Skip to content

Commit

Permalink
get balances and decimals without signer
Browse files Browse the repository at this point in the history
  • Loading branch information
Rihyx committed May 28, 2024
1 parent 918c237 commit c6331e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 0 additions & 2 deletions packages/sdk/src/getTransferData/getDestinationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export async function getDestinationData({
address: destinationAddress,
chain,
config,
evmSigner,
polkadot,
}),
});
Expand All @@ -41,7 +40,6 @@ export async function getDestinationData({
chain,
config,
decimals: zeroAmount.decimals,
evmSigner,
polkadot,
});
const min = await getMin(config, polkadot);
Expand Down
19 changes: 9 additions & 10 deletions packages/sdk/src/getTransferData/getTransferData.utils.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -23,7 +26,6 @@ export async function getBalance({
chain,
config,
decimals,
evmSigner,
polkadot,
}: GetBalancesParams) {
const cfg = config.balance.build({
Expand All @@ -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();
Expand All @@ -53,7 +54,6 @@ export async function getDecimals({
asset,
config,
polkadot,
evmSigner,
chain,
}: GetDecimalsParams) {
const cfg = config.balance.build({
Expand All @@ -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();
Expand Down

0 comments on commit c6331e4

Please sign in to comment.