From 47f402eba639447b217b4d232b641e11d9316c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Ka=C5=A1tovsk=C3=BD?= Date: Tue, 23 Jan 2024 12:03:08 +0100 Subject: [PATCH 1/3] ALL-4110: hard remove sdk faucets --- README.md | 31 ----------------- docs/structure.md | 14 ++++---- src/e2e/tatum.faucet.spec.ts | 57 -------------------------------- src/service/faucet/faucet.dto.ts | 3 -- src/service/faucet/faucet.ts | 46 -------------------------- src/service/faucet/index.ts | 2 -- src/service/tatum/tatum.evm.ts | 14 +------- src/service/tatum/tatum.other.ts | 3 -- 8 files changed, 7 insertions(+), 163 deletions(-) delete mode 100644 src/e2e/tatum.faucet.spec.ts delete mode 100644 src/service/faucet/faucet.dto.ts delete mode 100644 src/service/faucet/faucet.ts delete mode 100644 src/service/faucet/index.ts diff --git a/README.md b/README.md index 70cd73ad30..f12afce76d 100644 --- a/README.md +++ b/README.md @@ -168,15 +168,6 @@ Access the latest crypto exchange rates and supported currency information to st | [Supported Crypto Currencies](https://docs.tatum.io/docs/exchange-rates/supported-crypto-currencies) | | [Supported Fiats](https://docs.tatum.io/docs/exchange-rates/supported-fiats) | -### ⛽ Faucets - -Request testnet token sums of cryptocurrency from our [Faucets](http://faucets.tatum.io). - -| Documentation | -| ----- | -| [Get testnet native tokens](https://docs.tatum.io/docs/faucets/fund) | - - ### 📘 Getting Started with TatumSDK This guide will lead you step by step, from basic setup and installation to harnessing the immense capabilities of our library. For a detailed walkthrough, check out the [Getting Started page](https://docs.tatum.io/sdk/get-started-with-tatum-sdk). @@ -409,28 +400,6 @@ await tatum.destroy() For more details, check out the [Wallet address operations documentation](https://docs.tatum.io/docs/wallet-address-operations). -### Get testnet faucet funds -Using TatumSDK, you can request testnet native token sums of cryptocurrency from our [Faucets](http://faucets.tatum.io). - -```ts -import { TatumSDK, Network, Ethereum } from '@tatumio/tatum' - -const tatum = await TatumSDK.init({ network: Network.ETHEREUM_SEPOLIA }) - -const res = await tatum.faucet.fund('0x712e3a792c974b3e3dbe41229ad4290791c75a82') - -if (res.data) { - console.log(res.data) -} else { - console.error(res.error) -} - -// Destroy Tatum SDK - needed for stopping background jobs -await tatum.destroy() -``` - -For more details, check out the [Faucets documentation](https://docs.tatum.io/docs/faucets). - ## RPC calls All RPC calls are implemented in the `tatum.rpc.*` submodule. diff --git a/docs/structure.md b/docs/structure.md index 1ecc73e30b..52182ba90f 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -2,18 +2,16 @@ TatumSDK is thoughtfully designed and organized into these submodules to provide a clean and efficient way of interacting with blockchains: -* **[RPC submodule](https://github.com/tatumio/tatum-js/blob/master/docs/rpc.md) - `tatum.rpc.*`**: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more. RPC submodule is using load balancer to select the most responsive node from the list of nodes. +- **[RPC submodule](https://github.com/tatumio/tatum-js/blob/master/docs/rpc.md) - `tatum.rpc.*`**: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more. RPC submodule is using load balancer to select the most responsive node from the list of nodes. -* **Notification submodule - `tatum.notification.*`**: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain. +- **Notification submodule - `tatum.notification.*`**: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain. -* **NFT submodule - `tatum.nft.*`**: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection or identify the owners of a particular NFT. +- **NFT submodule - `tatum.nft.*`**: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection or identify the owners of a particular NFT. -* **Address submodule - `tatum.address.*`**: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly. +- **Address submodule - `tatum.address.*`**: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly. -* **Wallet Provider submodule - `tatum.walletProvider.*`**: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets. +- **Wallet Provider submodule - `tatum.walletProvider.*`**: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets. -* **Rate Exchange submodule - `tatum.rates.*`**: This submodule enables allows you to easily obtain exchange rates for fiat/crypto. - -* **Faucet submodule - `tatum.faucet.*`**: This submodule allows you to get testnet faucet funds for all supported chains (http://faucets.tatum.io). +- **Rate Exchange submodule - `tatum.rates.*`**: This submodule enables allows you to easily obtain exchange rates for fiat/crypto. By dividing the library into these submodules, TatumSDK offers an organized, easy-to-use interface that makes interacting with Ethereum and other blockchains a breeze. Both beginners and advanced developers can benefit from the streamlined architecture, enabling them to focus on building powerful blockchain applications. diff --git a/src/e2e/tatum.faucet.spec.ts b/src/e2e/tatum.faucet.spec.ts deleted file mode 100644 index def54f6611..0000000000 --- a/src/e2e/tatum.faucet.spec.ts +++ /dev/null @@ -1,57 +0,0 @@ -import process from 'process' -import { Ethereum, Network, TatumSDK } from '../service' -import { Status } from '../util' - -describe('Tatum faucet', () => { - const SEPOLIA_VAULT = '0x712e3a792c974b3e3dbe41229ad4290791c75a82' - const SDK_VAULT = '0x8be1a5737817d3c8bf65039a8d374f920819563a' - - describe('invalid request', () => { - const EXPECTED_RES = 'validation.failed' - - it('should get error due to unsupported chain', async () => { - const tatum = await TatumSDK.init({ - network: Network.MULTIVERSX, - }) - const res = await tatum.faucet.fund(SEPOLIA_VAULT) - - await tatum.destroy() - expect(res.error?.code).toBe(EXPECTED_RES) - }) - - it('should get error due to unsupported mainnet', async () => { - const tatum = await TatumSDK.init({ - network: Network.ETHEREUM, - }) - const res = await tatum.faucet.fund(SEPOLIA_VAULT) - - await tatum.destroy() - expect(res.error?.code).toBe(EXPECTED_RES) - }) - }) - - describe('valid request', () => { - it.skip('should only stop at balance being above limit', async () => { - const tatum = await TatumSDK.init({ - network: Network.POLYGON_MUMBAI, - }) - const res = await tatum.faucet.fund(SDK_VAULT) - - await tatum.destroy() - expect(res.error?.code).toBe('faucet.balance') - }) - - it.skip('should return success', async () => { - const tatum = await TatumSDK.init({ - network: Network.ETHEREUM_SEPOLIA, - apiKey: { - v4: process.env.V4_API_KEY_TESTNET, - }, - }) - const res = await tatum.faucet.fund(SEPOLIA_VAULT) - - await tatum.destroy() - expect(res.status).toBe(Status.SUCCESS) - }) - }) -}) diff --git a/src/service/faucet/faucet.dto.ts b/src/service/faucet/faucet.dto.ts deleted file mode 100644 index ea9d563155..0000000000 --- a/src/service/faucet/faucet.dto.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface TxIdResponse { - txId: string -} diff --git a/src/service/faucet/faucet.ts b/src/service/faucet/faucet.ts deleted file mode 100644 index 6a4ef61b62..0000000000 --- a/src/service/faucet/faucet.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Container, Service } from 'typedi' - -import { TatumConnector } from '../../connector/tatum.connector' -import { CONFIG, ErrorUtils, LOGGER, ResponseDto } from '../../util' -import { Network, TatumConfig } from '../tatum' - -import { Logger } from '../logger/logger.types' -import { TxIdResponse } from './faucet.dto' - -@Service({ - factory: (data: { id: string }) => { - return new Faucet(data.id) - }, - transient: true, -}) -export class Faucet { - private readonly connector: TatumConnector - private readonly config: TatumConfig - private readonly logger: Logger - - constructor(private readonly id: string) { - this.connector = Container.of(this.id).get(TatumConnector) - this.config = Container.of(this.id).get(CONFIG) - this.logger = Container.of(this.id).get(LOGGER) - } - - async fund(address: string): Promise> { - if (!this.config.apiKey?.v4) { - this.logger.warn( - 'Unable to make Faucet calls, get an api key to successfully use this feature: https://co.tatum.io/signup', - ) - } - - const chain = this.convertToFaucetChain(this.config.network) - - return ErrorUtils.tryFail(async () => { - return this.connector.post({ - path: `faucet/${chain}/${address}`, - }) - }) - } - - private convertToFaucetChain(network: Network) { - return network === Network.HORIZEN_EON_GOBI ? 'eon-testnet' : network - } -} diff --git a/src/service/faucet/index.ts b/src/service/faucet/index.ts deleted file mode 100644 index ce31ea3525..0000000000 --- a/src/service/faucet/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './faucet' -export * from './faucet.dto' diff --git a/src/service/tatum/tatum.evm.ts b/src/service/tatum/tatum.evm.ts index 496dacb8c8..8ff0ede8f4 100644 --- a/src/service/tatum/tatum.evm.ts +++ b/src/service/tatum/tatum.evm.ts @@ -3,7 +3,6 @@ import { EvmBasedBeaconRpcSuite, EvmBasedRpcSuite } from '../../dto' import { NativeEvmBasedRpcSuite } from '../../dto/rpc/NativeEvmBasedRpcInterface' import { CONFIG, Utils } from '../../util' import { Address } from '../address' -import { Faucet } from '../faucet' import { FeeEvm } from '../fee' import { Ipfs } from '../ipfs' import { Nft } from '../nft' @@ -27,15 +26,6 @@ export abstract class BaseEvm extends TatumSdkChain { } } -export abstract class FaucetEvm extends BaseEvm { - faucet: Faucet - - constructor(id: string) { - super(id) - this.faucet = Container.of(id).get(Faucet) - } -} - export class NotificationEvm extends BaseEvm { notification: Notification @@ -48,14 +38,12 @@ export class NotificationEvm extends BaseEvm { export class FullEvm extends NotificationEvm { nft: Nft token: Token - faucet: Faucet address: Address constructor(id: string) { super(id) this.nft = Container.of(id).get(Nft) this.token = Container.of(id).get(Token) - this.faucet = Container.of(id).get(Faucet) this.address = Container.of(id).get(Address) } } @@ -80,7 +68,7 @@ export class Vechain extends BaseEvm {} export class XinFin extends BaseEvm {} export class Chiliz extends NotificationEvm {} -export class HorizenEon extends FaucetEvm { +export class HorizenEon extends BaseEvm { address: Address constructor(id: string) { diff --git a/src/service/tatum/tatum.other.ts b/src/service/tatum/tatum.other.ts index 0831ac1420..ad2fbc30c3 100644 --- a/src/service/tatum/tatum.other.ts +++ b/src/service/tatum/tatum.other.ts @@ -8,7 +8,6 @@ import { EosRpcSuite } from '../../dto/rpc/EosRpcSuite' import { StellarRpcSuite } from '../../dto/rpc/StellarRpcSuite' import { CONFIG, Utils } from '../../util' import { Address, AddressTezos, AddressTron } from '../address' -import { Faucet } from '../faucet' import { Ipfs } from '../ipfs' import { Nft, NftTezos } from '../nft' import { Notification } from '../notification' @@ -144,7 +143,6 @@ export class FullSdk extends TatumSdkChain { token: Token address: Address rates: Rates - faucet: Faucet ipfs: Ipfs constructor(id: string) { @@ -154,7 +152,6 @@ export class FullSdk extends TatumSdkChain { this.token = Container.of(id).get(Token) this.address = Container.of(id).get(Address) this.rates = Container.of(id).get(Rates) - this.faucet = Container.of(id).get(Faucet) this.ipfs = Container.of(id).get(Ipfs) } } From 581cf349f1637594347916e1e1b3326b888132ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Ka=C5=A1tovsk=C3=BD?= Date: Tue, 23 Jan 2024 12:04:23 +0100 Subject: [PATCH 2/3] ALL-4110: bump version --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a07fb987..1eacd02f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [4.2.3] - 2024.1.23 + +### Updated + +- Drop support for faucet claims via SDK + ## [4.2.2] - 2024.1.12 ### Added diff --git a/package.json b/package.json index bf924d1058..edf8ad4973 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum", - "version": "4.2.2", + "version": "4.2.3", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", From bbad227275765785f9c1dfccd1d74969308a9b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Ka=C5=A1tovsk=C3=BD?= Date: Tue, 23 Jan 2024 12:09:19 +0100 Subject: [PATCH 3/3] ALL-4110: fix formatting --- docs/structure.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/structure.md b/docs/structure.md index 52182ba90f..18904ac05d 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -2,16 +2,16 @@ TatumSDK is thoughtfully designed and organized into these submodules to provide a clean and efficient way of interacting with blockchains: -- **[RPC submodule](https://github.com/tatumio/tatum-js/blob/master/docs/rpc.md) - `tatum.rpc.*`**: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more. RPC submodule is using load balancer to select the most responsive node from the list of nodes. +* **[RPC submodule](https://github.com/tatumio/tatum-js/blob/master/docs/rpc.md) - `tatum.rpc.*`**: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more. RPC submodule is using load balancer to select the most responsive node from the list of nodes. -- **Notification submodule - `tatum.notification.*`**: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain. +* **Notification submodule - `tatum.notification.*`**: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain. -- **NFT submodule - `tatum.nft.*`**: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection or identify the owners of a particular NFT. +* **NFT submodule - `tatum.nft.*`**: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection or identify the owners of a particular NFT. -- **Address submodule - `tatum.address.*`**: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly. +* **Address submodule - `tatum.address.*`**: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly. -- **Wallet Provider submodule - `tatum.walletProvider.*`**: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets. +* **Wallet Provider submodule - `tatum.walletProvider.*`**: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets. -- **Rate Exchange submodule - `tatum.rates.*`**: This submodule enables allows you to easily obtain exchange rates for fiat/crypto. +* **Rate Exchange submodule - `tatum.rates.*`**: This submodule enables allows you to easily obtain exchange rates for fiat/crypto. By dividing the library into these submodules, TatumSDK offers an organized, easy-to-use interface that makes interacting with Ethereum and other blockchains a breeze. Both beginners and advanced developers can benefit from the streamlined architecture, enabling them to focus on building powerful blockchain applications.