Skip to content

Commit

Permalink
chore: migrate rococo refs to paseo (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
marshacb authored Oct 16, 2024
1 parent 830f9d3 commit da53859
Show file tree
Hide file tree
Showing 44 changed files with 249 additions and 241 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ type AssetTransferApiOpts = {
* }
* }
*
* NOTE: It supports adding info for `polkadot`, `kusama`, `westend` and `rococo`.
* NOTE: It supports adding info for `polkadot`, `kusama`, `westend` and `paseo`.
*/
injectedRegistry?: RequireAtLeastOne<ChainInfoRegistry>;
/**
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/consts.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2023 Parity Technologies (UK) Ltd.

export const KUSAMA_ASSET_HUB_WS_URL = 'ws://127.0.0.1:9911';
export const ROCOCO_ALICE_WS_URL = 'ws://127.0.0.1:9900';
export const TRAPPIST_WS_URL = 'ws://127.0.0.1:9921';
export const PASEO_ALICE_WS_URL = 'ws://127.0.0.1:9900';
export const MUSE_WS_URL = 'ws://127.0.0.1:9921';

export const BOB_ADDR = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
export const FERDE_ADDR = '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL';
Expand Down
16 changes: 8 additions & 8 deletions e2e-tests/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { cryptoWaitReady } from '@polkadot/util-crypto';
import { delay } from '../scripts/util';
import { constructApiPromise } from '../src';
import { balanceTracker, IBalance } from './balance';
import { KUSAMA_ASSET_HUB_WS_URL, ROCOCO_ALICE_WS_URL, TRAPPIST_WS_URL } from './consts';
import { KUSAMA_ASSET_HUB_WS_URL, MUSE_WS_URL, PASEO_ALICE_WS_URL } from './consts';
import { startProgressBar, startTestLogger, terminateProgressBar, testResultLogger, updateProgressBar } from './logger';
import { assetTests, foreignAssetsTests, IndividualTest, liquidPoolsTests, localTests, tests } from './tests';
import { verification } from './verification';
Expand Down Expand Up @@ -62,32 +62,32 @@ const executor = async (testCase: string) => {

switch (originChainId) {
case '0':
originWsUrl = ROCOCO_ALICE_WS_URL;
chainName = 'Rococo';
originWsUrl = PASEO_ALICE_WS_URL;
chainName = 'Paseo';
break;
case '1000':
originWsUrl = KUSAMA_ASSET_HUB_WS_URL;
chainName = 'Kusama Asset Hub';
break;
case '1836':
originWsUrl = TRAPPIST_WS_URL;
chainName = 'Trappist';
originWsUrl = MUSE_WS_URL;
chainName = 'Muse Testnet';
break;
}
if (originChainId == destChainId) {
destWsUrl = originWsUrl;
} else {
switch (destChainId) {
case '0':
destWsUrl = ROCOCO_ALICE_WS_URL;
chainName = 'Rococo';
destWsUrl = PASEO_ALICE_WS_URL;
chainName = 'Paseo';
break;
case '1000':
destWsUrl = KUSAMA_ASSET_HUB_WS_URL;
chainName = 'Kusama Asset Hub';
break;
case '1836':
destWsUrl = TRAPPIST_WS_URL;
destWsUrl = MUSE_WS_URL;
chainName = 'Trappist';
break;
}
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/tests/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { TxResult } from '../../src/types';

const createAssetApi = (api: ApiPromise, specName: string, safeXcmVersion: number): AssetTransferApi => {
const injectedRegistry = {
rococo: {
'1836': {
tokens: ['HOP'],
paseo: {
'3369': {
tokens: ['MUSE'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'trappist-rococo',
specName: 'muse',
poolPairsInfo: {},
},
},
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/tests/foreignAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { TxResult } from '../../src/types';

const createAssetApi = (api: ApiPromise, specName: string, safeXcmVersion: number): AssetTransferApi => {
const injectedRegistry = {
rococo: {
'1836': {
tokens: ['HOP'],
paseo: {
'3369': {
tokens: ['MUSE'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'trappist-rococo',
specName: 'muse',
poolPairsInfo: {},
},
},
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export const tests: TestGroups = {
test: 'createForeignTransferTransaction',
args: [
'1000',
'1836',
'3369',
'//Alice',
BOB_ADDR,
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "1836" }, { "GeneralIndex": "0" }]}}]',
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "3369" }, { "GeneralIndex": "0" }]}}]',
'[200000000]',
'{ "format": "payload", "xcmVersion": 3, "sendersAddr": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" }',
],
verification: [
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "1836" }, { "GeneralIndex": "0" }]}}]',
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "3369" }, { "GeneralIndex": "0" }]}}]',
'[200000000]',
],
},
Expand All @@ -44,12 +44,12 @@ export const tests: TestGroups = {
'1000',
'//Alice',
FERDE_ADDR,
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "1836" }, { "GeneralIndex": "0" }]}}]',
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "3369" }, { "GeneralIndex": "0" }]}}]',
'[200000000000]',
'{ "format": "payload", "xcmVersion": 3, "sendersAddr": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" }',
],
verification: [
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "1836" }, { "GeneralIndex": "0" }]}}]',
'[{ "parents": "1", "interior": { "X2": [{ "Parachain": "3369" }, { "GeneralIndex": "0" }]}}]',
'[200000000000]',
],
},
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/tests/liquidPools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { TxResult } from '../../src/types';

const createAssetApi = (api: ApiPromise, specName: string, safeXcmVersion: number): AssetTransferApi => {
const injectedRegistry = {
rococo: {
'1836': {
tokens: ['HOP'],
paseo: {
'3369': {
tokens: ['MUSE'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'trappist-rococo',
specName: 'muse',
poolPairsInfo: {},
},
},
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/tests/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import { TxResult } from '../../src/types';

const createAssetApi = (api: ApiPromise, specName: string, safeXcmVersion: number): AssetTransferApi => {
const injectedRegistry = {
rococo: {
'1836': {
tokens: ['HOP'],
paseo: {
'3369': {
tokens: ['MUSE'],
assetsInfo: {},
foreignAssetsInfo: {},
specName: 'trappist-rococo',
specName: 'muse',
poolPairsInfo: {},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { TxResult } from '../../../../src/types';
import { GREEN, PURPLE, RESET } from '../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssets` call to send 1 ROC (asset with location `{"parents":"1","interior":{"Here":""}}`)
* from a Rococo Asset Hub (System Parachain) account
* In this example we are creating a `polkadotXcm` pallet `transferAssets` call to send 1 PAS (asset with location `{"parents":"1","interior":{"Here":""}}`)
* from a Paseo Asset Hub (System Parachain) account
* to a Westend Asset Hub account, where the `xcmVersion` is set to safeXcmVersion and no `weightLimit` option is provided declaring that
* the tx will allow unlimited weight to be used for fees.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://rococo-asset-hub-rpc.polkadot.io');
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://paseo-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);

let callInfo: TxResult<'call'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { GREEN, PURPLE, RESET } from '../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssets` call to send WETH (foreign asset with location `{"parents":"2","interior":{"X2":[{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}},{"AccountKey20":{"network":null,"key":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14"}}]}}`)
* from a Rococo Asset Hub (System Parachain) account
* from a Paseo Asset Hub (System Parachain) account
* to an Ethereum Sepolia account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* `weightLimit` option provided which declares that the tx will allow unlimited weight to be used for fees.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, chainName, safeXcmVersion } = await constructApiPromise(
'wss://rococo-asset-hub-rpc.polkadot.io',
'wss://paseo-asset-hub-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, {
chainName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { GREEN, PURPLE, RESET } from '../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssets` call to send 1 WND (foreign asset with location `{"parents":"2","interior":{"X1":{"GlobalConsensus":"Westend"}}}`)
* from a Rococo Asset Hub (System Parachain) account
* from a Paseo Asset Hub (System Parachain) account
* to a Westend Asset Hub account, where the `xcmVersion` is set to safeXcmVersion and no `weightLimit` option is provided declaring that
* the tx will allow unlimited weight to be used for fees.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://rococo-asset-hub-rpc.polkadot.io');
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://paseo-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);

let callInfo: TxResult<'call'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';

/**
* In this example we are creating a `foreignAssets` pallet `transfer` call to send WETH (foreign asset with location `{"parents":"2","interior":{"X2":[{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}},{"AccountKey20":{"network":null,"key":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14"}}]}}`,`)
* from a Rococo Asset Hub (System Parachain) account
* to a Rococo Asset Hub (System Parachain) account.
* from a Paseo Asset Hub (System Parachain) account
* to a Paseo Asset Hub (System Parachain) account.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, safeXcmVersion, chainName } = await constructApiPromise(
'wss://rococo-asset-hub-rpc.polkadot.io',
'wss://paseo-asset-hub-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, {
chainName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssetsUsingTypeAndThen` call to send MUSE (foreign asset with location `{"parents":"1","interior":{"X1":{"Parachain":"3369"}}}`)
* from a Rococo Asset Hub (System Parachain) account
* to a Bifrost Polkadot (Parachain) testnet account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* from a Paseo Asset Hub (System Parachain) account
* to a Bifrost Paseo (Parachain) testnet account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* `weightLimit` option provided which declares that the tx will allow unlimited weight to be used for fees.
* We provide a `paysWithFeeDest` asset location for MUSE which will be used to pay for fees on the destination chain.
* We also provide a value of `RemoteReserve` for the `assetTransferType` and `feeTransferType` options declaring a custom reserve location for both
Expand All @@ -20,7 +20,7 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';
*/
const main = async () => {
const { api, specName, chainName, safeXcmVersion } = await constructApiPromise(
'wss://rococo-asset-hub-rpc.polkadot.io',
'wss://paseo-asset-hub-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, {
chainName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssetsUsingTypeAndThen` call to send MUSE (foreign asset with location `{"parents":"1","interior":{"X1":{"Parachain":"3369"}}}`)
* from a Rococo Asset Hub (System Parachain) account
* to a Rhala Testnet (ParaChain) account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* from a Paseo Asset Hub (System Parachain) account
* to a Hydration Paseo (ParaChain) account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* `weightLimit` option provided which declares that the tx will allow unlimited weight to be used for fees.
* * The `paysWithFeeDest` value is set to pay fees with `MUSE` and the values for `assetTransferType` and `feesTransferType`
* are both set to `LocalReserve` specifying that the reserve location to be used for transfers and fees is AssetHub.
Expand All @@ -19,14 +19,14 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion, chainName } = await constructApiPromise(
'wss://rococo-asset-hub-rpc.polkadot.io',
'wss://paseo-asset-hub-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, { chainName });

let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
'2004',
'2034',
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
[`{"parents":"1","interior":{"X1":{"Parachain":"3369"}}}`],
['1000000000000'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';

/**
* In this example we are creating a `polkadotXcm` pallet `transferAssetsUsingTypeAndThen` call to send WETH (foreign asset with location `{"parents":"2","interior":{"X2":[{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}},{"AccountKey20":{"network":null,"key":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14"}}]}}`)
* from a Rococo Asset Hub (System Parachain) account
* to a Rhala Testnet (ParaChain) account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* from a Paseo Asset Hub (System Parachain) account
* to a Hydration Paseo (ParaChain) account, where the `xcmVersion` is set to safeXcmVersion, and there is no
* `weightLimit` option provided which declares that the tx will allow unlimited weight to be used for fees.
* The `paysWithFeeDest` value is set to pay fees with WETH and the values for `assetTransferType` and `feesTransferType`
* are both set to `LocalReserve` specifying that the reserve location to be used for transfers and fees is AssetHub.
Expand All @@ -19,14 +19,14 @@ import { GREEN, PURPLE, RESET } from '../../../../colors';
*/
const main = async () => {
const { api, specName, safeXcmVersion, chainName } = await constructApiPromise(
'wss://rococo-asset-hub-rpc.polkadot.io',
'wss://paseo-asset-hub-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion, { chainName });

let callInfo: TxResult<'call'>;
try {
callInfo = await assetApi.createTransferTransaction(
'2004',
'2034',
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
[
`{"parents":"2","interior":{"X2":[{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}},{"AccountKey20":{"network":null,"key":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14"}}]}}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import { TxResult } from '../../../../src/types';
import { GREEN, PURPLE, RESET } from '../../../colors';

/**
* In this example we are creating a `transferAssets` payload to send 1 ROC
* from a Rococo Asset Hub (System Parachain) account
* to a Basilisk (Parachain) account, where the `xcmVersion` is set to safeXcmVersion and no `weightLimit` is provided declaring that
* In this example we are creating a `transferAssets` payload to send 1 PAS
* from a Paseo Asset Hub (System Parachain) account
* to a Hydration Paseo (Parachain) account, where the `xcmVersion` is set to safeXcmVersion and no `weightLimit` is provided declaring that
* the allowable weight will be `unlimited` and `paysWithFeeOrigin` is asset location `{"parents":"1","interior":{"X1":{"Parachain":"3369"}}}` (MUSE)
* declaring that `MUSE` `should be used to pay for tx fees in the origin. In order to pay fees on the origin with a different asset than the native asset, the selected asset is expected to have an existing liquidity pool/pair with the native asset in AssetHub.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://rococo-asset-hub-rpc.polkadot.io');
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://paseo-asset-hub-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);

let payloadInfo: TxResult<'payload'>;
try {
payloadInfo = await assetApi.createTransferTransaction(
'2090',
'2034',
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
[''],
['1000000'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { TxResult } from '../../../../src/types';
import { GREEN, PURPLE, RESET } from '../../../colors';

/**
* In this example we are creating an `xcmPallet` `transferAssetsUsingTypeAndThen` call to send 1 ROC (asset with location `{"parents":"0","interior":{"Here":""}}`)
* from a Rococo (Relay Chain) account
* In this example we are creating an `xcmPallet` `transferAssetsUsingTypeAndThen` call to send 1 PAS (asset with location `{"parents":"0","interior":{"Here":""}}`)
* from a Paseo (Relay Chain) account
* to a Westend Asset Hub account, where the `xcmVersion` is set to 4 and no `weightLimit` option is provided declaring that
* the tx will allow unlimited weight to be used for fees.
* The `paysWithFeeDest` value is set to pay fees with ROC and the values for `assetTransferType` and `feesTransferType`
* are both set to the `RemoteReserve` location of Rococo AssetHub, specifying that the reserve location to be used for transferring and fees is Rococo AssetHub.
* The `paysWithFeeDest` value is set to pay fees with PAS and the values for `assetTransferType` and `feesTransferType`
* are both set to the `RemoteReserve` location of Paseo AssetHub, specifying that the reserve location to be used for transferring and fees is Paseo AssetHub.
*
* NOTE: To specify the amount of weight for the tx to use provide a `weightLimit` option containing desired values for `refTime` and `proofSize`.
*/
const main = async () => {
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://rococo-rpc.polkadot.io');
const { api, specName, safeXcmVersion } = await constructApiPromise('wss://paseo-rpc.polkadot.io');
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);

let callInfo: TxResult<'call'>;
Expand Down
Loading

0 comments on commit da53859

Please sign in to comment.