Skip to content

Commit

Permalink
Use the value from the LI.FI quote response data directly
Browse files Browse the repository at this point in the history
The mainnet value must be sent as it is calculated by the LI.FI API
because it includes mainnet amount needed to pay for bridge fees within
the smart contract.
  • Loading branch information
samholmes committed Aug 15, 2023
1 parent 2f4aa54 commit c84e51f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/swap/defi/lifi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ export function makeLifiPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {

const quoteJson = await quoteResponse.json()
const quote = asV1Quote(quoteJson)
const { estimate, includedSteps } = quote
const { estimate, includedSteps, transactionRequest } = quote
const { approvalAddress, toAmountMin } = estimate

const { data, gasLimit, gasPrice } = quote.transactionRequest
const { data, gasLimit, gasPrice } = transactionRequest
const gasPriceDecimal = hexToDecimal(gasPrice)
const gasPriceGwei = div18(gasPriceDecimal, '1000000000')
const providers = includedSteps.map(s => s.toolDetails.name)
Expand Down Expand Up @@ -333,7 +333,7 @@ export function makeLifiPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {
spendTargets: [
{
memo: data,
nativeAmount: nativeAmount,
nativeAmount: mul(transactionRequest.value, '1'),
publicAddress: approvalAddress
}
],
Expand Down

0 comments on commit c84e51f

Please sign in to comment.