Variable DemosTransactionsConst

DemosTransactions: {
    broadcast: ((validationData: RPCResponseWithValidityData, demos: Demos) => Promise<any>);
    confirm: ((transaction: Transaction, demos: Demos) => Promise<RPCResponseWithValidityData>);
    empty: (() => Transaction);
    prepare: ((data?: any) => Promise<Transaction>);
    sign: ((raw_tx: Transaction, keypair: IKeyPair, options: {
        algorithm: SigningAlgorithm;
    }) => Promise<Transaction>);
    signWithAlgorithm: ((data: string, keypair: IKeyPair, options: {
        algorithm: SigningAlgorithm;
    }) => Promise<{
        data: string;
        type: SigningAlgorithm;
    }>);
    createL2PSHashUpdate(l2psUid: string, consolidatedHash: string, transactionCount: number, demos: Demos): Promise<Transaction>;
    pay(to: string, amount: number, demos: Demos): Promise<Transaction>;
    store(bytes: Uint8Array<ArrayBufferLike>, demos: Demos): Promise<Transaction>;
    transfer(to: string, amount: number, demos: Demos): Promise<Transaction>;
} = ...

Type declaration

  • broadcast: ((validationData: RPCResponseWithValidityData, demos: Demos) => Promise<any>)

    Broadcasts a transaction for execution.

      • (validationData, demos): Promise<any>
      • Parameters

        Returns Promise<any>

        The response from the node

  • confirm: ((transaction: Transaction, demos: Demos) => Promise<RPCResponseWithValidityData>)

    Confirms a transaction.

  • empty: (() => Transaction)
  • prepare: ((data?: any) => Promise<Transaction>)
  • sign: ((raw_tx: Transaction, keypair: IKeyPair, options: {
        algorithm: SigningAlgorithm;
    }) => Promise<Transaction>)

    Signs a transaction after hashing its content.

    Use demos.sign(tx) instead

  • signWithAlgorithm: ((data: string, keypair: IKeyPair, options: {
        algorithm: SigningAlgorithm;
    }) => Promise<{
        data: string;
        type: SigningAlgorithm;
    }>)

    Signs a message with a given algorithm.

      • (data, keypair, options): Promise<{
            data: string;
            type: SigningAlgorithm;
        }>
      • Parameters

        • data: string

          The message to sign.

        • keypair: IKeyPair

          The keypair to use for signing.

        • options: {
              algorithm: SigningAlgorithm;
          }

        Returns Promise<{
            data: string;
            type: SigningAlgorithm;
        }>

        A Promise that resolves to the signed message.

  • createL2PSHashUpdate:function
    • Create a signed L2PS hash update transaction for DTR relay to validators.

      L2PS hash updates are self-directed transactions that carry consolidated hash information representing multiple L2PS transactions. These transactions are automatically relayed to validators via DTR (Distributed Transaction Routing) to enable consensus on L2PS network activity without exposing transaction content.

      Parameters

      • l2psUid: string

        The unique identifier of the L2PS network

      • consolidatedHash: string

        SHA-256 hash representing all L2PS transactions

      • transactionCount: number

        Number of transactions included in this hash update

      • demos: Demos

        The demos instance (for getting the address nonce)

      Returns Promise<Transaction>

      The signed L2PS hash update transaction

      const hashUpdateTx = await DemosTransactions.createL2PSHashUpdate(
      "l2ps_network_123",
      "0x1234567890abcdef...",
      5,
      demos
      )
  • pay:function
    • Create a signed DEMOS transaction to send native tokens to a given address.

      Parameters

      • to: string

        The reciever

      • amount: number

        The amount in DEM

      • demos: Demos

        The demos instance (for getting the address nonce)

      Returns Promise<Transaction>

      The signed transaction.

  • store:function
    • Create a signed DEMOS transaction to store binary data on the blockchain. Data is stored in the sender's account.

      Parameters

      • bytes: Uint8Array<ArrayBufferLike>

        The binary data to store (will be base64-encoded)

      • demos: Demos

        The demos instance (for getting the address nonce)

      Returns Promise<Transaction>

      The signed storage transaction.

  • transfer:function
    • Create a signed DEMOS transaction to send native tokens to a given address.

      Parameters

      • to: string

        The reciever

      • amount: number

        The amount in DEM

      • demos: Demos

        The demos instance (for getting the address nonce)

      Returns Promise<Transaction>

      The signed transaction.