INNER CODE UNIT · TypeScript

Feed

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

export class Feed<F extends readonly FieldLike[] = readonly Field[]> {
  private constructor(
    readonly manifest: Manifest<F>,
    /** `createWithSeed(admin, seed, loader)`. */
    readonly program: string,
    /** The feed account: `createWithSeed(admin, FEED_SEED, program)`. */
    readonly address: string,
    /** Payload bytes. */
    readonly size: number,
    private readonly slots: Slot[],
    private readonly adminKey: Uint8Array,
  ) {}

  /** Validates the manifest and derives the program and the feed address. */
  static async load<const F extends readonly FieldLike[]>(manifest: Manifest<F>): Promise<Feed<F>> {
    const admin = key(manifest.admin, 'admin');
    const seed = new TextEncoder().encode(typeof manifest.seed === 'string' ? manifest.seed : '');
    if (seed.length < 1 || seed.length > 32) throw new TypeError('seed: a seed is 1 to 32 bytes');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…