From b4d988f5dc9d8c7dfd8067747234609e8701ef52 Mon Sep 17 00:00:00 2001 From: albertov19 <64150856+albertov19@users.noreply.github.com> Date: Fri, 12 Jan 2024 12:16:54 +0100 Subject: [PATCH 01/12] Updated Parallel WSS Endpoint (#180) * Updated Parallel WSS Endpoint * Create big-rice-float.md --------- Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> --- .changeset/big-rice-float.md | 5 +++++ packages/config/src/chains.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/big-rice-float.md diff --git a/.changeset/big-rice-float.md b/.changeset/big-rice-float.md new file mode 100644 index 00000000..283473d6 --- /dev/null +++ b/.changeset/big-rice-float.md @@ -0,0 +1,5 @@ +--- +"@moonbeam-network/xcm-config": patch +--- + +Updated Parallel WSS Endpoint diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 3eda27a3..c23e606c 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -1135,7 +1135,7 @@ export const parallel = new Parachain({ name: 'Parallel', parachainId: 2012, ss58Format: 172, - ws: 'wss://rpc.parallel.fi', + ws: 'wss://polkadot-parallel-rpc.parallel.fi', }); export const parallelHeiko = new Parachain({ From 8635450d1dea1569f945f8eeae607368578724cc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:45:49 +0100 Subject: [PATCH 02/12] Version Packages (#181) Co-authored-by: github-actions[bot] --- .changeset/big-rice-float.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/big-rice-float.md diff --git a/.changeset/big-rice-float.md b/.changeset/big-rice-float.md deleted file mode 100644 index 283473d6..00000000 --- a/.changeset/big-rice-float.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonbeam-network/xcm-config": patch ---- - -Updated Parallel WSS Endpoint diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 8f4c0839..3091a9f2 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.18", - "@moonbeam-network/xcm-sdk": "1.4.14", + "@moonbeam-network/xcm-config": "1.3.19", + "@moonbeam-network/xcm-sdk": "1.4.15", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 2492db84..a66cd325 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.18", - "@moonbeam-network/xcm-sdk": "1.4.14", + "@moonbeam-network/xcm-config": "1.3.19", + "@moonbeam-network/xcm-sdk": "1.4.15", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -17004,7 +17004,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.18", + "version": "1.3.19", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.10", @@ -17018,11 +17018,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.14", + "version": "1.4.15", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.18", + "@moonbeam-network/xcm-config": "1.3.19", "@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 be0d3e12..96772c2a 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 1.3.19 + +### Patch Changes + +- [#180](https://github.com/PureStake/xcm-sdk/pull/180) [`b4d988f`](https://github.com/PureStake/xcm-sdk/commit/b4d988f5dc9d8c7dfd8067747234609e8701ef52) Thanks [@albertov19](https://github.com/albertov19)! - Updated Parallel WSS Endpoint + ## 1.3.18 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 51188dbc..2990ffc9 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.18", + "version": "1.3.19", "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 1b9134ff..082281b2 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonbeam-network/xcm-sdk +## 1.4.15 + +### Patch Changes + +- Updated dependencies [[`b4d988f`](https://github.com/PureStake/xcm-sdk/commit/b4d988f5dc9d8c7dfd8067747234609e8701ef52)]: + - @moonbeam-network/xcm-config@1.3.19 + ## 1.4.14 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 64dc15f7..2f30d645 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.14", + "version": "1.4.15", "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": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.18", + "@moonbeam-network/xcm-config": "1.3.19", "@moonbeam-network/xcm-types": "1.0.1", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" From 6beaf73e39d339f6221b7346758822f63bbf99e3 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Tue, 16 Jan 2024 21:17:19 +1300 Subject: [PATCH 03/12] Remove equilibrium alphanet config (#182) * remove equilibrium alphanet config * remove unused assets from moonbase alpha * add changeset --- .changeset/fuzzy-cherries-dress.md | 6 ++ .../src/ConfigBuilder/ConfigBuilder.test.ts | 20 +++---- .../src/ConfigService/ConfigService.test.ts | 9 +-- packages/config/src/chains.ts | 49 ++-------------- .../config/src/configs/equilibriumAlphanet.ts | 56 ------------------- packages/config/src/configs/index.ts | 2 - packages/config/src/configs/moonbaseAlpha.ts | 44 --------------- packages/sdk/src/polkadot/PolkadotService.ts | 6 +- 8 files changed, 23 insertions(+), 169 deletions(-) create mode 100644 .changeset/fuzzy-cherries-dress.md delete mode 100644 packages/config/src/configs/equilibriumAlphanet.ts diff --git a/.changeset/fuzzy-cherries-dress.md b/.changeset/fuzzy-cherries-dress.md new file mode 100644 index 00000000..10f8632f --- /dev/null +++ b/.changeset/fuzzy-cherries-dress.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-config': patch +'@moonbeam-network/xcm-sdk': patch +--- + +Remove equilibrium alphanet config diff --git a/packages/config/src/ConfigBuilder/ConfigBuilder.test.ts b/packages/config/src/ConfigBuilder/ConfigBuilder.test.ts index 94619cd1..c182b682 100644 --- a/packages/config/src/ConfigBuilder/ConfigBuilder.test.ts +++ b/packages/config/src/ConfigBuilder/ConfigBuilder.test.ts @@ -2,9 +2,9 @@ import { Ecosystem } from '@moonbeam-network/xcm-types'; import { ConfigService } from '../ConfigService'; import { dev } from '../assets'; -import { equilibriumAlphanet, moonbaseAlpha } from '../chains'; -import { equilibriumAlphanetConfig } from '../configs/equilibriumAlphanet'; +import { moonbaseAlpha, pendulumAlphanet } from '../chains'; import { moonbaseAlphaConfig } from '../configs/moonbaseAlpha'; +import { pendulumAlphanetConfig } from '../configs/pendulumAlphanet'; import { ConfigBuilder } from './ConfigBuilder'; describe('configBuilder', () => { @@ -13,7 +13,7 @@ describe('configBuilder', () => { .assets(Ecosystem.AlphanetRelay) .asset(dev) .source(moonbaseAlpha) - .destination(equilibriumAlphanet) + .destination(pendulumAlphanet) .build(); expect(config).toStrictEqual({ @@ -22,12 +22,12 @@ describe('configBuilder', () => { chain: moonbaseAlpha, config: moonbaseAlphaConfig.getAssetDestinationConfig( dev, - equilibriumAlphanet, + pendulumAlphanet, ), }, destination: { - chain: equilibriumAlphanet, - config: equilibriumAlphanetConfig.getAssetDestinationConfig( + chain: pendulumAlphanet, + config: pendulumAlphanetConfig.getAssetDestinationConfig( dev, moonbaseAlpha, ), @@ -41,7 +41,7 @@ describe('configBuilder', () => { .assets(Ecosystem.AlphanetRelay) .asset(dev) .source(moonbaseAlpha) - .destination(equilibriumAlphanet) + .destination(pendulumAlphanet) .build(); expect(config).toStrictEqual({ @@ -50,12 +50,12 @@ describe('configBuilder', () => { chain: moonbaseAlpha, config: moonbaseAlphaConfig.getAssetDestinationConfig( dev, - equilibriumAlphanet, + pendulumAlphanet, ), }, destination: { - chain: equilibriumAlphanet, - config: equilibriumAlphanetConfig.getAssetDestinationConfig( + chain: pendulumAlphanet, + config: pendulumAlphanetConfig.getAssetDestinationConfig( dev, moonbaseAlpha, ), diff --git a/packages/config/src/ConfigService/ConfigService.test.ts b/packages/config/src/ConfigService/ConfigService.test.ts index fc3e88e1..55ca9ecc 100644 --- a/packages/config/src/ConfigService/ConfigService.test.ts +++ b/packages/config/src/ConfigService/ConfigService.test.ts @@ -9,12 +9,7 @@ import { Parachain, } from '@moonbeam-network/xcm-types'; import { assetsList, dev, glmr, tt1, unit } from '../assets'; -import { - equilibriumAlphanet, - hydraDX, - moonbaseAlpha, - moonbeam, -} from '../chains'; +import { hydraDX, moonbaseAlpha, moonbeam, pendulumAlphanet } from '../chains'; import { ConfigService } from './ConfigService'; import { AssetConfig } from '../types/AssetConfig'; @@ -123,7 +118,7 @@ describe('config service', () => { ); expect(chains).toStrictEqual( - expect.arrayContaining([moonbaseAlpha, equilibriumAlphanet]), + expect.arrayContaining([moonbaseAlpha, pendulumAlphanet]), ); }); }); diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index c23e606c..0b17c818 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -47,7 +47,6 @@ import { ring, rmrk, sdn, - soon, sub, teer, tt1, @@ -403,33 +402,6 @@ export const equilibrium = new Parachain({ ws: 'wss://node.pol.equilibrium.io', }); -export const equilibriumAlphanet = new Parachain({ - assetsData: [ - { - asset: dev, - decimals: 9, - id: 1_735_159_154, - }, - { - asset: eq, - id: 25_969, - }, - { - asset: eqd, - id: 6_648_164, - }, - ], - ecosystem: Ecosystem.AlphanetRelay, - genesisHash: - '0x0ba4508078664cfd04f00bf17892dd1a0764ce61d90857f76c6a2ea61f008247', - isTestChain: true, - key: 'equilibrium-alphanet', - name: 'EquilibriumAlphanet', - parachainId: 2011, - ss58Format: 68, - ws: 'wss://devnet.equilab.io/alphanet/collator/api/wss', -}); - export const hydraDX = new Parachain({ assetsData: [ { @@ -699,24 +671,16 @@ export const moonbaseAlpha = new EvmParachain({ asset: atom, id: '244316754493307480955066032215622931381', }, - { - asset: auq, - id: '69536036667157951501899290870203586130', - }, + // { + // asset: auq, + // id: '69536036667157951501899290870203586130', + // }, { asset: dev, id: '0x0000000000000000000000000000000000000802', metadataId: 0, min: 0.01, }, - { - asset: eq, - id: '190590555344745888270686124937537713878', - }, - { - asset: eqd, - id: '187224307232923873519830480073807488153', - }, { asset: lit, id: '65216491554813189869575508812319036608', @@ -733,10 +697,6 @@ export const moonbaseAlpha = new EvmParachain({ asset: pica, id: '22417088946346045371238623691600461855', }, - { - asset: soon, - id: '205153165378836428058230526014907639736', - }, { asset: tt1, id: '156305701417244550631956600137082963628', @@ -1455,7 +1415,6 @@ export const chainsList: AnyChain[] = [ darwiniaCrab, darwiniaPangoro, equilibrium, - equilibriumAlphanet, hydraDX, integritee, interlay, diff --git a/packages/config/src/configs/equilibriumAlphanet.ts b/packages/config/src/configs/equilibriumAlphanet.ts deleted file mode 100644 index bc453de0..00000000 --- a/packages/config/src/configs/equilibriumAlphanet.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - BalanceBuilder, - ExtrinsicBuilder, - FeeBuilder, -} from '@moonbeam-network/xcm-builder'; -import { dev, eq, eqd } from '../assets'; -import { equilibriumAlphanet, moonbaseAlpha } from '../chains'; -import { AssetConfig } from '../types/AssetConfig'; -import { ChainConfig } from '../types/ChainConfig'; - -export const equilibriumAlphanetConfig = new ChainConfig({ - assets: [ - new AssetConfig({ - asset: eq, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - destination: moonbaseAlpha, - destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), - asset: eq, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - }, - extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), - }), - new AssetConfig({ - asset: eqd, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - destination: moonbaseAlpha, - destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), - asset: eq, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - }, - extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), - fee: { - asset: eq, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - }, - }), - new AssetConfig({ - asset: dev, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - destination: moonbaseAlpha, - destinationFee: { - amount: 0.00005, - asset: dev, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - }, - extrinsic: ExtrinsicBuilder().eqBalances().transferXcm(), - fee: { - asset: eq, - balance: BalanceBuilder().substrate().system().accountEquilibrium(), - }, - }), - ], - chain: equilibriumAlphanet, -}); diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index 1a09e5d9..f42f0247 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -13,7 +13,6 @@ import { darwiniaConfig } from './darwinia'; import { darwiniaCrabConfig } from './darwiniaCrab'; import { darwiniaPangoroConfig } from './darwiniaPangoro'; import { equilibriumConfig } from './equilibrium'; -import { equilibriumAlphanetConfig } from './equilibriumAlphanet'; import { hydraDxConfig } from './hydraDX'; import { integriteeConfig } from './integritee'; import { interlayConfig } from './interlay'; @@ -61,7 +60,6 @@ export const chainsConfigList: ChainConfig[] = [ darwiniaConfig, darwiniaCrabConfig, darwiniaPangoroConfig, - equilibriumAlphanetConfig, equilibriumConfig, hydraDxConfig, integriteeConfig, diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index dea9b312..ceb95b63 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -4,8 +4,6 @@ import { ampe, atom, dev, - eq, - eqd, lit, otp, paring, @@ -18,7 +16,6 @@ import { alphanetAssetHub, alphanetRelay, darwiniaPangoro, - equilibriumAlphanet, litentryAlphanet, moonbaseAlpha, moonbaseBeta, @@ -32,17 +29,6 @@ import { ChainConfig } from '../types/ChainConfig'; export const moonbaseAlphaConfig = new ChainConfig({ assets: [ - new AssetConfig({ - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: equilibriumAlphanet, - destinationFee: { - amount: 4, - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: dev, balance: BalanceBuilder().substrate().system().account(), @@ -132,36 +118,6 @@ export const moonbaseAlphaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: eq, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: equilibriumAlphanet, - destinationFee: { - amount: 14, - asset: eq, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - }, - }), - new AssetConfig({ - asset: eqd, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: equilibriumAlphanet, - destinationFee: { - amount: 4, - asset: eqd, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: lit, balance: BalanceBuilder().substrate().assets().account(), diff --git a/packages/sdk/src/polkadot/PolkadotService.ts b/packages/sdk/src/polkadot/PolkadotService.ts index f61fef9b..ef634242 100644 --- a/packages/sdk/src/polkadot/PolkadotService.ts +++ b/packages/sdk/src/polkadot/PolkadotService.ts @@ -9,7 +9,6 @@ import { darwiniaPangoro, eq, equilibrium, - equilibriumAlphanet, paring, } from '@moonbeam-network/xcm-config'; import { @@ -74,10 +73,7 @@ export class PolkadotService { // TODO: Remove this once Equilibrium is updated // or find better way if issue appears on other chains - if ( - key === 'token' && - [equilibriumAlphanet.key, equilibrium.key].includes(this.chain.key) - ) { + if (key === 'token' && [equilibrium.key].includes(this.chain.key)) { return eq; } From 4e6e0f0a7454c609dc4cb7e3264ea4f2b73e5839 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 21:25:04 +1300 Subject: [PATCH 04/12] Version Packages (#183) Co-authored-by: github-actions[bot] --- .changeset/fuzzy-cherries-dress.md | 6 ------ examples/sdk-simple/package.json | 4 ++-- package-lock.json | 10 +++++----- packages/config/CHANGELOG.md | 6 ++++++ packages/config/package.json | 2 +- packages/sdk/CHANGELOG.md | 9 +++++++++ packages/sdk/package.json | 4 ++-- 7 files changed, 25 insertions(+), 16 deletions(-) delete mode 100644 .changeset/fuzzy-cherries-dress.md diff --git a/.changeset/fuzzy-cherries-dress.md b/.changeset/fuzzy-cherries-dress.md deleted file mode 100644 index 10f8632f..00000000 --- a/.changeset/fuzzy-cherries-dress.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@moonbeam-network/xcm-config': patch -'@moonbeam-network/xcm-sdk': patch ---- - -Remove equilibrium alphanet config diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 3091a9f2..6919ae01 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.19", - "@moonbeam-network/xcm-sdk": "1.4.15", + "@moonbeam-network/xcm-config": "1.3.20", + "@moonbeam-network/xcm-sdk": "1.4.16", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index a66cd325..51a29eb4 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.19", - "@moonbeam-network/xcm-sdk": "1.4.15", + "@moonbeam-network/xcm-config": "1.3.20", + "@moonbeam-network/xcm-sdk": "1.4.16", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -17004,7 +17004,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.19", + "version": "1.3.20", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.10", @@ -17018,11 +17018,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.15", + "version": "1.4.16", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.19", + "@moonbeam-network/xcm-config": "1.3.20", "@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 96772c2a..452e5935 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 1.3.20 + +### Patch Changes + +- [#182](https://github.com/PureStake/xcm-sdk/pull/182) [`6beaf73`](https://github.com/PureStake/xcm-sdk/commit/6beaf73e39d339f6221b7346758822f63bbf99e3) Thanks [@mmaurello](https://github.com/mmaurello)! - Remove equilibrium alphanet config + ## 1.3.19 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 2990ffc9..9173b6c8 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.19", + "version": "1.3.20", "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 082281b2..7e77706f 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-sdk +## 1.4.16 + +### Patch Changes + +- [#182](https://github.com/PureStake/xcm-sdk/pull/182) [`6beaf73`](https://github.com/PureStake/xcm-sdk/commit/6beaf73e39d339f6221b7346758822f63bbf99e3) Thanks [@mmaurello](https://github.com/mmaurello)! - Remove equilibrium alphanet config + +- Updated dependencies [[`6beaf73`](https://github.com/PureStake/xcm-sdk/commit/6beaf73e39d339f6221b7346758822f63bbf99e3)]: + - @moonbeam-network/xcm-config@1.3.20 + ## 1.4.15 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 2f30d645..500a8083 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.15", + "version": "1.4.16", "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": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.19", + "@moonbeam-network/xcm-config": "1.3.20", "@moonbeam-network/xcm-types": "1.0.1", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" From 88b6322327b30baa0fb2bf55f99497e2944c95ef Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Wed, 17 Jan 2024 21:34:49 +1300 Subject: [PATCH 05/12] Adjust weight limit, always use unlimited (fix Bifrost issue) (#184) * always use unlimited weight limit to fix bifrost issues * update snapshot * add changeset --- .changeset/late-carpets-suffer.md | 6 +++++ .../__snapshots__/xTokens.test.ts.snap | 6 ++--- .../src/extrinsic/pallets/xTokens/xTokens.ts | 14 +++++----- .../pallets/xTokens/xTokens.utils.ts | 27 +++---------------- .../types/src/chain/parachain/Parachain.ts | 4 +-- 5 files changed, 21 insertions(+), 36 deletions(-) create mode 100644 .changeset/late-carpets-suffer.md diff --git a/.changeset/late-carpets-suffer.md b/.changeset/late-carpets-suffer.md new file mode 100644 index 00000000..584c223b --- /dev/null +++ b/.changeset/late-carpets-suffer.md @@ -0,0 +1,6 @@ +--- +'@moonbeam-network/xcm-builder': patch +'@moonbeam-network/xcm-types': patch +--- + +Use unlimited weight in all transactions for the xTokens pallet diff --git a/packages/builder/src/extrinsic/pallets/xTokens/__snapshots__/xTokens.test.ts.snap b/packages/builder/src/extrinsic/pallets/xTokens/__snapshots__/xTokens.test.ts.snap index e388f1bd..00588e79 100644 --- a/packages/builder/src/extrinsic/pallets/xTokens/__snapshots__/xTokens.test.ts.snap +++ b/packages/builder/src/extrinsic/pallets/xTokens/__snapshots__/xTokens.test.ts.snap @@ -30,7 +30,7 @@ exports[`xTokens transfer should get correct arguments 1`] = ` "parents": 1, }, }, - 1000000000, + "Unlimited", ] `; @@ -85,7 +85,7 @@ exports[`xTokens transferMultiAsset parachain should get correct arguments 1`] = "parents": 1, }, }, - 1000000000, + "Unlimited", ] `; @@ -188,7 +188,7 @@ exports[`xTokens transferMultiAsset x2 should get correct arguments 1`] = ` "parents": 1, }, }, - 1000000000, + "Unlimited", ] `; diff --git a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts index 5a55f22a..b05ec066 100644 --- a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts +++ b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts @@ -12,7 +12,7 @@ const pallet = 'xTokens'; export function xTokens() { return { transfer: (): ExtrinsicConfigBuilder => ({ - build: ({ address, amount, asset, destination, source }) => + build: ({ address, amount, asset, destination }) => new ExtrinsicConfig({ module: pallet, func: 'transfer', @@ -23,7 +23,7 @@ export function xTokens() { asset, amount, getDestination(version, address, destination), - getWeight(source.weight, func), + getWeight(), ]; }, }), @@ -55,7 +55,7 @@ export function xTokens() { }, }, getDestination(version, address, destination), - 'Unlimited', + getWeight(), ]; }, }), @@ -87,13 +87,13 @@ export function xTokens() { }, }, getDestination(version, address, destination), - 'Unlimited', + getWeight(), ]; }, }), }), X2: (): ExtrinsicConfigBuilder => ({ - build: ({ address, amount, asset, destination, source }) => + build: ({ address, amount, asset, destination }) => new ExtrinsicConfig({ module: pallet, func: funcName, @@ -124,7 +124,7 @@ export function xTokens() { }, }, getDestination(version, address, destination), - getWeight(source.weight, func), + getWeight(), ]; }, }), @@ -143,7 +143,7 @@ export function xTokens() { ], 1, getDestination(XcmVersion.v3, address, destination), - 'Unlimited', + getWeight(), ], }), }), diff --git a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.utils.ts b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.utils.ts index 2b44f740..1a6518af 100644 --- a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.utils.ts +++ b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.utils.ts @@ -1,34 +1,13 @@ import { AnyChain } from '@moonbeam-network/xcm-types'; -import { SubmittableExtrinsicFunction } from '@polkadot/api/types'; import { XcmVersion } from '../../ExtrinsicBuilder.interfaces'; import { getExtrinsicAccount } from '../../ExtrinsicBuilder.utils'; import { XTokensWeightLimit } from './xTokens.interfaces'; /** - * Workaround for weight parameter type change in xTokens pallet - * https://github.com/open-web3-stack/open-runtime-module-library/pull/841 + * It is safer to always use unlimited */ -export function getWeight( - weight: number, - func?: SubmittableExtrinsicFunction<'promise'>, -): XTokensWeightLimit { - const type = func?.meta.args.at(-1)?.type; - - if (!type) { - return weight; - } - - if (type.eq('XcmV2WeightLimit')) { - return { - Limited: weight, - }; - } - - if (type.eq('XcmV3WeightLimit')) { - return 'Unlimited'; - } - - return weight; +export function getWeight(): XTokensWeightLimit { + return 'Unlimited'; } export function getDestination( diff --git a/packages/types/src/chain/parachain/Parachain.ts b/packages/types/src/chain/parachain/Parachain.ts index b7f57950..03cb14ae 100644 --- a/packages/types/src/chain/parachain/Parachain.ts +++ b/packages/types/src/chain/parachain/Parachain.ts @@ -23,7 +23,7 @@ export class Parachain extends Chain { readonly ss58Format: number; - readonly weight: number; + readonly weight: number | undefined; readonly ws: string; @@ -46,7 +46,7 @@ export class Parachain extends Chain { this.genesisHash = genesisHash; this.parachainId = parachainId; this.ss58Format = ss58Format; - this.weight = weight ?? 1_000_000_000; + this.weight = weight; this.ws = ws; } From bd9722729a6bc8b6f6e450ffb403af3637a1a1f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 21:36:35 +1300 Subject: [PATCH 06/12] Version Packages (#185) Co-authored-by: github-actions[bot] --- .changeset/late-carpets-suffer.md | 6 ------ examples/sdk-simple/package.json | 4 ++-- package-lock.json | 24 ++++++++++++------------ packages/builder/CHANGELOG.md | 9 +++++++++ packages/builder/package.json | 4 ++-- packages/config/CHANGELOG.md | 8 ++++++++ packages/config/package.json | 6 +++--- packages/sdk/CHANGELOG.md | 9 +++++++++ packages/sdk/package.json | 8 ++++---- packages/types/CHANGELOG.md | 6 ++++++ packages/types/package.json | 2 +- 11 files changed, 56 insertions(+), 30 deletions(-) delete mode 100644 .changeset/late-carpets-suffer.md diff --git a/.changeset/late-carpets-suffer.md b/.changeset/late-carpets-suffer.md deleted file mode 100644 index 584c223b..00000000 --- a/.changeset/late-carpets-suffer.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@moonbeam-network/xcm-builder': patch -'@moonbeam-network/xcm-types': patch ---- - -Use unlimited weight in all transactions for the xTokens pallet diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 6919ae01..fd128596 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.20", - "@moonbeam-network/xcm-sdk": "1.4.16", + "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-sdk": "1.4.17", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 51a29eb4..1d9483ca 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.20", - "@moonbeam-network/xcm-sdk": "1.4.16", + "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-sdk": "1.4.17", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -16976,10 +16976,10 @@ }, "packages/builder": { "name": "@moonbeam-network/xcm-builder", - "version": "1.0.10", + "version": "1.0.11", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-types": "1.0.1", + "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1", "type-fest": "^3.8.0" @@ -17004,11 +17004,11 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.20", + "version": "1.3.21", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-types": "1.0.1" + "@moonbeam-network/xcm-builder": "1.0.11", + "@moonbeam-network/xcm-types": "1.0.2" }, "peerDependencies": { "@polkadot/types": "^10.10.1", @@ -17018,12 +17018,12 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.16", + "version": "1.4.17", "license": "MIT", "dependencies": { - "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.20", - "@moonbeam-network/xcm-types": "1.0.1", + "@moonbeam-network/xcm-builder": "1.0.11", + "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" }, @@ -17038,7 +17038,7 @@ }, "packages/types": { "name": "@moonbeam-network/xcm-types", - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-utils": "1.x", diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md index c5d3ec1d..b3373efb 100644 --- a/packages/builder/CHANGELOG.md +++ b/packages/builder/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-builder +## 1.0.11 + +### Patch Changes + +- [#184](https://github.com/PureStake/xcm-sdk/pull/184) [`88b6322`](https://github.com/PureStake/xcm-sdk/commit/88b6322327b30baa0fb2bf55f99497e2944c95ef) Thanks [@mmaurello](https://github.com/mmaurello)! - Use unlimited weight in all transactions for the xTokens pallet + +- Updated dependencies [[`88b6322`](https://github.com/PureStake/xcm-sdk/commit/88b6322327b30baa0fb2bf55f99497e2944c95ef)]: + - @moonbeam-network/xcm-types@1.0.2 + ## 1.0.10 ### Patch Changes diff --git a/packages/builder/package.json b/packages/builder/package.json index 1ef3c9e2..ffd35037 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-builder", - "version": "1.0.10", + "version": "1.0.11", "description": "Moonbeam XCM builder", "scripts": { "build": "tsup", @@ -50,7 +50,7 @@ "types": "./build/index.d.ts", "main": "./build/index.cjs", "dependencies": { - "@moonbeam-network/xcm-types": "1.0.1", + "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1", "type-fest": "^3.8.0" diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 452e5935..c1eec703 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,13 @@ # @moonbeam-network/xcm-config +## 1.3.21 + +### Patch Changes + +- Updated dependencies [[`88b6322`](https://github.com/PureStake/xcm-sdk/commit/88b6322327b30baa0fb2bf55f99497e2944c95ef)]: + - @moonbeam-network/xcm-builder@1.0.11 + - @moonbeam-network/xcm-types@1.0.2 + ## 1.3.20 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 9173b6c8..ad8dbc91 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.20", + "version": "1.3.21", "description": "All necessary configuration to transfer assets from Moonbeam, Moonriver, Moonbase to other parachains and back", "scripts": { "build": "tsup", @@ -50,8 +50,8 @@ "types": "./build/index.d.ts", "main": "./build/index.cjs", "dependencies": { - "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-types": "1.0.1" + "@moonbeam-network/xcm-builder": "1.0.11", + "@moonbeam-network/xcm-types": "1.0.2" }, "peerDependencies": { "@polkadot/types": "^10.10.1", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 7e77706f..a5bf1a0c 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,14 @@ # @moonbeam-network/xcm-sdk +## 1.4.17 + +### Patch Changes + +- Updated dependencies [[`88b6322`](https://github.com/PureStake/xcm-sdk/commit/88b6322327b30baa0fb2bf55f99497e2944c95ef)]: + - @moonbeam-network/xcm-builder@1.0.11 + - @moonbeam-network/xcm-types@1.0.2 + - @moonbeam-network/xcm-config@1.3.21 + ## 1.4.16 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 500a8083..4ac94f09 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.16", + "version": "1.4.17", "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,9 +51,9 @@ "types": "./build/index.d.ts", "main": "./build/index.cjs", "dependencies": { - "@moonbeam-network/xcm-builder": "1.0.10", - "@moonbeam-network/xcm-config": "1.3.20", - "@moonbeam-network/xcm-types": "1.0.1", + "@moonbeam-network/xcm-builder": "1.0.11", + "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" }, diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 0eff6272..60b50754 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-types +## 1.0.2 + +### Patch Changes + +- [#184](https://github.com/PureStake/xcm-sdk/pull/184) [`88b6322`](https://github.com/PureStake/xcm-sdk/commit/88b6322327b30baa0fb2bf55f99497e2944c95ef) Thanks [@mmaurello](https://github.com/mmaurello)! - Use unlimited weight in all transactions for the xTokens pallet + ## 1.0.1 ### Patch Changes diff --git a/packages/types/package.json b/packages/types/package.json index 2bb5476e..162a3401 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-types", - "version": "1.0.1", + "version": "1.0.2", "description": "Moonbeam XCM Types", "scripts": { "build": "tsup", From f72cf9b55e20c24294971a41ff7b3dc82d588126 Mon Sep 17 00:00:00 2001 From: albertov19 <64150856+albertov19@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:48:34 +0100 Subject: [PATCH 07/12] Updated Calamari Endpoint (#186) * Updated Calamari Endpoint * add changeset --------- Co-authored-by: mmaurello <93129175+mmaurello@users.noreply.github.com> --- .changeset/late-houses-type.md | 5 +++++ packages/config/src/chains.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/late-houses-type.md diff --git a/.changeset/late-houses-type.md b/.changeset/late-houses-type.md new file mode 100644 index 00000000..10e69d42 --- /dev/null +++ b/.changeset/late-houses-type.md @@ -0,0 +1,5 @@ +--- +"@moonbeam-network/xcm-config": patch +--- + +Updated Calamari Endpoint diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 0b17c818..07c38477 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -254,7 +254,7 @@ export const calamari = new Parachain({ name: 'Calamari', parachainId: 2084, ss58Format: 78, - ws: 'wss://ws.calamari.systems', + ws: 'wss://calamari.systems', }); export const centrifuge = new Parachain({ From d26fa1035414b47201ead77d92ca3a389767b8f5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 00:55:19 +1300 Subject: [PATCH 08/12] Version Packages (#187) Co-authored-by: github-actions[bot] --- .changeset/late-houses-type.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/late-houses-type.md diff --git a/.changeset/late-houses-type.md b/.changeset/late-houses-type.md deleted file mode 100644 index 10e69d42..00000000 --- a/.changeset/late-houses-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonbeam-network/xcm-config": patch ---- - -Updated Calamari Endpoint diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index fd128596..5bf4bc8d 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.21", - "@moonbeam-network/xcm-sdk": "1.4.17", + "@moonbeam-network/xcm-config": "1.3.22", + "@moonbeam-network/xcm-sdk": "1.4.18", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 1d9483ca..33c9ad65 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.21", - "@moonbeam-network/xcm-sdk": "1.4.17", + "@moonbeam-network/xcm-config": "1.3.22", + "@moonbeam-network/xcm-sdk": "1.4.18", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -17004,7 +17004,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.21", + "version": "1.3.22", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.11", @@ -17018,11 +17018,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.17", + "version": "1.4.18", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.11", - "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-config": "1.3.22", "@moonbeam-network/xcm-types": "1.0.2", "@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 c1eec703..cf601f53 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 1.3.22 + +### Patch Changes + +- [#186](https://github.com/PureStake/xcm-sdk/pull/186) [`f72cf9b`](https://github.com/PureStake/xcm-sdk/commit/f72cf9b55e20c24294971a41ff7b3dc82d588126) Thanks [@albertov19](https://github.com/albertov19)! - Updated Calamari Endpoint + ## 1.3.21 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index ad8dbc91..454639ca 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.21", + "version": "1.3.22", "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 a5bf1a0c..a7b3ecd7 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonbeam-network/xcm-sdk +## 1.4.18 + +### Patch Changes + +- Updated dependencies [[`f72cf9b`](https://github.com/PureStake/xcm-sdk/commit/f72cf9b55e20c24294971a41ff7b3dc82d588126)]: + - @moonbeam-network/xcm-config@1.3.22 + ## 1.4.17 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 4ac94f09..ee8fd616 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.17", + "version": "1.4.18", "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": "1.0.11", - "@moonbeam-network/xcm-config": "1.3.21", + "@moonbeam-network/xcm-config": "1.3.22", "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" From 1b0992493f5afac24e7cdbfd907303f7d450860c Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Mon, 22 Jan 2024 23:05:35 +1300 Subject: [PATCH 09/12] Remove obsolete integration (#188) * remove litentry alphanet configuration * change parallel endpoint * add changeset --- .changeset/many-ladybugs-tickle.md | 5 ++++ packages/config/src/chains.ts | 21 +-------------- packages/config/src/configs/index.ts | 2 -- .../config/src/configs/litentryAlphanet.ts | 26 ------------------- packages/config/src/configs/moonbaseAlpha.ts | 17 ------------ 5 files changed, 6 insertions(+), 65 deletions(-) create mode 100644 .changeset/many-ladybugs-tickle.md delete mode 100644 packages/config/src/configs/litentryAlphanet.ts diff --git a/.changeset/many-ladybugs-tickle.md b/.changeset/many-ladybugs-tickle.md new file mode 100644 index 00000000..2c279dd1 --- /dev/null +++ b/.changeset/many-ladybugs-tickle.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-config': patch +--- + +Remove Litentry alphanet and change Parallel endpoint diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 07c38477..82d9826e 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -600,24 +600,6 @@ export const kusamaAssetHub = new Parachain({ ws: 'wss://kusama-asset-hub-rpc.polkadot.io', }); -export const litentryAlphanet = new Parachain({ - assetsData: [ - { - asset: lit, - id: 'SelfReserve', - }, - ], - ecosystem: Ecosystem.AlphanetRelay, - genesisHash: - '0x4decfd421755d9008781d00ce40ea4cf47ec24a3717a34ca995126fc4a78c4f8', - isTestChain: true, - key: 'litentry-alphanet', - name: 'Litentry Alphanet', - parachainId: 2106, - ss58Format: 131, - ws: 'wss://moonbase-parachain-sg-0.litentry.io', -}); - export const litmus = new Parachain({ assetsData: [ { @@ -1095,7 +1077,7 @@ export const parallel = new Parachain({ name: 'Parallel', parachainId: 2012, ss58Format: 172, - ws: 'wss://polkadot-parallel-rpc.parallel.fi', + ws: 'wss://parallel-rpc.dwellir.com', }); export const parallelHeiko = new Parachain({ @@ -1422,7 +1404,6 @@ export const chainsList: AnyChain[] = [ khala, kintsugi, kusama, - litentryAlphanet, litmus, mangataKusama, moonbaseAlpha, diff --git a/packages/config/src/configs/index.ts b/packages/config/src/configs/index.ts index f42f0247..5d250cab 100644 --- a/packages/config/src/configs/index.ts +++ b/packages/config/src/configs/index.ts @@ -21,7 +21,6 @@ import { khalaConfig } from './khala'; import { kintsugiConfig } from './kintsugi'; import { kusamaConfig } from './kusama'; import { kusamaAssetHubConfig } from './kusamaAssetHub'; -import { litentryAlphanetConfig } from './litentryAlphanet'; import { litmusConfig } from './litmus'; import { mangataKusamaConfig } from './mangataKusama'; import { moonbaseAlphaConfig } from './moonbaseAlpha'; @@ -68,7 +67,6 @@ export const chainsConfigList: ChainConfig[] = [ khalaConfig, kintsugiConfig, kusamaConfig, - litentryAlphanetConfig, litmusConfig, mangataKusamaConfig, moonbaseAlphaConfig, diff --git a/packages/config/src/configs/litentryAlphanet.ts b/packages/config/src/configs/litentryAlphanet.ts deleted file mode 100644 index 9d76b5a0..00000000 --- a/packages/config/src/configs/litentryAlphanet.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { - BalanceBuilder, - ExtrinsicBuilder, - FeeBuilder, -} from '@moonbeam-network/xcm-builder'; -import { lit } from '../assets'; -import { litentryAlphanet, moonbaseAlpha } from '../chains'; -import { AssetConfig } from '../types/AssetConfig'; -import { ChainConfig } from '../types/ChainConfig'; - -export const litentryAlphanetConfig = new ChainConfig({ - assets: [ - new AssetConfig({ - asset: lit, - balance: BalanceBuilder().substrate().system().account(), - destination: moonbaseAlpha, - destinationFee: { - amount: FeeBuilder().assetManager().assetTypeUnitsPerSecond(), - asset: lit, - balance: BalanceBuilder().substrate().system().account(), - }, - extrinsic: ExtrinsicBuilder().xTokens().transfer(), - }), - ], - chain: litentryAlphanet, -}); diff --git a/packages/config/src/configs/moonbaseAlpha.ts b/packages/config/src/configs/moonbaseAlpha.ts index ceb95b63..b362fd1c 100644 --- a/packages/config/src/configs/moonbaseAlpha.ts +++ b/packages/config/src/configs/moonbaseAlpha.ts @@ -4,7 +4,6 @@ import { ampe, atom, dev, - lit, otp, paring, pica, @@ -16,7 +15,6 @@ import { alphanetAssetHub, alphanetRelay, darwiniaPangoro, - litentryAlphanet, moonbaseAlpha, moonbaseBeta, originTrailAlphanet, @@ -118,21 +116,6 @@ export const moonbaseAlphaConfig = new ChainConfig({ balance: BalanceBuilder().substrate().system().account(), }, }), - new AssetConfig({ - asset: lit, - balance: BalanceBuilder().substrate().assets().account(), - contract: ContractBuilder().Xtokens().transfer(), - destination: litentryAlphanet, - destinationFee: { - amount: 0.032, - asset: lit, - balance: BalanceBuilder().substrate().assets().account(), - }, - fee: { - asset: dev, - balance: BalanceBuilder().substrate().system().account(), - }, - }), new AssetConfig({ asset: otp, balance: BalanceBuilder().substrate().assets().account(), From d7d021cd93d0ba11d5575b316cf11251a222e820 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 00:26:09 +1300 Subject: [PATCH 10/12] Version Packages (#189) Co-authored-by: github-actions[bot] --- .changeset/many-ladybugs-tickle.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/many-ladybugs-tickle.md diff --git a/.changeset/many-ladybugs-tickle.md b/.changeset/many-ladybugs-tickle.md deleted file mode 100644 index 2c279dd1..00000000 --- a/.changeset/many-ladybugs-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@moonbeam-network/xcm-config': patch ---- - -Remove Litentry alphanet and change Parallel endpoint diff --git a/examples/sdk-simple/package.json b/examples/sdk-simple/package.json index 5bf4bc8d..787bc6be 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.22", - "@moonbeam-network/xcm-sdk": "1.4.18", + "@moonbeam-network/xcm-config": "1.3.23", + "@moonbeam-network/xcm-sdk": "1.4.19", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index 33c9ad65..822e3dbd 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.22", - "@moonbeam-network/xcm-sdk": "1.4.18", + "@moonbeam-network/xcm-config": "1.3.23", + "@moonbeam-network/xcm-sdk": "1.4.19", "@moonbeam-network/xcm-utils": "1.0.3" }, "devDependencies": { @@ -17004,7 +17004,7 @@ }, "packages/config": { "name": "@moonbeam-network/xcm-config", - "version": "1.3.22", + "version": "1.3.23", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.11", @@ -17018,11 +17018,11 @@ }, "packages/sdk": { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.18", + "version": "1.4.19", "license": "MIT", "dependencies": { "@moonbeam-network/xcm-builder": "1.0.11", - "@moonbeam-network/xcm-config": "1.3.22", + "@moonbeam-network/xcm-config": "1.3.23", "@moonbeam-network/xcm-types": "1.0.2", "@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 cf601f53..9d9157fe 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonbeam-network/xcm-config +## 1.3.23 + +### Patch Changes + +- [#188](https://github.com/PureStake/xcm-sdk/pull/188) [`1b09924`](https://github.com/PureStake/xcm-sdk/commit/1b0992493f5afac24e7cdbfd907303f7d450860c) Thanks [@mmaurello](https://github.com/mmaurello)! - Remove Litentry alphanet and change Parallel endpoint + ## 1.3.22 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 454639ca..a914d19d 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-config", - "version": "1.3.22", + "version": "1.3.23", "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 a7b3ecd7..68728ac5 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonbeam-network/xcm-sdk +## 1.4.19 + +### Patch Changes + +- Updated dependencies [[`1b09924`](https://github.com/PureStake/xcm-sdk/commit/1b0992493f5afac24e7cdbfd907303f7d450860c)]: + - @moonbeam-network/xcm-config@1.3.23 + ## 1.4.18 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ee8fd616..a7982619 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonbeam-network/xcm-sdk", - "version": "1.4.18", + "version": "1.4.19", "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": "1.0.11", - "@moonbeam-network/xcm-config": "1.3.22", + "@moonbeam-network/xcm-config": "1.3.23", "@moonbeam-network/xcm-types": "1.0.2", "@moonbeam-network/xcm-utils": "1.0.3", "big.js": "^6.2.1" From 9257ddb62ede7b0bda3e24385b119b65b456639d Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:48:11 +1300 Subject: [PATCH 11/12] add empty workflow with workflow dispatch (#190) --- .github/workflows/xcm-wss-endpoints-monitor.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/xcm-wss-endpoints-monitor.yml diff --git a/.github/workflows/xcm-wss-endpoints-monitor.yml b/.github/workflows/xcm-wss-endpoints-monitor.yml new file mode 100644 index 00000000..3b915be5 --- /dev/null +++ b/.github/workflows/xcm-wss-endpoints-monitor.yml @@ -0,0 +1,12 @@ +name: XCM WS endpoints monitor + +on: + workflow_dispatch: + +jobs: + run_script: + runs-on: ubuntu-latest + + steps: + - name: hello world + run: echo "Hello World!" From fc7505e9e1ec65fca051c56786faa4e137655217 Mon Sep 17 00:00:00 2001 From: mmaurello <93129175+mmaurello@users.noreply.github.com> Date: Wed, 24 Jan 2024 00:36:40 +1300 Subject: [PATCH 12/12] Monitor ws endpoints with script execution (#191) * xcm ws endpoints monitor script * add workflow * fix workflow * add build step * fix build misplacement * remove include test chains param --- .../workflows/xcm-wss-endpoints-monitor.yml | 25 ++++- package-lock.json | 84 +++++++++++++-- package.json | 1 + scripts/check-websockets.ts | 100 ++++++++++++++++++ 4 files changed, 202 insertions(+), 8 deletions(-) create mode 100644 scripts/check-websockets.ts diff --git a/.github/workflows/xcm-wss-endpoints-monitor.yml b/.github/workflows/xcm-wss-endpoints-monitor.yml index 3b915be5..7ce1b628 100644 --- a/.github/workflows/xcm-wss-endpoints-monitor.yml +++ b/.github/workflows/xcm-wss-endpoints-monitor.yml @@ -2,11 +2,32 @@ name: XCM WS endpoints monitor on: workflow_dispatch: + schedule: + # Runs every 30 minutes + - cron: '*/30 * * * *' jobs: run_script: runs-on: ubuntu-latest steps: - - name: hello world - run: echo "Hello World!" + - name: 🤘 checkout + uses: actions/checkout@v3 + + - name: ⚙️ Setup Node.js environment + uses: actions/setup-node@v3.0.0 + with: + node-version: 18.x + cache: 'npm' + + - name: Update npm + run: npm i -g npm@9 + + - name: ⬇️ install + run: npm ci --ignore-scripts + + - name: 🛠️ Build + run: npm run build + + - name: 💻 Run script + run: npx bun ./scripts/check-websockets.ts --slack-wh=${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/package-lock.json b/package-lock.json index 822e3dbd..677ffa93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "devDependencies": { "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", + "@slack/webhook": "^7.0.2", "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.59.8", @@ -5148,6 +5149,31 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@slack/types": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/@slack/types/-/types-2.11.0.tgz", + "integrity": "sha512-UlIrDWvuLaDly3QZhCPnwUSI/KYmV1N9LyhuH6EDKCRS1HWZhyTG3Ja46T3D0rYfqdltKYFXbJSSRPwZpwO0cQ==", + "dev": true, + "engines": { + "node": ">= 12.13.0", + "npm": ">= 6.12.0" + } + }, + "node_modules/@slack/webhook": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@slack/webhook/-/webhook-7.0.2.tgz", + "integrity": "sha512-dsrO/ow6a6+xkLm/lZKbUNTsFJlBc679tD+qwlVTztsQkDxPLH6odM7FKALz1IHa+KpLX8HKUIPV13a7y7z29w==", + "dev": true, + "dependencies": { + "@slack/types": "^2.9.0", + "@types/node": ">=18.0.0", + "axios": "^1.6.3" + }, + "engines": { + "node": ">= 18", + "npm": ">= 8.6.0" + } + }, "node_modules/@snowfork/snowbridge-types": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/@snowfork/snowbridge-types/-/snowbridge-types-0.2.7.tgz", @@ -6578,8 +6604,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "peer": true + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/available-typed-arrays": { "version": "1.0.5", @@ -6593,6 +6618,31 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/axios": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.4", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/babel-jest": { "version": "29.6.1", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.1.tgz", @@ -7360,7 +7410,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -7625,7 +7674,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "peer": true, "engines": { "node": ">=0.4.0" } @@ -8832,6 +8880,26 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -12393,7 +12461,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "peer": true, "engines": { "node": ">= 0.6" } @@ -12402,7 +12469,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -14398,6 +14464,12 @@ "node": ">= 8" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", diff --git a/package.json b/package.json index 2a72cf45..1df6f46a 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "devDependencies": { "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", + "@slack/webhook": "^7.0.2", "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.59.8", diff --git a/scripts/check-websockets.ts b/scripts/check-websockets.ts new file mode 100644 index 00000000..9023cbe2 --- /dev/null +++ b/scripts/check-websockets.ts @@ -0,0 +1,100 @@ +/* eslint-disable import/no-extraneous-dependencies */ +/* eslint-disable no-console */ +import { chainsList } from '@moonbeam-network/xcm-config'; +import { IncomingWebhook } from '@slack/webhook'; +import WebSocket from 'ws'; + +function procesArgs() { + const args = process.argv; + const incudeTestChains = args.some((arg) => arg === '--include-test-chains'); + const slackWebhookArg = args.find((arg) => arg.startsWith('--slack-wh=')); + const webhookUrl = slackWebhookArg ? slackWebhookArg.split('=')[1] : ''; + return { incudeTestChains, webhookUrl }; +} + +async function checkWebSocketEndpoints( + endpoints: ChainEndpoint[], +): Promise<{ endpoint: ChainEndpoint; isAlive: boolean }[]> { + async function checkIsWebSocketAlive({ + chainKey, + ws: endpoint, + }: ChainEndpoint): Promise { + return new Promise((resolve) => { + const ws = new WebSocket(endpoint); + + let isAlive = false; + + ws.on('error', (error) => { + console.error( + `WebSocket ${chainKey} connection to ${endpoint} failed. Error: ${error.message}`, + ); + resolve(false); + }); + + ws.on('open', () => { + console.log( + `WebSocket ${chainKey} connection to ${endpoint} successful.`, + ); + isAlive = true; + ws.terminate(); + }); + + ws.on('close', () => { + resolve(isAlive); + }); + }); + } + + return Promise.all( + endpoints.map(async (endpoint) => { + const isAlive = await checkIsWebSocketAlive(endpoint); + + return { endpoint, isAlive }; + }), + ); +} + +const { incudeTestChains, webhookUrl } = procesArgs(); + +const webhook = new IncomingWebhook(webhookUrl); + +interface ChainEndpoint { + chainKey: string; + ws: string; +} + +const filteredChainList = incudeTestChains + ? chainsList + : chainsList.filter((chain) => !chain.isTestChain); + +const websocketEndpoints = filteredChainList.map(({ key, ws }) => ({ + chainKey: key, + ws, +})); + +if (incudeTestChains) { + console.log('Checking the endpoints of all chains, including test chains...'); +} + +checkWebSocketEndpoints(websocketEndpoints).then(async (results) => { + let output = ''; + + results.forEach(({ isAlive, endpoint: { chainKey, ws } }) => { + if (!isAlive) { + output += `\n${chainKey}: \`${ws}\`,`; + } + }); + + if (output) { + const text = `The following websocket endpoints from the XCM integrations in the dapp are not working, please review them: ${output}`; + + console.log(text); + if (webhookUrl) { + await webhook.send({ + text, + }); + } else { + console.warn('Slack webhook not detected, notification not sent'); + } + } +});