diff --git a/.eslintrc b/.eslintrc index ac209e9a64..5718197c17 100644 --- a/.eslintrc +++ b/.eslintrc @@ -61,6 +61,15 @@ "@typescript-eslint/no-non-null-assertion": "off", "no-lone-blocks": "off" } + }, + { + "files": [ + "**/jellyfish-api-core/__tests__/**/*.ts", + "**/jellyfish-api-core/src/**/*.ts" + ], + "rules": { + "@typescript-eslint/no-explicit-any": "error" + } } ] } diff --git a/docs/node/CATEGORIES/05-wallet.md b/docs/node/CATEGORIES/05-wallet.md index 930c66eb3f..f75762a2d5 100644 --- a/docs/node/CATEGORIES/05-wallet.md +++ b/docs/node/CATEGORIES/05-wallet.md @@ -35,6 +35,7 @@ Identical to getBalance to get untrusted pending balance. ```ts title="client.wallet.getUnconfirmedBalance()" interface wallet { getUnconfirmedBalance (): Promise +} ``` ## getBalances @@ -338,7 +339,7 @@ List groups of addresses which have had their common ownership made public by co ```ts title="client.wallet.listAddressGroupings()" interface wallet { - listAddressGroupings (): Promise + listAddressGroupings (): Promise } ``` diff --git a/docs/node/CATEGORIES/08-account.md b/docs/node/CATEGORIES/08-account.md index a6e3ba4a2c..963fbb4ea3 100644 --- a/docs/node/CATEGORIES/08-account.md +++ b/docs/node/CATEGORIES/08-account.md @@ -31,7 +31,7 @@ interface account { } interface AccountPagination { - start?: number + start?: number | string including_start?: boolean limit?: number } @@ -98,7 +98,7 @@ interface AccountAmount { } interface AccountPagination { - start?: string | number + start?: number | string including_start?: boolean limit?: number } diff --git a/packages/jellyfish-api-core/__tests__/category/account/getAccount.test.ts b/packages/jellyfish-api-core/__tests__/category/account/getAccount.test.ts index 41cd92e99c..5457636e1e 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/getAccount.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/getAccount.test.ts @@ -1,6 +1,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' import waitForExpect from 'wait-for-expect' +import { AccountOwner, AccountResult } from '@defichain/jellyfish-api-core/dist/category/account' const container = new MasterNodeRegTestContainer() const client = new ContainerAdapterClient(container) @@ -42,7 +43,7 @@ it('should getAccount', async () => { }) it('should getAccount with pagination start and including_start', async () => { - let accounts: any[] = [] + let accounts: Array> = [] let beforeAccountCount = 0 await waitForExpect(async () => { diff --git a/packages/jellyfish-api-core/__tests__/category/account/getAccountHistory.test.ts b/packages/jellyfish-api-core/__tests__/category/account/getAccountHistory.test.ts index 9cfe41aa70..d45ee6bd23 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/getAccountHistory.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/getAccountHistory.test.ts @@ -1,6 +1,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { Testing } from '@defichain/jellyfish-testing' import { RpcApiError } from '@defichain/jellyfish-api-core' +import { AccountOwner, AccountResult } from '@defichain/jellyfish-api-core/dist/category/account' describe('Account', () => { const testing = Testing.create(new MasterNodeRegTestContainer()) @@ -28,7 +29,7 @@ describe('Account', () => { }) it('should getAccountHistory with owner CScript', async () => { - const accounts: any[] = await testing.rpc.account.listAccounts() + const accounts: Array> = await testing.rpc.account.listAccounts() const { owner } = accounts[0] const { hex, addresses } = owner diff --git a/packages/jellyfish-api-core/__tests__/category/account/listAccountHistory.test.ts b/packages/jellyfish-api-core/__tests__/category/account/listAccountHistory.test.ts index 163edba0ba..dc3c131781 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/listAccountHistory.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/listAccountHistory.test.ts @@ -1,7 +1,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' import waitForExpect from 'wait-for-expect' -import { DfTxType, BalanceTransferPayload } from '../../../src/category/account' +import { DfTxType, BalanceTransferPayload, AccountResult, AccountOwner } from '../../../src/category/account' function createTokenForContainer (container: MasterNodeRegTestContainer) { return async (address: string, symbol: string, amount: number) => { @@ -83,7 +83,7 @@ describe('Account', () => { }) it('should listAccountHistory with owner CScript', async () => { - const accounts: any[] = await client.account.listAccounts() + const accounts: Array> = await client.account.listAccounts() const { owner } = accounts[0] const { hex, addresses } = owner @@ -263,7 +263,7 @@ describe('Account', () => { }) it('should listAccountHistory with owner CScript options block height and txn 1', async () => { - const accounts: any[] = await client.account.listAccounts() + const accounts: Array> = await client.account.listAccounts() const { owner } = accounts[0] const { hex, addresses } = owner @@ -284,7 +284,7 @@ describe('Account', () => { }) it('should listAccountHistory with owner CScript options block height and txn 0', async () => { - const accounts: any[] = await client.account.listAccounts() + const accounts: Array> = await client.account.listAccounts() const { owner } = accounts[0] const { hex, addresses } = owner diff --git a/packages/jellyfish-api-core/__tests__/category/account/listAccounts.test.ts b/packages/jellyfish-api-core/__tests__/category/account/listAccounts.test.ts index aa24aa1d66..b0bf70052c 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/listAccounts.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/listAccounts.test.ts @@ -2,6 +2,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' import waitForExpect from 'wait-for-expect' import BigNumber from 'bignumber.js' +import { AccountOwner, AccountResult } from '@defichain/jellyfish-api-core/dist/category/account' describe('Account', () => { const container = new MasterNodeRegTestContainer() @@ -53,7 +54,7 @@ describe('Account', () => { }) it('should listAccounts with pagination start and including_start', async () => { - const accounts: any[] = await client.account.listAccounts() + const accounts: Array> = await client.account.listAccounts() const pagination = { start: accounts[accounts.length - 1].key, diff --git a/packages/jellyfish-api-core/__tests__/category/blockchain/getBlockHash.test.ts b/packages/jellyfish-api-core/__tests__/category/blockchain/getBlockHash.test.ts index c3d2869a8d..7410367dcb 100644 --- a/packages/jellyfish-api-core/__tests__/category/blockchain/getBlockHash.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/blockchain/getBlockHash.test.ts @@ -30,6 +30,7 @@ describe('BlockHash', () => { expect.assertions(1) try { await client.blockchain.getBlockHash(10000) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ } catch (err: any) { expect(err.payload).toStrictEqual({ code: -8, diff --git a/packages/jellyfish-api-core/__tests__/category/icxorderbook/icx_setup.ts b/packages/jellyfish-api-core/__tests__/category/icxorderbook/icx_setup.ts index 35699a6d8c..a975f841e1 100644 --- a/packages/jellyfish-api-core/__tests__/category/icxorderbook/icx_setup.ts +++ b/packages/jellyfish-api-core/__tests__/category/icxorderbook/icx_setup.ts @@ -123,9 +123,9 @@ export class ICXSetup { async setTakerFee (fee: number): Promise { await this.container.call('setgov', [{ ICX_TAKERFEE_PER_BTC: fee }]) await this.container.generate(1) - const result: any = await this.container.call('getgov', ['ICX_TAKERFEE_PER_BTC']) - expect(result.ICX_TAKERFEE_PER_BTC as number).toStrictEqual(fee) - ICX_TAKERFEE_PER_BTC = result.ICX_TAKERFEE_PER_BTC as number + const result: { ICX_TAKERFEE_PER_BTC: number } = await this.container.call('getgov', ['ICX_TAKERFEE_PER_BTC']) + expect(result.ICX_TAKERFEE_PER_BTC).toStrictEqual(fee) + ICX_TAKERFEE_PER_BTC = result.ICX_TAKERFEE_PER_BTC } async closeAllOpenOffers (): Promise { diff --git a/packages/jellyfish-api-core/__tests__/category/loan/getVault.test.ts b/packages/jellyfish-api-core/__tests__/category/loan/getVault.test.ts index e5bd52d057..373b949918 100644 --- a/packages/jellyfish-api-core/__tests__/category/loan/getVault.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/loan/getVault.test.ts @@ -1,7 +1,7 @@ import { LoanMasterNodeRegTestContainer } from './loan_container' import { Testing } from '@defichain/jellyfish-testing' import BigNumber from 'bignumber.js' -import { VaultActive, VaultState } from '../../../src/category/loan' +import { Interest, VaultActive, VaultState } from '../../../src/category/loan' describe('Loan getVault', () => { const container = new LoanMasterNodeRegTestContainer() @@ -134,7 +134,7 @@ describe('Loan getVault', () => { await testing.generate(1) // interest info. - const interestInfo: any = await testing.rpc.call('getinterest', ['default', 'TSLA'], 'bignumber') + const interestInfo: Interest[] = await testing.rpc.call('getinterest', ['default', 'TSLA'], 'bignumber') const data = await testing.rpc.loan.getVault(vaultId) as VaultActive const informativeRatio: BigNumber = data.collateralValue.dividedBy(data.loanValue).multipliedBy(100) diff --git a/packages/jellyfish-api-core/__tests__/category/loan/listAuctionHistory.test.ts b/packages/jellyfish-api-core/__tests__/category/loan/listAuctionHistory.test.ts index 5e00fc5249..38242a1e41 100644 --- a/packages/jellyfish-api-core/__tests__/category/loan/listAuctionHistory.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/loan/listAuctionHistory.test.ts @@ -1,7 +1,7 @@ import BigNumber from 'bignumber.js' import { TestingGroup } from '@defichain/jellyfish-testing' import { GenesisKeys, MasterNodeRegTestContainer } from '@defichain/testcontainers' -import { ListAuctionHistoryDetail } from '../../../src/category/loan' +import { ListAuctionHistoryDetail, VaultLiquidation } from '../../../src/category/loan' describe('Loan listAuctionHistory', () => { const tGroup = TestingGroup.create(2, i => new MasterNodeRegTestContainer(GenesisKeys[i])) @@ -326,8 +326,8 @@ describe('Loan listAuctionHistory', () => { await alice.generate(1) // When there is liquidation - const list = await alice.container.call('listauctions', []) - list.forEach((l: { state: any }) => + const list: VaultLiquidation[] = await alice.container.call('listauctions', []) + list.forEach(l => expect(l.state).toStrictEqual('inLiquidation') ) diff --git a/packages/jellyfish-api-core/__tests__/category/masternode/createMasternode.test.ts b/packages/jellyfish-api-core/__tests__/category/masternode/createMasternode.test.ts index b1a887e3ec..9415e157cd 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/createMasternode.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/createMasternode.test.ts @@ -117,7 +117,7 @@ describe('Masternode', () => { const ownerAddress = await client.wallet.getNewAddress() await container.fundAddress(ownerAddress, 10) const utxos = await container.call('listunspent') - const utxo = utxos.find((utxo: any) => utxo.address === ownerAddress) + const utxo = utxos.find((utxo: { address: string }) => utxo.address === ownerAddress) const txid = await client.masternode.createMasternode( ownerAddress, ownerAddress, { utxos: [{ txid: utxo.txid, vout: utxo.vout }] } diff --git a/packages/jellyfish-api-core/__tests__/category/masternode/listGovs.test.ts b/packages/jellyfish-api-core/__tests__/category/masternode/listGovs.test.ts index ee2c0f4652..a3331a4a06 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/listGovs.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/listGovs.test.ts @@ -13,6 +13,7 @@ describe('Masternode', () => { const govsBefore = await client.masternode.listGovs() expect(govsBefore.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govsBefore.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(Object.keys(liqSplits[0].LP_SPLITS).length).toStrictEqual(0) @@ -33,6 +34,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(1) @@ -53,6 +55,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(2) diff --git a/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts b/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts index 28b3c2a1ed..013c7a7856 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts @@ -3,6 +3,7 @@ import { GenesisKeys, MasterNodeRegTestContainer } from '@defichain/testcontaine import { createPoolPair, createToken } from '@defichain/testing' import { ContainerAdapterClient } from '../../container_adapter_client' import { Testing } from '@defichain/jellyfish-testing' +import { UTXO } from '@defichain/jellyfish-api-core/dist/category/masternode' describe('Masternode', () => { const container = new MasterNodeRegTestContainer() @@ -40,7 +41,7 @@ describe('Masternode', () => { { // before utxo spent const utxos = await container.call('listunspent') - const found = utxos.find((u: any) => u.txid === utxo.txid && u.vout === utxo.vout) + const found = utxos.find((u: UTXO) => u.txid === utxo.txid && u.vout === utxo.vout) expect(found).not.toStrictEqual(undefined) } @@ -53,7 +54,7 @@ describe('Masternode', () => { { // after utxo spent const utxos = await container.call('listunspent') - const found = utxos.find((u: any) => u.txid === utxo.txid && u.vout === utxo.vout) + const found = utxos.find((u: UTXO) => u.txid === utxo.txid && u.vout === utxo.vout) expect(found).toStrictEqual(undefined) } }) diff --git a/packages/jellyfish-api-core/__tests__/category/masternode/setGovHeight.test.ts b/packages/jellyfish-api-core/__tests__/category/masternode/setGovHeight.test.ts index bfae8d4dd9..890557f633 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/setGovHeight.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/setGovHeight.test.ts @@ -2,6 +2,7 @@ import { RpcApiError } from '@defichain/jellyfish-api-core' import { GenesisKeys, LoanMasterNodeRegTestContainer } from '@defichain/testcontainers' import { createPoolPair, createToken } from '@defichain/testing' import { ContainerAdapterClient } from '../../container_adapter_client' +import { UTXO } from '@defichain/jellyfish-api-core/dist/category/masternode' describe('Masternode', () => { let container!: LoanMasterNodeRegTestContainer @@ -31,6 +32,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(1) @@ -53,6 +55,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(2) @@ -68,6 +71,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(1) @@ -81,7 +85,7 @@ describe('Masternode', () => { { // before utxo spent const utxos = await client.wallet.listUnspent(1, 99999, { addresses: [GenesisKeys[0].owner.address] }) - const found = utxos.find((u: any) => u.txid === utxo.txid && u.vout === utxo.vout) + const found = utxos.find((u: UTXO) => u.txid === utxo.txid && u.vout === utxo.vout) expect(found).not.toStrictEqual(undefined) } @@ -94,6 +98,7 @@ describe('Masternode', () => { const govVars = await client.masternode.listGovs() expect(govVars.length).toBeGreaterThan(0) + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ const liqSplits = govVars.find(l => l[0]?.LP_SPLITS !== undefined) as Array> expect(liqSplits).toBeDefined() expect(liqSplits.length).toStrictEqual(2) @@ -104,7 +109,7 @@ describe('Masternode', () => { { // after utxo spent const utxos = await client.wallet.listUnspent(1, 99999, { addresses: [GenesisKeys[0].owner.address] }) - const found = utxos.find((u: any) => u.txid === utxo.txid && u.vout === utxo.vout) + const found = utxos.find((u: UTXO) => u.txid === utxo.txid && u.vout === utxo.vout) expect(found).toStrictEqual(undefined) } }) diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/addPoolLiquidity.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/addPoolLiquidity.test.ts index 7a00466490..70248a8cfe 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/addPoolLiquidity.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/addPoolLiquidity.test.ts @@ -1,5 +1,6 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' +import { UTXO } from '@defichain/jellyfish-api-core/dist/category/poolpair' describe('Poolpair', () => { const container = new MasterNodeRegTestContainer() @@ -33,7 +34,7 @@ describe('Poolpair', () => { await container.generate(1) } - async function createPoolPair (tokenB: string, metadata?: any): Promise { + async function createPoolPair (tokenB: string): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { tokenA: 'DFI', @@ -42,7 +43,7 @@ describe('Poolpair', () => { status: true, ownerAddress: address } - await client.poolpair.createPoolPair({ ...defaultMetadata, ...metadata }) + await client.poolpair.createPoolPair({ ...defaultMetadata }) await container.generate(1) } @@ -99,7 +100,7 @@ describe('Poolpair', () => { await container.generate(1) const utxos = await container.call('listunspent') - const inputs = utxos.filter((utxo: any) => utxo.txid === txid).map((utxo: any) => { + const inputs = utxos.filter((utxo: UTXO) => utxo.txid === txid).map((utxo: UTXO) => { return { txid: utxo.txid, vout: utxo.vout @@ -126,7 +127,7 @@ describe('Poolpair', () => { const tokenBAddress = await container.call('getnewaddress') const utxos = await container.call('listunspent') - const inputs = utxos.map((utxo: any) => { + const inputs = utxos.map((utxo: UTXO) => { return { txid: utxo.txid, vout: utxo.vout diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/getPoolPair.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/getPoolPair.test.ts index 5ba030569a..f8cb6c10ea 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/getPoolPair.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/getPoolPair.test.ts @@ -32,7 +32,7 @@ describe('Poolpair', () => { await container.generate(1) } - async function createPoolPair (tokenB: string, metadata?: any): Promise { + async function createPoolPair (tokenB: string): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { tokenA: 'DFI', @@ -41,7 +41,7 @@ describe('Poolpair', () => { status: true, ownerAddress: address } - await client.poolpair.createPoolPair({ ...defaultMetadata, ...metadata }) + await client.poolpair.createPoolPair({ ...defaultMetadata }) await container.generate(1) } diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolPairs.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolPairs.test.ts index 86ff3ce6dd..90638fbb79 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolPairs.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolPairs.test.ts @@ -40,7 +40,7 @@ describe('Poolpair', () => { await container.generate(1) } - async function createPoolPair (tokenB: string, metadata?: any): Promise { + async function createPoolPair (tokenB: string, metadata?: { commission?: number, status?: boolean}): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { tokenA: 'DFI', diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolShares.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolShares.test.ts index 95f9cb4831..efe9aefb5f 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolShares.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/listPoolShares.test.ts @@ -40,7 +40,7 @@ describe('Poolpair', () => { await container.generate(1) } - async function createPoolPair (tokenB: string, metadata?: any): Promise { + async function createPoolPair (tokenB: string, metadata?: { isDAT?: boolean, mintable?: boolean, tradeable?: boolean}): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { tokenA: 'DFI', diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/poolswap.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/poolswap.test.ts index b9b08f29e3..e86779cbee 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/poolswap.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/poolswap.test.ts @@ -95,7 +95,7 @@ describe('poolSwap', () => { await container.fundAddress(dfiAddress, 25) const utxos = await container.call('listunspent') - const utxo = utxos.find((utxo: any) => utxo.address === dfiAddress) + const utxo = utxos.find((utxo: { address: string }) => utxo.address === dfiAddress) const hex = await client.poolpair.poolSwap(metadata, [utxo]) expect(typeof hex).toStrictEqual('string') diff --git a/packages/jellyfish-api-core/__tests__/category/poolpair/removePoolLiquidity.test.ts b/packages/jellyfish-api-core/__tests__/category/poolpair/removePoolLiquidity.test.ts index 5e24d86164..02fa29f28f 100644 --- a/packages/jellyfish-api-core/__tests__/category/poolpair/removePoolLiquidity.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/poolpair/removePoolLiquidity.test.ts @@ -74,7 +74,7 @@ describe('Poolpair', () => { const poolLiquidityAddress = await setup('APE', 'BEE') await container.fundAddress(poolLiquidityAddress, 25) const utxos = await container.call('listunspent') - const utxo = utxos.find((utxo: any) => utxo.address === poolLiquidityAddress) + const utxo = utxos.find((utxo: { address: string }) => utxo.address === poolLiquidityAddress) const txid = await client.poolpair.removePoolLiquidity( poolLiquidityAddress, '4@APE-BEE', { utxos: [{ txid: utxo.txid, vout: utxo.vout }] } @@ -97,7 +97,7 @@ describe('Poolpair', () => { await container.fundAddress(otherAddress, 25) const utxos = await container.call('listunspent') - const utxo = utxos.find((utxo: any) => utxo.address === otherAddress) + const utxo = utxos.find((utxo: { address: string }) => utxo.address === otherAddress) const promise = client.poolpair.removePoolLiquidity( poolLiquidityAddress, '4@ELF-GOR', { utxos: [{ txid: utxo.txid, vout: utxo.vout }] } ) diff --git a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewardConfirms.test.ts b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewardConfirms.test.ts index 40b2cbb141..72cfeff95f 100644 --- a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewardConfirms.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewardConfirms.test.ts @@ -1,6 +1,7 @@ import { spv } from '@defichain/jellyfish-api-core' import { TestingGroup } from '@defichain/jellyfish-testing' import { GenesisKeys } from '@defichain/testcontainers' +import { ListAnchorsResult } from '@defichain/jellyfish-api-core/dist/category/spv' describe('Spv', () => { const tGroup = TestingGroup.create(3) @@ -97,19 +98,19 @@ describe('Spv', () => { await tGroup.get(0).container.call('spv_setlastheight', [6]) await tGroup.get(1).container.call('spv_setlastheight', [6]) - const anchors = await tGroup.get(0).container.call('spv_listanchors') + const anchors: ListAnchorsResult[] = await tGroup.get(0).container.call('spv_listanchors') expect(anchors.length).toBeGreaterThan(0) - const activeAnchor = anchors.find((anchor: any) => anchor.active) + const activeAnchor = anchors.find(anchor => anchor.active) const rewardConfs = await tGroup.get(0).rpc.spv.listAnchorRewardConfirms() expect(rewardConfs.length).toBeGreaterThan(0) const rewardConf = rewardConfs[0] expect(typeof rewardConf.btcTxHeight).toStrictEqual('number') - expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor.btcTxHash) - expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor.defiBlockHeight) - expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor.defiBlockHash) + expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor?.btcTxHash) + expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor?.defiBlockHeight) + expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor?.defiBlockHash) expect(typeof rewardConf.prevAnchorHeight).toStrictEqual('number') - expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor.rewardAddress) + expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor?.rewardAddress) expect(typeof rewardConf.confirmSignHash).toStrictEqual('string') expect(typeof rewardConf.signers).toStrictEqual('number') }) diff --git a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewards.test.ts b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewards.test.ts index 4cabd104a2..80af6e2de9 100644 --- a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewards.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorRewards.test.ts @@ -1,6 +1,7 @@ import { spv } from '@defichain/jellyfish-api-core' import { TestingGroup } from '@defichain/jellyfish-testing' import { GenesisKeys } from '@defichain/testcontainers' +import { ListAnchorsResult } from '@defichain/jellyfish-api-core/dist/category/spv' describe('Spv', () => { const tGroup = TestingGroup.create(3) @@ -101,19 +102,19 @@ describe('Spv', () => { await tGroup.get(0).container.call('spv_setlastheight', [6]) await tGroup.get(1).container.call('spv_setlastheight', [6]) - const anchors = await tGroup.get(0).container.call('spv_listanchors') + const anchors: ListAnchorsResult[] = await tGroup.get(0).container.call('spv_listanchors') expect(anchors.length).toBeGreaterThan(0) - const activeAnchor = anchors.find((anchor: any) => anchor.active) + const activeAnchor = anchors.find(anchor => anchor.active) const rewardConfs = await tGroup.get(0).container.call('spv_listanchorrewardconfirms') expect(rewardConfs.length).toBeGreaterThan(0) const rewardConf = rewardConfs[0] expect(typeof rewardConf.btcTxHeight).toStrictEqual('number') - expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor.btcTxHash) - expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor.defiBlockHeight) - expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor.defiBlockHash) + expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor?.btcTxHash) + expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor?.defiBlockHeight) + expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor?.defiBlockHash) expect(typeof rewardConf.prevAnchorHeight).toStrictEqual('number') - expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor.rewardAddress) + expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor?.rewardAddress) expect(typeof rewardConf.confirmSignHash).toStrictEqual('string') expect(typeof rewardConf.signers).toStrictEqual('number') diff --git a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorsUnRewarded.test.ts b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorsUnRewarded.test.ts index 62d40774f4..147f54f8aa 100644 --- a/packages/jellyfish-api-core/__tests__/category/spv/listAnchorsUnRewarded.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/spv/listAnchorsUnRewarded.test.ts @@ -1,6 +1,7 @@ import { spv } from '@defichain/jellyfish-api-core' import { TestingGroup } from '@defichain/jellyfish-testing' import { GenesisKeys } from '@defichain/testcontainers' +import { ListAnchorsResult } from '@defichain/jellyfish-api-core/dist/category/spv' describe('Spv', () => { const tGroup = TestingGroup.create(3) @@ -102,19 +103,19 @@ describe('Spv', () => { await tGroup.get(0).container.call('spv_setlastheight', [6]) await tGroup.get(1).container.call('spv_setlastheight', [6]) - const anchors = await tGroup.get(0).container.call('spv_listanchors') + const anchors: ListAnchorsResult[] = await tGroup.get(0).container.call('spv_listanchors') expect(anchors.length).toBeGreaterThan(0) - const activeAnchor = anchors.find((anchor: any) => anchor.active) + const activeAnchor = anchors.find(anchor => anchor.active) const rewardConfs = await tGroup.get(0).container.call('spv_listanchorrewardconfirms') expect(rewardConfs.length).toBeGreaterThan(0) const rewardConf = rewardConfs[0] expect(typeof rewardConf.btcTxHeight).toStrictEqual('number') - expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor.btcTxHash) - expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor.defiBlockHeight) - expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor.defiBlockHash) + expect(rewardConf.btcTxHash).toStrictEqual(activeAnchor?.btcTxHash) + expect(rewardConf.anchorHeight).toStrictEqual(activeAnchor?.defiBlockHeight) + expect(rewardConf.dfiBlockHash).toStrictEqual(activeAnchor?.defiBlockHash) expect(typeof rewardConf.prevAnchorHeight).toStrictEqual('number') - expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor.rewardAddress) + expect(rewardConf.rewardAddress).toStrictEqual(activeAnchor?.rewardAddress) expect(typeof rewardConf.confirmSignHash).toStrictEqual('string') expect(typeof rewardConf.signers).toStrictEqual('number') diff --git a/packages/jellyfish-api-core/__tests__/category/spv/refundHtlc.test.ts b/packages/jellyfish-api-core/__tests__/category/spv/refundHtlc.test.ts index 1ec8441d64..c5d71dd830 100644 --- a/packages/jellyfish-api-core/__tests__/category/spv/refundHtlc.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/spv/refundHtlc.test.ts @@ -1,6 +1,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { BigNumber, RpcApiError } from '@defichain/jellyfish-api-core' import { ContainerAdapterClient } from '../../container_adapter_client' +import { ReceivedByAddressInfo } from '@defichain/jellyfish-api-core/dist/category/spv' describe('Spv', () => { const container = new MasterNodeRegTestContainer() @@ -32,10 +33,10 @@ describe('Spv', () => { /** * Assert that the destination address received the refund */ - const listReceivingAddresses = await container.call('spv_listreceivedbyaddress') - const receivingAddress = listReceivingAddresses.find(({ address }: { address: string }) => address === destinationAddress) - expect(receivingAddress.address).toStrictEqual(destinationAddress) - expect(receivingAddress.txids.some((txid: string) => txid === result.txid)).toStrictEqual(true) + const listReceivingAddresses: ReceivedByAddressInfo[] = await container.call('spv_listreceivedbyaddress') + const receivingAddress = listReceivingAddresses.find(l => l.address === destinationAddress) + expect(receivingAddress?.address).toStrictEqual(destinationAddress) + expect(receivingAddress?.txids.some((txid: string) => txid === result.txid)).toStrictEqual(true) }) it('should refundHtlc with custom feeRate', async () => { @@ -55,10 +56,10 @@ describe('Spv', () => { /** * Assert that the destination address received the refund */ - const listReceivingAddresses = await container.call('spv_listreceivedbyaddress') - const receivingAddress = listReceivingAddresses.find(({ address }: { address: string }) => address === destinationAddress) - expect(receivingAddress.address).toStrictEqual(destinationAddress) - expect(receivingAddress.txids.some((txid: string) => txid === result.txid)).toStrictEqual(true) + const listReceivingAddresses: ReceivedByAddressInfo[] = await container.call('spv_listreceivedbyaddress') + const receivingAddress = listReceivingAddresses.find(l => l.address === destinationAddress) + expect(receivingAddress?.address).toStrictEqual(destinationAddress) + expect(receivingAddress?.txids.some((txid: string) => txid === result.txid)).toStrictEqual(true) }) it('should not refundHtlc when no unspent HTLC outputs found', async () => { diff --git a/packages/jellyfish-api-core/__tests__/category/spv/refundHtlcAll.test.ts b/packages/jellyfish-api-core/__tests__/category/spv/refundHtlcAll.test.ts index 9d52f3d679..4812e7b93f 100644 --- a/packages/jellyfish-api-core/__tests__/category/spv/refundHtlcAll.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/spv/refundHtlcAll.test.ts @@ -1,6 +1,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { BigNumber, RpcApiError } from '@defichain/jellyfish-api-core' import { Testing } from '@defichain/jellyfish-testing' +import { ListHtlcsOutputsResult, ReceivedByAddressInfo } from '@defichain/jellyfish-api-core/dist/category/spv' describe('Spv', () => { let testing: Testing @@ -40,7 +41,7 @@ describe('Spv', () => { * confirms at 11 as it `increaseSpvHeight` increased height by 10, * and refund action adds 1. */ - const outputList: any[] = await container.call('spv_listhtlcoutputs') + const outputList: ListHtlcsOutputsResult[] = await container.call('spv_listhtlcoutputs') expect(outputList.length).toStrictEqual(2) const output1 = outputList.find(({ txid }: { txid: string }) => txid === fund1.txid) const output2 = outputList.find(({ txid }: { txid: string }) => txid === fund2.txid) @@ -70,10 +71,10 @@ describe('Spv', () => { /** * Assert that the destination address received the refund */ - const listReceivingAddresses: any[] = await container.call('spv_listreceivedbyaddress') - const receivingAddress = listReceivingAddresses.find(({ address }: { address: string }) => address === destinationAddress) - expect(receivingAddress.address).toStrictEqual(destinationAddress) - expect(receivingAddress.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) + const listReceivingAddresses: ReceivedByAddressInfo[] = await container.call('spv_listreceivedbyaddress') + const receivingAddress = listReceivingAddresses.find(l => l.address === destinationAddress) + expect(receivingAddress?.address).toStrictEqual(destinationAddress) + expect(receivingAddress?.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) }) it('should refundHtlcAll for expired only', async () => { @@ -99,7 +100,7 @@ describe('Spv', () => { * confirms at 11 as it `increaseSpvHeight` increased height by 10, * and refund action adds 1. */ - const outputList: any[] = await container.call('spv_listhtlcoutputs') + const outputList: ListHtlcsOutputsResult[] = await container.call('spv_listhtlcoutputs') expect(outputList.length).toStrictEqual(2) const output1 = outputList.find(({ txid }: { txid: string }) => txid === fund1.txid) const output2 = outputList.find(({ txid }: { txid: string }) => txid === fund2.txid) @@ -125,10 +126,10 @@ describe('Spv', () => { /** * Assert that the destination address received the refund */ - const listReceivingAddresses: any[] = await container.call('spv_listreceivedbyaddress') - const receivingAddress = listReceivingAddresses.find(({ address }: { address: string }) => address === destinationAddress) - expect(receivingAddress.address).toStrictEqual(destinationAddress) - expect(receivingAddress.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) + const listReceivingAddresses: ReceivedByAddressInfo[] = await container.call('spv_listreceivedbyaddress') + const receivingAddress = listReceivingAddresses.find(l => l.address === destinationAddress) + expect(receivingAddress?.address).toStrictEqual(destinationAddress) + expect(receivingAddress?.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) }) it('should refundHtlcAll with custom feeRate', async () => { @@ -152,7 +153,7 @@ describe('Spv', () => { * confirms at 11 as it `increaseSpvHeight` increased height by 10, * and refund action adds 1. */ - const outputList: any[] = await container.call('spv_listhtlcoutputs') + const outputList: ListHtlcsOutputsResult[] = await container.call('spv_listhtlcoutputs') expect(outputList.length).toStrictEqual(1) const output = outputList.find(({ txid }: { txid: string }) => txid === fund.txid) expect(output).toStrictEqual({ @@ -170,10 +171,10 @@ describe('Spv', () => { /** * Assert that the destination address received the refund */ - const listReceivingAddresses = await container.call('spv_listreceivedbyaddress') - const receivingAddress = listReceivingAddresses.find(({ address }: { address: string }) => address === destinationAddress) - expect(receivingAddress.address).toStrictEqual(destinationAddress) - expect(receivingAddress.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) + const listReceivingAddresses: ReceivedByAddressInfo[] = await container.call('spv_listreceivedbyaddress') + const receivingAddress = listReceivingAddresses.find(l => l.address === destinationAddress) + expect(receivingAddress?.address).toStrictEqual(destinationAddress) + expect(receivingAddress?.txids.some((txid: string) => txid === results[0])).toStrictEqual(true) }) it('should not refundHtlcAll when no unspent HTLC outputs found', async () => { diff --git a/packages/jellyfish-api-core/__tests__/category/token/listTokens.test.ts b/packages/jellyfish-api-core/__tests__/category/token/listTokens.test.ts index 6d4d4ff441..9ee02b3dcb 100644 --- a/packages/jellyfish-api-core/__tests__/category/token/listTokens.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/token/listTokens.test.ts @@ -94,7 +94,7 @@ describe('Token on masternode', () => { await container.stop() }) - async function createToken (symbol: string, metadata?: any): Promise { + async function createToken (symbol: string, metadata?: { isDAT?: boolean, mintable?: boolean, tradeable?: boolean}): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { symbol, diff --git a/packages/jellyfish-api-core/__tests__/category/token/updateToken.test.ts b/packages/jellyfish-api-core/__tests__/category/token/updateToken.test.ts index 83e4867052..07df882f3c 100644 --- a/packages/jellyfish-api-core/__tests__/category/token/updateToken.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/token/updateToken.test.ts @@ -38,7 +38,7 @@ describe('Token', () => { } } - async function createToken (symbol: string, metadata?: any): Promise { + async function createToken (symbol: string): Promise { const address = await container.call('getnewaddress') const defaultMetadata = { symbol, @@ -48,7 +48,7 @@ describe('Token', () => { tradeable: true, collateralAddress: address } - await client.token.createToken({ ...defaultMetadata, ...metadata }) + await client.token.createToken({ ...defaultMetadata }) } it('should updateToken', async () => { diff --git a/packages/jellyfish-api-core/__tests__/category/vault/getVault.test.ts b/packages/jellyfish-api-core/__tests__/category/vault/getVault.test.ts index 7e4d3bdcb1..6890f6be98 100644 --- a/packages/jellyfish-api-core/__tests__/category/vault/getVault.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/vault/getVault.test.ts @@ -2,6 +2,7 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { Testing } from '@defichain/jellyfish-testing' import BigNumber from 'bignumber.js' import { VaultActive, VaultState } from '../../../src/category/vault' +import { Interest } from '@defichain/jellyfish-api-core/dist/category/vault' describe('Vault getVault', () => { const container = new MasterNodeRegTestContainer() @@ -134,7 +135,7 @@ describe('Vault getVault', () => { await testing.generate(1) // interest info. - const interestInfo: any = await testing.rpc.call('getinterest', ['default', 'TSLA'], 'bignumber') + const interestInfo: Interest[] = await testing.rpc.call('getinterest', ['default', 'TSLA'], 'bignumber') const data = await testing.rpc.vault.getVault(vaultId) as VaultActive const informativeRatio: BigNumber = data.collateralValue.dividedBy(data.loanValue).multipliedBy(100) diff --git a/packages/jellyfish-api-core/__tests__/category/vault/listAuctionHistory.test.ts b/packages/jellyfish-api-core/__tests__/category/vault/listAuctionHistory.test.ts index 580b11cbcf..d99ca19936 100644 --- a/packages/jellyfish-api-core/__tests__/category/vault/listAuctionHistory.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/vault/listAuctionHistory.test.ts @@ -1,7 +1,7 @@ import BigNumber from 'bignumber.js' import { TestingGroup } from '@defichain/jellyfish-testing' import { GenesisKeys, MasterNodeRegTestContainer } from '@defichain/testcontainers' -import { ListAuctionHistoryDetail } from '../../../src/category/vault' +import { ListAuctionHistoryDetail, VaultLiquidation } from '../../../src/category/vault' describe('Vault listAuctionHistory', () => { const tGroup = TestingGroup.create(2, i => new MasterNodeRegTestContainer(GenesisKeys[i])) @@ -326,8 +326,8 @@ describe('Vault listAuctionHistory', () => { await alice.generate(1) // When there is liquidation - const list = await alice.container.call('listauctions', []) - list.forEach((l: { state: any }) => + const list: VaultLiquidation[] = await alice.container.call('listauctions', []) + list.forEach(l => expect(l.state).toStrictEqual('inLiquidation') ) diff --git a/packages/jellyfish-api-core/__tests__/category/wallet/listAddressGroupings.test.ts b/packages/jellyfish-api-core/__tests__/category/wallet/listAddressGroupings.test.ts index 1a672042be..916f04628c 100644 --- a/packages/jellyfish-api-core/__tests__/category/wallet/listAddressGroupings.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/wallet/listAddressGroupings.test.ts @@ -45,12 +45,12 @@ describe('Address on masternode', () => { expect(data[0][0][0]).toStrictEqual('mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy') expect(data[0][0][1] instanceof BigNumber).toStrictEqual(true) - expect(data[0][0][1].isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) + expect((data[0][0][1] as BigNumber).isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) expect(data[0][0][2]).toStrictEqual('operator') expect(data[1][0][0]).toStrictEqual('mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU') expect(data[1][0][1] instanceof BigNumber).toStrictEqual(true) - expect(data[1][0][1].isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) + expect((data[1][0][1] as BigNumber).isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) expect(data[1][0][2]).toStrictEqual('owner') }) }) diff --git a/packages/jellyfish-api-core/__tests__/category/wallet/wallet.test.ts b/packages/jellyfish-api-core/__tests__/category/wallet/wallet.test.ts index 3345572b93..6c2bddb04e 100644 --- a/packages/jellyfish-api-core/__tests__/category/wallet/wallet.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/wallet/wallet.test.ts @@ -773,12 +773,12 @@ describe('masternode', () => { expect(data[0][0][0]).toStrictEqual('mswsMVsyGMj1FzDMbbxw2QW3KvQAv2FKiy') expect(data[0][0][1] instanceof BigNumber).toStrictEqual(true) - expect(data[0][0][1].isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) + expect((data[0][0][1] as BigNumber).isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) expect(data[0][0][2]).toStrictEqual('operator') expect(data[1][0][0]).toStrictEqual('mwsZw8nF7pKxWH8eoKL9tPxTpaFkz7QeLU') expect(data[1][0][1] instanceof BigNumber).toStrictEqual(true) - expect(data[1][0][1].isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) + expect((data[1][0][1] as BigNumber).isGreaterThanOrEqualTo(new BigNumber('0'))).toStrictEqual(true) expect(data[1][0][2]).toStrictEqual('owner') }) }) diff --git a/packages/jellyfish-api-core/__tests__/container_adapter_client.ts b/packages/jellyfish-api-core/__tests__/container_adapter_client.ts index a0a82ab515..70ddab17e8 100644 --- a/packages/jellyfish-api-core/__tests__/container_adapter_client.ts +++ b/packages/jellyfish-api-core/__tests__/container_adapter_client.ts @@ -17,6 +17,7 @@ export class ContainerAdapterClient extends ApiClient { /** * Wrap the call from client to testcontainers. */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async call (method: string, params: any[], precision: Precision | PrecisionPath): Promise { const body = JellyfishJSON.stringify({ jsonrpc: '1.0', diff --git a/packages/jellyfish-api-core/__tests__/index.test.ts b/packages/jellyfish-api-core/__tests__/index.test.ts index 2f038a4793..1027853b69 100644 --- a/packages/jellyfish-api-core/__tests__/index.test.ts +++ b/packages/jellyfish-api-core/__tests__/index.test.ts @@ -3,6 +3,7 @@ import { ContainerAdapterClient } from './container_adapter_client' import { RegTestContainer } from '@defichain/testcontainers' class TestClient extends ApiClient { + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async call (method: string, payload: any[]): Promise { throw new ClientApiError('error from client') } diff --git a/packages/jellyfish-api-core/src/category/account.ts b/packages/jellyfish-api-core/src/category/account.ts index 2a474d7d11..5c7b456b1b 100644 --- a/packages/jellyfish-api-core/src/category/account.ts +++ b/packages/jellyfish-api-core/src/category/account.ts @@ -443,7 +443,7 @@ export class Account { } export interface AccountPagination { - start?: number + start?: number | string including_start?: boolean limit?: number } diff --git a/packages/jellyfish-api-core/src/category/masternode.ts b/packages/jellyfish-api-core/src/category/masternode.ts index e685cc8c23..1b97a09199 100644 --- a/packages/jellyfish-api-core/src/category/masternode.ts +++ b/packages/jellyfish-api-core/src/category/masternode.ts @@ -154,6 +154,7 @@ export class Masternode { * @return {Promise} hash * */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async setGov (input: Record, utxos: UTXO[] = []): Promise { return await this.client.call('setgov', [input, utxos], 'number') } @@ -169,6 +170,7 @@ export class Masternode { * @return {Promise} hash * */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async setGovHeight (input: Record, activationHeight: number, utxos: UTXO[] = []): Promise { return await this.client.call('setgovheight', [input, activationHeight, utxos], 'number') } @@ -179,6 +181,7 @@ export class Masternode { * @param {string} name governance name * @return {Promise} governance information as json object */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async getGov (name: string): Promise> { return await this.client.call('getgov', [name], 'bignumber') } @@ -194,6 +197,7 @@ export class Masternode { * * @returns {Promise>>>} */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ async listGovs (): Promise>>> { return await this.client.call('listgovs', [], 'bignumber') } diff --git a/packages/jellyfish-api-core/src/category/vault.ts b/packages/jellyfish-api-core/src/category/vault.ts index 1ccc2e8bfb..d3b7af0ad4 100644 --- a/packages/jellyfish-api-core/src/category/vault.ts +++ b/packages/jellyfish-api-core/src/category/vault.ts @@ -370,3 +370,10 @@ export interface VaultEstimation { export interface TokenPercentageSplit { [token: string]: number // Token: split } + +export interface Interest { + token: string + realizedInterestPerBlock: BigNumber + totalInterest: BigNumber + interestPerBlock: BigNumber +} diff --git a/packages/jellyfish-api-core/src/category/wallet.ts b/packages/jellyfish-api-core/src/category/wallet.ts index 021c1da2ac..dc76a66d0a 100644 --- a/packages/jellyfish-api-core/src/category/wallet.ts +++ b/packages/jellyfish-api-core/src/category/wallet.ts @@ -241,9 +241,9 @@ export class Wallet { * Lists groups of addresses which have had their common ownership made public * by common use as inputs or as the resulting change in past transactions * - * @return {Promise} + * @return {Promise} */ - async listAddressGroupings (): Promise { + async listAddressGroupings (): Promise { return await this.client.call('listaddressgroupings', [], 'bignumber') } diff --git a/packages/jellyfish-api-core/src/index.ts b/packages/jellyfish-api-core/src/index.ts index 08316796f3..e26edd9363 100644 --- a/packages/jellyfish-api-core/src/index.ts +++ b/packages/jellyfish-api-core/src/index.ts @@ -80,6 +80,7 @@ export abstract class ApiClient { * @throws RpcApiError * @throws ClientApiError */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ abstract call (method: string, params: any[], precision: Precision | PrecisionPath): Promise }