MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / encodeFunctionData

Method encodeFunctionData

src.ts/abi/interface.ts:875–886  ·  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

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

Callers 3

#fetchMethod · 0.45
populateTransactionFunction · 0.45
test-abi.tsFile · 0.45

Calls 4

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

Tested by

no test coverage detected