From 87471713dfda8345a0cbc902fc3d8b28a5e78cee Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:22:21 +0200 Subject: [PATCH 1/8] Adjust GLMR amount for fees (#340) * double GLMR fees for wormhole assets * add changeset --- .changeset/silver-bees-kneel.md | 5 +++++ packages/config/src/configs/hydration.ts | 10 +++++----- packages/config/src/configs/peaq.ts | 10 +++++----- packages/config/src/configs/peaqEvm.ts | 10 +++++----- packages/config/src/configs/pendulum.ts | 2 +- packages/config/src/configs/zeitgeist.ts | 2 +- 6 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 .changeset/silver-bees-kneel.md diff --git a/.changeset/silver-bees-kneel.md b/.changeset/silver-bees-kneel.md new file mode 100644 index 00000000..235eecba --- /dev/null +++ b/.changeset/silver-bees-kneel.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-config': patch +--- + +Increase GLMR sent along for fees diff --git a/packages/config/src/configs/hydration.ts b/packages/config/src/configs/hydration.ts index 5d6e4ec7..03011e73 100644 --- a/packages/config/src/configs/hydration.ts +++ b/packages/config/src/configs/hydration.ts @@ -37,7 +37,7 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -52,7 +52,7 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -67,7 +67,7 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -82,7 +82,7 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, @@ -97,7 +97,7 @@ export const hydrationConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, diff --git a/packages/config/src/configs/peaq.ts b/packages/config/src/configs/peaq.ts index f4b1b696..d9fbb651 100644 --- a/packages/config/src/configs/peaq.ts +++ b/packages/config/src/configs/peaq.ts @@ -39,7 +39,7 @@ export const peaqConfig = new ChainConfig({ balance: BalanceBuilder().substrate().assets().account(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().assets().account(), }, @@ -55,7 +55,7 @@ export const peaqConfig = new ChainConfig({ balance: BalanceBuilder().substrate().assets().account(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().assets().account(), }, @@ -71,7 +71,7 @@ export const peaqConfig = new ChainConfig({ balance: BalanceBuilder().substrate().assets().account(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().assets().account(), }, @@ -87,7 +87,7 @@ export const peaqConfig = new ChainConfig({ balance: BalanceBuilder().substrate().assets().account(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().assets().account(), }, @@ -103,7 +103,7 @@ export const peaqConfig = new ChainConfig({ balance: BalanceBuilder().substrate().assets().account(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().assets().account(), }, diff --git a/packages/config/src/configs/peaqEvm.ts b/packages/config/src/configs/peaqEvm.ts index 9cd9ae34..8b5ca789 100644 --- a/packages/config/src/configs/peaqEvm.ts +++ b/packages/config/src/configs/peaqEvm.ts @@ -32,7 +32,7 @@ export const peaqEvmConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transferMultiCurrencies(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().evm().erc20(), }, @@ -48,7 +48,7 @@ export const peaqEvmConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transferMultiCurrencies(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.1, asset: glmr, balance: BalanceBuilder().evm().erc20(), }, @@ -64,7 +64,7 @@ export const peaqEvmConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transferMultiCurrencies(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().evm().erc20(), }, @@ -80,7 +80,7 @@ export const peaqEvmConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transferMultiCurrencies(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().evm().erc20(), }, @@ -96,7 +96,7 @@ export const peaqEvmConfig = new ChainConfig({ contract: ContractBuilder().Xtokens().transferMultiCurrencies(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().evm().erc20(), }, diff --git a/packages/config/src/configs/pendulum.ts b/packages/config/src/configs/pendulum.ts index 1d963431..4850842d 100644 --- a/packages/config/src/configs/pendulum.ts +++ b/packages/config/src/configs/pendulum.ts @@ -41,7 +41,7 @@ export const pendulumConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, diff --git a/packages/config/src/configs/zeitgeist.ts b/packages/config/src/configs/zeitgeist.ts index 2fbf5d5f..329785cc 100644 --- a/packages/config/src/configs/zeitgeist.ts +++ b/packages/config/src/configs/zeitgeist.ts @@ -26,7 +26,7 @@ export const zeitgeistConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.04, + amount: 0.08, asset: glmr, balance: BalanceBuilder().substrate().tokens().accounts(), }, From 5b58b1b644d443c386313e1e60dd3fca15e329d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:23:57 +0200 Subject: [PATCH 2/8] Version Packages (#341) Co-authored-by: github-actions[bot] --- .changeset/silver-bees-kneel.md | 5 ----- examples/sdk-simple/package.json | 4 ++-- package-lock.json | 10 +++++----- packages/config/CHANGELOG.md | 6 ++++++ packages/config/package.json | 2 +- packages/sdk/CHANGELOG.md | 7 +++++++ packages/sdk/package.json | 4 ++-- 7 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 .changeset/silver-bees-kneel.md diff --git a/.changeset/silver-bees-kneel.md b/.changeset/silver-bees-kneel.md deleted file mode 100644 index 235eecba..00000000 --- a/.changeset/silver-bees-kneel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@moonbeam-network/xcm-config': patch ---- - -Increase GLMR sent along for fees diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 839bf191..8cef9fee 100644 --- a/examples/sdk-simple/package.json +++ b/examples/sdk-simple/package.json @@ -12,8 +12,8 @@ "author": "", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.9", - "@moonbeam-network/xcm-sdk": "2.5.10", + "@moonbeam-network/xcm-config": "2.5.10", + "@moonbeam-network/xcm-sdk": "2.5.11", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 6f528d12..d5fb42a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,8 +50,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.9", - "@moonbeam-network/xcm-sdk": "2.5.10", + "@moonbeam-network/xcm-config": "2.5.10", + "@moonbeam-network/xcm-sdk": "2.5.11", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { @@ -19611,7 +19611,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "2.5.9", + "version": "2.5.10", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", @@ -19625,11 +19625,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.10", + "version": "2.5.11", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.9", + "@moonbeam-network/xcm-config": "2.5.10", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index a17773f7..a930ea7c 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 2.5.10 + +### Patch Changes + +- [#340](https://github.com/moonbeam-foundation/xcm-sdk/pull/340) [`8747171`](https://github.com/moonbeam-foundation/xcm-sdk/commit/87471713dfda8345a0cbc902fc3d8b28a5e78cee) Thanks [@mmaurello](https://github.com/mmaurello)! - Increase GLMR sent along for fees + ## 2.5.9 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index e06ea2ac..9f01f6be 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "2.5.9", + "version": "2.5.10", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index b9d08ee0..ab86ad17 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonbeam-network/xcm-sdk +## 2.5.11 + +### Patch Changes + +- Updated dependencies [[`8747171`](https://github.com/moonbeam-foundation/xcm-sdk/commit/87471713dfda8345a0cbc902fc3d8b28a5e78cee)]: + - @moonbeam-network/xcm-config@2.5.10 + ## 2.5.10 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 5017a89b..16bb18d9 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.10", + "version": "2.5.11", "description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem", "scripts": { "build": "tsup", @@ -52,7 +52,7 @@ "main": "./build/index.cjs", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.9", + "@moonbeam-network/xcm-config": "2.5.10", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" From 8add299dc2edc34a8812c8f846ac314c03caa6d7 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:20:18 +0200 Subject: [PATCH 3/8] Remove Litmus configuration (#342) * remove litmus configuration * add changeset * remove litmus from config --- .changeset/polite-suits-peel.md | 5 +++++ packages/config/src/chains.ts | 18 ---------------- packages/config/src/configs/index.ts | 2 -- packages/config/src/configs/litmus.ts | 26 ------------------------ packages/config/src/configs/moonriver.ts | 17 ---------------- 5 files changed, 5 insertions(+), 63 deletions(-) create mode 100644 .changeset/polite-suits-peel.md delete mode 100644 packages/config/src/configs/litmus.ts diff --git a/.changeset/polite-suits-peel.md b/.changeset/polite-suits-peel.md new file mode 100644 index 00000000..e7b21b9e --- /dev/null +++ b/.changeset/polite-suits-peel.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-config': patch +--- + +Remove Litmus configuration diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index d00591f8..9042a4f1 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -675,23 +675,6 @@ export const kusamaAssetHub = new Parachain({ ], }); -export const litmus = new Parachain({ - assetsData: [ - { - asset: lit, - id: 'SelfReserve', - }, - ], - ecosystem: Ecosystem.Kusama, - genesisHash: - '0xda5831fbc8570e3c6336d0d72b8c08f8738beefec812df21ef2afc2982ede09c', - key: 'litmus', - name: 'Litmus', - parachainId: 2106, - ss58Format: 131, - ws: ['wss://rpc.litmus-parachain.litentry.io'], -}); - export const mangataKusama = new Parachain({ assetsData: [ { @@ -1948,7 +1931,6 @@ export const chainsList: AnyChain[] = [ khala, kintsugi, kusama, - litmus, mangataKusama, mantaParachain, moonbaseAlpha, diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index b47b48ba..bcbfa77b 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -20,7 +20,6 @@ import { khalaConfig } from './khala'; import { kintsugiConfig } from './kintsugi'; import { kusamaConfig } from './kusama'; import { kusamaAssetHubConfig } from './kusamaAssetHub'; -import { litmusConfig } from './litmus'; import { mangataKusamaConfig } from './mangataKusama'; import { mantaParachainConfig } from './mantaParachain'; import { moonbaseAlphaConfig } from './moonbaseAlpha'; @@ -70,7 +69,6 @@ export const chainsConfigList: ChainConfig[] = [ khalaConfig, kintsugiConfig, kusamaConfig, - litmusConfig, mangataKusamaConfig, mantaParachainConfig, moonbaseAlphaConfig, diff --git a/packages/config/src/configs/litmus.ts b/packages/config/src/configs/litmus.ts deleted file mode 100644 index 441cadba..00000000 --- a/packages/config/src/configs/litmus.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - BalanceBuilder, - ExtrinsicBuilder, - FeeBuilder, -} from '@moonbeam-network/xcm-builder'; -import { lit } from '../assets'; -import { litmus, moonriver } from '../chains'; -import { AssetConfig } from '../types/AssetConfig'; -import { ChainConfig } from '../types/ChainConfig'; - -export const litmusConfig = new ChainConfig({ - assets: [ - new AssetConfig({ - asset: lit, - balance: BalanceBuilder().substrate().system().account(), - destination: moonriver, - destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), - asset: lit, - balance: BalanceBuilder().substrate().system().account(), - }, - extrinsic: ExtrinsicBuilder().xTokens().transfer(), - }), - ], - chain: litmus, -}); diff --git a/packages/config/src/configs/moonriver.ts b/packages/config/src/configs/moonriver.ts index 4984eb91..5c7658d1 100644 --- a/packages/config/src/configs/moonriver.ts +++ b/packages/config/src/configs/moonriver.ts @@ -9,7 +9,6 @@ import { kint, kma, ksm, - lit, mgx, movr, pha, @@ -36,7 +35,6 @@ import { kintsugi, kusama, kusamaAssetHub, - litmus, mangataKusama, moonriver, picasso, @@ -284,21 +282,6 @@ export const moonriverConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: lit, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: litmus, - destinationFee: { - amount: 0.0032, - asset: lit, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: movr, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: mgx, balance: BalanceBuilder().substrate().assets().account(), From f04570c195b959090c7752e06aae45c61a9a1e39 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:21:37 +0200 Subject: [PATCH 4/8] Version Packages (#343) Co-authored-by: github-actions[bot] --- .changeset/polite-suits-peel.md | 5 ----- examples/sdk-simple/package.json | 4 ++-- package-lock.json | 10 +++++----- packages/config/CHANGELOG.md | 6 ++++++ packages/config/package.json | 2 +- packages/sdk/CHANGELOG.md | 7 +++++++ packages/sdk/package.json | 4 ++-- 7 files changed, 23 insertions(+), 15 deletions(-) delete mode 100644 .changeset/polite-suits-peel.md diff --git a/.changeset/polite-suits-peel.md b/.changeset/polite-suits-peel.md deleted file mode 100644 index e7b21b9e..00000000 --- a/.changeset/polite-suits-peel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@moonbeam-network/xcm-config': patch ---- - -Remove Litmus configuration diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 8cef9fee..574f6cb8 100644 --- a/examples/sdk-simple/package.json +++ b/examples/sdk-simple/package.json @@ -12,8 +12,8 @@ "author": "", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.10", - "@moonbeam-network/xcm-sdk": "2.5.11", + "@moonbeam-network/xcm-config": "2.5.11", + "@moonbeam-network/xcm-sdk": "2.5.12", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index d5fb42a5..f8008388 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,8 +50,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.10", - "@moonbeam-network/xcm-sdk": "2.5.11", + "@moonbeam-network/xcm-config": "2.5.11", + "@moonbeam-network/xcm-sdk": "2.5.12", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { @@ -19611,7 +19611,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "2.5.10", + "version": "2.5.11", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", @@ -19625,11 +19625,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.11", + "version": "2.5.12", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.10", + "@moonbeam-network/xcm-config": "2.5.11", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index a930ea7c..2c38b1b5 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 2.5.11 + +### Patch Changes + +- [#342](https://github.com/moonbeam-foundation/xcm-sdk/pull/342) [`8add299`](https://github.com/moonbeam-foundation/xcm-sdk/commit/8add299dc2edc34a8812c8f846ac314c03caa6d7) Thanks [@mmaurello](https://github.com/mmaurello)! - Remove Litmus configuration + ## 2.5.10 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 9f01f6be..7570c6b4 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "2.5.10", + "version": "2.5.11", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index ab86ad17..c3f498f1 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonbeam-network/xcm-sdk +## 2.5.12 + +### Patch Changes + +- Updated dependencies [[`8add299`](https://github.com/moonbeam-foundation/xcm-sdk/commit/8add299dc2edc34a8812c8f846ac314c03caa6d7)]: + - @moonbeam-network/xcm-config@2.5.11 + ## 2.5.11 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 16bb18d9..8626b7e2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.11", + "version": "2.5.12", "description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem", "scripts": { "build": "tsup", @@ -52,7 +52,7 @@ "main": "./build/index.cjs", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.10", + "@moonbeam-network/xcm-config": "2.5.11", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" From 6fe69b230b4d44c717d9ec7ff73bbc6282b1385e Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:29:10 +0200 Subject: [PATCH 5/8] Change relay chains configuration (#345) * add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains * add changeset --- .changeset/orange-lemons-prove.md | 6 ++ .../extrinsic/ExtrinsicBuilder.interfaces.ts | 1 + .../extrinsic/pallets/xcmPallet/xcmPallet.ts | 71 +++++++++++++++++++ packages/config/src/configs/alphanetRelay.ts | 2 +- packages/config/src/configs/kusama.ts | 2 +- packages/config/src/configs/polkadot.ts | 2 +- 6 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 .changeset/orange-lemons-prove.md diff --git a/.changeset/orange-lemons-prove.md b/.changeset/orange-lemons-prove.md new file mode 100644 index 00000000..c8f0f965 --- /dev/null +++ b/.changeset/orange-lemons-prove.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-builder': patch +'@moonbeam-network/xcm-config': patch +--- + +Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains diff --git a/packages/builder/src/extrinsic/ExtrinsicBuilder.interfaces.ts b/packages/builder/src/extrinsic/ExtrinsicBuilder.interfaces.ts index ed51cf9e..08c17d1a 100644 --- a/packages/builder/src/extrinsic/ExtrinsicBuilder.interfaces.ts +++ b/packages/builder/src/extrinsic/ExtrinsicBuilder.interfaces.ts @@ -20,6 +20,7 @@ export enum XcmVersion { v1 = 'V1', v2 = 'V2', v3 = 'V3', + v4 = 'V4', } export type Parents = 0 | 1; diff --git a/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts b/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts index 984a237b..afb2974e 100644 --- a/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts +++ b/packages/builder/src/extrinsic/pallets/xcmPallet/xcmPallet.ts @@ -2,7 +2,9 @@ import { ExtrinsicConfigBuilder, Parents, + XcmVersion, } from '../../ExtrinsicBuilder.interfaces'; +import { getExtrinsicAccount } from '../../ExtrinsicBuilder.utils'; import { ExtrinsicConfig } from '../../ExtrinsicConfig'; import { getPolkadotXcmExtrinsicArgs } from '../polkadotXcm/polkadotXcm.util'; @@ -42,5 +44,74 @@ export function xcmPallet() { }), }; }, + transferAssetsUsingTypeAndThen: () => { + const func = 'transferAssetsUsingTypeAndThen'; + + return { + here: (): ExtrinsicConfigBuilder => ({ + build: (params) => + new ExtrinsicConfig({ + module: pallet, + func, + getArgs: () => { + const version = XcmVersion.v4; + return [ + { + [version]: { + parents: 0, + interior: { + X1: [ + { + Parachain: params.destination.parachainId, + }, + ], + }, + }, + }, + { + [version]: [ + { + id: { + parents: 0, + interior: 'Here', + }, + fun: { + Fungible: params.amount, + }, + }, + ], + }, + 'LocalReserve', + { + [version]: { + parents: 0, + interior: 'Here', + }, + }, + 'LocalReserve', + { + [version]: [ + { + DepositAsset: { + assets: { + Wild: { AllCounted: 1 }, + }, + beneficiary: { + parents: 0, + interior: { + X1: [getExtrinsicAccount(params.address)], + }, + }, + }, + }, + ], + }, + 'Unlimited', + ]; + }, + }), + }), + }; + }, }; } diff --git a/packages/config/src/configs/alphanetRelay.ts b/packages/config/src/configs/alphanetRelay.ts index fcd7c0f3..c4201c6a 100644 --- a/packages/config/src/configs/alphanetRelay.ts +++ b/packages/config/src/configs/alphanetRelay.ts @@ -21,7 +21,7 @@ export const alphanetRelayConfig = new ChainConfig({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), }), ], diff --git a/packages/config/src/configs/kusama.ts b/packages/config/src/configs/kusama.ts index 80d44585..ca13d41d 100644 --- a/packages/config/src/configs/kusama.ts +++ b/packages/config/src/configs/kusama.ts @@ -21,7 +21,7 @@ export const kusamaConfig = new ChainConfig({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), fee: { asset: ksm, diff --git a/packages/config/src/configs/polkadot.ts b/packages/config/src/configs/polkadot.ts index 148801e8..63eeb2b9 100644 --- a/packages/config/src/configs/polkadot.ts +++ b/packages/config/src/configs/polkadot.ts @@ -21,7 +21,7 @@ export const polkadotConfig = new ChainConfig({ }, extrinsic: ExtrinsicBuilder() .xcmPallet() - .limitedReserveTransferAssets(0) + .transferAssetsUsingTypeAndThen() .here(), fee: { asset: dot, From 5b9f5484e21a8e131e589835c4ae3701fcdcd5d2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:30:44 +0200 Subject: [PATCH 6/8] Version Packages (#346) Co-authored-by: github-actions[bot] --- .changeset/orange-lemons-prove.md | 6 ------ examples/sdk-simple/package.json | 4 ++-- package-lock.json | 16 ++++++++-------- packages/builder/CHANGELOG.md | 6 ++++++ packages/builder/package.json | 2 +- packages/config/CHANGELOG.md | 9 +++++++++ packages/config/package.json | 4 ++-- packages/sdk/CHANGELOG.md | 8 ++++++++ packages/sdk/package.json | 6 +++--- 9 files changed, 39 insertions(+), 22 deletions(-) delete mode 100644 .changeset/orange-lemons-prove.md diff --git a/.changeset/orange-lemons-prove.md b/.changeset/orange-lemons-prove.md deleted file mode 100644 index c8f0f965..00000000 --- a/.changeset/orange-lemons-prove.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@moonbeam-network/xcm-builder': patch -'@moonbeam-network/xcm-config': patch ---- - -Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 574f6cb8..a11e45e2 100644 --- a/examples/sdk-simple/package.json +++ b/examples/sdk-simple/package.json @@ -12,8 +12,8 @@ "author": "", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.11", - "@moonbeam-network/xcm-sdk": "2.5.12", + "@moonbeam-network/xcm-config": "2.5.12", + "@moonbeam-network/xcm-sdk": "2.5.13", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index f8008388..16f7230e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,8 +50,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "2.5.11", - "@moonbeam-network/xcm-sdk": "2.5.12", + "@moonbeam-network/xcm-config": "2.5.12", + "@moonbeam-network/xcm-sdk": "2.5.13", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { @@ -19594,7 +19594,7 @@ }, "packages/builder": { "name": "@moonbeam-network/xcm-builder", - "version": "2.4.6", + "version": "2.4.7", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-types": "2.3.4", @@ -19611,10 +19611,10 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "2.5.11", + "version": "2.5.12", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-builder": "2.4.6", + "@moonbeam-network/xcm-builder": "2.4.7", "@moonbeam-network/xcm-types": "2.3.4" }, "peerDependencies": { @@ -19625,11 +19625,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.12", + "version": "2.5.13", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.11", + "@moonbeam-network/xcm-builder": "2.4.7", + "@moonbeam-network/xcm-config": "2.5.12", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md index 7ac5b9bf..ae6a9311 100644 --- a/packages/builder/CHANGELOG.md +++ b/packages/builder/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-builder +## 2.4.7 + +### Patch Changes + +- [#345](https://github.com/moonbeam-foundation/xcm-sdk/pull/345) [`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e) Thanks [@mmaurello](https://github.com/mmaurello)! - Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains + ## 2.4.6 ### Patch Changes diff --git a/packages/builder/package.json b/packages/builder/package.json index 5215227e..2f9cdbdc 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-builder", - "version": "2.4.6", + "version": "2.4.7", "description": "Moonbeam XCM builder", "scripts": { "build": "tsup", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 2c38b1b5..63c1e6ab 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-config +## 2.5.12 + +### Patch Changes + +- [#345](https://github.com/moonbeam-foundation/xcm-sdk/pull/345) [`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e) Thanks [@mmaurello](https://github.com/mmaurello)! - Add transferAssetsUsingTypeAndThen function to xcmPallet and implement it to relay chains + +- Updated dependencies [[`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e)]: + - @moonbeam-network/xcm-builder@2.4.7 + ## 2.5.11 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 7570c6b4..c773a492 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "2.5.11", + "version": "2.5.12", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", @@ -49,7 +49,7 @@ "types": "./build/index.d.ts", "main": "./build/index.cjs", "dependencies": { - "@moonbeam-network/xcm-builder": "2.4.6", + "@moonbeam-network/xcm-builder": "2.4.7", "@moonbeam-network/xcm-types": "2.3.4" }, "peerDependencies": { diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index c3f498f1..3688d1a0 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @moonbeam-network/xcm-sdk +## 2.5.13 + +### Patch Changes + +- Updated dependencies [[`6fe69b2`](https://github.com/moonbeam-foundation/xcm-sdk/commit/6fe69b230b4d44c717d9ec7ff73bbc6282b1385e)]: + - @moonbeam-network/xcm-builder@2.4.7 + - @moonbeam-network/xcm-config@2.5.12 + ## 2.5.12 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 8626b7e2..eaf3aba9 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.12", + "version": "2.5.13", "description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem", "scripts": { "build": "tsup", @@ -51,8 +51,8 @@ "types": "./build/index.d.ts", "main": "./build/index.cjs", "dependencies": { - "@moonbeam-network/xcm-builder": "2.4.6", - "@moonbeam-network/xcm-config": "2.5.11", + "@moonbeam-network/xcm-builder": "2.4.7", + "@moonbeam-network/xcm-config": "2.5.12", "@moonbeam-network/xcm-types": "2.3.4", "@moonbeam-network/xcm-utils": "2.1.7", "big.js": "^6.2.1" From 61e71430e7826e8450da2bf93e92a3269470b310 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:18:21 +0200 Subject: [PATCH 7/8] Fix ethers contract identification error (#348) * fix how we validate if the contract is from Ethers and update example * add changeset * add comment --- .changeset/famous-meals-wait.md | 5 +++ examples/sdk-simple/index.ts | 37 ++++++++++++++++----- packages/sdk/src/contract/contract.utils.ts | 2 +- 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 .changeset/famous-meals-wait.md diff --git a/.changeset/famous-meals-wait.md b/.changeset/famous-meals-wait.md new file mode 100644 index 00000000..da8f7a50 --- /dev/null +++ b/.changeset/famous-meals-wait.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-sdk': patch +--- + +Fix Ethers contract identification diff --git a/examples/sdk-simple/index.ts b/examples/sdk-simple/index.ts index 6acdc27a..513e3bfa 100644 --- a/examples/sdk-simple/index.ts +++ b/examples/sdk-simple/index.ts @@ -1,19 +1,40 @@ /* eslint-disable import/no-extraneous-dependencies */ import { dot, moonbeam, polkadot } from '@moonbeam-network/xcm-config'; -import { Sdk, TransferData } from '@moonbeam-network/xcm-sdk'; +import { EvmSigner, Sdk, TransferData } from '@moonbeam-network/xcm-sdk'; import { Keyring } from '@polkadot/api'; import { cryptoWaitReady } from '@polkadot/util-crypto'; import { ethers } from 'ethers'; import { setTimeout } from 'node:timers/promises'; - +import { createWalletClient, http } from 'viem'; +import { privateKeyToAccount } from 'viem/accounts'; +import { moonbeam as moonbeamViem } from 'viem/chains'; // Moonbeam Signer =========================================================== -const moonbeamPrivateKey = ''; -const provider = new ethers.WebSocketProvider(moonbeam.ws, { +const moonbeamPrivateKey = '0x...'; +const provider = new ethers.WebSocketProvider(moonbeam.ws[0], { chainId: moonbeam.id, name: moonbeam.name, }); -const evmSigner = new ethers.Wallet(moonbeamPrivateKey, provider); + +// Using ethers +// *****WARNING: IN THE UPCOMING VERSION OF THIS SDK, ethers SUPPORT WILL BE REMOVED, PLEASE SWITCH TO viem WHEN POSSIBLE +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const ethersSigner = new ethers.Wallet(moonbeamPrivateKey, provider); + +// Using viem +const account = privateKeyToAccount(moonbeamPrivateKey); +const viemSigner = createWalletClient({ + account, + chain: moonbeamViem, + transport: http('https://rpc.api.moonbeam.network'), +}); + +// ethers +// const evmSigner: EvmSigner = ethersSigner +// const address = ethersSigner.address +// viem +const evmSigner: EvmSigner = viemSigner; +const { address } = account; // Polkadot Signer =========================================================== @@ -65,7 +86,7 @@ export async function fromPolkadot() { console.log('\nTransfer from Polkadot to Moonbeam\n'); const data = await Sdk().getTransferData({ - destinationAddress: evmSigner.address, + destinationAddress: address, destinationKeyOrChain: moonbeam, keyOrAsset: dot, polkadotSigner: pair, @@ -93,7 +114,7 @@ export async function fromMoonbeam() { .asset(dot) .source(moonbeam) .destination(polkadot) - .accounts(evmSigner.address, pair.address, { + .accounts(address, pair.address, { evmSigner, }); @@ -114,7 +135,7 @@ async function main() { console.warn = () => null; console.clear(); - console.log(`\nMoonbeam address: ${evmSigner.address}.`); + console.log(`\nMoonbeam address: ${address}.`); console.log(`Polkadot address: ${pair.address}.`); await fromPolkadot(); diff --git a/packages/sdk/src/contract/contract.utils.ts b/packages/sdk/src/contract/contract.utils.ts index 3a275b74..b3872aa1 100644 --- a/packages/sdk/src/contract/contract.utils.ts +++ b/packages/sdk/src/contract/contract.utils.ts @@ -13,5 +13,5 @@ export function isWalletClient(signer: EvmSigner): signer is WalletClient { export function isEthersContract( contract: Contract | GetContractReturnType, ): contract is Contract { - return 'signer' in contract; + return !('abi' in contract); } From 59027cfcd978744de3f1c9c6481e4b31981643e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:23:58 +0200 Subject: [PATCH 8/8] Version Packages (#349) Co-authored-by: github-actions[bot] --- .changeset/famous-meals-wait.md | 5 ----- examples/sdk-simple/package.json | 2 +- package-lock.json | 4 ++-- packages/sdk/CHANGELOG.md | 6 ++++++ packages/sdk/package.json | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 .changeset/famous-meals-wait.md diff --git a/.changeset/famous-meals-wait.md b/.changeset/famous-meals-wait.md deleted file mode 100644 index da8f7a50..00000000 --- a/.changeset/famous-meals-wait.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@moonbeam-network/xcm-sdk': patch ---- - -Fix Ethers contract identification diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index a11e45e2..9184d47f 100644 --- a/examples/sdk-simple/package.json +++ b/examples/sdk-simple/package.json @@ -13,7 +13,7 @@ "license": "MIT", "dependencies": { "@moonbeam-network/xcm-config": "2.5.12", - "@moonbeam-network/xcm-sdk": "2.5.13", + "@moonbeam-network/xcm-sdk": "2.5.14", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 16f7230e..67505536 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ "license": "MIT", "dependencies": { "@moonbeam-network/xcm-config": "2.5.12", - "@moonbeam-network/xcm-sdk": "2.5.13", + "@moonbeam-network/xcm-sdk": "2.5.14", "@moonbeam-network/xcm-utils": "2.1.7" }, "devDependencies": { @@ -19625,7 +19625,7 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.13", + "version": "2.5.14", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "2.4.7", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 3688d1a0..5eb0154d 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-sdk +## 2.5.14 + +### Patch Changes + +- [#348](https://github.com/moonbeam-foundation/xcm-sdk/pull/348) [`61e7143`](https://github.com/moonbeam-foundation/xcm-sdk/commit/61e71430e7826e8450da2bf93e92a3269470b310) Thanks [@mmaurello](https://github.com/mmaurello)! - Fix Ethers contract identification + ## 2.5.13 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index eaf3aba9..8fac1ed6 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "2.5.13", + "version": "2.5.14", "description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem", "scripts": { "build": "tsup",