UNPKG

@kraken-crypto/ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41 lines (37 loc) 912 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); class AbiParser2 { constructor(abi) { this.abi = abi; } /** * abi method inputs length * @param abiMethod FunctionAbi * @returns number */ methodInputsLength(abiMethod) { return abiMethod.inputs.length; } /** * get method definition from abi * @param name string * @returns FunctionAbi | undefined */ getMethod(name) { const intf = this.abi.find((it) => it.type === 'interface'); return intf.items.find((it) => it.name === name); } /** * Get Abi in legacy format * @returns Abi */ getLegacyFormat() { return this.abi.flatMap((e) => { if (e.type === 'interface') { return e.items; } return e; }); } } exports.AbiParser2 = AbiParser2;