From c82166829ee427452ee97a92ab7074daa608c9b1 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Tue, 26 Dec 2023 16:52:59 +1300 Subject: [PATCH 01/13] -wip- initial commit --- packages/config/src/assets.ts | 6 +++ packages/config/src/chains.ts | 30 ++++++++++++++ packages/config/src/configs/index.ts | 2 + packages/config/src/configs/moonbaseAlpha.ts | 28 +++++++++++++ .../config/src/configs/pendulumAlphanet.ts | 41 +++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 packages/config/src/configs/pendulumAlphanet.ts diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index 59ae920e..cc0da809 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -10,6 +10,11 @@ export const alan = new Asset({ originSymbol: 'ALAN', }); +export const ampe = new Asset({ + key: 'ampe', + originSymbol: 'AMPE', +}); + export const astr = new Asset({ key: 'astr', originSymbol: 'ASTR', @@ -308,6 +313,7 @@ export const ztg = new Asset({ export const assetsList: Asset[] = [ aca, alan, + ampe, astr, atom, auq, diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 6b2acd87..896da50f 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -7,6 +7,7 @@ import { import { aca, alan, + ampe, aseed, astr, atom, @@ -689,6 +690,10 @@ export const moonbaseAlpha = new EvmParachain({ id: '0x9133c5a22024118804089f1fB752b7B2ce2a6351', metadataId: 0, // no metadata for ERC20 tokens }, + { + asset: ampe, + id: '170050401128744171791743427490841452054', + }, { asset: atom, id: '244316754493307480955066032215622931381', @@ -1150,6 +1155,30 @@ export const parallelHeiko = new Parachain({ ws: 'wss://heiko-rpc.parallel.fi', }); +export const pendulumAlphanet = new Parachain({ + assetsData: [ + { + asset: ampe, + id: 'Native', + metadataId: 0, + }, + { + asset: dev, + decimals: 18, + id: { XCM: 1 }, + }, + ], + ecosystem: Ecosystem.AlphanetRelay, + genesisHash: + '0x3db2074093ab964732631d842b99d6612a6dc75a379738a660642b05ccad59c8', + isTestChain: true, + key: 'pendulum-alphanet', + name: 'Foucoco', + parachainId: 2124, + ss58Format: 49, + ws: 'wss://moonbeam-00.pendulumchain.tech:443', +}); + export const phala = new Parachain({ assetsData: [ { @@ -1418,6 +1447,7 @@ export const chainsList: AnyChain[] = [ originTrailAlphanet, parallel, parallelHeiko, + pendulumAlphanet, phala, picasso, picassoAlphanet, diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index 77538590..f1597b49 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -34,6 +34,7 @@ import { originTrailConfig } from './originTrail'; import { originTrailAlphanetConfig } from './originTrailAlphanet'; import { parallelConfig } from './parallel'; import { parallelHeikoConfig } from './parallelHeiko'; +import { pendulumAlphanetConfig } from './pendulumAlphanet'; import { phalaConfig } from './phala'; import { picassoConfig } from './picasso'; import { picassoAlphanetConfig } from './picassoAlphanet'; @@ -80,6 +81,7 @@ export const chainsConfigList: ChainConfig[] = [ originTrailAlphanetConfig, parallelConfig, parallelHeikoConfig, + pendulumAlphanetConfig, phalaConfig, picassoConfig, picassoAlphanetConfig, diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index ee4d7478..dc0d36c9 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -1,6 +1,7 @@ import { BalanceBuilder, ContractBuilder } from '@moonbeam-network/xcm-builder'; import { alan, + ampe, atom, dev, eq, @@ -22,6 +23,7 @@ import { moonbaseAlpha, moonbaseBeta, originTrailAlphanet, + pendulumAlphanet, picassoAlphanet, turingAlphanet, } from '../chains'; @@ -63,6 +65,17 @@ export const moonbaseAlphaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: dev, + balance: BalanceBuilder().substrate().system().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulumAlphanet, + destinationFee: { + amount: 0.0000001, // TODO + asset: dev, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: dev, balance: BalanceBuilder().substrate().system().account(), @@ -104,6 +117,21 @@ export const moonbaseAlphaConfig = new ChainConfig({ // balance: BalanceBuilder().substrate().system().account(), // }, // }), + new AssetConfig({ + asset: ampe, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulumAlphanet, + destinationFee: { + amount: 0.1, // TODO + asset: ampe, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: dev, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: eq, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/config/src/configs/pendulumAlphanet.ts b/packages/config/src/configs/pendulumAlphanet.ts new file mode 100644 index 00000000..6827d549 --- /dev/null +++ b/packages/config/src/configs/pendulumAlphanet.ts @@ -0,0 +1,41 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, + FeeBuilder, +} from '@moonbeam-network/xcm-builder'; +import { ampe, dev } from '../assets'; +import { moonbaseAlpha, pendulumAlphanet } from '../chains'; +import { AssetConfig } from '../types/AssetConfig'; +import { ChainConfig } from '../types/ChainConfig'; + +export const pendulumAlphanetConfig = new ChainConfig({ + assets: [ + new AssetConfig({ + asset: ampe, + balance: BalanceBuilder().substrate().system().account(), + destination: moonbaseAlpha, + destinationFee: { + amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), + asset: ampe, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetConfig({ + asset: dev, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: moonbaseAlpha, + destinationFee: { + amount: 0.01, + asset: dev, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: ampe, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + ], + chain: pendulumAlphanet, +}); From aa0f8477f5a851320e45612ece7a356cbc79c437 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 17:16:29 +1300 Subject: [PATCH 02/13] fix genesis hash and ss58 --- packages/config/src/chains.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 896da50f..6ba801b2 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -1170,12 +1170,12 @@ export const pendulumAlphanet = new Parachain({ ], ecosystem: Ecosystem.AlphanetRelay, genesisHash: - '0x3db2074093ab964732631d842b99d6612a6dc75a379738a660642b05ccad59c8', + '0xe83b546ddeccf999d4b7fef4d83271034e82bb5db538e769c242c2731f61e8d6', isTestChain: true, key: 'pendulum-alphanet', name: 'Foucoco', parachainId: 2124, - ss58Format: 49, + ss58Format: 57, ws: 'wss://moonbeam-00.pendulumchain.tech:443', }); From 7b7a0a81745536b79cd2e538177ebd487c060bff Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 21:07:16 +1300 Subject: [PATCH 03/13] apply unlimited weight to precompile calls --- .vscode/settings.json | 4 ++-- .../builder/src/contract/contracts/Xtokens/Xtokens.ts | 8 ++++---- packages/config/src/configs/moonbaseAlpha.ts | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 26ef47ff..31aad05b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ "editor.formatOnSaveMode": "file", "typescript.preferences.importModuleSpecifier": "relative", "editor.codeActionsOnSave": { - "source.organizeImports": true, - "source.fixAll.eslint": true + "source.organizeImports": "explicit", + "source.fixAll.eslint": "explicit" } } diff --git a/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts b/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts index 56afd29e..6fee58d5 100644 --- a/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts +++ b/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts @@ -6,9 +6,11 @@ import { decodeAddress } from '@polkadot/util-crypto'; import { ContractConfigBuilder } from '../../ContractBuilder.interfaces'; import { ContractConfig } from '../../ContractConfig'; +const U_64_MAX = 18446744073709551615n; + export function Xtokens() { return { - transfer: (weight = 4_000_000_000): ContractConfigBuilder => ({ + transfer: (weight = U_64_MAX): ContractConfigBuilder => ({ build: ({ address, amount, asset, destination }) => new ContractConfig({ args: [ @@ -21,9 +23,7 @@ export function Xtokens() { module: 'Xtokens', }), }), - transferMultiCurrencies: ( - weight = 4_000_000_000, - ): ContractConfigBuilder => ({ + transferMultiCurrencies: (weight = U_64_MAX): ContractConfigBuilder => ({ build: ({ address, amount, asset, destination, fee, feeAsset }) => new ContractConfig({ args: [ diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index dc0d36c9..dea9b312 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -71,7 +71,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transfer(), destination: pendulumAlphanet, destinationFee: { - amount: 0.0000001, // TODO + amount: 0.0000001, asset: dev, balance: BalanceBuilder().substrate().system().account(), }, @@ -123,7 +123,7 @@ export const moonbaseAlphaConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transfer(), destination: pendulumAlphanet, destinationFee: { - amount: 0.1, // TODO + amount: 0.001, asset: ampe, balance: BalanceBuilder().substrate().assets().account(), }, From 56814d89287e32511be934e7d14152baef6b13c7 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 21:16:48 +1300 Subject: [PATCH 04/13] revert changes in settings test --- .vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 31aad05b..26ef47ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ "editor.formatOnSaveMode": "file", "typescript.preferences.importModuleSpecifier": "relative", "editor.codeActionsOnSave": { - "source.organizeImports": "explicit", - "source.fixAll.eslint": "explicit" + "source.organizeImports": true, + "source.fixAll.eslint": true } } From 2de8db325bcd4a717dab57361455995e03113d73 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 21:28:05 +1300 Subject: [PATCH 05/13] change script execution --- .github/workflows/publish-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 79268333..75d9ec4e 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -22,7 +22,7 @@ jobs: - run: npm ci --ignore-scripts - name: ✌️ Update versions - run: npx ts-node --esm ./scripts/update-dev-versions.ts + run: npx ts-node-esm ./scripts/update-dev-versions.ts - name: 🛠️ Build run: npm run build From 3d30278719e371d4c49506b333001d9a0c7e195e Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 21:38:17 +1300 Subject: [PATCH 06/13] add changeset --- .changeset/cuddly-hairs-speak.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/cuddly-hairs-speak.md diff --git a/.changeset/cuddly-hairs-speak.md b/.changeset/cuddly-hairs-speak.md new file mode 100644 index 00000000..0707f037 --- /dev/null +++ b/.changeset/cuddly-hairs-speak.md @@ -0,0 +1,7 @@ +--- +'@moonbeam-network/xcm-builder': patch +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Pendulum integration with Moonbase From 31c2956c61a5c6f4e549f220ec0362eea8b362fb Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 22:04:33 +1300 Subject: [PATCH 07/13] install bun for scripts --- .github/workflows/publish-dev.yml | 2 +- .vscode/settings.json | 4 +- examples/sdk-simple/package.json | 4 +- package-lock.json | 149 ++++++++++++++++++++++++++++-- package.json | 2 +- 5 files changed, 146 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index 75d9ec4e..4e9b1d4f 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -22,7 +22,7 @@ jobs: - run: npm ci --ignore-scripts - name: ✌️ Update versions - run: npx ts-node-esm ./scripts/update-dev-versions.ts + run: npx bun ./scripts/update-dev-versions.ts - name: 🛠️ Build run: npm run build diff --git a/.vscode/settings.json b/.vscode/settings.json index 26ef47ff..31aad05b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,7 +38,7 @@ "editor.formatOnSaveMode": "file", "typescript.preferences.importModuleSpecifier": "relative", "editor.codeActionsOnSave": { - "source.organizeImports": true, - "source.fixAll.eslint": true + "source.organizeImports": "explicit", + "source.fixAll.eslint": "explicit" } } diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index cb021f41..62f1e4f1 100644 --- a/examples/sdk-simple/package.json +++ b/examples/sdk-simple/package.json @@ -6,7 +6,7 @@ "type": "module", "main": "index.ts", "scripts": { - "start": "ts-node --esm index.ts" + "start": "bun index.ts" }, "keywords": [], "author": "", @@ -17,6 +17,6 @@ "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { - "ts-node": "^10.9.1" + "bun": "^1.0.20" } } diff --git a/package-lock.json b/package-lock.json index da2ff33d..194eb4aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.59.8", + "bun": "^1.0.20", "dotenv": "^16.3.1", "eslint": "^8.41.0", "eslint-config-airbnb-base": "^15.0.0", @@ -38,7 +39,6 @@ "lint-staged": "^13.2.3", "prettier": "^2.8.8", "ts-jest": "^29.1.0", - "ts-node": "^10.9.1", "tsup": "^6.7.0", "turbo": "^1.9.9", "typescript": "^5.0.4", @@ -54,7 +54,7 @@ "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { - "ts-node": "^10.9.1" + "bun": "^1.0.20" } }, "node_modules/@acala-network/type-definitions": { @@ -1016,6 +1016,8 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -1028,6 +1030,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -4054,6 +4058,84 @@ "lodash.merge": "^4.6.2" } }, + "node_modules/@oven/bun-darwin-aarch64": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.0.20.tgz", + "integrity": "sha512-8eB/OtkCuesoUI8qk6CywuJ+OSH5rk3LDStn2+c91dmHhXZ5q++D8nJKNOkyRh4nWsR3q2loav+CPQddbEJp9g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.0.20.tgz", + "integrity": "sha512-esoLmnV8/FrAMb1DaXdmPJXni1Ow7wjOd6qoq6yd/CkMwkO2LIGBOpR1fG31QKW78GgsHiDFi4NfyNBVvOc/mA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-darwin-x64-baseline": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.0.20.tgz", + "integrity": "sha512-QF1Bja1lhKjG25UkTkZ1VzJ9ZzkVPppskSKX/y2zx8xwKPlCgoxLXrvx4edKpqIgbD0zGTSRO8EOuPn/VbGDAA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oven/bun-linux-aarch64": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.0.20.tgz", + "integrity": "sha512-Zy4PwUb1JRnBoPc3N9S1XtMzRIz+2R5VME9O08bFRlj2sg2mf7bSFElavsRTTEPys5X/QJU3E3GngWFxKpc4Vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.0.20.tgz", + "integrity": "sha512-1iA6EFGfAGCPbmEvRXCmayoFZXNm/8KrLF5RJt51FBt1mHmbVE7vX/xOexAQbh69bO1EFy6ruslPV3arLLie+g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oven/bun-linux-x64-baseline": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.0.20.tgz", + "integrity": "sha512-lZUcUsq4Fk3CxhF5UhZhB2hhNViYzAFPprL47LxuFuvtybPtXVCOCyGSP37MiMfA6QxE+nNW6w7oJQqXkC1exg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@parallel-finance/type-definitions": { "version": "1.7.17", "resolved": "https://registry.npmjs.org/@parallel-finance/type-definitions/-/type-definitions-1.7.17.tgz", @@ -5648,25 +5730,33 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.1", @@ -6258,6 +6348,8 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, + "optional": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -6375,7 +6467,9 @@ "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/argparse": { "version": "1.0.10", @@ -6898,6 +6992,33 @@ "node": ">=6.14.2" } }, + "node_modules/bun": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/bun/-/bun-1.0.20.tgz", + "integrity": "sha512-dBTDB8ombE6JzBgxRqY1GCjl5gcYziNcC9lvgqXx7bnq+bTBeW3rd8TKIgPNmmJbdwXTLJRe/5G7E2Po4CxGlA==", + "cpu": [ + "arm64", + "x64" + ], + "dev": true, + "hasInstallScript": true, + "os": [ + "darwin", + "linux" + ], + "bin": { + "bun": "bin/bun", + "bunx": "bin/bun" + }, + "optionalDependencies": { + "@oven/bun-darwin-aarch64": "1.0.20", + "@oven/bun-darwin-x64": "1.0.20", + "@oven/bun-darwin-x64-baseline": "1.0.20", + "@oven/bun-linux-aarch64": "1.0.20", + "@oven/bun-linux-x64": "1.0.20", + "@oven/bun-linux-x64-baseline": "1.0.20" + } + }, "node_modules/bundle-require": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.0.1.tgz", @@ -7300,7 +7421,9 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/cross-spawn": { "version": "7.0.3", @@ -7530,6 +7653,8 @@ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true, + "optional": true, + "peer": true, "engines": { "node": ">=0.3.1" } @@ -15749,6 +15874,8 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -16301,7 +16428,9 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/v8-to-istanbul": { "version": "9.1.0", @@ -16827,6 +16956,8 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, + "optional": true, + "peer": true, "engines": { "node": ">=6" } diff --git a/package.json b/package.json index f346ee92..2a72cf45 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.59.8", + "bun": "^1.0.20", "dotenv": "^16.3.1", "eslint": "^8.41.0", "eslint-config-airbnb-base": "^15.0.0", @@ -61,7 +62,6 @@ "lint-staged": "^13.2.3", "prettier": "^2.8.8", "ts-jest": "^29.1.0", - "ts-node": "^10.9.1", "tsup": "^6.7.0", "turbo": "^1.9.9", "typescript": "^5.0.4", From ad162b0d1cd76c57dae5fb413e47e8c9e0280905 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 22:07:54 +1300 Subject: [PATCH 08/13] remove ts-node from tsconfig --- tsconfig.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 08977a70..7844f7d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,10 +18,5 @@ "allowSyntheticDefaultImports": true, "resolveJsonModule": true }, - "ts-node": { - "moduleTypes": { - "jest.config.ts": "cjs" - } - }, "exclude": ["node_modules", "dist", "build"] } From 147265ae62f592e11c8a3ea18cb5281b1cc16131 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 22:12:37 +1300 Subject: [PATCH 09/13] revert tsconfig changes --- tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index 7844f7d6..08977a70 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,5 +18,10 @@ "allowSyntheticDefaultImports": true, "resolveJsonModule": true }, + "ts-node": { + "moduleTypes": { + "jest.config.ts": "cjs" + } + }, "exclude": ["node_modules", "dist", "build"] } From f1ed7577cae4c5de66b1b7fe4d9f2c9aeaa5928b Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Thu, 28 Dec 2023 22:54:23 +1300 Subject: [PATCH 10/13] Pendulum - Moonbeam config --- packages/config/src/assets.ts | 6 ++++ packages/config/src/chains.ts | 29 +++++++++++++++++ packages/config/src/configs/index.ts | 2 ++ packages/config/src/configs/moonbeam.ts | 17 ++++++++++ packages/config/src/configs/pendulum.ts | 41 +++++++++++++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 packages/config/src/configs/pendulum.ts diff --git a/packages/config/src/assets.ts b/packages/config/src/assets.ts index cc0da809..c23b67bc 100644 --- a/packages/config/src/assets.ts +++ b/packages/config/src/assets.ts @@ -180,6 +180,11 @@ export const paring = new Asset({ originSymbol: 'PARING', }); +export const pen = new Asset({ + key: 'pen', + originSymbol: 'PEN', +}); + export const pha = new Asset({ key: 'pha', originSymbol: 'PHA', @@ -346,6 +351,7 @@ export const assetsList: Asset[] = [ otp, para, paring, + pen, pha, pica, ring, diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 6ba801b2..471a0b30 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -41,6 +41,7 @@ import { otp, para, paring, + pen, pha, pica, ring, @@ -873,6 +874,10 @@ export const moonbeam = new EvmParachain({ asset: pha, id: '132685552157663328694213725410064821485', }, + { + asset: pen, + id: '45647473099451451833602657905356404688', + }, { asset: ring, id: '125699734534028342599692732320197985871', @@ -1155,6 +1160,29 @@ export const parallelHeiko = new Parachain({ ws: 'wss://heiko-rpc.parallel.fi', }); +export const pendulum = new Parachain({ + assetsData: [ + { + asset: pen, + id: 'Native', + metadataId: 0, + }, + { + asset: glmr, + decimals: 18, + id: { XCM: 1 }, + }, + ], + ecosystem: Ecosystem.Polkadot, + genesisHash: + '0x5d3c298622d5634ed019bf61ea4b71655030015bde9beb0d6a24743714462c86', + key: 'pendulum', + name: 'Pendulum', + parachainId: 2094, + ss58Format: 56, + ws: 'wss://pendulum-rpc.dwellir.com/', +}); + export const pendulumAlphanet = new Parachain({ assetsData: [ { @@ -1447,6 +1475,7 @@ export const chainsList: AnyChain[] = [ originTrailAlphanet, parallel, parallelHeiko, + pendulum, pendulumAlphanet, phala, picasso, diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index f1597b49..1a09e5d9 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -34,6 +34,7 @@ import { originTrailConfig } from './originTrail'; import { originTrailAlphanetConfig } from './originTrailAlphanet'; import { parallelConfig } from './parallel'; import { parallelHeikoConfig } from './parallelHeiko'; +import { pendulumConfig } from './pendulum'; import { pendulumAlphanetConfig } from './pendulumAlphanet'; import { phalaConfig } from './phala'; import { picassoConfig } from './picasso'; @@ -81,6 +82,7 @@ export const chainsConfigList: ChainConfig[] = [ originTrailAlphanetConfig, parallelConfig, parallelHeikoConfig, + pendulumConfig, pendulumAlphanetConfig, phalaConfig, picassoConfig, diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index ea6c8878..b88a75b3 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -18,6 +18,7 @@ import { nodl, otp, para, + pen, pha, ring, sub, @@ -45,6 +46,7 @@ import { nodle, originTrail, parallel, + pendulum, phala, polkadot, polkadotAssetHub, @@ -579,6 +581,21 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulum, + destinationFee: { + amount: 0.01, + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: sub, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/config/src/configs/pendulum.ts b/packages/config/src/configs/pendulum.ts new file mode 100644 index 00000000..1e232f69 --- /dev/null +++ b/packages/config/src/configs/pendulum.ts @@ -0,0 +1,41 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, + FeeBuilder, +} from '@moonbeam-network/xcm-builder'; +import { glmr, pen } from '../assets'; +import { moonbeam, pendulum } from '../chains'; +import { AssetConfig } from '../types/AssetConfig'; +import { ChainConfig } from '../types/ChainConfig'; + +export const pendulumConfig = new ChainConfig({ + assets: [ + new AssetConfig({ + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + destination: moonbeam, + destinationFee: { + amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetConfig({ + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: moonbeam, + destinationFee: { + amount: 0.01, // TODO + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: pen, + balance: BalanceBuilder().substrate().system().account(), + }, + }), + ], + chain: pendulum, +}); From 71ee2878876bad059f487a488c3cc3ecf84c679f Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Fri, 29 Dec 2023 21:06:03 +1300 Subject: [PATCH 11/13] finish config --- packages/config/src/chains.ts | 4 +-- packages/config/src/configs/moonbeam.ts | 41 ++++++++++++++++--------- packages/config/src/configs/pendulum.ts | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 471a0b30..3eda27a3 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -1170,7 +1170,7 @@ export const pendulum = new Parachain({ { asset: glmr, decimals: 18, - id: { XCM: 1 }, + id: { XCM: 6 }, }, ], ecosystem: Ecosystem.Polkadot, @@ -1180,7 +1180,7 @@ export const pendulum = new Parachain({ name: 'Pendulum', parachainId: 2094, ss58Format: 56, - ws: 'wss://pendulum-rpc.dwellir.com/', + ws: 'wss://rpc-pendulum.prd.pendulumchain.tech', }); export const pendulumAlphanet = new Parachain({ diff --git a/packages/config/src/configs/moonbeam.ts b/packages/config/src/configs/moonbeam.ts index b88a75b3..3d9c281e 100644 --- a/packages/config/src/configs/moonbeam.ts +++ b/packages/config/src/configs/moonbeam.ts @@ -146,6 +146,17 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulum, + destinationFee: { + amount: 0.0002, // + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: aca, balance: BalanceBuilder().substrate().assets().account(), @@ -356,6 +367,21 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), + new AssetConfig({ + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + contract: ContractBuilder().Xtokens().transfer(), + destination: pendulum, + destinationFee: { + amount: 0.01, + asset: pen, + balance: BalanceBuilder().substrate().assets().account(), + }, + fee: { + asset: glmr, + balance: BalanceBuilder().substrate().system().account(), + }, + }), new AssetConfig({ asset: pha, balance: BalanceBuilder().substrate().assets().account(), @@ -581,21 +607,6 @@ export const moonbeamConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: pen, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: pendulum, - destinationFee: { - amount: 0.01, - asset: pen, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: glmr, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: sub, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/config/src/configs/pendulum.ts b/packages/config/src/configs/pendulum.ts index 1e232f69..a8876599 100644 --- a/packages/config/src/configs/pendulum.ts +++ b/packages/config/src/configs/pendulum.ts @@ -26,7 +26,7 @@ export const pendulumConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.01, // TODO + amount: 0.01, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, From e04af3aed16958f679bc5679a9dc74b29b82c82d Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Fri, 29 Dec 2023 21:09:10 +1300 Subject: [PATCH 12/13] remove changeset --- .changeset/cuddly-hairs-speak.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .changeset/cuddly-hairs-speak.md diff --git a/.changeset/cuddly-hairs-speak.md b/.changeset/cuddly-hairs-speak.md deleted file mode 100644 index 0707f037..00000000 --- a/.changeset/cuddly-hairs-speak.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@moonbeam-network/xcm-builder': patch -'@moonbeam-network/xcm-config': patch -'@moonbeam-network/xcm-sdk': patch ---- - -Pendulum integration with Moonbase From 74fc050c283257eb5d0da1a658b626592e497524 Mon Sep 17 00:00:00 2001 From: Mario J Maurello Date: Fri, 29 Dec 2023 21:10:11 +1300 Subject: [PATCH 13/13] add changeset --- .changeset/dirty-buckets-relax.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dirty-buckets-relax.md diff --git a/.changeset/dirty-buckets-relax.md b/.changeset/dirty-buckets-relax.md new file mode 100644 index 00000000..10dc189e --- /dev/null +++ b/.changeset/dirty-buckets-relax.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Pendulum integration with Moonbeam