Skip to content

Commit

Permalink
ALL-4820 - Added BASE RPC Support (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel authored Mar 11, 2024
1 parent ff2ed8e commit d106fe6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [4.2.15] - 2024.3.11

### Added

- Added RPC support for the BASE network. Users can now make Base RPC calls using the `Network.BASE` network.

## [4.2.14] - 2024.3.11

### Changed
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.2.14",
"version": "4.2.15",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
1 change: 1 addition & 0 deletions src/dto/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export enum Currency {
KCS = 'KCS',
EGLD = 'EGLD',
DOT = 'DOT',
BASE = 'BASE',
}

export function networkToCurrency(network: Network): Currency {
Expand Down
13 changes: 13 additions & 0 deletions src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum Network {
AVALANCHE_C = 'avalanche-c-mainnet',
AVALANCHE_P = 'avax-p-mainnet',
AVALANCHE_X = 'avax-x-mainnet',
BASE = 'base-mainnet',
BINANCE_SMART_CHAIN = 'bsc-mainnet',
BNB = 'bnb-beacon-chain-mainnet',
BITCOIN = 'bitcoin-mainnet',
Expand Down Expand Up @@ -58,6 +59,7 @@ export enum Network {
AVALANCHE_C_TESTNET = 'avax-testnet',
AVALANCHE_P_TESTNET = 'avax-p-testnet',
AVALANCHE_X_TESTNET = 'avax-x-testnet',
BASE_SEPOLIA = 'base-sepolia',
BINANCE_SMART_CHAIN_TESTNET = 'bsc-testnet',
BITCOIN_TESTNET = 'bitcoin-testnet',
BITCOIN_CASH_TESTNET = 'bch-testnet',
Expand Down Expand Up @@ -227,6 +229,7 @@ export const EVM_LOAD_BALANCER_NETWORKS = [
Network.XINFIN,
Network.FANTOM,
Network.CRONOS,
Network.BASE,
]

export const TRON_LOAD_BALANCER_NETWORKS = [Network.TRON]
Expand Down Expand Up @@ -855,4 +858,14 @@ export const NETWORK_METADATA: Record<Network, NetworkMetadata> = {
testnet: true,
chainId: 0,
},
[Network.BASE]: {
currency: Currency.BASE,
testnet: false,
chainId: 8453,
},
[Network.BASE_SEPOLIA]: {
currency: Currency.BASE,
testnet: true,
chainId: 84532,
},
}
1 change: 1 addition & 0 deletions src/e2e/rpc/evm/evm.rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const testNetworks = [
},
{ network: Network.CRONOS },
{ network: Network.CRONOS_TESTNET, apiKey: process.env.V3_API_KEY_TESTNET },
{ network: Network.BASE },
]

describe.each(testNetworks)('RPC EVM', (testNetwork) => {
Expand Down
1 change: 1 addition & 0 deletions src/service/tatum/tatum.evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class Optimism extends BaseEvm {}
export class Palm extends BaseEvm {}
export class Vechain extends BaseEvm {}
export class XinFin extends BaseEvm {}
export class Base extends BaseEvm {}
export class Flare extends NotificationEvm {}
export class Chiliz extends NotificationEvm {}

Expand Down
4 changes: 4 additions & 0 deletions src/util/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export const Constant = {
[Network.HAQQ_TESTNET]: 18,
[Network.CHILIZ]: 18,
[Network.BNB]: 18,
[Network.BASE]: 18,
[Network.BASE_SEPOLIA]: 18,
},
CURRENCY_NAMES: {
[Network.BITCOIN]: 'BTC',
Expand Down Expand Up @@ -210,6 +212,8 @@ export const Constant = {
[Network.HAQQ_TESTNET]: 'HAQQ',
[Network.CHILIZ]: 'CHILIZ',
[Network.BNB]: 'BNB',
[Network.BASE]: 'BASE',
[Network.BASE_SEPOLIA]: 'BASE',
},
RPC: {
MAINNETS: [
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 @@ -44,6 +44,7 @@ import {
ArbitrumOne,
Aurora,
AvalancheC,
Base,
BinanceSmartChain,
Bitcoin,
BitcoinCash,
Expand Down Expand Up @@ -718,6 +719,9 @@ export const Utils = {
case Network.STELLAR:
case Network.STELLAR_TESTNET:
return new Stellar(id) as T
case Network.BASE:
case Network.BASE_SEPOLIA:
return new Base(id) as T
default:
return new FullSdk(id) as T
}
Expand Down

0 comments on commit d106fe6

Please sign in to comment.