Skip to content

Commit

Permalink
change variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Jan 31, 2024
1 parent 14618a5 commit eca107b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ export const zeitgeist = new Parachain({
name: 'Zeitgeist',
parachainId: 2092,
ss58Format: 73,
usesOwnDecimalsInternally: true,
usesChainDecimals: true,
ws: 'wss://zeitgeist-rpc.dwellir.com',
});

Expand Down
7 changes: 2 additions & 5 deletions packages/sdk/src/getTransferData/getSourceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,14 @@ export async function getFeeBalance({
return balance;
}

const convertAmount = chain.usesOwnDecimalsInternally;
const feeBalance = await polkadot.query(
feeConfig.balance.build({
address,
asset: polkadot.chain.getBalanceAssetId(feeConfig.asset),
}) as SubstrateQueryConfig,
);

return convertAmount
return chain.usesChainDecimals
? convertDecimals(feeBalance, polkadot.decimals, decimals)
: feeBalance;
}
Expand Down Expand Up @@ -241,11 +240,9 @@ export async function getFee({

const xcmDeliveryFee = getXcmDeliveryFee(decimals, feeConfig);

const convertAmount = chain.usesOwnDecimalsInternally;

const totalFee = extrinsicFee + xcmDeliveryFee;

return convertAmount
return chain.usesChainDecimals
? convertDecimals(totalFee, polkadot.decimals, decimals)
: totalFee;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/sdk/src/getTransferData/getTransferData.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export async function getBalance({
});

if (cfg.type === CallType.Substrate) {
const convertAmount = chain.usesOwnDecimalsInternally;
const balance = await polkadot.query(cfg as SubstrateQueryConfig);
return convertAmount
return chain.usesChainDecimals
? convertDecimals(balance, polkadot.decimals, decimals)
: balance;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/types/src/chain/parachain/Parachain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ParachainConstructorParams
genesisHash: string;
parachainId: number;
ss58Format: number;
usesOwnDecimalsInternally?: boolean;
usesChainDecimals?: boolean;
weight?: number;
ws: string;
}
Expand All @@ -24,7 +24,7 @@ export class Parachain extends Chain {

readonly ss58Format: number;

readonly usesOwnDecimalsInternally: boolean;
readonly usesChainDecimals: boolean;

readonly weight: number | undefined;

Expand All @@ -34,7 +34,7 @@ export class Parachain extends Chain {
assetsData,
genesisHash,
parachainId,
usesOwnDecimalsInternally,
usesChainDecimals,
ss58Format,
weight,
ws,
Expand All @@ -50,7 +50,7 @@ export class Parachain extends Chain {
this.genesisHash = genesisHash;
this.parachainId = parachainId;
this.ss58Format = ss58Format;
this.usesOwnDecimalsInternally = !!usesOwnDecimalsInternally;
this.usesChainDecimals = !!usesChainDecimals;
this.weight = weight;
this.ws = ws;
}
Expand Down

0 comments on commit eca107b

Please sign in to comment.