You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

no-yolo-signatures

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

no-yolo-signatures - npm Package Compare versions

Comparing version

to
0.0.1-alpha2

lib/networks.d.ts

8

lib/abiFetcher.d.ts

@@ -44,3 +44,7 @@ import { Result, RootError } from '@celo/base';

export declare const getAbisFromFetchers: (abiFetchers: AbiFetcher[], address: Address) => Promise<import("@celo/base").OkResult<JsonFragment[][]> | import("@celo/base").ErrorResult<NotFoundError>>;
export declare const celoAbiFetchers: (SourcifyAbiFetcher | ExplorerAbiFetcher | ProxyAbiFetcher)[];
export declare const ethAbiFetchers: (SourcifyAbiFetcher | ProxyAbiFetcher)[];
interface GetAbiFetcherOptions {
explorerAPIKey?: string;
accomodateRateLimit?: boolean;
}
export declare const getAbiFetchersForChainId: (chainId: number, opts?: GetAbiFetcherOptions | undefined) => (SourcifyAbiFetcher | ExplorerAbiFetcher | ProxyAbiFetcher)[];
export {};

@@ -57,6 +57,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ethAbiFetchers = exports.celoAbiFetchers = exports.getAbisFromFetchers = exports.ProxyAbiFetcher = exports.ExplorerAbiFetcher = exports.SourcifyAbiFetcher = exports.NotFoundError = exports.NoProxyError = exports.FetchingAbiError = exports.FetchAbiErrorTypes = void 0;
exports.getAbiFetchersForChainId = exports.getAbisFromFetchers = exports.ProxyAbiFetcher = exports.ExplorerAbiFetcher = exports.SourcifyAbiFetcher = exports.NotFoundError = exports.NoProxyError = exports.FetchingAbiError = exports.FetchAbiErrorTypes = void 0;
var base_1 = require("@celo/base");
var providers_1 = require("@ethersproject/providers");
var cross_fetch_1 = require("cross-fetch");
var networks_1 = require("./networks");
var proxy_v1_1 = __importDefault(require("./static/proxy-v1"));

@@ -256,18 +257,17 @@ var usdc_proxy_1 = __importDefault(require("./static/usdc-proxy"));

exports.getAbisFromFetchers = getAbisFromFetchers;
var celoSourcifyAbiFetcher = new SourcifyAbiFetcher(42220);
var celoBlockscoutAbiFetcher = new ExplorerAbiFetcher('https://explorer.celo.org');
var celoProvider = new providers_1.JsonRpcProvider('https://forno.celo.org');
var proxyAbiFetcher = new ProxyAbiFetcher(celoProvider, [
celoSourcifyAbiFetcher,
celoBlockscoutAbiFetcher,
]);
exports.celoAbiFetchers = [proxyAbiFetcher, celoSourcifyAbiFetcher, celoBlockscoutAbiFetcher];
var ethSourcifyAbiFetcher = new SourcifyAbiFetcher(1);
var etherscanAbiFetcher = new ExplorerAbiFetcher('https://api.etherscan.io');
var ethProvider = new providers_1.JsonRpcProvider('https://mainnet-nethermind.blockscout.com/');
var ethProxyAbiFetcher = new ProxyAbiFetcher(ethProvider, [
ethSourcifyAbiFetcher,
etherscanAbiFetcher,
]);
exports.ethAbiFetchers = [ethProxyAbiFetcher, ethSourcifyAbiFetcher];
var getAbiFetchersForChainId = function (chainId, opts) {
var sourcifyAbiFetcher = new SourcifyAbiFetcher(chainId);
var network = networks_1.NETWORKS[chainId];
if (!network) {
return [sourcifyAbiFetcher];
}
var explorerAbiFetcher = new ExplorerAbiFetcher(network.explorerAPIURL, opts === null || opts === void 0 ? void 0 : opts.explorerAPIKey);
var provider = new providers_1.JsonRpcProvider(network.rpcURL);
var proxyAbiFetcher = new ProxyAbiFetcher(provider, [sourcifyAbiFetcher, explorerAbiFetcher]);
if (opts === null || opts === void 0 ? void 0 : opts.accomodateRateLimit) {
return [proxyAbiFetcher, sourcifyAbiFetcher];
}
return [proxyAbiFetcher, explorerAbiFetcher, sourcifyAbiFetcher];
};
exports.getAbiFetchersForChainId = getAbiFetchersForChainId;
var stripMetadataFromBytecode = function (bytecode) {

@@ -274,0 +274,0 @@ // Docs:

@@ -1,2 +0,2 @@

import { Address, Transaction } from "./types";
import { Address, Transaction, TokenList, GenericAddressList } from "./types";
export declare enum AddressInfoType {

@@ -40,20 +40,2 @@ TokenListInfo = "tokenListInfo",

}
interface TokenList {
tokens: Array<{
chainId: number;
symbol: string;
address: Address;
name: string;
logoURI: string;
}>;
}
interface GenericAddressList {
addresses: Array<{
chainId: number;
address: Address;
name: string;
description: string;
logoURI: string;
}>;
}
export declare class TokenListAddressInfoFetcher implements AddressInfoFetcher {

@@ -72,3 +54,3 @@ readonly tokenList: TokenList;

}
export declare const celoAddressInfoFetchers: (GenericAddressListInfoFetcher | TokenListAddressInfoFetcher | ContextAddressInfoFetcher)[];
export declare const getAddressInfoFetchersForChainId: (chainId: number) => (TokenListAddressInfoFetcher | GenericAddressListInfoFetcher | ContextAddressInfoFetcher)[];
export {};

@@ -13,9 +13,5 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.celoAddressInfoFetchers = exports.ContextAddressInfoFetcher = exports.GenericAddressListInfoFetcher = exports.TokenListAddressInfoFetcher = exports.ContextInfoType = exports.AddressInfoType = void 0;
var celoTokenList_json_1 = __importDefault(require("./static/celoTokenList.json"));
var celoGenericAddressList_json_1 = __importDefault(require("./static/celoGenericAddressList.json"));
exports.getAddressInfoFetchersForChainId = exports.ContextAddressInfoFetcher = exports.GenericAddressListInfoFetcher = exports.TokenListAddressInfoFetcher = exports.ContextInfoType = exports.AddressInfoType = void 0;
var _1 = require(".");
var AddressInfoType;

@@ -74,3 +70,15 @@ (function (AddressInfoType) {

exports.ContextAddressInfoFetcher = ContextAddressInfoFetcher;
exports.celoAddressInfoFetchers = [new GenericAddressListInfoFetcher(celoGenericAddressList_json_1.default), new TokenListAddressInfoFetcher(celoTokenList_json_1.default), new ContextAddressInfoFetcher()];
var getAddressInfoFetchersForChainId = function (chainId) {
var contextFetcher = new ContextAddressInfoFetcher();
var network = _1.NETWORKS[chainId];
if (!network) {
return [contextFetcher];
}
return [
network.genericAddressList ? [new GenericAddressListInfoFetcher(network.genericAddressList)] : [],
network.tokenList ? [new TokenListAddressInfoFetcher(network.tokenList)] : [],
[contextFetcher]
].flat();
};
exports.getAddressInfoFetchersForChainId = getAddressInfoFetchersForChainId;
//# sourceMappingURL=addressInfo.js.map

@@ -41,11 +41,12 @@ "use strict";

var _1 = require(".");
var abiFetcher_1 = require("./abiFetcher");
var parser_1 = require("./parser");
function main() {
return __awaiter(this, void 0, void 0, function () {
var parser, provider, parseResult, txHash, tx, parseResult;
var celoAbiFetchers, celoAddressInfoFetchers, parser, provider, parseResult, txHash, tx, parseResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
parser = new parser_1.Parser({ abiFetchers: abiFetcher_1.celoAbiFetchers, addressInfoFetchers: _1.celoAddressInfoFetchers });
celoAbiFetchers = (0, _1.getAbiFetchersForChainId)(42220);
celoAddressInfoFetchers = (0, _1.getAddressInfoFetchersForChainId)(42220);
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers, addressInfoFetchers: celoAddressInfoFetchers });
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org');

@@ -52,0 +53,0 @@ if (!(process.argv.length > 3)) return [3 /*break*/, 2];

@@ -5,1 +5,2 @@ export * from './abiFetcher';

export * from './addressInfo';
export * from './networks';

@@ -17,2 +17,3 @@ "use strict";

__exportStar(require("./addressInfo"), exports);
__exportStar(require("./networks"), exports);
//# sourceMappingURL=index.js.map

@@ -40,6 +40,8 @@ "use strict";

var ethers_1 = require("ethers");
var addressInfo_1 = require("./addressInfo");
var abiFetcher_1 = require("./abiFetcher");
var _1 = require(".");
var parser_1 = require("./parser");
// Real network tests
var celoAbiFetchers = (0, _1.getAbiFetchersForChainId)(42220);
var ethAbiFetchers = (0, _1.getAbiFetchersForChainId)(1, { accomodateRateLimit: true });
var celoAddressInfoFetchers = (0, _1.getAddressInfoFetchersForChainId)(42220);
describe('Real transaction tests', function () {

@@ -51,3 +53,3 @@ it('can properly decode a basic Celo TX', function () { return __awaiter(void 0, void 0, void 0, function () {

case 0:
parser = new parser_1.Parser({ abiFetchers: abiFetcher_1.celoAbiFetchers, addressInfoFetchers: addressInfo_1.celoAddressInfoFetchers });
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers, addressInfoFetchers: celoAddressInfoFetchers });
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org');

@@ -79,3 +81,3 @@ txHash = '0x13c0fb425956878519a59cb67ad0f76f2399223c84b8fe5383f005d38b75c345';

case 0:
parser = new parser_1.Parser({ abiFetchers: abiFetcher_1.celoAbiFetchers });
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers });
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org');

@@ -104,3 +106,3 @@ txHash = '0x3d17faf7c8e9e5fdc69570c9b620cf5eb79db2e3e3c1bb6f9f1e1cd72184aeb9';

case 0:
parser = new parser_1.Parser({ abiFetchers: abiFetcher_1.ethAbiFetchers });
parser = new parser_1.Parser({ abiFetchers: ethAbiFetchers });
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://mainnet-nethermind.blockscout.com/');

@@ -107,0 +109,0 @@ txHash = '0xb87ec0c256b81be5ca98040e58f27483167c773ef38c024e71e209410f8d26b3';

@@ -14,1 +14,19 @@ import { BigNumberish } from 'ethers';

}
export interface TokenList {
tokens: Array<{
chainId: number;
symbol: string;
address: Address;
name: string;
logoURI: string;
}>;
}
export interface GenericAddressList {
addresses: Array<{
chainId: number;
address: Address;
name: string;
description: string;
logoURI: string;
}>;
}
{
"name": "no-yolo-signatures",
"version": "0.0.1-alpha1",
"version": "0.0.1-alpha2",
"description": "Tooling to discourage yolo tx signing",

@@ -5,0 +5,0 @@ "author": "Nam Chu Hoai",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet