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

Method decode

src.ts/abi/coders/array.ts:180–197  ·  view source on GitHub ↗
(reader: Reader)

Source from the content-addressed store, hash-verified

178 }
179
180 decode(reader: Reader): any {
181 let count = this.length;
182 if (count === -1) {
183 count = reader.readIndex();
184
185 // Check that there is *roughly* enough data to ensure
186 // stray random data is not being read as a length. Each
187 // slot requires at least 32 bytes for their value (or 32
188 // bytes as a link to the data). This could use a much
189 // tighter bound, but we are erroring on the side of safety.
190 assert(count * WordSize <= reader.dataLength, "insufficient data length",
191 "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });
192 }
193 let coders: Array<Coder> = [];
194 for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }
195
196 return unpack(reader, coders);
197 }
198}
199

Callers 1

unpackFunction · 0.45

Calls 3

assertFunction · 0.90
unpackFunction · 0.70
readIndexMethod · 0.45

Tested by

no test coverage detected