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/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..18904ac05d 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -14,6 +14,4 @@ TatumSDK is thoughtfully designed and organized into these submodules to provide * **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). - 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/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", 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) } }