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

Method parseTransaction

lib.commonjs/abi/interface.js:1038–1047  ·  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

1036 * If the matching function cannot be found, return null.
1037 */
1038 parseTransaction(tx) {
1039 const data = (0, index_js_3.getBytes)(tx.data, "tx.data");
1040 const value = (0, index_js_3.getBigInt)((tx.value != null) ? tx.value : 0, "tx.value");
1041 const fragment = this.getFunction((0, index_js_3.hexlify)(data.slice(0, 4)));
1042 if (!fragment) {
1043 return null;
1044 }
1045 const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));
1046 return new TransactionDescription(fragment, fragment.selector, args, value);
1047 }
1048 parseCallResult(data) {
1049 throw new Error("@TODO");
1050 }

Callers 2

makeErrorMethod · 0.95
test-abi.jsFile · 0.45

Calls 3

getFunctionMethod · 0.95
sliceMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected