js-conflux-sdk v2.0 has imported several big features.
Group RPC methods by namespace
From Conflux-rust v2.0.0, the pos RPC group has been added, which can be used to get PoS chain info. js-conflux-sdk will add support to PoS related RPC in v2.0. These methods are located at Conflux's sub object pos conflux.pos, for example:
If your RPC endpoint support txpool RPC methods, now you can fast send transaction sequencely. For example:
for(let i =0; i <100; i++) {let hash =awaitconflux.cfx.sendTransaction({ from: account, to:'cfxtest:aaawgvnhveawgvnhveawgvnhveawgvnhvey1umfzwp', value:1 });console.log(`TX hash: ${hash}`);}
Note the max sequence transaction send count can not surpass 2000
Readable ABI support
consttokenAbi= [// Some details about the token"function name() view returns (string)","function symbol() view returns (string)",// Get the account balance"function balanceOf(address) view returns (uint)",// Send some of your tokens to someone else"function transfer(address to, uint amount)",// An event triggered whenever anyone transfers to someone else"event Transfer(address indexed from, address indexed to, uint amount)"];constcontract=conflux.Contract({ abi: tokenAbi, address:'cfxtest:aaawgvnhveawgvnhveawgvnhveawgvnhvey1umfzwp'// use a valid token address here});constbalance=awaitcontract.balanceOf('cfxtest:aaawgvnhveawgvnhveawgvnhveawgvnhvey1umfzwp');