Skip to content

Commit

Permalink
Adding a better explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
pawell24 committed Sep 17, 2024
1 parent cd5288d commit 65ea9b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ export async function prepareXchainRequestFulfillmentTransaction({
})

// Transaction estimation from Squid API allows us to know the transaction fees (gas and fee), then we can iterate over them and add the values ​​that are in dollars
// Explanation:
// feeCosts: Service fees that may be charged by the Squid.
// gasCosts: Network gas fees charged for blockchain transactions.
// feeEstimation: The total estimated fee, which is the sum of both feeCosts and gasCosts.
// Why loops?: Each of these costs can contain multiple items (multiple txs such as approve, swap, etc), so we iterate through each to add their USD values to the total estimated fee.

let feeEstimation = 0
if (routeResult.txEstimation.feeCosts.length > 0) {
routeResult.txEstimation.feeCosts.forEach((fee) => {
Expand Down

0 comments on commit 65ea9b9

Please sign in to comment.