Skip to content

Commit

Permalink
ALL-4358 - Add Flare subscription support
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Feb 15, 2024
1 parent df50c3d commit 9ff37fc
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 6 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.9] - 2024.2.15

### Added

- Added support for Flare, Flare Coston, Flare Coston 2 and Flare Songbird subscriptions.

## [4.2.8] - 2024.2.15

### Updated
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.8",
"version": "4.2.9",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
1 change: 1 addition & 0 deletions src/dto/AddressEventNotificationChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export enum AddressEventNotificationChain {
TEZOS = 'TEZOS',
EON = 'EON',
CHZ = 'CHZ',
FLR = 'FLR',
}
1 change: 1 addition & 0 deletions src/dto/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export enum Chain {
Dogecoin = 'Dogecoin',
Tron = 'Tron',
BinanceSmartChain = 'BinanceSmartChain',
Flare = 'Flare',
}
4 changes: 2 additions & 2 deletions src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,16 +763,16 @@ export const NETWORK_METADATA: Record<Network, NetworkMetadata> = {
currency: Currency.FLR,
testnet: false,
chainId: 14,
defaultMainnet: true,
},
[Network.FLARE_COSTON_2]: {
currency: Currency.FLR,
testnet: true,
defaultTestnet: true,
chainId: 114,
},
[Network.FLARE_SONGBIRD]: {
currency: Currency.SGB,
testnet: false,
testnet: true,
chainId: 19,
},
[Network.FLARE_COSTON]: {
Expand Down
40 changes: 40 additions & 0 deletions src/e2e/e2e.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export const AddressEventNetworks = [
Network.XRP,
Network.XRP_TESTNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const IncomingNativeTxNetworks = [
Expand Down Expand Up @@ -61,6 +65,10 @@ export const IncomingNativeTxNetworks = [
Network.XRP,
Network.XRP_TESTNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const OutgoingNativeTxNetworks = [
Expand Down Expand Up @@ -88,6 +96,10 @@ export const OutgoingNativeTxNetworks = [
Network.XRP,
Network.XRP_TESTNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const OutgoingFailedNetworks = [
Expand All @@ -103,6 +115,10 @@ export const OutgoingFailedNetworks = [
Network.KLAYTN,
Network.KLAYTN_BAOBAB,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const PaidFeeNetworks = [
Expand All @@ -122,6 +138,10 @@ export const PaidFeeNetworks = [
Network.XRP,
Network.XRP_TESTNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const FungibleTxNetworks = [
Expand All @@ -141,6 +161,10 @@ export const FungibleTxNetworks = [
Network.SOLANA,
Network.SOLANA_DEVNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const NftNetworks = [
Expand All @@ -160,6 +184,10 @@ export const NftNetworks = [
Network.SOLANA,
Network.SOLANA_DEVNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const MultitokenNetworks = [
Expand All @@ -174,6 +202,10 @@ export const MultitokenNetworks = [
Network.BINANCE_SMART_CHAIN_TESTNET,
Network.KLAYTN,
Network.KLAYTN_BAOBAB,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const FailedTxPerBlockNetworks = [
Expand All @@ -193,6 +225,10 @@ export const FailedTxPerBlockNetworks = [
Network.SOLANA,
Network.SOLANA_DEVNET,
Network.TEZOS,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const ContractAddressLogEventNetworks = [
Expand All @@ -207,6 +243,10 @@ export const ContractAddressLogEventNetworks = [
Network.BINANCE_SMART_CHAIN_TESTNET,
Network.KLAYTN,
Network.KLAYTN_BAOBAB,
Network.FLARE,
Network.FLARE_COSTON,
Network.FLARE_COSTON_2,
Network.FLARE_SONGBIRD,
]

export const InternalTxNetworks = [
Expand Down
4 changes: 4 additions & 0 deletions src/e2e/e2e.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const e2eUtil = {
switch (network) {
case Network.ETHEREUM_SEPOLIA:
case Network.ETHEREUM_HOLESKY:
case Network.FLARE:
case Network.FLARE_COSTON:
case Network.FLARE_COSTON_2:
case Network.FLARE_SONGBIRD:
return '0xdb4C3b4350EE869F2D0a2F43ce0292865E2Aa149'
case Network.CELO_ALFAJORES:
return '0xdf083B077F1FD890fC71feCaBbd3F68F94cD21Bf'
Expand Down
3 changes: 2 additions & 1 deletion src/e2e/rpc/other/tatum.rpc.solana.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const getClient = async (testnet?: boolean): Promise<Solana> =>

const blockNumber = 203046000

describe('Solana', () => {
// TODO: Too unstable
describe.skip('Solana', () => {
describe('mainnet', () => {
describe('getAccountInfo', () => {
it('should return account info', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/tatum.notification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { e2eUtil } from './e2e.util'

// TODO pipeline dont work with API keys

describe.skip('notification', () => {
describe('notification', () => {
beforeAll(async () => {
const tatum = await TatumSDK.init<Ethereum>({
network: Network.ETHEREUM,
Expand Down
2 changes: 1 addition & 1 deletion src/service/tatum/tatum.evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export class EthereumClassic extends BaseEvm {}
export class Fantom extends BaseEvm {}
export class Gnosis extends BaseEvm {}
export class Haqq extends BaseEvm {}
export class Flare extends BaseEvm {}
export class HarmonyOne extends BaseEvm {}
export class Kucoin extends BaseEvm {}
export class Oasis extends BaseEvm {}
export class Optimism extends BaseEvm {}
export class Palm extends BaseEvm {}
export class Vechain extends BaseEvm {}
export class XinFin extends BaseEvm {}
export class Flare extends NotificationEvm {}
export class Chiliz extends NotificationEvm {}

export class HorizenEon extends BaseEvm {
Expand Down
1 change: 1 addition & 0 deletions src/util/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const Constant = {
[AddressEventNotificationChain.DOGE]: Chain.Dogecoin,
[AddressEventNotificationChain.TRON]: Chain.Tron,
[AddressEventNotificationChain.BSC]: Chain.BinanceSmartChain,
[AddressEventNotificationChain.FLR]: Chain.Flare,
},
},
DECIMALS: {
Expand Down
7 changes: 7 additions & 0 deletions src/util/util.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ export const Utils = {
return Network.HORIZEN_EON
case AddressEventNotificationChain.CHZ:
return Network.CHILIZ
case AddressEventNotificationChain.FLR:
return Network.FLARE
default:
throw new Error(`Chain ${chain} is not supported.`)
}
Expand Down Expand Up @@ -465,6 +467,11 @@ export const Utils = {
return AddressEventNotificationChain.EON
case Network.CHILIZ:
return AddressEventNotificationChain.CHZ
case Network.FLARE:
case Network.FLARE_COSTON:
case Network.FLARE_COSTON_2:
case Network.FLARE_SONGBIRD:
return AddressEventNotificationChain.FLR
default:
throw new Error(`Network ${network} is not supported.`)
}
Expand Down

0 comments on commit 9ff37fc

Please sign in to comment.