Skip to content

Commit 08b0cbf

Browse files
authored
Merge branch 'main' into feat/bump-assets-package
2 parents c8ff60e + 718bbf7 commit 08b0cbf

File tree

4 files changed

+61
-18
lines changed

4 files changed

+61
-18
lines changed

test/e2e/page-objects/pages/dialog/confirm-alert.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ class ConfirmAlertModal {
2424
}
2525

2626
async rejectFromAlertModal() {
27-
this.driver.clickElement(this.alertModalCancelButton);
27+
await this.driver.clickElement(this.alertModalCancelButton);
2828
}
2929

3030
async confirmFromAlertModal() {
31-
this.driver.clickElement(this.alertModalAcknowledgeCheckBox);
32-
this.driver.clickElement(this.alertModalSubmitButton);
31+
await this.driver.clickElement(this.alertModalAcknowledgeCheckBox);
32+
await this.driver.clickElement(this.alertModalSubmitButton);
3333
}
3434

3535
async acknowledgeAlert() {
36-
this.driver.clickElement(this.alertModalAcknowledgeCheckBox);
37-
this.driver.clickElement(this.alertModalButton);
36+
await this.driver.clickElement(this.alertModalAcknowledgeCheckBox);
37+
await this.driver.clickElement(this.alertModalButton);
3838
}
3939

4040
async verifyNetworkDisplay(networkName: string): Promise<void> {

test/e2e/page-objects/pages/send/send-token-page.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,19 @@ class SendTokenPage {
239239
await this.driver.pasteIntoField(this.hexInput, hex);
240240
}
241241

242-
async getHexInputValue(): Promise<string> {
242+
async waitForHexDataCleared(): Promise<string> {
243243
console.log('Getting value from hex input');
244244
const hexInputElement = await this.driver.waitForSelector(this.hexInput);
245-
this.driver.waitForNonEmptyElement(hexInputElement);
245+
await this.driver.waitUntil(
246+
async () => {
247+
const value = await hexInputElement.getAttribute('value');
248+
return value === '';
249+
},
250+
{
251+
timeout: 5000,
252+
interval: 500,
253+
},
254+
);
246255
const value = await hexInputElement.getAttribute('value');
247256
console.log(`Hex input value: ${value}`);
248257
return value;

test/e2e/tests/transaction/change-assets.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import assert from 'assert/strict';
21
import { withFixtures } from '../../helpers';
32
import FixtureBuilder from '../../fixtures/fixture-builder';
43
import { SMART_CONTRACTS } from '../../seeder/smart-contracts';
@@ -232,12 +231,7 @@ describe('Change assets', function () {
232231
await sendTokenPage.fillAmount('2');
233232

234233
// Make sure hex data is cleared after switching assets
235-
const hexDataValue = await sendTokenPage.getHexInputValue();
236-
assert.equal(
237-
hexDataValue,
238-
'',
239-
'Hex data has not been cleared after switching assets.',
240-
);
234+
await sendTokenPage.waitForHexDataCleared();
241235

242236
// Make sure gas is updated by resetting amount and hex data
243237
// Note: this is needed until the race condition is fixed on the wallet level (issue #25243)

ui/pages/bridge/quotes/multichain-bridge-quote-card.tsx

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { useRewards } from '../../../hooks/bridge/useRewards';
4545
import { RewardsBadge } from '../../../components/app/rewards/RewardsBadge';
4646
import AddRewardsAccount from '../../../components/app/rewards/AddRewardsAccount';
4747
import { Skeleton } from '../../../components/component-library/skeleton';
48+
import { getGasFeesSponsoredNetworkEnabled } from '../../../selectors/selectors';
4849
import { BridgeQuotesModal } from './bridge-quotes-modal';
4950

5051
const getTimerColor = (timeInSeconds: number) => {
@@ -87,6 +88,9 @@ export const MultichainBridgeQuoteCard = ({
8788
const dispatch = useDispatch();
8889

8990
const isToOrFromNonEvm = useSelector(getIsToOrFromNonEvm);
91+
const gasFeesSponsoredNetworkEnabled = useSelector(
92+
getGasFeesSponsoredNetworkEnabled,
93+
);
9094

9195
const [showAllQuotes, setShowAllQuotes] = useState(false);
9296

@@ -97,7 +101,43 @@ export const MultichainBridgeQuoteCard = ({
97101
const gasIncluded = activeQuote?.quote?.gasIncluded ?? false;
98102
const gasIncluded7702 = activeQuote?.quote?.gasIncluded7702 ?? false;
99103
const gasSponsored = activeQuote?.quote?.gasSponsored ?? false;
100-
const isGasless = gasIncluded7702 || gasIncluded || gasSponsored;
104+
105+
const isCurrentNetworkGasSponsored = useMemo(() => {
106+
if (!fromChain?.chainId || !gasFeesSponsoredNetworkEnabled) {
107+
return false;
108+
}
109+
return Boolean(
110+
gasFeesSponsoredNetworkEnabled[
111+
fromChain.chainId as keyof typeof gasFeesSponsoredNetworkEnabled
112+
],
113+
);
114+
}, [fromChain?.chainId, gasFeesSponsoredNetworkEnabled]);
115+
116+
const shouldShowGasSponsored = useMemo(() => {
117+
if (gasSponsored) {
118+
return true;
119+
}
120+
121+
// For the insufficientBal workaround, validate it's a same-chain swap
122+
if (insufficientBal && isCurrentNetworkGasSponsored) {
123+
// Gas sponsorship only applies to same-chain swaps, not cross-chain bridges
124+
const isSameChain =
125+
fromToken?.chainId &&
126+
toToken?.chainId &&
127+
fromToken.chainId === toToken.chainId;
128+
return Boolean(isSameChain);
129+
}
130+
131+
return false;
132+
}, [
133+
gasSponsored,
134+
insufficientBal,
135+
isCurrentNetworkGasSponsored,
136+
fromToken?.chainId,
137+
toToken?.chainId,
138+
]);
139+
140+
const isGasless = gasIncluded7702 || gasIncluded || shouldShowGasSponsored;
101141

102142
const nativeTokenSymbol = fromChain
103143
? getNativeAssetForChainId(fromChain.chainId).symbol
@@ -266,7 +306,7 @@ export const MultichainBridgeQuoteCard = ({
266306
{t('networkFeeExplanation')}
267307
</Tooltip>
268308
</Row>
269-
{gasSponsored && (
309+
{shouldShowGasSponsored && (
270310
<Row gap={1} data-testid="network-fees-sponsored">
271311
<Text
272312
variant={TextVariant.bodySm}
@@ -283,7 +323,7 @@ export const MultichainBridgeQuoteCard = ({
283323
</Tooltip>
284324
</Row>
285325
)}
286-
{!gasSponsored && activeQuote.quote.gasIncluded && (
326+
{!shouldShowGasSponsored && activeQuote.quote.gasIncluded && (
287327
<Row gap={1} data-testid="network-fees-included">
288328
<Text
289329
variant={TextVariant.bodySm}
@@ -308,7 +348,7 @@ export const MultichainBridgeQuoteCard = ({
308348
</Text>
309349
</Row>
310350
)}
311-
{!gasSponsored && !activeQuote.quote.gasIncluded && (
351+
{!shouldShowGasSponsored && !activeQuote.quote.gasIncluded && (
312352
<Text
313353
variant={TextVariant.bodySm}
314354
color={TextColor.textAlternative}

0 commit comments

Comments
 (0)