UNPKG

ccxt

Version:

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges

41 lines (38 loc) 1.09 kB
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD export 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; }); } }