@imtbl/sdk 1.47.10-alpha.5 → 1.48.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{blockchain_data-cWzsr5wl.js → blockchain_data-DmBo09Ub.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/{AddFundsWidget-CRB4FIQA.js → AddFundsWidget-B76vjzLe.js} +2 -2
- package/dist/browser/checkout/{BridgeWidget-DQWytFMq.js → BridgeWidget-26FpSkDM.js} +892 -5
- package/dist/browser/checkout/{CheckoutWidget-2YWKTPOw.js → CheckoutWidget-A0lpxQW5.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-Gp9PjJdg.js → OnRampWidget-BpHfHW9m.js} +19 -3
- package/dist/browser/checkout/{SaleWidget-KTxWf98O.js → SaleWidget-2NLt4vHC.js} +8 -8
- package/dist/browser/checkout/{SpendingCapHero-D5yi8Bqy.js → SpendingCapHero-CFYmjAC9.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-DRFyJjEa.js → SwapWidget-jOf_i-tX.js} +191 -226
- package/dist/browser/checkout/{TopUpView-CKizPnH0.js → TopUpView-CCWR_Ywt.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-BenJO1Gt.js → WalletWidget-DX6XyHRZ.js} +3 -3
- package/dist/browser/checkout/{auto-track-yKpxFpit.js → auto-track-HlFDs4AF.js} +1 -1
- package/dist/browser/checkout/{balance-Dpnr5wqM.js → balance-CxYIjdr3.js} +2 -2
- package/dist/browser/checkout/{index-B4PflMJG.js → index-B98fdYSj.js} +1150 -7300
- package/dist/browser/checkout/{index-CwvAErsc.js → index-C8MSufU0.js} +2 -2
- package/dist/browser/checkout/{index-COqbxbY_.js → index-CDckawJL.js} +1 -1
- package/dist/browser/checkout/{index-DlDjB9wn.js → index-DA2uO4yr.js} +1 -1
- package/dist/browser/checkout/{index-ZniBNFXw.js → index-DArhMjiX.js} +1 -1
- package/dist/browser/checkout/{index-D5C65gfz.js → index-Gzx2b9iM.js} +1 -1
- package/dist/browser/checkout/{index-CtXbWWJf.js → index-SW1XTDNB.js} +1 -1
- package/dist/browser/checkout/{index-PQUGtdAp.js → index-b14pM-Uq.js} +1 -1
- package/dist/browser/checkout/{index.umd-Bs9q0s4U.js → index.umd-YT5yUs2O.js} +1 -1
- package/dist/browser/checkout/{retry-C8XS-Xeo.js → retry-B5JRrQBT.js} +1 -1
- package/dist/browser/checkout/sdk.js +22 -22
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +1640 -6927
- package/dist/{checkout-CXpTQLRS.js → checkout-BFNKSC1p.js} +23 -7
- package/dist/checkout.d.ts +27 -2
- package/dist/checkout.js +5 -5
- package/dist/{config-B9pm_o2B.js → config-DdiXqLnW.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-Cd1_4hIm.js → index-CRCX_kjh.js} +1 -1
- package/dist/{index-E33r6dfY.js → index-CV4zecZ4.js} +3 -3
- package/dist/{index-PfNmrnl8.js → index-DZ3iNNYG.js} +4 -4
- package/dist/{index-BFR3TJ6T.js → index-I5hCRizU.js} +1 -1
- package/dist/{index-B73Nr-3V.js → index-YU2e3sgJ.js} +1 -1
- package/dist/{index-OqfbhlAB.js → index-n1s55SSO.js} +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +24 -8
- package/dist/index.d.ts +29 -2
- package/dist/index.js +14 -14
- package/dist/{minting_backend-BoiGA7Ww.js → minting_backend-D0xUp3hC.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-CcN997JC.js → orderbook-C3Fya1eb.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-DpdFVU6c.js → passport-DnEOV22D.js} +3 -3
- package/dist/passport.js +4 -4
- package/dist/{webhook-CHM4Pnle.js → webhook-CLXVoP8g.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-CxXemjdw.js → x-BNrl5-72.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as useTranslation,
|
|
2
|
-
import { S as SelectForm, T as TextInputForm,
|
|
3
|
-
import {
|
|
4
|
-
import { u as useInterval } from './retry-
|
|
5
|
-
import { S as SpendingCapHero } from './SpendingCapHero-
|
|
1
|
+
import { l as useTranslation, b5 as WidgetTheme, b6 as getRemoteImage, n as jsxs, b7 as quickswapFooterStyles, a as Box, b8 as quickswapFooterLogoStyles, j as jsx, o as Body, b9 as quickswapFooterDisclaimerTextStyles, r as reactExports, d as Button, ba as getImxTokenImage, a7 as Drawer, bb as CloudImage, a6 as Heading, bc as Logo, bd as Icon, ar as BigNumber, X as calculateCryptoToFiat, A as tokenValueFormat, aT as isGasFree, v as formatZeroAmount, q as ConnectLoaderContext, be as getDefaultTokenImage, G as isNativeToken, bf as NATIVE, V as ViewContext, t as useAnalytics, bg as DEFAULT_QUOTE_REFRESH_INTERVAL, w as isPassportProvider, bh as amountInputValidation, bi as Tooltip, U as UserJourney, z as Environment, p as ViewActions, K as SharedViews, x as getL2ChainId, aB as Fragment, bj as ESTIMATE_DEBOUNCE, bk as DEFAULT_TOKEN_VALIDATION_DECIMALS, bl as DEFAULT_TOKEN_DECIMALS, E as EventTargetContext, bm as sendSwapWidgetCloseEvent, Y as HeaderNavigation, aj as LoadingView, a2 as SimpleLayout, bn as IMX_TOKEN_SYMBOL, J as CheckoutErrorType, ae as SimpleTextBody, bo as FooterButton, ah as viewReducer, ai as initialViewState, T as TokenFilterTypes, Q as DEFAULT_BALANCE_RETRY_POLICY, bp as SwapDirection$1, bq as StatusView, br as sendSwapSuccessEvent, aJ as StatusType, bs as sendSwapFailedEvent, bt as sendSwapRejectedEvent, ak as ErrorView, I as IMTBLWidgetEvents } from './index-B98fdYSj.js';
|
|
2
|
+
import { S as SelectForm, T as TextInputForm, F as Fees, a as TransactionRejected, N as NetworkSwitchDrawer, W as WalletApproveHero, g as getAllowedBalances } from './balance-CxYIjdr3.js';
|
|
3
|
+
import { f as formatUnits, p as parseUnits, C as CryptoFiatContext, a as CryptoFiatActions, c as parseEther, S as SwapWidgetViews, T as TopUpView, b as CryptoFiatProvider } from './TopUpView-CCWR_Ywt.js';
|
|
4
|
+
import { u as useInterval } from './retry-B5JRrQBT.js';
|
|
5
|
+
import { S as SpendingCapHero } from './SpendingCapHero-CFYmjAC9.js';
|
|
6
6
|
|
|
7
7
|
function QuickswapFooter({ theme, environment }) {
|
|
8
8
|
const { t } = useTranslation();
|
|
@@ -19,6 +19,7 @@ const initialSwapState = {
|
|
|
19
19
|
tokenBalances: [],
|
|
20
20
|
supportedTopUps: null,
|
|
21
21
|
allowedTokens: [],
|
|
22
|
+
autoProceed: false,
|
|
22
23
|
};
|
|
23
24
|
var SwapActions;
|
|
24
25
|
(function (SwapActions) {
|
|
@@ -28,6 +29,7 @@ var SwapActions;
|
|
|
28
29
|
SwapActions["SET_SUPPORTED_TOP_UPS"] = "SET_SUPPORTED_TOP_UPS";
|
|
29
30
|
SwapActions["SET_TOKEN_BALANCES"] = "SET_TOKEN_BALANCES";
|
|
30
31
|
SwapActions["SET_ALLOWED_TOKENS"] = "SET_ALLOWED_TOKENS";
|
|
32
|
+
SwapActions["SET_AUTO_PROCEED"] = "SET_AUTO_PROCEED";
|
|
31
33
|
})(SwapActions || (SwapActions = {}));
|
|
32
34
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
35
|
const SwapContext = reactExports.createContext({
|
|
@@ -71,24 +73,17 @@ const swapReducer = (state, action) => {
|
|
|
71
73
|
...state,
|
|
72
74
|
allowedTokens: action.payload.allowedTokens,
|
|
73
75
|
};
|
|
76
|
+
case SwapActions.SET_AUTO_PROCEED:
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
autoProceed: action.payload.autoProceed,
|
|
80
|
+
direction: action.payload.direction,
|
|
81
|
+
};
|
|
74
82
|
default:
|
|
75
83
|
return state;
|
|
76
84
|
}
|
|
77
85
|
};
|
|
78
86
|
|
|
79
|
-
const fromAmountIn = async (exchange, provider, fromToken, fromAmount, toToken) => {
|
|
80
|
-
const address = await provider.getSigner().getAddress();
|
|
81
|
-
return exchange.getUnsignedSwapTxFromAmountIn(address, fromToken.address, toToken.address, BigNumber.from(parseUnits(fromAmount, fromToken.decimals)));
|
|
82
|
-
};
|
|
83
|
-
const fromAmountOut = async (exchange, provider, toToken, toAmount, fromToken) => {
|
|
84
|
-
const address = await provider.getSigner().getAddress();
|
|
85
|
-
return exchange.getUnsignedSwapTxFromAmountOut(address, fromToken.address, toToken.address, BigNumber.from(parseUnits(toAmount, toToken.decimals)));
|
|
86
|
-
};
|
|
87
|
-
const quotesProcessor = {
|
|
88
|
-
fromAmountIn,
|
|
89
|
-
fromAmountOut,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
87
|
const selectInputBoxStyle = {
|
|
93
88
|
display: 'flex',
|
|
94
89
|
flexDirection: 'row',
|
|
@@ -139,153 +134,15 @@ const swapButtonIconLoadingStyle = {
|
|
|
139
134
|
width: 'base.icon.size.400',
|
|
140
135
|
};
|
|
141
136
|
|
|
142
|
-
function SwapButton({ loading,
|
|
137
|
+
function SwapButton({ loading, validator, sendTransaction, }) {
|
|
143
138
|
const { t } = useTranslation();
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const { track } = useAnalytics();
|
|
149
|
-
const sendTransaction = async () => {
|
|
150
|
-
const isValid = validator();
|
|
151
|
-
// Tracking swap from data here and is valid or not to understand behaviour
|
|
152
|
-
track({
|
|
153
|
-
userJourney: UserJourney.SWAP,
|
|
154
|
-
screen: 'SwapCoins',
|
|
155
|
-
control: 'Swap',
|
|
156
|
-
controlType: 'Button',
|
|
157
|
-
extras: {
|
|
158
|
-
swapFromAddress: data?.fromTokenAddress,
|
|
159
|
-
swapFromAmount: data?.fromAmount,
|
|
160
|
-
swapFromTokenSymbol: data?.fromTokenSymbol,
|
|
161
|
-
swapToAddress: data?.toTokenAddress,
|
|
162
|
-
swapToAmount: data?.toAmount,
|
|
163
|
-
swapToTokenSymbol: data?.toTokenSymbol,
|
|
164
|
-
isSwapFormValid: isValid,
|
|
165
|
-
hasFundsForGas: !insufficientFundsForGas,
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
if (!isValid)
|
|
169
|
-
return;
|
|
170
|
-
if (!checkout || !provider || !transaction)
|
|
171
|
-
return;
|
|
172
|
-
if (insufficientFundsForGas) {
|
|
173
|
-
openNotEnoughImxDrawer();
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
try {
|
|
177
|
-
// check for switch network here
|
|
178
|
-
const currentChainId = await provider.provider.request({ method: 'eth_chainId', params: [] });
|
|
179
|
-
// eslint-disable-next-line radix
|
|
180
|
-
const parsedChainId = parseInt(currentChainId.toString());
|
|
181
|
-
if (parsedChainId !== getL2ChainId(checkout.config)) {
|
|
182
|
-
openNetworkSwitchDrawer();
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
catch (err) {
|
|
187
|
-
// eslint-disable-next-line no-console
|
|
188
|
-
console.error('Current network check failed', err);
|
|
189
|
-
}
|
|
190
|
-
if (!transaction)
|
|
191
|
-
return;
|
|
192
|
-
try {
|
|
193
|
-
updateLoading(true);
|
|
194
|
-
const prefilledSwapData = {
|
|
195
|
-
fromAmount: data?.fromAmount || '',
|
|
196
|
-
fromTokenAddress: data?.fromTokenAddress || '',
|
|
197
|
-
toTokenAddress: data?.toTokenAddress || '',
|
|
198
|
-
toAmount: data?.toAmount || '',
|
|
199
|
-
};
|
|
200
|
-
if (transaction.approval) {
|
|
201
|
-
// If we need to approve a spending limit first
|
|
202
|
-
// send user to Approve ERC20 Onbaording flow
|
|
203
|
-
viewDispatch({
|
|
204
|
-
payload: {
|
|
205
|
-
type: ViewActions.UPDATE_VIEW,
|
|
206
|
-
view: {
|
|
207
|
-
type: SwapWidgetViews.APPROVE_ERC20,
|
|
208
|
-
data: {
|
|
209
|
-
approveTransaction: transaction.approval.transaction,
|
|
210
|
-
transaction: transaction.swap.transaction,
|
|
211
|
-
info: transaction.quote,
|
|
212
|
-
swapFormInfo: prefilledSwapData,
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const txn = await checkout.sendTransaction({
|
|
220
|
-
provider,
|
|
221
|
-
transaction: {
|
|
222
|
-
...transaction.swap.transaction,
|
|
223
|
-
gasPrice: (isPassportProvider(provider) ? BigNumber.from(0) : undefined),
|
|
224
|
-
},
|
|
225
|
-
});
|
|
226
|
-
viewDispatch({
|
|
227
|
-
payload: {
|
|
228
|
-
type: ViewActions.UPDATE_VIEW,
|
|
229
|
-
view: {
|
|
230
|
-
type: SwapWidgetViews.IN_PROGRESS,
|
|
231
|
-
data: {
|
|
232
|
-
transactionResponse: txn.transactionResponse,
|
|
233
|
-
swapForm: prefilledSwapData,
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
catch (err) {
|
|
240
|
-
// eslint-disable-next-line no-console
|
|
241
|
-
console.error(err);
|
|
242
|
-
updateLoading(false);
|
|
243
|
-
if (err.type === CheckoutErrorType.USER_REJECTED_REQUEST_ERROR) {
|
|
244
|
-
setShowTxnRejectedState(true);
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (err.type === CheckoutErrorType.UNPREDICTABLE_GAS_LIMIT) {
|
|
248
|
-
viewDispatch({
|
|
249
|
-
payload: {
|
|
250
|
-
type: ViewActions.UPDATE_VIEW,
|
|
251
|
-
view: {
|
|
252
|
-
type: SwapWidgetViews.PRICE_SURGE,
|
|
253
|
-
data: data,
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
if (err.type === CheckoutErrorType.TRANSACTION_FAILED
|
|
260
|
-
|| err.type === CheckoutErrorType.INSUFFICIENT_FUNDS
|
|
261
|
-
|| (err.receipt && err.receipt.status === 0)) {
|
|
262
|
-
viewDispatch({
|
|
263
|
-
payload: {
|
|
264
|
-
type: ViewActions.UPDATE_VIEW,
|
|
265
|
-
view: {
|
|
266
|
-
type: SwapWidgetViews.FAIL,
|
|
267
|
-
reason: 'Transaction failed',
|
|
268
|
-
data: data,
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
viewDispatch({
|
|
275
|
-
payload: {
|
|
276
|
-
type: ViewActions.UPDATE_VIEW,
|
|
277
|
-
view: {
|
|
278
|
-
type: SharedViews.ERROR_VIEW,
|
|
279
|
-
error: err,
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
});
|
|
139
|
+
const handleClick = async () => {
|
|
140
|
+
const canSwap = validator();
|
|
141
|
+
if (canSwap) {
|
|
142
|
+
await sendTransaction();
|
|
283
143
|
}
|
|
284
144
|
};
|
|
285
|
-
return (
|
|
286
|
-
sendTransaction();
|
|
287
|
-
setShowTxnRejectedState(false);
|
|
288
|
-
} })] }));
|
|
145
|
+
return (jsx(Box, { sx: swapButtonBoxStyle, children: jsx(Button, { testId: "swap-button", disabled: loading, variant: "primary", onClick: handleClick, size: "large", children: loading ? (jsx(Button.Icon, { icon: "Loading", sx: swapButtonIconLoadingStyle })) : t('views.SWAP.swapForm.buttonText') }) }));
|
|
289
146
|
}
|
|
290
147
|
|
|
291
148
|
const containerStyles$1 = {
|
|
@@ -639,9 +496,9 @@ const shouldSetToAddress = (toAddress, fromAddress) => {
|
|
|
639
496
|
return true;
|
|
640
497
|
};
|
|
641
498
|
let quoteRequest;
|
|
642
|
-
function SwapForm({ data, theme }) {
|
|
499
|
+
function SwapForm({ data, theme, cancelAutoProceed }) {
|
|
643
500
|
const { t } = useTranslation();
|
|
644
|
-
const { swapState: { allowedTokens,
|
|
501
|
+
const { swapState: { allowedTokens, tokenBalances, network, autoProceed, }, } = reactExports.useContext(SwapContext);
|
|
645
502
|
const { connectLoaderState } = reactExports.useContext(ConnectLoaderContext);
|
|
646
503
|
const { checkout, provider } = connectLoaderState;
|
|
647
504
|
const defaultTokenImage = getDefaultTokenImage(checkout?.config.environment, theme);
|
|
@@ -667,6 +524,7 @@ function SwapForm({ data, theme }) {
|
|
|
667
524
|
const [toToken, setToToken] = reactExports.useState();
|
|
668
525
|
const [toTokenError, setToTokenError] = reactExports.useState('');
|
|
669
526
|
const [fromFiatValue, setFromFiatValue] = reactExports.useState('');
|
|
527
|
+
const [loadedToAndFromTokens, setLoadedToAndFromTokens] = reactExports.useState(false);
|
|
670
528
|
// Quote
|
|
671
529
|
const [quote, setQuote] = reactExports.useState(null);
|
|
672
530
|
const [gasFeeValue, setGasFeeValue] = reactExports.useState('');
|
|
@@ -685,6 +543,7 @@ function SwapForm({ data, theme }) {
|
|
|
685
543
|
const [showNotEnoughImxDrawer, setShowNotEnoughImxDrawer] = reactExports.useState(false);
|
|
686
544
|
const [showUnableToSwapDrawer, setShowUnableToSwapDrawer] = reactExports.useState(false);
|
|
687
545
|
const [showNetworkSwitchDrawer, setShowNetworkSwitchDrawer] = reactExports.useState(false);
|
|
546
|
+
const [showTxnRejectedState, setShowTxnRejectedState] = reactExports.useState(false);
|
|
688
547
|
reactExports.useEffect(() => {
|
|
689
548
|
if (tokenBalances.length === 0)
|
|
690
549
|
return;
|
|
@@ -716,6 +575,7 @@ function SwapForm({ data, theme }) {
|
|
|
716
575
|
if (shouldSetToAddress(data?.toTokenAddress, data?.fromTokenAddress) && !toToken) {
|
|
717
576
|
setToToken(allowedTokens.find((token) => (isNativeToken(token.address) && data?.toTokenAddress?.toLowerCase() === NATIVE) || (token.address?.toLowerCase() === data?.toTokenAddress?.toLowerCase())));
|
|
718
577
|
}
|
|
578
|
+
setLoadedToAndFromTokens(true);
|
|
719
579
|
}, [
|
|
720
580
|
tokenBalances,
|
|
721
581
|
allowedTokens,
|
|
@@ -766,14 +626,19 @@ function SwapForm({ data, theme }) {
|
|
|
766
626
|
const processFetchQuoteFrom = async (silently = false) => {
|
|
767
627
|
if (!provider)
|
|
768
628
|
return;
|
|
769
|
-
if (!
|
|
629
|
+
if (!checkout)
|
|
770
630
|
return;
|
|
771
631
|
if (!fromToken)
|
|
772
632
|
return;
|
|
773
633
|
if (!toToken)
|
|
774
634
|
return;
|
|
775
635
|
try {
|
|
776
|
-
const quoteResultPromise =
|
|
636
|
+
const quoteResultPromise = checkout.swapQuote({
|
|
637
|
+
provider,
|
|
638
|
+
fromToken,
|
|
639
|
+
toToken,
|
|
640
|
+
fromAmount,
|
|
641
|
+
});
|
|
777
642
|
const currentQuoteRequest = CancellablePromise.all([
|
|
778
643
|
quoteResultPromise,
|
|
779
644
|
]);
|
|
@@ -821,14 +686,20 @@ function SwapForm({ data, theme }) {
|
|
|
821
686
|
const processFetchQuoteTo = async (silently = false) => {
|
|
822
687
|
if (!provider)
|
|
823
688
|
return;
|
|
824
|
-
if (!
|
|
689
|
+
if (!checkout)
|
|
825
690
|
return;
|
|
826
691
|
if (!fromToken)
|
|
827
692
|
return;
|
|
828
693
|
if (!toToken)
|
|
829
694
|
return;
|
|
830
695
|
try {
|
|
831
|
-
const quoteResultPromise =
|
|
696
|
+
const quoteResultPromise = checkout.swapQuote({
|
|
697
|
+
provider,
|
|
698
|
+
fromToken,
|
|
699
|
+
toToken,
|
|
700
|
+
fromAmount: undefined,
|
|
701
|
+
toAmount,
|
|
702
|
+
});
|
|
832
703
|
const currentQuoteRequest = CancellablePromise.all([
|
|
833
704
|
quoteResultPromise,
|
|
834
705
|
]);
|
|
@@ -927,7 +798,9 @@ function SwapForm({ data, theme }) {
|
|
|
927
798
|
await fetchQuoteTo(silently);
|
|
928
799
|
};
|
|
929
800
|
// Silently refresh the quote
|
|
930
|
-
useInterval(() =>
|
|
801
|
+
useInterval(() => {
|
|
802
|
+
fetchQuote(true);
|
|
803
|
+
}, DEFAULT_QUOTE_REFRESH_INTERVAL);
|
|
931
804
|
// Fetch quote triggers
|
|
932
805
|
reactExports.useEffect(() => {
|
|
933
806
|
if (direction === SwapDirection.FROM) {
|
|
@@ -1110,7 +983,103 @@ function SwapForm({ data, theme }) {
|
|
|
1110
983
|
});
|
|
1111
984
|
return isSwapFormValid;
|
|
1112
985
|
};
|
|
986
|
+
const isFormValidForAutoProceed = reactExports.useMemo(() => {
|
|
987
|
+
if (!autoProceed)
|
|
988
|
+
return false;
|
|
989
|
+
if (!loadedToAndFromTokens)
|
|
990
|
+
return false;
|
|
991
|
+
return !loading;
|
|
992
|
+
}, [autoProceed, loading, loadedToAndFromTokens]);
|
|
993
|
+
const canAutoSwap = reactExports.useMemo(() => {
|
|
994
|
+
if (!autoProceed)
|
|
995
|
+
return false;
|
|
996
|
+
if (!isFormValidForAutoProceed)
|
|
997
|
+
return false;
|
|
998
|
+
const isFormValid = SwapFormValidator();
|
|
999
|
+
if (!isFormValid) {
|
|
1000
|
+
cancelAutoProceed();
|
|
1001
|
+
return false;
|
|
1002
|
+
}
|
|
1003
|
+
return true;
|
|
1004
|
+
}, [isFormValidForAutoProceed]);
|
|
1005
|
+
const sendTransaction = async () => {
|
|
1006
|
+
if (!quote)
|
|
1007
|
+
return;
|
|
1008
|
+
const transaction = quote;
|
|
1009
|
+
const isValid = SwapFormValidator();
|
|
1010
|
+
// Tracking swap from data here and is valid or not to understand behaviour
|
|
1011
|
+
track({
|
|
1012
|
+
userJourney: UserJourney.SWAP,
|
|
1013
|
+
screen: 'SwapCoins',
|
|
1014
|
+
control: 'Swap',
|
|
1015
|
+
controlType: 'Button',
|
|
1016
|
+
extras: {
|
|
1017
|
+
swapFromAddress: data?.fromTokenAddress,
|
|
1018
|
+
swapFromAmount: data?.fromAmount,
|
|
1019
|
+
swapFromTokenSymbol: data?.fromTokenSymbol,
|
|
1020
|
+
swapToAddress: data?.toTokenAddress,
|
|
1021
|
+
swapToAmount: data?.toAmount,
|
|
1022
|
+
swapToTokenSymbol: data?.toTokenSymbol,
|
|
1023
|
+
isSwapFormValid: isValid,
|
|
1024
|
+
hasFundsForGas: !insufficientFundsForGas,
|
|
1025
|
+
},
|
|
1026
|
+
});
|
|
1027
|
+
if (!isValid)
|
|
1028
|
+
return;
|
|
1029
|
+
if (!checkout || !provider || !transaction)
|
|
1030
|
+
return;
|
|
1031
|
+
if (insufficientFundsForGas) {
|
|
1032
|
+
cancelAutoProceed();
|
|
1033
|
+
openNotEnoughImxDrawer();
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
try {
|
|
1037
|
+
// check for switch network here
|
|
1038
|
+
const currentChainId = await provider.provider.request({ method: 'eth_chainId', params: [] });
|
|
1039
|
+
// eslint-disable-next-line radix
|
|
1040
|
+
const parsedChainId = parseInt(currentChainId.toString());
|
|
1041
|
+
if (parsedChainId !== getL2ChainId(checkout.config)) {
|
|
1042
|
+
setShowNetworkSwitchDrawer(true);
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
catch (err) {
|
|
1047
|
+
// eslint-disable-next-line no-console
|
|
1048
|
+
console.error('Current network check failed', err);
|
|
1049
|
+
}
|
|
1050
|
+
if (!transaction)
|
|
1051
|
+
return;
|
|
1052
|
+
setLoading(true);
|
|
1053
|
+
const prefilledSwapData = {
|
|
1054
|
+
fromAmount: data?.fromAmount || '',
|
|
1055
|
+
fromTokenAddress: data?.fromTokenAddress || '',
|
|
1056
|
+
toTokenAddress: data?.toTokenAddress || '',
|
|
1057
|
+
toAmount: data?.toAmount || '',
|
|
1058
|
+
};
|
|
1059
|
+
viewDispatch({
|
|
1060
|
+
payload: {
|
|
1061
|
+
type: ViewActions.UPDATE_VIEW,
|
|
1062
|
+
view: {
|
|
1063
|
+
type: SwapWidgetViews.APPROVE_ERC20,
|
|
1064
|
+
data: {
|
|
1065
|
+
approveTransaction: transaction.approval?.transaction,
|
|
1066
|
+
transaction: transaction.swap.transaction,
|
|
1067
|
+
info: transaction.quote,
|
|
1068
|
+
swapFormInfo: prefilledSwapData,
|
|
1069
|
+
},
|
|
1070
|
+
},
|
|
1071
|
+
},
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
reactExports.useEffect(() => {
|
|
1075
|
+
if (!autoProceed)
|
|
1076
|
+
return;
|
|
1077
|
+
if (!canAutoSwap)
|
|
1078
|
+
return;
|
|
1079
|
+
sendTransaction();
|
|
1080
|
+
}, [canAutoSwap, autoProceed, sendTransaction]);
|
|
1113
1081
|
return (jsxs(Fragment, { children: [jsxs(Box, { sx: {
|
|
1082
|
+
visibility: autoProceed ? 'hidden' : 'visible',
|
|
1114
1083
|
paddingX: 'base.spacing.x4',
|
|
1115
1084
|
marginBottom: 'base.spacing.x2',
|
|
1116
1085
|
}, children: [jsx(Heading, { size: "small", weight: "regular", sx: { paddingBottom: 'base.spacing.x4' }, children: t('views.SWAP.content.title') }), jsxs(Box, { sx: {
|
|
@@ -1144,16 +1113,10 @@ function SwapForm({ data, theme }) {
|
|
|
1144
1113
|
});
|
|
1145
1114
|
}, sx: {
|
|
1146
1115
|
paddingBottom: '0',
|
|
1147
|
-
}, loading: loading }))] }), jsx(SwapButton, { validator: SwapFormValidator,
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
toAmount,
|
|
1152
|
-
fromTokenSymbol: fromToken?.symbol,
|
|
1153
|
-
fromTokenAddress: fromToken?.address,
|
|
1154
|
-
toTokenSymbol: toToken?.symbol,
|
|
1155
|
-
toTokenAddress: toToken?.address,
|
|
1156
|
-
}, insufficientFundsForGas: insufficientFundsForGas, openNotEnoughImxDrawer: openNotEnoughImxDrawer, openNetworkSwitchDrawer: () => setShowNetworkSwitchDrawer(true) }), jsx(NotEnoughImx, { environment: checkout?.config.environment ?? Environment.PRODUCTION, visible: showNotEnoughImxDrawer, showAdjustAmount: fromToken?.address === NATIVE, hasZeroImx: false, onAddCoinsClick: () => {
|
|
1116
|
+
}, loading: loading }))] }), !autoProceed && (jsx(SwapButton, { validator: SwapFormValidator, loading: loading, sendTransaction: sendTransaction })), jsx(TransactionRejected, { visible: showTxnRejectedState, showHeaderBar: false, onCloseDrawer: () => setShowTxnRejectedState(false), onRetry: () => {
|
|
1117
|
+
sendTransaction();
|
|
1118
|
+
setShowTxnRejectedState(false);
|
|
1119
|
+
} }), jsx(NotEnoughImx, { environment: checkout?.config.environment ?? Environment.PRODUCTION, visible: showNotEnoughImxDrawer, showAdjustAmount: fromToken?.address === NATIVE, hasZeroImx: false, onAddCoinsClick: () => {
|
|
1157
1120
|
viewDispatch({
|
|
1158
1121
|
payload: {
|
|
1159
1122
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -1189,11 +1152,11 @@ const hasZeroBalance = (tokenBalances, symbol) => {
|
|
|
1189
1152
|
return zeroBalance;
|
|
1190
1153
|
};
|
|
1191
1154
|
|
|
1192
|
-
function SwapCoins({ theme, fromAmount, toAmount, fromTokenAddress, toTokenAddress, }) {
|
|
1155
|
+
function SwapCoins({ theme, cancelAutoProceed, fromAmount, toAmount, fromTokenAddress, toTokenAddress, }) {
|
|
1193
1156
|
const { t } = useTranslation();
|
|
1194
1157
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
1195
1158
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
1196
|
-
const { swapState: { tokenBalances, }, } = reactExports.useContext(SwapContext);
|
|
1159
|
+
const { swapState: { tokenBalances, autoProceed, }, } = reactExports.useContext(SwapContext);
|
|
1197
1160
|
const { connectLoaderState: { checkout, provider, }, } = reactExports.useContext(ConnectLoaderContext);
|
|
1198
1161
|
const [showNotEnoughImxDrawer, setShowNotEnoughImxDrawer] = reactExports.useState(false);
|
|
1199
1162
|
const { page } = useAnalytics();
|
|
@@ -1214,28 +1177,28 @@ function SwapCoins({ theme, fromAmount, toAmount, fromTokenAddress, toTokenAddre
|
|
|
1214
1177
|
setShowNotEnoughImxDrawer(true);
|
|
1215
1178
|
}
|
|
1216
1179
|
}, [tokenBalances]);
|
|
1217
|
-
return (
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1180
|
+
return (jsxs(SimpleLayout, { header: !autoProceed ? (jsx(HeaderNavigation, { title: t('views.SWAP.header.title'), onCloseButtonClick: () => sendSwapWidgetCloseEvent(eventTarget) })) : '', footer: jsx(QuickswapFooter, { environment: checkout?.config.environment, theme: theme }), children: [jsxs(Box, { sx: {
|
|
1181
|
+
height: '100%',
|
|
1182
|
+
display: 'flex',
|
|
1183
|
+
flexDirection: 'column',
|
|
1184
|
+
justifyContent: 'space-between',
|
|
1185
|
+
}, children: [jsx(SwapForm, { cancelAutoProceed: cancelAutoProceed, data: {
|
|
1186
|
+
fromAmount,
|
|
1187
|
+
toAmount,
|
|
1188
|
+
fromTokenAddress,
|
|
1189
|
+
toTokenAddress,
|
|
1190
|
+
}, theme: theme }), jsx(NotEnoughImx, { environment: checkout?.config.environment ?? Environment.PRODUCTION, visible: showNotEnoughImxDrawer, showAdjustAmount: false, hasZeroImx: true, onAddCoinsClick: () => {
|
|
1191
|
+
viewDispatch({
|
|
1192
|
+
payload: {
|
|
1193
|
+
type: ViewActions.UPDATE_VIEW,
|
|
1194
|
+
view: {
|
|
1195
|
+
type: SharedViews.TOP_UP_VIEW,
|
|
1196
|
+
},
|
|
1233
1197
|
},
|
|
1234
|
-
}
|
|
1235
|
-
})
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
} })] }) }));
|
|
1198
|
+
});
|
|
1199
|
+
}, onCloseDrawer: () => {
|
|
1200
|
+
setShowNotEnoughImxDrawer(false);
|
|
1201
|
+
} })] }), autoProceed && jsx(LoadingView, { loadingText: t('views.SWAP.PREPARE_SWAP.loading.text') })] }));
|
|
1239
1202
|
}
|
|
1240
1203
|
|
|
1241
1204
|
function SwapInProgress({ transactionResponse, swapForm, }) {
|
|
@@ -1309,10 +1272,11 @@ function ApproveERC20Onboarding({ data }) {
|
|
|
1309
1272
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
1310
1273
|
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
1311
1274
|
const isPassport = isPassportProvider(provider);
|
|
1275
|
+
const noApprovalTransaction = data.approveTransaction === undefined;
|
|
1312
1276
|
// Local state
|
|
1313
1277
|
const [actionDisabled, setActionDisabled] = reactExports.useState(false);
|
|
1314
1278
|
const [approvalTxnLoading, setApprovalTxnLoading] = reactExports.useState(false);
|
|
1315
|
-
const [showSwapTxnStep, setShowSwapTxnStep] = reactExports.useState(
|
|
1279
|
+
const [showSwapTxnStep, setShowSwapTxnStep] = reactExports.useState(noApprovalTransaction);
|
|
1316
1280
|
const [loading, setLoading] = reactExports.useState(false);
|
|
1317
1281
|
// reject transaction flags
|
|
1318
1282
|
const [rejectedSpending, setRejectedSpending] = reactExports.useState(false);
|
|
@@ -1539,7 +1503,7 @@ function ApproveERC20Onboarding({ data }) {
|
|
|
1539
1503
|
return (jsxs(Fragment, { children: [approvalTxnLoading && (jsx(LoadingView, { loadingText: t('views.APPROVE_ERC20.approveSpending.loading.text') })), !approvalTxnLoading && (jsx(SimpleLayout, { header: (jsx(HeaderNavigation, { transparent: true, showBack: true, onCloseButtonClick: () => sendSwapWidgetCloseEvent(eventTarget), onBackButtonClick: goBackWithSwapData })), floatHeader: true, heroContent: showSwapTxnStep ? jsx(WalletApproveHero, {}) : jsx(SpendingCapHero, {}), footer: showSwapTxnStep ? approveSwapFooter : approveSpendingFooter, children: showSwapTxnStep ? approveSwapContent : approveSpendingContent }))] }));
|
|
1540
1504
|
}
|
|
1541
1505
|
|
|
1542
|
-
function SwapWidget({ amount, fromTokenAddress, toTokenAddress, config, }) {
|
|
1506
|
+
function SwapWidget({ amount, fromTokenAddress, toTokenAddress, config, autoProceed, direction, }) {
|
|
1543
1507
|
const { t } = useTranslation();
|
|
1544
1508
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
1545
1509
|
const { environment, theme, isOnRampEnabled, isSwapEnabled, isBridgeEnabled, } = config;
|
|
@@ -1617,26 +1581,6 @@ function SwapWidget({ amount, fromTokenAddress, toTokenAddress, config, }) {
|
|
|
1617
1581
|
// connect loader handle the switch network functionality
|
|
1618
1582
|
if (network.chainId !== getL2ChainId(checkout.config))
|
|
1619
1583
|
return;
|
|
1620
|
-
let dexConfig;
|
|
1621
|
-
try {
|
|
1622
|
-
dexConfig = (await checkout.config.remote.getConfig('dex'));
|
|
1623
|
-
}
|
|
1624
|
-
catch (err) {
|
|
1625
|
-
showErrorView(err);
|
|
1626
|
-
return;
|
|
1627
|
-
}
|
|
1628
|
-
const exchange = new Exchange({
|
|
1629
|
-
chainId: network.chainId,
|
|
1630
|
-
baseConfig: new ImmutableConfiguration({ environment }),
|
|
1631
|
-
secondaryFees: dexConfig.secondaryFees,
|
|
1632
|
-
overrides: dexConfig.overrides,
|
|
1633
|
-
});
|
|
1634
|
-
swapDispatch({
|
|
1635
|
-
payload: {
|
|
1636
|
-
type: SwapActions.SET_EXCHANGE,
|
|
1637
|
-
exchange,
|
|
1638
|
-
},
|
|
1639
|
-
});
|
|
1640
1584
|
swapDispatch({
|
|
1641
1585
|
payload: {
|
|
1642
1586
|
type: SwapActions.SET_NETWORK,
|
|
@@ -1650,8 +1594,29 @@ function SwapWidget({ amount, fromTokenAddress, toTokenAddress, config, }) {
|
|
|
1650
1594
|
}
|
|
1651
1595
|
})();
|
|
1652
1596
|
}, [checkout, provider]);
|
|
1653
|
-
|
|
1654
|
-
|
|
1597
|
+
reactExports.useEffect(() => {
|
|
1598
|
+
swapDispatch({
|
|
1599
|
+
payload: {
|
|
1600
|
+
type: SwapActions.SET_AUTO_PROCEED,
|
|
1601
|
+
autoProceed: autoProceed ?? false,
|
|
1602
|
+
direction: direction ?? SwapDirection$1.FROM,
|
|
1603
|
+
},
|
|
1604
|
+
});
|
|
1605
|
+
}, [autoProceed, direction]);
|
|
1606
|
+
const cancelAutoProceed = reactExports.useCallback(() => {
|
|
1607
|
+
if (autoProceed) {
|
|
1608
|
+
swapDispatch({
|
|
1609
|
+
payload: {
|
|
1610
|
+
type: SwapActions.SET_AUTO_PROCEED,
|
|
1611
|
+
autoProceed: false,
|
|
1612
|
+
direction: SwapDirection$1.FROM,
|
|
1613
|
+
},
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
}, [autoProceed, swapDispatch]);
|
|
1617
|
+
const fromAmount = direction === SwapDirection$1.FROM || direction == null ? amount : undefined;
|
|
1618
|
+
const toAmount = direction === SwapDirection$1.TO ? amount : undefined;
|
|
1619
|
+
return (jsx(ViewContext.Provider, { value: viewReducerValues, children: jsx(SwapContext.Provider, { value: swapReducerValues, children: jsxs(CryptoFiatProvider, { environment: environment, children: [viewState.view.type === SharedViews.LOADING_VIEW && (jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') })), viewState.view.type === SwapWidgetViews.SWAP && (jsx(SwapCoins, { theme: theme, cancelAutoProceed: cancelAutoProceed, fromAmount: fromAmount, toAmount: toAmount, fromTokenAddress: viewState.view.data?.fromTokenAddress ?? fromTokenAddress, toTokenAddress: viewState.view.data?.toTokenAddress ?? toTokenAddress })), viewState.view.type === SwapWidgetViews.IN_PROGRESS && (jsx(SwapInProgress, { transactionResponse: viewState.view.data.transactionResponse, swapForm: viewState.view.data.swapForm })), viewState.view.type === SwapWidgetViews.APPROVE_ERC20 && (jsx(ApproveERC20Onboarding, { data: viewState.view.data })), viewState.view.type === SwapWidgetViews.SUCCESS && (jsx(StatusView, { statusText: t('views.SWAP.success.text'), actionText: t('views.SWAP.success.actionText'), onRenderEvent: () => {
|
|
1655
1620
|
page({
|
|
1656
1621
|
userJourney: UserJourney.SWAP,
|
|
1657
1622
|
screen: 'SwapSuccess',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ar as BigNumber, bF as Logger, cH as version$1, cI as hexZeroPad, cJ as isBigNumberish, bQ as arrayify, cK as isBytes, r as reactExports, z as Environment, bz as axios, j as jsx, n as jsxs, M as MenuItem, a as Box, l as useTranslation, V as ViewContext, E as EventTargetContext, t as useAnalytics, c8 as GasEstimateType, Y as HeaderNavigation, a6 as Heading, o as Body, a2 as SimpleLayout, I as IMTBLWidgetEvents, p as ViewActions, F as orchestrationEvents } from './index-B98fdYSj.js';
|
|
2
2
|
|
|
3
3
|
const logger$1 = new Logger(version$1);
|
|
4
4
|
const _constructorGuard = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as ButtCon, _ as _objectWithoutProperties, u as useTheme, g as getStartingSize, D as DEFAULT_BUTTON_SIZE, m as merge, r as reactExports, f as flattenChildren, j as jsx, i as isChildSubcomponent, S as SmartClone, a as Box, b as getResponsiveSx, c as BUTTON_SIZES, s as setDefaultSxBackgroundColor, C as ClassNames, d as Button, e as ButtonIcon, h as ButtonLogo, k as _defineProperty, T as TokenFilterTypes, l as useTranslation, V as ViewContext, n as jsxs, o as Body, p as ViewActions, q as ConnectLoaderContext, t as useAnalytics, v as formatZeroAmount, E as EventTargetContext, w as isPassportProvider, x as getL2ChainId, y as getL1ChainId, z as Environment, M as MenuItem, A as tokenValueFormat, U as UserJourney, F as orchestrationEvents, I as IMTBLWidgetEvents, Z as ZERO_BALANCE_STRING, G as isNativeToken, H as sendNetworkSwitchEvent, J as CheckoutErrorType, K as SharedViews, N as NetworkFilterTypes, L as sortNetworksCompareFn, O as FramedImage, P as getChainImage, Q as DEFAULT_BALANCE_RETRY_POLICY, R as sortTokensByAmount, W as getTokenImageByAddress, X as calculateCryptoToFiat, Y as HeaderNavigation, $ as ButtonNavigationStyles, a0 as sendWalletWidgetCloseEvent, a1 as FooterLogo, a2 as SimpleLayout, a3 as WalletProviderName, a4 as getWalletProviderNameByProvider, a5 as abbreviateWalletAddress, a6 as Heading, a7 as Drawer, a8 as useWalletConnect, a9 as sendDisconnectWalletEvent, aa as isWalletConnectProvider, ab as heroBackGroundStyles, ac as heroImageStyles, ad as heroImageBottomAlign, ae as SimpleTextBody, af as FAQS_LINK, ag as Link, ah as viewReducer, ai as initialViewState, aj as LoadingView, ak as ErrorView } from './index-
|
|
2
|
-
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider, T as TopUpView } from './TopUpView-
|
|
3
|
-
import { T as TokenImage, r as retry, u as useInterval } from './retry-
|
|
1
|
+
import { B as ButtCon, _ as _objectWithoutProperties, u as useTheme, g as getStartingSize, D as DEFAULT_BUTTON_SIZE, m as merge, r as reactExports, f as flattenChildren, j as jsx, i as isChildSubcomponent, S as SmartClone, a as Box, b as getResponsiveSx, c as BUTTON_SIZES, s as setDefaultSxBackgroundColor, C as ClassNames, d as Button, e as ButtonIcon, h as ButtonLogo, k as _defineProperty, T as TokenFilterTypes, l as useTranslation, V as ViewContext, n as jsxs, o as Body, p as ViewActions, q as ConnectLoaderContext, t as useAnalytics, v as formatZeroAmount, E as EventTargetContext, w as isPassportProvider, x as getL2ChainId, y as getL1ChainId, z as Environment, M as MenuItem, A as tokenValueFormat, U as UserJourney, F as orchestrationEvents, I as IMTBLWidgetEvents, Z as ZERO_BALANCE_STRING, G as isNativeToken, H as sendNetworkSwitchEvent, J as CheckoutErrorType, K as SharedViews, N as NetworkFilterTypes, L as sortNetworksCompareFn, O as FramedImage, P as getChainImage, Q as DEFAULT_BALANCE_RETRY_POLICY, R as sortTokensByAmount, W as getTokenImageByAddress, X as calculateCryptoToFiat, Y as HeaderNavigation, $ as ButtonNavigationStyles, a0 as sendWalletWidgetCloseEvent, a1 as FooterLogo, a2 as SimpleLayout, a3 as WalletProviderName, a4 as getWalletProviderNameByProvider, a5 as abbreviateWalletAddress, a6 as Heading, a7 as Drawer, a8 as useWalletConnect, a9 as sendDisconnectWalletEvent, aa as isWalletConnectProvider, ab as heroBackGroundStyles, ac as heroImageStyles, ad as heroImageBottomAlign, ae as SimpleTextBody, af as FAQS_LINK, ag as Link, ah as viewReducer, ai as initialViewState, aj as LoadingView, ak as ErrorView } from './index-B98fdYSj.js';
|
|
2
|
+
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider, T as TopUpView } from './TopUpView-CCWR_Ywt.js';
|
|
3
|
+
import { T as TokenImage, r as retry, u as useInterval } from './retry-B5JRrQBT.js';
|
|
4
4
|
|
|
5
5
|
var horizontalMenuSxProps = {
|
|
6
6
|
justifyContent: "stretch",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TokenImage, r as retry } from './retry-
|
|
1
|
+
import { co as hFlex, j as jsx, aG as motion, _ as _objectWithoutProperties, u as useTheme, r as reactExports, cp as _slicedToArray, cq as useGetSubcomponentChild, m as merge, n as jsxs, cr as BaseClickable, B as ButtCon, S as SmartClone, cs as AnimatePresence, a as Box, aL as Stack, C as ClassNames, k as _defineProperty, ct as getTertiaryButtonStyles, f as flattenChildren, i as isChildSubcomponent, aN as Divider, l as useTranslation, b6 as getRemoteImage, z as Environment, c4 as getChainNameById, y as getL1ChainId, aa as isWalletConnectProvider, c6 as isMetaMaskProvider, bb as CloudImage, a6 as Heading, o as Body, d as Button, a1 as FooterLogo, a7 as Drawer, M as MenuItem, cu as Select, cv as FormControlWrapper, b5 as WidgetTheme, cw as TextInput, cx as PriceDisplay, aB as Fragment, A as tokenValueFormat, v as formatZeroAmount, bS as ShimmerBox, cy as DuoCon, ab as heroBackGroundStyles, ac as heroImageStyles, ad as heroImageBottomAlign, bf as NATIVE, W as getTokenImageByAddress, G as isNativeToken, Q as DEFAULT_BALANCE_RETRY_POLICY } from './index-B98fdYSj.js';
|
|
2
|
+
import { T as TokenImage, r as retry } from './retry-B5JRrQBT.js';
|
|
3
3
|
|
|
4
4
|
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|