Skip to main content

TransactionFactory

Index

Methods

publicstaticfromBlockBodyData

  • When decoding a BlockBody, in the transactions field, a field is either: A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) A Uint8Array[] (Legacy Transaction) This method returns the right transaction.


    Parameters

    • data: Uint8Array | Uint8Array[]

      A Uint8Array or Uint8Array[]

    • txOptions: TxOptions = {}

      The transaction options

    Returns TypedTransaction

publicstaticfromSerializedData

  • This method tries to decode serialized data.


    Parameters

    • data: Uint8Array

      The data Uint8Array

    • txOptions: TxOptions = {}

      The transaction options

    Returns TypedTransaction

publicstaticfromTxData

  • Create a transaction from a txData object


    Parameters

    • txData: TypedTransaction | TxData

      The transaction data. The type field will determine which transaction type is returned (if undefined, creates a legacy transaction)

    • txOptions: TxOptions = {}

      Options to pass on to the constructor of the transaction

    Returns TypedTransaction

publicstaticregisterTransactionType

  • registerTransactionType<NewTxTypeClass>(type: Numbers, txClass: NewTxTypeClass): void
  • Type parameters

    • NewTxTypeClass: { prototype: BaseTransaction<any>; fromSerializedTx: any; fromTxData: any }

    Parameters

    • type: Numbers
    • txClass: NewTxTypeClass

    Returns void

publicstatictypeToInt

  • Parameters

    Returns number