From c6331e4f61624d565d57743b17d2ae3c74996ac2 Mon Sep 17 00:00:00 2001 From: Richard Kenigs Date: Tue, 28 May 2024 11:20:31 +0200 Subject: [PATCH] get balances and decimals without signer --- .../src/getTransferData/getDestinationData.ts | 2 -- .../getTransferData/getTransferData.utils.ts | 19 +++++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/sdk/src/getTransferData/getDestinationData.ts b/packages/sdk/src/getTransferData/getDestinationData.ts index fbfe0ee3..e40d9046 100644 --- a/packages/sdk/src/getTransferData/getDestinationData.ts +++ b/packages/sdk/src/getTransferData/getDestinationData.ts @@ -31,7 +31,6 @@ export async function getDestinationData({ address: destinationAddress, chain, config, - evmSigner, polkadot, }), }); @@ -41,7 +40,6 @@ export async function getDestinationData({ chain, config, decimals: zeroAmount.decimals, - evmSigner, polkadot, }); const min = await getMin(config, polkadot); diff --git a/packages/sdk/src/getTransferData/getTransferData.utils.ts b/packages/sdk/src/getTransferData/getTransferData.utils.ts index 71301846..74e96b26 100644 --- a/packages/sdk/src/getTransferData/getTransferData.utils.ts +++ b/packages/sdk/src/getTransferData/getTransferData.utils.ts @@ -1,8 +1,11 @@ import { CallType, SubstrateQueryConfig } from '@moonbeam-network/xcm-builder'; import { AssetConfig } from '@moonbeam-network/xcm-config'; -import { AnyChain, Asset } from '@moonbeam-network/xcm-types'; +import { AnyChain, Asset, EvmParachain } from '@moonbeam-network/xcm-types'; import { convertDecimals, toBigInt } from '@moonbeam-network/xcm-utils'; -import { BalanceContractInterface, createContract } from '../contract'; +import { + BalanceContractInterface, + createContractWithoutSigner, +} from '../contract'; import { PolkadotService } from '../polkadot'; import { EvmSigner } from '../sdk.interfaces'; @@ -23,7 +26,6 @@ export async function getBalance({ chain, config, decimals, - evmSigner, polkadot, }: GetBalancesParams) { const cfg = config.balance.build({ @@ -37,10 +39,9 @@ export async function getBalance({ : balance; } - const contract = createContract( + const contract = createContractWithoutSigner( cfg, - evmSigner, - chain, + chain as EvmParachain, ) as BalanceContractInterface; const balance = await contract.getBalance(); @@ -53,7 +54,6 @@ export async function getDecimals({ asset, config, polkadot, - evmSigner, chain, }: GetDecimalsParams) { const cfg = config.balance.build({ @@ -64,10 +64,9 @@ export async function getDecimals({ return polkadot.getAssetDecimals(asset || config.asset); } - const contract = createContract( + const contract = createContractWithoutSigner( cfg, - evmSigner, - chain, + chain as EvmParachain, ) as BalanceContractInterface; return contract.getDecimals();