diff --git a/.changeset/poor-lemons-wink.md b/.changeset/poor-lemons-wink.md new file mode 100644 index 00000000..eb561636 --- /dev/null +++ b/.changeset/poor-lemons-wink.md @@ -0,0 +1,5 @@ +--- +'@galacticcouncil/xcm-cfg': patch +--- + +add ASTR and GLMR to bifrost diff --git a/.changeset/swift-insects-run.md b/.changeset/swift-insects-run.md new file mode 100644 index 00000000..b64d6a44 --- /dev/null +++ b/.changeset/swift-insects-run.md @@ -0,0 +1,5 @@ +--- +'@galacticcouncil/xcm-cfg': minor +--- + +ASTR Hydration<>Bifrost diff --git a/examples/xcm-transfer/package.json b/examples/xcm-transfer/package.json index 72f8676f..a4bab04c 100644 --- a/examples/xcm-transfer/package.json +++ b/examples/xcm-transfer/package.json @@ -16,5 +16,9 @@ "@galacticcouncil/xcm-cfg": "^5.6.0", "@galacticcouncil/xcm-sdk": "^7.0.0", "@talismn/connect-wallets": "^1.2.5" - } + }, + "version": "1.0.0", + "author": "", + "license": "ISC", + "description": "" } diff --git a/examples/xcm-transfer/src/index.ts b/examples/xcm-transfer/src/index.ts index fc787bbb..dda7b858 100644 --- a/examples/xcm-transfer/src/index.ts +++ b/examples/xcm-transfer/src/index.ts @@ -54,9 +54,9 @@ const wallet = new Wallet({ configureExternal(externals, configService); // Define transfer -const srcChain = configService.getChain('hydration'); -const destChain = configService.getChain('ethereum'); -const asset = configService.getAsset('aave'); +const srcChain = configService.getChain('ethereum'); +const destChain = configService.getChain('hydration'); +const asset = configService.getAsset('eth'); const configBuilder = ConfigBuilder(configService); const { sourceChains } = configBuilder.assets().asset(asset); @@ -71,8 +71,8 @@ logDestChains(asset.key, destinationChains); logSrcChains(asset.key, sourceChains); // Define source & dest accounts -const srcAddr = '5HbftW2XCP77ypjeBEkL2iXHKw5rnRJoqKd3ySZCgxvxbxYj'; -const destAddr = '0x26f5C2370e563e9f4dDA435f03A63D7C109D8D04'; +const srcAddr = 'INSERT_ADDRESS'; +const destAddr = 'INSERT_ADDRESS'; // Subscribe source chain token balance const balanceObserver = (balances: AssetAmount[]) => console.log(balances); diff --git a/package-lock.json b/package-lock.json index faf10fba..71f116e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,6 +103,8 @@ } }, "examples/xcm-transfer": { + "version": "1.0.0", + "license": "ISC", "dependencies": { "@galacticcouncil/sdk": "^5.0.1", "@galacticcouncil/xcm-cfg": "^5.6.0", diff --git a/packages/xcm-cfg/src/chains.ts b/packages/xcm-cfg/src/chains.ts index a0cebf1c..94386baa 100644 --- a/packages/xcm-cfg/src/chains.ts +++ b/packages/xcm-cfg/src/chains.ts @@ -299,6 +299,55 @@ export const astar = new Parachain({ id: '4294969280', metadataId: 0, }, + { + asset: bnc, + decimals: 12, + id: '18446744073709551623', + metadataId: 0, + min: 0.01, + }, + { + asset: glmr, + decimals: 18, + id: '18446744073709551619', + metadataId: 0, + min: 0.01, + }, + { + asset: ibtc, + decimals: 8, + id: '18446744073709551620', + metadataId: 0, + min: 0.000001, + }, + { + asset: intr, + decimals: 10, + id: '18446744073709551621', + metadataId: 0, + min: 0.01, + }, + { + asset: pha, + decimals: 12, + id: '18446744073709551622', + metadataId: 0, + min: 0.01, + }, + { + asset: vdot, + decimals: 10, + id: '18446744073709551624', + metadataId: 0, + min: 0.01, + }, + { + asset: vastr, + decimals: 18, + id: '18446744073709551632', + metadataId: 0, + min: 0.01, + }, ], ecosystem: Ecosystem.Polkadot, explorer: 'https://astar.subscan.io', @@ -364,6 +413,27 @@ export const bifrost = new Parachain({ metadataId: 23, palletInstance: 50, }, + { + asset: astr, + decimals: 18, + id: { Token2: 3 }, + metadataId: { Token2: 3 }, + min: 0.01, + }, + { + asset: glmr, + decimals: 18, + id: { Token2: 1 }, + metadataId: { Token2: 1 }, + min: 0.00001, + }, + { + asset: ibtc, + decimals: 8, + id: { Token2: 6 }, + metadataId: { Token2: 6 }, + min: 0.000001, + }, ], ecosystem: Ecosystem.Polkadot, explorer: 'https://bifrost.subscan.io', @@ -382,6 +452,20 @@ export const centrifuge = new Parachain({ asset: cfg, id: 'Native', }, + { + asset: dot, + decimals: 10, + id: { ForeignAsset: 5 }, + metadataId: { ForeignAsset: 5 }, + min: 0.0001, + }, + { + asset: glmr, + decimals: 18, + id: { ForeignAsset: 4 }, + metadataId: { ForeignAsset: 4 }, + min: 0.001, + }, ], ecosystem: Ecosystem.Polkadot, explorer: 'https://centrifuge.subscan.io', @@ -1328,6 +1412,11 @@ export const interlay = new Parachain({ decimals: 12, id: { ForeignAsset: 13 }, }, + { + asset: vdot, + decimals: 10, + id: { ForeignAsset: 3 }, + }, ], ecosystem: Ecosystem.Polkadot, explorer: 'https://interlay.subscan.io', diff --git a/packages/xcm-cfg/src/configs/polkadot/astar.ts b/packages/xcm-cfg/src/configs/polkadot/astar.ts index 6dbf099b..704ff81b 100644 --- a/packages/xcm-cfg/src/configs/polkadot/astar.ts +++ b/packages/xcm-cfg/src/configs/polkadot/astar.ts @@ -1,6 +1,6 @@ import { AssetRoute, ChainRoutes } from '@galacticcouncil/xcm-core'; -import { astr, dot } from '../../assets'; +import { astr, bnc, dot, glmr, ibtc, intr, pha, vastr, vdot } from '../../assets'; import { astar, hydration } from '../../chains'; import { BalanceBuilder, ExtrinsicBuilder } from '../../builders'; @@ -45,6 +45,160 @@ const toHydration: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: bnc, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: bnc, + fee: { + amount: 0.1, + asset: bnc, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: glmr, + fee: { + amount: 0.04, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: ibtc, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: ibtc, + fee: { + amount: 0.04, + asset: ibtc, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: intr, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: intr, + fee: { + amount: 0.2, + asset: intr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: pha, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: pha, + fee: { + amount: 0.3, + asset: pha, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: vdot, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: vdot, + fee: { + amount: 0.0004, + asset: vdot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: vastr, + balance: BalanceBuilder().substrate().assets().account(), + fee: { + asset: astr, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().assets().account(), + }, + }, + destination: { + chain: hydration, + asset: vastr, + fee: { + amount: 0.025, + asset: vastr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; export const astarConfig = new ChainRoutes({ diff --git a/packages/xcm-cfg/src/configs/polkadot/bifrost.ts b/packages/xcm-cfg/src/configs/polkadot/bifrost.ts index e2b7e066..c28d44e9 100644 --- a/packages/xcm-cfg/src/configs/polkadot/bifrost.ts +++ b/packages/xcm-cfg/src/configs/polkadot/bifrost.ts @@ -1,6 +1,6 @@ import { AssetRoute, ChainRoutes } from '@galacticcouncil/xcm-core'; -import { bnc, dot, usdc, usdt, vdot, vastr } from '../../assets'; +import { bnc, dot, usdc, usdt, vdot, vastr, astr, glmr, ibtc } from '../../assets'; import { assetHub, bifrost, hydration, polkadot } from '../../chains'; import { BalanceBuilder, ExtrinsicBuilder } from '../../builders'; @@ -89,6 +89,72 @@ const toHydration: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: astr, + balance: BalanceBuilder().substrate().tokens().accounts(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: astr, + fee: { + amount: 0.5, + asset: astr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: BalanceBuilder().substrate().tokens().accounts(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: glmr, + fee: { + amount: 0.1, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: ibtc, + balance: BalanceBuilder().substrate().tokens().accounts(), + fee: { + asset: bnc, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: ibtc, + fee: { + amount: 0.000002, + asset: ibtc, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; const toPolkadot: AssetRoute[] = [ diff --git a/packages/xcm-cfg/src/configs/polkadot/centrifuge.ts b/packages/xcm-cfg/src/configs/polkadot/centrifuge.ts index 77ede23e..14f3e2f9 100644 --- a/packages/xcm-cfg/src/configs/polkadot/centrifuge.ts +++ b/packages/xcm-cfg/src/configs/polkadot/centrifuge.ts @@ -1,6 +1,6 @@ import { AssetRoute, ChainRoutes } from '@galacticcouncil/xcm-core'; -import { cfg } from '../../assets'; +import { cfg, dot, glmr } from '../../assets'; import { centrifuge, hydration } from '../../chains'; import { BalanceBuilder, ExtrinsicBuilder } from '../../builders'; @@ -23,6 +23,50 @@ const toHydration: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: dot, + balance: BalanceBuilder().substrate().ormlTokens().accounts(), + fee: { + asset: cfg, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().ormlTokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: dot, + fee: { + amount: 0.1, + asset: dot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: BalanceBuilder().substrate().ormlTokens().accounts(), + fee: { + asset: cfg, + balance: BalanceBuilder().substrate().system().account(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().ormlTokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: glmr, + fee: { + amount: 0.05, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; export const centrifugeConfig = new ChainRoutes({ diff --git a/packages/xcm-cfg/src/configs/polkadot/hydration/index.ts b/packages/xcm-cfg/src/configs/polkadot/hydration/index.ts index aa477019..c63e1135 100644 --- a/packages/xcm-cfg/src/configs/polkadot/hydration/index.ts +++ b/packages/xcm-cfg/src/configs/polkadot/hydration/index.ts @@ -290,6 +290,139 @@ const toAstar: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: bnc, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: bnc, + fee: { + amount: 0.05, + asset: bnc, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: glmr, + fee: { + amount: 0.025, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: ibtc, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: ibtc, + fee: { + amount: 0.025, + asset: ibtc, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: intr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: intr, + fee: { + amount: 0.01, + asset: intr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: pha, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: pha, + fee: { + amount: 0.3, + asset: pha, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: vdot, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: vdot, + fee: { + amount: 0.0004, + asset: vdot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: vastr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: astar, + asset: vastr, + fee: { + amount: 0.005, + asset: vastr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; const toBifrost: AssetRoute[] = [ @@ -369,6 +502,63 @@ const toBifrost: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: astr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: bifrost, + asset: astr, + fee: { + amount: 0.5, + asset: astr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: bifrost, + asset: glmr, + fee: { + amount: 0.1, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: ibtc, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: bifrost, + asset: ibtc, + fee: { + amount: 0.000002, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; const toCentrifuge: AssetRoute[] = [ @@ -391,6 +581,44 @@ const toCentrifuge: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: dot, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: centrifuge, + asset: dot, + fee: { + amount: 0.1, + asset: dot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), + new AssetRoute({ + source: { + asset: glmr, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: centrifuge, + asset: glmr, + fee: { + amount: 0.05, + asset: glmr, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; const toInterlay: AssetRoute[] = [ @@ -470,6 +698,25 @@ const toInterlay: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: vdot, + balance: balance(), + fee: fee(), + destinationFee: { + balance: balance(), + }, + }, + destination: { + chain: interlay, + asset: vdot, + fee: { + amount: 0.01, + asset: dot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; const toMoonbeam: AssetRoute[] = [ diff --git a/packages/xcm-cfg/src/configs/polkadot/interlay.ts b/packages/xcm-cfg/src/configs/polkadot/interlay.ts index 998258cd..192481a6 100644 --- a/packages/xcm-cfg/src/configs/polkadot/interlay.ts +++ b/packages/xcm-cfg/src/configs/polkadot/interlay.ts @@ -1,6 +1,6 @@ import { AssetRoute, ChainRoutes } from '@galacticcouncil/xcm-core'; -import { dot, hdx, ibtc, intr } from '../../assets'; +import { dot, hdx, ibtc, intr, vdot } from '../../assets'; import { hydration, interlay } from '../../chains'; import { BalanceBuilder, ExtrinsicBuilder } from '../../builders'; @@ -89,6 +89,28 @@ const toHydration: AssetRoute[] = [ }, extrinsic: ExtrinsicBuilder().xTokens().transfer(), }), + new AssetRoute({ + source: { + asset: vdot, + balance: BalanceBuilder().substrate().tokens().accounts(), + fee: { + asset: intr, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + destinationFee: { + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + }, + destination: { + chain: hydration, + asset: vdot, + fee: { + amount: 0.001, + asset: vdot, + }, + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + }), ]; export const interlayConfig = new ChainRoutes({