Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssetTransferTransaction

Spends the existing asset and creates a new asset. Ownership can be transferred during this process.

An AssetTransferTransaction consists of:

  • A list of AssetTransferInput to burn.
  • A list of AssetTransferInput to spend.
  • A list of AssetTransferOutput to create.
  • A network ID. This must be identical to the network ID of which the transaction is being sent to.

All inputs must be valid for the transaction to be valid. When each asset types' amount have been summed, the sum of inputs and the sum of outputs must be identical. If an identical transaction hash already exists, then the change fails. In this situation, a transaction can be created again by arbitrarily changing the nonce.

Hierarchy

  • AssetTransferTransaction

Index

Constructors

constructor

Properties

burns

inputs

networkId

networkId: NetworkId

nonce

nonce: number

outputs

type

type: "assetTransfer" = "assetTransfer"

Methods

addBurns

addInputs

addOutputs

getAssetAddress

  • getAssetAddress(index: number): H256

getTransferredAsset

  • getTransferredAsset(index: number): Asset

getTransferredAssets

  • getTransferredAssets(): Asset[]

hash

hashWithoutScript

  • hashWithoutScript(): H256

rlpBytes

  • rlpBytes(): Buffer

signBurn

  • signBurn(index: number, params: object): Promise<void>
  • Set a burn's lock script and an input's unlock script so that the burn become burnable.

    Parameters

    • index: number

      An index indicating the burn to sign.

    • params: object
      • Optional passphrase?: undefined | string
      • signer: TransactionBurnSigner

        A TransactionSigner. Currently, P2PKH is available.

    Returns Promise<void>

    A promise that resolves when setting is done.

signInput

  • signInput(index: number, params: object): Promise<void>
  • Set an input's lock script and an input's unlock script so that the input become spendable.

    Parameters

    • index: number

      An index indicating the input to sign.

    • params: object
      • Optional passphrase?: undefined | string
      • signer: TransactionInputSigner

        A TransactionSigner. Currently, P2PKH is available.

    Returns Promise<void>

    A promise that resolves when setting is done.

toEncodeObject

  • toEncodeObject(): (string | number | (Buffer | (string | number)[])[][] | (string | number | Buffer[])[][])[]

toJSON

  • toJSON(): object
  • Convert to an AssetTransferTransaction JSON object.

    Returns object

    An AssetTransferTransaction JSON object.

    • type: string
    • data: object
      • burns: object[]
      • inputs: object[]
      • networkId: string
      • nonce: number
      • outputs: object[]

Static fromJSON

Generated using TypeDoc