INNER CODE UNIT · TypeScript

data

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

    const data = new Uint8Array(HEADER + this.size);
    const view = new DataView(data.buffer);
    view.setBigUint64(0, u64, true);
    const fields = value as Record<string, unknown>;
    for (const slot of this.slots) {
      const x = fields[slot.name];
      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. */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…