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

Method parseTransaction

lib.esm/abi/interface.js:1030–1039  ·  view source on GitHub ↗

* Parses a transaction, finding the matching function and extracts * the parameter values along with other useful function details. * * If the matching function cannot be found, return null.

(tx)

Source from the content-addressed store, hash-verified

1028 * If the matching function cannot be found, return null.
1029 */
1030 parseTransaction(tx) {
1031 const data = getBytes(tx.data, "tx.data");
1032 const value = getBigInt((tx.value != null) ? tx.value : 0, "tx.value");
1033 const fragment = this.getFunction(hexlify(data.slice(0, 4)));
1034 if (!fragment) {
1035 return null;
1036 }
1037 const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));
1038 return new TransactionDescription(fragment, fragment.selector, args, value);
1039 }
1040 parseCallResult(data) {
1041 throw new Error("@TODO");
1042 }

Callers 2

makeErrorMethod · 0.95
test-abi.jsFile · 0.45

Calls 6

getFunctionMethod · 0.95
getBytesFunction · 0.90
getBigIntFunction · 0.90
hexlifyFunction · 0.90
sliceMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected