Transaction

constructor

Params

Name

Type

Required

Description

client

Client

Conditional required

RPC client that will be used to interact with KardiaChain

provider

string

Conditional required

RPC endpoint. Either client or provider must be provided to initialize a smart contract instance

Return

Return a Transaction instance .

Methods

getTransaction

Get transaction object by hash

Params

Name

Type

Required

Description

txHash

string

Required

Transaction hash to get detail

Return

Transaction object.

getPendingTransaction

Params

None

Return

Name

Type

Description

pendingTransactions

List of pending transactions

getTransactionReceipt

Get transaction receipt object by hash

Params

Name

Type

Required

Description

txHash

string

Required

Transaction hash to get detail

Return

Transaction receipt object.

sendTransaction

Submit transaction

Params

Name

Type

Required

Description

data

object

Required

Transaction data object

waitUntilMined

boolean

Indicate if wait for transaction to be executed successfully or return transaction hash immediately

waitTimeout

number

Time to wait for transaction to be executed (in milliseconds). Default to 5 minutes.

Return

  • Transaction Hash if waitUntilMined is false

  • Transaction receipt object if waitUntilMined is true

sendTransactionToExtension

Submit transaction using web extension

Params

Name

Type

Required

Description

data

object

Required

Transaction data object

waitUntilMined

boolean

Indicate if wait for transaction to be executed successfully or return transaction hash immediately

waitTimeout

number

Time to wait for transaction to be executed (in milliseconds). Default to 5 minutes.

Return

  • Transaction Hash if waitUntilMined is false

  • Transaction object if waitUntilMined is true

generateTransaction

Generate transaction to submit later

Params

Name

Type

Required

Description

txPayload

object

Transaction payload

Return

A Transaction payload object ready to submit to be signed.

signTransaction

Sign a transaction by private key

Params

Name

Type

Required

Description

tx

Required

Transaction object. Can be achieved by using generateTransaction method

privateKey

string

Required

Private key that will be used to sign transaction

Return

Raw transaction object ready to be submitted to KardiaChain

Name

Type

Description

messageHash

string

Transaction's message hash

v

string

Private key's v

r

string

Private key's r

s

string

Private key's s

rawTransaction

string

Signed transaction. This will be used to submit to KardiaChain

sendRawTransaction

Send signed transaction to KardiaChain

Params

Name

Type

Required

Description

rawTx

string

Required

Signed transaction

waitUntilMined

boolean

Indicate if wait for transaction to be executed successfully or return transaction hash immediately

waitTimeOut

number

Time to wait for transaction to be executed (in milliseconds). Default to 5 minutes.

Return

  • Transaction Hash if waitUntilMined is false

  • Transaction object if waitUntilMined is true

estimateGas

Estimate gas used of a transaction

Params

Name

Type

Required

Description

txPayload

Required

Transaction object to estimate

data

string

Hex string represent transaction data.

Return

Estimated gas.

To ensure transaction is submitted successfully, add some more gas to the estimated gas.

debugTransaction

Debug a failed transaction

Params

Name

Type

Required

Description

txHash

string

Required

Transaction hash to debug

Return

Transaction debug object

Last updated