diff --git a/tests/e2e/api/info.test.ts b/tests/e2e/api/info.test.ts index 5e5c3464..67f4bf60 100644 --- a/tests/e2e/api/info.test.ts +++ b/tests/e2e/api/info.test.ts @@ -1,9 +1,8 @@ -import { GenesisJUNEChain } from '../../../src' import { PROVIDER } from '../constants' describe('InfoAPI', () => { describe('isBootstrapped', () => { - test.each([{ chainID: GenesisJUNEChain.id }])('Valid: $chainID', async ({ chainID }) => { + test.each([{ chainID: PROVIDER.juneChain.id }])('Valid: $chainID', async ({ chainID }) => { const result = await PROVIDER.info.isBootstrapped(chainID) expect(result.isBootstrapped).toEqual(true) }) @@ -15,7 +14,7 @@ describe('InfoAPI', () => { describe('getBlockchainID', () => { test.each([{ alias: 'JUNE' }])('Valid: $alias', async ({ alias }) => { const result = await PROVIDER.info.getBlockchainID(alias) - expect(result.blockchainID).toEqual(GenesisJUNEChain.id) + expect(result.blockchainID).toEqual(PROVIDER.juneChain.id) }) test.failing.each([{ alias: 'WRONG_ALIAS' }])('Invalid: $alias', async ({ alias }) => { await PROVIDER.info.getBlockchainID('alias') diff --git a/tests/e2e/api/jevm.test.ts b/tests/e2e/api/jevm.test.ts index 07a7d16f..96595a45 100644 --- a/tests/e2e/api/jevm.test.ts +++ b/tests/e2e/api/jevm.test.ts @@ -1,4 +1,4 @@ -import { GenesisEUROC1Asset, GenesisJUNEChain } from '../../../src' +import { SocotraEUR1Asset } from '../../../src' import { PROVIDER } from '../constants' describe('JEVMAPI', () => { @@ -8,7 +8,7 @@ describe('JEVMAPI', () => { { txID: '0x3c529e9941b6ca0ec34948c7f797e94ff810643ef64896c409ea0df36be9e554' }, { txID: 'INVALID_TX_ID' } ])('Invalid: $txID', async ({ txID }) => { - const result = await PROVIDER.jevmApi[GenesisJUNEChain.id].getTx(txID) + const result = await PROVIDER.jevmApi[PROVIDER.juneChain.id].getTx(txID) expect(result.tx).toBeDefined() }) }) @@ -19,13 +19,13 @@ describe('JEVMAPI', () => { description: 'Wrong address', address: '0x9b31d8C5Dd49fCdE96218895f96a6eC894529', block: '0x4BF7C5', - assetID: GenesisEUROC1Asset.assetId + assetID: SocotraEUR1Asset.assetId }, { description: 'Wrong block', address: '0x9b31d8C5Dd49fCdE96218895f96a6eC1ea894529', block: '2000', - assetID: GenesisEUROC1Asset.assetId + assetID: SocotraEUR1Asset.assetId }, { description: 'Wrong assetID', @@ -34,27 +34,27 @@ describe('JEVMAPI', () => { assetID: '0x0' } ])('$description: $address, $block, $assetID', async ({ address, block, assetID }) => { - await PROVIDER.jevmApi[GenesisJUNEChain.id].eth_getAssetBalance(address, block, assetID) + await PROVIDER.jevmApi[PROVIDER.juneChain.id].eth_getAssetBalance(address, block, assetID) }) }) describe('eth_baseFee', () => { test('Returns base fee', async () => { - const result = await PROVIDER.jevmApi[GenesisJUNEChain.id].eth_baseFee() + const result = await PROVIDER.jevmApi[PROVIDER.juneChain.id].eth_baseFee() expect(result).toBeDefined() }) }) describe('eth_maxPriorityFeePerGas', () => { test('Returns max priority fee per gas', async () => { - const result = await PROVIDER.jevmApi[GenesisJUNEChain.id].eth_maxPriorityFeePerGas() + const result = await PROVIDER.jevmApi[PROVIDER.juneChain.id].eth_maxPriorityFeePerGas() expect(result).toBeDefined() }) }) describe('eth_getChainConfig', () => { test('Returns chain config', async () => { - const result = await PROVIDER.jevmApi[GenesisJUNEChain.id].eth_getChainConfig() + const result = await PROVIDER.jevmApi[PROVIDER.juneChain.id].eth_getChainConfig() expect(result).toBeDefined() }) }) diff --git a/tests/e2e/api/jvm.test.ts b/tests/e2e/api/jvm.test.ts index f373deb6..bbd77bce 100644 --- a/tests/e2e/api/jvm.test.ts +++ b/tests/e2e/api/jvm.test.ts @@ -1,7 +1,6 @@ import { - GenesisBCH1Asset, - GenesisETH1Asset, - GenesisJUNEAsset, + SocotraBCH1Asset, + SocotraEUR1Asset, type GetAssetDescriptionResponse, type GetBlockResponse, type GetHeightResponse, @@ -15,7 +14,7 @@ describe('JVMAPI', () => { }) describe('getAssetDescription', () => { - test.each([{ asset: GenesisJUNEAsset }, { asset: GenesisETH1Asset }, { asset: GenesisBCH1Asset }])( + test.each([{ asset: PROVIDER.jvmChain.asset }, { asset: SocotraEUR1Asset }, { asset: SocotraBCH1Asset }])( 'Valid: $asset.assetId ($asset.symbol)', async ({ asset }) => { const result: GetAssetDescriptionResponse = await PROVIDER.jvmApi.getAssetDescription(asset.assetId) @@ -69,8 +68,8 @@ describe('JVMAPI', () => { describe('getTx', () => { test.each([ - { txID: 'dGJVWGj3GHQRAvt87xqcVUwKNKcJRaB7iUwGpNP9PYSrk6rie' }, - { txID: '2FKNX3WoJwtbanNxVV44qaXsv8SgkiBtD4psHC2wdbLizXvGS' } + { txID: 'P1ogBpExP9gRM2Pjqr7J32bzACcob4hZtEj62T71feW6Q8KGb' }, + { txID: '2E5DxrCSQkAc1FoAQ7q1QQyaHnHskEkvDjzFG9YYN7dfsjKGjB' } ])('Valid: $txID', async ({ txID }) => { const result: GetTxResponse = await PROVIDER.jvmApi.getTx(txID) expect(result.encoding).toBeDefined() diff --git a/tests/e2e/api/platform.test.ts b/tests/e2e/api/platform.test.ts index 1ff598e6..9e0e28a1 100644 --- a/tests/e2e/api/platform.test.ts +++ b/tests/e2e/api/platform.test.ts @@ -1,11 +1,11 @@ -import { GenesisBCH1Chain, GenesisJUNEChain, type GetBlockResponse } from '../../../src' +import { SocotraBCH1Chain, type GetBlockResponse } from '../../../src' import { PROVIDER } from '../constants' describe('PlatformAPI', () => { describe('getBlock', () => { test.each([ - { blockID: '2qbN8EiGKprtFLkQxnQMgqbXSWdui5rwVUTsQp5Z5RYFphy1oK' }, - { blockID: '2K8nAXkMwgnJRCFMAS7KiJSkBbDYKtFP6JH7ww2YiAjg6XnN69' } + { blockID: '25ttEN33bZ4nj2TYUWYrMrmx3jShwGQwsakjckPvk75FXnPKx' }, + { blockID: '8uUGsfz6PfnLqF5H3FA6PkkcVv5bZ7o35SgBX1VcrLgEGEdn7' } ])('Valid blockID: $blockID', async ({ blockID }) => { const result: GetBlockResponse = await PROVIDER.platformApi.getBlock(blockID) expect(result.block).toBeDefined() @@ -31,8 +31,8 @@ describe('PlatformAPI', () => { describe('getBlockchainStatus', () => { test.each([ - { blockchainID: GenesisJUNEChain.id }, - { blockchainID: GenesisBCH1Chain.id }, + { blockchainID: PROVIDER.juneChain.id }, + { blockchainID: SocotraBCH1Chain.id }, { blockchainID: '2k1EyxAV5XYPxnsuPVrKyquUTLC3EMA1c5AhM7r8sRy1Kg7Zje' } ])('Valid blockchainID: $blockchainID', async ({ blockchainID }) => { const result = await PROVIDER.platformApi.getBlockchainStatus(blockchainID) @@ -108,7 +108,7 @@ describe('PlatformAPI', () => { { description: 'Invalid supernetID', supernetID: 'INVALID_SUPERNET_ID' }, { description: 'Permissionned supernet supernetID', - supernetID: 'ZLfejkjx2AwkaNbGC7oQxX3gE6G1YLs4FzMimQEG6Us2b7UpW' + supernetID: 'qyieai1WRqtxqKwn8CUUAfgXfu6rQbHJhiiLE6DpCWHXtHTGG' } ])('$description: $supernetID', async ({ supernetID }) => { await PROVIDER.platformApi.getMinStake(supernetID as any) @@ -157,7 +157,7 @@ describe('PlatformAPI', () => { { description: 'Invalid supernetID', supernetID: 'INVALID_SUPERNET_ID' }, { description: 'Permissionned supernet supernetID', - supernetID: 'ZLfejkjx2AwkaNbGC7oQxX3gE6G1YLs4FzMimQEG6Us2b7UpW' + supernetID: 'ZLfejkjx2AwkaNbGC7oQxX3gE6G1YLs4FzMimQEG6Us2bUpW' } ])('$description: $supernetID', async ({ supernetID }) => { await PROVIDER.platformApi.getTotalStake(supernetID as any) @@ -166,8 +166,8 @@ describe('PlatformAPI', () => { describe('getTx', () => { test.each([ - { txID: '2tCUnxobnWD6PgRMVaBJt6uiUxk9NcjLU6Emczbj64GF7dnkcp' }, - { txID: '27xs3BGknXSSKg86rczsFCHTvDLQ4dcH9BrgSwKepQcYB5VGc3' } + { txID: '2G5dJ1kQFu7S6pJTffKqcnfVGNcFGCmtZE3D3fCPDSQuCRrM5p' }, + { txID: 'V39EFBBf2yXLqacsmFrM1WRhvtHfMa55LY2CwFsVLDK64sKXG' } ])('Valid txID: $txID', async ({ txID }) => { const result = await PROVIDER.platformApi.getTx(txID) expect(result.encoding).toBeDefined() @@ -203,7 +203,8 @@ describe('PlatformAPI', () => { describe('getValidatorsAt', () => { test.each([{ height: 100 }, { height: 200 }])('Valid height: $height', async ({ height }) => { const result = await PROVIDER.platformApi.getValidatorsAt(height) - expect(result.validators).toBeDefined() + // TODO: Check the result + expect(result).toBeDefined() }) }) @@ -220,8 +221,8 @@ describe('PlatformAPI', () => { describe('validatedBy', () => { test.each([ - { blockchainID: GenesisJUNEChain.id }, - { blockchainID: '2k1EyxAV5XYPxnsuPVrKyquUTLC3EMA1c5AhM7r8sRy1Kg7Zje' } + { blockchainID: PROVIDER.juneChain.id }, + { blockchainID: '3pW4zxtzuMAWLA6rdttWDqkVMtGRTqohthSDW962k8GTNyKXj' } ])('Valid blockchainID: $blockchainID', async ({ blockchainID }) => { const result = await PROVIDER.platformApi.validatedBy(blockchainID) expect(result.supernetID).toBeDefined() @@ -231,7 +232,7 @@ describe('PlatformAPI', () => { describe('validates', () => { test.each([ { supernetID: PROVIDER.mcn.primary.id }, - { supernetID: 'ZLfejkjx2AwkaNbGC7oQxX3gE6G1YLs4FzMimQEG6Us2b7UpW' } + { supernetID: 'qyieai1WRqtxqKwn8CUUAfgXfu6rQbHJhiiLE6DpCWHXtHTGG' } ])('Valid supernetID: $supernetID', async ({ supernetID }) => { const result = await PROVIDER.platformApi.validates(supernetID) expect(result.blockchainIDs).toBeDefined() diff --git a/tests/e2e/constants.ts b/tests/e2e/constants.ts index c1a7a32f..eaa8009d 100644 --- a/tests/e2e/constants.ts +++ b/tests/e2e/constants.ts @@ -1,8 +1,8 @@ import * as dotenv from 'dotenv' -import { GenesisNetwork, MCNAccount, MCNProvider, MCNWallet } from '../../src' +import { MCNAccount, MCNProvider, MCNWallet, SocotraNetwork } from '../../src' dotenv.config() -export const PROVIDER: MCNProvider = new MCNProvider(GenesisNetwork) +export const PROVIDER: MCNProvider = new MCNProvider(SocotraNetwork) const WALLET = MCNWallet.recover(process.env.MNEMONIC ?? '', PROVIDER.mcn.hrp) export const ACCOUNT: MCNAccount = new MCNAccount(PROVIDER, WALLET) diff --git a/tests/e2e/wallet/cross.test.ts b/tests/e2e/wallet/cross.test.ts index 058061d6..3c5b7f9e 100644 --- a/tests/e2e/wallet/cross.test.ts +++ b/tests/e2e/wallet/cross.test.ts @@ -1,29 +1,30 @@ import { AccountError, CrossOperation, - GenesisEUROC1Chain, - GenesisJUNEChain, - GenesisJVMChain, - GenesisPlatformChain, InputError, NetworkOperationRange, NetworkOperationType, + SocotraEUR1Chain, + SocotraJUNEChain, + SocotraJVMChain, + SocotraPlatformChain, type ExecutableOperation } from '../../../src' import { ACCOUNT, DEFAULT_TIMEOUT, DONE_STATUS, EXCESSIVE_AMOUNT } from '../constants' describe('Cross operations', () => { - const juneChain = GenesisJUNEChain - const euroChain = GenesisEUROC1Chain - const platformChain = GenesisPlatformChain - const jvmChain = GenesisJVMChain + const juneChain = SocotraJUNEChain + const euroChain = SocotraEUR1Chain + const platformChain = SocotraPlatformChain + const jvmChain = SocotraJVMChain + const euroAddress = '0x3000000000000000000000000000000000000000' describe('Instantiation', () => { test.each([ { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: BigInt(1_000) }, @@ -58,21 +59,21 @@ describe('Cross operations', () => { { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: EXCESSIVE_AMOUNT }, { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: BigInt(0) }, { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: BigInt(-1_000) } @@ -96,7 +97,7 @@ describe('Cross operations', () => { { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: BigInt(1_000) }, @@ -167,7 +168,7 @@ describe('Cross operations', () => { { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: BigInt(-1), expectedError: InputError @@ -175,7 +176,7 @@ describe('Cross operations', () => { { source: juneChain, destination: euroChain, - assetId: '0x3300000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'EUROC.e', value: EXCESSIVE_AMOUNT, expectedError: AccountError diff --git a/tests/e2e/wallet/send.test.ts b/tests/e2e/wallet/send.test.ts index 623c537b..ff0512b4 100644 --- a/tests/e2e/wallet/send.test.ts +++ b/tests/e2e/wallet/send.test.ts @@ -1,17 +1,18 @@ import { AccountError, - GenesisEUROC1Chain, - GenesisJUNEChain, - GenesisJVMChain, SendOperation, + SocotraEUR1Chain, + SocotraJUNEChain, + SocotraJVMChain, type ExecutableOperation } from '../../../src' import { ACCOUNT, DEFAULT_TIMEOUT, DONE_STATUS, EXCESSIVE_AMOUNT } from '../constants' describe('Send operations', () => { - const juneChain = GenesisJUNEChain - const euroChain = GenesisEUROC1Chain - const jvmChain = GenesisJVMChain + const juneChain = SocotraJUNEChain + const euroChain = SocotraEUR1Chain + const jvmChain = SocotraJVMChain + const euroAddress = '0x3000000000000000000000000000000000000000' describe('EVM send', () => { describe('Valid execute', () => { @@ -25,7 +26,7 @@ describe('Send operations', () => { }, { chain: juneChain, - assetId: '0x2d00000000000000000000000000000000000000', + assetId: euroAddress, symbol: 'ETH.e', value: BigInt(1), recipient: '0x3c647d88Bc92766075feA7A965CA599CAAB2FD26' diff --git a/tests/e2e/wallet/stake.test.ts b/tests/e2e/wallet/stake.test.ts index 936aabc7..f2967998 100644 --- a/tests/e2e/wallet/stake.test.ts +++ b/tests/e2e/wallet/stake.test.ts @@ -10,16 +10,18 @@ import { ACCOUNT, DEFAULT_TIMEOUT, DONE_STATUS, EXCESSIVE_AMOUNT, PROVIDER } fro const chainAccount: ChainAccount = ACCOUNT.getAccount(PROVIDER.platformChain.id) // for now we take this nodeID. maybe in the future we can select the node Id with a function -const validNodeId = 'NodeID-P6qNB7Zk2tUirf9TvBiXxiCHxa5Hzq6sL' +const validNodeId = 'NodeID-4JfgcoMWBpxCQL5VmyQ1f6L36mUbLLBga' const ONE_DAY: bigint = BigInt(86_400) let currentTime: bigint = TimeUtils.now() + BigInt(30) let tomorrow: bigint = currentTime + ONE_DAY +let twoWeeks: bigint = currentTime + BigInt(14) * ONE_DAY describe('Staking operations', (): void => { beforeAll(async () => { // TODO create time provider utils to manage those tests currentTime = TimeUtils.now() + BigInt(30) tomorrow = currentTime + ONE_DAY + twoWeeks = currentTime + BigInt(14) * ONE_DAY + BigInt(30) }) test.todo('operations instantiations') @@ -29,10 +31,10 @@ describe('Staking operations', (): void => { test.each([ { nodeId: validNodeId, - amount: BigInt(10_000_000), + amount: BigInt(100_000_000), // 0.1 JUNE expectedStatus: DONE_STATUS, startTime: currentTime, - endTime: tomorrow + endTime: twoWeeks } ])( '$#) $amount tokens to delegate node id: $nodeId from $startTime to $endTime', diff --git a/tests/e2e/wallet/wrap.test.ts b/tests/e2e/wallet/wrap.test.ts index 7bae92fa..e8134260 100644 --- a/tests/e2e/wallet/wrap.test.ts +++ b/tests/e2e/wallet/wrap.test.ts @@ -1,9 +1,9 @@ import { AccountError, - GenesisJUNEChain, - GenesisWJUNEAsset, NetworkOperationRange, NetworkOperationType, + SocotraJUNEChain, + SocotraWJUNEAsset, UnwrapOperation, WrapOperation, type ExecutableOperation @@ -11,8 +11,8 @@ import { import { ACCOUNT, DEFAULT_TIMEOUT, DONE_STATUS, EXCESSIVE_AMOUNT } from '../constants' describe('Wrapping operations', () => { - const juneChain = GenesisJUNEChain - const wJuneAsset = GenesisWJUNEAsset + const juneChain = SocotraJUNEChain + const wJuneAsset = SocotraWJUNEAsset describe('WrapOperation', () => { describe('Instantiation', () => { diff --git a/tests/unit/transaction/type.test.ts b/tests/unit/transaction/type.test.ts index 44b18bf3..6d44be37 100644 --- a/tests/unit/transaction/type.test.ts +++ b/tests/unit/transaction/type.test.ts @@ -346,9 +346,9 @@ describe('Types', () => { describe('BlockchainId', () => { describe('Constructor', () => { test.each([ - { blockchainId: '2c2z3duV8XJhkZHedp19WTBtKEpkfG5BAcvKdL8tbjSgH8uj2o' }, - { blockchainId: 'fqxdvHoxBciiVa7wAZjq48HYmFVyQefrDpPyVuPd5GAUHAjEN' }, - { blockchainId: 'NLp7mU4yqN9xfu3Yezc6Sq66xFx5E1bKaxsBZRBZ7N7FmKhb5' } + { blockchainId: '2f1fGVRDot1V5CYeoiAN49LYrEBWmsZgnDXguvQ6u8YKdjqRGv' }, + { blockchainId: 'vFZ8cj9v4SMPn4nvcmSw7KuxCvK9kLQq4u2wnTUFMzhUehwUN' }, + { blockchainId: 'BUDQJ63154EiJZwwvukRB1tX3yQCDQdoEYYuCNKEruQ9MjRs4' } ])('Instantiate blockchainId: $blockchainId', ({ blockchainId }) => { expect(new BlockchainId(blockchainId)).toBeInstanceOf(BlockchainId) }) @@ -361,7 +361,7 @@ describe('Types', () => { }, { description: 'Invalid size', - blockchainId: '2c2z3duV8XJhkZHedp19WTBtKEpkfG5BAcvKdL8tbjSgH8uj2oq', + blockchainId: '2f1fGVRDot1V5CYeoiAN49LYrEBWmsZgnDXguvQ6u8YKdjqRGvq', expectedError: DecodingError }, { @@ -396,7 +396,7 @@ describe('Types', () => { }, { description: 'Upper bound size', - blockchainId: '2c2z3duV8XJhkZHedp19WTBtKEpkfG5BAcvKdL8tbjSgH8uj2oq', + blockchainId: '2f1fGVRDot1V5CYeoiAN49LYrEBWmsZgnDXguvQ6u8YKdjqRGvq', expectedError: DecodingError } ])('$description', ({ blockchainId, expectedError }) => { @@ -406,16 +406,16 @@ describe('Types', () => { describe('serialization', () => { test.each([ { - blockchainId: '2c2z3duV8XJhkZHedp19WTBtKEpkfG5BAcvKdL8tbjSgH8uj2o', - result: '2c2z3duV8XJhkZHedp19WTBtKEpkfG5BAcvKdL8tbjSgH8uj2o' + blockchainId: '2f1fGVRDot1V5CYeoiAN49LYrEBWmsZgnDXguvQ6u8YKdjqRGv', + result: '2f1fGVRDot1V5CYeoiAN49LYrEBWmsZgnDXguvQ6u8YKdjqRGv' }, { - blockchainId: 'fqxdvHoxBciiVa7wAZjq48HYmFVyQefrDpPyVuPd5GAUHAjEN', - result: 'fqxdvHoxBciiVa7wAZjq48HYmFVyQefrDpPyVuPd5GAUHAjEN' + blockchainId: 'vFZ8cj9v4SMPn4nvcmSw7KuxCvK9kLQq4u2wnTUFMzhUehwUN', + result: 'vFZ8cj9v4SMPn4nvcmSw7KuxCvK9kLQq4u2wnTUFMzhUehwUN' }, { - blockchainId: 'NLp7mU4yqN9xfu3Yezc6Sq66xFx5E1bKaxsBZRBZ7N7FmKhb5', - result: 'NLp7mU4yqN9xfu3Yezc6Sq66xFx5E1bKaxsBZRBZ7N7FmKhb5' + blockchainId: 'BUDQJ63154EiJZwwvukRB1tX3yQCDQdoEYYuCNKEruQ9MjRs4', + result: 'BUDQJ63154EiJZwwvukRB1tX3yQCDQdoEYYuCNKEruQ9MjRs4' } ])('Serialize: $blockchainId', ({ blockchainId, result }) => { expect(new BlockchainId(blockchainId).serialize().toCB58()).toBe(result)