From 7e552d57bc89aa30eed080a59cdd27c797325330 Mon Sep 17 00:00:00 2001 From: Pavol Noha Date: Tue, 28 Nov 2023 10:30:45 +0100 Subject: [PATCH] fix xcm-transfer index --- examples/xcm-transfer/src/index.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/xcm-transfer/src/index.ts b/examples/xcm-transfer/src/index.ts index 7d3c39bf..82e5ab78 100644 --- a/examples/xcm-transfer/src/index.ts +++ b/examples/xcm-transfer/src/index.ts @@ -2,11 +2,15 @@ import { Sdk } from '@moonbeam-network/xcm-sdk'; import { ConfigService } from '@moonbeam-network/xcm-config'; import { assetsMap, chainsMap, chainsConfigMap } from '@galacticcouncil/xcm'; -import { walletClient } from './clients'; +import { moonbeamWalletClient } from './client'; import { createPolkadotSigner } from './signers'; import { logAssets, logDestChains, logSrcChains } from './utils'; -const configService = new ConfigService({ assets: assetsMap, chains: chainsMap, chainsConfig: chainsConfigMap }); +const configService = new ConfigService({ + assets: assetsMap, + chains: chainsMap, + chainsConfig: chainsConfigMap, +}); async function transfer(srcChain: string, destChain: string, asset: string) { const sourceChain = configService.getChain(srcChain); @@ -15,19 +19,25 @@ async function transfer(srcChain: string, destChain: string, asset: string) { const { sourceChains } = sdkBuilder.assets().asset(asset); logSrcChains(asset, sourceChains); - const { destinationChains } = sdkBuilder.assets().asset(asset).source(srcChain); + const { destinationChains } = sdkBuilder + .assets() + .asset(asset) + .source(srcChain); logDestChains(asset, destinationChains); const polkaSigner = await createPolkadotSigner(); + const SRC_ADDR = 'INSERT_ADDRESS'; + const DST_ADDR = 'INSERT_ADDRESS'; + const data = await sdkBuilder .assets() .asset(asset) .source(srcChain) .destination(destChain) - .accounts('7MHE9BUBEWU88cEto6P1XNNb66foSwAZPKhfL8GHW9exnuH1', '24ZGSbmos67brVoJnskkWcH4qP6DYDnyPULhiuBKxq97skrF', { + .accounts(SRC_ADDR, DST_ADDR, { polkadotSigner: polkaSigner.signer, - evmSigner: walletClient, + evmSigner: moonbeamWalletClient, }); //data.transfer(0.1); console.log(data.source); @@ -35,4 +45,4 @@ async function transfer(srcChain: string, destChain: string, asset: string) { } const sdkBuilder = Sdk({ configService: configService }); -await transfer('hydradx', 'acala', 'wbtc-acala'); +await transfer('hydradx', 'moonbeam', 'wbtc_mwh');