From 767aa7199458153486350a6804fa0851932d91ae Mon Sep 17 00:00:00 2001 From: canonbrother Date: Fri, 23 Feb 2024 14:48:52 +0800 Subject: [PATCH] chore(): 4.0.9 (#2181) #### What this PR does / why we need it: #### Which issue(s) does this PR fixes?: Fixes # #### Additional comments?: --- .../modules/PlaygroundModule.test.ts | 86 +-- apps/playground-api/src/setups/setup.gov.ts | 96 +-- apps/whale-api/docker-compose.yml | 2 +- .../src/module.api/address.controller.e2e.ts | 13 +- .../src/module.api/address.controller.spec.ts | 13 +- .../module.api/consortium.controller.spec.ts | 4 +- .../src/module.api/stats.controller.ts | 31 +- .../category/account/getBurnInfo.test.ts | 2 +- .../category/account/transferDomain.test.ts | 4 +- .../category/masternode/setGov.test.ts | 2 +- .../masternode/updatemasternode.test.ts | 2 +- .../category/rawtx/testMempoolAccept.test.ts | 4 +- .../category/token/burnTokens.test.ts | 70 +-- .../category/token/mintTokens.test.ts | 586 +++++++++--------- .../txn_builder_account_future_swap.test.ts | 44 +- ...xn_builder_account_transfer_domain.test.ts | 14 +- .../txn/txn_builder_claim_dfc_htlc.test.ts | 2 +- .../txn_builder_governance_createcfp.test.ts | 12 +- .../txn_builder_governance_createvoc.test.ts | 10 +- .../txn/txn_builder_governance_vote.test.ts | 10 +- .../txn/txn_builder_icx_close_offer.test.ts | 4 +- .../txn/txn_builder_icx_close_order.test.ts | 4 +- .../txn/txn_builder_loan_close_vault.test.ts | 12 +- .../txn/txn_builder_loan_create_vault.test.ts | 6 +- .../txn_builder_loan_deposit_to_vault.test.ts | 2 +- ...n_builder_loan_destroy_loan_scheme.test.ts | 10 +- .../txn/txn_builder_loan_payback_loan.test.ts | 16 +- ..._builder_loan_set_collateral_token.test.ts | 4 +- ...ilder_loan_set_default_loan_scheme.test.ts | 10 +- .../txn_builder_loan_set_loan_scheme.test.ts | 28 +- .../txn_builder_loan_set_loan_token.test.ts | 6 +- .../txn/txn_builder_loan_take_loan.test.ts | 12 +- ...txn_builder_loan_update_loan_token.test.ts | 8 +- .../txn/txn_builder_loan_update_vault.test.ts | 6 +- ...n_builder_loan_withdraw_from_vault.test.ts | 2 +- .../txn/txn_builder_masternode_create.test.ts | 2 +- .../txn/txn_builder_masternode_update.test.ts | 20 +- .../txn/txn_builder_token_burn_token.test.ts | 48 +- .../txn/txn_builder_token_mint_token.test.ts | 16 +- .../txn/txn_builder_vault_close_vault.test.ts | 12 +- .../txn_builder_vault_create_vault.test.ts | 6 +- ...txn_builder_vault_deposit_to_vault.test.ts | 2 +- .../txn_builder_vault_update_vault.test.ts | 6 +- ..._builder_vault_withdraw_from_vault.test.ts | 2 +- .../src/containers/DeFiDContainer.ts | 2 +- .../src/containers/NativeChainContainer.ts | 2 +- .../__tests__/api/consortium.test.ts | 6 +- 47 files changed, 651 insertions(+), 610 deletions(-) diff --git a/apps/playground-api/__tests__/modules/PlaygroundModule.test.ts b/apps/playground-api/__tests__/modules/PlaygroundModule.test.ts index 36b66448e6..3a940a6f4d 100644 --- a/apps/playground-api/__tests__/modules/PlaygroundModule.test.ts +++ b/apps/playground-api/__tests__/modules/PlaygroundModule.test.ts @@ -1,5 +1,5 @@ -import { RegTestFoundationKeys } from '@defichain/jellyfish-network' -import { ConsortiumKey } from '../../src/ConsortiumKey' +// import { RegTestFoundationKeys } from '@defichain/jellyfish-network' +// import { ConsortiumKey } from '../../src/ConsortiumKey' import { PlaygroundApiTesting } from '../../testing/PlaygroundApiTesting' const pg = PlaygroundApiTesting.create() @@ -63,46 +63,46 @@ it('should have gov set', async () => { const gov = await testing.container.call('getgov', ['ATTRIBUTES']) expect(gov).toStrictEqual({ ATTRIBUTES: { - 'v0/consortium/1/members': { - '01': { - backingId: 'backing_address_btc_1_c', - mintLimit: 50, - mintLimitDaily: 5, - name: 'Waves HQ', - ownerAddress: ConsortiumKey.address, - status: 0 - }, - '02': { - backingId: 'backing_address_btc_1_br, backing_address_btc_2_br', - mintLimit: 50, - mintLimitDaily: 5, - name: 'Alexandria', - ownerAddress: RegTestFoundationKeys[RegTestFoundationKeys.length - 1].owner.address, - status: 0 - } - }, - 'v0/consortium/2/members': { - '01': { - backingId: 'backing_address_eth_1_c', - mintLimit: 10, - mintLimitDaily: 5, - name: 'Waves HQ', - ownerAddress: ConsortiumKey.address, - status: 0 - }, - '02': { - backingId: 'backing_address_eth_1_br, backing_address_eth_2_br', - mintLimit: 10, - mintLimitDaily: 5, - name: 'Alexandria', - ownerAddress: RegTestFoundationKeys[RegTestFoundationKeys.length - 1].owner.address, - status: 0 - } - }, - 'v0/consortium/1/mint_limit': '50', - 'v0/consortium/1/mint_limit_daily': '5', - 'v0/consortium/2/mint_limit': '20', - 'v0/consortium/2/mint_limit_daily': '10', + // 'v0/consortium/1/members': { + // '01': { + // backingId: 'backing_address_btc_1_c', + // mintLimit: 50, + // mintLimitDaily: 5, + // name: 'Waves HQ', + // ownerAddress: ConsortiumKey.address, + // status: 0 + // }, + // '02': { + // backingId: 'backing_address_btc_1_br, backing_address_btc_2_br', + // mintLimit: 50, + // mintLimitDaily: 5, + // name: 'Alexandria', + // ownerAddress: RegTestFoundationKeys[RegTestFoundationKeys.length - 1].owner.address, + // status: 0 + // } + // }, + // 'v0/consortium/2/members': { + // '01': { + // backingId: 'backing_address_eth_1_c', + // mintLimit: 10, + // mintLimitDaily: 5, + // name: 'Waves HQ', + // ownerAddress: ConsortiumKey.address, + // status: 0 + // }, + // '02': { + // backingId: 'backing_address_eth_1_br, backing_address_eth_2_br', + // mintLimit: 10, + // mintLimitDaily: 5, + // name: 'Alexandria', + // ownerAddress: RegTestFoundationKeys[RegTestFoundationKeys.length - 1].owner.address, + // status: 0 + // } + // }, + // 'v0/consortium/1/mint_limit': '50', + // 'v0/consortium/1/mint_limit_daily': '5', + // 'v0/consortium/2/mint_limit': '20', + // 'v0/consortium/2/mint_limit_daily': '10', 'v0/live/economy/evm/block/fee_burnt': 0, 'v0/live/economy/evm/block/fee_burnt_max': 0, 'v0/live/economy/evm/block/fee_burnt_max_hash': expect.any(String), @@ -118,7 +118,7 @@ it('should have gov set', async () => { 'v0/params/dfip2203/block_period': '20', 'v0/params/dfip2203/fee_pct': '0.05', 'v0/params/dfip2203/reward_pct': '0.05', - 'v0/params/feature/consortium': 'true', + // 'v0/params/feature/consortium': 'true', 'v0/params/feature/gov': 'true', 'v0/token/0/fixed_interval_price_id': 'DFI/USD', 'v0/token/0/loan_collateral_enabled': 'true', diff --git a/apps/playground-api/src/setups/setup.gov.ts b/apps/playground-api/src/setups/setup.gov.ts index 8d5cce599f..61af001bc1 100644 --- a/apps/playground-api/src/setups/setup.gov.ts +++ b/apps/playground-api/src/setups/setup.gov.ts @@ -67,54 +67,54 @@ export class SetupGov extends PlaygroundSetup> { 'v0/vaults/dusd-vault/enabled': 'true', // On-chain governance - 'v0/params/feature/gov': 'true', - - // Enable consortium - 'v0/params/feature/consortium': 'true', - - // Set a consortium global limit for dBTC - 'v0/consortium/1/mint_limit': '50', - 'v0/consortium/1/mint_limit_daily': '5', - - // Set a consortium member for dBTC - 'v0/consortium/1/members': { - '01': { - name: 'Waves HQ', - ownerAddress: this.consortiumOwnerAddress1, - backingId: 'backing_address_btc_1_c', - mintLimitDaily: '5.00000000', - mintLimit: '50.00000000' - }, - '02': { - name: 'Alexandria', - ownerAddress: this.consortiumOwnerAddress2, - backingId: 'backing_address_btc_1_br, backing_address_btc_2_br', - mintLimitDaily: '5.00000000', - mintLimit: '50.00000000' - } - }, - - // Consortium global limit for dETH - 'v0/consortium/2/mint_limit': '20', - 'v0/consortium/2/mint_limit_daily': '10', - - // Set a consortium member for dETH - 'v0/consortium/2/members': { - '01': { - name: 'Waves HQ', - ownerAddress: this.consortiumOwnerAddress1, - backingId: 'backing_address_eth_1_c', - mintLimitDaily: '5.00000000', - mintLimit: '10.00000000' - }, - '02': { - name: 'Alexandria', - ownerAddress: this.consortiumOwnerAddress2, - backingId: 'backing_address_eth_1_br, backing_address_eth_2_br', - mintLimitDaily: '5.00000000', - mintLimit: '10.00000000' - } - } + 'v0/params/feature/gov': 'true' + + // // Enable consortium + // 'v0/params/feature/consortium': 'true' + + // // Set a consortium global limit for dBTC + // 'v0/consortium/1/mint_limit': '50', + // 'v0/consortium/1/mint_limit_daily': '5', + + // // Set a consortium member for dBTC + // 'v0/consortium/1/members': { + // '01': { + // name: 'Waves HQ', + // ownerAddress: this.consortiumOwnerAddress1, + // backingId: 'backing_address_btc_1_c', + // mintLimitDaily: '5.00000000', + // mintLimit: '50.00000000' + // }, + // '02': { + // name: 'Alexandria', + // ownerAddress: this.consortiumOwnerAddress2, + // backingId: 'backing_address_btc_1_br, backing_address_btc_2_br', + // mintLimitDaily: '5.00000000', + // mintLimit: '50.00000000' + // } + // }, + + // // Consortium global limit for dETH + // 'v0/consortium/2/mint_limit': '20', + // 'v0/consortium/2/mint_limit_daily': '10', + + // // Set a consortium member for dETH + // 'v0/consortium/2/members': { + // '01': { + // name: 'Waves HQ', + // ownerAddress: this.consortiumOwnerAddress1, + // backingId: 'backing_address_eth_1_c', + // mintLimitDaily: '5.00000000', + // mintLimit: '10.00000000' + // }, + // '02': { + // name: 'Alexandria', + // ownerAddress: this.consortiumOwnerAddress2, + // backingId: 'backing_address_eth_1_br, backing_address_eth_2_br', + // mintLimitDaily: '5.00000000', + // mintLimit: '10.00000000' + // } + // } } } ] diff --git a/apps/whale-api/docker-compose.yml b/apps/whale-api/docker-compose.yml index 95e65e3e85..a7eff8d34e 100644 --- a/apps/whale-api/docker-compose.yml +++ b/apps/whale-api/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: defi-blockchain: - image: defi/defichain:4.0.5 + image: defi/defichain:4.0.9 ports: - "19554:19554" diff --git a/apps/whale-api/src/module.api/address.controller.e2e.ts b/apps/whale-api/src/module.api/address.controller.e2e.ts index d9c80b7727..6323271cff 100644 --- a/apps/whale-api/src/module.api/address.controller.e2e.ts +++ b/apps/whale-api/src/module.api/address.controller.e2e.ts @@ -8,6 +8,7 @@ import { Testing } from '@defichain/jellyfish-testing' import { ForbiddenException } from '@nestjs/common' import BigNumber from 'bignumber.js' import { RegTestFoundationKeys } from '@defichain/jellyfish-network' +import { RpcApiError } from '@defichain/jellyfish-api-core/dist/index' const container = new MasterNodeRegTestContainer() let app: NestFastifyApplication @@ -1077,7 +1078,15 @@ describe('listTokens', () => { }) it('should return empty and page undefined while listTokens with invalid address', async () => { - const tokens = await controller.listTokens('invalid', { size: 30 }) - expect(tokens).toStrictEqual(expect.objectContaining({ data: [], page: undefined })) + try { + await controller.listTokens('invalid', { size: 30 }) + } catch (err: any) { + expect(err).toBeInstanceOf(RpcApiError) + expect(err.payload).toStrictEqual({ + code: -5, + message: 'Invalid owner address', + method: 'getaccount' + }) + } }) }) diff --git a/apps/whale-api/src/module.api/address.controller.spec.ts b/apps/whale-api/src/module.api/address.controller.spec.ts index c9e0bdaa39..34bd9cb724 100644 --- a/apps/whale-api/src/module.api/address.controller.spec.ts +++ b/apps/whale-api/src/module.api/address.controller.spec.ts @@ -5,6 +5,7 @@ import { Testing } from '@defichain/jellyfish-testing' import BigNumber from 'bignumber.js' import { createTestingApp, stopTestingApp } from '../e2e.module' import { NestFastifyApplication } from '@nestjs/platform-fastify' +import { RpcApiError } from '@defichain/jellyfish-api-core/dist/index' const container = new MasterNodeRegTestContainer() const testing = Testing.create(container) @@ -175,7 +176,15 @@ describe('listTokens', () => { }) it('should return empty and page undefined while listTokens with invalid address', async () => { - const tokens = await controller.listTokens('invalid', { size: 30 }) - expect(tokens).toStrictEqual(expect.objectContaining({ data: [], page: undefined })) + try { + await controller.listTokens('invalid', { size: 30 }) + } catch (err: any) { + expect(err).toBeInstanceOf(RpcApiError) + expect(err.payload).toStrictEqual({ + code: -5, + message: 'Invalid owner address', + method: 'getaccount' + }) + } }) }) diff --git a/apps/whale-api/src/module.api/consortium.controller.spec.ts b/apps/whale-api/src/module.api/consortium.controller.spec.ts index fdc53abe13..e226dd92ef 100644 --- a/apps/whale-api/src/module.api/consortium.controller.spec.ts +++ b/apps/whale-api/src/module.api/consortium.controller.spec.ts @@ -122,7 +122,7 @@ async function setup (): Promise { }]) } -describe('getAssetBreakdown', () => { +describe.skip('getAssetBreakdown', () => { it('should return an empty list if theres no consortium members or tokens initialized', async () => { const info = await controller.getAssetBreakdown() expect(info).toStrictEqual([]) @@ -188,7 +188,7 @@ describe('getAssetBreakdown', () => { }) }) -describe('getMemberStats', () => { +describe.skip('getMemberStats', () => { it('should throw an error if given consortium member id does not exists', async () => { await setup() diff --git a/apps/whale-api/src/module.api/stats.controller.ts b/apps/whale-api/src/module.api/stats.controller.ts index 9c4bec4126..56452cfaf3 100644 --- a/apps/whale-api/src/module.api/stats.controller.ts +++ b/apps/whale-api/src/module.api/stats.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get } from '@nestjs/common' +import { Controller, Get, Inject, NotFoundException } from '@nestjs/common' import { BurnData, RewardDistributionData, StatsData, SupplyData } from '@defichain/whale-api-client/dist/api/stats' import { SemaphoreCache } from '@defichain-apps/libs/caches' import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc' @@ -11,6 +11,7 @@ import { BlockchainInfo } from '@defichain/jellyfish-api-core/dist/category/bloc import { getBlockSubsidy } from './subsidy' import { BlockSubsidy, + NetworkName, getBlockRewardDistribution } from '@defichain/jellyfish-network' import { BurnInfo } from '@defichain/jellyfish-api-core/dist/category/account' @@ -27,7 +28,8 @@ export class StatsController { protected readonly poolPairService: PoolPairService, protected readonly rpcClient: JsonRpcClient, protected readonly cache: SemaphoreCache, - protected readonly blockSubsidy: BlockSubsidy + protected readonly blockSubsidy: BlockSubsidy, + @Inject('NETWORK') protected readonly network: NetworkName ) { } @@ -210,13 +212,30 @@ export class StatsController { } } + private getBurnAddress (): string { + switch (this.network) { + case 'mainnet': + return '8defichainBurnAddressXXXXXXXdRQkSm' + case 'testnet': + case 'changi': + case 'devnet': + return '7DefichainBurnAddressXXXXXXXdMUE5n' + case 'regtest': + return 'mfburnZSAM7Gs1hpDeNaMotJXSGA7edosG' + default: + throw new NotFoundException('Unable to get burn address due to unknown network') + } + } + /** - * '76a914f7874e8821097615ec345f74c7e5bcf61b12e2ee88ac' is '8defichainBurnAddressXXXXXXXdRQkSm' - * using the hex representation as it's applicable in all network + * ~~'76a914f7874e8821097615ec345f74c7e5bcf61b12e2ee88ac' is '8defichainBurnAddressXXXXXXXdRQkSm'~~ + * ~~using the hex representation as it's applicable in all network~~ + * update: https://github.com/DeFiCh/ain/pull/2798 + * rpc `getaccount` only expects regular address, no more scriptpubkey */ private async getBurnedTotal (): Promise { - const address = '76a914f7874e8821097615ec345f74c7e5bcf61b12e2ee88ac' - const tokens = await this.rpcClient.account.getAccount(address) + const burnAddress = this.getBurnAddress() + const tokens = await this.rpcClient.account.getAccount(burnAddress) const burnInfo = await this.getBurnInfo() const utxo = burnInfo.amount diff --git a/packages/jellyfish-api-core/__tests__/category/account/getBurnInfo.test.ts b/packages/jellyfish-api-core/__tests__/category/account/getBurnInfo.test.ts index fd2aa51ea0..57b7d89cf5 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/getBurnInfo.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/getBurnInfo.test.ts @@ -50,7 +50,7 @@ it('should getBurnInfo', async () => { tokens: ['50.00000000@GOLD'], feeburn: new BigNumber('2'), auctionburn: new BigNumber(0), - consortiumtokens: [], + // consortiumtokens: [], emissionburn: new BigNumber('6274'), paybackburn: [], paybackfees: [], diff --git a/packages/jellyfish-api-core/__tests__/category/account/transferDomain.test.ts b/packages/jellyfish-api-core/__tests__/category/account/transferDomain.test.ts index 108c05ff2c..20553b993d 100644 --- a/packages/jellyfish-api-core/__tests__/category/account/transferDomain.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/account/transferDomain.test.ts @@ -220,7 +220,7 @@ describe('TransferDomain', () => { } ]) await expect(promise).rejects.toThrow(RpcApiError) - await expect(promise).rejects.toThrow('Failed to create and sign TX: Invalid address') + await expect(promise).rejects.toThrow('Dst address must be an ERC55 address in case of "EVM" domain') }) it('(evm -> dvm) should fail if src address is not ERC55 address in case of "EVM" domain', async () => { @@ -488,7 +488,7 @@ describe('TransferDomain', () => { } ]) await expect(promise).rejects.toThrow(RpcApiError) - await expect(promise).rejects.toThrow('Failed to create and sign TX: Invalid address') + await expect(promise).rejects.toThrow('Cannot transfer inside same domain') }) it('(evm -> evm) should fail if transfer within same domain', async () => { 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 9063f19477..6236bbbcf6 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/setGov.test.ts @@ -517,7 +517,7 @@ describe('setGov ATTRIBUTES loan dusd burn keys', () => { }) }) -describe('setGov consortium ATTRIBUTES', () => { +describe.skip('setGov consortium ATTRIBUTES', () => { const tGroup = TestingGroup.create(2) let account0: string, account1: string let idBTC: string diff --git a/packages/jellyfish-api-core/__tests__/category/masternode/updatemasternode.test.ts b/packages/jellyfish-api-core/__tests__/category/masternode/updatemasternode.test.ts index 03cdfb7ac9..3e57381a45 100644 --- a/packages/jellyfish-api-core/__tests__/category/masternode/updatemasternode.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/masternode/updatemasternode.test.ts @@ -529,7 +529,7 @@ describe('Update Masternode', () => { const promise = container.call('sendrawtransaction', [signedTx.hex]) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'bad-txns-collateral-locked, tried to spend locked collateral for ${masternodeId} (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'bad-txns-collateral-locked, tried to spend locked collateral for ${masternodeId}', code: -26`) }) }) diff --git a/packages/jellyfish-api-core/__tests__/category/rawtx/testMempoolAccept.test.ts b/packages/jellyfish-api-core/__tests__/category/rawtx/testMempoolAccept.test.ts index 44afbe3ed1..1689e86ee1 100644 --- a/packages/jellyfish-api-core/__tests__/category/rawtx/testMempoolAccept.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/rawtx/testMempoolAccept.test.ts @@ -76,12 +76,12 @@ describe('Raw transaction', () => { it('testMempoolAccept() should fail with low fee rate', async () => { const result = await testMempoolAcceptFees(new BigNumber('4.5')) expect(result.allowed).toStrictEqual(false) - expect(result['reject-reason']).toStrictEqual('256: absurdly-high-fee') + expect(result['reject-reason']).toStrictEqual('absurdly-high-fee') }) it('testMempoolAccept() should fail with extreme low fee rate', async () => { const result = await testMempoolAcceptFees(new BigNumber('0.01')) expect(result.allowed).toStrictEqual(false) - expect(result['reject-reason']).toStrictEqual('256: absurdly-high-fee') + expect(result['reject-reason']).toStrictEqual('absurdly-high-fee') }) }) diff --git a/packages/jellyfish-api-core/__tests__/category/token/burnTokens.test.ts b/packages/jellyfish-api-core/__tests__/category/token/burnTokens.test.ts index af03c55710..a4976f82b5 100644 --- a/packages/jellyfish-api-core/__tests__/category/token/burnTokens.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/token/burnTokens.test.ts @@ -1,18 +1,18 @@ import { TestingGroup } from '@defichain/jellyfish-testing' -import { BigNumber } from '../../../src' describe('burnTokens', () => { const tGroup = TestingGroup.create(3) const symbolDBTC = 'DBTC' - let account0: string, account1: string, account2: string - let idBTC: string + let account0: string, account1: string + // let account2: string + // let idBTC: string beforeEach(async () => { await tGroup.start() account0 = await tGroup.get(0).generateAddress() account1 = await tGroup.get(1).generateAddress() - account2 = await tGroup.get(2).generateAddress() + // account2 = await tGroup.get(2).generateAddress() await tGroup.get(0).token.create({ symbol: symbolDBTC, @@ -29,30 +29,30 @@ describe('burnTokens', () => { await tGroup.get(0).generate(1) - idBTC = await tGroup.get(0).token.getTokenId(symbolDBTC) - - await setGovAttr({ 'v0/params/feature/consortium': 'true' }) - - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account0, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing2' - }, - '03': { - name: 'account3BTC', - ownerAddress: account2, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing2' - } - } - }) + // idBTC = await tGroup.get(0).token.getTokenId(symbolDBTC) + + // await setGovAttr({ 'v0/params/feature/consortium': 'true' }) + + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account0, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing2' + // }, + // '03': { + // name: 'account3BTC', + // ownerAddress: account2, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing2' + // } + // } + // }) await tGroup.get(0).rpc.token.mintTokens({ amounts: [`10@${symbolDBTC}`] }) await tGroup.get(0).generate(1) @@ -62,11 +62,11 @@ describe('burnTokens', () => { await tGroup.stop() }) - async function setGovAttr (attributes: object): Promise { - const hash = await tGroup.get(0).rpc.masternode.setGov({ ATTRIBUTES: attributes }) - expect(hash).toBeTruthy() - await tGroup.get(0).generate(1) - } + // async function setGovAttr (attributes: object): Promise { + // const hash = await tGroup.get(0).rpc.masternode.setGov({ ATTRIBUTES: attributes }) + // expect(hash).toBeTruthy() + // await tGroup.get(0).generate(1) + // } it('should throw an error if invalid value is provided for amount', async () => { // @ts-expect-error @@ -112,8 +112,8 @@ describe('burnTokens', () => { const tokensAfterBurn = await tGroup.get(0).rpc.account.getAccount(account0) expect(tokensAfterBurn[0]).toStrictEqual(`9.00000000@${symbolDBTC}`) - const attr = (await tGroup.get(2).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES - expect(attr['v0/live/economy/consortium/1/burnt']).toStrictEqual(new BigNumber(1)) + // const attr = (await tGroup.get(2).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES + // expect(attr['v0/live/economy/consortium/1/burnt']).toStrictEqual(new BigNumber(1)) }) it('should burn tokens with utxos', async () => { diff --git a/packages/jellyfish-api-core/__tests__/category/token/mintTokens.test.ts b/packages/jellyfish-api-core/__tests__/category/token/mintTokens.test.ts index 4c64ed6c3e..8309fa1877 100644 --- a/packages/jellyfish-api-core/__tests__/category/token/mintTokens.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/token/mintTokens.test.ts @@ -134,10 +134,12 @@ describe('Token', () => { }) }) -describe('Consortium', () => { +// NOTE(canonbrother): skip as consortium is removed, ref: https://github.com/DeFiCh/ain/pull/2730 +describe.skip('Consortium', () => { const tGroup = TestingGroup.create(4) let account0: string, account1: string, account2: string, account3: string - let idBTC: string, idDOGE: string + let idBTC: string + // let idDOGE: string const symbolBTC = 'BTC' const symbolDOGE = 'DOGE' const startFlags: StartFlags[] = [{ name: 'regtest-minttoken-simulate-mainnet', value: 1 }] @@ -178,22 +180,22 @@ describe('Consortium', () => { await tGroup.get(0).generate(1) idBTC = await tGroup.get(0).token.getTokenId(symbolBTC) - idDOGE = await tGroup.get(0).token.getTokenId(symbolDOGE) + // idDOGE = await tGroup.get(0).token.getTokenId(symbolDOGE) - // Enable consortium - await setGovAttr({ 'v0/params/feature/consortium': 'true' }) + // // Enable consortium + // await setGovAttr({ 'v0/params/feature/consortium': 'true' }) }) afterEach(async () => { await tGroup.stop() }) - async function setGovAttr (attributes: object): Promise { - const hash = await tGroup.get(0).rpc.masternode.setGov({ ATTRIBUTES: attributes }) - expect(hash).toBeTruthy() - await tGroup.get(0).generate(1) - await tGroup.waitForSync() - } + // async function setGovAttr (attributes: object): Promise { + // const hash = await tGroup.get(0).rpc.masternode.setGov({ ATTRIBUTES: attributes }) + // expect(hash).toBeTruthy() + // await tGroup.get(0).generate(1) + // await tGroup.waitForSync() + // } it('should throw an error if foundation or consortium member authorization is not present', async () => { const errorMsg = 'RpcApiError: \'Test MintTokenTx execution failed:\nYou are not a foundation member or token owner and cannot mint this token!\', code: -32600, method: minttokens' @@ -205,82 +207,82 @@ describe('Consortium', () => { it('should throw an error if the token is not specified in governance vars', async () => { // Set consortium members 02 for BTC - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing2' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing2' + // } + // } + // }) // Member 02 trying to mint DOGE await expect(tGroup.get(2).rpc.token.mintTokens({ amounts: [`1@${symbolDOGE}`] })).rejects.toThrow('RpcApiError: \'Test MintTokenTx execution failed:\nYou are not a foundation member or token owner and cannot mint this token!\', code: -32600, method: minttokens') }) it('should throw an error if member daily mint limit exceeds', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing2' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing2' + // } + // } + // }) await expect(tGroup.get(2).rpc.token.mintTokens({ amounts: [`6@${symbolBTC}`] })).rejects.toThrow(`RpcApiError: 'Test MintTokenTx execution failed:\nYou will exceed your daily mint limit for ${symbolBTC} token by minting this amount', code: -32600, method: minttokens`) }) it('should throw an error if member maximum mint limit exceeds', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing2' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing2' + // } + // } + // }) await expect(tGroup.get(2).rpc.token.mintTokens({ amounts: [`11@${symbolBTC}`] })).rejects.toThrow(`RpcApiError: 'Test MintTokenTx execution failed:\nYou will exceed your maximum mint limit for ${symbolBTC} token by minting this amount!', code: -32600, method: minttokens`) }) it('should throw an error if global daily mint limit exceeds', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '01': { - id: '01', - name: 'account1BTC', - ownerAddress: account1, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing1' - }, - '03': { - name: 'account3BTC', - ownerAddress: account3, - mintLimitDaily: 5, - mintLimit: 10, - backingId: 'backing3' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '01': { + // id: '01', + // name: 'account1BTC', + // ownerAddress: account1, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing1' + // }, + // '03': { + // name: 'account3BTC', + // ownerAddress: account3, + // mintLimitDaily: 5, + // mintLimit: 10, + // backingId: 'backing3' + // } + // } + // }) // Hit global daily mint limit await tGroup.get(1).rpc.token.mintTokens({ amounts: [`5.0000000@${symbolBTC}`] }) @@ -291,27 +293,27 @@ describe('Consortium', () => { }) it('should throw an error if global mint limit exceeds', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/mint_limit`]: '8', - [`v0/consortium/${idBTC}/members`]: { - '01': { - id: '01', - name: 'account1BTC', - ownerAddress: account1, - mintLimitDaily: 5, - mintLimit: 8, - backingId: 'backing1' - }, - '03': { - name: 'account3BTC', - ownerAddress: account3, - mintLimitDaily: 5, - mintLimit: 8, - backingId: 'backing3' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/mint_limit`]: '8', + // [`v0/consortium/${idBTC}/members`]: { + // '01': { + // id: '01', + // name: 'account1BTC', + // ownerAddress: account1, + // mintLimitDaily: 5, + // mintLimit: 8, + // backingId: 'backing1' + // }, + // '03': { + // name: 'account3BTC', + // ownerAddress: account3, + // mintLimitDaily: 5, + // mintLimit: 8, + // backingId: 'backing3' + // } + // } + // }) // Hit global mint limit await tGroup.get(1).rpc.token.mintTokens({ amounts: [`5.0000000@${symbolBTC}`] }) @@ -322,38 +324,38 @@ describe('Consortium', () => { }) it('should throw an error if tried to mint a token while not being an active member of the consortium', async () => { - await setGovAttr({ - [`v0/consortium/${idDOGE}/mint_limit`]: '10', - [`v0/consortium/${idDOGE}/mint_limit_daily`]: '5', - [`v0/consortium/${idDOGE}/members`]: { - '01': { - name: 'account1DOGE', - ownerAddress: account1, - backingId: 'backing1', - mintLimitDaily: 2.00000000, - mintLimit: 5.00000000, - status: 1 - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idDOGE}/mint_limit`]: '10', + // [`v0/consortium/${idDOGE}/mint_limit_daily`]: '5', + // [`v0/consortium/${idDOGE}/members`]: { + // '01': { + // name: 'account1DOGE', + // ownerAddress: account1, + // backingId: 'backing1', + // mintLimitDaily: 2.00000000, + // mintLimit: 5.00000000, + // status: 1 + // } + // } + // }) await expect(tGroup.get(1).rpc.token.mintTokens({ amounts: [`1@${symbolDOGE}`] })).rejects.toThrow(`Cannot mint token, not an active member of consortium for ${symbolDOGE}!`) }) it('should be able to mint tokens', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimit: 10, - mintLimitDaily: 5, - backingId: 'backing2' - } - } - }) + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimit: 10, + // mintLimitDaily: 5, + // backingId: 'backing2' + // } + // } + // }) const hash = await tGroup.get(2).rpc.token.mintTokens({ amounts: [`1@${symbolBTC}`] }) expect(hash).toBeTruthy() @@ -368,20 +370,20 @@ describe('Consortium', () => { }) it('should be able to mint tokens to address', async () => { - await setGovAttr({ - 'v0/params/feature/mint-tokens-to-address': 'true', - [`v0/consortium/${idBTC}/mint_limit`]: '10', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - [`v0/consortium/${idBTC}/members`]: { - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimit: 10, - mintLimitDaily: 5, - backingId: 'backing2' - } - } - }) + // await setGovAttr({ + // 'v0/params/feature/mint-tokens-to-address': 'true', + // [`v0/consortium/${idBTC}/mint_limit`]: '10', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + // [`v0/consortium/${idBTC}/members`]: { + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimit: 10, + // mintLimitDaily: 5, + // backingId: 'backing2' + // } + // } + // }) const toAddress = await tGroup.get(2).generateAddress() @@ -397,163 +399,163 @@ describe('Consortium', () => { expect(attr[`v0/live/economy/consortium/${idBTC}/supply`]).toStrictEqual(new BigNumber('1')) }) - it('should be able to set unlimited mint limits per member when global mint_limit or mint_limit_daily is set to -1', async () => { - await setGovAttr({ - [`v0/consortium/${idBTC}/mint_limit_daily`]: '-1', - [`v0/consortium/${idBTC}/mint_limit`]: '-1', - [`v0/consortium/${idBTC}/members`]: { - '01': { - id: '01', - name: 'account1BTC', - ownerAddress: account1, - mintLimitDaily: 10000000, - mintLimit: 10000000, - backingId: 'backing1' - }, - '02': { - name: 'account2BTC', - ownerAddress: account2, - mintLimitDaily: 50000000, - mintLimit: 50000000, - backingId: 'backing2' - }, - '03': { - name: 'account3BTC', - ownerAddress: account3, - mintLimitDaily: 50000000, - mintLimit: 50000000, - backingId: 'backing3' - } - } - }) - }) - - it('should return correct governance attribute values', async () => { - await setGovAttr({ - [`v0/consortium/${idDOGE}/mint_limit`]: '100', - [`v0/consortium/${idDOGE}/mint_limit_daily`]: '50', - [`v0/consortium/${idBTC}/mint_limit`]: '20', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '10', - [`v0/consortium/${idBTC}/members`]: { - '01': { - name: 'account1BTC', - ownerAddress: account1, - backingId: 'backing1', - mintLimitDaily: 5.00000000, - mintLimit: 10.00000000 - }, - '02': { - name: 'account2BTC', - ownerAddress: account2, - backingId: 'backing2', - mintLimitDaily: 5.00000000, - mintLimit: 10.00000000 - } - }, - [`v0/consortium/${idDOGE}/members`]: { - '01': { - name: 'account1DOGE', - ownerAddress: account1, - backingId: 'backing1', - mintLimitDaily: 5.00000000, - mintLimit: 10.00000000 - }, - '02': { - name: 'account2DOGE', - ownerAddress: account2, - backingId: 'backing2', - mintLimitDaily: 5.00000000, - mintLimit: 10.00000000 - } - } - }) - - const attr0 = (await tGroup.get(0).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES - expect(attr0[`v0/consortium/${idBTC}/members`]).toStrictEqual({ - '01': { - name: 'account1BTC', - ownerAddress: account1, - backingId: 'backing1', - mintLimit: new BigNumber(10), - mintLimitDaily: new BigNumber(5), - status: new BigNumber(0) - }, - '02': { - name: 'account2BTC', - ownerAddress: account2, - backingId: 'backing2', - mintLimit: new BigNumber(10), - mintLimitDaily: new BigNumber(5), - status: new BigNumber(0) - } - }) - expect(attr0[`v0/consortium/${idBTC}/mint_limit`]).toStrictEqual('20') - expect(attr0[`v0/consortium/${idBTC}/mint_limit_daily`]).toStrictEqual('10') - - expect(attr0[`v0/consortium/${idDOGE}/members`]).toStrictEqual({ - '01': { - name: 'account1DOGE', - ownerAddress: account1, - backingId: 'backing1', - mintLimit: new BigNumber(10), - mintLimitDaily: new BigNumber(5), - status: new BigNumber(0) - }, - '02': { - name: 'account2DOGE', - ownerAddress: account2, - backingId: 'backing2', - mintLimit: new BigNumber(10), - mintLimitDaily: new BigNumber(5), - status: new BigNumber(0) - } - }) - expect(attr0[`v0/consortium/${idDOGE}/mint_limit`]).toStrictEqual('100') - expect(attr0[`v0/consortium/${idDOGE}/mint_limit_daily`]).toStrictEqual('50') - - await tGroup.get(1).rpc.token.mintTokens({ amounts: [`3@${symbolBTC}`] }) - await tGroup.get(1).rpc.token.mintTokens({ amounts: [`4@${symbolDOGE}`] }) - await tGroup.get(1).generate(1) - await tGroup.waitForSync() - - await tGroup.get(2).rpc.token.mintTokens({ amounts: [`1@${symbolBTC}`] }) - await tGroup.get(2).rpc.token.mintTokens({ amounts: [`2@${symbolDOGE}`] }) - await tGroup.get(2).generate(1) - await tGroup.waitForSync() - - expect((await tGroup.get(1).rpc.account.getAccount(account1))).toStrictEqual([ - `3.00000000@${symbolBTC}`, - `4.00000000@${symbolDOGE}` - ]) - - expect((await tGroup.get(2).rpc.account.getAccount(account2))).toStrictEqual([ - `1.00000000@${symbolBTC}`, - `2.00000000@${symbolDOGE}` - ]) - - const attr2 = (await tGroup.get(2).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES - expect(attr2[`v0/live/economy/consortium/${idBTC}/minted`]).toStrictEqual(new BigNumber(4)) - expect(attr2[`v0/live/economy/consortium/${idBTC}/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium/${idBTC}/supply`]).toStrictEqual(new BigNumber(4)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/minted`]).toStrictEqual(new BigNumber(3)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/daily_minted`]).toStrictEqual('0/3.00000000') - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/supply`]).toStrictEqual(new BigNumber(3)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/minted`]).toStrictEqual(new BigNumber(1)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/daily_minted`]).toStrictEqual('0/1.00000000') - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/supply`]).toStrictEqual(new BigNumber(1)) - - expect(attr2[`v0/live/economy/consortium/${idDOGE}/minted`]).toStrictEqual(new BigNumber(6)) - expect(attr2[`v0/live/economy/consortium/${idDOGE}/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium/${idDOGE}/supply`]).toStrictEqual(new BigNumber(6)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/minted`]).toStrictEqual(new BigNumber(4)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/daily_minted`]).toStrictEqual('0/4.00000000') - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/supply`]).toStrictEqual(new BigNumber(4)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/minted`]).toStrictEqual(new BigNumber(2)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/daily_minted`]).toStrictEqual('0/2.00000000') - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/burnt`]).toStrictEqual(new BigNumber(0)) - expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/supply`]).toStrictEqual(new BigNumber(2)) - }) + // it('should be able to set unlimited mint limits per member when global mint_limit or mint_limit_daily is set to -1', async () => { + // await setGovAttr({ + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '-1', + // [`v0/consortium/${idBTC}/mint_limit`]: '-1', + // [`v0/consortium/${idBTC}/members`]: { + // '01': { + // id: '01', + // name: 'account1BTC', + // ownerAddress: account1, + // mintLimitDaily: 10000000, + // mintLimit: 10000000, + // backingId: 'backing1' + // }, + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // mintLimitDaily: 50000000, + // mintLimit: 50000000, + // backingId: 'backing2' + // }, + // '03': { + // name: 'account3BTC', + // ownerAddress: account3, + // mintLimitDaily: 50000000, + // mintLimit: 50000000, + // backingId: 'backing3' + // } + // } + // }) + // }) + + // it('should return correct governance attribute values', async () => { + // await setGovAttr({ + // [`v0/consortium/${idDOGE}/mint_limit`]: '100', + // [`v0/consortium/${idDOGE}/mint_limit_daily`]: '50', + // [`v0/consortium/${idBTC}/mint_limit`]: '20', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '10', + // [`v0/consortium/${idBTC}/members`]: { + // '01': { + // name: 'account1BTC', + // ownerAddress: account1, + // backingId: 'backing1', + // mintLimitDaily: 5.00000000, + // mintLimit: 10.00000000 + // }, + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // backingId: 'backing2', + // mintLimitDaily: 5.00000000, + // mintLimit: 10.00000000 + // } + // }, + // [`v0/consortium/${idDOGE}/members`]: { + // '01': { + // name: 'account1DOGE', + // ownerAddress: account1, + // backingId: 'backing1', + // mintLimitDaily: 5.00000000, + // mintLimit: 10.00000000 + // }, + // '02': { + // name: 'account2DOGE', + // ownerAddress: account2, + // backingId: 'backing2', + // mintLimitDaily: 5.00000000, + // mintLimit: 10.00000000 + // } + // } + // }) + + // const attr0 = (await tGroup.get(0).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES + // expect(attr0[`v0/consortium/${idBTC}/members`]).toStrictEqual({ + // '01': { + // name: 'account1BTC', + // ownerAddress: account1, + // backingId: 'backing1', + // mintLimit: new BigNumber(10), + // mintLimitDaily: new BigNumber(5), + // status: new BigNumber(0) + // }, + // '02': { + // name: 'account2BTC', + // ownerAddress: account2, + // backingId: 'backing2', + // mintLimit: new BigNumber(10), + // mintLimitDaily: new BigNumber(5), + // status: new BigNumber(0) + // } + // }) + // expect(attr0[`v0/consortium/${idBTC}/mint_limit`]).toStrictEqual('20') + // expect(attr0[`v0/consortium/${idBTC}/mint_limit_daily`]).toStrictEqual('10') + + // expect(attr0[`v0/consortium/${idDOGE}/members`]).toStrictEqual({ + // '01': { + // name: 'account1DOGE', + // ownerAddress: account1, + // backingId: 'backing1', + // mintLimit: new BigNumber(10), + // mintLimitDaily: new BigNumber(5), + // status: new BigNumber(0) + // }, + // '02': { + // name: 'account2DOGE', + // ownerAddress: account2, + // backingId: 'backing2', + // mintLimit: new BigNumber(10), + // mintLimitDaily: new BigNumber(5), + // status: new BigNumber(0) + // } + // }) + // expect(attr0[`v0/consortium/${idDOGE}/mint_limit`]).toStrictEqual('100') + // expect(attr0[`v0/consortium/${idDOGE}/mint_limit_daily`]).toStrictEqual('50') + + // await tGroup.get(1).rpc.token.mintTokens({ amounts: [`3@${symbolBTC}`] }) + // await tGroup.get(1).rpc.token.mintTokens({ amounts: [`4@${symbolDOGE}`] }) + // await tGroup.get(1).generate(1) + // await tGroup.waitForSync() + + // await tGroup.get(2).rpc.token.mintTokens({ amounts: [`1@${symbolBTC}`] }) + // await tGroup.get(2).rpc.token.mintTokens({ amounts: [`2@${symbolDOGE}`] }) + // await tGroup.get(2).generate(1) + // await tGroup.waitForSync() + + // expect((await tGroup.get(1).rpc.account.getAccount(account1))).toStrictEqual([ + // `3.00000000@${symbolBTC}`, + // `4.00000000@${symbolDOGE}` + // ]) + + // expect((await tGroup.get(2).rpc.account.getAccount(account2))).toStrictEqual([ + // `1.00000000@${symbolBTC}`, + // `2.00000000@${symbolDOGE}` + // ]) + + // const attr2 = (await tGroup.get(2).rpc.masternode.getGov('ATTRIBUTES')).ATTRIBUTES + // expect(attr2[`v0/live/economy/consortium/${idBTC}/minted`]).toStrictEqual(new BigNumber(4)) + // expect(attr2[`v0/live/economy/consortium/${idBTC}/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium/${idBTC}/supply`]).toStrictEqual(new BigNumber(4)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/minted`]).toStrictEqual(new BigNumber(3)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/daily_minted`]).toStrictEqual('0/3.00000000') + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/01/supply`]).toStrictEqual(new BigNumber(3)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/minted`]).toStrictEqual(new BigNumber(1)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/daily_minted`]).toStrictEqual('0/1.00000000') + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium_members/${idBTC}/02/supply`]).toStrictEqual(new BigNumber(1)) + + // expect(attr2[`v0/live/economy/consortium/${idDOGE}/minted`]).toStrictEqual(new BigNumber(6)) + // expect(attr2[`v0/live/economy/consortium/${idDOGE}/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium/${idDOGE}/supply`]).toStrictEqual(new BigNumber(6)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/minted`]).toStrictEqual(new BigNumber(4)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/daily_minted`]).toStrictEqual('0/4.00000000') + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/01/supply`]).toStrictEqual(new BigNumber(4)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/minted`]).toStrictEqual(new BigNumber(2)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/daily_minted`]).toStrictEqual('0/2.00000000') + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/burnt`]).toStrictEqual(new BigNumber(0)) + // expect(attr2[`v0/live/economy/consortium_members/${idDOGE}/02/supply`]).toStrictEqual(new BigNumber(2)) + // }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_future_swap.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_future_swap.test.ts index 9364070b4a..55584e782e 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_future_swap.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_future_swap.test.ts @@ -915,7 +915,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 not currently active (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 not currently active\', code: -26') }) it('should refund the futureswap if DFIP2203 is disabled before execution', async () => { @@ -1009,7 +1009,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero\', code: -26') } { // negative source amount is given @@ -1035,7 +1035,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero\', code: -26') } { // invalid source dtoken 100 @@ -1049,7 +1049,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 100 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 100\', code: -26') } { // non loan source token 1(BTC) @@ -1063,7 +1063,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 1 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 1\', code: -26') } { // destination is given when futureswap dtoken to dusd @@ -1077,7 +1077,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Destination should not be set when source amount is dToken or DFI (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Destination should not be set when source amount is dToken or DFI\', code: -26') } { // INVALID destination 100 is given when futureswap dusd to dtoken @@ -1091,7 +1091,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get destination loan token 100. Set valid destination. (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get destination loan token 100. Set valid destination.\', code: -26') } { // arbitrary address without enough balance @@ -1106,7 +1106,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner\', code: -26') } }) @@ -1135,7 +1135,7 @@ describe('create futureswap', () => { // Ensure the created txn is correct const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 currently disabled for token 2 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 currently disabled for token 2\', code: -26') }) it('should not create DFI-to-DUSD futureswap while dfip2206f is not active', async () => { @@ -1154,7 +1154,7 @@ describe('create futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2206F not currently active (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2206F not currently active\', code: -26') }) }) @@ -1883,7 +1883,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 1.00000000 is less than 1.00000001 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 1.00000000 is less than 1.00000001\', code: -26') } // Withdraw fail - Destination should not be set when source amount is dToken or DFI @@ -1898,7 +1898,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Destination should not be set when source amount is dToken or DFI (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Destination should not be set when source amount is dToken or DFI\', code: -26') } // Withdraw fail - try to withdraw from unavailable futureswap @@ -1913,7 +1913,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 0.00000000 is less than 0.50000000 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 0.00000000 is less than 0.50000000\', code: -26') } // Withdraw fail - Invalid source token: 10 @@ -1928,7 +1928,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 10 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 10\', code: -26') } // withdraw with BTC(1) which is not a loan token @@ -1943,7 +1943,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 1 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Could not get source loan token 1\', code: -26') } // withdraw from arbitrary address @@ -1958,7 +1958,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner\', code: -26') } // withdraw from arbitrary valid address @@ -1973,7 +1973,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Transaction must have at least one input from owner\', code: -26') } // withdraw 0 amount @@ -1988,7 +1988,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero\', code: -26') } // withdraw -1 amount @@ -2016,7 +2016,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: Source amount must be more than zero\', code: -26') } // withdraw after setting ${idTSLA}/dfip2203 to false @@ -2034,7 +2034,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 currently disabled for token 2 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 currently disabled for token 2\', code: -26') await testing.rpc.masternode.setGov({ [attributeKey]: { [`v0/token/${idTSLA}/dfip2203`]: 'true' } }) } @@ -2053,7 +2053,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 not currently active (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: DFIP2203 not currently active\', code: -26') await testing.rpc.masternode.setGov({ [attributeKey]: { 'v0/params/dfip2203/active': 'true' } }) } @@ -2098,7 +2098,7 @@ describe('withdraw futureswap', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 0.00000000 is less than 1.00000000 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DFIP2203Tx: amount 0.00000000 is less than 1.00000000\', code: -26') } }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_transfer_domain.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_transfer_domain.test.ts index 0971581f6f..4615ac8efd 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_transfer_domain.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_account_transfer_domain.test.ts @@ -180,7 +180,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Cannot transfer inside same domain (code 16)') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Cannot transfer inside same domain') }) it('should fail if amount is different', async () => { @@ -247,7 +247,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Source amount must be equal to destination amount (code 16)') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Source amount must be equal to destination amount') }) it('(dvm -> evm) should fail if source address and source domain are not match', async () => { @@ -314,7 +314,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Src address must be a legacy or Bech32 address in case of "DVM" domain (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Src address must be a legacy or Bech32 address in case of "DVM" domain\', code: -26') }) it('(evm -> dvm) should fail if source address and source domain are not match', async () => { @@ -381,7 +381,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Src address must be an ERC55 address in case of "EVM" domain (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Src address must be an ERC55 address in case of "EVM" domain\', code: -26') }) it('(dvm -> evm) should fail if destination address and destination domain are not match', async () => { @@ -448,7 +448,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Dst address must be an ERC55 address in case of "EVM" domain (code 16)') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Dst address must be an ERC55 address in case of "EVM" domain') }) it('(evm -> dvm) should fail if destination address and destination domain are not match', async () => { @@ -515,7 +515,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Dst address must be a legacy or Bech32 address in case of "DVM" domain (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: Dst address must be a legacy or Bech32 address in case of "DVM" domain\', code: -26') }) it('(dvm -> evm) should fail if address is not owned', async () => { @@ -584,7 +584,7 @@ describe('transferDomain', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: tx must have at least one input from account owner (code 16)') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TransferDomainTx: tx must have at least one input from account owner') }) it('should not transfer if custom (isDAT = false) token is transferred', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_claim_dfc_htlc.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_claim_dfc_htlc.test.ts index 34a799b80e..96a76d3e41 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_claim_dfc_htlc.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_claim_dfc_htlc.test.ts @@ -219,6 +219,6 @@ describe('claim DFC HTLC', () => { seed: 'INVALID_SEED' } const txn = await builder.icxorderbook.claimDFCHTLC(claimDFCHTLC, script) - await expect(sendTransaction(testing.container, txn)).rejects.toThrow('DeFiDRpcError: \'ICXClaimDFCHTLCTx: hash generated from given seed is different than in dfc htlc: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - 957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220! (code 16)\', code: -26') + await expect(sendTransaction(testing.container, txn)).rejects.toThrow('DeFiDRpcError: \'ICXClaimDFCHTLCTx: hash generated from given seed is different than in dfc htlc: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - 957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220!\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createcfp.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createcfp.test.ts index 3ff1f19dce..344d26b3d8 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createcfp.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createcfp.test.ts @@ -150,7 +150,7 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal title must not be empty (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal title must not be empty', code: -26") }) it('should reject with invalid title length', async () => { @@ -169,7 +169,7 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal title cannot be more than 128 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal title cannot be more than 128 bytes', code: -26") }) it('should reject with empty context', async () => { @@ -188,7 +188,7 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context must not be empty (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context must not be empty', code: -26") }) it('should reject with invalid context length', async () => { @@ -207,7 +207,7 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context cannot be more than 512 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context cannot be more than 512 bytes', code: -26") }) it('should reject with invalid context hash length', async () => { @@ -226,7 +226,7 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context hash cannot be more than 512 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal context hash cannot be more than 512 bytes', code: -26") }) it('should reject if proposal wants to gain all money (amount exceeds 1.2B DFI)', async () => { @@ -246,6 +246,6 @@ describe('createCfp', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal wants to gain all money (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateCfpTx: proposal wants to gain all money', code: -26") }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createvoc.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createvoc.test.ts index d9346edf98..2769493023 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createvoc.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_createvoc.test.ts @@ -183,7 +183,7 @@ describe('createVoc', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal title must not be empty (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal title must not be empty', code: -26") }) it('should reject with invalid title length', async () => { @@ -203,7 +203,7 @@ describe('createVoc', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal title cannot be more than 128 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal title cannot be more than 128 bytes', code: -26") }) it('should reject with empty context', async () => { @@ -223,7 +223,7 @@ describe('createVoc', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context must not be empty (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context must not be empty', code: -26") }) it('should reject with invalid context length', async () => { @@ -243,7 +243,7 @@ describe('createVoc', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context cannot be more than 512 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context cannot be more than 512 bytes', code: -26") }) it('should reject with invalid context hash length', async () => { @@ -263,6 +263,6 @@ describe('createVoc', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context hash cannot be more than 512 bytes (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'CreateVocTx: proposal context hash cannot be more than 512 bytes', code: -26") }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_vote.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_vote.test.ts index 3bd434d97c..1874d456b3 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_vote.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_governance_vote.test.ts @@ -116,7 +116,7 @@ describe('vote', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: masternode <${invalidMasternodeId}> does not exist (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: masternode <${invalidMasternodeId}> does not exist', code: -26`) }) it('should not vote on a proposal that does not exist', async () => { @@ -146,7 +146,7 @@ describe('vote', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: proposal <${proposalId}> does not exist (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: proposal <${proposalId}> does not exist', code: -26`) }) it('should not vote on a proposal with a masternode that did not mint at least one block', async () => { @@ -175,7 +175,7 @@ describe('vote', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: masternode <${masternodeId}> does not mine at least one block (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: masternode <${masternodeId}> does not mine at least one block', code: -26`) }) it('should not vote on a proposal not in voting period', async () => { @@ -207,7 +207,7 @@ describe('vote', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: proposal <${proposalId}> is not in voting period (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'VoteTx: proposal <${proposalId}> is not in voting period', code: -26`) }) }) @@ -273,6 +273,6 @@ describe('vote with masternode operator with legacy address', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'VoteTx: tx must have at least one input from the owner (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'VoteTx: tx must have at least one input from the owner', code: -26") }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_offer.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_offer.test.ts index 4a3e479726..ab6ae7b99e 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_offer.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_offer.test.ts @@ -101,7 +101,7 @@ describe('close ICX offer', () => { } const txn = await builder.icxorderbook.closeOffer(closeOffer, script) - await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOfferTx: offer with creation tx 0000000000000000000000000000000000000000000000000000000000000000 does not exists! (code 16)', code: -26") + await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOfferTx: offer with creation tx 0000000000000000000000000000000000000000000000000000000000000000 does not exists!', code: -26") }) it('should not close ICX order with input not from offer owner', async () => { @@ -120,6 +120,6 @@ describe('close ICX offer', () => { const txn = await newBuilder.icxorderbook.closeOffer({ offerTx }, newAddressScript) - await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOfferTx: tx must have at least one input from offer owner (code 16)', code: -26") + await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOfferTx: tx must have at least one input from offer owner', code: -26") }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_order.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_order.test.ts index 938d343550..21321dde6e 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_order.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_icx_close_order.test.ts @@ -100,7 +100,7 @@ describe('close ICX order', () => { } const txn = await builder.icxorderbook.closeOrder(closeOrder, script) - await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOrderTx: order with creation tx 0000000000000000000000000000000000000000000000000000000000000000 does not exists! (code 16)', code: -26") + await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOrderTx: order with creation tx 0000000000000000000000000000000000000000000000000000000000000000 does not exists!', code: -26") }) it('should not close ICX order with input not from order owner', async () => { @@ -118,6 +118,6 @@ describe('close ICX order', () => { const txn = await newBuilder.icxorderbook.closeOrder({ orderTx }, newAddressScript) - await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOrderTx: tx must have at least one input from order owner (code 16)', code: -26") + await expect(sendTransaction(testing.container, txn)).rejects.toThrow("DeFiDRpcError: 'ICXCloseOrderTx: tx must have at least one input from order owner', code: -26") }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_close_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_close_vault.test.ts index 1fb65cd27c..9a156a2c87 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_close_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_close_vault.test.ts @@ -303,7 +303,7 @@ describe('loans.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${'0'.repeat(64)}> not found (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${'0'.repeat(64)}> not found', code: -26`) }) it('should not closeVault for vault with loan taken', async () => { @@ -314,7 +314,7 @@ describe('loans.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLoanTakenId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLoanTakenId}> has loans', code: -26`) }) it('should not closeVault for mayliquidate vault', async () => { @@ -333,7 +333,7 @@ describe('loans.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans', code: -26`) await tGroup.get(0).rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), { prices: [{ tokenAmount: '2@TSLA', currency: 'USD' }] }) await tGroup.get(0).generate(1) @@ -357,7 +357,7 @@ describe('loans.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans', code: -26`) await tGroup.get(0).container.waitForPriceValid('TSLA/USD') @@ -385,7 +385,7 @@ describe('loans.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: Cannot close vault under liquidation (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: Cannot close vault under liquidation\', code: -26') await tGroup.get(0).rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), { prices: [{ tokenAmount: '2@TSLA', currency: 'USD' }] }) await tGroup.get(0).generate(1) @@ -405,6 +405,6 @@ describe('loans.closeVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: tx must have at least one input from token owner\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_create_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_create_vault.test.ts index 121df77c69..b24e1e5f0e 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_create_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_create_vault.test.ts @@ -251,7 +251,7 @@ describe('loans.createVault', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('VaultTx: Cannot find existing loan scheme with id scheme3 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('VaultTx: Cannot find existing loan scheme with id scheme3\', code: -26') }) it('should not createVault with scheme set to be destroyed', async () => { @@ -275,7 +275,7 @@ describe('loans.createVault', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('VaultTx: Cannot set scheme4 as loan scheme, set to be destroyed on block 150 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('VaultTx: Cannot set scheme4 as loan scheme, set to be destroyed on block 150\', code: -26') }) }) @@ -314,6 +314,6 @@ describe('loans.createVault when no default scheme and the given schemeId is emp const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'VaultTx: There is no default loan scheme (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'VaultTx: There is no default loan scheme\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_deposit_to_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_deposit_to_vault.test.ts index 0527e25457..6f39e72f1c 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_deposit_to_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_deposit_to_vault.test.ts @@ -316,7 +316,7 @@ describe('loans.depositToVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DepositToVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DepositToVaultTx: tx must have at least one input from token owner\', code: -26') }) it('should be failed as vault is not exists', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_destroy_loan_scheme.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_destroy_loan_scheme.test.ts index b9d0a94b9f..51df686bf4 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_destroy_loan_scheme.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_destroy_loan_scheme.test.ts @@ -96,7 +96,7 @@ describe('loan.destroyLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not destroyLoanScheme if identifier is an empty string', async () => { @@ -108,7 +108,7 @@ describe('loan.destroyLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not destroyLoanScheme if identifier does not exists', async () => { @@ -120,7 +120,7 @@ describe('loan.destroyLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: Cannot find existing loan scheme with id scheme2 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DestroyLoanSchemeTx: Cannot find existing loan scheme with id scheme2\', code: -26') }) it('should not destroyLoanScheme if identifier is a default scheme', async () => { @@ -132,7 +132,7 @@ describe('loan.destroyLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DestroyLoanSchemeTx: Cannot destroy default loan scheme, set new default first (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DestroyLoanSchemeTx: Cannot destroy default loan scheme, set new default first\', code: -26') }) }) @@ -239,6 +239,6 @@ describe('loan.destroyLoanScheme() with height less than current height', () => const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'DestroyLoanSchemeTx: Destruction height below current block height, set future height (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'DestroyLoanSchemeTx: Destruction height below current block height, set future height\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts index 65c419c1da..7f36094362 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_payback_loan.test.ts @@ -864,7 +864,7 @@ describe('paybackLoan failed #2', () => { const promise = sendTransaction(bob.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: amount 0.00000000 is less than 0.00006850 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: amount 0.00000000 is less than 0.00006850\', code: -26') }) }) @@ -2110,7 +2110,7 @@ describe('paybackLoan for any token', () => { }, script) let promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active\', code: -26') await testing.rpc.masternode.setGov({ [attributeKey]: { [key]: 'false' } }) await testing.container.generate(1) @@ -2129,7 +2129,7 @@ describe('paybackLoan for any token', () => { }, script) promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active\', code: -26') }) it('should not be able to payback TSLA loan using DFI when the governance is set to payback DUSD using DFI', async () => { @@ -2155,7 +2155,7 @@ describe('paybackLoan for any token', () => { }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (DUSD) in this vault! (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (DUSD) in this vault!\', code: -26') }) it('should not be able to payback DUSD loan using other tokens', async () => { @@ -2173,7 +2173,7 @@ describe('paybackLoan for any token', () => { }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (TSLA) in this vault! (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (TSLA) in this vault!\', code: -26') }) it('should not be able to payback TSLA loan using DFI - without PaybackLoanMetadataV2', async () => { @@ -2207,7 +2207,7 @@ describe('paybackLoan for any token', () => { }, script) const payBackPromise = sendTransaction(testing.container, txn) - await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active (code 16)\', code: -26') + await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Payback of loan via DFI token is not currently active\', code: -26') }) it('should not be able to payback TSLA loan using BTC - without PaybackLoanMetadataV2', async () => { @@ -2265,7 +2265,7 @@ describe('paybackLoan for any token', () => { }, script) const payBackPromise = sendTransaction(testing.container, txn) - await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Loan token with id (3) does not exist! (code 16)\', code: -26') + await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: Loan token with id (3) does not exist!\', code: -26') }) it('should not be able to payback DUSD loan using TSLA - without PaybackLoanMetadataV2', async () => { @@ -2296,6 +2296,6 @@ describe('paybackLoan for any token', () => { }, script) const payBackPromise = sendTransaction(testing.container, txn) - await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (TSLA) in this vault! (code 16)\', code: -26') + await expect(payBackPromise).rejects.toThrow('DeFiDRpcError: \'PaybackLoanTx: There is no loan on token (TSLA) in this vault!\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_collateral_token.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_collateral_token.test.ts index 1230b8a4d8..084a140862 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_collateral_token.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_collateral_token.test.ts @@ -88,7 +88,7 @@ describe('loan.setCollateralToken()', () => { activateAfterBlock: 0 }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanCollateralTokenTx: No such token (2) (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanCollateralTokenTx: No such token (2)\', code: -26') }) it('should setCollateralToken if factor is greater than 1', async () => { @@ -115,6 +115,6 @@ describe('loan.setCollateralToken()', () => { activateAfterBlock: 0 }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanCollateralTokenTx: Price feed MFST/USD does not belong to any oracle (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanCollateralTokenTx: Price feed MFST/USD does not belong to any oracle\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_default_loan_scheme.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_default_loan_scheme.test.ts index 45bf01b609..7d0bc7f374 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_default_loan_scheme.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_default_loan_scheme.test.ts @@ -87,7 +87,7 @@ describe('loan.setDefaultLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not setDefaultLoanScheme if identifier is more than 8 chars long', async () => { @@ -98,7 +98,7 @@ describe('loan.setDefaultLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not setDefaultLoanScheme if identifier does not exists', async () => { @@ -109,7 +109,7 @@ describe('loan.setDefaultLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Cannot find existing loan scheme with id scheme3 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Cannot find existing loan scheme with id scheme3\', code: -26') }) it('should not setDefaultLoanScheme if the identifier is a default scheme', async () => { @@ -120,7 +120,7 @@ describe('loan.setDefaultLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Loan scheme with id scheme1 is already set as default (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Loan scheme with id scheme1 is already set as default\', code: -26') }) it('should not setDefaultLoanScheme if the scheme is going to be deleted at future block', async () => { @@ -143,7 +143,7 @@ describe('loan.setDefaultLoanScheme()', () => { const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Cannot set scheme3 as default, set to destroyed on block 120 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DefaultLoanSchemeTx: Cannot set scheme3 as default, set to destroyed on block 120\', code: -26') // Delete at block 120 await testing.container.waitForBlockHeight(120) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_scheme.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_scheme.test.ts index a12e1b81e8..a2b870cd74 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_scheme.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_scheme.test.ts @@ -90,7 +90,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: minimum collateral ratio cannot be less than 100 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: minimum collateral ratio cannot be less than 100\', code: -26') }) it('should not createLoanScheme if rate is less than 0.01', async () => { @@ -104,7 +104,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: interest rate cannot be less than 0.01 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: interest rate cannot be less than 0.01\', code: -26') }) it('should not createLoanScheme if same ratio and rate were created before', async () => { @@ -118,7 +118,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme default with same interestrate and mincolratio already exists (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme default with same interestrate and mincolratio already exists\', code: -26') }) it('should not createLoanScheme if same identifier was created before', async () => { @@ -132,7 +132,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme already exist with id default (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme already exist with id default\', code: -26') }) it('should not createLoanScheme if identifier is an empty string', async () => { @@ -146,7 +146,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not createLoanScheme if identifier is more than 8 chars long', async () => { @@ -160,7 +160,7 @@ describe('loan.createLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) }) @@ -254,7 +254,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: minimum collateral ratio cannot be less than 100 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: minimum collateral ratio cannot be less than 100\', code: -26') }) it('should not updateLoanScheme if rate is less than 0.01', async () => { @@ -268,7 +268,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: interest rate cannot be less than 0.01 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: interest rate cannot be less than 0.01\', code: -26') }) it('should not updateLoanScheme if same ratio and rate were created before', async () => { @@ -282,7 +282,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) // Failed because its ratio and rate are same as default await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme default with same interestrate and mincolratio already exists (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme default with same interestrate and mincolratio already exists\', code: -26') }) it('should not updateLoanScheme if identifier does not exist', async () => { @@ -296,7 +296,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Cannot find existing loan scheme with id scheme2 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Cannot find existing loan scheme with id scheme2\', code: -26') }) it('should not updateLoanScheme if identifier is an empty string', async () => { @@ -310,7 +310,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) it('should not updateLoanScheme if identifier is more than 8 chars long', async () => { @@ -324,7 +324,7 @@ describe('loan.updateLoanScheme()', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: id cannot be empty or more than 8 chars long\', code: -26') }) }) @@ -447,7 +447,7 @@ describe('loan.updateLoanScheme() with update less than current height', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Update height below current block height, set future height (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Update height below current block height, set future height\', code: -26') }) }) @@ -496,6 +496,6 @@ describe('loan.updateLoanScheme() if a pending loan scheme exists with same rate // Attempt to update same ratio and rate as the pending scheme const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme scheme1 with same interestrate and mincolratio already exists (code 16)\', code: -26') + await expect(promise).rejects.toThrow('LoanSchemeTx: Loan scheme scheme1 with same interestrate and mincolratio already exists\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_token.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_token.test.ts index 70fc9ab7ee..f521ba950a 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_token.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_set_loan_token.test.ts @@ -146,7 +146,7 @@ describe('loan.setLoanToken()', () => { }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('SetLoanTokenTx: Invalid token symbol. Valid: Start with an alphabet, non-empty, not contain # or / (code 16)\', code: -26') + await expect(promise).rejects.toThrow('SetLoanTokenTx: Invalid token symbol. Valid: Start with an alphabet, non-empty, not contain # or /\', code: -26') }) it('should not setLoanToken if the symbol is used in other token', async () => { @@ -180,7 +180,7 @@ describe('loan.setLoanToken()', () => { }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanTokenTx: token \'Token3\' already exists! (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanTokenTx: token \'Token3\' already exists!\', code: -26') }) it('should not setLoanToken if currencyPair does not belong to any oracle', async () => { @@ -194,7 +194,7 @@ describe('loan.setLoanToken()', () => { }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanTokenTx: Price feed MFST/USD does not belong to any oracle (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'SetLoanTokenTx: Price feed MFST/USD does not belong to any oracle\', code: -26') }) it('should setLoanToken with the given name', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_take_loan.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_take_loan.test.ts index 486c5eff65..a9639861ee 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_take_loan.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_take_loan.test.ts @@ -620,7 +620,7 @@ describe('loans.takeLoan failed', () => { const promise = sendTransaction(bob.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') { // revert DFI value changes @@ -1151,7 +1151,7 @@ describe('takeLoan with 50% DUSD or DFI collaterals', () => { // Ensure the created txn is correct const outs = sendTransaction(bob.container, txn) await expect(outs).rejects.toThrow(DeFiDRpcError) - await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) it('should not takeLoan with DUSD sole collateral before reaching fort canning road height', async () => { @@ -1190,7 +1190,7 @@ describe('takeLoan with 50% DUSD or DFI collaterals', () => { // Ensure the created txn is correct const outs = sendTransaction(bob.container, txn) await expect(outs).rejects.toThrow(DeFiDRpcError) - await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) it('should not takeLoan with 25% DFI + 25% DUSD collateral before reaching fort canning road height', async () => { @@ -1226,7 +1226,7 @@ describe('takeLoan with 50% DUSD or DFI collaterals', () => { // Ensure the created txn is correct const outs = sendTransaction(bob.container, txn) await expect(outs).rejects.toThrow(DeFiDRpcError) - await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) it('should not takeLoan with 33.33% DUSD collateral', async () => { @@ -1266,7 +1266,7 @@ describe('takeLoan with 50% DUSD or DFI collaterals', () => { // Ensure the created txn is correct const outs = sendTransaction(bob.container, txn) await expect(outs).rejects.toThrow(DeFiDRpcError) - await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) it('should not takeLoan with 24.9975% DFI + 24.9975% DUSD of minimum required collateral', async () => { @@ -1301,6 +1301,6 @@ describe('takeLoan with 50% DUSD or DFI collaterals', () => { // Ensure the created txn is correct const outs = sendTransaction(bob.container, txn) await expect(outs).rejects.toThrow(DeFiDRpcError) - await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(outs).rejects.toThrow('DeFiDRpcError: \'TakeLoanTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_loan_token.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_loan_token.test.ts index 92022217ad..9d20c28e5a 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_loan_token.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_loan_token.test.ts @@ -188,7 +188,7 @@ describe('loan.updateLoanToken()', () => { tokenTx: loanTokenId }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Invalid token symbol. Valid: Start with an alphabet, non-empty, not contain # or / (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Invalid token symbol. Valid: Start with an alphabet, non-empty, not contain # or /\', code: -26') }) it('should not updateLoanToken if the symbol is used in other token', async () => { @@ -224,7 +224,7 @@ describe('loan.updateLoanToken()', () => { tokenTx: loanTokenId }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: token with key \'Token1\' already exists! (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: token with key \'Token1\' already exists!\', code: -26') }) it('should updateLoanToken if name is more than 128 letters', async () => { @@ -294,7 +294,7 @@ describe('loan.updateLoanToken()', () => { tokenTx: loanTokenId }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Price feed MFST/USD does not belong to any oracle (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Price feed MFST/USD does not belong to any oracle\', code: -26') }) it('should not updateLoanToken if tokenTx does not exist', async () => { @@ -308,6 +308,6 @@ describe('loan.updateLoanToken()', () => { tokenTx: 'd6e157b66957dda2297947e31ac2a1d0c92eae515f35bc1ebad9478d06efa3c0' }, script) const promise = sendTransaction(testing.container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Loan token (d6e157b66957dda2297947e31ac2a1d0c92eae515f35bc1ebad9478d06efa3c0) does not exist! (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateLoanTokenTx: Loan token (d6e157b66957dda2297947e31ac2a1d0c92eae515f35bc1ebad9478d06efa3c0) does not exist!\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_vault.test.ts index 5893c91e20..391c3693ea 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_update_vault.test.ts @@ -225,7 +225,7 @@ describe('loans updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Cannot update vault while any of the asset\'s price is invalid (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Cannot update vault while any of the asset\'s price is invalid\', code: -26') await alice.container.waitForPriceValid('DFI/USD') @@ -273,7 +273,7 @@ describe('loans updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Vault does not have enough collateralization ratio defined by loan scheme - 147 < 150 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Vault does not have enough collateralization ratio defined by loan scheme - 147 < 150\', code: -26') }) it('should not updateVault as different auth address', async () => { @@ -297,6 +297,6 @@ describe('loans updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: tx must have at least one input from token owner\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_withdraw_from_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_withdraw_from_vault.test.ts index a0476eaf71..d45d02b476 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_withdraw_from_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_loan_withdraw_from_vault.test.ts @@ -332,7 +332,7 @@ describe('loans.withdrawFromVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'WithdrawFromVaultTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'WithdrawFromVaultTx: At least 50% of the minimum required collateral must be in DFI or DUSD\', code: -26') }) it('should not withdraw from liquidated vault', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_create.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_create.test.ts index f8261b3713..5e762afc13 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_create.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_create.test.ts @@ -175,7 +175,7 @@ describe('CreateMasternode', () => { try { await sendTransaction(container, txn) } catch (err) { - expect(err.message).toStrictEqual('DeFiDRpcError: \'CreateMasternodeTx: malformed tx vouts (wrong creation fee or collateral amount) (code 16)\', code: -26') + expect(err.message).toStrictEqual('DeFiDRpcError: \'CreateMasternodeTx: malformed tx vouts (wrong creation fee or collateral amount)\', code: -26') } }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_update.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_update.test.ts index da1fc16141..529d874484 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_update.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_masternode_update.test.ts @@ -558,7 +558,7 @@ describe('UpdateMasternode', () => { }) const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Owner address must be P2PKH or P2WPKH type (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Owner address must be P2PKH or P2WPKH type', code: -26") } { const address = await container.getNewAddress('', 'p2sh-segwit') @@ -572,7 +572,7 @@ describe('UpdateMasternode', () => { const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Operator address must be P2PKH or P2WPKH type (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Operator address must be P2PKH or P2WPKH type', code: -26") } // Updated: P2SH is allowed - https://github.com/DeFiCh/ain/pull/1664 // { @@ -587,7 +587,7 @@ describe('UpdateMasternode', () => { // const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) // const promise = sendTransaction(container, txn) // await expect(promise).rejects.toThrow(DeFiDRpcError) - // await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Reward address must be P2PKH or P2WPKH type (code 16)', code: -26") + // await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Reward address must be P2PKH or P2WPKH type', code: -26") // } }) @@ -609,7 +609,7 @@ describe('UpdateMasternode', () => { const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'bad-txns-customtx, UpdateMasternodeTx: Operator address must be P2PKH or P2WPKH type (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateMasternodeTx: Operator address must be P2PKH or P2WPKH type\', code: -26') } // NOTE(canonbrother): panic as raw address is not verified on ain @@ -622,7 +622,7 @@ describe('UpdateMasternode', () => { // const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) // const promise = sendTransaction(container, txn) // await expect(promise).rejects.toThrow(DeFiDRpcError) - // await expect(promise).rejects.toThrow('DeFiDRpcError: \'bad-txns-customtx, UpdateMasternodeTx: Reward address must be P2SH, P2PKH or P2WPKH type (code 16)\', code: -26') + // await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateMasternodeTx: Reward address must be P2SH, P2PKH or P2WPKH type\', code: -26') // } }) @@ -652,7 +652,7 @@ describe('UpdateMasternode', () => { const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Missing previous collateral from transaction inputs (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Missing previous collateral from transaction inputs', code: -26") }) it('should fail to update owner address with same address', async () => { @@ -686,7 +686,7 @@ describe('UpdateMasternode', () => { const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Masternode with collateral address as operator or owner already exists (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Masternode with collateral address as operator or owner already exists', code: -26") }) it('should fail to update another node with operator address that is already used', async () => { @@ -720,7 +720,7 @@ describe('UpdateMasternode', () => { const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Masternode with that operator address already exists (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'UpdateMasternodeTx: Masternode with that operator address already exists', code: -26") }) it('should not update masternode while in PRE_ENABLED or TRANSFERRING state', async () => { @@ -756,7 +756,7 @@ describe('UpdateMasternode', () => { const txn: TransactionSegWit = await builder.masternode.update(updateMasternode, script) const promise = sendTransaction(container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'bad-txns-customtx, UpdateMasternodeTx: Masternode ${masternodeId} is not in 'ENABLED' state (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'UpdateMasternodeTx: Masternode ${masternodeId} is not in 'ENABLED' state', code: -26`) } await container.generate(20) @@ -997,6 +997,6 @@ describe('Update Masternode (Multi-containers)', () => { const promise = sendTransaction(node[1].container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'bad-txns-customtx, UpdateMasternodeTx: tx must have at least one input from the owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateMasternodeTx: tx must have at least one input from the owner\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_burn_token.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_burn_token.test.ts index 3c6e3ac572..7ba09d9047 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_burn_token.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_burn_token.test.ts @@ -22,28 +22,28 @@ let wavesConsortiumAddress: string let idBTC: string async function setupGovs (): Promise { - await testing.rpc.masternode.setGov({ - [attributeKey]: - { - // Enable consortium - 'v0/params/feature/consortium': 'true', - - // Set a consortium global limit for dBTC - [`v0/consortium/${idBTC}/mint_limit`]: '50', - [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', - - // Set a consortium member for dBTC - [`v0/consortium/${idBTC}/members`]: { - '01': { - name: 'Waves HQ', - ownerAddress: wavesConsortiumAddress, - backingId: 'backing_address_btc_1_c', - mintLimitDaily: '5.00000000', - mintLimit: '50.00000000' - } - } - } - }) + // await testing.rpc.masternode.setGov({ + // [attributeKey]: + // { + // // Enable consortium + // 'v0/params/feature/consortium': 'true', + + // // Set a consortium global limit for dBTC + // [`v0/consortium/${idBTC}/mint_limit`]: '50', + // [`v0/consortium/${idBTC}/mint_limit_daily`]: '5', + + // // Set a consortium member for dBTC + // [`v0/consortium/${idBTC}/members`]: { + // '01': { + // name: 'Waves HQ', + // ownerAddress: wavesConsortiumAddress, + // backingId: 'backing_address_btc_1_c', + // mintLimitDaily: '5.00000000', + // mintLimit: '50.00000000' + // } + // } + // } + // }) } describe('burnToken', () => { @@ -111,7 +111,7 @@ describe('burnToken', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'BurnTokenTx: amount 0.00000000 is less than 15.00000000 (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'BurnTokenTx: amount 0.00000000 is less than 15.00000000', code: -26") }) it('should burnToken without context', async () => { @@ -236,7 +236,7 @@ describe('burnToken', () => { // Verify that the burn action is tied to the existing consortium member expect(keys.some(key => burntKeyRegex.exec(key) === null)).toStrictEqual(true) - expect(attributes.ATTRIBUTES[`v0/live/economy/consortium_members/${idBTC}/01/burnt`]).toStrictEqual(new BigNumber(30)) + // expect(attributes.ATTRIBUTES[`v0/live/economy/consortium_members/${idBTC}/01/burnt`]).toStrictEqual(new BigNumber(30)) // Verify the token balance is deducted correctly (100 - 30 = 70 BTC) const accAfter = await testing.rpc.account.getAccount(await providers.getAddress()) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_mint_token.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_mint_token.test.ts index 2c19c83ac2..21243dab04 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_mint_token.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_token_mint_token.test.ts @@ -12,7 +12,7 @@ import { Bech32, WIF } from '@defichain/jellyfish-crypto' const attributeKey = 'ATTRIBUTES' const symbolDBTC = 'BTC' -describe('Consortium', () => { +describe.skip('Consortium', () => { const tGroup = TestingGroup.create(3) const alice = tGroup.get(0) const bob = tGroup.get(1) @@ -154,7 +154,7 @@ describe('Consortium', () => { const txn = await cBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(charlie.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You are not a foundation or consortium member and cannot mint this token! (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You are not a foundation or consortium member and cannot mint this token!', code: -26") }) it('should throw an error if the token is not specified in governance vars', async () => { @@ -172,7 +172,7 @@ describe('Consortium', () => { const txn = await aBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(alice.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You are not a foundation member or token owner and cannot mint this token! (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You are not a foundation member or token owner and cannot mint this token!', code: -26") }) it('should not mintTokens for non-existent token', async () => { @@ -190,7 +190,7 @@ describe('Consortium', () => { const txn = await aBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(alice.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: token 22 does not exist! (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: token 22 does not exist!', code: -26") }) it('should throw an error if member daily mint limit exceeds', async () => { @@ -208,7 +208,7 @@ describe('Consortium', () => { const txn = await aBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(alice.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed your daily mint limit for BTC token by minting this amount (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed your daily mint limit for BTC token by minting this amount', code: -26") }) it('should throw an error if member maximum mint limit exceeds', async () => { @@ -226,7 +226,7 @@ describe('Consortium', () => { const txn = await aBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(alice.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed your maximum mint limit for BTC token by minting this amount! (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed your maximum mint limit for BTC token by minting this amount!', code: -26") }) it('should throw an error if global daily mint limit exceeds', async () => { @@ -249,7 +249,7 @@ describe('Consortium', () => { const txn = await bBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(bob.container, txn) - await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed global daily maximum consortium mint limit for BTC token by minting this amount. (code 16)', code: -26") + await expect(promise).rejects.toThrow("DeFiDRpcError: 'MintTokenTx: You will exceed global daily maximum consortium mint limit for BTC token by minting this amount.', code: -26") }) it('should throw an error if global mint limit exceeds', async () => { @@ -272,7 +272,7 @@ describe('Consortium', () => { const txn = await bBuilder.tokens.mint(tokenMint, script) const promise = sendTransaction(bob.container, txn) - await expect(promise).rejects.toThrow("MintTokenTx: You will exceed global daily maximum consortium mint limit for BTC token by minting this amount. (code 16)', code: -26") + await expect(promise).rejects.toThrow("MintTokenTx: You will exceed global daily maximum consortium mint limit for BTC token by minting this amount.', code: -26") }) it('should mintTokens', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_close_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_close_vault.test.ts index f51ab21310..669a7a9b46 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_close_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_close_vault.test.ts @@ -303,7 +303,7 @@ describe('vault.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${'0'.repeat(64)}> not found (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${'0'.repeat(64)}> not found', code: -26`) }) it('should not closeVault for vault with loan taken', async () => { @@ -314,7 +314,7 @@ describe('vault.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLoanTakenId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLoanTakenId}> has loans', code: -26`) }) it('should not closeVault for mayliquidate vault', async () => { @@ -333,7 +333,7 @@ describe('vault.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans', code: -26`) await tGroup.get(0).rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), { prices: [{ tokenAmount: '2@TSLA', currency: 'USD' }] }) await tGroup.get(0).generate(1) @@ -357,7 +357,7 @@ describe('vault.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans (code 16)', code: -26`) + await expect(promise).rejects.toThrow(`DeFiDRpcError: 'CloseVaultTx: Vault <${vaultWithLiquidationId}> has loans', code: -26`) await tGroup.get(0).container.waitForPriceValid('TSLA/USD') @@ -385,7 +385,7 @@ describe('vault.closeVault', () => { }, script) const promise = sendTransaction(tGroup.get(0).container, txn) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: Cannot close vault under liquidation (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: Cannot close vault under liquidation\', code: -26') await tGroup.get(0).rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), { prices: [{ tokenAmount: '2@TSLA', currency: 'USD' }] }) await tGroup.get(0).generate(1) @@ -405,6 +405,6 @@ describe('vault.closeVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'CloseVaultTx: tx must have at least one input from token owner\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_create_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_create_vault.test.ts index 739aadf3c3..d7d4dfcd44 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_create_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_create_vault.test.ts @@ -251,7 +251,7 @@ describe('vault.createVault', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('VaultTx: Cannot find existing loan scheme with id scheme3 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('VaultTx: Cannot find existing loan scheme with id scheme3\', code: -26') }) it('should not createVault with scheme set to be destroyed', async () => { @@ -275,7 +275,7 @@ describe('vault.createVault', () => { const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('VaultTx: Cannot set scheme4 as loan scheme, set to be destroyed on block 150 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('VaultTx: Cannot set scheme4 as loan scheme, set to be destroyed on block 150\', code: -26') }) }) @@ -314,6 +314,6 @@ describe('vault.createVault when no default scheme and the given schemeId is emp const promise = sendTransaction(testing.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'VaultTx: There is no default loan scheme (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'VaultTx: There is no default loan scheme\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_deposit_to_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_deposit_to_vault.test.ts index bb3f7675cd..d0e7bbadbb 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_deposit_to_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_deposit_to_vault.test.ts @@ -316,7 +316,7 @@ describe('vault.depositToVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DepositToVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DepositToVaultTx: tx must have at least one input from token owner\', code: -26') }) it('should be failed as vault is not exists', async () => { diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_update_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_update_vault.test.ts index b5842c9436..eb6a2bee60 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_update_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_update_vault.test.ts @@ -225,7 +225,7 @@ describe('vault.updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Cannot update vault while any of the asset\'s price is invalid (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Cannot update vault while any of the asset\'s price is invalid\', code: -26') await alice.container.waitForPriceValid('DFI/USD') @@ -273,7 +273,7 @@ describe('vault.updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Vault does not have enough collateralization ratio defined by loan scheme - 147 < 150 (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: Vault does not have enough collateralization ratio defined by loan scheme - 147 < 150\', code: -26') }) it('should not updateVault as different auth address', async () => { @@ -297,6 +297,6 @@ describe('vault.updateVault', () => { const promise = sendTransaction(alice.container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: tx must have at least one input from token owner (code 16)\', code: -26') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'UpdateVaultTx: tx must have at least one input from token owner\', code: -26') }) }) diff --git a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_withdraw_from_vault.test.ts b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_withdraw_from_vault.test.ts index 388b51b0bb..ee6ca2ec60 100644 --- a/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_withdraw_from_vault.test.ts +++ b/packages/jellyfish-transaction-builder/__tests__/txn/txn_builder_vault_withdraw_from_vault.test.ts @@ -332,7 +332,7 @@ describe('vault.withdrawFromVault', () => { const promise = sendTransaction(tGroup.get(0).container, txn) await expect(promise).rejects.toThrow(DeFiDRpcError) - await expect(promise).rejects.toThrow('DeFiDRpcError: \'WithdrawFromVaultTx: At least 50% of the minimum required collateral must be in DFI or DUSD (code 16)') + await expect(promise).rejects.toThrow('DeFiDRpcError: \'WithdrawFromVaultTx: At least 50% of the minimum required collateral must be in DFI or DUSD') }) it('should not withdraw from liquidated vault', async () => { diff --git a/packages/testcontainers/src/containers/DeFiDContainer.ts b/packages/testcontainers/src/containers/DeFiDContainer.ts index 810e1352d6..1f0c4db61a 100644 --- a/packages/testcontainers/src/containers/DeFiDContainer.ts +++ b/packages/testcontainers/src/containers/DeFiDContainer.ts @@ -36,7 +36,7 @@ export abstract class DeFiDContainer extends DockerContainer { if (process?.env?.DEFICHAIN_DOCKER_IMAGE !== undefined) { return process.env.DEFICHAIN_DOCKER_IMAGE } - return 'defi/defichain:4.0.5' // renovate.json regexManagers + return 'defi/defichain:4.0.9' // renovate.json regexManagers } public static readonly DefaultStartOptions = { diff --git a/packages/testcontainers/src/containers/NativeChainContainer.ts b/packages/testcontainers/src/containers/NativeChainContainer.ts index 113fce02d7..ef812e5468 100644 --- a/packages/testcontainers/src/containers/NativeChainContainer.ts +++ b/packages/testcontainers/src/containers/NativeChainContainer.ts @@ -29,7 +29,7 @@ export class NativeChainContainer extends GenericContainer { if (process?.env?.DEFICHAIN_DOCKER_IMAGE !== undefined) { return process.env.DEFICHAIN_DOCKER_IMAGE } - return 'defi/defichain:4.0.5' // renovate.json regexManagers + return 'defi/defichain:4.0.9' // renovate.json regexManagers } public static readonly PREFIX = 'defichain-testcontainers-' diff --git a/packages/whale-api-client/__tests__/api/consortium.test.ts b/packages/whale-api-client/__tests__/api/consortium.test.ts index 2175a335ed..0c81b95b84 100644 --- a/packages/whale-api-client/__tests__/api/consortium.test.ts +++ b/packages/whale-api-client/__tests__/api/consortium.test.ts @@ -1,3 +1,5 @@ +// NOTE(canonbrother): skip as consortium is removed, ref: https://github.com/DeFiCh/ain/pull/2730 + import { TestingGroup } from '@defichain/jellyfish-testing' import { StartFlags } from '@defichain/testcontainers' import { WhaleApiException } from '../../src' @@ -124,7 +126,7 @@ async function setup (): Promise { }]) } -describe('getAssetBreakdown', () => { +describe.skip('getAssetBreakdown', () => { it('should respond an empty list if theres no consortium members or tokens initialized', async () => { const info = await client.consortium.getAssetBreakdown() expect(info).toStrictEqual([]) @@ -190,7 +192,7 @@ describe('getAssetBreakdown', () => { }) }) -describe('getMemberStats', () => { +describe.skip('getMemberStats', () => { it('should throw an error if provided consortium member id is invalid', async () => { try { await setup()