* Decodes the %%data%% from a transaction ``tx.data`` for * the function specified (see [[getFunction]] for valid values * for %%fragment%%). * * Most developers should prefer the [[parseTransaction]] method * instead, which will automatically detect the fragment.
(fragment, data)
| 630 | * instead, which will automatically detect the fragment. |
| 631 | */ |
| 632 | decodeFunctionData(fragment, data) { |
| 633 | if (typeof (fragment) === "string") { |
| 634 | const f = this.getFunction(fragment); |
| 635 | assertArgument(f, "unknown function", "fragment", fragment); |
| 636 | fragment = f; |
| 637 | } |
| 638 | assertArgument(dataSlice(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); |
| 639 | return this._decodeParams(fragment.inputs, dataSlice(data, 4)); |
| 640 | } |
| 641 | /** |
| 642 | * Encodes the ``tx.data`` for a transaction that calls the function |
| 643 | * specified (see [[getFunction]] for valid values for %%fragment%%) with |
nothing calls this directly
no test coverage detected