Skip to content

Commit

Permalink
standarize transferAsset and feeAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Oct 3, 2024
1 parent 7531461 commit fcc496e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/mrl/src/getTransferData/getMoonChainData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export async function getMoonChainData({

const fee = await getDestinationFee({
address: sourceAddress, // TODO not correct
asset: route.mrl.moonChain.fee.asset,
asset: route.source.asset,
destination: moonChain,
fee: route.mrl.moonChain.fee.amount,
transferAsset: route.source.asset,
feeAsset: route.mrl.moonChain.fee.asset,
});

let address = sourceAddress;
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/getTransferData/getDestinationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export async function getDestinationData({
});
const fee = await getDestinationFee({
address: destinationAddress,
asset: route.destination.fee.asset,
feeAsset: route.destination.fee.asset,
destination,
fee: route.destination.fee.amount,
transferAsset: route.source.asset,
asset: route.source.asset,
});
const existentialDeposit = await getExistentialDeposit(destination);

Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/src/getTransferData/getTransferData.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,19 @@ export function getMax({
export interface GetDestinationFeeParams {
address: string;
asset: Asset;
feeAsset: Asset;
destination: AnyChain;
fee: number | FeeConfigBuilder;
transferAsset: Asset;
}

export async function getDestinationFee({
address,
asset,
destination,
fee,
transferAsset,
feeAsset,
}: GetDestinationFeeParams): Promise<AssetAmount> {
const zero = AssetAmount.fromChainAsset(destination.getChainAsset(asset), {
const zero = AssetAmount.fromChainAsset(destination.getChainAsset(feeAsset), {
amount: 0n,
});

Expand All @@ -184,9 +184,9 @@ export async function getDestinationFee({
const cfg = (fee as FeeConfigBuilder).build({
address,
api: polkadot.api,
asset: destination.getChainAsset(transferAsset),
feeAsset: destination.getChainAsset(asset),
asset: destination.getChainAsset(asset),
destination,
feeAsset: destination.getChainAsset(feeAsset),
});

return zero.copyWith({
Expand Down

0 comments on commit fcc496e

Please sign in to comment.