Conflux
Classes
The Client class that provides an interface to the Conflux network.
Typedefs
ConfluxOption : Object
TransactionMeta : TransactionMeta
Conflux
The Client class that provides an interface to the Conflux network.
Kind: global class
instance
.version :
string
.provider :
BaseProvider
|WechatProvider
|HttpProvider
|WebsocketProvider
.wallet :
Wallet
.defaultGasPrice:number|string.defaultGasRatio :
number
.defaultStorageRatio :
number
.pos :
PoS
.trace :
Trace
.txpool :
TxPool
.cfx :
CFX
.advanced :
AdvancedRPCUtilities
.Contract(options) ⇒
Contract
.InternalContract(name) ⇒
Contract
.CRC20(address) ⇒
Contract
.BatchRequest() ⇒
BatchRequester
.getClientVersion() ⇒
Promise.<string>
.getSupplyInfo([epochNumber]) ⇒
Promise.<SupplyInfo>
.getStatus() ⇒
Promise.<ChainStatus>
.getGasPrice() ⇒
Promise.<BigInt>
.getInterestRate([epochNumber]) ⇒
Promise.<BigInt>
.getAccumulateInterestRate([epochNumber]) ⇒
Promise.<BigInt>
.getAccount(address, [epochNumber]) ⇒
Promise.<Account>
.getBalance(address, [epochNumber]) ⇒
Promise.<BigInt>
.getStakingBalance(address, [epochNumber]) ⇒
Promise.<BigInt>
.getNextNonce(address, [epochNumber]) ⇒
Promise.<BigInt>
.getAdmin(address, [epochNumber]) ⇒
Promise.<string>
.getVoteList(address, [epochNumber]) ⇒
Promise.<Array.<Vote>>
.getDepositList(address, [epochNumber]) ⇒
Promise.<Array.<Deposit>>
.getEpochNumber([epochNumber]) ⇒
Promise.<number>
.getBlockByEpochNumber(epochNumber, [detail]) ⇒
Promise.<(Block|null)>
.getBlockByBlockNumber(blockNumber, [detail]) ⇒
Promise.<(Block|null)>
.getBlocksByEpochNumber(epochNumber) ⇒
Promise.<Array.<string>>
.getBlockRewardInfo(epochNumber) ⇒
Promise.<Array.<RewardInfo>>
.getBestBlockHash() ⇒
Promise.<string>
.getBlockByHash(blockHash, [detail]) ⇒
Promise.<(Block|null)>
.getBlockByHashWithPivotAssumption(blockHash, pivotBlockHash, epochNumber) ⇒
Promise.<(Block|null)>
.getConfirmationRiskByHash(blockHash) ⇒
Promise.<(number|null)>
.getTransactionByHash(transactionHash) ⇒
Promise.<(Transaction|null)>
.getTransactionReceipt(transactionHash) ⇒
Promise.<(TransactionReceipt|null)>
.sendRawTransaction(hex) ⇒
Promise.<PendingTransaction>
.sendTransaction(options, [password]) ⇒
Promise.<PendingTransaction>
.getCode(address, [epochNumber]) ⇒
Promise.<string>
.getStorageAt(address, position, [epochNumber]) ⇒
Promise.<(string|null)>
.getStorageRoot(address, [epochNumber]) ⇒
Promise.<object>
.getSponsorInfo(address, [epochNumber]) ⇒
Promise.<SponsorInfo>
.getAccountPendingInfo(address) ⇒
Promise.<AccountPendingInfo>
.getAccountPendingTransactions(address) ⇒
Promise.<AccountPendingTransactions>
.getCollateralForStorage(address, [epochNumber]) ⇒
Promise.<BigInt>
.call(options, [epochNumber]) ⇒
Promise.<string>
.estimateGasAndCollateral(options, [epochNumber]) ⇒
Promise.<EstimateResult>
.estimateGasAndCollateralAdvance(options, [epochNumber]) ⇒
Promise.<object>
.getLogs([options]) ⇒
Promise.<Array.<Log>>
.traceBlock(blockHash) ⇒
Promise.<Array.<object>>
.traceTransaction(txHash) ⇒
Promise.<Array.<Trace>>
.traceFilter(filter) ⇒
Promise.<Array.<Trace>>
.getEpochReceipts(epochNumber) ⇒
Promise.<Array.<Array.<TransactionReceipt>>>
.getEpochReceiptsByPivotBlockHash(pivotBlockHash) ⇒
Promise.<Array.<Array.<TransactionReceipt>>>
.getPoSEconomics() ⇒
Promise.<PoSEconomics>
.subscribe(name, ...args) ⇒
Promise.<string>
.subscribeEpochs([sub_epoch]) ⇒
Promise.<Subscription>
.subscribeNewHeads() ⇒
Promise.<Subscription>
.subscribeLogs([options]) ⇒
Promise.<Subscription>
.unsubscribe(id) ⇒
Promise.<boolean>
static
new Conflux([options])
Example
Example
conflux.version : string
string
Kind: instance property of Conflux
conflux.provider : BaseProvider
| WechatProvider
| HttpProvider
| WebsocketProvider
BaseProvider
| WechatProvider
| HttpProvider
| WebsocketProvider
Provider for rpc call
Kind: instance property of Conflux
conflux.wallet : Wallet
Wallet
Wallet for sendTransaction
to get Account
by from
field
Kind: instance property of Conflux
conflux.defaultGasPrice : number
| string
number
string
Deprecated
Default gas price for following methods:
Conflux.sendTransaction
Kind: instance property of Conflux
conflux.defaultGasRatio : number
number
If transaction.gas is undefined, gas will be set by estimate, cause gas used might be change during estimateGasAndCollateral
and sendTransaction
, estimate value need to multiply by defaultGasRatio (>1.0) in case of gas not enough.
transaction.gas = estimate.gasUsed * defaultGasRatio
Default gas price for following methods:
Conflux.sendTransaction
Kind: instance property of Conflux
conflux.defaultStorageRatio : number
number
If transaction.storageLimit is undefined, storageLimit will be set by estimate, cause storage limit might be change during estimateGasAndCollateral
and sendTransaction
, estimate value need to multiply by defaultStorageRatio (>1.0) in case of storageLimit not enough.
transaction.storageLimit = estimate.storageCollateralized * defaultStorageRatio
Default gas price for following methods:
Conflux.sendTransaction
Kind: instance property of Conflux
conflux.pos : PoS
PoS
pos RPC methods
Kind: instance property of Conflux
conflux.trace : Trace
Trace
trace RPC methods
Kind: instance property of Conflux
conflux.txpool : TxPool
TxPool
txpool RPC methods
Kind: instance property of Conflux
conflux.cfx : CFX
CFX
cfx RPC methods
Kind: instance property of Conflux
conflux.advanced : AdvancedRPCUtilities
AdvancedRPCUtilities
Advanced RPC compose methods
Kind: instance property of Conflux
conflux.request()
Different kind provider API wrapper
Kind: instance method of Conflux
conflux.Contract(options) ⇒ Contract
Contract
A shout cut for new Contract(options, conflux);
Kind: instance method of Conflux
conflux.InternalContract(name) ⇒ Contract
Contract
Create internal contract by default abi and address
Kind: instance method of Conflux
Example
conflux.CRC20(address) ⇒ Contract
Contract
Create an token CRC20 contract with standard CRC20 abi
Kind: instance method of Conflux
Returns: Contract
- A token contract instance
conflux.BatchRequest() ⇒ BatchRequester
BatchRequester
Return a BatchRequester instance which can used to build batch request and decode response data
Kind: instance method of Conflux
Returns: BatchRequester
- - A BatchRequester instance
conflux.close()
close connection.
Kind: instance method of Conflux
Example
conflux.updateNetworkId()
Update conflux networkId from RPC
Kind: instance method of Conflux
conflux.getClientVersion() ⇒ Promise.<string>
Promise.<string>
Get node client version
Kind: instance method of Conflux
conflux.getSupplyInfo([epochNumber]) ⇒ Promise.<SupplyInfo>
Promise.<SupplyInfo>
Get supply info
Kind: instance method of Conflux
Returns: Promise.<SupplyInfo>
- Return supply info
totalIssued
BigInt
: Total issued balance inDrip
totalStaking
BigInt
: Total staking balance inDrip
totalCollateral
BigInt
: Total collateral balance inDrip
Example
conflux.getStatus() ⇒ Promise.<ChainStatus>
Promise.<ChainStatus>
Get status
Kind: instance method of Conflux
Returns: Promise.<ChainStatus>
- Status information object
chainId
number
: Chain idepochNumber
number
: Epoch numberblockNumber
number
: Block numberpendingTxNumber
number
: Pending transaction numberbestHash
string
: The block hash of best pivot block Example
conflux.getGasPrice() ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the current price per gas in Drip.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- Gas price in drip.
Example
conflux.getInterestRate([epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the interest rate of given parameter.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- The interest rate of given parameter.
Example
conflux.getAccumulateInterestRate([epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the accumulate interest rate of given parameter.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- The accumulate interest rate of given parameter.
Example
conflux.getAccount(address, [epochNumber]) ⇒ Promise.<Account>
Promise.<Account>
Return account related states of the given account
Kind: instance method of Conflux
Returns: Promise.<Account>
- Return the states of the given account:
balance
BigInt
: the balance of the account.nonce
BigInt
: the nonce of the account's next transaction.codeHash
string
: the code hash of the account.stakingBalance
BigInt
: the staking balance of the account.collateralForStorage
BigInt
: the collateral storage of the account.accumulatedInterestReturn
BigInt
: accumulated unterest return of the account.admin
string
: admin of the account.
Example
conflux.getBalance(address, [epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the balance of the account of given address.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- The balance in Drip.
Example
conflux.getStakingBalance(address, [epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the balance of the staking account of given address.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- The staking balance in Drip.
Example
conflux.getNextNonce(address, [epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the next nonce should be used by given address.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- The next nonce should be used by given address.
Example
conflux.getAdmin(address, [epochNumber]) ⇒ Promise.<string>
Promise.<string>
Returns the admin of given contract.
Kind: instance method of Conflux
Returns: Promise.<string>
- Address to admin, or null
if the contract does not exist.
Example
conflux.getVoteList(address, [epochNumber]) ⇒ Promise.<Array.<Vote>>
Promise.<Array.<Vote>>
Returns vote list of the given account.
Kind: instance method of Conflux
Returns: Promise.<Array.<Vote>>
- Vote list
array
:amount
BigInt
: This is the number of tokens should be locked beforeunlockBlockNumber
number
: This is the timestamp when the vote right will be invalid, measured in, the number of past blocks.
conflux.getDepositList(address, [epochNumber]) ⇒ Promise.<Array.<Deposit>>
Promise.<Array.<Deposit>>
Returns deposit list of the given account.
Kind: instance method of Conflux
Returns: Promise.<Array.<Deposit>>
- Deposit list
array
:amount
BigInt
: the number of tokens depositedaccumulatedInterestRate:
BigInt
: the accumulated interest rate at the time of the depositdepositTime
number
: the time of the deposit
conflux.getEpochNumber([epochNumber]) ⇒ Promise.<number>
Promise.<number>
Returns the epoch number of given parameter.
Kind: instance method of Conflux
Returns: Promise.<number>
- integer of the current epoch number of given parameter.
Example
conflux.getBlockByEpochNumber(epochNumber, [detail]) ⇒ Promise.<(Block|null)>
Promise.<(Block|null)>
Returns information about a block by epoch number.
Kind: instance method of Conflux
Returns: Promise.<(Block|null)>
- See getBlockByHash
Example
conflux.getBlockByBlockNumber(blockNumber, [detail]) ⇒ Promise.<(Block|null)>
Promise.<(Block|null)>
Returns information about a block by block number.
Kind: instance method of Conflux
Returns: Promise.<(Block|null)>
- See getBlockByHash
Example
conflux.getBlocksByEpochNumber(epochNumber) ⇒ Promise.<Array.<string>>
Promise.<Array.<string>>
Returns hashes of blocks located in some epoch.
Kind: instance method of Conflux
Returns: Promise.<Array.<string>>
- Array of block hashes, sorted by execution(topological) order.
Example
conflux.getBlockRewardInfo(epochNumber) ⇒ Promise.<Array.<RewardInfo>>
Promise.<Array.<RewardInfo>>
Get epoch blocks reward info
Kind: instance method of Conflux
Returns: Promise.<Array.<RewardInfo>>
- List of block reward info
blockHash
string
: Hash of the block.author
string
: The address of the beneficiary to whom the mining rewards were given.baseReward
BigInt
: Block base reward inDrip
totalReward
BigInt
: Block total reward inDrip
txFee
BigInt
: Total gas fee of block transaction
Example
conflux.getBestBlockHash() ⇒ Promise.<string>
Promise.<string>
Returns the hash of best block.
Kind: instance method of Conflux
Returns: Promise.<string>
- hash of the best block.
Example
conflux.getBlockByHash(blockHash, [detail]) ⇒ Promise.<(Block|null)>
Promise.<(Block|null)>
Returns information about a block by hash.
Kind: instance method of Conflux
Returns: Promise.<(Block|null)>
- A block object, or null when no block was found:
adaptive
boolean
: Iftrue
the weight of the block is adaptive under GHAST rule, iffalse
otherwise.blame
number
: If 0, then no blocks are blamed on its parent path, If greater than 0, then the nearest blamed block on the parent path is blame steps away.deferredLogsBloomHash
string
: The bloom hash of deferred logs.deferredReceiptsRoot
string
: The hash of the receipts of the block after deferred execution.deferredStateRoot
string
: The root of the final state trie of the block after deferred execution.difficulty
string
: Integer string of the difficulty for this block.epochNumber
number|null
: The current block epoch number in the client's view. null when it's not in best block's past set and the epoch number is not determined.gasLimit
BigInt
: The maximum gas allowed in this block.hash
string|null
: Hash of the block.null
when its pending block.height
number
: The block heights.null
when its pending block.miner
string
: The address of the beneficiary to whom the mining rewards were given.nonce
string
: Hash of the generated proof-of-work.null
when its pending block.parentHash
string
: Hash of the parent block.powQuality
string
:Hash of the generated proof-of-work.null
when its pending block.refereeHashes
string[]
: Array of referee hashes.size
number
: Integer the size of this block in bytes.timestamp
number
: The unix timestamp for when the block was collated.transactions
string[]|object[]
: Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.transactionsRoot
string
: The hash of the transactions of the block.
Example
conflux.getBlockByHashWithPivotAssumption(blockHash, pivotBlockHash, epochNumber) ⇒ Promise.<(Block|null)>
Promise.<(Block|null)>
Get block by blockHash
if pivot block of epochNumber
is pivotBlockHash
.
Kind: instance method of Conflux
Returns: Promise.<(Block|null)>
- See getBlockByHash
conflux.getConfirmationRiskByHash(blockHash) ⇒ Promise.<(number|null)>
Promise.<(number|null)>
Get the risk of the block could be reverted. All block in one same epoch returned same risk number
Kind: instance method of Conflux
Returns: Promise.<(number|null)>
- Number >0 and <1
Example
conflux.getTransactionByHash(transactionHash) ⇒ Promise.<(Transaction|null)>
Promise.<(Transaction|null)>
Returns the information about a transaction requested by transaction hash.
Kind: instance method of Conflux
Returns: Promise.<(Transaction|null)>
- transaction object, or null
when no transaction was found:
blockHash
string
: hash of the block where this transaction was in and got executed.null
when its pending.contractCreated
string|null
: address of created contract.null
when it's not a contract creating transactiondata
string
: the data send along with the transaction.epochHeight
number
: epoch heightfrom
string
: address of the sender.gas
BigInt
: gas provided by the sender.gasPrice
number
: gas price provided by the sender in Drip.hash
string
: hash of the transaction.nonce
BigInt
: the number of transactions made by the sender prior to this one.r
string
: ECDSA signature rs
string
: ECDSA signature sstatus
number
: 0 for success, 1 for error occured,null
when the transaction is skipped or not packed.storageLimit
BigInt
: storage limit in byteschainId
number
: chain idto
string
: address of the receiver. null when its a contract creation transaction.transactionIndex
number
: integer of the transactions's index position in the block.null
when its pending.v
string
: ECDSA recovery idvalue
BigInt
: value transferred in Drip.
Example
conflux.getTransactionReceipt(transactionHash) ⇒ Promise.<(TransactionReceipt|null)>
Promise.<(TransactionReceipt|null)>
Returns the information about a transaction receipt requested by transaction hash.
Kind: instance method of Conflux
Returns: Promise.<(TransactionReceipt|null)>
- A transaction receipt object, or null when no transaction was found or the transaction was not executed yet:
transactionHash
string
: Hash of the given transaction.index
number
: Transaction index within the block.blockHash
string
: Hash of the block where this transaction was in and got executed.epochNumber
number
: Epoch number of the block where this transaction was in and got executed.from
string
: Address of the sender.to
string
: Address of the receiver.null
when its a contract creation transaction.gasUsed
number
: Gas used the transaction.contractCreated
string|null
: Address of created contract.null
when it's not a contract creating transaction.stateRoot
string
: Hash of the state root.outcomeStatus
number
: the outcome status code, 0 was successful, 1 for an error occurred in the execution.logsBloom
string
: Bloom filter for light clients to quickly retrieve related logs.logs
object[]
: Array of log objects, which this transaction generated.gasCoveredBySponsor
boolean
:true
if this transaction's gas fee was covered by the sponsor.storageCoveredBySponsor
boolean
:true
if this transaction's storage collateral was covered by the sponsor.storageCollateralized
BigInt
: the amount of storage collateral this transaction required.storageReleased
array
: array of storage change objects, each specifying an address and the corresponding amount of storage collateral releasedaddress
string
: address releasedcollaterals
BigInt
: corresponding amount of storage collateral released
Example
conflux.sendRawTransaction(hex) ⇒ Promise.<PendingTransaction>
Promise.<PendingTransaction>
Creates new message call transaction or a contract creation for signed transactions.
Kind: instance method of Conflux
Returns: Promise.<PendingTransaction>
- The transaction hash, or the zero hash if the transaction is not yet available.
Example
conflux.sendTransaction(options, [password]) ⇒ Promise.<PendingTransaction>
Promise.<PendingTransaction>
Sign and send transaction if from
field in conflux.wallet
, sign by local account and send raw transaction, else call cfx_sendTransaction
and sign by remote wallet
Kind: instance method of Conflux
Returns: Promise.<PendingTransaction>
- The PendingTransaction object.
Example
Example
Example
Example
Example
conflux.getCode(address, [epochNumber]) ⇒ Promise.<string>
Promise.<string>
Returns the code of given contract.
Kind: instance method of Conflux
Returns: Promise.<string>
- Byte code of contract, or 0x if the contract does not exist.
Example
conflux.getStorageAt(address, position, [epochNumber]) ⇒ Promise.<(string|null)>
Promise.<(string|null)>
Returns storage entries from a given contract.
Kind: instance method of Conflux
Returns: Promise.<(string|null)>
- Storage entry of given query, or null if the it does not exist.
Example
conflux.getStorageRoot(address, [epochNumber]) ⇒ Promise.<object>
Promise.<object>
Returns the storage root of a given contract.
Kind: instance method of Conflux
Returns: Promise.<object>
- A storage root object, or null
if the contract does not exist
delta
string
: storage root in the delta trie.intermediate
string
: storage root in the intermediate trie.snapshot
string
: storage root in the snapshot.
Example
conflux.getSponsorInfo(address, [epochNumber]) ⇒ Promise.<SponsorInfo>
Promise.<SponsorInfo>
Returns the sponsor info of given contract.
Kind: instance method of Conflux
Returns: Promise.<SponsorInfo>
- A sponsor info object, if the contract doesn't have a sponsor, then the all fields in returned object will be 0:
sponsorBalanceForCollateral
BigInt
: the sponsored balance for storage.sponsorBalanceForGas
BigInt
: the sponsored balance for gas.sponsorGasBound
BigInt
: the max gas could be sponsored for one transaction.sponsorForCollateral
string
: the address of the storage sponsor.sponsorForGas
string
: the address of the gas sponsor.
Example
conflux.getAccountPendingInfo(address) ⇒ Promise.<AccountPendingInfo>
Promise.<AccountPendingInfo>
Return pending info of an account
Kind: instance method of Conflux
Returns: Promise.<AccountPendingInfo>
- An account pending info object.
localNonce
BigInt
: then next nonce can use in the transaction poolnextPendingTx
string
: the hash of next pending transactionpendingCount
BigInt
: the count of pending transactionspendingNonce
BigInt
: the nonce of pending transaction
conflux.getAccountPendingTransactions(address) ⇒ Promise.<AccountPendingTransactions>
Promise.<AccountPendingTransactions>
Return pending transactions of one account
Kind: instance method of Conflux
Returns: Promise.<AccountPendingTransactions>
- An account's pending transactions and info.
pendingTransactions
Array
: pending transactionsfirstTxStatus
Object
: the status of first pending txpendingCount
BigInt
: the count of pending transactions
conflux.getCollateralForStorage(address, [epochNumber]) ⇒ Promise.<BigInt>
Promise.<BigInt>
Returns the size of the collateral storage of given address, in Byte.
Kind: instance method of Conflux
Returns: Promise.<BigInt>
- - The collateral storage in Byte.
Example
conflux.call(options, [epochNumber]) ⇒ Promise.<string>
Promise.<string>
Virtually call a contract, return the output data.
Kind: instance method of Conflux
Returns: Promise.<string>
- The output data.
conflux.estimateGasAndCollateral(options, [epochNumber]) ⇒ Promise.<EstimateResult>
Promise.<EstimateResult>
Virtually call a contract, return the estimate gas used and storage collateralized.
Kind: instance method of Conflux
Returns: Promise.<EstimateResult>
- A estimate result object:
BigInt
gasUsed: The gas used.BigInt
gasLimit: The gas limit.BigInt
storageCollateralized: The storage collateralized in Byte.
conflux.estimateGasAndCollateralAdvance(options, [epochNumber]) ⇒ Promise.<object>
Promise.<object>
Estimate a transaction's gas and storageCollateralize, check whether user's balance is enough for fee and value
Kind: instance method of Conflux
Returns: Promise.<object>
- A estimate result with advance info object:
BigInt
gasUsed: The gas used.BigInt
gasLimit: The gas limit.BigInt
storageCollateralized: The storage collateralized in Byte.BigInt
balance: The balance of the options.from.Boolean
isBalanceEnough: indicate balance is enough for gas and storage feeBoolean
isBalanceEnoughForValueAndFee: indicate balance is enough for gas and storage fee plus valueBoolean
willPayCollateral: false if the transaction is eligible for storage collateral sponsorship, true otherwiseBoolean
willPayTxFee: false if the transaction is eligible for gas sponsorship, true otherwise
conflux.checkBalanceAgainstTransaction(from, to, gas, gasPrice, storageLimit, [epochNumber]) ⇒ Promise.<object>
Promise.<object>
Check whether transaction sender's balance is enough for gas and storage fee
Kind: instance method of Conflux
Returns: Promise.<object>
- A check result object:
Boolean
isBalanceEnough: indicate balance is enough for gas and storage feeBoolean
willPayCollateral: false if the transaction is eligible for storage collateral sponsorship, true otherwiseBoolean
willPayTxFee: false if the transaction is eligible for gas sponsorship, true otherwise
conflux.getLogs([options]) ⇒ Promise.<Array.<Log>>
Promise.<Array.<Log>>
Returns logs matching the filter provided.
Kind: instance method of Conflux
Returns: Promise.<Array.<Log>>
- Array of log, that the logs matching the filter provided:
address
string
: Address this event originated from.topics
string[]
: Array of topics.data
string
: The data containing non-indexed log parameter.blockHash
string
: Hash of the block where the log in.epochNumber
number
: Epoch number of the block where the log in.transactionHash
string
: Hash of the transaction where the log in.transactionIndex
string
: Transaction index in the block.logIndex
number
: Log index in block.transactionLogIndex
number
: Log index in transaction.
Example
conflux.traceBlock(blockHash) ⇒ Promise.<Array.<object>>
Promise.<Array.<object>>
Return block's execution trace.
Note: need RPC server open trace_block method
Kind: instance method of Conflux
Returns: Promise.<Array.<object>>
- Array of transaction traces.
Example
conflux.traceTransaction(txHash) ⇒ Promise.<Array.<Trace>>
Promise.<Array.<Trace>>
Return transaction's trace
Kind: instance method of Conflux
Returns: Promise.<Array.<Trace>>
- Array of traces.
Example
conflux.traceFilter(filter) ⇒ Promise.<Array.<Trace>>
Promise.<Array.<Trace>>
Return traces that satisfy an filter
Kind: instance method of Conflux
Returns: Promise.<Array.<Trace>>
- Array of traces.
Example
conflux.getEpochReceipts(epochNumber) ⇒ Promise.<Array.<Array.<TransactionReceipt>>>
Promise.<Array.<Array.<TransactionReceipt>>>
Return one epoch's all receipts
Kind: instance method of Conflux
Returns: Promise.<Array.<Array.<TransactionReceipt>>>
- Array of array receipts.
Example
conflux.getEpochReceiptsByPivotBlockHash(pivotBlockHash) ⇒ Promise.<Array.<Array.<TransactionReceipt>>>
Promise.<Array.<Array.<TransactionReceipt>>>
Return one epoch's all receipts by pivot block hash
Kind: instance method of Conflux
Returns: Promise.<Array.<Array.<TransactionReceipt>>>
- Array of array receipts.
Example
conflux.getPoSEconomics() ⇒ Promise.<PoSEconomics>
Promise.<PoSEconomics>
Return PoS summary info
Kind: instance method of Conflux
Returns: Promise.<PoSEconomics>
- PoS summary info
distributablePosInterest
number
: Currently total distributable PoS interest (Drip)lastDistributeBlock
number
: Last distribute block numbertotalPosStakingTokens
number
: Total token amount (Drip) staked in PoS
conflux.subscribe(name, ...args) ⇒ Promise.<string>
Promise.<string>
Subscribe event by name and got id, and provider will emit event by id
Note: suggest use
conflux.subscribeXXX
to subscribe
Kind: instance method of Conflux
Returns: Promise.<string>
- Id of subscription
Example
conflux.subscribeEpochs([sub_epoch]) ⇒ Promise.<Subscription>
Promise.<Subscription>
The epochs topic streams consensus results: the total order of blocks, as expressed by a sequence of epochs. The returned series of epoch numbers is monotonically increasing with an increment of one. If you see the same epoch twice, this suggests a pivot chain reorg has happened (this might happen for recent epochs). For each epoch, the last hash in epochHashesOrdered is the hash of the pivot block.
Kind: instance method of Conflux
Returns: Promise.<Subscription>
- EventEmitter instance with the follow events:
'data':
epochNumber
number
: epoch numberepochHashesOrdered
array
: epoch block hash in orderstring
: block hash
Example
conflux.subscribeNewHeads() ⇒ Promise.<Subscription>
Promise.<Subscription>
The newHeads topic streams all new block headers participating in the consensus.
Kind: instance method of Conflux
Returns: Promise.<Subscription>
- EventEmitter instance with the follow events:
'data': see
getBlockByHash
Example
conflux.subscribeLogs([options]) ⇒ Promise.<Subscription>
Promise.<Subscription>
The logs topic streams all logs matching a certain filter, in order. In case of a pivot chain reorg (which might affect recent logs), a special revert message is sent. All logs received previously that belong to epochs larger than the one in this message should be considered invalid.
Kind: instance method of Conflux
Returns: Promise.<Subscription>
- EventEmitter instance with the follow events:
'data': see
getLogs
'revert':
revertTo 'number': epoch number
Example
Example
conflux.unsubscribe(id) ⇒ Promise.<boolean>
Promise.<boolean>
Unsubscribe subscription.
Kind: instance method of Conflux
Returns: Promise.<boolean>
- Is success
Example
Example
Conflux.create(options) ⇒ Conflux
Conflux
Create a Conflux instance with networdId set up
Kind: static method of Conflux
ConfluxOption : Object
Object
Kind: global typedef Properties
TransactionMeta : TransactionMeta
TransactionMeta
Kind: global typedef
Last updated