Options
All
  • Public
  • Public/Protected
  • All
Menu
implements

{TokenType}

Type Parameters

  • T

Hierarchy

  • Token

Index

Constructors

Properties

Methods

Constructors

Properties

data: MatchRecord<T, ((input: Blob) => URL)>
readonly
ipnft: CIDString
readonly
readonly

Methods

  • encode<T>(input: T): Promise<{ car: CarReader; cid: CID; token: Token<T> }>
  • Takes token input, encodes it as a DAG, wraps it in a CAR and creates a new Token instance from it. Where values are discovered Blob (or File) objects in the given input, they are replaced with IPFS URLs (an ipfs:// prefixed CID with an optional path).

    example
    const cat = new File(['...'], 'cat.png')
    const kitty = new File(['...'], 'kitty.png')
    const { token, car } = await Token.encode({
    name: 'hello'
    image: cat
    properties: {
    extra: {
    image: kitty
    }
    }
    })

    Type Parameters

    Parameters

    • input: T

    Returns Promise<{ car: CarReader; cid: CID; token: Token<T> }>

    }

Generated using TypeDoc