Usage
Using EIP-1193 provider
Checking account balance
Obtaining a connex instance in Node.js
Sending VET
Working with web3.js
Working with ethers.js
Obtaining a signer
Deploying a contract
Methods modifyProvider
and modifyFactory
are used to patch the original code of ethers.js that is incompatible with the Thor protocol.
Request at a particular block hight
APIs eth_getBalance
, eth_getCode
, eth_getStorageAt
and eth_call
allow users to specify a particular block height [1]. To do that, we need to provide a Net
object when creating a provider:
Fee delegation
Fee delegation can be enabled by passing the delegator URL when constructing an instance of Provider
/ProviderWeb3
:
or calling enableDelegate
:
You can also disable fee delegation by
A delegator is a web service that co-signs and returns a signature for transactions it accepts. The gas fee would then be deducted from the delegator's account instead of the transaction sender's account. More information on fee delegation is available Fee Delegation
See here for a demo.
More Examples
More examples can be found here.
Supported APIs
eth_accounts
eth_blockNumber
eth_call
eth_estimateGas
eth_gasPrice
Returning 0x0
eth_getBalance
eth_getBlockByNumber
eth_getBlockByHash
eth_chainId
eth_getCode
eth_getLogs
eth_getStorageAt
eth_getTransactionByHash
eth_getTransactionCount
Returning 0x0
eth_getTransactionReceipt
eth_isSyncing
eth_requestAccounts
eth_sendRawTransaction
Requiring passing a Net
object when constructing an instance of Provider
or ProviderWeb3
eth_sendTransaction
eth_subscribe
, eth_unsubscribe
Supported subscription type: newHeads
, logs
evm_mine
net_version
Equivalent to eth_chainId
web3_clientVersion
Returning string thor
debug_traceTransaction
debug_traceCall
Implementation Notes
Fields
blockHash
andtransactionHash
return the values ofblockId
andtransactionId
defined in the Thor protocol, respectively.APIs
eth_estimateGas
,eth_call
,eth_getTransactionReceipt
,debug_traceTransaction
anddebug_traceCall
only return information associated with the first clause in a transaction.Clauses (Multi-Task Transaction)Unsupported returning fields (all set to zero):
cumulativeGasUsed
difficulty
gasPrice
logsBloom
nonce
sha3Uncles
totalDifficulty
For the default block number options [1], only
latest
andearliest
are supported
Last updated