Skip to content

Commit

Permalink
ALL-2668 Add Horizen Eon Gobi and Chiliz Rpc support
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Sep 26, 2023
1 parent d544539 commit b482685
Show file tree
Hide file tree
Showing 7 changed files with 38 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 @@
## [3.1.9] - 2023.09.26
### Added
- Added RPC support for the Horizen Eon Gobi and Chiliz networks. Users can now make RPC calls to these networks using the `Network.HORIZEN_EON_GOBI` and `Network.CHILIZ` network.

## [3.1.8] - 2023.09.22
### Added
- Capability to initialize `TatumSDK` with various extensions from Extension Ecosystem using the init() method and `TatumConfig.configureExtensions`.
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": "3.1.8",
"version": "3.1.9",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
7 changes: 7 additions & 0 deletions src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum Network {
DOGECOIN = 'doge-mainnet',
EOS = 'eos-mainnet',
HORIZEN_EON = 'eon-mainnet',
CHILIZ = 'chiliz-mainnet',
ETHEREUM = 'ethereum-mainnet',
ETHEREUM_CLASSIC = 'ethereum-classic-mainnet',
FANTOM = 'fantom-mainnet',
Expand Down Expand Up @@ -70,6 +71,7 @@ export enum Network {
GNOSIS_TESTNET = 'gno-testnet',
HAQQ_TESTNET = 'haqq-testnet',
HARMONY_ONE_TESTNET_SHARD_0 = 'one-testnet-s0',
HORIZEN_EON_GOBI = 'horizen-eon-gobi',
KLAYTN_BAOBAB = 'klaytn-baobab',
KUCOIN_TESTNET = 'kcs-testnet',
LITECOIN_TESTNET = 'litecoin-testnet',
Expand Down Expand Up @@ -139,6 +141,8 @@ export const EVM_BASED_NETWORKS = [
Network.ARBITRUM_ONE,
Network.BINANCE_SMART_CHAIN,
Network.HORIZEN_EON,
Network.HORIZEN_EON_GOBI,
Network.CHILIZ,
]

export const UTXO_BASED_NETWORKS = [
Expand Down Expand Up @@ -203,8 +207,10 @@ export const EVM_LOAD_BALANCER_NETWORKS = [
Network.OPTIMISM,
Network.OPTIMISM_TESTNET,
Network.HORIZEN_EON,
Network.HORIZEN_EON_GOBI,
Network.ARBITRUM_ONE,
Network.BINANCE_SMART_CHAIN,
Network.CHILIZ,
]

export const TRON_LOAD_BALANCER_NETWORKS = [Network.TRON]
Expand All @@ -222,6 +228,7 @@ export const EVM_ARCHIVE_NON_ARCHIVE_LOAD_BALANCER_NETWORKS = [
Network.HAQQ_TESTNET,
Network.POLYGON,
Network.POLYGON_MUMBAI,
Network.CHILIZ,
]

export const SOLANA_NETWORKS = [Network.SOLANA, Network.SOLANA_DEVNET]
Expand Down
2 changes: 2 additions & 0 deletions src/e2e/rpc/evm/evm.rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const testNetworks = [
apiKey: process.env.V3_API_KEY_TESTNET,
},
{ network: Network.HORIZEN_EON, expected: { chainId: 7332 } },
{ network: Network.HORIZEN_EON_GOBI, expected: { chainId: 7332 } },
{ network: Network.CHILIZ, expected: { chainId: 7332 } },
{ network: Network.BINANCE_SMART_CHAIN, expected: { chainId: 56 } },
{
network: Network.BINANCE_SMART_CHAIN_TESTNET,
Expand Down
23 changes: 14 additions & 9 deletions src/service/tatum/tatum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { isLoadBalancerNetwork } from '../../dto'
import { EvmBasedRpcSuite, SolanaRpcSuite, TronRpcSuite, UtxoBasedRpcSuite, XrpRpcSuite } from '../../dto/rpc'
import { CONFIG, Constant, Utils } from '../../util'
import { Address, AddressTezos, AddressTron } from '../address'
import { TatumSdkContainer, TatumSdkExtension } from '../extensions'
import { FeeEvm, FeeUtxo } from '../fee'
import { Nft, NftTezos } from '../nft'
import { Notification } from '../notification'
Expand All @@ -11,22 +12,25 @@ import { LoadBalancer } from '../rpc/generic/LoadBalancer'
import { Token } from '../token'
import { WalletProvider } from '../walletProvider'
import { ApiVersion, TatumConfig } from './tatum.dto'
import { TatumSdkContainer, TatumSdkExtension } from "../extensions";

export interface ITatumSdkChain {
extension<T extends TatumSdkExtension>(type: new (tatumSdkContainer: TatumSdkContainer, ...args: unknown[]) => T): T
extension<T extends TatumSdkExtension>(
type: new (tatumSdkContainer: TatumSdkContainer, ...args: unknown[]) => T,
): T
}

export abstract class TatumSdkChain implements ITatumSdkChain {
protected constructor(readonly id: string) { }
protected constructor(readonly id: string) {}

extension<T extends TatumSdkExtension>(type: new (tatumSdkContainer: TatumSdkContainer, ...args: unknown[]) => T): T {
return Container.of(this.id).get(type);
}
extension<T extends TatumSdkExtension>(
type: new (tatumSdkContainer: TatumSdkContainer, ...args: unknown[]) => T,
): T {
return Container.of(this.id).get(type)
}

destroy(): void {
Container.of(this.id).reset( {strategy: 'resetServices' })
}
destroy(): void {
Container.of(this.id).reset({ strategy: 'resetServices' })
}
}

export class BaseTatumSdk extends TatumSdkChain {
Expand Down Expand Up @@ -98,6 +102,7 @@ export class Polygon extends BaseEvmClass {}
export class Vechain extends BaseEvmClass {}
export class Xdc extends BaseEvmClass {}
export class HorizenEon extends BaseEvmClass {}
export class Chiliz extends BaseEvmClass {}

// UTXO chains
export class Bitcoin extends BaseUtxoClass {}
Expand Down
6 changes: 6 additions & 0 deletions src/util/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const Constant = {
[Network.ETHEREUM_CLASSIC]: 18,
[Network.EOS]: 4,
[Network.HORIZEN_EON]: 18,
[Network.HORIZEN_EON_GOBI]: 18,
[Network.EOS_TESTNET]: 4,
[Network.TEZOS]: 6,
[Network.TEZOS_TESTNET]: 6,
Expand Down Expand Up @@ -109,6 +110,7 @@ export const Constant = {
[Network.FLARE_SONGBIRD]: 18,
[Network.HAQQ]: 18,
[Network.HAQQ_TESTNET]: 18,
[Network.CHILIZ]: 18,
},
CURRENCY_NAMES: {
[Network.BITCOIN]: 'BTC',
Expand Down Expand Up @@ -176,6 +178,7 @@ export const Constant = {
[Network.ETHEREUM_CLASSIC]: 'ETC',
[Network.EOS]: 'EOS',
[Network.HORIZEN_EON]: 'EON',
[Network.HORIZEN_EON_GOBI]: 'EON',
[Network.EOS_TESTNET]: 'EOS',
[Network.TEZOS]: 'XTZ',
[Network.TEZOS_TESTNET]: 'XTZ',
Expand All @@ -199,6 +202,7 @@ export const Constant = {
[Network.ZILLIQA_TESTNET]: 'ZIL',
[Network.HAQQ]: 'HAQQ',
[Network.HAQQ_TESTNET]: 'HAQQ',
[Network.CHILIZ]: 'CHILIZ',
},
RPC: {
MAINNETS: [
Expand Down Expand Up @@ -243,6 +247,7 @@ export const Constant = {
Network.XRP,
Network.ZCASH,
Network.ZILLIQA,
Network.CHILIZ,
],
TESTNETS: [
Network.ALGORAND_TESTNET,
Expand Down Expand Up @@ -285,6 +290,7 @@ export const Constant = {
Network.XRP_TESTNET,
Network.ZCASH_TESTNET,
Network.ZILLIQA_TESTNET,
Network.HORIZEN_EON_GOBI,
],
},
OPEN_RPC: {
Expand Down
4 changes: 4 additions & 0 deletions src/util/util.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
Bitcoin,
BitcoinCash,
Celo,
Chiliz,
Cronos,
Dogecoin,
Ethereum,
Expand Down Expand Up @@ -383,7 +384,10 @@ export const Utils = {
case Network.TEZOS:
return new Tezos(id) as T
case Network.HORIZEN_EON:
case Network.HORIZEN_EON_GOBI:
return new HorizenEon(id) as T
case Network.CHILIZ:
return new Chiliz(id) as T
default:
return new BaseTatumSdk(id) as T
}
Expand Down

0 comments on commit b482685

Please sign in to comment.