Skip to content

Commit

Permalink
fix xcm-transfer index
Browse files Browse the repository at this point in the history
  • Loading branch information
nohaapav committed Nov 28, 2023
1 parent 6ae42fc commit 7e552d5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions examples/xcm-transfer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -15,24 +19,30 @@ 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);
console.log(data.destination);
}

const sdkBuilder = Sdk({ configService: configService });
await transfer('hydradx', 'acala', 'wbtc-acala');
await transfer('hydradx', 'moonbeam', 'wbtc_mwh');

0 comments on commit 7e552d5

Please sign in to comment.