INNER CODE UNIT · TypeScript

at

blueshift-gg/doppler · packages/core/index.ts:256

      const at = HEADER + slot.offset;
      if (slot.len === 1) {
        put(view, at, slot, x);
      } else {
        if (!Array.isArray(x) || x.length !== slot.len) throw new TypeError(`${slot.name}: expected ${slot.len} × ${slot.type}`);
        x.forEach((e, i) => put(view, at + i * TYPES[slot.type].size, slot, e));
      }
    }
    return data;
  }

  /** Feed account data; `owner` must be the program. */
  decode(data: ArrayBufferView, owner: string): Reading<Payload<F>> {
    if (owner !== this.program) throw new Error('the account is not owned by the feed program');
    if (data.byteLength !== HEADER + this.size) throw new Error('the account size does not match the payload');
    const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
    const value: Record<string, unknown> = {};
    for (const { name, type, len, offset } of this.slots) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…