MCPcopy Create free account
hub / github.com/ccxt/ccxt / encodeFunctionData

Method encodeFunctionData

ts/src/static_dependencies/ethers/interface.ts:874–885  ·  view source on GitHub ↗

* Encodes the ``tx.data`` for a transaction that calls the function * specified (see [[getFunction]] for valid values for %%fragment%%) with * the %%values%%.

(fragment: FunctionFragment | string, values?: ReadonlyArray<any>)

Source from the content-addressed store, hash-verified

872 * the %%values%%.
873 */
874 encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray<any>): string {
875 if (typeof(fragment) === "string") {
876 const f = this.getFunction(fragment);
877 assertArgument(f, "unknown function", "fragment", fragment);
878 fragment = f;
879 }
880
881 return concat([
882 fragment.selector,
883 this._encodeParams(fragment.inputs, values || [ ])
884 ]);
885 }
886
887 /**
888 * Decodes the result %%data%% (e.g. from an ``eth_call``) for the

Callers

nothing calls this directly

Calls 4

getFunctionMethod · 0.95
_encodeParamsMethod · 0.95
assertArgumentFunction · 0.90
concatFunction · 0.90

Tested by

no test coverage detected