js-conflux-sdk
Conflux Doc
  • Home
  • Introduction
  • QuickStart
  • Overview
  • Contrast with web3.js
  • Guides
    • Providers
    • How to Connect Fluent
    • CIP37 Address
    • Account
    • Sending Transaction
    • Interact with Contract
    • Sign methods
    • Error Handling
    • Batch RPC
  • API
    • Conflux
    • PoS
    • TxPool
    • Provider
    • Drip
    • Transaction
    • Wallet
  • Release notes
  • v2.0 Changes
  • FAQs
Powered by GitBook
On this page
  • Classes
  • Typedefs
  • Transaction
  • TransactionMeta : CallRequest

Was this helpful?

Edit on GitHub
  1. API

Transaction

PreviousDripNextWallet

Last updated 2 years ago

Was this helpful?

Classes

Typedefs

: CallRequest

Transaction

Kind: global class

    • instance

      • ⇒ string | undefined

      • ⇒

      • ⇒ string

      • ⇒ Buffer

      • ⇒ string

    • static

      • ⇒

new Transaction(options)

Create a transaction.

Param
Type
Description

options

object

[options.from]

string

The sender address.

[options.nonce]

string | number

This allows to overwrite your own pending transactions that use the same nonce.

[options.gasPrice]

string | number

The price of gas for this transaction in drip.

[options.gas]

string | number

The amount of gas to use for the transaction (unused gas is refunded).

[options.to]

string

The destination address of the message, left undefined for a contract-creation transaction.

[options.value]

string | number

The value transferred for the transaction in drip, also the endowment if it’s a contract-creation transaction.

[options.storageLimit]

string | number

The storage limit specified by the sender.

[options.epochHeight]

string | number

The epoch proposed by the sender. Note that this is NOT the epoch of the block containing this transaction.

[options.chainId]

string | number

The chain ID specified by the sender.

[options.data]

string | Buffer

Either a ABI byte string containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation code.

[options.r]

string | Buffer

ECDSA signature r

[options.s]

string | Buffer

ECDSA signature s

[options.v]

number

ECDSA recovery id

transaction.hash ⇒ string | undefined

Getter of transaction hash include signature.

Note: calculate every time.

Sign transaction and set 'r','s','v'.

Param
Type
Description

privateKey

string

Private key hex string.

networkId

number

fullnode's network id.

transaction.recover() ⇒ string

Recover public key from signed Transaction.

transaction.encode([includeSignature]) ⇒ Buffer

Encode rlp.

Param
Type
Default
Description

[includeSignature]

boolean

false

Whether or not to include the signature.

transaction.serialize() ⇒ string

Get the raw transaction hex string.

Decode rlp encoded raw transaction hex string

Param
Type
Description

raw

string

rlp encoded transaction hex string

TransactionMeta : CallRequest

Kind: global typedef

Kind: instance property of Returns: string | undefined - If transaction has r,s,v return hex string, else return undefined.

transaction.sign(privateKey, networkId) ⇒

Kind: instance method of

Kind: instance method of

Kind: instance method of

Kind: instance method of Returns: string - Hex string

Transaction.decodeRaw(raw) ⇒

Kind: static method of Returns: - A Transaction instance

Transaction
TransactionMeta
Transaction
new Transaction(options)
.hash
.sign(privateKey, networkId)
Transaction
.recover()
.encode([includeSignature])
.serialize()
.decodeRaw(raw)
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction
Transaction