diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 6232c379..b926851a 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": "1.3.7", - "@moonbeam-network/xcm-sdk": "1.4.2", + "@moonbeam-network/xcm-config": "1.3.8", + "@moonbeam-network/xcm-sdk": "1.4.3", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 6ecf7aea..f7501718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,8 +49,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-config": "1.3.7", - "@moonbeam-network/xcm-sdk": "1.4.2", + "@moonbeam-network/xcm-config": "1.3.8", + "@moonbeam-network/xcm-sdk": "1.4.3", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -16951,7 +16951,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.7", + "version": "1.3.8", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.8", @@ -16965,11 +16965,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.2", + "version": "1.4.3", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.8", - "@moonbeam-network/xcm-config": "1.3.7", + "@moonbeam-network/xcm-config": "1.3.8", "@moonbeam-network/xcm-types": "1.0.1", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 96e3c73a..1e7fb408 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 1.3.8 + +### Patch Changes + +- [#153](https://github.com/PureStake/xcm-sdk/pull/153) [`de87e3e`](https://github.com/PureStake/xcm-sdk/commit/de87e3e4b2817080dcb60495cbcc70a8bef47a69) Thanks [@mmaurello](https://github.com/mmaurello)! - Change how we get decimals from assets in destination and change vDOT transfers paying asset + ## 1.3.7 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 11dc5b89..afd290f1 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.7", + "version": "1.3.8", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index ac6bc74a..4545e52f 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -220,7 +220,7 @@ export const bifrostPolkadot = new Parachain({ name: 'Bifrost', parachainId: 2030, ss58Format: 6, - ws: 'wss://hk.p.bifrost-rpc.liebi.com/ws', + ws: 'wss://eu.bifrost-polkadot-rpc.liebi.com/ws', }); export const calamari = new Parachain({ diff --git a/packages/config/src/configs/bifrostPolkadot.ts b/packages/config/src/configs/bifrostPolkadot.ts index f7542e73..f6d24020 100644 --- a/packages/config/src/configs/bifrostPolkadot.ts +++ b/packages/config/src/configs/bifrostPolkadot.ts @@ -59,11 +59,11 @@ export const bifrostPolkadotConfig = new ChainConfig({ balance: BalanceBuilder().substrate().tokens().accounts(), destination: moonbeam, destinationFee: { - amount: 0.2, - asset: bnc, - balance: BalanceBuilder().substrate().system().account(), + amount: 0.01, + asset: vdot, + balance: BalanceBuilder().substrate().tokens().accounts(), }, - extrinsic: ExtrinsicBuilder().xTokens().transferMultiCurrencies(), + extrinsic: ExtrinsicBuilder().xTokens().transfer(), fee: { asset: bnc, balance: BalanceBuilder().substrate().system().account(), diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 779097d9..4d0e1741 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-sdk +## 1.4.3 + +### Patch Changes + +- [#153](https://github.com/PureStake/xcm-sdk/pull/153) [`de87e3e`](https://github.com/PureStake/xcm-sdk/commit/de87e3e4b2817080dcb60495cbcc70a8bef47a69) Thanks [@mmaurello](https://github.com/mmaurello)! - Change how we get decimals from assets in destination and change vDOT transfers paying asset + +- Updated dependencies [[`de87e3e`](https://github.com/PureStake/xcm-sdk/commit/de87e3e4b2817080dcb60495cbcc70a8bef47a69)]: + - @moonbeam-network/xcm-config@1.3.8 + ## 1.4.2 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 7be133a2..ede9928f 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.2", + "version": "1.4.3", "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", @@ -48,7 +48,7 @@ "main": "./build/index.cjs", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.8", - "@moonbeam-network/xcm-config": "1.3.7", + "@moonbeam-network/xcm-config": "1.3.8", "@moonbeam-network/xcm-types": "1.0.1", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" diff --git a/packages/sdk/src/getTransferData/getDestinationData.ts b/packages/sdk/src/getTransferData/getDestinationData.ts index 1f59fd0b..ed56e1cc 100644 --- a/packages/sdk/src/getTransferData/getDestinationData.ts +++ b/packages/sdk/src/getTransferData/getDestinationData.ts @@ -46,7 +46,12 @@ export async function getDestinationData({ const balanceAmount = zeroAmount.copyWith({ amount: balance }); const { existentialDeposit } = polkadot; - const feeAmount = await getFee({ config: transferConfig, polkadot }); + const feeAmount = await getFee({ + address: destinationAddress, + config: transferConfig, + evmSigner, + polkadot, + }); const minAmount = zeroAmount.copyWith({ amount: min }); return { @@ -59,16 +64,26 @@ export async function getDestinationData({ } export interface GetFeeParams { + address: string; config: TransferConfig; + evmSigner?: EvmSigner; polkadot: PolkadotService; } export async function getFee({ + address, config, + evmSigner, polkadot, }: GetFeeParams): Promise { const { amount, asset } = config.source.config.destinationFee; - const decimals = await polkadot.getAssetDecimals(asset); + const decimals = await getDecimals({ + address, + asset, + config: config.destination.config, + evmSigner, + polkadot, + }); const zeroAmount = AssetAmount.fromAsset(asset, { amount: 0n, decimals,