Skip to content

Commit

Permalink
Fix Api client e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Jun 27, 2024
1 parent 6778adc commit a42edbd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 28 deletions.
19 changes: 6 additions & 13 deletions packages/api-client/src/lib/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ export type BtcBasedApiService = BitcoinService | BitcoinCashService | DogecoinS

export type EvmBasedApiService = EthereumService | CeloService

export type ApiServiceTypes = typeof TokenApiService &
typeof NftApiService &
typeof WalletApiService &
typeof TransactionsApiService &
typeof DeFiApiService

export const ApiServices = {
blockchain: {
ada: CardanoService,
Expand Down Expand Up @@ -145,16 +139,15 @@ export const ApiServices = {
},
security: MaliciousAddressService,
kms: KeyManagementSystemService,
data: {
...DeFiApiService,
...WalletApiService,
...TokenApiService,
...TransactionsApiService,
...NftApiService,
},
exchangeRate: ExchangeRateService,
tatum: ServiceUtilsService,
custodial: CustodialManagedWalletsService,
auction: AuctionService,
gasPump: GasPumpService,
data: {
defi: DeFiApiService,
wallet: WalletApiService,
token: TokenApiService,
nftService: NftApiService,
},
}
4 changes: 2 additions & 2 deletions packages/blockchain/btc/src/lib/__tests__/btc.tx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ describe('BTC transactions', () => {
},
) {
if (obj === -1) {
mockedApi.data.getUtxosByAddress.mockResolvedValue([])
mockedApi.data.wallet.getUtxosByAddress.mockResolvedValue([])
} else {
mockedApi.data.getUtxosByAddress.mockResolvedValue([obj])
mockedApi.data.wallet.getUtxosByAddress.mockResolvedValue([obj])
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/cardano/src/lib/cardano.sdk.tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
AdaTransactionFromAddressKMS,
AdaTransactionFromUTXO,
AdaTransactionFromUTXOKMS,
ApiServices, ApiServiceTypes,
ApiServices,
Currency,
NodeRpcService,
PendingTransaction,
Expand All @@ -19,7 +19,7 @@ type CardanoTxOptions = { testnet: boolean }

type ApiCallsType = {
cardanoBroadcast: typeof ApiServices.blockchain.ada.adaBroadcast;
getUTXOsByAddress: ApiServiceTypes['getUtxosByAddress'];
getUTXOsByAddress: typeof WalletApiService.getUtxosByAddress;
rpcCall: typeof NodeRpcService.nodeJsonPostRpcDriver;
};

Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/ltc/src/lib/transaction/ltc.tx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ describe('LTC transactions', () => {
},
) {
if (obj === -1) {
mockedApi.data.getUtxosByAddress.mockResolvedValue([])
mockedApi.data.wallet.getUtxosByAddress.mockResolvedValue([])
} else {
mockedApi.data.getUtxosByAddress.mockResolvedValue([obj])
mockedApi.data.wallet.getUtxosByAddress.mockResolvedValue([obj])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ describe('OptimismSDK - blockchain', () => {
getBlockchainAccountBalance: [api.optimismGetBalance, testData.TESTNET.ADDRESS_0],
getTransaction: [api.optimismGetTransaction, testData.TX_HASH],
smartContractGetAddress: [BlockchainUtilsService.scGetContractAddress, 'OPTIMISM', testData.TX_HASH],
estimateGas: [
blockchain.estimateGas,
{
from: testData.TESTNET.ADDRESS_0,
to: testData.TESTNET.ADDRESS_100,
contractAddress: testData.TESTNET.SMART_CONTRACT.CONTRACT_ADDRESS,
amount: '10',
} as OptimismEstimateGas,
],
smartContractInvocation: [
api.optimismBlockchainSmartContractInvocation,
{
Expand Down

0 comments on commit a42edbd

Please sign in to comment.