UNPKG

@kraken-crypto/ccxt

Version:

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

31 lines (30 loc) 736 B
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; } }