* Encode the %%values%% as the %%types%% into ABI data. * * @returns DataHexstring
(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>)
| 118 | * @returns DataHexstring |
| 119 | */ |
| 120 | encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string { |
| 121 | assertArgumentCount(values.length, types.length, "types/values length mismatch"); |
| 122 | |
| 123 | const coders = types.map((type) => this.#getCoder(ParamType.from(type))); |
| 124 | const coder = (new TupleCoder(coders, "_")); |
| 125 | |
| 126 | const writer = new Writer(); |
| 127 | coder.encode(writer, values); |
| 128 | return writer.data; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Decode the ABI %%data%% as the %%types%% into values. |