v2.0 Changes

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:

async function main() {
  const conflux = new Conflux({
    url: 'https://test.confluxrpc.com',
    networkId: 1
  });
  const status = await conflux.pos.getStatus();
  console.log('Current PoS status: ', status);
  /*
  {
    epoch: 29,
    latestCommitted: 1725,
    latestTxNumber: '0x1e36',
    latestVoted: 1728,
    pivotDecision: {
      blockHash: '0xc8c2c58ef952f48adf00d6204d6e930f23aee26c6b9a903820bea1c012f72f3e',
      height: 120480
    }
  }
  */
}

Check PoS RPC documentation for the complete method list.

And previous cfx RPC methods are also been moved to their own namespace, for example:

Besides txpool and trace namespace is also added, so js-sdk v2.0 have four RPC namespace:

  • cfx

  • pos

  • txpool

  • trace

There also is an advanced namespace, which will provide some useful combined RPC utilities, for example:

  • getNextUsableNonce

  • getPoSInterestRate

Add new Internal contracts

Two more internal contracts are added:

  • ConfluxContext

  • PoSRegister

Add support for batch request RPC

v2.0 has add support for RPC batch invoke, for example:

Check here for detail introduction.

Browser exported SDK name changed to TreeGraph

Note this is a breaking change

From v2.0 the browser exported SDK class name has change from Conflux to TreeGraph.

Previous

Currently:

Enable fast send transaction

If your RPC endpoint support txpool RPC methods, now you can fast send transaction sequencely. For example:

Note the max sequence transaction send count can not surpass 2000

Readable ABI support

Last updated

Was this helpful?