@mintmoney/react 0.2.0-alpha.1 → 0.2.0-alpha.3
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/css/styles.css +12 -1
- package/dist/docs/customisation.md +8 -0
- package/dist/esm/api/errors.js +89 -0
- package/dist/esm/api/errors.js.map +1 -0
- package/dist/esm/api/generated.js +825 -65
- package/dist/esm/api/generated.js.map +1 -1
- package/dist/esm/api/payments.js +26 -2
- package/dist/esm/api/payments.js.map +1 -1
- package/dist/esm/api/tokens.js +34 -0
- package/dist/esm/api/tokens.js.map +1 -0
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/checkout/claimable-funds.js +20 -10
- package/dist/esm/checkout/claimable-funds.js.map +1 -1
- package/dist/esm/checkout/creation-error-modal.js +2 -2
- package/dist/esm/checkout/creation-error-modal.js.map +1 -1
- package/dist/esm/checkout/index.js +48 -8
- package/dist/esm/checkout/index.js.map +1 -1
- package/dist/esm/checkout/modal.js +78 -78
- package/dist/esm/checkout/modal.js.map +1 -1
- package/dist/esm/checkout/payment-status.js +68 -28
- package/dist/esm/checkout/payment-status.js.map +1 -1
- package/dist/esm/checkout/provider-status.js +9 -0
- package/dist/esm/checkout/provider-status.js.map +1 -0
- package/dist/esm/checkout/providers/checkout-wallet.js +315 -0
- package/dist/esm/checkout/providers/checkout-wallet.js.map +1 -0
- package/dist/esm/checkout/providers/wagmi-config.js +55 -49
- package/dist/esm/checkout/providers/wagmi-config.js.map +1 -1
- package/dist/esm/checkout/refund-notice.js +16 -0
- package/dist/esm/checkout/refund-notice.js.map +1 -0
- package/dist/esm/checkout/resume-state.js +151 -13
- package/dist/esm/checkout/resume-state.js.map +1 -1
- package/dist/esm/checkout/surplus-refund.js +12 -0
- package/dist/esm/checkout/surplus-refund.js.map +1 -1
- package/dist/esm/checkout/views/amount-header.js +1 -1
- package/dist/esm/checkout/views/amount-header.js.map +1 -1
- package/dist/esm/checkout/views/claimable-funds.js +22 -13
- package/dist/esm/checkout/views/claimable-funds.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/direct-details.js +226 -887
- package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js +235 -0
- package/dist/esm/checkout/views/crypto-intent/manual-instruction-card.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js +2 -26
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-refresh.js +19 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refresh.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js +151 -23
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js +295 -0
- package/dist/esm/checkout/views/crypto-intent/manual-route-picker.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-sources.js +155 -0
- package/dist/esm/checkout/views/crypto-intent/manual-sources.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js +84 -0
- package/dist/esm/checkout/views/crypto-intent/manual-transfer-instructions.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/methods.js +22 -123
- package/dist/esm/checkout/views/crypto-intent/methods.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/payment-route-error.js +10 -0
- package/dist/esm/checkout/views/crypto-intent/payment-route-error.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/processing.js +167 -25
- package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/success.js +74 -46
- package/dist/esm/checkout/views/crypto-intent/success.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/test-payment.js +11 -1
- package/dist/esm/checkout/views/crypto-intent/test-payment.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js +14 -24
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js +61 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-discovery.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js +136 -1169
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js +506 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.styles.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js +7 -164
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js.map +1 -1
- package/dist/esm/checkout/views/failed.js +62 -26
- package/dist/esm/checkout/views/failed.js.map +1 -1
- package/dist/esm/checkout/views/funding-timeline.js +255 -0
- package/dist/esm/checkout/views/funding-timeline.js.map +1 -0
- package/dist/esm/checkout/views/initial.js +25 -41
- package/dist/esm/checkout/views/initial.js.map +1 -1
- package/dist/esm/checkout/views/method-select.js +6 -4
- package/dist/esm/checkout/views/method-select.js.map +1 -1
- package/dist/esm/checkout/views/payment-follower.js +105 -0
- package/dist/esm/checkout/views/payment-follower.js.map +1 -0
- package/dist/esm/checkout/views/restart.js +11 -2
- package/dist/esm/checkout/views/restart.js.map +1 -1
- package/dist/esm/components/buttons/index.js +3 -2
- package/dist/esm/components/buttons/index.js.map +1 -1
- package/dist/esm/components/icons/search.js +5 -0
- package/dist/esm/components/icons/search.js.map +1 -0
- package/dist/esm/components/loading/index.js +2 -2
- package/dist/esm/components/loading/index.js.map +1 -1
- package/dist/esm/components/modals/modal-with-views.js +6 -12
- package/dist/esm/components/modals/modal-with-views.js.map +1 -1
- package/dist/esm/components/modals/modal.js +3 -3
- package/dist/esm/components/modals/modal.js.map +1 -1
- package/dist/esm/components/modals/transition-view.js +16 -0
- package/dist/esm/components/modals/transition-view.js.map +1 -0
- package/dist/esm/components/modals/use-modal-with-views.js +17 -19
- package/dist/esm/components/modals/use-modal-with-views.js.map +1 -1
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js +21 -2
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js.map +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/integrations/bitcoin-metamask.js +87 -0
- package/dist/esm/integrations/bitcoin-metamask.js.map +1 -0
- package/dist/esm/integrations/bitcoin-network.js +59 -0
- package/dist/esm/integrations/bitcoin-network.js.map +1 -0
- package/dist/esm/integrations/bitcoin-psbt.js +4 -0
- package/dist/esm/integrations/bitcoin-psbt.js.map +1 -0
- package/dist/esm/integrations/bitcoin-source.js +12 -0
- package/dist/esm/integrations/bitcoin-source.js.map +1 -0
- package/dist/esm/integrations/bitcoin-wallet.js +225 -0
- package/dist/esm/integrations/bitcoin-wallet.js.map +1 -0
- package/dist/esm/integrations/evm-chain.js +18 -0
- package/dist/esm/integrations/evm-chain.js.map +1 -1
- package/dist/esm/integrations/guarded-wallet-client.js +19 -0
- package/dist/esm/integrations/guarded-wallet-client.js.map +1 -0
- package/dist/esm/integrations/lifi.js +85 -38
- package/dist/esm/integrations/lifi.js.map +1 -1
- package/dist/esm/refund/index.js +217 -226
- package/dist/esm/refund/index.js.map +1 -1
- package/dist/esm/state/checkout/bitcoin-payment.js +253 -0
- package/dist/esm/state/checkout/bitcoin-payment.js.map +1 -0
- package/dist/esm/state/checkout/checkout-state.js +54 -0
- package/dist/esm/state/checkout/checkout-state.js.map +1 -0
- package/dist/esm/state/checkout/funding.js +5 -0
- package/dist/esm/state/checkout/funding.js.map +1 -0
- package/dist/esm/state/checkout/issuance-conflicts.js +29 -0
- package/dist/esm/state/checkout/issuance-conflicts.js.map +1 -0
- package/dist/esm/state/checkout/manual-route.js +10 -0
- package/dist/esm/state/checkout/manual-route.js.map +1 -0
- package/dist/esm/state/checkout/payment-attempt.js +50 -20
- package/dist/esm/state/checkout/payment-attempt.js.map +1 -1
- package/dist/esm/state/checkout/payment-lifecycle.js +9 -15
- package/dist/esm/state/checkout/payment-lifecycle.js.map +1 -1
- package/dist/esm/state/checkout/payment-observer.js +147 -0
- package/dist/esm/state/checkout/payment-observer.js.map +1 -0
- package/dist/esm/state/checkout/payment-phase.js +131 -0
- package/dist/esm/state/checkout/payment-phase.js.map +1 -0
- package/dist/esm/state/checkout/quote-countdown.js +26 -0
- package/dist/esm/state/checkout/quote-countdown.js.map +1 -0
- package/dist/esm/state/checkout/quote-lifecycle.js +378 -0
- package/dist/esm/state/checkout/quote-lifecycle.js.map +1 -0
- package/dist/esm/state/checkout/route-estimate.js +77 -0
- package/dist/esm/state/checkout/route-estimate.js.map +1 -0
- package/dist/esm/state/checkout/store.js +350 -708
- package/dist/esm/state/checkout/store.js.map +1 -1
- package/dist/esm/state/checkout/wallet-payment-options.js +0 -32
- package/dist/esm/state/checkout/wallet-payment-options.js.map +1 -1
- package/dist/esm/state/checkout/wallet-payment.js +249 -0
- package/dist/esm/state/checkout/wallet-payment.js.map +1 -0
- package/dist/esm/utils/string.js +2 -0
- package/dist/esm/utils/string.js.map +1 -1
- package/dist/esm/utils/token-amount.js +88 -0
- package/dist/esm/utils/token-amount.js.map +1 -0
- package/dist/esm/utils/wallet-errors.js +21 -4
- package/dist/esm/utils/wallet-errors.js.map +1 -1
- package/dist/types/api/errors.d.ts +37 -0
- package/dist/types/api/errors.d.ts.map +1 -0
- package/dist/types/api/generated.d.ts +4570 -695
- package/dist/types/api/generated.d.ts.map +1 -1
- package/dist/types/api/payments.d.ts +28 -1
- package/dist/types/api/payments.d.ts.map +1 -1
- package/dist/types/api/tokens.d.ts +6 -0
- package/dist/types/api/tokens.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +28 -2
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/checkout/claimable-funds.d.ts +15 -2
- package/dist/types/checkout/claimable-funds.d.ts.map +1 -1
- package/dist/types/checkout/creation-error-modal.d.ts +2 -1
- package/dist/types/checkout/creation-error-modal.d.ts.map +1 -1
- package/dist/types/checkout/index.d.ts +21 -1
- package/dist/types/checkout/index.d.ts.map +1 -1
- package/dist/types/checkout/modal.d.ts +4 -1
- package/dist/types/checkout/modal.d.ts.map +1 -1
- package/dist/types/checkout/payment-status.d.ts +10 -2
- package/dist/types/checkout/payment-status.d.ts.map +1 -1
- package/dist/types/checkout/provider-status.d.ts +11 -0
- package/dist/types/checkout/provider-status.d.ts.map +1 -0
- package/dist/types/checkout/providers/checkout-wallet.d.ts +23 -0
- package/dist/types/checkout/providers/checkout-wallet.d.ts.map +1 -0
- package/dist/types/checkout/providers/wagmi-config.d.ts +8 -2
- package/dist/types/checkout/providers/wagmi-config.d.ts.map +1 -1
- package/dist/types/checkout/refund-notice.d.ts +7 -0
- package/dist/types/checkout/refund-notice.d.ts.map +1 -0
- package/dist/types/checkout/resume-state.d.ts +41 -4
- package/dist/types/checkout/resume-state.d.ts.map +1 -1
- package/dist/types/checkout/surplus-refund.d.ts +8 -0
- package/dist/types/checkout/surplus-refund.d.ts.map +1 -1
- package/dist/types/checkout/views/amount-header.d.ts.map +1 -1
- package/dist/types/checkout/views/claimable-funds.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts +3 -13
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts +10 -0
- package/dist/types/checkout/views/crypto-intent/manual-instruction-card.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts +4 -11
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts +4 -0
- package/dist/types/checkout/views/crypto-intent/manual-refresh.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts +14 -10
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts +18 -0
- package/dist/types/checkout/views/crypto-intent/manual-route-picker.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts +33 -0
- package/dist/types/checkout/views/crypto-intent/manual-sources.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts +18 -0
- package/dist/types/checkout/views/crypto-intent/manual-transfer-instructions.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/methods.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts +2 -0
- package/dist/types/checkout/views/crypto-intent/payment-route-error.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/processing.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts +2 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/test-payment.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts +8 -8
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts +17 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-discovery.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts +2 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts +61 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.styles.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts +1 -2
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts.map +1 -1
- package/dist/types/checkout/views/failed.d.ts +6 -0
- package/dist/types/checkout/views/failed.d.ts.map +1 -1
- package/dist/types/checkout/views/funding-timeline.d.ts +49 -0
- package/dist/types/checkout/views/funding-timeline.d.ts.map +1 -0
- package/dist/types/checkout/views/initial.d.ts +2 -4
- package/dist/types/checkout/views/initial.d.ts.map +1 -1
- package/dist/types/checkout/views/method-select.d.ts +2 -1
- package/dist/types/checkout/views/method-select.d.ts.map +1 -1
- package/dist/types/checkout/views/payment-follower.d.ts +31 -0
- package/dist/types/checkout/views/payment-follower.d.ts.map +1 -0
- package/dist/types/checkout/views/restart.d.ts +1 -1
- package/dist/types/checkout/views/restart.d.ts.map +1 -1
- package/dist/types/components/buttons/index.d.ts.map +1 -1
- package/dist/types/components/icons/search.d.ts +2 -0
- package/dist/types/components/icons/search.d.ts.map +1 -0
- package/dist/types/components/loading/index.d.ts +6 -1
- package/dist/types/components/loading/index.d.ts.map +1 -1
- package/dist/types/components/modals/modal-with-views.d.ts +2 -0
- package/dist/types/components/modals/modal-with-views.d.ts.map +1 -1
- package/dist/types/components/modals/modal.d.ts +2 -1
- package/dist/types/components/modals/modal.d.ts.map +1 -1
- package/dist/types/components/modals/transition-view.d.ts +2 -0
- package/dist/types/components/modals/transition-view.d.ts.map +1 -0
- package/dist/types/components/modals/use-modal-with-views.d.ts +2 -1
- package/dist/types/components/modals/use-modal-with-views.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/domain.d.ts +1 -1
- package/dist/types/components/wallet-selector/domain.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts +2 -2
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/integrations/bitcoin-metamask.d.ts +11 -0
- package/dist/types/integrations/bitcoin-metamask.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-network.d.ts +13 -0
- package/dist/types/integrations/bitcoin-network.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-psbt.d.ts +5 -0
- package/dist/types/integrations/bitcoin-psbt.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-source.d.ts +12 -0
- package/dist/types/integrations/bitcoin-source.d.ts.map +1 -0
- package/dist/types/integrations/bitcoin-wallet.d.ts +63 -0
- package/dist/types/integrations/bitcoin-wallet.d.ts.map +1 -0
- package/dist/types/integrations/evm-chain.d.ts +5 -0
- package/dist/types/integrations/evm-chain.d.ts.map +1 -1
- package/dist/types/integrations/guarded-wallet-client.d.ts +4 -0
- package/dist/types/integrations/guarded-wallet-client.d.ts.map +1 -0
- package/dist/types/integrations/lifi.d.ts +22 -0
- package/dist/types/integrations/lifi.d.ts.map +1 -1
- package/dist/types/refund/index.d.ts +1 -1
- package/dist/types/refund/index.d.ts.map +1 -1
- package/dist/types/state/checkout/bitcoin-payment.d.ts +28 -0
- package/dist/types/state/checkout/bitcoin-payment.d.ts.map +1 -0
- package/dist/types/state/checkout/checkout-state.d.ts +102 -0
- package/dist/types/state/checkout/checkout-state.d.ts.map +1 -0
- package/dist/types/state/checkout/funding.d.ts +6 -0
- package/dist/types/state/checkout/funding.d.ts.map +1 -0
- package/dist/types/state/checkout/issuance-conflicts.d.ts +22 -0
- package/dist/types/state/checkout/issuance-conflicts.d.ts.map +1 -0
- package/dist/types/state/checkout/manual-route.d.ts +13 -0
- package/dist/types/state/checkout/manual-route.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-attempt.d.ts +20 -1
- package/dist/types/state/checkout/payment-attempt.d.ts.map +1 -1
- package/dist/types/state/checkout/payment-lifecycle.d.ts +6 -8
- package/dist/types/state/checkout/payment-lifecycle.d.ts.map +1 -1
- package/dist/types/state/checkout/payment-observer.d.ts +41 -0
- package/dist/types/state/checkout/payment-observer.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-phase.d.ts +116 -0
- package/dist/types/state/checkout/payment-phase.d.ts.map +1 -0
- package/dist/types/state/checkout/quote-countdown.d.ts +15 -0
- package/dist/types/state/checkout/quote-countdown.d.ts.map +1 -0
- package/dist/types/state/checkout/quote-lifecycle.d.ts +39 -0
- package/dist/types/state/checkout/quote-lifecycle.d.ts.map +1 -0
- package/dist/types/state/checkout/route-estimate.d.ts +38 -0
- package/dist/types/state/checkout/route-estimate.d.ts.map +1 -0
- package/dist/types/state/checkout/store.d.ts +38 -90
- package/dist/types/state/checkout/store.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-payment-options.d.ts +0 -16
- package/dist/types/state/checkout/wallet-payment-options.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-payment.d.ts +24 -0
- package/dist/types/state/checkout/wallet-payment.d.ts.map +1 -0
- package/dist/types/utils/string.d.ts +2 -0
- package/dist/types/utils/string.d.ts.map +1 -1
- package/dist/types/utils/token-amount.d.ts +18 -0
- package/dist/types/utils/token-amount.d.ts.map +1 -0
- package/dist/types/utils/wallet-errors.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/esm/checkout/providers/wallet-connect-resume.js +0 -129
- package/dist/esm/checkout/providers/wallet-connect-resume.js.map +0 -1
- package/dist/esm/refund/confirmation.js +0 -30
- package/dist/esm/refund/confirmation.js.map +0 -1
- package/dist/types/checkout/providers/wallet-connect-resume.d.ts +0 -9
- package/dist/types/checkout/providers/wallet-connect-resume.d.ts.map +0 -1
- package/dist/types/refund/confirmation.d.ts +0 -14
- package/dist/types/refund/confirmation.d.ts.map +0 -1
|
@@ -1,1207 +1,174 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { disconnect } from "@wagmi/core";
|
|
4
|
-
import { useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
5
|
-
import { keyframes, styled } from "styled-components";
|
|
6
|
-
import { useAccount, useConfig } from "wagmi";
|
|
7
|
-
import { confirmPayment } from "../../../api/payments.js";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
8
3
|
import { EditIcon, LogOutIcon } from "../../../components/icons/index.js";
|
|
9
4
|
import { QuoteExpiryCountdown, StyledButton, Text, useModalWithView, } from "../../../components/index.js";
|
|
10
|
-
import { WalletContext } from "../../../components/wallet-selector/provider.js";
|
|
11
|
-
import { useWalletActions } from "../../../components/wallet-selector/store.js";
|
|
12
|
-
import { WagmiWalletInterface } from "../../../components/wallet-selector/wallets/wagmi/index.js";
|
|
13
5
|
import { useMintMoneyConfig } from "../../../context.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
6
|
+
import { BITCOIN_CHAIN } from "../../../integrations/bitcoin-source.js";
|
|
7
|
+
import { getRouteQuote } from "../../../state/checkout/checkout-state.js";
|
|
8
|
+
import { hasReceivedFunds } from "../../../state/checkout/funding.js";
|
|
9
|
+
import { QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO, useQuoteCountdown, } from "../../../state/checkout/quote-countdown.js";
|
|
10
|
+
import { clearQuoteRefresh, getFrozenRefundRecipient, loadWalletPaymentQuote, prepareWalletQuoteReplacement, resetWalletPaymentState, useCheckoutStore, } from "../../../state/checkout/store.js";
|
|
11
|
+
import { loadWalletPaymentOptions, payWithWallet, retryWalletPayment, } from "../../../state/checkout/wallet-payment.js";
|
|
17
12
|
import { formatAddress } from "../../../utils/string.js";
|
|
18
|
-
import {
|
|
13
|
+
import { formatBaseUnits } from "../../../utils/token-amount.js";
|
|
19
14
|
import { ModalViewContainer } from "../../container.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
15
|
+
import { useCheckoutWallet, } from "../../providers/checkout-wallet.js";
|
|
16
|
+
import { getRefundNotice } from "../../refund-notice.js";
|
|
17
|
+
import { FundingProgress, settlementTokenSymbol } from "../funding-timeline.js";
|
|
18
|
+
import { ManualInstructionCard } from "./manual-instruction-card.js";
|
|
19
|
+
import { PaymentRouteError } from "./payment-route-error.js";
|
|
22
20
|
import { resolveWalletPaymentConfirmationAmount } from "./wallet-payment-confirmation-amount.js";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
transform: translateY(-6px);
|
|
28
|
-
}
|
|
29
|
-
to {
|
|
30
|
-
opacity: 1;
|
|
31
|
-
transform: translateY(0);
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
const ContextStrip = styled.div `
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
gap: 8px;
|
|
38
|
-
`;
|
|
39
|
-
const ContextPill = styled.div `
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
padding: 12px 14px;
|
|
42
|
-
border-radius: 14px;
|
|
43
|
-
background: ${({ $accent }) => ($accent ? "#f8fffc" : "#ffffff")};
|
|
44
|
-
border: 1px solid ${({ $accent }) => ($accent ? "#bbf7d0" : "#eef2f6")};
|
|
45
|
-
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
|
46
|
-
animation: ${pillSlideIn} 200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
47
|
-
`;
|
|
48
|
-
const ContextPillToggle = styled.button `
|
|
49
|
-
width: 100%;
|
|
50
|
-
border: 0;
|
|
51
|
-
background: transparent;
|
|
52
|
-
color: inherit;
|
|
53
|
-
padding: 0;
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
gap: 12px;
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
text-align: left;
|
|
59
|
-
|
|
60
|
-
&:focus-visible {
|
|
61
|
-
outline: 2px solid #a7f3d0;
|
|
62
|
-
outline-offset: 4px;
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
const PillIconWrap = styled.div `
|
|
66
|
-
position: relative;
|
|
67
|
-
width: 40px;
|
|
68
|
-
height: 40px;
|
|
69
|
-
flex-shrink: 0;
|
|
70
|
-
`;
|
|
71
|
-
const PillTokenIcon = styled.div `
|
|
72
|
-
width: 100%;
|
|
73
|
-
height: 100%;
|
|
74
|
-
border-radius: 999px;
|
|
75
|
-
display: inline-flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
font-size: 11px;
|
|
79
|
-
font-weight: 700;
|
|
80
|
-
color: #1d4ed8;
|
|
81
|
-
background: linear-gradient(135deg, #dbeafe, #bfdbfe);
|
|
82
|
-
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
83
|
-
background-size: cover;
|
|
84
|
-
background-position: center;
|
|
85
|
-
`;
|
|
86
|
-
const PillChainBadge = styled.div `
|
|
87
|
-
position: absolute;
|
|
88
|
-
right: -2px;
|
|
89
|
-
bottom: -2px;
|
|
90
|
-
width: 14px;
|
|
91
|
-
height: 14px;
|
|
92
|
-
border-radius: 999px;
|
|
93
|
-
border: 1.5px solid #ffffff;
|
|
94
|
-
background: #ffffff;
|
|
95
|
-
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
96
|
-
background-size: 85%;
|
|
97
|
-
background-position: center;
|
|
98
|
-
background-repeat: no-repeat;
|
|
99
|
-
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
|
|
100
|
-
`;
|
|
101
|
-
const WalletDot = styled.div `
|
|
102
|
-
width: 22px;
|
|
103
|
-
height: 22px;
|
|
104
|
-
border-radius: 999px;
|
|
105
|
-
flex-shrink: 0;
|
|
106
|
-
background:
|
|
107
|
-
${({ $iconUrl }) => ($iconUrl ? `url(${$iconUrl})` : "none")},
|
|
108
|
-
linear-gradient(135deg, #22c55e, #60a5fa);
|
|
109
|
-
background-size: cover;
|
|
110
|
-
background-position: center;
|
|
111
|
-
`;
|
|
112
|
-
const WalletSwitchLink = styled.button `
|
|
113
|
-
flex-shrink: 0;
|
|
114
|
-
border: none;
|
|
115
|
-
background: transparent;
|
|
116
|
-
color: #94a3b8;
|
|
117
|
-
display: inline-flex;
|
|
118
|
-
align-items: center;
|
|
119
|
-
justify-content: center;
|
|
120
|
-
width: 24px;
|
|
121
|
-
height: 24px;
|
|
122
|
-
margin: -2px -2px -2px -6px;
|
|
123
|
-
padding: 0;
|
|
124
|
-
cursor: pointer;
|
|
125
|
-
border-radius: 999px;
|
|
126
|
-
transition:
|
|
127
|
-
color 120ms ease,
|
|
128
|
-
background-color 120ms ease;
|
|
129
|
-
|
|
130
|
-
&:hover {
|
|
131
|
-
color: #0f172a;
|
|
132
|
-
background: #f1f5f9;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&:focus-visible {
|
|
136
|
-
outline: 2px solid #a7f3d0;
|
|
137
|
-
outline-offset: 2px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:disabled {
|
|
141
|
-
opacity: 0.5;
|
|
142
|
-
cursor: not-allowed;
|
|
143
|
-
}
|
|
144
|
-
`;
|
|
145
|
-
const WalletDisconnectButton = styled.button `
|
|
146
|
-
flex-shrink: 0;
|
|
147
|
-
border: none;
|
|
148
|
-
background: transparent;
|
|
149
|
-
color: #dc2626;
|
|
150
|
-
display: inline-flex;
|
|
151
|
-
align-items: center;
|
|
152
|
-
justify-content: center;
|
|
153
|
-
width: 24px;
|
|
154
|
-
height: 24px;
|
|
155
|
-
margin: -2px -2px -2px -4px;
|
|
156
|
-
padding: 0;
|
|
157
|
-
border-radius: 999px;
|
|
158
|
-
cursor: pointer;
|
|
159
|
-
transition:
|
|
160
|
-
background-color 120ms ease,
|
|
161
|
-
color 120ms ease;
|
|
162
|
-
|
|
163
|
-
&:hover {
|
|
164
|
-
background: #fee2e2;
|
|
165
|
-
color: #b91c1c;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
&:focus-visible {
|
|
169
|
-
outline: 2px solid #fecaca;
|
|
170
|
-
outline-offset: 2px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
&:disabled {
|
|
174
|
-
opacity: 0.5;
|
|
175
|
-
cursor: not-allowed;
|
|
176
|
-
}
|
|
177
|
-
`;
|
|
178
|
-
const WalletRowActions = styled.div `
|
|
179
|
-
display: inline-flex;
|
|
180
|
-
align-items: center;
|
|
181
|
-
gap: 6px;
|
|
182
|
-
flex-shrink: 0;
|
|
183
|
-
`;
|
|
184
|
-
const PillBody = styled.div `
|
|
185
|
-
display: flex;
|
|
186
|
-
flex-direction: column;
|
|
187
|
-
gap: 2px;
|
|
188
|
-
min-width: 0;
|
|
189
|
-
flex: 1;
|
|
190
|
-
`;
|
|
191
|
-
const PillEyebrow = styled.span `
|
|
192
|
-
font-size: 12px;
|
|
193
|
-
line-height: 1.2;
|
|
194
|
-
color: ${({ theme }) => theme.font.color.tertiary};
|
|
195
|
-
white-space: nowrap;
|
|
196
|
-
overflow: hidden;
|
|
197
|
-
text-overflow: ellipsis;
|
|
198
|
-
`;
|
|
199
|
-
const PillTitle = styled.span `
|
|
200
|
-
font-size: 14px;
|
|
201
|
-
font-weight: 600;
|
|
202
|
-
color: ${({ theme }) => theme.font.color.primary};
|
|
203
|
-
line-height: 1.3;
|
|
204
|
-
white-space: nowrap;
|
|
205
|
-
overflow: hidden;
|
|
206
|
-
text-overflow: ellipsis;
|
|
207
|
-
`;
|
|
208
|
-
const PillAction = styled.button `
|
|
209
|
-
flex-shrink: 0;
|
|
210
|
-
border: none;
|
|
211
|
-
background: transparent;
|
|
212
|
-
color: ${({ theme }) => theme.font.color.secondary};
|
|
213
|
-
font-size: 14px;
|
|
214
|
-
font-weight: 600;
|
|
215
|
-
padding: 6px 10px;
|
|
216
|
-
border-radius: 999px;
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
transition:
|
|
219
|
-
background-color 120ms ease,
|
|
220
|
-
color 120ms ease;
|
|
221
|
-
|
|
222
|
-
&:hover {
|
|
223
|
-
background: #f1f5f9;
|
|
224
|
-
color: #0f172a;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
&:focus-visible {
|
|
228
|
-
outline: 2px solid #a7f3d0;
|
|
229
|
-
outline-offset: 2px;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
&:disabled {
|
|
233
|
-
opacity: 0.5;
|
|
234
|
-
cursor: not-allowed;
|
|
235
|
-
}
|
|
236
|
-
`;
|
|
237
|
-
const PillCaret = styled.span `
|
|
238
|
-
width: 24px;
|
|
239
|
-
height: 24px;
|
|
240
|
-
border-radius: 999px;
|
|
241
|
-
background: #f1f3fb;
|
|
242
|
-
display: inline-flex;
|
|
243
|
-
align-items: center;
|
|
244
|
-
justify-content: center;
|
|
245
|
-
font-size: 13px;
|
|
246
|
-
line-height: 1;
|
|
247
|
-
color: #6b7280;
|
|
248
|
-
transform: rotate(${({ $expanded }) => ($expanded ? "180deg" : "0deg")});
|
|
249
|
-
transition:
|
|
250
|
-
transform 0.15s ease,
|
|
251
|
-
background 0.15s ease;
|
|
252
|
-
flex-shrink: 0;
|
|
253
|
-
`;
|
|
254
|
-
const PillDetails = styled.div `
|
|
255
|
-
border-top: 1px solid #edf1f5;
|
|
256
|
-
margin-top: 12px;
|
|
257
|
-
padding-top: 12px;
|
|
258
|
-
display: flex;
|
|
259
|
-
flex-direction: column;
|
|
260
|
-
`;
|
|
261
|
-
const PillDetailRow = styled.div `
|
|
262
|
-
display: flex;
|
|
263
|
-
align-items: center;
|
|
264
|
-
justify-content: space-between;
|
|
265
|
-
gap: 12px;
|
|
266
|
-
border-bottom: 1px solid #edf1f5;
|
|
267
|
-
padding: 9px 0;
|
|
268
|
-
|
|
269
|
-
&:last-child {
|
|
270
|
-
border-bottom: 0;
|
|
271
|
-
padding-bottom: 0;
|
|
272
|
-
}
|
|
273
|
-
`;
|
|
274
|
-
const PillDetailLabel = styled.span `
|
|
275
|
-
font-size: 13px;
|
|
276
|
-
line-height: 1.3;
|
|
277
|
-
color: #475569;
|
|
278
|
-
`;
|
|
279
|
-
const PillDetailValue = styled.span `
|
|
280
|
-
display: inline-flex;
|
|
281
|
-
align-items: center;
|
|
282
|
-
justify-content: flex-end;
|
|
283
|
-
gap: 6px;
|
|
284
|
-
min-width: 0;
|
|
285
|
-
font-size: 13px;
|
|
286
|
-
line-height: 1.3;
|
|
287
|
-
font-weight: 600;
|
|
288
|
-
color: #0f172a;
|
|
289
|
-
text-align: right;
|
|
290
|
-
`;
|
|
291
|
-
const SectionLabel = styled.div `
|
|
292
|
-
font-size: 11px;
|
|
293
|
-
font-weight: 600;
|
|
294
|
-
letter-spacing: 0.06em;
|
|
295
|
-
text-transform: uppercase;
|
|
296
|
-
color: #94a3b8;
|
|
297
|
-
padding: 0 2px;
|
|
298
|
-
`;
|
|
299
|
-
const SectionRow = styled.div `
|
|
300
|
-
display: flex;
|
|
301
|
-
align-items: baseline;
|
|
302
|
-
justify-content: space-between;
|
|
303
|
-
gap: 12px;
|
|
304
|
-
padding: 0 2px;
|
|
305
|
-
`;
|
|
306
|
-
const ConnectedWalletRow = styled.div `
|
|
307
|
-
display: flex;
|
|
308
|
-
align-items: center;
|
|
309
|
-
justify-content: space-between;
|
|
310
|
-
gap: 12px;
|
|
311
|
-
padding: 2px 4px;
|
|
312
|
-
`;
|
|
313
|
-
const ConnectedWalletIdentity = styled.div `
|
|
314
|
-
display: inline-flex;
|
|
315
|
-
align-items: center;
|
|
316
|
-
gap: 10px;
|
|
317
|
-
min-width: 0;
|
|
318
|
-
font-size: 14px;
|
|
319
|
-
line-height: 1.4;
|
|
320
|
-
color: #64748b;
|
|
321
|
-
`;
|
|
322
|
-
const ConnectedWalletAddress = styled.span `
|
|
323
|
-
min-width: 0;
|
|
324
|
-
overflow: hidden;
|
|
325
|
-
text-overflow: ellipsis;
|
|
326
|
-
white-space: nowrap;
|
|
327
|
-
`;
|
|
328
|
-
const OptionsContainer = styled.div `
|
|
329
|
-
display: flex;
|
|
330
|
-
flex-direction: column;
|
|
331
|
-
flex: 1;
|
|
332
|
-
gap: 8px;
|
|
333
|
-
min-height: 0;
|
|
334
|
-
overflow-y: auto;
|
|
335
|
-
margin: -4px -4px -6px;
|
|
336
|
-
padding: 4px 4px 6px;
|
|
337
|
-
overscroll-behavior: contain;
|
|
338
|
-
scrollbar-width: none;
|
|
339
|
-
|
|
340
|
-
&::-webkit-scrollbar {
|
|
341
|
-
display: none;
|
|
342
|
-
}
|
|
343
|
-
`;
|
|
344
|
-
const OptionCard = styled.button `
|
|
345
|
-
border: 1px solid #eef2f6;
|
|
346
|
-
border-radius: 16px;
|
|
347
|
-
padding: 12px 14px;
|
|
348
|
-
background: #ffffff;
|
|
349
|
-
cursor: pointer;
|
|
350
|
-
width: 100%;
|
|
351
|
-
text-align: left;
|
|
352
|
-
display: flex;
|
|
353
|
-
align-items: center;
|
|
354
|
-
gap: 12px;
|
|
355
|
-
transition:
|
|
356
|
-
border-color 140ms ease,
|
|
357
|
-
box-shadow 140ms ease,
|
|
358
|
-
transform 140ms ease,
|
|
359
|
-
background-color 140ms ease;
|
|
360
|
-
|
|
361
|
-
&:hover {
|
|
362
|
-
border-color: #cdd9e3;
|
|
363
|
-
box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
|
|
364
|
-
transform: translateY(-1px);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
&:focus-visible {
|
|
368
|
-
outline: 2px solid #a7f3d0;
|
|
369
|
-
outline-offset: 2px;
|
|
370
|
-
}
|
|
371
|
-
`;
|
|
372
|
-
const OptionTokenIconWrap = styled.div `
|
|
373
|
-
position: relative;
|
|
374
|
-
width: 40px;
|
|
375
|
-
height: 40px;
|
|
376
|
-
flex-shrink: 0;
|
|
377
|
-
`;
|
|
378
|
-
const OptionTokenIcon = styled.div `
|
|
379
|
-
width: 100%;
|
|
380
|
-
height: 100%;
|
|
381
|
-
border-radius: 999px;
|
|
382
|
-
display: inline-flex;
|
|
383
|
-
align-items: center;
|
|
384
|
-
justify-content: center;
|
|
385
|
-
font-size: 12px;
|
|
386
|
-
font-weight: 700;
|
|
387
|
-
color: ${({ $token }) => ($token === "ETH" ? "#ffffff" : "#1d4ed8")};
|
|
388
|
-
background: ${({ $token }) => $token === "ETH"
|
|
389
|
-
? "linear-gradient(135deg, #64748b, #0f172a)"
|
|
390
|
-
: "linear-gradient(135deg, #dbeafe, #bfdbfe)"};
|
|
391
|
-
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
392
|
-
background-size: cover;
|
|
393
|
-
background-position: center;
|
|
394
|
-
overflow: hidden;
|
|
395
|
-
`;
|
|
396
|
-
const OptionChainBadge = styled.div `
|
|
397
|
-
position: absolute;
|
|
398
|
-
right: -2px;
|
|
399
|
-
bottom: -2px;
|
|
400
|
-
width: 18px;
|
|
401
|
-
height: 18px;
|
|
402
|
-
border-radius: 999px;
|
|
403
|
-
border: 1.5px solid #ffffff;
|
|
404
|
-
background: #ffffff;
|
|
405
|
-
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
406
|
-
background-size: 85%;
|
|
407
|
-
background-position: center;
|
|
408
|
-
background-repeat: no-repeat;
|
|
409
|
-
box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
|
|
410
|
-
overflow: hidden;
|
|
411
|
-
`;
|
|
412
|
-
const OptionIdentity = styled.div `
|
|
413
|
-
display: flex;
|
|
414
|
-
flex-direction: column;
|
|
415
|
-
gap: 2px;
|
|
416
|
-
min-width: 0;
|
|
417
|
-
flex: 1;
|
|
418
|
-
`;
|
|
419
|
-
const OptionBalance = styled.div `
|
|
420
|
-
display: flex;
|
|
421
|
-
flex-direction: column;
|
|
422
|
-
align-items: flex-end;
|
|
423
|
-
gap: 4px;
|
|
424
|
-
flex-shrink: 0;
|
|
425
|
-
`;
|
|
426
|
-
const FastBadge = styled.span `
|
|
427
|
-
display: inline-flex;
|
|
428
|
-
align-items: center;
|
|
429
|
-
border-radius: 999px;
|
|
430
|
-
gap: 4px;
|
|
431
|
-
background: #ecfdf5;
|
|
432
|
-
color: #047857;
|
|
433
|
-
font-size: 11px;
|
|
434
|
-
font-weight: 600;
|
|
435
|
-
line-height: 1;
|
|
436
|
-
padding: 4px 8px;
|
|
437
|
-
white-space: nowrap;
|
|
438
|
-
`;
|
|
439
|
-
const RoutedBadge = styled.span `
|
|
440
|
-
font-size: 11px;
|
|
441
|
-
font-weight: 500;
|
|
442
|
-
color: #94a3b8;
|
|
443
|
-
white-space: nowrap;
|
|
444
|
-
`;
|
|
445
|
-
const QuoteCard = styled.div `
|
|
446
|
-
background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
|
|
447
|
-
border: 1px solid #eef2f6;
|
|
448
|
-
border-radius: 18px;
|
|
449
|
-
padding: 16px 18px;
|
|
450
|
-
display: flex;
|
|
451
|
-
flex-direction: column;
|
|
452
|
-
gap: 10px;
|
|
453
|
-
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
|
|
454
|
-
`;
|
|
455
|
-
const QuoteRow = styled.div `
|
|
456
|
-
display: flex;
|
|
457
|
-
align-items: baseline;
|
|
458
|
-
justify-content: space-between;
|
|
459
|
-
gap: 16px;
|
|
460
|
-
`;
|
|
461
|
-
const QuoteHairline = styled.div `
|
|
462
|
-
height: 1px;
|
|
463
|
-
background: #eef2f6;
|
|
464
|
-
margin: 2px 0;
|
|
465
|
-
`;
|
|
466
|
-
const QuoteFootnote = styled.div `
|
|
467
|
-
display: flex;
|
|
468
|
-
align-items: center;
|
|
469
|
-
gap: 6px;
|
|
470
|
-
font-size: 12px;
|
|
471
|
-
color: #94a3b8;
|
|
472
|
-
|
|
473
|
-
&::before {
|
|
474
|
-
content: "";
|
|
475
|
-
display: inline-block;
|
|
476
|
-
width: 6px;
|
|
477
|
-
height: 6px;
|
|
478
|
-
border-radius: 999px;
|
|
479
|
-
background: #22c55e;
|
|
480
|
-
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
|
|
481
|
-
}
|
|
482
|
-
`;
|
|
483
|
-
const QuoteFootnoteWarn = styled(QuoteFootnote) `
|
|
484
|
-
color: #b45309;
|
|
485
|
-
|
|
486
|
-
&::before {
|
|
487
|
-
background: #f59e0b;
|
|
488
|
-
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
|
|
489
|
-
}
|
|
490
|
-
`;
|
|
491
|
-
const SkeletonContainer = styled.div `
|
|
492
|
-
display: flex;
|
|
493
|
-
flex-direction: column;
|
|
494
|
-
gap: 8px;
|
|
495
|
-
`;
|
|
496
|
-
const skeletonShimmer = keyframes `
|
|
497
|
-
0% { background-position: -120% 0; }
|
|
498
|
-
100% { background-position: 220% 0; }
|
|
499
|
-
`;
|
|
500
|
-
const SkeletonRow = styled.div `
|
|
501
|
-
height: 64px;
|
|
502
|
-
border-radius: 16px;
|
|
503
|
-
border: 1px solid #eef2f6;
|
|
504
|
-
background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 50%, #f8fafc 100%);
|
|
505
|
-
background-size: 220% 100%;
|
|
506
|
-
animation: ${skeletonShimmer} 1.4s ease-in-out infinite;
|
|
507
|
-
`;
|
|
508
|
-
const EmptyState = styled.div `
|
|
509
|
-
position: relative;
|
|
510
|
-
border-radius: 22px;
|
|
511
|
-
padding: 22px 20px;
|
|
512
|
-
background: #ffffff;
|
|
513
|
-
border: 1px solid #ecf1ee;
|
|
514
|
-
display: flex;
|
|
515
|
-
flex-direction: column;
|
|
516
|
-
align-items: center;
|
|
517
|
-
gap: 10px;
|
|
518
|
-
text-align: center;
|
|
519
|
-
box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
|
|
520
|
-
`;
|
|
521
|
-
const EmptyHeadline = styled.div `
|
|
522
|
-
display: flex;
|
|
523
|
-
flex-direction: column;
|
|
524
|
-
gap: 4px;
|
|
525
|
-
max-width: 300px;
|
|
526
|
-
`;
|
|
527
|
-
const FallbackTopActions = styled.div `
|
|
528
|
-
display: flex;
|
|
529
|
-
justify-content: flex-end;
|
|
530
|
-
min-height: 32px;
|
|
531
|
-
`;
|
|
532
|
-
const FallbackDisconnectButton = styled(WalletDisconnectButton) `
|
|
533
|
-
width: 32px;
|
|
534
|
-
height: 32px;
|
|
535
|
-
margin: 0;
|
|
536
|
-
border: 1px solid #fee2e2;
|
|
537
|
-
background: #ffffff;
|
|
538
|
-
`;
|
|
539
|
-
const ContentStage = styled.div `
|
|
540
|
-
display: flex;
|
|
541
|
-
flex-direction: column;
|
|
542
|
-
flex: 1;
|
|
543
|
-
gap: 14px;
|
|
544
|
-
min-height: 0;
|
|
545
|
-
|
|
546
|
-
@media (max-width: 768px) {
|
|
547
|
-
justify-content: ${({ $mobileCentered }) => $mobileCentered ? "center" : "flex-start"};
|
|
548
|
-
}
|
|
549
|
-
`;
|
|
550
|
-
const formatDisplayAmount = (amount, maximumFractionDigits = 4) => {
|
|
551
|
-
if (!amount)
|
|
552
|
-
return null;
|
|
553
|
-
const parsed = Number(amount);
|
|
554
|
-
if (!Number.isFinite(parsed))
|
|
555
|
-
return amount;
|
|
556
|
-
if (parsed >= 1000)
|
|
557
|
-
return parsed.toLocaleString(undefined, { maximumFractionDigits: 2 });
|
|
558
|
-
if (parsed >= 1) {
|
|
559
|
-
return parsed.toLocaleString(undefined, {
|
|
560
|
-
minimumFractionDigits: 2,
|
|
561
|
-
maximumFractionDigits: 2,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (parsed >= 0.01) {
|
|
565
|
-
return parsed.toLocaleString(undefined, {
|
|
566
|
-
minimumFractionDigits: 2,
|
|
567
|
-
maximumFractionDigits,
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
return parsed.toLocaleString(undefined, {
|
|
571
|
-
minimumFractionDigits: 4,
|
|
572
|
-
maximumFractionDigits,
|
|
573
|
-
});
|
|
574
|
-
};
|
|
575
|
-
const formatTokenBalance = (tokenName, amount) => {
|
|
576
|
-
const isEth = tokenName.toUpperCase() === "ETH";
|
|
577
|
-
const formatted = formatDisplayAmount(amount, isEth ? 8 : 4);
|
|
578
|
-
if (!formatted)
|
|
579
|
-
return null;
|
|
580
|
-
if (tokenName.toLowerCase().includes("usd"))
|
|
581
|
-
return `$${formatted}`;
|
|
582
|
-
if (isEth)
|
|
583
|
-
return `ETH ${formatted}`;
|
|
584
|
-
return formatted;
|
|
585
|
-
};
|
|
586
|
-
const formatMoneyAmount = (currency, amount) => {
|
|
587
|
-
try {
|
|
588
|
-
return new Intl.NumberFormat(undefined, {
|
|
589
|
-
style: "currency",
|
|
590
|
-
currency,
|
|
591
|
-
minimumFractionDigits: 2,
|
|
592
|
-
maximumFractionDigits: 2,
|
|
593
|
-
}).format(amount);
|
|
594
|
-
}
|
|
595
|
-
catch {
|
|
596
|
-
return `${currency} ${amount.toFixed(2)}`;
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
const getTokenMonogram = (tokenName, tokenSymbol) => {
|
|
600
|
-
if (tokenSymbol)
|
|
601
|
-
return tokenSymbol.slice(0, 2).toUpperCase();
|
|
602
|
-
return tokenName.slice(0, 2).toUpperCase();
|
|
603
|
-
};
|
|
604
|
-
const buildDirectQuote = (option, context) => {
|
|
605
|
-
const amount = String(context.cryptoPaymentAttempt.amount_formatted);
|
|
606
|
-
const formattedAmount = formatDisplayAmount(amount) ?? amount;
|
|
607
|
-
const amountDisplay = formatTokenBalance(option.fromTokenSymbol ?? option.fromTokenName, formattedAmount) ?? formattedAmount;
|
|
608
|
-
return {
|
|
609
|
-
quoteId: option.quoteId,
|
|
610
|
-
routeId: option.routeId,
|
|
611
|
-
toolName: "Direct transfer",
|
|
612
|
-
fromAmount: amount,
|
|
613
|
-
fromAmountDisplay: amountDisplay,
|
|
614
|
-
toAmount: amount,
|
|
615
|
-
toAmountDisplay: amountDisplay,
|
|
616
|
-
estimatedDurationMinutes: 1,
|
|
617
|
-
};
|
|
618
|
-
};
|
|
619
|
-
const CryptoIntentWalletPaymentOptionsAppKitViewContent = () => {
|
|
21
|
+
import { getTokenMonogram, WalletPaymentDiscovery, WalletPaymentFailure, } from "./wallet-payment-discovery.js";
|
|
22
|
+
import { ConnectedWalletAddress, ConnectedWalletIdentity, ConnectedWalletRow, ContentStage, ContextPill, ContextPillToggle, ContextStrip, PillAction, PillBody, PillCaret, PillChainBadge, PillDetailLabel, PillDetailRow, PillDetailValue, PillDetails, PillEyebrow, PillIconWrap, PillTitle, PillTokenIcon, QuoteFootnote, QuoteNotice, QuoteRow, WalletDisconnectButton, WalletDot, WalletRowActions, WalletSwitchLink, } from "./wallet-payment-options.styles.js";
|
|
23
|
+
import { CryptoIntentSelectWalletViewContent } from "./wallet-select.js";
|
|
24
|
+
const ConnectedWalletPaymentOptions = ({ connection, onPaymentSelectionChange, }) => {
|
|
620
25
|
const modalRef = useRef(null);
|
|
621
|
-
const
|
|
622
|
-
const lastWalletOptionsLoadKeyRef = useRef(null);
|
|
623
|
-
const walletOptionsRequestRef = useRef(null);
|
|
624
|
-
const lastQuoteLoadKeyRef = useRef(null);
|
|
625
|
-
const { goToView } = useModalWithView();
|
|
626
|
-
const { open } = useAppKit();
|
|
26
|
+
const { goToView, viewProps } = useModalWithView();
|
|
627
27
|
const config = useMintMoneyConfig();
|
|
628
|
-
const
|
|
629
|
-
const {
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
const
|
|
28
|
+
const session = useCheckoutWallet();
|
|
29
|
+
const { address: walletAddress, connectorIcon } = connection;
|
|
30
|
+
const checkoutState = useCheckoutStore();
|
|
31
|
+
const { payment, cryptoPaymentAttempt, cryptoCurrency, walletPayment, quote, processing, } = checkoutState;
|
|
32
|
+
const frozenRefundRecipient = getFrozenRefundRecipient(checkoutState);
|
|
33
|
+
const refundNotice = getRefundNotice(frozenRefundRecipient, walletAddress);
|
|
634
34
|
const [paymentDetailsExpanded, setPaymentDetailsExpanded] = useState(false);
|
|
635
|
-
const
|
|
636
|
-
const connectorName = account.connector?.name || "Connected wallet";
|
|
637
|
-
const connectorIcon = typeof account.connector?.icon === "string"
|
|
638
|
-
? account.connector.icon
|
|
639
|
-
: undefined;
|
|
640
|
-
const connectedWagmiWallet = useMemo(() => {
|
|
641
|
-
if (!account.isConnected || !account.address || !account.connector) {
|
|
642
|
-
return null;
|
|
643
|
-
}
|
|
644
|
-
return new WagmiWalletInterface(account.connector, wagmiConfig);
|
|
645
|
-
}, [account.address, account.connector, account.isConnected, wagmiConfig]);
|
|
646
|
-
const activeWallet = connectedWagmiWallet ?? wallet;
|
|
35
|
+
const countdown = useQuoteCountdown(quote);
|
|
647
36
|
useEffect(() => {
|
|
648
|
-
if (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
const currentCheckout = state.checkout;
|
|
657
|
-
const currentCryptoCurrency = state.cryptoCurrency;
|
|
658
|
-
if (!currentCheckout || !currentCryptoCurrency || !activeWallet) {
|
|
659
|
-
throw new Error("Wallet payment context is not ready");
|
|
660
|
-
}
|
|
661
|
-
const resolvedPayment = currentPayment ?? state.payment;
|
|
662
|
-
if (!resolvedPayment) {
|
|
663
|
-
throw new Error("Missing payment");
|
|
664
|
-
}
|
|
665
|
-
const walletAddress = await activeWallet.getAddress();
|
|
666
|
-
if (!walletAddress) {
|
|
667
|
-
throw new Error("Failed to get wallet address");
|
|
668
|
-
}
|
|
669
|
-
return {
|
|
670
|
-
checkout: currentCheckout,
|
|
671
|
-
payment: resolvedPayment,
|
|
672
|
-
settlementCurrency: currentCryptoCurrency,
|
|
673
|
-
walletAddress,
|
|
674
|
-
};
|
|
675
|
-
}, [activeWallet]);
|
|
676
|
-
const loadWalletPaymentOptions = useCallback(async (isCancelled, options = {}) => {
|
|
677
|
-
const preparedContext = await buildContext();
|
|
678
|
-
const loadKey = buildWalletPaymentOptionsLoadKey({
|
|
679
|
-
paymentId: preparedContext.payment.id,
|
|
680
|
-
settlementChain: preparedContext.settlementCurrency.chain,
|
|
681
|
-
settlementAsset: preparedContext.settlementCurrency.asset,
|
|
682
|
-
walletAddress: preparedContext.walletAddress,
|
|
683
|
-
});
|
|
684
|
-
if (!loadKey) {
|
|
685
|
-
throw new Error("Wallet payment context is not ready");
|
|
686
|
-
}
|
|
687
|
-
const currentWalletPayment = useCheckoutStore.getState().walletPayment;
|
|
688
|
-
const isSameWallet = currentWalletPayment.walletAddress?.toLowerCase() ===
|
|
689
|
-
preparedContext.walletAddress.toLowerCase();
|
|
690
|
-
const canReuseLoadedOptions = !options.force &&
|
|
691
|
-
lastWalletOptionsLoadKeyRef.current === loadKey &&
|
|
692
|
-
isSameWallet &&
|
|
693
|
-
currentWalletPayment.status !== "failed";
|
|
694
|
-
if (canReuseLoadedOptions) {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
setProcessing(true);
|
|
698
|
-
setSelectedCurrency(cryptoCurrency);
|
|
699
|
-
const shouldPreserveVisibleOptions = isSameWallet &&
|
|
700
|
-
currentWalletPayment.options.length > 0 &&
|
|
701
|
-
currentWalletPayment.status !== "failed";
|
|
702
|
-
if (shouldPreserveVisibleOptions) {
|
|
703
|
-
setWalletPaymentState({ status: "ready", error: null });
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
resetWalletPaymentState();
|
|
707
|
-
setWalletPaymentState({ status: "loading", error: null, options: [] });
|
|
708
|
-
}
|
|
709
|
-
writeCheckoutResumeState(preparedContext.payment.id, {
|
|
710
|
-
view: "cryptoIntentWalletPaymentOptions",
|
|
711
|
-
walletAddress: preparedContext.walletAddress,
|
|
712
|
-
pendingWalletConnection: false,
|
|
713
|
-
});
|
|
714
|
-
const existingRequest = walletOptionsRequestRef.current;
|
|
715
|
-
const request = existingRequest?.key === loadKey
|
|
716
|
-
? existingRequest.promise
|
|
717
|
-
: findWalletPaymentOptions(preparedContext);
|
|
718
|
-
if (existingRequest?.key !== loadKey) {
|
|
719
|
-
walletOptionsRequestRef.current = {
|
|
720
|
-
key: loadKey,
|
|
721
|
-
promise: request,
|
|
722
|
-
};
|
|
723
|
-
void request
|
|
724
|
-
.finally(() => {
|
|
725
|
-
if (walletOptionsRequestRef.current?.key === loadKey) {
|
|
726
|
-
walletOptionsRequestRef.current = null;
|
|
727
|
-
}
|
|
728
|
-
})
|
|
729
|
-
.catch(() => undefined);
|
|
730
|
-
}
|
|
731
|
-
const providerOptions = await request;
|
|
732
|
-
if (isCancelled()) {
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
const resumeState = readCheckoutResumeState(preparedContext.payment.id);
|
|
736
|
-
const shouldRestoreSelectedOption = resumeState.walletAddress?.toLowerCase() ===
|
|
737
|
-
preparedContext.walletAddress.toLowerCase() &&
|
|
738
|
-
Boolean(resumeState.selectedWalletOptionId &&
|
|
739
|
-
providerOptions.some((option) => option.id === resumeState.selectedWalletOptionId));
|
|
740
|
-
setWalletPaymentState({
|
|
741
|
-
...buildWalletPaymentOptionsReadyState({
|
|
742
|
-
walletAddress: preparedContext.walletAddress,
|
|
743
|
-
options: providerOptions,
|
|
744
|
-
}),
|
|
745
|
-
selectedOptionId: shouldRestoreSelectedOption
|
|
746
|
-
? resumeState.selectedWalletOptionId || null
|
|
747
|
-
: null,
|
|
748
|
-
});
|
|
749
|
-
lastWalletOptionsLoadKeyRef.current = loadKey;
|
|
750
|
-
}, [buildContext, cryptoCurrency]);
|
|
751
|
-
const handleMissingAccount = useCallback(() => {
|
|
752
|
-
resetWalletPaymentState();
|
|
753
|
-
clearQuoteRefresh();
|
|
754
|
-
setProcessing(false);
|
|
755
|
-
goToView("cryptoIntent");
|
|
756
|
-
}, [goToView]);
|
|
757
|
-
const handleMissingWalletConnection = useCallback(() => {
|
|
758
|
-
goToView("failed", { reason: "wallet_not_connected" });
|
|
759
|
-
}, [goToView]);
|
|
760
|
-
const handleWalletPaymentOptionsError = useCallback((error) => {
|
|
761
|
-
const message = error instanceof Error ? error.message : "Failed to load payment options";
|
|
762
|
-
setWalletPaymentState({
|
|
763
|
-
status: "failed",
|
|
764
|
-
error: message,
|
|
765
|
-
options: [],
|
|
766
|
-
});
|
|
767
|
-
}, []);
|
|
768
|
-
const shouldPreserveSubmittedFailure = walletPayment.status === "failed" &&
|
|
769
|
-
walletPayment.options.length > 0 &&
|
|
770
|
-
Boolean(walletPayment.sourceTxHash);
|
|
37
|
+
if (cryptoCurrency)
|
|
38
|
+
void loadWalletPaymentOptions(walletAddress, session.capture());
|
|
39
|
+
}, [cryptoCurrency, walletAddress, session.capture]);
|
|
40
|
+
useEffect(() => () => clearQuoteRefresh({ preserveWalletAddress: true }), []);
|
|
41
|
+
const selectedOption = walletPayment.options.find((option) => option.id === walletPayment.selectedOptionId) ?? null;
|
|
42
|
+
const bitcoinSelected = selectedOption?.fromChain === BITCOIN_CHAIN;
|
|
43
|
+
const resume = viewProps.resumePaymentSelection;
|
|
44
|
+
const restored = useRef(false);
|
|
771
45
|
useEffect(() => {
|
|
772
|
-
if (
|
|
773
|
-
|
|
46
|
+
if (restored.current ||
|
|
47
|
+
resume?.kind !== "wallet" ||
|
|
48
|
+
walletPayment.status !== "ready")
|
|
774
49
|
return;
|
|
775
|
-
|
|
776
|
-
if (
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
return;
|
|
788
|
-
}
|
|
789
|
-
if (shouldPreserveSubmittedFailure) {
|
|
790
|
-
setProcessing(false);
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
const currentWalletPayment = useCheckoutStore.getState().walletPayment;
|
|
794
|
-
if (currentWalletPayment.selectedOptionId ||
|
|
795
|
-
currentWalletPayment.status === "executing" ||
|
|
796
|
-
currentWalletPayment.status === "submitted") {
|
|
797
|
-
if (currentWalletPayment.status !== "executing") {
|
|
798
|
-
setProcessing(false);
|
|
799
|
-
}
|
|
50
|
+
restored.current = true;
|
|
51
|
+
if (resume.address === walletAddress &&
|
|
52
|
+
walletPayment.options.some((option) => option.id === resume.optionId)) {
|
|
53
|
+
prepareWalletQuoteReplacement(walletAddress, resume.optionId);
|
|
54
|
+
}
|
|
55
|
+
}, [resume, walletAddress, walletPayment.options, walletPayment.status]);
|
|
56
|
+
const paymentId = payment?.id;
|
|
57
|
+
const optionId = !walletPayment.submission && !hasReceivedFunds(payment?.funding)
|
|
58
|
+
? selectedOption?.id
|
|
59
|
+
: null;
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
if (!paymentId || !optionId)
|
|
800
62
|
return;
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
finally {
|
|
813
|
-
if (!cancelled) {
|
|
814
|
-
setProcessing(false);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
void loadOptions();
|
|
819
|
-
return () => {
|
|
820
|
-
cancelled = true;
|
|
821
|
-
clearQuoteRefresh();
|
|
822
|
-
};
|
|
823
|
-
}, [
|
|
824
|
-
account.address,
|
|
825
|
-
account.isConnected,
|
|
826
|
-
activeWallet,
|
|
827
|
-
cryptoCurrency,
|
|
828
|
-
handleMissingAccount,
|
|
829
|
-
handleMissingWalletConnection,
|
|
830
|
-
handleWalletPaymentOptionsError,
|
|
831
|
-
isWalletConnectionSettling,
|
|
832
|
-
loadWalletPaymentOptions,
|
|
833
|
-
shouldPreserveSubmittedFailure,
|
|
834
|
-
walletPayment.selectedOptionId,
|
|
835
|
-
]);
|
|
836
|
-
const selectedOption = walletPayment.options.find((option) => option.id === walletPayment.selectedOptionId) ?? null;
|
|
837
|
-
const hasNoPaymentOptions = walletPayment.status === "ready" && walletPayment.options.length === 0;
|
|
838
|
-
const unsupportedWalletAddress = walletPayment.walletAddress ?? account.address ?? null;
|
|
839
|
-
const quoteLoadKey = buildWalletQuoteLoadKey({
|
|
840
|
-
paymentId: payment?.id,
|
|
841
|
-
paymentAmount: payment?.amount,
|
|
842
|
-
paymentCurrency: payment?.currency,
|
|
843
|
-
paymentExpiresAt: payment?.expires_at,
|
|
844
|
-
settlementChain: cryptoCurrency?.chain,
|
|
845
|
-
settlementAsset: cryptoCurrency?.asset,
|
|
846
|
-
walletAddress: walletPayment.walletAddress ?? account.address,
|
|
847
|
-
option: selectedOption,
|
|
848
|
-
});
|
|
849
|
-
const confirmationAmount = selectedOption && payment
|
|
850
|
-
? resolveWalletPaymentConfirmationAmount({
|
|
851
|
-
option: selectedOption,
|
|
852
|
-
quote: walletPayment.quote,
|
|
853
|
-
attempt: cryptoPaymentAttempt,
|
|
854
|
-
})
|
|
63
|
+
onPaymentSelectionChange?.(paymentId, {
|
|
64
|
+
kind: "wallet",
|
|
65
|
+
address: walletAddress,
|
|
66
|
+
optionId,
|
|
67
|
+
});
|
|
68
|
+
return () => onPaymentSelectionChange?.(paymentId, null);
|
|
69
|
+
}, [optionId, onPaymentSelectionChange, paymentId, walletAddress]);
|
|
70
|
+
const routeQuote = getRouteQuote(quote);
|
|
71
|
+
const bitcoinQuote = quote.data?.kind === "bitcoin_estimate" ||
|
|
72
|
+
quote.data?.kind === "bitcoin_prepared"
|
|
73
|
+
? quote.data
|
|
855
74
|
: null;
|
|
856
|
-
const
|
|
857
|
-
(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
75
|
+
const bitcoinAmount = bitcoinQuote?.price
|
|
76
|
+
? formatBaseUnits(bitcoinQuote.price.amount, 8)
|
|
77
|
+
: null;
|
|
78
|
+
const walletAmount = bitcoinSelected
|
|
79
|
+
? bitcoinAmount
|
|
80
|
+
? {
|
|
81
|
+
sendAmount: `${bitcoinAmount} BTC`,
|
|
82
|
+
amountUsd: bitcoinQuote?.price?.amount_usd,
|
|
83
|
+
}
|
|
84
|
+
: null
|
|
85
|
+
: selectedOption && payment
|
|
86
|
+
? resolveWalletPaymentConfirmationAmount({
|
|
87
|
+
option: selectedOption,
|
|
88
|
+
quote: routeQuote,
|
|
89
|
+
attempt: cryptoPaymentAttempt,
|
|
90
|
+
})
|
|
91
|
+
: null;
|
|
92
|
+
const bitcoinAmountTooLow = bitcoinSelected && quote.data?.kind === "bitcoin_amount_too_low";
|
|
863
93
|
const handlePickOption = (option) => {
|
|
864
|
-
|
|
865
|
-
prepareWalletQuoteReplacement(walletPayment.walletAddress);
|
|
94
|
+
prepareWalletQuoteReplacement(walletAddress, option.id);
|
|
866
95
|
setPaymentDetailsExpanded(false);
|
|
867
|
-
writeCheckoutResumeState(payment?.id, {
|
|
868
|
-
view: "cryptoIntentWalletPaymentOptions",
|
|
869
|
-
walletAddress: walletPayment.walletAddress ?? account.address ?? null,
|
|
870
|
-
selectedWalletOptionId: option.id,
|
|
871
|
-
});
|
|
872
|
-
setWalletPaymentState({
|
|
873
|
-
selectedOptionId: option.id,
|
|
874
|
-
error: null,
|
|
875
|
-
quoteId: null,
|
|
876
|
-
routeId: null,
|
|
877
|
-
quoteStatus: "idle",
|
|
878
|
-
quote: null,
|
|
879
|
-
quoteError: null,
|
|
880
|
-
});
|
|
881
96
|
};
|
|
882
97
|
const handleReturnToOptions = () => {
|
|
883
|
-
|
|
884
|
-
prepareWalletQuoteReplacement(walletPayment.walletAddress);
|
|
98
|
+
prepareWalletQuoteReplacement(walletAddress, null);
|
|
885
99
|
setPaymentDetailsExpanded(false);
|
|
886
|
-
writeCheckoutResumeState(payment?.id, {
|
|
887
|
-
view: "cryptoIntentWalletPaymentOptions",
|
|
888
|
-
walletAddress: walletPayment.walletAddress ?? account.address ?? null,
|
|
889
|
-
selectedWalletOptionId: null,
|
|
890
|
-
});
|
|
891
|
-
setWalletPaymentState({
|
|
892
|
-
selectedOptionId: null,
|
|
893
|
-
error: null,
|
|
894
|
-
quoteStatus: "idle",
|
|
895
|
-
quote: null,
|
|
896
|
-
quoteError: null,
|
|
897
|
-
});
|
|
898
100
|
};
|
|
899
|
-
const handleChangeWallet =
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const handleDisconnectWallet = useCallback(() => {
|
|
905
|
-
isChangingWalletRef.current = false;
|
|
906
|
-
clearCheckoutResumeState(payment?.id);
|
|
907
|
-
resetWalletPaymentState();
|
|
908
|
-
clearQuoteRefresh();
|
|
909
|
-
setWallet(null);
|
|
910
|
-
setProcessing(false);
|
|
101
|
+
const handleChangeWallet = () => {
|
|
102
|
+
void session.connect();
|
|
103
|
+
};
|
|
104
|
+
const handleDisconnectWallet = () => {
|
|
105
|
+
void session.disconnect();
|
|
911
106
|
goToView("cryptoIntent");
|
|
912
|
-
void disconnect(wagmiConfig).catch((error) => {
|
|
913
|
-
console.warn("Unable to disconnect wallet", error);
|
|
914
|
-
});
|
|
915
|
-
}, [goToView, payment?.id, setWallet, wagmiConfig]);
|
|
916
|
-
const confirmDirectWalletPayment = async (txHash) => {
|
|
917
|
-
if (!payment) {
|
|
918
|
-
throw new Error("Missing payment");
|
|
919
|
-
}
|
|
920
|
-
try {
|
|
921
|
-
await confirmPayment(payment.id, { txHash });
|
|
922
|
-
}
|
|
923
|
-
catch (error) {
|
|
924
|
-
const message = messageForWalletError(error, "Failed to confirm wallet payment");
|
|
925
|
-
setWalletPaymentState({
|
|
926
|
-
status: "failed",
|
|
927
|
-
error: message,
|
|
928
|
-
});
|
|
929
|
-
goToView("cryptoIntentWalletPaymentOptions");
|
|
930
|
-
}
|
|
931
107
|
};
|
|
108
|
+
const selectedOptionId = walletPayment.selectedOptionId;
|
|
932
109
|
useEffect(() => {
|
|
933
|
-
if (!
|
|
934
|
-
if (!selectedOption) {
|
|
935
|
-
lastQuoteLoadKeyRef.current = null;
|
|
936
|
-
}
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
if (lastQuoteLoadKeyRef.current === quoteLoadKey) {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
lastQuoteLoadKeyRef.current = quoteLoadKey;
|
|
943
|
-
let cancelled = false;
|
|
944
|
-
const loadQuote = async () => {
|
|
945
|
-
const currentPayment = useCheckoutStore.getState().payment;
|
|
946
|
-
if (!currentPayment?.id) {
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
try {
|
|
950
|
-
prepareWalletQuoteReplacement(walletPayment.walletAddress ?? account.address ?? null);
|
|
951
|
-
setWalletPaymentState({
|
|
952
|
-
quoteStatus: "loading",
|
|
953
|
-
quote: null,
|
|
954
|
-
quoteError: null,
|
|
955
|
-
quoteId: null,
|
|
956
|
-
routeId: null,
|
|
957
|
-
});
|
|
958
|
-
const preparedContext = await buildContext(currentPayment);
|
|
959
|
-
const walletAddress = await activeWallet?.getAddress();
|
|
960
|
-
if (!walletAddress) {
|
|
961
|
-
throw new Error("Failed to get wallet address");
|
|
962
|
-
}
|
|
963
|
-
const ensuredAttempt = await createWalletOptionPaymentAttempt(selectedOption, walletAddress, null);
|
|
964
|
-
if (cancelled) {
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
const quoteContext = {
|
|
968
|
-
...preparedContext,
|
|
969
|
-
cryptoPaymentAttempt: ensuredAttempt,
|
|
970
|
-
};
|
|
971
|
-
if (selectedOption.kind === "direct") {
|
|
972
|
-
const directQuote = buildDirectQuote(selectedOption, quoteContext);
|
|
973
|
-
setWalletPaymentState({
|
|
974
|
-
quoteStatus: "ready",
|
|
975
|
-
quote: directQuote,
|
|
976
|
-
quoteId: directQuote.quoteId,
|
|
977
|
-
routeId: directQuote.routeId,
|
|
978
|
-
quoteError: null,
|
|
979
|
-
});
|
|
980
|
-
configureWalletQuoteRefresh(walletAddress);
|
|
981
|
-
return;
|
|
982
|
-
}
|
|
983
|
-
const quote = await fetchWalletPaymentQuote({
|
|
984
|
-
option: selectedOption,
|
|
985
|
-
context: quoteContext,
|
|
986
|
-
});
|
|
987
|
-
if (cancelled) {
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
setWalletPaymentState({
|
|
991
|
-
quoteStatus: "ready",
|
|
992
|
-
quote,
|
|
993
|
-
quoteId: quote.quoteId,
|
|
994
|
-
routeId: quote.routeId,
|
|
995
|
-
quoteError: null,
|
|
996
|
-
});
|
|
997
|
-
configureWalletQuoteRefresh(walletAddress);
|
|
998
|
-
}
|
|
999
|
-
catch (error) {
|
|
1000
|
-
if (cancelled) {
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
const message = error instanceof Error ? error.message : "Failed to load route quote";
|
|
1004
|
-
setWalletPaymentState({
|
|
1005
|
-
quoteStatus: "failed",
|
|
1006
|
-
quote: null,
|
|
1007
|
-
quoteError: message,
|
|
1008
|
-
});
|
|
1009
|
-
clearQuoteRefresh({ preserveWalletAddress: true });
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
void loadQuote();
|
|
1013
|
-
return () => {
|
|
1014
|
-
cancelled = true;
|
|
1015
|
-
};
|
|
1016
|
-
}, [
|
|
1017
|
-
account.address,
|
|
1018
|
-
activeWallet,
|
|
1019
|
-
buildContext,
|
|
1020
|
-
cryptoCurrency,
|
|
1021
|
-
goToView,
|
|
1022
|
-
quoteLoadKey,
|
|
1023
|
-
selectedOption,
|
|
1024
|
-
walletPayment.walletAddress,
|
|
1025
|
-
]);
|
|
1026
|
-
const handleSelectOption = async (option) => {
|
|
1027
|
-
if (!activeWallet || !payment || !cryptoCurrency) {
|
|
1028
|
-
goToView("failed", { reason: "wallet_not_connected" });
|
|
110
|
+
if (!selectedOptionId)
|
|
1029
111
|
return;
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
if (!walletAddress) {
|
|
1044
|
-
throw new Error("Failed to get wallet address");
|
|
1045
|
-
}
|
|
1046
|
-
writeCheckoutResumeState(payment.id, {
|
|
1047
|
-
view: "cryptoIntentWalletPaymentOptions",
|
|
1048
|
-
walletAddress,
|
|
1049
|
-
selectedWalletOptionId: option.id,
|
|
1050
|
-
});
|
|
1051
|
-
const ensuredAttempt = await createWalletOptionPaymentAttempt(option, walletAddress, option.kind === "direct" ? null : walletPayment.quote);
|
|
1052
|
-
const preparedContext = {
|
|
1053
|
-
...(await buildContext(payment)),
|
|
1054
|
-
cryptoPaymentAttempt: ensuredAttempt,
|
|
1055
|
-
};
|
|
1056
|
-
if (option.kind === "direct") {
|
|
1057
|
-
const txHash = await executeTransfer(activeWallet);
|
|
1058
|
-
if (!txHash) {
|
|
1059
|
-
throw new Error("Failed to get transaction hash");
|
|
1060
|
-
}
|
|
1061
|
-
setWalletPaymentState({
|
|
1062
|
-
status: "submitted",
|
|
1063
|
-
sourceTxHash: txHash,
|
|
1064
|
-
destinationTxHash: null,
|
|
1065
|
-
quoteId: null,
|
|
1066
|
-
routeId: null,
|
|
1067
|
-
});
|
|
1068
|
-
goToView("paymentStatus");
|
|
1069
|
-
void (async () => {
|
|
1070
|
-
try {
|
|
1071
|
-
await checkChainStatus(activeWallet);
|
|
1072
|
-
await confirmDirectWalletPayment(txHash);
|
|
1073
|
-
}
|
|
1074
|
-
catch (error) {
|
|
1075
|
-
const message = messageForWalletError(error, "Failed to confirm wallet payment");
|
|
1076
|
-
setWalletPaymentState({
|
|
1077
|
-
status: "failed",
|
|
1078
|
-
error: message,
|
|
1079
|
-
});
|
|
1080
|
-
goToView("cryptoIntentWalletPaymentOptions");
|
|
1081
|
-
}
|
|
1082
|
-
})();
|
|
1083
|
-
return;
|
|
1084
|
-
}
|
|
1085
|
-
else {
|
|
1086
|
-
const freshQuote = await fetchWalletPaymentQuote({
|
|
1087
|
-
option,
|
|
1088
|
-
context: preparedContext,
|
|
1089
|
-
});
|
|
1090
|
-
if (!freshQuote.quoteId) {
|
|
1091
|
-
throw new Error("Missing LI.FI quote id for routed wallet payment");
|
|
1092
|
-
}
|
|
1093
|
-
setWalletPaymentState({
|
|
1094
|
-
quoteStatus: "ready",
|
|
1095
|
-
quote: freshQuote,
|
|
1096
|
-
quoteId: freshQuote.quoteId,
|
|
1097
|
-
routeId: freshQuote.routeId,
|
|
1098
|
-
quoteError: null,
|
|
1099
|
-
});
|
|
1100
|
-
const result = await executeWalletPaymentOption({
|
|
1101
|
-
option,
|
|
1102
|
-
wallet: activeWallet,
|
|
1103
|
-
context: preparedContext,
|
|
1104
|
-
quote: freshQuote,
|
|
1105
|
-
});
|
|
1106
|
-
const confirmationTxHash = result?.destinationTxHash ?? null;
|
|
1107
|
-
if (!confirmationTxHash) {
|
|
1108
|
-
throw new Error("Missing destination transaction hash for routed wallet payment");
|
|
1109
|
-
}
|
|
1110
|
-
await confirmPayment(payment.id, {
|
|
1111
|
-
txHash: confirmationTxHash,
|
|
1112
|
-
lifiQuote: {
|
|
1113
|
-
quote_id: freshQuote.quoteId,
|
|
1114
|
-
route_id: freshQuote.routeId ?? null,
|
|
1115
|
-
route: freshQuote.raw,
|
|
1116
|
-
},
|
|
1117
|
-
});
|
|
1118
|
-
setWalletPaymentState({
|
|
1119
|
-
status: "submitted",
|
|
1120
|
-
sourceTxHash: result?.sourceTxHash ?? null,
|
|
1121
|
-
destinationTxHash: confirmationTxHash,
|
|
1122
|
-
quoteId: freshQuote.quoteId,
|
|
1123
|
-
routeId: freshQuote.routeId,
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
goToView("paymentStatus");
|
|
1127
|
-
}
|
|
1128
|
-
catch (error) {
|
|
1129
|
-
const message = messageForWalletError(error, "Failed to execute wallet payment");
|
|
1130
|
-
setWalletPaymentState({
|
|
1131
|
-
status: "failed",
|
|
1132
|
-
error: message,
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
finally {
|
|
1136
|
-
setExecutingId(null);
|
|
1137
|
-
setProcessing(false);
|
|
1138
|
-
}
|
|
112
|
+
// The lifecycle owns cancellation and renewal. Returned payment/attempt
|
|
113
|
+
// snapshots update the displayed quote without restarting this request.
|
|
114
|
+
void loadWalletPaymentQuote(walletAddress, session.capture());
|
|
115
|
+
}, [selectedOptionId, walletAddress, session.capture]);
|
|
116
|
+
const paymentSession = () => ({
|
|
117
|
+
...connection,
|
|
118
|
+
ownsConnection: session.capture(),
|
|
119
|
+
onStatusChange: (status) => goToView(status === "submitted"
|
|
120
|
+
? "paymentStatus"
|
|
121
|
+
: "cryptoIntentWalletPaymentOptions"),
|
|
122
|
+
});
|
|
123
|
+
const handleSelectOption = () => {
|
|
124
|
+
void payWithWallet(paymentSession());
|
|
1139
125
|
};
|
|
1140
126
|
const handleRetryWalletPayment = () => {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
setWalletPaymentState({ status: "ready", error: null });
|
|
1150
|
-
void handleSelectOption(selectedOption);
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
const retry = async () => {
|
|
1154
|
-
try {
|
|
1155
|
-
await loadWalletPaymentOptions(() => false, { force: true });
|
|
1156
|
-
}
|
|
1157
|
-
catch (error) {
|
|
1158
|
-
handleWalletPaymentOptionsError(error);
|
|
1159
|
-
}
|
|
1160
|
-
finally {
|
|
1161
|
-
setProcessing(false);
|
|
1162
|
-
}
|
|
1163
|
-
};
|
|
1164
|
-
void retry();
|
|
127
|
+
void retryWalletPayment(paymentSession());
|
|
128
|
+
};
|
|
129
|
+
const handleChooseAnotherMethod = () => {
|
|
130
|
+
if (!walletPayment.submission)
|
|
131
|
+
resetWalletPaymentState();
|
|
132
|
+
goToView("cryptoIntent");
|
|
1165
133
|
};
|
|
1166
|
-
const showWalletPill =
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
walletPayment.status !== "failed";
|
|
1170
|
-
const walletAddressForPill = walletPayment.walletAddress ?? account.address ?? null;
|
|
1171
|
-
const walletAddressForHeader = walletPayment.walletAddress ?? account.address ?? null;
|
|
1172
|
-
return (_jsxs(ModalViewContainer, { ref: modalRef, children: [showWalletPill && walletAddressForPill && selectedOption ? (_jsxs(ContextStrip, { children: [_jsx(QuoteExpiryCountdown, { remainingMs: quote.remainingMs, totalDurationMs: quote.totalDurationMs, primaryColor: config.theme.btn.primary.default.backgroundColor, urgentThresholdRatio: QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO }), _jsxs(ContextPill, { children: [_jsxs(ContextPillToggle, { type: "button", onClick: () => setPaymentDetailsExpanded((expanded) => !expanded), "aria-expanded": paymentDetailsExpanded, children: [_jsxs(PillIconWrap, { children: [_jsx(PillTokenIcon, { "$iconUrl": selectedOption.fromTokenIconUrl, children: !selectedOption.fromTokenIconUrl
|
|
134
|
+
const showWalletPill = walletPayment.status !== "loading" && walletPayment.status !== "failed";
|
|
135
|
+
const showWalletHeader = !showWalletPill || !selectedOption;
|
|
136
|
+
return (_jsxs(ModalViewContainer, { ref: modalRef, children: [showWalletHeader ? (_jsxs(ConnectedWalletRow, { children: [_jsxs(ConnectedWalletIdentity, { children: [_jsx(WalletDot, { "$iconUrl": connectorIcon, "aria-hidden": "true" }), _jsx(ConnectedWalletAddress, { children: formatAddress(walletAddress) })] }), _jsxs(WalletRowActions, { children: [_jsx(WalletSwitchLink, { type: "button", onClick: handleChangeWallet, disabled: processing, "aria-label": "Switch wallet", title: "Switch wallet", children: _jsx(EditIcon, { size: 12 }) }), _jsx(WalletDisconnectButton, { type: "button", onClick: handleDisconnectWallet, disabled: processing, "aria-label": "Disconnect wallet", title: "Disconnect wallet", children: _jsx(LogOutIcon, { size: 12 }) })] })] })) : null, showWalletPill && selectedOption ? (_jsxs(ContextStrip, { children: [walletPayment.status !== "executing" && (_jsx(QuoteExpiryCountdown, { remainingMs: countdown.remainingMs, totalDurationMs: countdown.totalDurationMs, primaryColor: config.theme.btn.primary.default.backgroundColor, urgentThresholdRatio: QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO })), _jsxs(ContextPill, { children: [_jsxs(ContextPillToggle, { type: "button", onClick: () => setPaymentDetailsExpanded((expanded) => !expanded), "aria-expanded": paymentDetailsExpanded, children: [_jsxs(PillIconWrap, { children: [_jsx(PillTokenIcon, { "$iconUrl": selectedOption.fromTokenIconUrl, children: !selectedOption.fromTokenIconUrl
|
|
1173
137
|
? getTokenMonogram(selectedOption.fromTokenName, selectedOption.fromTokenSymbol)
|
|
1174
138
|
: null }), selectedOption.fromChainIconUrl ? (_jsx(PillChainBadge, { "$iconUrl": selectedOption.fromChainIconUrl })) : null] }), _jsxs(PillBody, { children: [_jsx(PillEyebrow, { children: "You send" }), _jsxs(PillTitle, { children: [selectedOption.fromTokenSymbol, " on", " ", selectedOption.fromChainName] })] }), _jsx(PillAction, { type: "button", onClick: (event) => {
|
|
1175
139
|
event.stopPropagation();
|
|
1176
140
|
handleReturnToOptions();
|
|
1177
|
-
}, disabled: processing, children: "Change" }), _jsx(PillCaret, { "$expanded": paymentDetailsExpanded, children: "\u25BE" })] }), paymentDetailsExpanded ? (_jsxs(PillDetails, { children: [_jsxs(PillDetailRow, { children: [_jsx(PillDetailLabel, { children: "Connected wallet" }), _jsxs(PillDetailValue, { children: [_jsx(WalletDot, { "$iconUrl": connectorIcon, "aria-hidden": "true" }), formatAddress(
|
|
141
|
+
}, disabled: processing, children: "Change" }), _jsx(PillCaret, { "$expanded": paymentDetailsExpanded, children: "\u25BE" })] }), paymentDetailsExpanded ? (_jsxs(PillDetails, { children: [_jsxs(PillDetailRow, { children: [_jsx(PillDetailLabel, { children: "Connected wallet" }), _jsxs(PillDetailValue, { children: [_jsx(WalletDot, { "$iconUrl": connectorIcon, "aria-hidden": "true" }), formatAddress(walletAddress), _jsx(WalletSwitchLink, { type: "button", onClick: handleChangeWallet, disabled: processing, "aria-label": "Switch wallet", title: "Switch wallet", children: _jsx(EditIcon, { size: 12 }) }), _jsx(WalletDisconnectButton, { type: "button", onClick: handleDisconnectWallet, disabled: processing, "aria-label": "Disconnect wallet", title: "Disconnect wallet", children: _jsx(LogOutIcon, { size: 12 }) })] })] }), _jsxs(PillDetailRow, { children: [_jsx(PillDetailLabel, { children: "Route" }), _jsx(PillDetailValue, { children: selectedOption.kind === "direct"
|
|
1178
142
|
? "Direct transfer"
|
|
1179
|
-
: "Routed transfer" })] })] })) : null] })] })) : null, walletPayment.status === "failed" ? (
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
:
|
|
143
|
+
: "Routed transfer" })] })] })) : null] })] })) : null, walletPayment.status === "failed" ? (_jsx(WalletPaymentFailure, { heading: selectedOption
|
|
144
|
+
? "Payment couldn’t continue"
|
|
145
|
+
: "Wallet options unavailable", error: walletPayment.error, refundNotice: selectedOption && !bitcoinSelected ? refundNotice : null, processing: processing, onRetry: handleRetryWalletPayment, onChooseAnotherMethod: handleChooseAnotherMethod })) : walletPayment.status === "loading" ||
|
|
146
|
+
(walletPayment.status === "ready" && !selectedOption) ? (_jsx(WalletPaymentDiscovery, { status: walletPayment.status, options: walletPayment.options, processing: processing, onSelect: handlePickOption })) : (walletPayment.status === "ready" ||
|
|
147
|
+
walletPayment.status === "executing") &&
|
|
148
|
+
selectedOption ? (_jsxs(ContentStage, { children: [walletAmount && _jsx(ManualInstructionCard, { ...walletAmount }), bitcoinSelected ? (bitcoinAmountTooLow ? (_jsx(PaymentRouteError, { role: "alert", children: "This amount is too small for Bitcoin." })) : !walletAmount &&
|
|
149
|
+
walletPayment.status === "ready" &&
|
|
150
|
+
(quote.status === "ready" || quote.status === "failed") ? (_jsx(PaymentRouteError, { role: "alert", children: "Bitcoin estimate unavailable." })) : null) : (_jsxs(_Fragment, { children: [typeof routeQuote?.estimatedDurationMinutes === "number" ? (_jsxs(QuoteRow, { children: [_jsx(Text, { size: "sm", color: config.theme.font.color.secondary, children: "Estimated time" }), _jsxs(Text, { size: "sm", weight: "semibold", color: config.theme.font.color.primary, children: ["~", routeQuote.estimatedDurationMinutes, " min"] })] })) : null, hasReceivedFunds(payment?.funding) ? (_jsx(FundingProgress, { funding: payment?.funding, tokenSymbol: settlementTokenSymbol(payment?.payment_attempt) })) : null, quote.status === "refreshing" ? (_jsx(QuoteFootnote, { children: "Fetching the freshest quote\u2026" })) : null, quote.status === "failed" ? (_jsx(PaymentRouteError, { role: "alert", children: quote.error || "We couldn't fetch a quote right now." })) : null, refundNotice ? (_jsx(QuoteNotice, { role: "note", children: refundNotice })) : null] })), _jsx(StyledButton, { onClick: bitcoinAmountTooLow
|
|
151
|
+
? handleChooseAnotherMethod
|
|
152
|
+
: handleSelectOption, disabled: processing ||
|
|
153
|
+
!selectedOption ||
|
|
154
|
+
quote.status === "refreshing" ||
|
|
155
|
+
(!bitcoinSelected &&
|
|
156
|
+
selectedOption.kind !== "direct" &&
|
|
157
|
+
quote.status !== "ready"), children: bitcoinAmountTooLow
|
|
158
|
+
? "Choose another payment method"
|
|
159
|
+
: walletPayment.status === "executing"
|
|
160
|
+
? bitcoinSelected
|
|
161
|
+
? "Preparing transaction…"
|
|
162
|
+
: "Preparing..."
|
|
163
|
+
: quote.status === "refreshing"
|
|
1200
164
|
? "Fetching quote..."
|
|
1201
|
-
:
|
|
165
|
+
: bitcoinSelected
|
|
166
|
+
? "Prepare transaction"
|
|
167
|
+
: `Pay with ${selectedOption.fromTokenName}` }), _jsx(StyledButton, { variant: "secondary", onClick: handleReturnToOptions, disabled: processing, children: "Back" })] })) : null] }));
|
|
1202
168
|
};
|
|
1203
|
-
const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
1204
|
-
|
|
169
|
+
const CryptoIntentWalletPaymentOptionsViewContent = (props) => {
|
|
170
|
+
const { connection } = useCheckoutWallet();
|
|
171
|
+
return connection ? (_jsx(ConnectedWalletPaymentOptions, { connection: connection, ...props }, connection.identity)) : (_jsx(CryptoIntentSelectWalletViewContent, {}));
|
|
1205
172
|
};
|
|
1206
173
|
export { CryptoIntentWalletPaymentOptionsViewContent };
|
|
1207
174
|
//# sourceMappingURL=wallet-payment-options.js.map
|