UNPKG

ccxt

Version:

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

37 lines (34 loc) 1.02 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 import { isLen } from '../cairo.js'; export class AbiParser1 { constructor(abi) { this.abi = abi; } /** * abi method inputs length without '_len' inputs * cairo 0 reducer * @param abiMethod FunctionAbi * @returns number */ methodInputsLength(abiMethod) { return abiMethod.inputs.reduce((acc, input) => (!isLen(input.name) ? acc + 1 : acc), 0); } /** * get method definition from abi * @param name string * @returns FunctionAbi | undefined */ getMethod(name) { return this.abi.find((it) => it.name === name); } /** * Get Abi in legacy format * @returns Abi */ getLegacyFormat() { return this.abi; } }