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

Method parseTransaction

src.ts/abi/interface.ts:1193–1203  ·  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: { data: string, value?: BigNumberish })

Source from the content-addressed store, hash-verified

1191 * If the matching function cannot be found, return null.
1192 */
1193 parseTransaction(tx: { data: string, value?: BigNumberish }): null | TransactionDescription {
1194 const data = getBytes(tx.data, "tx.data");
1195 const value = getBigInt((tx.value != null) ? tx.value: 0, "tx.value");
1196
1197 const fragment = this.getFunction(hexlify(data.slice(0, 4)));
1198
1199 if (!fragment) { return null; }
1200
1201 const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));
1202 return new TransactionDescription(fragment, fragment.selector, args, value);
1203 }
1204
1205 parseCallResult(data: BytesLike): Result {
1206 throw new Error("@TODO");

Callers 2

makeErrorMethod · 0.95
test-abi.tsFile · 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