Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALL-4358 - Add Flare subscription support #1064

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 Expand Up @@ -82,7 +86,7 @@
})
if (error) {
await tatum.destroy()
throw new Error(error.message.join(','))

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Address Event ► OK bitcoin-testnet

Failed test found in: reports/jest-junit.xml Error: Error: address must be a valid mainnet BTC address. Bitcoin address should start with 1, 2, 3, bc1, m, n or tb1. And it must be at least 27 characters long.
Raw output
Error: address must be a valid mainnet BTC address. Bitcoin address should start with 1, 2, 3, bc1, m, n or tb1. And it must be at least 27 characters long. 
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:54:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Address Event ► OK bch-testnet

Failed test found in: reports/jest-junit.xml Error: Error: address must be a valid mainnet BCH address. Bitcoin Cash address must start with bitcoincash, bchtest or bchreg. And must contain 42 characters after.
Raw output
Error: address must be a valid mainnet BCH address. Bitcoin Cash address must start with bitcoincash, bchtest or bchreg. And must contain 42 characters after. 
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:54:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Address Event ► OK litecoin-testnet

Failed test found in: reports/jest-junit.xml Error: Error: Request validation failed. Please see data for additional information.
Raw output
Error: Request validation failed. Please see data for additional information.
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:54:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Address Event ► OK doge-testnet

Failed test found in: reports/jest-junit.xml Error: Error: address must be a valid mainnet DOGE address. Doge address must start with D or n. And must contain 33 characters after.
Raw output
Error: address must be a valid mainnet DOGE address. Doge address must start with D or n. And must contain 33 characters after. 
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:54:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK bitcoin-testnet

Failed test found in: reports/jest-junit.xml Error: Error: address must be a valid mainnet BTC address. Bitcoin address should start with 1, 2, 3, bc1, m, n or tb1. And it must be at least 27 characters long.
Raw output
Error: address must be a valid mainnet BTC address. Bitcoin address should start with 1, 2, 3, bc1, m, n or tb1. And it must be at least 27 characters long. 
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK litecoin-testnet

Failed test found in: reports/jest-junit.xml Error: Error: Request validation failed. Please see data for additional information.
Raw output
Error: Request validation failed. Please see data for additional information.
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK doge-testnet

Failed test found in: reports/jest-junit.xml Error: Error: address must be a valid mainnet DOGE address. Doge address must start with D or n. And must contain 33 characters after.
Raw output
Error: address must be a valid mainnet DOGE address. Doge address must start with D or n. And must contain 33 characters after. 
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK tron-testnet

Failed test found in: reports/jest-junit.xml Error: Error: Subscription for type INCOMING_NATIVE_TX on the address id TLduuX5NWFucPPafLbj9eab6Znwrdm72Qv and currency TRON already exists (65ce1e76bfd3da4bc8c65447).
Raw output
Error: Subscription for type INCOMING_NATIVE_TX on the address id TLduuX5NWFucPPafLbj9eab6Znwrdm72Qv and currency TRON already exists (65ce1e76bfd3da4bc8c65447).
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK solana-devnet

Failed test found in: reports/jest-junit.xml Error: Error: Too Many Requests
Raw output
Error: Too Many Requests
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK flare-coston

Failed test found in: reports/jest-junit.xml Error: Error: Maximum overall subscriptions count for free plan is 5.
Raw output
Error: Maximum overall subscriptions count for free plan is 5.
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11

Check failure on line 89 in src/e2e/e2e.util.ts

View workflow job for this annotation

GitHub Actions / TEST REPORT

src/e2e/tatum.notification.spec.ts ► notification › createSubscription › IP auth › Incoming Native Tx ► OK flare-coston2

Failed test found in: reports/jest-junit.xml Error: Error: Maximum overall subscriptions count for free plan is 5.
Raw output
Error: Maximum overall subscriptions count for free plan is 5.
    at Object.testAddressBasedSubscription (/home/runner/work/tatum-js/tatum-js/src/e2e/e2e.util.ts:89:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /home/runner/work/tatum-js/tatum-js/src/e2e/tatum.notification.spec.ts:73:11
}

expect(data.id).toBeDefined()
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
Loading