From abbd00c00fd04c8e2f072e26a06f1e4bcf88844a Mon Sep 17 00:00:00 2001 From: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Date: Thu, 20 Jun 2024 09:52:14 +0200 Subject: [PATCH] Mint relay chain tokens on initialization (#50) --- src/regionx/index.init.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/regionx/index.init.ts b/src/regionx/index.init.ts index 1f0e049..18e6394 100644 --- a/src/regionx/index.init.ts +++ b/src/regionx/index.init.ts @@ -13,10 +13,13 @@ export async function regionxInit(relayEndpoint: string, regionxEndpoint: string const relayApi = await ApiPromise.create({ provider: relayWsProvider }); await setupRelayAsset(regionxApi); + const giveRcTokensCall = regionxApi.tx.tokens.setBalance(alice.address, RELAY_ASSET_ID, 10n ** 18n, 0); + await force(regionxApi, giveRcTokensCall); if (regionxAccount) { const giveBalanceCall = regionxApi.tx.balances.forceSetBalance(regionxAccount, 10n ** 18n); - await force(regionxApi, giveBalanceCall); + const giveRcTokensCall = regionxApi.tx.tokens.setBalance(regionxAccount, RELAY_ASSET_ID, 10n ** 18n, 0); + await force(regionxApi, regionxApi.tx.utility.batch([giveBalanceCall, giveRcTokensCall])); await transferRelayTokensToRegionX(100n * 10n ** 12n, regionxAccount, relayApi, alice); }