diff --git a/CHANGELOG.md b/CHANGELOG.md index 72e333e1d..a8c6d3f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [4.1.36] - 2024.1.3 +### Fixed +- Fix optional params for STELLAR network. + ## [4.1.35] - 2024.1.3 ### Added - Added RPC support for the STELLAR network. Users can now make Stellar RPC calls using the `Network.STELLAR` network. diff --git a/package.json b/package.json index 13b7f56d0..69b919887 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumio/tatum", - "version": "4.1.35", + "version": "4.1.36", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", diff --git a/src/dto/rpc/StellarRpcSuite.ts b/src/dto/rpc/StellarRpcSuite.ts index 0d6771b50..7cb7e1354 100644 --- a/src/dto/rpc/StellarRpcSuite.ts +++ b/src/dto/rpc/StellarRpcSuite.ts @@ -1012,17 +1012,17 @@ export interface GetStrictReceivePaymentPathsParams { sourceAssets?: string destinationAssetType: string destinationAssetIssuer?: string - destinationAssetCode: string + destinationAssetCode?: string destinationAmount: string } export interface GetStrictSendPaymentPathsParams { sourceAccount?: string sourceAssets?: string - sourceAssetType?: string + sourceAssetType: string sourceAssetIssuer?: string sourceAssetCode?: string - sourceAmount?: string + sourceAmount: string destinationAccount?: string destinationAssets?: string } @@ -1045,7 +1045,7 @@ export interface GetTransactionsParams extends BaseParams { } export interface StellarRpcSuite { - getAccounts(params: GetAccountsParams): Promise + getAccounts(params?: GetAccountsParams): Promise getAccount(params: GetAccountParams): Promise getAccountTransactions(params: GetAccountTransactionsParams): Promise getAccountOperations(params: GetOperationsByAccountIdParams): Promise @@ -1054,14 +1054,14 @@ export interface StellarRpcSuite { getAccountOffers(params: GetOffersByAccountIdParams): Promise getAccountTrades(params: GetAccountTradesParams): Promise getAccountData(params: GetAccountDataParams): Promise<{ value: string }> - getAssets(params: GetAssetsParams): Promise - getClaimableBalances(params: GetClaimableBalancesParams): Promise + getAssets(params?: GetAssetsParams): Promise + getClaimableBalances(params?: GetClaimableBalancesParams): Promise getClaimableBalance(params: GetClaimableBalanceParams): Promise getClaimableTransactions(params: GetClaimableTransactionsParams): Promise getClaimableOperations(params: GetClaimableOperationsParams): Promise - getEffects(params: GetEffectsParams): Promise + getEffects(params?: GetEffectsParams): Promise getFeeStats(): Promise - getLiquidityPools(params: GetLiquidityPoolsParams): Promise + getLiquidityPools(params?: GetLiquidityPoolsParams): Promise getLiquidityPool(params: GetLiquidityPoolParams): Promise getLiquidityPoolEffects(params: GetLiquidityPoolEffectsParams): Promise getLiquidityPoolTrades(params: GetLiquidityPoolTradesParams): Promise @@ -1072,21 +1072,21 @@ export interface StellarRpcSuite { getLedgerPayments(params: GetLedgerPaymentsParams): Promise getLedgerOperations(params: GetLedgerOperationsParams): Promise getLedgerEffects(params: GetLedgerEffectsParams): Promise> - getLedgers(params: BaseParams): Promise - getOffers(params: GetOffersParams): Promise + getLedgers(params?: BaseParams): Promise + getOffers(params?: GetOffersParams): Promise getOffer(params: GetOfferParams): Promise getOfferTrades(params: GetOfferTradesParams): Promise getOrderBook(params: GetOrderBookParams): Promise getTradeAggregations(params: GetTradeAggregationsParams): Promise - getTrades(params: GetTradesParams): Promise + getTrades(params?: GetTradesParams): Promise getTransaction(params: GetTransactionParams): Promise getTransactionOperations(params: GetTransactionOperationsParams): Promise getTransactionEffects(params: GetTransactionEffectsParams): Promise - getTransactions(params: GetTransactionsParams): Promise + getTransactions(params?: GetTransactionsParams): Promise getOperation(params: GetOperationParams): Promise getOperationEffects(params: GetOperationEffectsParams): Promise - getOperations(params: GetOperationsParams): Promise - getPayments(params: GetPaymentsParams): Promise + getOperations(params?: GetOperationsParams): Promise + getPayments(params?: GetPaymentsParams): Promise getStrictReceivePaymentPaths(params: GetStrictReceivePaymentPathsParams): Promise getStrictSendPaymentPaths(params: GetStrictSendPaymentPathsParams): Promise submitTransaction(params: SubmitTransactionParams): Promise diff --git a/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts b/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts index 5200b0113..508e3641d 100644 --- a/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts +++ b/src/e2e/rpc/other/tatum.rpc.stellar.spec.ts @@ -48,4 +48,22 @@ describe('Stellar', () => { const response = await tatum.rpc.getOffers({}) expect(response).toBeDefined() }) + + it('should get strict send', async () => { + const response = await tatum.rpc.getStrictSendPaymentPaths({ + sourceAssetType: 'native', + sourceAmount: '1', + destinationAccount: 'GB3LIKQ6GOJ6D4EYKVS47L2SBY66SJO4MN4CZCMUPNBUJ2L3PF62ECBA', + }) + expect(response).toBeDefined() + }) + + it('should get strict receive', async () => { + const response = await tatum.rpc.getStrictReceivePaymentPaths({ + destinationAssetType: 'native', + destinationAmount: '1', + sourceAssets: 'USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN', + }) + expect(response).toBeDefined() + }) }) diff --git a/src/service/rpc/other/AbstractStellarRpc.ts b/src/service/rpc/other/AbstractStellarRpc.ts index fa3176b7c..617b2bc14 100644 --- a/src/service/rpc/other/AbstractStellarRpc.ts +++ b/src/service/rpc/other/AbstractStellarRpc.ts @@ -116,7 +116,7 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.post(post) } - getAccounts(params: GetAccountsParams): Promise { + getAccounts(params?: GetAccountsParams): Promise { return this.sendGet({ path: '/accounts', queryParams: params as QueryParams }) } @@ -159,11 +159,11 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: `/accounts/${accountId}/data/${rest.key}` }) } - getAssets(params: GetAssetsParams): Promise { + getAssets(params?: GetAssetsParams): Promise { return this.sendGet({ path: '/assets', queryParams: params as QueryParams }) } - getClaimableBalances(params: GetClaimableBalancesParams): Promise { + getClaimableBalances(params?: GetClaimableBalancesParams): Promise { return this.sendGet({ path: '/claimable_balances', queryParams: params as QueryParams }) } @@ -181,7 +181,7 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: `/claimable_balances/${claimableBalanceId}/operations`, queryParams: rest }) } - getEffects(params: GetEffectsParams): Promise { + getEffects(params?: GetEffectsParams): Promise { return this.sendGet({ path: '/effects', queryParams: params as QueryParams }) } @@ -189,7 +189,7 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: '/fee_stats' }) } - getLiquidityPools(params: GetLiquidityPoolsParams): Promise { + getLiquidityPools(params?: GetLiquidityPoolsParams): Promise { return this.sendGet({ path: '/liquidity_pools', queryParams: params as QueryParams }) } @@ -243,11 +243,11 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: `/ledgers/${sequence}/effects`, queryParams: rest }) } - getLedgers(params: BaseParams): Promise { + getLedgers(params?: BaseParams): Promise { return this.sendGet({ path: '/ledgers', queryParams: params as QueryParams }) } - getOffers(params: GetOffersParams): Promise { + getOffers(params?: GetOffersParams): Promise { return this.sendGet({ path: '/offers', queryParams: params as QueryParams }) } @@ -274,7 +274,7 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { }) } - getTrades(params: GetTradesParams): Promise { + getTrades(params?: GetTradesParams): Promise { return this.sendGet({ path: '/trades', queryParams: params as QueryParams }) } @@ -293,7 +293,7 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: `/transactions/${transactionHash}/effects`, queryParams: rest }) } - getTransactions(params: GetTransactionsParams): Promise { + getTransactions(params?: GetTransactionsParams): Promise { return this.sendGet({ path: '/transactions', queryParams: params as QueryParams }) } @@ -307,27 +307,25 @@ export abstract class AbstractStellarRpc implements StellarRpcSuite { return this.sendGet({ path: `/operations/${id}/effects`, queryParams: rest }) } - getOperations(params: GetOperationsParams): Promise { + getOperations(params?: GetOperationsParams): Promise { return this.sendGet({ path: '/operations', queryParams: params as QueryParams }) } - getPayments(params: GetPaymentsParams): Promise { + getPayments(params?: GetPaymentsParams): Promise { return this.sendGet({ path: '/payments', queryParams: params as QueryParams }) } getStrictReceivePaymentPaths(params: GetStrictReceivePaymentPathsParams): Promise { - const { destinationAssetType, destinationAmount, ...rest } = params return this.sendGet({ - path: `/paths/strict-receive${destinationAssetType}${destinationAmount}`, - queryParams: rest, + path: `/paths/strict-receive`, + queryParams: params as unknown as QueryParams, }) } getStrictSendPaymentPaths(params: GetStrictSendPaymentPathsParams): Promise { - const { sourceAssetType, sourceAmount, ...rest } = params return this.sendGet({ - path: `/paths/strict-send${sourceAssetType}${sourceAmount}`, - queryParams: rest, + path: `/paths/strict-send`, + queryParams: params as unknown as QueryParams, }) }