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

Method encode

lib.commonjs/abi/abi-coder.js:165–172  ·  view source on GitHub ↗

* Encode the %%values%% as the %%types%% into ABI data. * * @returns DataHexstring

(types, values)

Source from the content-addressed store, hash-verified

163 * @returns DataHexstring
164 */
165 encode(types, values) {
166 (0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch");
167 const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type)));
168 const coder = (new tuple_js_1.TupleCoder(coders, "_"));
169 const writer = new abstract_coder_js_1.Writer();
170 coder.encode(writer, values);
171 return writer.data;
172 }
173 /**
174 * Decode the ABI %%data%% as the %%types%% into values.
175 *

Callers 6

test-abi.jsFile · 0.45
_encodeParamsMethod · 0.45
encodeFunctionResultMethod · 0.45
encodeTopicMethod · 0.45
encodeEventLogMethod · 0.45

Calls 3

#getCoderMethod · 0.95
mapMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected