Skip to content

Commit

Permalink
support multi-fees for auction intents (#1507)
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei authored Jul 18, 2024
1 parent 6a41854 commit 8b9210c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/services/src/view-service/fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,30 @@ export const extractAltFee = async (
return swaps?.swap?.claimFee?.assetId ?? indexedDb.stakingTokenAssetId;
}

const auctionScheduleAsset = request.dutchAuctionScheduleActions
.map(a => a.description?.input)
.find(Boolean);
if (auctionScheduleAsset?.assetId) {
return auctionScheduleAsset.assetId;
}

const auctionEndAsset = request.dutchAuctionEndActions.map(a => a.auctionId).find(Boolean);
if (auctionEndAsset) {
const endAuction = await indexedDb.getAuction(auctionEndAsset);
if (endAuction.auction?.input?.assetId) {
return endAuction.auction.input.assetId;
}
}

const auctionWithdrawAsset = request.dutchAuctionWithdrawActions
.map(a => a.auctionId)
.find(Boolean);
if (auctionWithdrawAsset) {
const withdrawAuction = await indexedDb.getAuction(auctionWithdrawAsset);
if (withdrawAuction.auction?.input?.assetId) {
return withdrawAuction.auction.input.assetId;
}
}

throw new Error('Could not extract alternative fee assetId from TransactionPlannerRequest');
};

0 comments on commit 8b9210c

Please sign in to comment.