Hierarchy

  • Utility

Constructors

  • Parameters

    • wallet: Wallet
    • rpcEndpoint: string = DEFAULT_RPC_ENDPOINT
    • programId: string = DEFAULT_SEN_UTILITY_PROGRAM_ID

    Returns Utility

Properties

program: Program<SenUtility>

Accessors

  • get events(): ("ClaimEvent" | "InitializeDistributorEvent" | "RevokeEvent")[]
  • Get list of event names

    Returns ("ClaimEvent" | "InitializeDistributorEvent" | "RevokeEvent")[]

Methods

  • Listen changes on an event

    Returns

    Listener id

    Type Parameters

    • T extends "ClaimEvent" | "InitializeDistributorEvent" | "RevokeEvent"

    Parameters

    • eventName: T

      Event name

    • callback: ((data: IdlEvents<SenUtility>[T]) => void)

      Event handler

        • (data: IdlEvents<SenUtility>[T]): void
        • Parameters

          Returns void

    Returns Promise<number>

  • Claim a distribution.

    Returns

    Parameters

    • __namedParameters: { data: Leaf; distributorAddress: string; feeOptions?: FeeOptions; proof: Buffer[]; sendAndConfirm?: boolean }
      • data: Leaf
      • distributorAddress: string
      • Optional feeOptions?: FeeOptions
      • proof: Buffer[]
      • Optional sendAndConfirm?: boolean

    Returns Promise<{ dstAddress: string; tx: Transaction; txId: string }>

  • Derive my receipt address by distributor address, and salt.

    Returns

    Receipt address.

    Parameters

    • salt: Buffer

      Buffer.

    • distributorAddress: string

      Distributor address.

    • strict: boolean = false

      (Optional) if true, a validation process will activate to make sure the receipt is safe.

    Returns Promise<string>

  • Derive treasurer address of a distributor.

    Returns

    Treasurer address that holds the secure token treasuries of the distributor.

    Parameters

    • distributorAddress: string

      Distributor address.

    Returns Promise<string>

  • Get current Unix Timestamp of Solana Cluster

    Returns

    Number (in seconds)

    Returns Promise<number>

  • Get distributor data.

    Returns

    Distributor readable data.

    Parameters

    • distributorAddress: string

      Distributor address.

    Returns Promise<TypeDef<{ name: "distributor"; type: { fields: [{ name: "authority"; type: "publicKey" }, { name: "mint"; type: "publicKey" }, { name: "merkleRoot"; type: { array: ["u8", 32] } }, { name: "total"; type: "u64" }, { name: "claimed"; type: "u64" }, { name: "endedAt"; type: "i64" }, { name: "metadata"; type: { array: ["u8", 32] } }]; kind: "struct" } } & { name: "distributor" } & never, Record<string, never>>>

  • Get receipt data.

    Returns

    Receipt readable data.

    Parameters

    • receiptAddress: string

      Receipt address.

    Returns Promise<TypeDef<never & { name: "receipt"; type: { fields: [{ name: "authority"; type: "publicKey" }, { name: "distributor"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "startedAt"; type: "i64" }, { name: "claimedAt"; type: "i64" }, { name: "salt"; type: { array: ["u8", 32] } }]; kind: "struct" } } & { name: "receipt" }, Record<string, never>>>

  • Initialize a merkle distributor.

    Returns

    Parameters

    • __namedParameters: { distributor?: Keypair; endedAt?: number; feeOptions?: FeeOptions; merkleRoot: Uint8Array | Buffer; metadata: Uint8Array | Buffer; sendAndConfirm?: boolean; tokenAddress: string; total: BN }
      • Optional distributor?: Keypair
      • Optional endedAt?: number
      • Optional feeOptions?: FeeOptions
      • merkleRoot: Uint8Array | Buffer
      • metadata: Uint8Array | Buffer
      • Optional sendAndConfirm?: boolean
      • tokenAddress: string
      • total: BN

    Returns Promise<{ distributorAddress: string; tx: Transaction; txId: string }>

  • Parse distributor buffer data.

    Returns

    Distributor readable data.

    Parameters

    • data: Buffer

      Distributor buffer data.

    Returns TypeDef<{ name: "distributor"; type: { fields: [{ name: "authority"; type: "publicKey" }, { name: "mint"; type: "publicKey" }, { name: "merkleRoot"; type: { array: ["u8", 32] } }, { name: "total"; type: "u64" }, { name: "claimed"; type: "u64" }, { name: "endedAt"; type: "i64" }, { name: "metadata"; type: { array: ["u8", 32] } }]; kind: "struct" } } & { name: "distributor" } & never, Record<string, never>>

  • Parse receipt buffer data.

    Returns

    Receipt readable data.

    Parameters

    • data: Buffer

      Receipt buffer data.

    Returns TypeDef<never & { name: "receipt"; type: { fields: [{ name: "authority"; type: "publicKey" }, { name: "distributor"; type: "publicKey" }, { name: "amount"; type: "u64" }, { name: "startedAt"; type: "i64" }, { name: "claimedAt"; type: "i64" }, { name: "salt"; type: { array: ["u8", 32] } }]; kind: "struct" } } & { name: "receipt" }, Record<string, never>>

  • Remove listener by its id

    Returns

    Parameters

    • listenerId: number

      Listener id

    Returns Promise<void>

  • Revoke the remaining tokens of a distribution.

    Returns

    Parameters

    • __namedParameters: { distributorAddress: string; feeOptions?: FeeOptions; sendAndConfirm?: boolean }
      • distributorAddress: string
      • Optional feeOptions?: FeeOptions
      • Optional sendAndConfirm?: boolean

    Returns Promise<{ dstAddress: string; tx: Transaction; txId: string }>

  • Create the destination's associcated account if needed, and mint tokens to.

    Returns

    Parameters

    • __namedParameters: { amount: BN; dstWalletAddress: string; feeOptions?: FeeOptions; sendAndConfirm?: boolean; tokenAddress: string }
      • amount: BN
      • dstWalletAddress: string
      • Optional feeOptions?: FeeOptions
      • Optional sendAndConfirm?: boolean
      • tokenAddress: string

    Returns Promise<{ dstAddress: string; tx: Transaction; txId: string }>

  • Create the destination's associcated account if needed, and transfer tokens.

    Returns

    Parameters

    • __namedParameters: { amount: BN; dstWalletAddress: string; feeOptions?: FeeOptions; sendAndConfirm?: boolean; tokenAddress: string }
      • amount: BN
      • dstWalletAddress: string
      • Optional feeOptions?: FeeOptions
      • Optional sendAndConfirm?: boolean
      • tokenAddress: string

    Returns Promise<{ dstAddress: string; srcAddress: string; tx: Transaction; txId: string }>

Generated using TypeDoc