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

Method decodeErrorResult

lib.commonjs/abi/interface.js:693–701  ·  view source on GitHub ↗

* Decodes the result %%data%% (e.g. from an ``eth_call``) for the * specified error (see [[getError]] for valid values for * %%key%%). * * Most developers should prefer the [[parseCallResult]] method instead, * which will automatically detect a ``CALL_EXCEPTION`` and th

(fragment, data)

Source from the content-addressed store, hash-verified

691 * corresponding error.
692 */
693 decodeErrorResult(fragment, data) {
694 if (typeof (fragment) === "string") {
695 const f = this.getError(fragment);
696 (0, index_js_3.assertArgument)(f, "unknown error", "fragment", fragment);
697 fragment = f;
698 }
699 (0, index_js_3.assertArgument)((0, index_js_3.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data);
700 return this._decodeParams(fragment.inputs, (0, index_js_3.dataSlice)(data, 4));
701 }
702 /**
703 * Encodes the transaction revert data for a call result that
704 * reverted from the the Contract with the sepcified %%error%%

Callers

nothing calls this directly

Calls 2

getErrorMethod · 0.95
_decodeParamsMethod · 0.95

Tested by

no test coverage detected