UNPKG

@tatumio/tatum

Version:

Tatum JS SDK

76 lines 3.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const service_1 = require("../../../service"); const e2e_util_1 = require("../../e2e.util"); const getAlgorandIndexerRpc = async (testnet) => await service_1.TatumSDK.init(e2e_util_1.e2eUtil.initConfig(testnet ? service_1.Network.ALGORAND_INDEXER_TESTNET : service_1.Network.ALGORAND_INDEXER)); describe.each([false, true])('Algorand Indexer', (testnet) => { describe(`${testnet ? 'Testnet' : 'Mainnet'}`, () => { let indexer; beforeEach(async () => { indexer = await getAlgorandIndexerRpc(false); }); afterEach(async () => { await indexer.destroy(); }); it('should correctly get health status', async () => { const health = await indexer.rpc.getHealth(); expect(health).toBeDefined(); expect(health.data).toBeDefined(); }); it('should correctly get accounts', async () => { const accountRequest = { limit: 10, }; const accountsResponse = await indexer.rpc.getAccounts(accountRequest); expect(accountsResponse).toBeDefined(); }); it('should correctly get account by address', async () => { const accountRequest = { limit: 1, }; const accountsResponse = (await indexer.rpc.getAccounts(accountRequest)); const account = accountsResponse.accounts[0]; const accountResponse = await indexer.rpc.getAccount({ accountId: account.address }); expect(accountResponse).toBeDefined(); }); it('should correctly get assets', async () => { const assetsRequest = { limit: 10, }; const assetsResponse = await indexer.rpc.getAssets(assetsRequest); expect(assetsResponse).toBeDefined(); }); it('should correctly get asset by id', async () => { const assetsRequest = { limit: 10, }; const assetsResponse = (await indexer.rpc.getAssets(assetsRequest)); const asset = assetsResponse.assets[0]; const assetResponse = await indexer.rpc.getAsset({ assetId: asset.index }); expect(assetResponse).toBeDefined(); }); it.skip('should correctly get asset balances', async () => { const assetsRequest = { limit: 10, }; const assetsResponse = (await indexer.rpc.getAssets(assetsRequest)); const asset = assetsResponse.assets[0]; const assetBalancesResponse = await indexer.rpc.getAssetBalances({ assetId: asset.index, limit: 2 }); expect(assetBalancesResponse).toBeDefined(); }); it.skip('should correctly get asset transactions', async () => { const assetsRequest = { limit: 10, }; const assetsResponse = (await indexer.rpc.getAssets(assetsRequest)); const asset = assetsResponse.assets[0]; const assetTransactionsResponse = await indexer.rpc.getAssetTransactions({ assetId: asset.index }); expect(assetTransactionsResponse).toBeDefined(); }); it('should correctly get block', async () => { const blockResponse = await indexer.rpc.getBlock({ roundNumber: 10 }); expect(blockResponse).toBeDefined(); }); }); }); //# sourceMappingURL=tatum.rpc.algorand.indexer.spec.js.map