Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • TransactionBase
    • Transaction

Implements

  • AbstractTransaction

Index

Constructors

constructor

  • params
    id:               string;
    from:             string;
    to:               string;
    nonce:            number | string;
    gasLimit:         number | string | BN;
    gasPrice:         number | string | BN;
    shardID:          number | string;
    toShardID:        number | string;
    data:             string;
    value:            number | string | BN;
    chainId:          number;
    rawTransaction:   string;
    unsignedRawTransaction: string;
    signature:        Signature;
    receipt?:         TransasctionReceipt;

    Parameters

    • Optional params: TxParams | any
    • Default value messenger: Messenger = defaultMessenger
    • Default value txStatus: TxStatus = TxStatus.INTIALIZED

    Returns Transaction

Properties

blockNumbers

blockNumbers: string[] = []

confirmationCheck

confirmationCheck: number = 0

confirmations

confirmations: number = 0

cxBlockNumbers

cxBlockNumbers: string[] = []

cxConfirmationCheck

cxConfirmationCheck: number = 0

cxConfirmations

cxConfirmations: number = 0

cxStatus

cxStatus: TxStatus = TxStatus.INTIALIZED

emitter

emitter: Emitter

id

id: string

messenger

messenger: Messenger

Optional receipt

shardID

shardID: number | string

txStatus

txStatus: TxStatus

Accessors

txParams

  • get transaction params

    example
    const txParams = txn.txParams;
    console.log(txParams)

    Returns TxParams

txPayload

  • get txPayload(): { data: string; from: string; gas: any; gasPrice: any; nonce: any; shardID: any; to: string; toShardID: any; value: any }
  • get the payload of transaction

    example
    const payload = txn.txPayload;
    console.log(payload);

    Returns { data: string; from: string; gas: any; gasPrice: any; nonce: any; shardID: any; to: string; toShardID: any; value: any }

    • data: string
    • from: string
    • gas: any
    • gasPrice: any
    • nonce: any
    • shardID: any
    • to: string
    • toShardID: any
    • value: any

Methods

confirm

  • confirm(txHash: string, maxAttempts?: number, interval?: number, shardID?: number | string, toShardID?: number | string): Promise<TransactionBase>
  • Parameters

    • txHash: string
    • Default value maxAttempts: number = 20
    • Default value interval: number = 1000
    • Default value shardID: number | string = this.txParams.shardID
    • Default value toShardID: number | string = this.txParams.toShardID

    Returns Promise<TransactionBase>

cxConfirm

  • cxConfirm(txHash: string, maxAttempts?: number, interval?: number, toShardID: number | string): Promise<TransactionBase>
  • Parameters

    • txHash: string
    • Default value maxAttempts: number = 20
    • Default value interval: number = 1000
    • toShardID: number | string

    Returns Promise<TransactionBase>

emitConfirm

  • emitConfirm(data: any): void
  • Parameters

    • data: any

    Returns void

emitCxConfirm

  • emitCxConfirm(data: any): void
  • Parameters

    • data: any

    Returns void

emitCxReceipt

  • emitCxReceipt(receipt: any): void
  • Parameters

    • receipt: any

    Returns void

emitCxTrack

  • emitCxTrack(data: any): void
  • Parameters

    • data: any

    Returns void

emitError

  • emitError(error: any): void
  • Parameters

    • error: any

    Returns void

emitReceipt

  • emitReceipt(receipt: any): void
  • Parameters

    • receipt: any

    Returns void

emitTrack

  • emitTrack(data: any): void
  • Parameters

    • data: any

    Returns void

emitTransactionHash

  • emitTransactionHash(transactionHash: string): void
  • Parameters

    • transactionHash: string

    Returns void

getBlockByNumber

  • getBlockByNumber(blockNumber: string): Promise<any>
  • Parameters

    • blockNumber: string

    Returns Promise<any>

getBlockNumber

  • getBlockNumber(shardID: number | string): Promise<BN>
  • Parameters

    • shardID: number | string

    Returns Promise<BN>

getCxStatus

  • Returns TxStatus

getRLPSigned

  • getRLPSigned(raw: any[], signature: Signature): string
  • Parameters

    • raw: any[]
    • signature: Signature

    Returns string

getRLPUnsigned

  • getRLPUnsigned(): [string, any[]]
  • example
    const unsigned = txn.getRLPUnsigned(txn);
    console.log(unsigned);

    Returns [string, any[]]

getRawTransaction

  • getRawTransaction(): string
  • example
    console.log(txn.getRawTransaction());

    Returns string

getTxStatus

  • Returns TxStatus

isConfirmed

  • isConfirmed(): boolean
  • Returns boolean

isCrossShard

  • isCrossShard(): boolean
  • Check whether the transaction is cross shard

    example
    console.log(txn.isCrossShard());

    Returns boolean

isCxConfirmed

  • isCxConfirmed(): boolean
  • Returns boolean

isCxPending

  • isCxPending(): boolean
  • Returns boolean

isCxRejected

  • isCxRejected(): boolean
  • Returns boolean

isInitialized

  • isInitialized(): boolean
  • Returns boolean

isPending

  • isPending(): boolean
  • Returns boolean

isRejected

  • isRejected(): boolean
  • Returns boolean

isSigned

  • isSigned(): boolean
  • Returns boolean

observed

  • observed(): any
  • Returns any

sendTransaction

  • example
    txn.sendTransaction().then((value) => {
      console.log(value);
    });

    Returns Promise<[Transaction, string]>

setCxStatus

  • Parameters

    Returns void

setMessenger

  • Parameters

    Returns void

setParams

  • set the params to the txn

    example
    txn.setParams({
      to: 'one1ew56rqrucu6p6n598fmjmnfh8dd4xpg6atne9c',
      value: '1200',
      gasLimit: '230000',
      shardID: 1,
      toShardID: 0,
      gasPrice: new hmy.utils.Unit('101').asGwei().toWei(),
      signature: {
        r: '0xd693b532a80fed6392b428604171fb32fdbf953728a3a7ecc7d4062b1652c042',
        s: '0x24e9c602ac800b983b035700a14b23f78a253ab762deab5dc27e3555a750b354',
        v: 0
      },
    });
    console.log(txn);

    Parameters

    Returns void

setTxStatus

  • Parameters

    Returns void

socketConfirm

  • socketConfirm(txHash: string, maxAttempts?: number, shardID: number | string): Promise<TransactionBase>
  • Parameters

    • txHash: string
    • Default value maxAttempts: number = 20
    • shardID: number | string

    Returns Promise<TransactionBase>

socketCxConfirm

  • socketCxConfirm(txHash: string, maxAttempts?: number, toShardID: number | string): Promise<TransactionBase>
  • Parameters

    • txHash: string
    • Default value maxAttempts: number = 20
    • toShardID: number | string

    Returns Promise<TransactionBase>

trackCx

  • trackCx(txHash: string, toShardID: number | string): Promise<boolean>
  • Parameters

    • txHash: string
    • toShardID: number | string

    Returns Promise<boolean>

trackTx

  • trackTx(txHash: string, shardID: number | string): Promise<boolean>
  • Parameters

    • txHash: string
    • shardID: number | string

    Returns Promise<boolean>

txConfirm

  • txConfirm(txHash: string, maxAttempts?: number, interval?: number, shardID: number | string): Promise<TransactionBase>
  • Parameters

    • txHash: string
    • Default value maxAttempts: number = 20
    • Default value interval: number = 1000
    • shardID: number | string

    Returns Promise<TransactionBase>

Static normalizeAddress

  • normalizeAddress(address: string): any
  • Parameters

    • address: string

    Returns any

Generated using TypeDoc