Skip to content

Commit

Permalink
ALL-2669 Add Support for Bitcoin Cash (#964)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel authored Oct 9, 2023
1 parent a4c02ab commit 43ba8cf
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [4.0.13] - 2023.10.09
### Added
- Added RPC support for the BITCOIN_CASH network. Users can now make RPC calls to these network using the `Network.BITCOIN_CASH` network.

## [4.0.12] - 2023.10.09
### Added
- Added RPC support for the KLAYTN network. Users can now make RPC calls to these network using the `Network.KLAYTN` network.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "4.0.12",
"version": "4.0.13",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
3 changes: 2 additions & 1 deletion src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export enum Network {
AVALANCHE_X = 'avax-x-mainnet',
BINANCE_SMART_CHAIN = 'bsc-mainnet',
BITCOIN = 'bitcoin-mainnet',
BITCOIN_CASH = 'bch-mainnet',
BITCOIN_CASH = 'bitcoin-cash-mainnet',
CARDANO = 'cardano-mainnet',
CELO = 'celo-mainnet',
CRONOS = 'cro-mainnet',
Expand Down Expand Up @@ -194,6 +194,7 @@ export const UTXO_LOAD_BALANCER_NETWORKS = [
Network.DOGECOIN,
Network.DOGECOIN_TESTNET,
Network.ZCASH,
Network.BITCOIN_CASH,
]

export const EVM_LOAD_BALANCER_NETWORKS = [
Expand Down
3 changes: 2 additions & 1 deletion src/e2e/rpc/other/tatum.rpc.eos.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const getEosRpc = async (testnet?: boolean) =>
verbose: e2eUtil.isVerbose,
})

describe('eos', () => {
// Too unstable
describe.skip('eos', () => {
describe('mainnet', () => {
it('getInfo', async () => {
const tatum = await getEosRpc()
Expand Down
14 changes: 7 additions & 7 deletions src/e2e/rpc/utxo/utxo.e2e.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const UtxoE2eUtils = {
const tatum = await UtxoE2eUtils.initTatum(params)
const { result } = await tatum.rpc.getBlockChainInfo()

expect(result.chain).toBe(type)
await tatum.destroy()
expect(result.chain).toBe(type)
})

it('chain info raw call', async () => {
Expand All @@ -34,49 +34,49 @@ export const UtxoE2eUtils = {
id: '1',
jsonrpc: '2.0',
})
expect(info.result.chain).toBe(type)
await tatum.destroy()
expect(info.result.chain).toBe(type)
})

it('best block hash', async () => {
const tatum = await UtxoE2eUtils.initTatum(params)
const { result } = await tatum.rpc.getBestBlockHash()

expect(result).toBeTruthy()
await tatum.destroy()
expect(result).toBeTruthy()
})

it('block count', async () => {
const tatum = await UtxoE2eUtils.initTatum(params)
const { result } = await tatum.rpc.getBlockCount()

expect(result).toBeGreaterThan(0)
await tatum.destroy()
expect(result).toBeGreaterThan(0)
})

it('difficulty', async () => {
const tatum = await UtxoE2eUtils.initTatum(params)
const { result } = await tatum.rpc.getDifficulty()

expect(result).toBeGreaterThan(0)
await tatum.destroy()
expect(result).toBeGreaterThan(0)
})

it('mempool info', async () => {
const tatum = await UtxoE2eUtils.initTatum(params)
const { result } = await tatum.rpc.getMempoolInfo()

expect(result).toBeDefined()
await tatum.destroy()
expect(result).toBeDefined()
})

if (!params.skipEstimateSmartFee) {
it('estimatesmartfee', async () => {
const tatum = await UtxoE2eUtils.initTatum(params)
const result = await tatum.rpc.estimateSmartFee(6)

expect(result.result).not.toBeNull()
await tatum.destroy()
expect(result.result).not.toBeNull()
})
}
},
Expand Down
7 changes: 7 additions & 0 deletions src/e2e/rpc/utxo/utxo.rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ const utxoTestNetworks = [
skipEstimateSmartFee: true,
},
{ network: Network.ZCASH, type: UtxoNetworkType.MAIN, skipEstimateSmartFee: true },
{
network: Network.BITCOIN_CASH_TESTNET,
type: UtxoNetworkType.TEST,
apiKey: process.env.V3_API_KEY_TESTNET,
skipEstimateSmartFee: true,
},
{ network: Network.BITCOIN_CASH, type: UtxoNetworkType.MAIN, skipEstimateSmartFee: true },
]

describe.each(utxoTestNetworks)('UTXO E2E Test Suite', (testNetwork) => {
Expand Down

0 comments on commit 43ba8cf

Please sign in to comment.