0.8.3 • Published 1 year ago

web3-providers-http-proxy v0.8.3

Weekly downloads
4
License
ISC
Repository
github
Last release
1 year ago

web3-provider-proxy

An http provider port from web3, which can proxy eth RPC requests to Conflux Core RPC service. This package use json-rpc-engine to convert RPC requests and responses.

How to use

Install through npm

$ npm install web3-providers-http-proxy

JsonRpcProxy

  • support websocket and http url
const JsonRpcProxy = require('web3-providers-http-proxy');
const URL = 'https://test.confluxrpc.com';
const proxy = new JsonRpcProxy(URL);
// then use proxy as an provider

See tests for usage details.

ETH-to-CFX what has been bridged

Tags

  • earliest -> earliest
  • latest -> latest_state

Address

  • hex40 to base32

Supported RPC methods

const ETH_TO_CFX_METHOD_MAPPER = {
  eth_blockNumber: 'cfx_epochNumber',
  eth_sendRawTransaction: 'cfx_sendRawTransaction',
  eth_sendTransaction: 'cfx_sendTransaction',
  eth_getBalance: 'cfx_getBalance',
  eth_call: 'cfx_call',
  eth_estimateGas: 'cfx_estimateGasAndCollateral',
  eth_gasPrice: 'cfx_gasPrice',
  eth_accounts: 'accounts',
  eth_getTransactionCount: 'cfx_getNextNonce',
  eth_getCode: 'cfx_getCode',
  eth_getStorageAt: 'cfx_getStorageAt',
  eth_getBlockByHash: 'cfx_getBlockByHash',
  eth_getBlockByNumber: 'cfx_getBlockByEpochNumber',
  eth_getTransactionByHash: 'cfx_getTransactionByHash',
  web3_clientVersion: 'cfx_clientVersion',
  eth_chainId: 'cfx_getStatus',
  net_version: 'cfx_getStatus',   // networkId
  eth_getTransactionReceipt: 'cfx_getTransactionReceipt',
  eth_getLogs: 'cfx_getLogs',
  eth_getBlockTransactionCountByHash: 'cfx_getBlockByHash',
  eth_getBlockTransactionCountByNumber: 'cfx_getBlockByEpochNumber',
  eth_getTransactionByBlockHashAndIndex: 'cfx_getBlockByHash',
  eth_getTransactionByBlockNumberAndIndex: 'cfx_getBlockByEpochNumber',
  eth_coinbase: null,
  eth_sign: 'sign',
  eth_signTransaction: 'cfx_signTransaction',
  web3_sha3: 'cfx_sha3',
};

References

  1. Conflux RPC doc
  2. Ethereum RPC doc
  3. Ethereum open-RPC
0.8.1

1 year ago

0.8.3

1 year ago

0.7.11

2 years ago

0.7.10

2 years ago

0.7.9

2 years ago

0.7.13

1 year ago

0.7.12

1 year ago

0.7.6

2 years ago

0.7.5

2 years ago

0.7.8

2 years ago

0.7.7

2 years ago

0.7.18

1 year ago

0.7.17

1 year ago

0.7.16

1 year ago

0.7.20

1 year ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.0

2 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago