no-yolo-signatures
Advanced tools
Comparing version
@@ -44,3 +44,10 @@ 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 { | ||
rpcUrls?: { | ||
[chainId: number]: string; | ||
}; | ||
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")); | ||
@@ -101,2 +102,19 @@ var usdc_proxy_1 = __importDefault(require("./static/usdc-proxy")); | ||
exports.NotFoundError = NotFoundError; | ||
var fetchAsResult = function (input) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res, error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, cross_fetch_1.fetch)(input)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, (0, base_1.Ok)(res)]; | ||
case 2: | ||
error_1 = _a.sent(); | ||
return [2 /*return*/, Promise.resolve((0, base_1.Err)(new FetchingAbiError(error_1)))]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
var SourcifyAbiFetcher = /** @class */ (function () { | ||
@@ -108,12 +126,15 @@ function SourcifyAbiFetcher(chainId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var request, data, abi; | ||
var requestResult, data, abi; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, cross_fetch_1.fetch)("https://repo.sourcify.dev/contracts/full_match/" + this.chainId + "/" + address + "/metadata.json")]; | ||
case 0: return [4 /*yield*/, fetchAsResult("https://repo.sourcify.dev/contracts/full_match/" + this.chainId + "/" + address + "/metadata.json")]; | ||
case 1: | ||
request = _a.sent(); | ||
if (!request.ok) { | ||
requestResult = _a.sent(); | ||
if (!requestResult.ok) { | ||
return [2 /*return*/, requestResult]; | ||
} | ||
if (!requestResult.result.ok) { | ||
return [2 /*return*/, (0, base_1.Err)(new FetchingAbiError(new Error('Could not fetch ABI')))]; | ||
} | ||
return [4 /*yield*/, request.json()]; | ||
return [4 /*yield*/, requestResult.result.json()]; | ||
case 2: | ||
@@ -137,3 +158,3 @@ data = _a.sent(); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var apiKeyS, request, data, abi; | ||
var apiKeyS, requestResult, data, abi; | ||
return __generator(this, function (_a) { | ||
@@ -143,9 +164,12 @@ switch (_a.label) { | ||
apiKeyS = this.apiKey ? "&apikey=" + this.apiKey : ''; | ||
return [4 /*yield*/, (0, cross_fetch_1.fetch)(this.baseUrl + "/api?module=contract&action=getabi&address=" + address + apiKeyS)]; | ||
return [4 /*yield*/, fetchAsResult(this.baseUrl + "/api?module=contract&action=getabi&address=" + address + apiKeyS)]; | ||
case 1: | ||
request = _a.sent(); | ||
if (!request.ok) { | ||
return [2 /*return*/, (0, base_1.Err)(new FetchingAbiError(new Error('Could not fetch ABI. Status:' + request.status)))]; | ||
requestResult = _a.sent(); | ||
if (!requestResult.ok) { | ||
return [2 /*return*/, requestResult]; | ||
} | ||
return [4 /*yield*/, request.json()]; | ||
if (!requestResult.result.ok) { | ||
return [2 /*return*/, (0, base_1.Err)(new FetchingAbiError(new Error('Could not fetch ABI. Status:' + requestResult.result.status)))]; | ||
} | ||
return [4 /*yield*/, requestResult.result.json()]; | ||
case 2: | ||
@@ -237,18 +261,19 @@ data = _a.sent(); | ||
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(42220); | ||
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 _a; | ||
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 rpcUrl = ((_a = opts === null || opts === void 0 ? void 0 : opts.rpcUrls) === null || _a === void 0 ? void 0 : _a[chainId]) || network.rpcURL; | ||
var provider = new providers_1.JsonRpcProvider(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) { | ||
@@ -255,0 +280,0 @@ // Docs: |
@@ -40,14 +40,18 @@ "use strict"; | ||
var ethers_1 = require("ethers"); | ||
var abiFetcher_1 = require("./abiFetcher"); | ||
var _1 = require("."); | ||
var parser_1 = require("./parser"); | ||
function main() { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var parser, provider, txDescription, txHash, tx, txDescription; | ||
var celoAbiFetchers, celoAddressInfoFetchers, parser, provider, parseResult, txHash, tx, parseResult; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
parser = new parser_1.Parser(abiFetcher_1.celoAbiFetchers); | ||
celoAbiFetchers = (0, _1.getAbiFetchersForChainId)(42220); | ||
return [4 /*yield*/, (0, _1.getAddressInfoFetchersForChainId)(42220)]; | ||
case 1: | ||
celoAddressInfoFetchers = _a.sent(); | ||
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers, addressInfoFetchers: celoAddressInfoFetchers }); | ||
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org'); | ||
if (!(process.argv.length > 3)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, parser.parse({ | ||
if (!(process.argv.length > 3)) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, parser.parseAsResult({ | ||
from: '', | ||
@@ -58,12 +62,17 @@ to: process.argv[2], | ||
})]; | ||
case 1: | ||
txDescription = _a.sent(); | ||
console.log(parser.formatTxDescriptionToHuman(txDescription)); | ||
return [3 /*break*/, 5]; | ||
case 2: | ||
parseResult = _a.sent(); | ||
if (!parseResult.transactionDescription.ok) { | ||
console.log('Could not decode transaction'); | ||
return [2 /*return*/]; | ||
} | ||
console.log("To: " + parser.formatAddress(process.argv[2], parseResult.addressInfo)); | ||
console.log(parser.formatTxDescriptionToHuman(parseResult.transactionDescription.result, parseResult.addressInfo)); | ||
return [3 /*break*/, 6]; | ||
case 3: | ||
txHash = process.argv[2]; | ||
return [4 /*yield*/, provider.getTransaction(txHash)]; | ||
case 3: | ||
case 4: | ||
tx = _a.sent(); | ||
return [4 /*yield*/, parser.parse({ | ||
return [4 /*yield*/, parser.parseAsResult({ | ||
from: tx.from, | ||
@@ -74,7 +83,11 @@ to: tx.to, | ||
})]; | ||
case 4: | ||
txDescription = _a.sent(); | ||
console.log(parser.formatTxDescriptionToHuman(txDescription)); | ||
_a.label = 5; | ||
case 5: return [2 /*return*/]; | ||
case 5: | ||
parseResult = _a.sent(); | ||
if (!parseResult.transactionDescription.ok) { | ||
console.log('Could not decode transaction'); | ||
return [2 /*return*/]; | ||
} | ||
console.log(parser.formatTxDescriptionToHuman(parseResult.transactionDescription.result, parseResult.addressInfo)); | ||
_a.label = 6; | ||
case 6: return [2 /*return*/]; | ||
} | ||
@@ -81,0 +94,0 @@ }); |
export * from './abiFetcher'; | ||
export * from './parser'; | ||
export * from './types'; | ||
export * from './addressInfo'; | ||
export * from './networks'; |
@@ -16,2 +16,4 @@ "use strict"; | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./addressInfo"), exports); | ||
__exportStar(require("./networks"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,6 @@ | ||
import { Address, Result, RootError } from '@celo/base'; | ||
import { Result, RootError } from '@celo/base'; | ||
import { TransactionDescription } from '@ethersproject/abi'; | ||
import { BigNumberish } from 'ethers'; | ||
import { AbiFetcher, FetchAbiError } from './abiFetcher'; | ||
import { BytesAsString } from './types'; | ||
import { AddressFetchResult, AddressInfoFetcher } from './addressInfo'; | ||
import { Transaction } from './types'; | ||
export declare enum ParserErrorTypes { | ||
@@ -21,10 +21,13 @@ NoAbiFetchers = "NoAbiFetchers", | ||
export declare type ParserErrors = FetchAbiError | AbiMismatchError | UnknownError | NoAbiFetchersError; | ||
interface Transaction { | ||
from: Address; | ||
to: Address; | ||
data: BytesAsString; | ||
value: BigNumberish; | ||
interface ParserConstructorOpts { | ||
abiFetchers?: AbiFetcher[]; | ||
addressInfoFetchers?: AddressInfoFetcher[]; | ||
} | ||
export interface ParserResult { | ||
transactionDescription: Result<TransactionDescription, ParserErrors>; | ||
addressInfo: AddressFetchResult; | ||
} | ||
export declare class Parser { | ||
readonly abiFetchers: AbiFetcher[]; | ||
readonly addressInfoFetchers: AddressInfoFetcher[]; | ||
/** | ||
@@ -34,8 +37,12 @@ * Creates a new instance of the parser | ||
*/ | ||
constructor(abiFetchers: AbiFetcher[]); | ||
parseAsResult(tx: Transaction): Promise<Result<TransactionDescription, ParserErrors>>; | ||
parse: (tx: Transaction) => Promise<TransactionDescription>; | ||
constructor(opts: ParserConstructorOpts); | ||
parseAsResult(tx: Transaction): Promise<ParserResult>; | ||
getAddressInfo(tx: Transaction, txDescriptionResult: Result<TransactionDescription, ParserErrors>): Promise<AddressFetchResult>; | ||
private collectAddressesFromParam; | ||
parseTransactionDescriptionAsResult(tx: Transaction): Promise<Result<TransactionDescription, ParserErrors>>; | ||
parseTransactionDescription: (tx: Transaction) => Promise<TransactionDescription>; | ||
private formatParam; | ||
formatTxDescriptionToHuman(description: TransactionDescription): string; | ||
formatAddress(address: string, addressInfo?: AddressFetchResult): string; | ||
formatTxDescriptionToHuman(description: TransactionDescription, addressInfo?: AddressFetchResult): string; | ||
} | ||
export {}; | ||
export { TransactionDescription } from '@ethersproject/abi'; |
@@ -54,5 +54,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Parser = exports.UnknownError = exports.AbiMismatchError = exports.NoAbiFetchersError = exports.ParserErrorTypes = void 0; | ||
exports.TransactionDescription = exports.Parser = exports.UnknownError = exports.AbiMismatchError = exports.NoAbiFetchersError = exports.ParserErrorTypes = void 0; | ||
var base_1 = require("@celo/base"); | ||
var abi_1 = require("@ethersproject/abi"); | ||
var _1 = require("."); | ||
var abiFetcher_1 = require("./abiFetcher"); | ||
@@ -100,8 +101,77 @@ var ParserErrorTypes; | ||
*/ | ||
function Parser(abiFetchers) { | ||
this.abiFetchers = abiFetchers; | ||
this.parse = (0, base_1.makeAsyncThrowable)(this.parseAsResult.bind(this)); | ||
function Parser(opts) { | ||
this.parseTransactionDescription = (0, base_1.makeAsyncThrowable)(this.parseTransactionDescriptionAsResult.bind(this)); | ||
this.abiFetchers = opts.abiFetchers ? opts.abiFetchers : []; | ||
this.addressInfoFetchers = opts.addressInfoFetchers ? opts.addressInfoFetchers : []; | ||
} | ||
Parser.prototype.parseAsResult = function (tx) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var transactionDescription, addressInfo; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.parseTransactionDescriptionAsResult(tx)]; | ||
case 1: | ||
transactionDescription = _a.sent(); | ||
return [4 /*yield*/, this.getAddressInfo(tx, transactionDescription)]; | ||
case 2: | ||
addressInfo = _a.sent(); | ||
return [2 /*return*/, { | ||
transactionDescription: transactionDescription, | ||
addressInfo: addressInfo | ||
}]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Parser.prototype.getAddressInfo = function (tx, txDescriptionResult) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var addresses, addressesFromTxDescription, context, result, ret; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
addresses = [tx.from, tx.to]; | ||
if (txDescriptionResult.ok) { | ||
addressesFromTxDescription = txDescriptionResult.result.args.flatMap(function (arg, index) { | ||
var fragment = txDescriptionResult.result.functionFragment.inputs[index]; | ||
return _this.collectAddressesFromParam(arg, fragment); | ||
}); | ||
addresses.push.apply(addresses, addressesFromTxDescription); | ||
} | ||
context = { tx: tx }; | ||
return [4 /*yield*/, Promise.all(addresses.map(function (address) { return __awaiter(_this, void 0, void 0, function () { | ||
var info; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, Promise.all(this.addressInfoFetchers.map(function (_) { return _.fetchInfo(address, context); }))]; | ||
case 1: | ||
info = _a.sent(); | ||
return [2 /*return*/, [address, info.flat()]]; | ||
} | ||
}); | ||
}); }))]; | ||
case 1: | ||
result = _a.sent(); | ||
ret = {}; | ||
result.forEach(function (_a) { | ||
var address = _a[0], info = _a[1]; | ||
return ret[address] = info; | ||
}); | ||
return [2 /*return*/, ret]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Parser.prototype.collectAddressesFromParam = function (paramValue, paramType) { | ||
var _this = this; | ||
if (paramType.arrayChildren) { | ||
return paramValue.flatMap(function (arg) { return _this.collectAddressesFromParam(arg, paramType.arrayChildren); }); | ||
} | ||
if (paramType.type === 'address') { | ||
return [paramValue]; | ||
} | ||
return []; | ||
}; | ||
Parser.prototype.parseTransactionDescriptionAsResult = function (tx) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var abis, abiInterface, data; | ||
@@ -136,7 +206,7 @@ return __generator(this, function (_a) { | ||
}; | ||
Parser.prototype.formatParam = function (paramValue, paramType) { | ||
Parser.prototype.formatParam = function (paramValue, paramType, addressInfo) { | ||
var _this = this; | ||
if (paramType.arrayChildren) { | ||
return "[" + paramValue | ||
.map(function (el) { return _this.formatParam(el, paramType.arrayChildren); }) | ||
.map(function (el) { return _this.formatParam(el, paramType.arrayChildren, addressInfo); }) | ||
.join(', ') + "]"; | ||
@@ -148,7 +218,21 @@ } | ||
if (paramType.type === 'address') { | ||
return "\"" + paramValue + "\""; | ||
return "\"" + this.formatAddress(paramValue, addressInfo) + "\""; | ||
} | ||
return paramValue; | ||
}; | ||
Parser.prototype.formatTxDescriptionToHuman = function (description) { | ||
Parser.prototype.formatAddress = function (address, addressInfo) { | ||
if (!addressInfo) | ||
return address; | ||
var addyInfo = addressInfo[address]; | ||
if (addyInfo.length === 0) | ||
return address; | ||
switch (addyInfo[0].type) { | ||
case _1.AddressInfoType.TokenListInfo: | ||
return "Token: " + addyInfo[0].name + " (" + addyInfo[0].symbol + ")"; | ||
case _1.AddressInfoType.GenericAddressInfo: | ||
return addyInfo[0].name; | ||
} | ||
return address; | ||
}; | ||
Parser.prototype.formatTxDescriptionToHuman = function (description, addressInfo) { | ||
var _this = this; | ||
@@ -158,3 +242,3 @@ var functionName = description.name; | ||
var fragment = description.functionFragment.inputs[index]; | ||
return fragment.name + ": " + _this.formatParam(arg, fragment); | ||
return fragment.name + ": " + _this.formatParam(arg, fragment, addressInfo); | ||
}); | ||
@@ -166,2 +250,4 @@ return functionName + "(" + inputs.join(', ') + ")"; | ||
exports.Parser = Parser; | ||
var abi_2 = require("@ethersproject/abi"); | ||
Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return abi_2.TransactionDescription; } }); | ||
//# sourceMappingURL=parser.js.map |
@@ -40,12 +40,25 @@ "use strict"; | ||
var ethers_1 = require("ethers"); | ||
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; | ||
describe('Real transaction tests', function () { | ||
beforeAll(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, _1.getAddressInfoFetchersForChainId)(42220)]; | ||
case 1: | ||
celoAddressInfoFetchers = _a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
it('can properly decode a basic Celo TX', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var parser, provider, txHash, tx, txDescription; | ||
var parser, provider, txHash, tx, result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
parser = new parser_1.Parser(abiFetcher_1.celoAbiFetchers); | ||
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers, addressInfoFetchers: celoAddressInfoFetchers }); | ||
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org'); | ||
@@ -56,3 +69,3 @@ txHash = '0x13c0fb425956878519a59cb67ad0f76f2399223c84b8fe5383f005d38b75c345'; | ||
tx = _a.sent(); | ||
return [4 /*yield*/, parser.parse({ | ||
return [4 /*yield*/, parser.parseAsResult({ | ||
from: tx.from, | ||
@@ -64,4 +77,7 @@ to: tx.to, | ||
case 2: | ||
txDescription = _a.sent(); | ||
expect(parser.formatTxDescriptionToHuman(txDescription)).toEqual("swapExactTokensForTokens(amountIn: 10768150309273298380, amountOutMin: 1868254991157015353, path: [\"0x73a210637f6F6B7005512677Ba6B3C96bb4AA44B\", \"0x471EcE3750Da237f93B8E339c536989b8978a438\", \"0xa8d0E6799FF3Fd19c6459bf02689aE09c4d78Ba7\"], to: \"0x2fcE67597ffbc863dFE8Cec25cCbE80961768CE8\", deadline: 1634594476)"); | ||
result = _a.sent(); | ||
if (!result.transactionDescription.ok) { | ||
throw new Error(); | ||
} | ||
expect(parser.formatTxDescriptionToHuman(result.transactionDescription.result)).toEqual("swapExactTokensForTokens(amountIn: 10768150309273298380, amountOutMin: 1868254991157015353, path: [\"0x73a210637f6F6B7005512677Ba6B3C96bb4AA44B\", \"0x471EcE3750Da237f93B8E339c536989b8978a438\", \"0xa8d0E6799FF3Fd19c6459bf02689aE09c4d78Ba7\"], to: \"0x2fcE67597ffbc863dFE8Cec25cCbE80961768CE8\", deadline: 1634594476)"); | ||
return [2 /*return*/]; | ||
@@ -76,3 +92,3 @@ } | ||
case 0: | ||
parser = new parser_1.Parser(abiFetcher_1.celoAbiFetchers); | ||
parser = new parser_1.Parser({ abiFetchers: celoAbiFetchers }); | ||
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://forno.celo.org'); | ||
@@ -83,3 +99,3 @@ txHash = '0x3d17faf7c8e9e5fdc69570c9b620cf5eb79db2e3e3c1bb6f9f1e1cd72184aeb9'; | ||
tx = _a.sent(); | ||
return [4 /*yield*/, parser.parse({ | ||
return [4 /*yield*/, parser.parseTransactionDescription({ | ||
from: tx.from, | ||
@@ -102,3 +118,3 @@ to: tx.to, | ||
case 0: | ||
parser = new parser_1.Parser(abiFetcher_1.ethAbiFetchers); | ||
parser = new parser_1.Parser({ abiFetchers: ethAbiFetchers }); | ||
provider = new ethers_1.ethers.providers.JsonRpcProvider('https://mainnet-nethermind.blockscout.com/'); | ||
@@ -109,3 +125,3 @@ txHash = '0xb87ec0c256b81be5ca98040e58f27483167c773ef38c024e71e209410f8d26b3'; | ||
tx = _a.sent(); | ||
return [4 /*yield*/, parser.parse({ | ||
return [4 /*yield*/, parser.parseTransactionDescription({ | ||
from: tx.from, | ||
@@ -112,0 +128,0 @@ to: tx.to, |
@@ -0,1 +1,2 @@ | ||
import { BigNumberish } from 'ethers'; | ||
export declare type Address = string; | ||
@@ -7,1 +8,27 @@ export declare type BytesAsString = string; | ||
} | ||
export interface Transaction { | ||
from: Address; | ||
to: Address; | ||
data: BytesAsString; | ||
value: BigNumberish; | ||
} | ||
export interface TokenListEntry { | ||
chainId: number; | ||
symbol: string; | ||
address: Address; | ||
name: string; | ||
logoURI: string; | ||
} | ||
export interface TokenList { | ||
tokens: TokenListEntry[]; | ||
} | ||
export interface GenericAddressListEntry { | ||
chainId: number; | ||
address: Address; | ||
name: string; | ||
description: string; | ||
logoURI: string; | ||
} | ||
export interface GenericAddressList { | ||
addresses: GenericAddressListEntry[]; | ||
} |
{ | ||
"name": "no-yolo-signatures", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Tooling to discourage yolo tx signing", | ||
@@ -11,2 +11,3 @@ "author": "Nam Chu Hoai", | ||
"prepublishOnly": "yarn build", | ||
"prepare": "yarn build", | ||
"build": "tsc -b .", | ||
@@ -24,7 +25,7 @@ "clean": "tsc -b . --clean", | ||
"dependencies": { | ||
"@celo/base": "1.3.0", | ||
"@celo/base": "1.3.3", | ||
"@ethersproject/abi": "5.4.1", | ||
"@ethersproject/abstract-provider": "^5.4.0", | ||
"cross-fetch": "3.0.4", | ||
"ethers": "5.4.7" | ||
"ethers": "^5.5.2" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
136984
105.07%35
40%2122
157.84%1
-50%69
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated