Skip to content

Commit

Permalink
ALL-4357 Add Holesky testnet subscription (#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel authored Feb 1, 2024
1 parent 32c22dd commit 14a09bd
Show file tree
Hide file tree
Showing 19 changed files with 694 additions and 147 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [4.2.5] - 2024.1.31

### Added

- Added support for Holesky Ethereum testnet for subscriptions.

## [4.2.4] - 2024.1.25

### Fixed
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.4",
"version": "4.2.5",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
14 changes: 10 additions & 4 deletions src/connector/tatum.connector.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'process'
import { Container, Service } from 'typedi'
import { JsonRpcCall } from '../dto'
import { ApiVersion } from '../service'
Expand Down Expand Up @@ -134,16 +135,21 @@ export class TatumConnector {
}
}

private getBaseUrl() {
const config = Container.of(this.id).get(CONFIG)
if (process.env.TATUM_URL) {
return process.env.TATUM_URL
}
return config.version === ApiVersion.V3 ? Constant.TATUM_API_URL.V3 : Constant.TATUM_API_URL.V4
}

private getUrl<PARAMS extends DefaultParamsType = DefaultParamsType>({
path,
params,
basePath,
}: GetUrl<PARAMS>) {
const config = Container.of(this.id).get(CONFIG)
const url = new URL(
path || '',
basePath || (config.version === ApiVersion.V3 ? Constant.TATUM_API_URL.V3 : Constant.TATUM_API_URL.V4),
)
const url = new URL(path || '', basePath || this.getBaseUrl())

if (params) {
Object.keys(params)
Expand Down
44 changes: 43 additions & 1 deletion src/dto/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,51 @@ import { Network } from './Network'

export enum Currency {
ETH = 'ETH',
SOL = 'SOL',
XRP = 'XRP',
MATIC = 'MATIC',
CELO = 'CELO',
KLAY = 'KLAY',
BTC = 'BTC',
DOGE = 'DOGE',
LTC = 'LTC',
BCH = 'BCH',
DOGE = 'DOGE',
TRON = 'TRON',
BSC = 'BSC',
TEZOS = 'TEZOS',
EON = 'EON',
CHZ = 'CHZ',
ALGO = 'ALGO',
ADA = 'ADA',
VET = 'VET',
FLOW = 'FLOW',
XDC = 'XDC',
XLM = 'XLM',
BNB = 'BNB',
ONE = 'ONE',
EOS = 'EOS',
AVAX = 'AVAX',
FTM = 'FTM',
ARB = 'ARB',
OP = 'OP',
NEAR = 'NEAR',
RSK = 'RSK',
AURORA = 'AURORA',
XOS = 'XOS',
ZCASH = 'ZCASH',
ZEC = 'ZEC',
PALM = 'PALM',
ZIL = 'ZIL',
ETC = 'ETC',
FLR = 'FLR',
SGB = 'SGB',
ISLM = 'ISLM',
ZEN = 'ZEN',
GNO = 'GNO',
CRO = 'CRO',
KCS = 'KCS',
EGLD = 'EGLD',
DOT = 'DOT',
}

export function networkToCurrency(network: Network): Currency {
Expand Down
Loading

0 comments on commit 14a09bd

Please sign in to comment.