From 7991304b54b6b65a3e0a04169f19cffe711f9786 Mon Sep 17 00:00:00 2001 From: green-jay Date: Sun, 31 Dec 2023 11:43:42 +0100 Subject: [PATCH] Add Nodle and Unique --- packages/xcm-cfg/src/assets.ts | 12 +++++++ packages/xcm-cfg/src/chains.ts | 48 +++++++++++++++++++++++++ packages/xcm-cfg/src/configs/hydraDX.ts | 42 ++++++++++++++++++++++ packages/xcm-cfg/src/configs/index.ts | 4 +++ packages/xcm-cfg/src/configs/nodle.ts | 24 +++++++++++++ packages/xcm-cfg/src/configs/unique.ts | 24 +++++++++++++ 6 files changed, 154 insertions(+) create mode 100644 packages/xcm-cfg/src/configs/nodle.ts create mode 100644 packages/xcm-cfg/src/configs/unique.ts diff --git a/packages/xcm-cfg/src/assets.ts b/packages/xcm-cfg/src/assets.ts index 1e6f61bd..cb3430fa 100644 --- a/packages/xcm-cfg/src/assets.ts +++ b/packages/xcm-cfg/src/assets.ts @@ -84,6 +84,16 @@ export const pha = new Asset({ originSymbol: 'PHA', }); +export const nodl = new Asset({ + key: 'nodl', + originSymbol: 'NODL', +}); + +export const unq = new Asset({ + key: 'unq', + originSymbol: 'UNQ', +}); + export const assets: Asset[] = [ aca, astr, @@ -96,7 +106,9 @@ export const assets: Asset[] = [ hdx, ibtc, intr, + nodl, sub, + unq, usdc, usdc_mwh, usdt, diff --git a/packages/xcm-cfg/src/chains.ts b/packages/xcm-cfg/src/chains.ts index 03a922ec..f9ffa467 100644 --- a/packages/xcm-cfg/src/chains.ts +++ b/packages/xcm-cfg/src/chains.ts @@ -18,7 +18,9 @@ import { hdx, ibtc, intr, + nodl, sub, + unq, usdc, usdc_mwh, usdt, @@ -201,11 +203,21 @@ export const hydraDX = new Parachain({ id: 17, decimals: 10, }, + { + asset: nodl, + id: 26, + decimals: 11, + }, { asset: sub, id: 24, decimals: 10, }, + { + asset: unq, + id: 25, + decimals: 18, + }, { asset: usdc, id: 1337, @@ -410,6 +422,42 @@ export const phala = new Parachain({ ws: 'wss://api.phala.network/ws', }); +export const nodle = new Parachain({ + assetsData: [ + // NOTE: no meta for native token + { + asset: nodl, + metadataId: 99999999, + }, + ], + ecosystem: Ecosystem.Polkadot, + genesisHash: + '0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21', + key: 'nodle', + name: 'Nodle', + parachainId: 2026, + ss58Format: 37, + ws: 'wss://eden-rpc.dwellir.com', +}); + +export const unique = new Parachain({ + assetsData: [ + // NOTE: no meta for native token + { + asset: unq, + metadataId: 99999999, + }, + ], + ecosystem: Ecosystem.Polkadot, + genesisHash: + '0x84322d9cddbf35088f1e54e9a85c967a41a56a4f43445768125e61af166c7d31', + key: 'unique', + name: 'Unique network', + parachainId: 2037, + ss58Format: 7391, + ws: 'wss://unique-rpc.dwellir.com', +}); + export const chains: AnyChain[] = [ acala, assetHub, diff --git a/packages/xcm-cfg/src/configs/hydraDX.ts b/packages/xcm-cfg/src/configs/hydraDX.ts index a528929f..95743236 100644 --- a/packages/xcm-cfg/src/configs/hydraDX.ts +++ b/packages/xcm-cfg/src/configs/hydraDX.ts @@ -20,8 +20,10 @@ import { hdx, ibtc, intr, + nodl, pha, sub, + unq, usdc, usdc_mwh, usdt, @@ -42,8 +44,10 @@ import { hydraDX, interlay, moonbeam, + nodle, phala, subsocial, + unique, zeitgeist, } from '../chains'; import { ExtrinsicBuilderV2 } from '../builders'; @@ -408,6 +412,42 @@ const toPhala: AssetConfig[] = [ }), ]; +const toNodle: AssetConfig[] = [ + new AssetConfig({ + asset: nodl, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: nodle, + destinationFee: { + amount: 0.0018, + asset: nodl, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: hdx, + balance: BalanceBuilder().substrate().system().account(), + }, + }), +]; + +const toUnique: AssetConfig[] = [ + new AssetConfig({ + asset: unq, + balance: BalanceBuilder().substrate().tokens().accounts(), + destination: unique, + destinationFee: { + amount: 0.000078, + asset: unq, + balance: BalanceBuilder().substrate().tokens().accounts(), + }, + extrinsic: ExtrinsicBuilder().xTokens().transfer(), + fee: { + asset: hdx, + balance: BalanceBuilder().substrate().system().account(), + }, + }), +]; + export const hydraDxConfig = new ChainConfig({ assets: [ ...toAcala, @@ -417,8 +457,10 @@ export const hydraDxConfig = new ChainConfig({ ...toCentrifuge, ...toInterlay, ...toMoonbeam, + ...toNodle, ...toPolkadot, ...toSubsocial, + ...toUnique, ...toZeitgeist, ...toPhala, ], diff --git a/packages/xcm-cfg/src/configs/index.ts b/packages/xcm-cfg/src/configs/index.ts index 48cc5953..bcc87b1a 100644 --- a/packages/xcm-cfg/src/configs/index.ts +++ b/packages/xcm-cfg/src/configs/index.ts @@ -8,8 +8,10 @@ import { centrifugeConfig } from './centrifuge'; import { hydraDxConfig } from './hydraDX'; import { interlayConfig } from './interlay'; import { moonbeamConfig } from './moonbeam'; +import { nodleConfig } from './nodle'; import { polkadotConfig } from './polkadot'; import { subsocialConfig } from './subsocial'; +import { uniqueConfig } from './unique'; import { zeitgeistConfig } from './zeitgeist'; import { phalaConfig } from './phala'; @@ -22,8 +24,10 @@ export const chainsConfig: ChainConfig[] = [ hydraDxConfig, interlayConfig, moonbeamConfig, + nodleConfig, polkadotConfig, subsocialConfig, + uniqueConfig, zeitgeistConfig, phalaConfig, ]; diff --git a/packages/xcm-cfg/src/configs/nodle.ts b/packages/xcm-cfg/src/configs/nodle.ts new file mode 100644 index 00000000..9850f0ce --- /dev/null +++ b/packages/xcm-cfg/src/configs/nodle.ts @@ -0,0 +1,24 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, +} from '@moonbeam-network/xcm-builder'; +import { AssetConfig, ChainConfig } from '@moonbeam-network/xcm-config'; +import { nodl } from 'assets'; +import { hydraDX, nodle } from '../chains'; + +export const nodleConfig = new ChainConfig({ + assets: [ + new AssetConfig({ + asset: nodl, + balance: BalanceBuilder().substrate().system().account(), + destination: hydraDX, + destinationFee: { + amount: 1.8, + asset: nodl, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTransfer().transfer().here(), + }), + ], + chain: nodle, +}); diff --git a/packages/xcm-cfg/src/configs/unique.ts b/packages/xcm-cfg/src/configs/unique.ts new file mode 100644 index 00000000..926e3a38 --- /dev/null +++ b/packages/xcm-cfg/src/configs/unique.ts @@ -0,0 +1,24 @@ +import { + BalanceBuilder, + ExtrinsicBuilder, +} from '@moonbeam-network/xcm-builder'; +import { AssetConfig, ChainConfig } from '@moonbeam-network/xcm-config'; +import { unq } from 'assets'; +import { hydraDX, unique } from '../chains'; + +export const uniqueConfig = new ChainConfig({ + assets: [ + new AssetConfig({ + asset: unq, + balance: BalanceBuilder().substrate().system().account(), + destination: hydraDX, + destinationFee: { + amount: 1.8, + asset: unq, + balance: BalanceBuilder().substrate().system().account(), + }, + extrinsic: ExtrinsicBuilder().xTransfer().transfer().here(), + }), + ], + chain: unique, +});