MCPcopy Create free account
hub / github.com/ccxt/ccxt / encode

Method encode

js/src/static_dependencies/ethers/coders/array.js:122–138  ·  view source on GitHub ↗
(writer, _value)

Source from the content-addressed store, hash-verified

120 return result;
121 }
122 encode(writer, _value) {
123 const value = Typed.dereference(_value, "array");
124 if (!Array.isArray(value)) {
125 this._throwError("expected array value", value);
126 }
127 let count = this.length;
128 if (count === -1) {
129 count = value.length;
130 writer.writeValue(value.length);
131 }
132 assertArgumentCount(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : ""));
133 let coders = [];
134 for (let i = 0; i < value.length; i++) {
135 coders.push(this.coder);
136 }
137 return pack(writer, coders, value);
138 }
139 decode(reader) {
140 let count = this.length;
141 if (count === -1) {

Callers 1

packFunction · 0.45

Calls 7

assertArgumentCountFunction · 0.90
_throwErrorMethod · 0.80
pushMethod · 0.80
packFunction · 0.70
dereferenceMethod · 0.45
isArrayMethod · 0.45
writeValueMethod · 0.45

Tested by

no test coverage detected