New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jpmonette/bscscan

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jpmonette/bscscan - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.coveralls.yml

8

index.ts

@@ -1,9 +0,11 @@

import { BscScan } from "./lib/client";
import { BscScan } from "./src/client";
import "isomorphic-fetch";
(async () => {
const client = new BscScan({});
const client = new BscScan({ apikey: "KG7G8MTDUJAE41DH4Y5E8QD9FFU8ZG187J" });
try {
const minedblocks = await client.accounts.getBalance({ address: "0x4e656459ed25bf986eea1196bc1b00665401645d" });
const minedblocks = await client.transactions.getTxReceiptStatus({
txhash: "0xe9975702518c79caf81d5da65dea689dcac701fcdd063f848d4f03c85392fd00",
});
console.log(minedblocks);

@@ -10,0 +12,0 @@ } catch (e) {

export default {
preset: "ts-jest",
testEnvironment: "node",
testPathIgnorePatterns: ["/node_modules/", "__tests__/util/"],
testRegex: "(/__tests__/.*\\.test)\\.(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
};
{
"name": "@jpmonette/bscscan",
"version": "0.1.1",
"description": "BscScan TypeScript API",
"version": "0.2.0",
"description": "Explore the Binance Smart Chain using TypeScript and JavaScript",
"homepage": "https://github.com/jpmonette/bscscan-ts",

@@ -19,3 +19,3 @@ "author": "Jean-Philippe Monette <contact@jpmonette.net>",

"build": "rimraf lib/ && mkdir lib && tsc",
"test": "export NODE_ENV=test && npx jest --silent --passWithNoTests",
"test": "export NODE_ENV=test && npx jest --silent --passWithNoTests --coverage && coveralls < coverage/lcov.info",
"test-travis": "yarn test"

@@ -22,0 +22,0 @@ },

import { Accounts } from "./modules/accounts";
import { Contracts } from "./modules/contracts";
import { Stats } from "./modules/stats";
import { Transactions } from "./modules/transactions";
import { APIResponse, BscScanOptions } from "./typings";

@@ -11,4 +13,6 @@

accounts: Accounts;
contracts: Contracts;
transactions: Transactions;
stats: Stats;
accounts: Accounts;

@@ -20,7 +24,10 @@ constructor(opts: BscScanOptions) {

this.baseUrl = opts.baseUrl || BASE_URL;
this.accounts = new Accounts(this);
this.contracts = new Contracts(this);
this.stats = new Stats(this);
this.accounts = new Accounts(this);
this.transactions = new Transactions(this);
}
async query(module: string, action: string, opts: Record<string, any> = {}): Promise<any> {
newRequest(method = "GET", module: string, action: string, opts: Record<string, any> = {}): Request {
const params = new URLSearchParams({ module, action });

@@ -43,3 +50,3 @@

const init: RequestInit = { method: "GET", headers };
const init: RequestInit = { method, headers };

@@ -49,6 +56,10 @@ const url = new URL("/api?" + params.toString(), BASE_URL);

const request = new Request(url.toString(), init);
return this.do(request);
return request;
}
private async do<T>(request: Request): Promise<T> {
async query(module: string, action: string, opts: Record<string, any> = {}): Promise<any> {
return this.do(this.newRequest("GET", module, action, opts));
}
async do<T>(request: Request): Promise<T> {
const response: Response = await fetch(request);

@@ -55,0 +66,0 @@ const responseBody: APIResponse<T> = await response.json();

export * from "./accounts";
export * from "./contracts";
export * from "./stats";
export * from "./transactions";

@@ -4,0 +6,0 @@ /**

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc