diff --git a/examples/mrl-simple/index.ts b/examples/mrl-simple/index.ts index 7d8a5571..73e6901d 100644 --- a/examples/mrl-simple/index.ts +++ b/examples/mrl-simple/index.ts @@ -1,9 +1,21 @@ import { Mrl } from '@moonbeam-network/mrl'; -import { fantomTestnet, ftm, peaqAlphanet } from '@moonbeam-network/xcm-config'; +import { + agng, + dev, + fantomTestnet, + ftm, + ftmwh, + moonbaseAlpha, + moonbaseBeta, + peaqAlphanet, + peaqEvmAlphanet, +} from '@moonbeam-network/xcm-config'; +import type { Asset } from '@moonbeam-network/xcm-types'; import { Keyring } from '@polkadot/api'; import { cryptoWaitReady } from '@polkadot/util-crypto'; import { http, type Address, createWalletClient } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; +import { moonbaseAlpha as moonbaseAlphaViem } from 'viem/chains'; // disable unnecessary warning logs console.warn = () => null; @@ -20,11 +32,6 @@ if (!EVM_PRIVATE_KEY || !POLKADOT_PRIVATE_KEY) { // EVM Signer =========================================================== const account = privateKeyToAccount(EVM_PRIVATE_KEY as Address); -const walletClient = createWalletClient({ - account, - chain: fantomTestnet.getViemChain(), - transport: http(), -}); console.log(`\nEVM address: ${account.address}`); @@ -47,14 +54,112 @@ main() .finally(() => process.exit()); async function main() { + // await fromFantomToPeaq(ftm, 0.011); + // await fromFantomToMoonbase(ftm, 0.01); + // await fromMoonbaseToFantom(dev, 0.01); + // await fromPeaqToFantom(ftmwh, 0.1); + await fromPeaqEvmToFantom(ftmwh, 0.12); +} + +async function fromFantomToPeaq(asset: Asset, amount: number) { const data = await Mrl() .setSource(fantomTestnet) .setDestination(peaqAlphanet) - .setAsset(ftm) + .setAsset(asset) .setAddresses({ sourceAddress: account.address, destinationAddress: pair.address, }); console.log(data); + + await data.transfer(amount, { + polkadotSigner: pair, + evmSigner: walletClient, + }); +} + +async function fromFantomToMoonbase(asset: Asset, amount: number) { + const walletClient = createWalletClient({ + account, + chain: fantomTestnet.getViemChain(), + transport: http(), + }); + + const data = await Mrl() + .setSource(fantomTestnet) + .setDestination(moonbaseAlpha) + .setAsset(dev) + .setAddresses({ + sourceAddress: account.address, + destinationAddress: account.address, + }); + + console.log(data); + + await data.transfer(0.5, { + polkadotSigner: pair, + evmSigner: walletClient, + }); +} + +async function fromMoonbaseToFantom(asset: Asset, amount: number) { + const walletClient = createWalletClient({ + account, + chain: moonbaseAlphaViem, + transport: http(), + }); + const data = await Mrl() + .setSource(moonbaseAlpha) + .setDestination(fantomTestnet) + .setAsset(asset) + .setAddresses({ + sourceAddress: account.address, + destinationAddress: account.address, + }); + + console.log(data); + + await data.transfer(amount, { + polkadotSigner: pair, + evmSigner: walletClient, + }); +} + +async function fromPeaqToFantom(asset: Asset, amount: number) { + const data = await Mrl() + .setSource(peaqAlphanet) + .setDestination(fantomTestnet) + .setAsset(asset) + .setAddresses({ + sourceAddress: pair.address, + destinationAddress: account.address, + }); + + console.log(data); + + await data.transfer(amount, { + polkadotSigner: pair, + }); +} + +async function fromPeaqEvmToFantom(asset: Asset, amount: number) { + const walletClient = createWalletClient({ + account, + chain: peaqEvmAlphanet.getViemChain(), + transport: http(), + }); + + const data = await Mrl() + .setSource(peaqEvmAlphanet) + .setDestination(fantomTestnet) + .setAsset(asset) + .setAddresses({ + sourceAddress: account.address, + destinationAddress: account.address, + }); + + console.log(data); + + await data.transfer(amount, { evmSigner: walletClient }); } diff --git a/examples/mrl-simple/package.json b/examples/mrl-simple/package.json index 0497de47..1ecf7d35 100644 --- a/examples/mrl-simple/package.json +++ b/examples/mrl-simple/package.json @@ -9,6 +9,7 @@ "dependencies": { "@moonbeam-network/mrl": "workspace:*", "@moonbeam-network/xcm-config": "workspace:*", + "@moonbeam-network/xcm-types": "workspace:*", "@moonbeam-network/xcm-utils": "workspace:*" }, "devDependencies": { diff --git a/packages/builder/src/builder.utils.ts b/packages/builder/src/builder.utils.ts new file mode 100644 index 00000000..3cf93a28 --- /dev/null +++ b/packages/builder/src/builder.utils.ts @@ -0,0 +1,29 @@ +import { type AnyParachain, EvmParachain } from '@moonbeam-network/xcm-types'; +import { u8aToHex } from '@polkadot/util'; +import { decodeAddress } from '@polkadot/util-crypto'; +import type { Address } from 'viem'; + +export function getPrecompileDestinationInterior( + destination: AnyParachain, + address?: string, +): [Address, Address] | [Address] { + if (!address) { + return [`0x0000000${destination.parachainId.toString(16)}`]; + } + + /* + 01: AccountId32 + 03: AccountKey20 + https://docs.moonbeam.network/builders/interoperability/xcm/xc20/xtokens/#building-the-precompile-multilocation + */ + const accountType = EvmParachain.is(destination) ? '03' : '01'; + const acc = `0x${accountType}${u8aToHex( + decodeAddress(address), + -1, + false, + )}00` as Address; + + return destination.parachainId + ? [`0x0000000${destination.parachainId.toString(16)}`, acc] + : [acc]; +} diff --git a/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts b/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts index 739bdc71..319ff331 100644 --- a/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts +++ b/packages/builder/src/contract/contracts/Xtokens/Xtokens.ts @@ -1,7 +1,8 @@ -import { type AnyParachain, EvmParachain } from '@moonbeam-network/xcm-types'; +import type { AnyParachain } from '@moonbeam-network/xcm-types'; import { formatAssetIdToERC20 } from '@moonbeam-network/xcm-utils'; import { u8aToHex } from '@polkadot/util'; import { decodeAddress, evmToAddress } from '@polkadot/util-crypto'; +import { getPrecompileDestinationInterior } from '../../../builder.utils'; import { ContractConfig } from '../../../types/evm/ContractConfig'; import type { ContractConfigBuilder } from '../../ContractBuilder.interfaces'; import { XTOKENS_ABI } from './XtokensABI'; @@ -116,6 +117,7 @@ type DestinationMultilocation = [ ), ]; +// TODO test if this is needed function getDestinationMultilocationForPrecompileDestination( address: string, destination: AnyParachain, @@ -145,22 +147,6 @@ function getDestinationMultilocation( address: string, destination: AnyParachain, ): DestinationMultilocation { - /* - 01: AccountId32 - 03: AccountKey20 - https://docs.moonbeam.network/builders/interoperability/xcm/xc20/xtokens/#building-the-precompile-multilocation - */ - const accountType = EvmParachain.is(destination) ? '03' : '01'; - const acc = `0x${accountType}${u8aToHex( - decodeAddress(address), - -1, - false, - )}00`; - - return [ - 1, - destination.parachainId - ? [`0x0000000${destination.parachainId.toString(16)}`, acc] - : [acc], - ]; + const interior = getPrecompileDestinationInterior(destination, address); + return [1, interior]; } diff --git a/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts b/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts index cbd6d04e..2ff65d9b 100644 --- a/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts +++ b/packages/builder/src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts @@ -185,7 +185,7 @@ export function polkadotXcm() { }), }; }, - trasferAssets: () => { + transferAssets: () => { const func = 'transferAssets'; return { diff --git a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts index fdb65d8a..47b6f8b4 100644 --- a/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts +++ b/packages/builder/src/extrinsic/pallets/xTokens/xTokens.ts @@ -16,7 +16,8 @@ export function xTokens() { module: pallet, func: 'transfer', getArgs: (func) => { - const version = getExtrinsicArgumentVersion(func, 2); + const destIndex = 2; + const version = getExtrinsicArgumentVersion(func, destIndex); return [ asset.getAssetId(), @@ -29,6 +30,7 @@ export function xTokens() { }), transferMultiAsset: (originParachainId: number) => { const funcName = 'transferMultiasset'; + const destIndex = 1; return { here: (): ExtrinsicConfigBuilder => ({ @@ -37,7 +39,7 @@ export function xTokens() { module: pallet, func: funcName, getArgs: (func) => { - const version = getExtrinsicArgumentVersion(func, 1); + const version = getExtrinsicArgumentVersion(func, destIndex); return [ { @@ -65,7 +67,7 @@ export function xTokens() { module: pallet, func: funcName, getArgs: (func) => { - const version = getExtrinsicArgumentVersion(func, 1); + const version = getExtrinsicArgumentVersion(func, destIndex); return [ { @@ -97,7 +99,7 @@ export function xTokens() { module: pallet, func: funcName, getArgs: (func) => { - const version = getExtrinsicArgumentVersion(func, 1); + const version = getExtrinsicArgumentVersion(func, destIndex); return [ { diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/Batch.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/Batch.ts new file mode 100644 index 00000000..97193f6d --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/Batch.ts @@ -0,0 +1,167 @@ +import { + type AssetAmount, + type ChainAsset, + EvmParachain, + type Parachain, +} from '@moonbeam-network/xcm-types'; +import { getMultilocationDerivedAddresses } from '@moonbeam-network/xcm-utils'; +import { _0n } from '@polkadot/util'; +import { evmToAddress } from '@polkadot/util-crypto'; +import { type Address, encodeFunctionData, maxUint64 } from 'viem'; +import { getPrecompileDestinationInterior } from '../../../../../builder.utils'; +import { ContractConfig } from '../../../../../contract'; +import type { MrlConfigBuilder } from '../../../../MrlBuilder.interfaces'; +import { + CROSS_CHAIN_FEE, + buildSendExtrinsic, +} from '../../extrinsic/polkadotXcm/polkadotXcm'; +import { getAbisForChain } from './abi/abi.helpers'; + +const module = 'Batch'; + +export function Batch() { + return { + transferAssetsAndMessage: (): MrlConfigBuilder => ({ + build: ({ + asset, + destination, + destinationAddress, + fee, + isAutomatic, + moonAsset, + moonChain, + moonApi, + source, + sourceAddress, + sourceApi, + transact, + }) => { + if (!EvmParachain.is(source)) { + throw new Error('Source chain needs to be an EVMParachain'); + } + + if (!sourceApi) { + throw new Error('Source API needs to be defined'); + } + + if ( + !source.contracts?.Xtokens || + !source.contracts?.XcmUtils || + !source.contracts?.Batch + ) { + throw new Error( + 'Source chain needs to have the Xtokens, XcmUtils and Batch contract addresses configured', + ); + } + + const subMappedAddress = evmToAddress(sourceAddress); + + const { BatchAbi, XcmUtilsAbi, XtokensAbi } = getAbisForChain(source); + + const { address20: computedOriginAccount } = + getMultilocationDerivedAddresses({ + address: subMappedAddress, + paraId: source.parachainId, + isParents: true, + }); + + const send = buildSendExtrinsic({ + asset, + destination, + destinationAddress, + computedOriginAccount, + fee, + isAutomatic, + moonAsset, + moonChain, + moonApi, + source, + sourceAddress, + sourceApi, + transact, + }); + // we keep only the message + const encodedXcmMessage = send.args[1].toHex(); + + const { destinationParachain, destinationParachainAndAddress } = + getDestinationInHex(moonChain, computedOriginAccount); + + const { currencies, feeItem } = getCurrencies({ + source, + moonAsset, + asset, + }); + const weight = maxUint64; + + const multiTransferTxData = encodeFunctionData({ + abi: XtokensAbi, + functionName: 'transferMultiCurrencies', + args: [currencies, feeItem, destinationParachainAndAddress, weight], + }); + + const xcmSendTxData = encodeFunctionData({ + abi: XcmUtilsAbi, + functionName: 'xcmSend', + args: [destinationParachain, encodedXcmMessage], + }); + + return new ContractConfig({ + address: source.contracts.Batch, + abi: BatchAbi, + args: [ + [source.contracts.Xtokens, source.contracts.XcmUtils], + [], + [multiTransferTxData, xcmSendTxData], + [], + ], + func: 'batchAll', + module, + }); + }, + }), + }; +} + +function getDestinationInHex( + moonChain: EvmParachain, + computedOriginAccount: string, +) { + const destinationParachain = { + parents: 1, + interior: getPrecompileDestinationInterior(moonChain), + } as const; + + const destinationParachainAndAddress = { + parents: 1, + interior: getPrecompileDestinationInterior( + moonChain, + computedOriginAccount, + ), + } as const; + + return { + destinationParachain, + destinationParachainAndAddress, + }; +} + +interface GetCurrenciesParams { + source: Parachain | EvmParachain; + moonAsset: ChainAsset; + asset: AssetAmount; +} + +function getCurrencies({ source, moonAsset, asset }: GetCurrenciesParams) { + const currencies = [ + { + currencyAddress: source.getChainAsset(moonAsset).address as Address, + amount: CROSS_CHAIN_FEE, + }, + { + currencyAddress: asset.address as Address, + amount: asset.amount, + }, + ]; + const feeItem = 0; // moonAsset + return { currencies, feeItem }; +} diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/abi.helpers.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/abi.helpers.ts new file mode 100644 index 00000000..b21e10b6 --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/abi.helpers.ts @@ -0,0 +1,13 @@ +import type { EvmParachain } from '@moonbeam-network/xcm-types'; +import { PEAQ_BATCH_ABI } from './peaq/PeaqBatchContractAbi'; +import { PEAQ_XCM_UTILS_ABI } from './peaq/PeaqXcmUtilsContractAbi'; +import { PEAQ_XTOKENS_ABI } from './peaq/PeaqXtokensContractAbi'; + +export function getAbisForChain(chain: EvmParachain) { + // TODO when we add more chains, find a way to handle Abis for the different chains, if the Abis differ + return { + BatchAbi: PEAQ_BATCH_ABI, + XcmUtilsAbi: PEAQ_XCM_UTILS_ABI, + XtokensAbi: PEAQ_XTOKENS_ABI, + }; +} diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqBatchContractAbi.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqBatchContractAbi.ts new file mode 100644 index 00000000..610ae0ac --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqBatchContractAbi.ts @@ -0,0 +1,112 @@ +export const PEAQ_BATCH_ABI = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + ], + name: 'SubcallFailed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint256', + name: 'index', + type: 'uint256', + }, + ], + name: 'SubcallSucceeded', + type: 'event', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'to', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'value', + type: 'uint256[]', + }, + { + internalType: 'bytes[]', + name: 'callData', + type: 'bytes[]', + }, + { + internalType: 'uint64[]', + name: 'gasLimit', + type: 'uint64[]', + }, + ], + name: 'batchAll', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'to', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'value', + type: 'uint256[]', + }, + { + internalType: 'bytes[]', + name: 'callData', + type: 'bytes[]', + }, + { + internalType: 'uint64[]', + name: 'gasLimit', + type: 'uint64[]', + }, + ], + name: 'batchSome', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address[]', + name: 'to', + type: 'address[]', + }, + { + internalType: 'uint256[]', + name: 'value', + type: 'uint256[]', + }, + { + internalType: 'bytes[]', + name: 'callData', + type: 'bytes[]', + }, + { + internalType: 'uint64[]', + name: 'gasLimit', + type: 'uint64[]', + }, + ], + name: 'batchSomeUntilFailure', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXcmUtilsContractAbi.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXcmUtilsContractAbi.ts new file mode 100644 index 00000000..ccf8b509 --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXcmUtilsContractAbi.ts @@ -0,0 +1,100 @@ +export const PEAQ_XCM_UTILS_ABI = [ + { + inputs: [ + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct XcmUtils.Multilocation', + name: 'multilocation', + type: 'tuple', + }, + ], + name: 'getUnitsPerSecond', + outputs: [ + { + internalType: 'uint256', + name: 'unitsPerSecond', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'message', + type: 'bytes', + }, + ], + name: 'weightMessage', + outputs: [ + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'bytes', + name: 'message', + type: 'bytes', + }, + { + internalType: 'uint64', + name: 'maxWeight', + type: 'uint64', + }, + ], + name: 'xcmExecute', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct XcmUtils.Multilocation', + name: 'dest', + type: 'tuple', + }, + { + internalType: 'bytes', + name: 'message', + type: 'bytes', + }, + ], + name: 'xcmSend', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXtokensContractAbi.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXtokensContractAbi.ts new file mode 100644 index 00000000..9e5cdb7e --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/abi/peaq/PeaqXtokensContractAbi.ts @@ -0,0 +1,312 @@ +export const PEAQ_XTOKENS_ABI = [ + { + inputs: [ + { + internalType: 'address', + name: 'currencyAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transfer', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'location', + type: 'tuple', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: 'struct Xtokens.MultiAsset[]', + name: 'assets', + type: 'tuple[]', + }, + { + internalType: 'uint32', + name: 'feeItem', + type: 'uint32', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transferMultiAssets', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'address', + name: 'currencyAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + internalType: 'struct Xtokens.Currency[]', + name: 'currencies', + type: 'tuple[]', + }, + { + internalType: 'uint32', + name: 'feeItem', + type: 'uint32', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transferMultiCurrencies', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'asset', + type: 'tuple', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transferMultiasset', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'asset', + type: 'tuple', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'fee', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transferMultiassetWithFee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'currencyAddress', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'fee', + type: 'uint256', + }, + { + components: [ + { + internalType: 'uint8', + name: 'parents', + type: 'uint8', + }, + { + internalType: 'bytes[]', + name: 'interior', + type: 'bytes[]', + }, + ], + internalType: 'struct Xtokens.Multilocation', + name: 'destination', + type: 'tuple', + }, + { + internalType: 'uint64', + name: 'weight', + type: 'uint64', + }, + ], + name: 'transferWithFee', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/builder/src/mrl/providers/wormhole/contract/Batch/index.ts b/packages/builder/src/mrl/providers/wormhole/contract/Batch/index.ts new file mode 100644 index 00000000..0c1f4f10 --- /dev/null +++ b/packages/builder/src/mrl/providers/wormhole/contract/Batch/index.ts @@ -0,0 +1 @@ +export * from './Batch'; diff --git a/packages/builder/src/mrl/providers/wormhole/contract/index.ts b/packages/builder/src/mrl/providers/wormhole/contract/index.ts index 06c68feb..478deb08 100644 --- a/packages/builder/src/mrl/providers/wormhole/contract/index.ts +++ b/packages/builder/src/mrl/providers/wormhole/contract/index.ts @@ -1,6 +1,7 @@ +import { Batch } from './Batch'; import { TokenBridge } from './TokenBridge'; import { TokenBridgeRelayer } from './TokenBridgeRelayer'; export function contract() { - return { TokenBridge, TokenBridgeRelayer }; + return { Batch, TokenBridge, TokenBridgeRelayer }; } diff --git a/packages/builder/src/mrl/providers/wormhole/extrinsic/polkadotXcm/polkadotXcm.ts b/packages/builder/src/mrl/providers/wormhole/extrinsic/polkadotXcm/polkadotXcm.ts index 6df20e27..fab440e9 100644 --- a/packages/builder/src/mrl/providers/wormhole/extrinsic/polkadotXcm/polkadotXcm.ts +++ b/packages/builder/src/mrl/providers/wormhole/extrinsic/polkadotXcm/polkadotXcm.ts @@ -16,7 +16,7 @@ import type { // TODO: these have to come from the configs const BUY_EXECUTION_FEE = 100_000_000_000_000_000n; // moonChainFee -const CROSS_CHAIN_FEE = 100_000_000_000_000_000n; // fee for processing the xcm message in moon chain +export const CROSS_CHAIN_FEE = 100_000_000_000_000_000n; // fee for processing the xcm message in moon chain export function polkadotXcm() { return { @@ -39,10 +39,6 @@ export function polkadotXcm() { throw new Error('Destination chain does not have a wormhole name'); } - if (!transact) { - throw new Error('Transact params are required'); - } - if (!sourceApi) { throw new Error('Source API needs to be defined'); } @@ -73,81 +69,21 @@ export function polkadotXcm() { sourceApi, }); - const send = sourceApi.tx.polkadotXcm.send( - { - V3: { - parents: 1, - interior: { X1: { Parachain: moonChain.parachainId } }, - }, - }, - { - V3: [ - { - WithdrawAsset: [ - { - id: { - Concrete: { - parents: 0, - interior: { - X1: { - PalletInstance: moonAsset.getAssetPalletInstance(), - }, - }, - }, - }, - fun: { Fungible: BUY_EXECUTION_FEE }, - }, - ], - }, - { - BuyExecution: { - fees: { - id: { - Concrete: { - parents: 0, - interior: { - X1: { - PalletInstance: moonAsset.getAssetPalletInstance(), - }, - }, - }, - }, - fun: { Fungible: BUY_EXECUTION_FEE }, - }, - weightLimit: 'Unlimited', - }, - }, - { - Transact: { - originKind: 'SovereignAccount', - requireWeightAtMost: { - refTime: transact.txWeight.refTime, - proofSize: transact.txWeight.proofSize, - }, - call: { - encoded: transact.call, - }, - }, - }, - { - SetAppendix: [ - { RefundSurplus: {} }, - { - DepositAsset: { - assets: { Wild: { AllCounted: 1 } }, - beneficiary: { - parents: 0, - interior: { - X1: { AccountKey20: { key: computedOriginAccount } }, - }, - }, - }, - }, - ], - }, - ], - }, - ); + const send = buildSendExtrinsic({ + asset, + destination, + destinationAddress, + computedOriginAccount, + fee, + isAutomatic, + moonAsset, + moonChain, + moonApi, + source, + sourceAddress, + sourceApi, + transact, + }); // TODO add here ability to only send the remote execution (only `send`) return new ExtrinsicConfig({ @@ -160,12 +96,100 @@ export function polkadotXcm() { }; } -interface GetAssetTransferTxsParams extends MrlBuilderParams { +interface HelperFunctionParams extends MrlBuilderParams { computedOriginAccount: string; source: AnyParachain; sourceApi: ApiPromise; } +export function buildSendExtrinsic({ + computedOriginAccount, + moonAsset, + moonChain, + sourceApi, + transact, +}: HelperFunctionParams) { + if (!transact) { + throw new Error('Transact params are required'); + } + + return sourceApi.tx.polkadotXcm.send( + { + V3: { + parents: 1, + interior: { X1: { Parachain: moonChain.parachainId } }, + }, + }, + { + V3: [ + { + WithdrawAsset: [ + { + id: { + Concrete: { + parents: 0, + interior: { + X1: { + PalletInstance: moonAsset.getAssetPalletInstance(), + }, + }, + }, + }, + fun: { Fungible: BUY_EXECUTION_FEE }, + }, + ], + }, + { + BuyExecution: { + fees: { + id: { + Concrete: { + parents: 0, + interior: { + X1: { + PalletInstance: moonAsset.getAssetPalletInstance(), + }, + }, + }, + }, + fun: { Fungible: BUY_EXECUTION_FEE }, + }, + weightLimit: 'Unlimited', + }, + }, + { + Transact: { + originKind: 'SovereignAccount', + requireWeightAtMost: { + refTime: transact.txWeight.refTime, + proofSize: transact.txWeight.proofSize, + }, + call: { + encoded: transact.call, + }, + }, + }, + { + SetAppendix: [ + { RefundSurplus: {} }, + { + DepositAsset: { + assets: { Wild: { AllCounted: 1 } }, + beneficiary: { + parents: 0, + interior: { + X1: { AccountKey20: { key: computedOriginAccount } }, + }, + }, + }, + }, + ], + }, + ], + }, + ); +} + function getAssetTransferTxs({ asset, computedOriginAccount, @@ -176,7 +200,7 @@ function getAssetTransferTxs({ source, sourceAddress, sourceApi, -}: GetAssetTransferTxsParams): SubmittableExtrinsic< +}: HelperFunctionParams): SubmittableExtrinsic< 'promise', ISubmittableResult >[] { diff --git a/packages/config/src/chains.ts b/packages/config/src/chains.ts index 78068034..0472d551 100644 --- a/packages/config/src/chains.ts +++ b/packages/config/src/chains.ts @@ -1791,6 +1791,8 @@ export const peaqEvmAlphanet = new EvmParachain({ }), ], contracts: { + Batch: '0x0000000000000000000000000000000000000805', + XcmUtils: '0x0000000000000000000000000000000000000804', Xtokens: '0x0000000000000000000000000000000000000803', }, ecosystem: Ecosystem.AlphanetRelay, diff --git a/packages/config/src/mrl-configs/peaqEvmAlphanet.ts b/packages/config/src/mrl-configs/peaqEvmAlphanet.ts index 3c25fbca..b778fd10 100644 --- a/packages/config/src/mrl-configs/peaqEvmAlphanet.ts +++ b/packages/config/src/mrl-configs/peaqEvmAlphanet.ts @@ -33,12 +33,12 @@ export const peaqEvmAlphanetRoutes = new MrlChainRoutes({ }, }, mrl: { - isAutomaticPossible: true, + isAutomaticPossible: false, // TODO transfer: MrlBuilder() .wormhole() .contract() - .TokenBridgeRelayer() - .transferTokensWithRelay(), + .Batch() + .transferAssetsAndMessage(), moonChain: { asset: ftmwh, fee: { diff --git a/packages/sdk/src/getTransferData/getDestinationData.ts b/packages/sdk/src/getTransferData/getDestinationData.ts index b65a7952..a813a09b 100644 --- a/packages/sdk/src/getTransferData/getDestinationData.ts +++ b/packages/sdk/src/getTransferData/getDestinationData.ts @@ -1,4 +1,10 @@ -import type { AssetRoute, DestinationConfig, SourceConfig } from '@moonbeam-network/xcm-config'; +import type { + AssetRoute, + DestinationConfig, + SourceConfig, +} from '@moonbeam-network/xcm-config'; +import { Parachain } from '@moonbeam-network/xcm-types'; +import { getSovereignAccountAddresses } from '@moonbeam-network/xcm-utils'; import type { DestinationChainTransferData } from '../sdk.interfaces'; import { getAssetMin, @@ -6,10 +12,6 @@ import { getDestinationFee, getExistentialDeposit, } from './getTransferData.utils'; -import { - getSovereignAccountAddresses, -} from '@moonbeam-network/xcm-utils'; -import { Parachain } from '@moonbeam-network/xcm-types'; export interface GetDestinationDataParams { route: AssetRoute; @@ -48,34 +50,31 @@ export async function getDestinationData({ existentialDeposit, fee, min, - sovereignAccountBalances: await getSovereignAccountBalances({ - source: route.source, - destination: route.destination, - }), + sovereignAccountBalances: await getSovereignAccountBalances({ + source: route.source, + destination: route.destination, + }), }; - } interface GetSovereignAccountBalancesProps { - source: SourceConfig; - destination: DestinationConfig; + source: SourceConfig; + destination: DestinationConfig; } -async function getSovereignAccountBalances( { +async function getSovereignAccountBalances({ destination, source, }: GetSovereignAccountBalancesProps) { - - if(!Parachain.is(source.chain) || !Parachain.is(destination.chain)) { - return undefined + if (!Parachain.is(source.chain) || !Parachain.is(destination.chain)) { + return undefined; } const sovereignAccountAddresses = getSovereignAccountAddresses( source.chain.parachainId, ); - const destinationFeeAssetBalance = - destination.fee.balance; + const destinationFeeAssetBalance = destination.fee.balance; const sovereignAccountAddress = destination.chain.isRelay ? sovereignAccountAddresses.relay @@ -93,7 +92,7 @@ async function getSovereignAccountBalances( { address: sovereignAccountAddress, asset: destination.chain.getChainAsset(destination.fee.asset), builder: destinationFeeAssetBalance, - chain: destination.chain, + chain: destination.chain, }) : undefined; return { diff --git a/packages/sdk/src/getTransferData/getTransferData.ts b/packages/sdk/src/getTransferData/getTransferData.ts index cf45947a..dce15565 100644 --- a/packages/sdk/src/getTransferData/getTransferData.ts +++ b/packages/sdk/src/getTransferData/getTransferData.ts @@ -11,7 +11,11 @@ import { EvmService } from '../services/evm/EvmService'; import { PolkadotService } from '../services/polkadot'; import { getDestinationData } from './getDestinationData'; import { getSourceData } from './getSourceData'; -import { convertToChainDecimals, getMin, validateSovereignAccountBalances} from './getTransferData.utils'; +import { + convertToChainDecimals, + getMin, + validateSovereignAccountBalances, +} from './getTransferData.utils'; export interface GetTransferDataParams { route: AssetRoute; @@ -67,14 +71,13 @@ export async function getTransferData({ amount, { evmSigner, polkadotSigner }: Partial, ): Promise { - const source = route.source.chain as AnyParachain; const destination = route.destination.chain as AnyParachain; const bigintAmount = toBigInt(amount, sourceData.balance.decimals); validateSovereignAccountBalances({ amount: bigintAmount, - destination, - source, + destinationData, + sourceData, }); const asset = AssetAmount.fromChainAsset( route.source.chain.getChainAsset(route.source.asset), diff --git a/packages/sdk/src/getTransferData/getTransferData.utils.ts b/packages/sdk/src/getTransferData/getTransferData.utils.ts index 05223500..61e6909b 100644 --- a/packages/sdk/src/getTransferData/getTransferData.utils.ts +++ b/packages/sdk/src/getTransferData/getTransferData.utils.ts @@ -20,13 +20,12 @@ import { } from '@moonbeam-network/xcm-types'; import { convertDecimals, toBigInt } from '@moonbeam-network/xcm-utils'; import Big from 'big.js'; -import { EvmService } from '../services/evm/EvmService'; -import { PolkadotService } from '../services/polkadot'; -import { +import type { DestinationChainTransferData, SourceChainTransferData, } from '../sdk.interfaces'; - +import { EvmService } from '../services/evm/EvmService'; +import { PolkadotService } from '../services/polkadot'; export interface GetBalancesParams { address: string; @@ -345,33 +344,33 @@ export async function getContractFee({ interface ValidateSovereignAccountBalancesProps { amount: bigint; - destination: DestinationChainTransferData; - source: SourceChainTransferData; + destinationData: DestinationChainTransferData; + sourceData: SourceChainTransferData; } export function validateSovereignAccountBalances({ amount, - source, - destination, + sourceData, + destinationData, }: ValidateSovereignAccountBalancesProps): void { if ( - !Parachain.is(destination.chain) || - !destination.chain.checkSovereignAccountBalances || - !destination.sovereignAccountBalances + !Parachain.is(destinationData.chain) || + !destinationData.chain.checkSovereignAccountBalances || + !destinationData.sovereignAccountBalances ) { return; } const { feeAssetBalance, transferAssetBalance } = - destination.sovereignAccountBalances; + destinationData.sovereignAccountBalances; if (amount > transferAssetBalance) { throw new Error( - `${source.chain.name} Sovereign account in ${destination.chain.name} does not have enough balance for this transaction`, + `${sourceData.chain.name} Sovereign account in ${destinationData.chain.name} does not have enough balance for this transaction`, ); } - if (feeAssetBalance && source.destinationFee.amount > feeAssetBalance) { + if (feeAssetBalance && sourceData.destinationFee.amount > feeAssetBalance) { throw new Error( - `${source.chain.name} Sovereign account in ${destination.chain.name} does not have enough balance to pay for fees for this transaction`, + `${sourceData.chain.name} Sovereign account in ${destinationData.chain.name} does not have enough balance to pay for fees for this transaction`, ); } } diff --git a/packages/types/src/chain/parachain/EvmParachain.ts b/packages/types/src/chain/parachain/EvmParachain.ts index 5558e920..00c1e421 100644 --- a/packages/types/src/chain/parachain/EvmParachain.ts +++ b/packages/types/src/chain/parachain/EvmParachain.ts @@ -12,6 +12,8 @@ export interface EvmParachainConstructorParams } type Contracts = { + Batch?: Address; + XcmUtils?: Address; Xtokens?: Address; }; diff --git a/packages/types/src/chain/parachain/Parachain.ts b/packages/types/src/chain/parachain/Parachain.ts index 712aa87d..391dc896 100644 --- a/packages/types/src/chain/parachain/Parachain.ts +++ b/packages/types/src/chain/parachain/Parachain.ts @@ -12,7 +12,6 @@ export interface ParachainConstructorParams extends ChainConstructorParams { } export class Parachain extends Chain { - readonly checkSovereignAccountBalances: boolean; readonly genesisHash: string; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a4a24310..35b5086b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -96,6 +96,9 @@ importers: '@moonbeam-network/xcm-config': specifier: workspace:* version: link:../../packages/config + '@moonbeam-network/xcm-types': + specifier: workspace:* + version: link:../../packages/types '@moonbeam-network/xcm-utils': specifier: workspace:* version: link:../../packages/utils @@ -1207,8 +1210,8 @@ packages: resolution: {integrity: sha512-BkG2tQpUUO0iUm65nSqP8hwHkNfN8jQw8apqflJNt9H8EkEL6v7sqwbLvGqtlxM9wzdxbg7lrWp3oHg4rOP31g==} engines: {node: '>=18'} - '@polkadot/api-augment@13.2.1': - resolution: {integrity: sha512-NTkI+/Hm48eWc/4Ojh/5elxnjnow5ptXK97IZdkWAe7mWi9hJR05Uq5lGt/T/57E9LSRWEuYje8cIDS3jbbAAw==} + '@polkadot/api-augment@14.0.1': + resolution: {integrity: sha512-+ZHq3JaQZ/3Q45r6/YQBeLfoP8S5ibgkOvLKnKA9cJeF7oP5Qgi6pAEnGW0accfnT9PyCEco9fD/ZOLR9Yka7w==} engines: {node: '>=18'} '@polkadot/api-augment@7.15.1': @@ -1227,8 +1230,8 @@ packages: resolution: {integrity: sha512-XYI7Po8i6C4lYZah7Xo0v7zOAawBUfkmtx0YxsLY/665Sup8oqzEj666xtV9qjBzR9coNhQonIFOn+9fh27Ncw==} engines: {node: '>=18'} - '@polkadot/api-base@13.2.1': - resolution: {integrity: sha512-00twdIjTjzdYNdU19i2YKLoWBmf2Yr6b3qrvqIVScHipUkKMbfFBgoPRB5FtcviBbEvLurgfyzHklwnrbWo8GQ==} + '@polkadot/api-base@14.0.1': + resolution: {integrity: sha512-OVnDiztKx/1ktae9eCzO1q8lmKEfnQ71fipo8JkDJOMIN4vT1IqL9KQo4e/Xz8UtOfTJ0H8kZ6evaLqdA3ZYOA==} engines: {node: '>=18'} '@polkadot/api-base@7.15.1': @@ -1247,8 +1250,8 @@ packages: resolution: {integrity: sha512-R0AMANEnqs5AiTaiQX2FXCxUlOibeDSgqlkyG1/0KDsdr6PO/l3dJOgEO+grgAwh4hdqzk4I9uQpdKxG83f2Gw==} engines: {node: '>=18'} - '@polkadot/api-derive@13.2.1': - resolution: {integrity: sha512-npxvS0kYcSFqmYv2G8QKWAJwFhIv/MBuGU0bV7cGP9K1A3j2Do3yYjvN1dTtY20jBavWNwmWFdXBV6/TRRsgmg==} + '@polkadot/api-derive@14.0.1': + resolution: {integrity: sha512-ADQMre3DRRW/0rhJqxOVhQ1vqtyafP2dSZJ0qEAsto12q2WMSF8CZWo7pXe4DxiniDkZx3zVq4z5lqw2aBRLfg==} engines: {node: '>=18'} '@polkadot/api-derive@7.15.1': @@ -1267,8 +1270,8 @@ packages: resolution: {integrity: sha512-e1KS048471iBWZU10TJNEYOZqLO+8h8ajmVqpaIBOVkamN7tmacBxmHgq0+IA8VrGxjxtYNa1xF5Sqrg76uBEg==} engines: {node: '>=18'} - '@polkadot/api@13.2.1': - resolution: {integrity: sha512-QvgKD3/q6KIU3ZuNYFJUNc6B8bGBoqeMF+iaPxJn3Twhh4iVD5XIymD5fVszSqiL1uPXMhzcWecjwE8rDidBoQ==} + '@polkadot/api@14.0.1': + resolution: {integrity: sha512-CDSaUiJpXu9aE6MaTg14K+9Trf8K2PBHcD3Xl5m5KOvJperWgYFxoCqV3rXLIBWt69LgHhMYlq5JSPRHxejIsw==} engines: {node: '>=18'} '@polkadot/api@7.15.1': @@ -1379,8 +1382,8 @@ packages: resolution: {integrity: sha512-IEco5pnso+fYkZNMlMAN5i4XAxdXPv0PZ0HNuWlCwF/MmRvWl8pq5JFtY1FiByHEbeuHwMIUhHM5SDKQ85q9Hg==} engines: {node: '>=18'} - '@polkadot/rpc-augment@13.2.1': - resolution: {integrity: sha512-HkndaAJPR1fi2xrzvP3q4g48WUCb26btGTeg1AKG9FGx9P2dgtpaPRmbMitmgVSzzRurrkxf3Meip8nC7BwDeg==} + '@polkadot/rpc-augment@14.0.1': + resolution: {integrity: sha512-M0CbN/IScqiedYI2TmoQ+SoeEdJHfxGeQD1qJf9uYv9LILK+x1/5fyr5DrZ3uCGVmLuObWAJLnHTs0BzJcSHTQ==} engines: {node: '>=18'} '@polkadot/rpc-augment@7.15.1': @@ -1399,8 +1402,8 @@ packages: resolution: {integrity: sha512-yaveqxNcmyluyNgsBT5tpnCa/md0CGbOtRK7K82LWsz7gsbh0x80GBbJrQGxsUybg1gPeZbO1q9IigwA6fY8ag==} engines: {node: '>=18'} - '@polkadot/rpc-core@13.2.1': - resolution: {integrity: sha512-hy0GksUlb/TfQ38m3ysIWj3qD+rIsyCdxx8Ug5rIx1u0odv86NZ7nTqtH066Ct2riVaPBgBkObFnlpDWTJ6auA==} + '@polkadot/rpc-core@14.0.1': + resolution: {integrity: sha512-SfgC6WU7RxaFFgm/GUpsqTywyaDeb7+r5GU3GlwC+QR148h3a7UcQ3sssOpB0MiZ2gIXngJuyIcIQm/3GfHnJw==} engines: {node: '>=18'} '@polkadot/rpc-core@7.15.1': @@ -1419,8 +1422,8 @@ packages: resolution: {integrity: sha512-cAhfN937INyxwW1AdjABySdCKhC7QCIONRDHDea1aLpiuxq/w+QwjxauR9fCNGh3lTaAwwnmZ5WfFU2PtkDMGQ==} engines: {node: '>=18'} - '@polkadot/rpc-provider@13.2.1': - resolution: {integrity: sha512-bbMVYHTNFUa89aY3UQ1hFYD+dP+v+0vhjsnHYYlv37rSUTqOGqW91rkHd63xYCpLAimFt7KRw8xR+SMSYiuDjw==} + '@polkadot/rpc-provider@14.0.1': + resolution: {integrity: sha512-mNfaKZUHPXGSY7TwgOfV05RN3Men21Dw7YXrSZDFkJYsZ55yOAYdmLg9anPZGHW100YnNWrXj+3uhQOw8JgqkA==} engines: {node: '>=18'} '@polkadot/rpc-provider@7.15.1': @@ -1439,8 +1442,8 @@ packages: resolution: {integrity: sha512-3fDCOy2BEMuAtMYl4crKg76bv/0pDNEuzpAzV4EBUMIlJwypmjy5sg3gUPCMcA+ckX3xb8DhkWU4ceUdS7T2KQ==} engines: {node: '>=18'} - '@polkadot/types-augment@13.2.1': - resolution: {integrity: sha512-FpV7/2kIJmmswRmwUbp41lixdNX15olueUjHnSweFk0xEn2Ur43oC0Y3eU3Ab7Y5gPJpceMCfwYz+PjCUGedDA==} + '@polkadot/types-augment@14.0.1': + resolution: {integrity: sha512-PGo81444J5tGJxP3tu060Jx1kkeuo8SmBIt9S/w626Se49x4RLM5a7Pa5fguYVsg4TsJa9cgVPMuu6Y0F/2aCQ==} engines: {node: '>=18'} '@polkadot/types-augment@7.15.1': @@ -1459,8 +1462,8 @@ packages: resolution: {integrity: sha512-DiPGRFWtVMepD9i05eC3orSbGtpN7un/pXOrXu0oriU+oxLkpvZH68ZsPNtJhKdQy03cAYtvB8elJOFJZYqoqQ==} engines: {node: '>=18'} - '@polkadot/types-codec@13.2.1': - resolution: {integrity: sha512-tFAzzS8sMYItoD5a91sFMD+rskWyv4WjSmUZaj0Y4OfLtDAiQvgO0KncdGJIB6D+zZ/T7khpgsv/CZbN3YnezA==} + '@polkadot/types-codec@14.0.1': + resolution: {integrity: sha512-IyUlkrRZ6uppbHVlMJL+btKP7dfgW65K06ggQxH7Y/IyRAQVDNjXecAZrCUMB/gtjUXNPyTHEIfPGDlg8E6rig==} engines: {node: '>=18'} '@polkadot/types-codec@7.15.1': @@ -1479,8 +1482,8 @@ packages: resolution: {integrity: sha512-nOpeAKZLdSqNMfzS3waQXgyPPaNt8rUHEmR5+WNv6c/Ke/vyf710wjxiTewfp0wpBgtdrimlgG4DLX1J9Ms1LA==} engines: {node: '>=18'} - '@polkadot/types-create@13.2.1': - resolution: {integrity: sha512-O/WKdsrNuMaZLf+XRCdum2xJYs5OKC6N3EMPF5Uhg10b80Y/hQCbzA/iWd3/aMNDLUA5XWhixwzJdrZWIMVIzg==} + '@polkadot/types-create@14.0.1': + resolution: {integrity: sha512-R9/ac3CHKrFhvPKVUdpjnCDFSaGjfrNwtuY+AzvExAMIq7pM9dxo2N8UfnLbyFaG/n1hfYPXDIS3hLHvOZsLbw==} engines: {node: '>=18'} '@polkadot/types-create@7.15.1': @@ -1499,8 +1502,8 @@ packages: resolution: {integrity: sha512-bvhO4KQu/dgPmdwQXsweSMRiRisJ7Bp38lZVEIFykfd2qYyRW3OQEbIPKYpx9raD+fDATU0bTiKQnELrSGhYXw==} engines: {node: '>=18'} - '@polkadot/types-known@13.2.1': - resolution: {integrity: sha512-uz3c4/IvspLpgN8q15A+QH8KWFauzcrV3RfLFlMP2BkkF5qpOwNeP7c4U8j0CZGQySqBsJRCGWmgBXrXg669KA==} + '@polkadot/types-known@14.0.1': + resolution: {integrity: sha512-oGypUOQNxZ6bq10czpVadZYeDM2NBB2kX3VFHLKLEpjaRbnVYtKXL6pl8B0uHR8GK/2Z8AmPOj6kuRjaC86qXg==} engines: {node: '>=18'} '@polkadot/types-known@4.17.1': @@ -1527,8 +1530,8 @@ packages: resolution: {integrity: sha512-bz6JSt23UEZ2eXgN4ust6z5QF9pO5uNH7UzCP+8I/Nm85ZipeBYj2Wu6pLlE3Hw30hWZpuPxMDOKoEhN5bhLgw==} engines: {node: '>=18'} - '@polkadot/types-support@13.2.1': - resolution: {integrity: sha512-jSbbUTXU+yZJQPRAWmxaDoe4NRO6SjpZPzBIbpuiadx1slON8XB80fVYIGBXuM2xRVrNrB6fCjyCTG7Razj6Hg==} + '@polkadot/types-support@14.0.1': + resolution: {integrity: sha512-lcZEyOf5e3WLLtrFlLTvFfUpO0Vx/Gh5lhLLjdx1W9Xs0KJUlOxSAKxvjVieJJj6HifL0Jh6tDYOUeEc4TOrvA==} engines: {node: '>=18'} '@polkadot/types-support@7.15.1': @@ -1547,8 +1550,8 @@ packages: resolution: {integrity: sha512-ivYtt7hYcRvo69ULb1BJA9BE1uefijXcaR089Dzosr9+sMzvsB1yslNQReOq+Wzq6h6AQj4qex6qVqjWZE6Z4A==} engines: {node: '>=18'} - '@polkadot/types@13.2.1': - resolution: {integrity: sha512-5yQ0mHMNvwgXeHQ1RZOuHaeak3utAdcBqCpHoagnYrAnGHqtO7kg7YLtT4LkFw2nwL85axu8tOQMv6/3kpFy9w==} + '@polkadot/types@14.0.1': + resolution: {integrity: sha512-DOMzHsyVbCa12FT2Fng8iGiQJhHW2ONpv5oieU+Z2o0gFQqwNmIDXWncScG5mAUBNcDMXLuvWIKLKtUDOq8msg==} engines: {node: '>=18'} '@polkadot/types@4.17.1': @@ -4834,13 +4837,13 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/api-augment@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/api-augment@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/api-base': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/rpc-augment': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 - '@polkadot/types-augment': 13.2.1 - '@polkadot/types-codec': 13.2.1 + '@polkadot/api-base': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/rpc-augment': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 + '@polkadot/types-augment': 14.0.1 + '@polkadot/types-codec': 14.0.1 '@polkadot/util': 13.1.1 tslib: 2.7.0 transitivePeerDependencies: @@ -4899,10 +4902,10 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/api-base@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/api-base@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/rpc-core': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 + '@polkadot/rpc-core': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 '@polkadot/util': 13.1.1 rxjs: 7.8.1 tslib: 2.7.0 @@ -4968,14 +4971,14 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/api-derive@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/api-derive@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/api': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/api-augment': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/api-base': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/rpc-core': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 - '@polkadot/types-codec': 13.2.1 + '@polkadot/api': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api-augment': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api-base': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/rpc-core': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 + '@polkadot/types-codec': 14.0.1 '@polkadot/util': 13.1.1 '@polkadot/util-crypto': 13.1.1(@polkadot/util@13.1.1) rxjs: 7.8.1 @@ -5066,20 +5069,20 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/api@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/api@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/api-augment': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/api-base': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/api-derive': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api-augment': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api-base': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api-derive': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) '@polkadot/keyring': 13.1.1(@polkadot/util-crypto@13.1.1(@polkadot/util@13.1.1))(@polkadot/util@13.1.1) - '@polkadot/rpc-augment': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/rpc-core': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/rpc-provider': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 - '@polkadot/types-augment': 13.2.1 - '@polkadot/types-codec': 13.2.1 - '@polkadot/types-create': 13.2.1 - '@polkadot/types-known': 13.2.1 + '@polkadot/rpc-augment': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/rpc-core': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/rpc-provider': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 + '@polkadot/types-augment': 14.0.1 + '@polkadot/types-codec': 14.0.1 + '@polkadot/types-create': 14.0.1 + '@polkadot/types-known': 14.0.1 '@polkadot/util': 13.1.1 '@polkadot/util-crypto': 13.1.1(@polkadot/util@13.1.1) eventemitter3: 5.0.1 @@ -5333,11 +5336,11 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/rpc-augment@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/rpc-augment@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/rpc-core': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 - '@polkadot/types-codec': 13.2.1 + '@polkadot/rpc-core': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 + '@polkadot/types-codec': 14.0.1 '@polkadot/util': 13.1.1 tslib: 2.7.0 transitivePeerDependencies: @@ -5394,11 +5397,11 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/rpc-core@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/rpc-core@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/rpc-augment': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/rpc-provider': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) - '@polkadot/types': 13.2.1 + '@polkadot/rpc-augment': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/rpc-provider': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/types': 14.0.1 '@polkadot/util': 13.1.1 rxjs: 7.8.1 tslib: 2.7.0 @@ -5474,11 +5477,11 @@ snapshots: - supports-color - utf-8-validate - '@polkadot/rpc-provider@13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@polkadot/rpc-provider@14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: '@polkadot/keyring': 13.1.1(@polkadot/util-crypto@13.1.1(@polkadot/util@13.1.1))(@polkadot/util@13.1.1) - '@polkadot/types': 13.2.1 - '@polkadot/types-support': 13.2.1 + '@polkadot/types': 14.0.1 + '@polkadot/types-support': 14.0.1 '@polkadot/util': 13.1.1 '@polkadot/util-crypto': 13.1.1(@polkadot/util@13.1.1) '@polkadot/x-fetch': 13.1.1 @@ -5549,10 +5552,10 @@ snapshots: '@polkadot/util': 13.0.2 tslib: 2.7.0 - '@polkadot/types-augment@13.2.1': + '@polkadot/types-augment@14.0.1': dependencies: - '@polkadot/types': 13.2.1 - '@polkadot/types-codec': 13.2.1 + '@polkadot/types': 14.0.1 + '@polkadot/types-codec': 14.0.1 '@polkadot/util': 13.1.1 tslib: 2.7.0 @@ -5582,7 +5585,7 @@ snapshots: '@polkadot/x-bigint': 13.0.2 tslib: 2.7.0 - '@polkadot/types-codec@13.2.1': + '@polkadot/types-codec@14.0.1': dependencies: '@polkadot/util': 13.1.1 '@polkadot/x-bigint': 13.1.1 @@ -5611,9 +5614,9 @@ snapshots: '@polkadot/util': 13.0.2 tslib: 2.7.0 - '@polkadot/types-create@13.2.1': + '@polkadot/types-create@14.0.1': dependencies: - '@polkadot/types-codec': 13.2.1 + '@polkadot/types-codec': 14.0.1 '@polkadot/util': 13.1.1 tslib: 2.7.0 @@ -5647,12 +5650,12 @@ snapshots: '@polkadot/util': 13.0.2 tslib: 2.7.0 - '@polkadot/types-known@13.2.1': + '@polkadot/types-known@14.0.1': dependencies: '@polkadot/networks': 13.1.1 - '@polkadot/types': 13.2.1 - '@polkadot/types-codec': 13.2.1 - '@polkadot/types-create': 13.2.1 + '@polkadot/types': 14.0.1 + '@polkadot/types-codec': 14.0.1 + '@polkadot/types-create': 14.0.1 '@polkadot/util': 13.1.1 tslib: 2.7.0 @@ -5698,7 +5701,7 @@ snapshots: '@polkadot/util': 13.0.2 tslib: 2.7.0 - '@polkadot/types-support@13.2.1': + '@polkadot/types-support@14.0.1': dependencies: '@polkadot/util': 13.1.1 tslib: 2.7.0 @@ -5735,12 +5738,12 @@ snapshots: rxjs: 7.8.1 tslib: 2.7.0 - '@polkadot/types@13.2.1': + '@polkadot/types@14.0.1': dependencies: '@polkadot/keyring': 13.1.1(@polkadot/util-crypto@13.1.1(@polkadot/util@13.1.1))(@polkadot/util@13.1.1) - '@polkadot/types-augment': 13.2.1 - '@polkadot/types-codec': 13.2.1 - '@polkadot/types-create': 13.2.1 + '@polkadot/types-augment': 14.0.1 + '@polkadot/types-codec': 14.0.1 + '@polkadot/types-create': 14.0.1 '@polkadot/util': 13.1.1 '@polkadot/util-crypto': 13.1.1(@polkadot/util@13.1.1) rxjs: 7.8.1 @@ -6481,7 +6484,7 @@ snapshots: '@subsocial/definitions@0.8.14(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@polkadot/api': 13.2.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@polkadot/api': 14.0.1(bufferutil@4.0.8)(utf-8-validate@5.0.10) lodash.camelcase: 4.3.0 transitivePeerDependencies: - bufferutil