Skip to content

Commit

Permalink
Fix bridge fee appearing without fee issue
Browse files Browse the repository at this point in the history
  • Loading branch information
saadahmsiddiqui committed Apr 19, 2024
1 parent a1a32bc commit 4303541
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { html } from 'lit';
import { when } from 'lit/directives/when.js';
import { customElement, property } from 'lit/decorators.js';
import { BigNumber } from 'ethers';
import type { SubstrateFee } from '@buildwithsygma/sygma-sdk-core/substrate';
import { tokenBalanceToNumber } from '../../../../utils/token';
import { BaseComponent } from '../../../common/base-component';
import { styles } from './styles';
Expand All @@ -20,7 +21,7 @@ export class FungibleTransferDetail extends BaseComponent {
static styles = styles;

@property({ type: Object })
fee?: EvmFee;
fee?: EvmFee | SubstrateFee | null;

@property({ type: Object })
selectedResource?: Resource;
Expand Down Expand Up @@ -101,7 +102,7 @@ export class FungibleTransferDetail extends BaseComponent {
return html`
<section class="transferDetail">
${when(
this.fee !== undefined,
this.fee !== null,
() =>
html`<div class="transferDetailContainer">
<div class="transferDetailContainerLabel">Bridge Fee</div>
Expand Down
9 changes: 9 additions & 0 deletions packages/widget/src/controllers/transfers/evm/gas-estimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import { Web3Provider } from '@ethersproject/providers';
import type { EIP1193Provider } from '@web3-onboard/core';
import { ethers, type BigNumber, type PopulatedTransaction } from 'ethers';

/**
* This method calculate the amount of gas
* list of transactions will cost
* @param {number} chainId blockchain ID
* @param {Eip1193Provider} eip1193Provider EIP compatible provider
* @param {string} sender address of signer connected with provider
* @param {PopulatedTransaction[]} transactions list of EVM transactions
* @returns {Promise<BigNumber>} gas cost in 18 decimals // or chain native decimals
*/
export async function estimateEvmTransactionsGasCost(
chainId: number,
eip1193Provider: EIP1193Provider,
Expand Down

0 comments on commit 4303541

Please sign in to comment.