@mintmoney/react 0.1.0-alpha.32 → 0.1.0-alpha.33
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 +8 -6
- package/dist/esm/api/generated.js +31 -0
- package/dist/esm/api/generated.js.map +1 -1
- package/dist/esm/api/index.js +1 -0
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/payments.js +39 -0
- package/dist/esm/api/payments.js.map +1 -1
- package/dist/esm/checkout/index.js +22 -18
- package/dist/esm/checkout/index.js.map +1 -1
- package/dist/esm/checkout/modal.js +4 -3
- package/dist/esm/checkout/modal.js.map +1 -1
- package/dist/esm/checkout/providers/wagmi-config.js +82 -0
- package/dist/esm/checkout/providers/wagmi-config.js.map +1 -0
- package/dist/esm/checkout/surplus-refund.js +38 -0
- package/dist/esm/checkout/surplus-refund.js.map +1 -0
- package/dist/esm/checkout/views/back.js +2 -2
- package/dist/esm/checkout/views/back.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/direct-details.js +941 -102
- package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/methods.js +84 -31
- package/dist/esm/checkout/views/crypto-intent/methods.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/processing.js +51 -3
- package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/success.js +58 -9
- package/dist/esm/checkout/views/crypto-intent/success.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js +684 -226
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js +104 -20
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js.map +1 -1
- package/dist/esm/checkout/views/failed.js +83 -1
- package/dist/esm/checkout/views/failed.js.map +1 -1
- package/dist/esm/checkout/views/initial.js +46 -6
- package/dist/esm/checkout/views/initial.js.map +1 -1
- package/dist/esm/checkout/views/method-select.js +16 -4
- package/dist/esm/checkout/views/method-select.js.map +1 -1
- package/dist/esm/checkout/views/restart.js +1 -1
- package/dist/esm/checkout/views/restart.js.map +1 -1
- package/dist/esm/components/buttons/index.js +4 -1
- package/dist/esm/components/buttons/index.js.map +1 -1
- package/dist/esm/components/icons/clock.js +4 -0
- package/dist/esm/components/icons/clock.js.map +1 -0
- package/dist/esm/components/icons/edit.js +6 -0
- package/dist/esm/components/icons/edit.js.map +1 -0
- package/dist/esm/components/icons/index.js +3 -0
- package/dist/esm/components/icons/index.js.map +1 -1
- package/dist/esm/components/icons/send.js +6 -0
- package/dist/esm/components/icons/send.js.map +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/quote-expiry/index.js +2 -0
- package/dist/esm/components/quote-expiry/index.js.map +1 -0
- package/dist/esm/components/quote-expiry/quote-expiry-countdown.js +35 -0
- package/dist/esm/components/quote-expiry/quote-expiry-countdown.js.map +1 -0
- package/dist/esm/components/quote-expiry/styles.js +109 -0
- package/dist/esm/components/quote-expiry/styles.js.map +1 -0
- package/dist/esm/components/quote-expiry/tiers.js +31 -0
- package/dist/esm/components/quote-expiry/tiers.js.map +1 -0
- package/dist/esm/components/wallet-selector/component.js +3 -5
- package/dist/esm/components/wallet-selector/component.js.map +1 -1
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js.map +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrations/lifi.js +52 -34
- package/dist/esm/integrations/lifi.js.map +1 -1
- package/dist/esm/refund/index.js +791 -0
- package/dist/esm/refund/index.js.map +1 -0
- package/dist/esm/state/checkout/payment-attempt.js +3 -0
- package/dist/esm/state/checkout/payment-attempt.js.map +1 -1
- package/dist/esm/state/checkout/payment-lifecycle.js +43 -35
- package/dist/esm/state/checkout/payment-lifecycle.js.map +1 -1
- package/dist/esm/state/checkout/store.js +318 -198
- package/dist/esm/state/checkout/store.js.map +1 -1
- package/dist/esm/state/checkout/wallet-payment-options.js +30 -0
- package/dist/esm/state/checkout/wallet-payment-options.js.map +1 -0
- package/dist/esm/themes/default.js +6 -0
- package/dist/esm/themes/default.js.map +1 -1
- package/dist/esm/utils/string.js +1 -0
- package/dist/esm/utils/string.js.map +1 -1
- package/dist/esm/utils/wallet-errors.js +15 -0
- package/dist/esm/utils/wallet-errors.js.map +1 -0
- package/dist/types/api/generated.d.ts +207 -4
- package/dist/types/api/generated.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/payments.d.ts +36 -1
- package/dist/types/api/payments.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +4 -0
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/checkout/index.d.ts +4 -1
- package/dist/types/checkout/index.d.ts.map +1 -1
- package/dist/types/checkout/modal.d.ts.map +1 -1
- package/dist/types/checkout/providers/wagmi-config.d.ts +12 -0
- package/dist/types/checkout/providers/wagmi-config.d.ts.map +1 -0
- package/dist/types/checkout/surplus-refund.d.ts +10 -0
- package/dist/types/checkout/surplus-refund.d.ts.map +1 -0
- package/dist/types/checkout/views/back.d.ts +2 -1
- package/dist/types/checkout/views/back.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts +10 -1
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/methods.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/processing.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts.map +1 -1
- package/dist/types/checkout/views/failed.d.ts.map +1 -1
- package/dist/types/checkout/views/initial.d.ts +2 -0
- package/dist/types/checkout/views/initial.d.ts.map +1 -1
- package/dist/types/checkout/views/method-select.d.ts +2 -0
- package/dist/types/checkout/views/method-select.d.ts.map +1 -1
- package/dist/types/components/buttons/index.d.ts.map +1 -1
- package/dist/types/components/icons/clock.d.ts +6 -0
- package/dist/types/components/icons/clock.d.ts.map +1 -0
- package/dist/types/components/icons/edit.d.ts +6 -0
- package/dist/types/components/icons/edit.d.ts.map +1 -0
- package/dist/types/components/icons/index.d.ts +3 -0
- package/dist/types/components/icons/index.d.ts.map +1 -1
- package/dist/types/components/icons/send.d.ts +6 -0
- package/dist/types/components/icons/send.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/quote-expiry/index.d.ts +2 -0
- package/dist/types/components/quote-expiry/index.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/quote-expiry-countdown.d.ts +15 -0
- package/dist/types/components/quote-expiry/quote-expiry-countdown.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/styles.d.ts +22 -0
- package/dist/types/components/quote-expiry/styles.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/tiers.d.ts +10 -0
- package/dist/types/components/quote-expiry/tiers.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/component.d.ts +1 -2
- package/dist/types/components/wallet-selector/component.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/domain.d.ts +3 -2
- package/dist/types/components/wallet-selector/domain.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts +41 -5
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrations/lifi.d.ts.map +1 -1
- package/dist/types/refund/index.d.ts +82 -0
- package/dist/types/refund/index.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-attempt.d.ts.map +1 -1
- package/dist/types/state/checkout/payment-lifecycle.d.ts +27 -10
- package/dist/types/state/checkout/payment-lifecycle.d.ts.map +1 -1
- package/dist/types/state/checkout/store.d.ts +35 -16
- package/dist/types/state/checkout/store.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-payment-options.d.ts +18 -0
- package/dist/types/state/checkout/wallet-payment-options.d.ts.map +1 -0
- package/dist/types/themes/default.d.ts.map +1 -1
- package/dist/types/themes/types.d.ts +11 -0
- package/dist/types/themes/types.d.ts.map +1 -1
- package/dist/types/utils/string.d.ts +1 -0
- package/dist/types/utils/string.d.ts.map +1 -1
- package/dist/types/utils/wallet-errors.d.ts +2 -0
- package/dist/types/utils/wallet-errors.d.ts.map +1 -0
- package/package.json +25 -18
- package/LICENSE +0 -21
|
@@ -1,61 +1,339 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useAppKit } from "@reown/appkit/react";
|
|
3
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
4
|
import { keyframes, styled } from "styled-components";
|
|
5
|
+
import { useAccount, useConfig } from "wagmi";
|
|
4
6
|
import { confirmPayment } from "../../../api/payments.js";
|
|
5
|
-
import {
|
|
7
|
+
import { EditIcon } from "../../../components/icons/index.js";
|
|
8
|
+
import { QuoteExpiryCountdown, StyledButton, Text, useModalWithView, } from "../../../components/index.js";
|
|
6
9
|
import { WalletContext } from "../../../components/wallet-selector/provider.js";
|
|
10
|
+
import { useWalletActions } from "../../../components/wallet-selector/store.js";
|
|
11
|
+
import { WagmiWalletInterface } from "../../../components/wallet-selector/wallets/wagmi/index.js";
|
|
7
12
|
import { useMintMoneyConfig } from "../../../context.js";
|
|
8
13
|
import { executeWalletPaymentOption, fetchWalletPaymentQuote, findWalletPaymentOptions, } from "../../../integrations/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
14
|
+
import { clearQuoteRefresh, checkChainStatus, configureWalletQuoteRefresh, createWalletOptionPaymentAttempt, executeTransfer, prepareWalletQuoteReplacement, resetWalletPaymentState, setProcessing, setSelectedCurrency, setWalletPaymentState, useCheckoutStore, } from "../../../state/checkout/store.js";
|
|
15
|
+
import { buildWalletQuoteLoadKey, buildWalletPaymentOptionsReadyState, NO_WALLET_PAYMENT_OPTIONS_DESCRIPTION, NO_WALLET_PAYMENT_OPTIONS_TITLE, } from "../../../state/checkout/wallet-payment-options.js";
|
|
16
|
+
import { formatAddress } from "../../../utils/string.js";
|
|
17
|
+
import { messageForWalletError } from "../../../utils/wallet-errors.js";
|
|
11
18
|
import { ModalViewContainer } from "../../container.js";
|
|
12
19
|
import { ModalBackButton } from "../back.js";
|
|
13
20
|
import { resolveWalletPaymentConfirmationAmount } from "./wallet-payment-confirmation-amount.js";
|
|
14
|
-
const
|
|
21
|
+
const QUOTE_COUNTDOWN_URGENT_THRESHOLD_RATIO = 0.25;
|
|
22
|
+
const pillSlideIn = keyframes `
|
|
23
|
+
from {
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transform: translateY(-6px);
|
|
26
|
+
}
|
|
27
|
+
to {
|
|
28
|
+
opacity: 1;
|
|
29
|
+
transform: translateY(0);
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const ContextStrip = styled.div `
|
|
15
33
|
display: flex;
|
|
16
34
|
flex-direction: column;
|
|
17
|
-
gap:
|
|
18
|
-
max-height: min(360px, 48vh);
|
|
19
|
-
overflow-y: auto;
|
|
20
|
-
padding-right: 4px;
|
|
21
|
-
overscroll-behavior: contain;
|
|
35
|
+
gap: 8px;
|
|
22
36
|
`;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
const ContextPill = styled.div `
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
padding: 12px 14px;
|
|
40
|
+
border-radius: 14px;
|
|
41
|
+
background: ${({ $accent }) => ($accent ? "#f8fffc" : "#ffffff")};
|
|
42
|
+
border: 1px solid ${({ $accent }) => ($accent ? "#bbf7d0" : "#eef2f6")};
|
|
43
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
|
44
|
+
animation: ${pillSlideIn} 200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
45
|
+
`;
|
|
46
|
+
const ContextPillToggle = styled.button `
|
|
47
|
+
width: 100%;
|
|
48
|
+
border: 0;
|
|
49
|
+
background: transparent;
|
|
50
|
+
color: inherit;
|
|
51
|
+
padding: 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 12px;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
text-align: left;
|
|
57
|
+
|
|
58
|
+
&:focus-visible {
|
|
59
|
+
outline: 2px solid #a7f3d0;
|
|
60
|
+
outline-offset: 4px;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
const PillIconWrap = styled.div `
|
|
64
|
+
position: relative;
|
|
65
|
+
width: 40px;
|
|
66
|
+
height: 40px;
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
`;
|
|
69
|
+
const PillTokenIcon = styled.div `
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
border-radius: 999px;
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
font-size: 11px;
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
color: #1d4ed8;
|
|
79
|
+
background: linear-gradient(135deg, #dbeafe, #bfdbfe);
|
|
80
|
+
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
81
|
+
background-size: cover;
|
|
82
|
+
background-position: center;
|
|
83
|
+
`;
|
|
84
|
+
const PillChainBadge = styled.div `
|
|
85
|
+
position: absolute;
|
|
86
|
+
right: -2px;
|
|
87
|
+
bottom: -2px;
|
|
88
|
+
width: 14px;
|
|
89
|
+
height: 14px;
|
|
90
|
+
border-radius: 999px;
|
|
91
|
+
border: 1.5px solid #ffffff;
|
|
27
92
|
background: #ffffff;
|
|
93
|
+
background-image: ${({ $iconUrl }) => $iconUrl ? `url(${$iconUrl})` : "none"};
|
|
94
|
+
background-size: 85%;
|
|
95
|
+
background-position: center;
|
|
96
|
+
background-repeat: no-repeat;
|
|
97
|
+
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
|
|
98
|
+
`;
|
|
99
|
+
const WalletDot = styled.div `
|
|
100
|
+
width: 18px;
|
|
101
|
+
height: 18px;
|
|
102
|
+
border-radius: 999px;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
background:
|
|
105
|
+
${({ $iconUrl }) => ($iconUrl ? `url(${$iconUrl})` : "none")},
|
|
106
|
+
linear-gradient(135deg, #22c55e, #60a5fa);
|
|
107
|
+
background-size: cover;
|
|
108
|
+
background-position: center;
|
|
109
|
+
`;
|
|
110
|
+
const WalletSwitchLink = styled.button `
|
|
111
|
+
flex-shrink: 0;
|
|
112
|
+
border: none;
|
|
113
|
+
background: transparent;
|
|
114
|
+
color: #94a3b8;
|
|
115
|
+
display: inline-flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
width: 20px;
|
|
119
|
+
height: 20px;
|
|
120
|
+
margin: -2px -2px -2px -6px;
|
|
121
|
+
padding: 0;
|
|
28
122
|
cursor: pointer;
|
|
123
|
+
border-radius: 999px;
|
|
29
124
|
transition:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
transform 120ms ease;
|
|
125
|
+
color 120ms ease,
|
|
126
|
+
background-color 120ms ease;
|
|
33
127
|
|
|
34
128
|
&:hover {
|
|
35
|
-
|
|
36
|
-
|
|
129
|
+
color: #0f172a;
|
|
130
|
+
background: #f1f5f9;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:focus-visible {
|
|
134
|
+
outline: 2px solid #a7f3d0;
|
|
135
|
+
outline-offset: 2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&:disabled {
|
|
139
|
+
opacity: 0.5;
|
|
140
|
+
cursor: not-allowed;
|
|
37
141
|
}
|
|
38
142
|
`;
|
|
39
|
-
const
|
|
143
|
+
const PillBody = styled.div `
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: 2px;
|
|
147
|
+
min-width: 0;
|
|
148
|
+
flex: 1;
|
|
149
|
+
`;
|
|
150
|
+
const PillEyebrow = styled.span `
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
line-height: 1.2;
|
|
153
|
+
color: ${({ theme }) => theme.font.color.tertiary};
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
text-overflow: ellipsis;
|
|
157
|
+
`;
|
|
158
|
+
const PillTitle = styled.span `
|
|
159
|
+
font-size: 14px;
|
|
160
|
+
font-weight: 600;
|
|
161
|
+
color: ${({ theme }) => theme.font.color.primary};
|
|
162
|
+
line-height: 1.3;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
text-overflow: ellipsis;
|
|
166
|
+
`;
|
|
167
|
+
const PillAction = styled.button `
|
|
168
|
+
flex-shrink: 0;
|
|
169
|
+
border: none;
|
|
170
|
+
background: transparent;
|
|
171
|
+
color: ${({ theme }) => theme.font.color.secondary};
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
padding: 6px 10px;
|
|
175
|
+
border-radius: 999px;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
transition:
|
|
178
|
+
background-color 120ms ease,
|
|
179
|
+
color 120ms ease;
|
|
180
|
+
|
|
181
|
+
&:hover {
|
|
182
|
+
background: #f1f5f9;
|
|
183
|
+
color: #0f172a;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:focus-visible {
|
|
187
|
+
outline: 2px solid #a7f3d0;
|
|
188
|
+
outline-offset: 2px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&:disabled {
|
|
192
|
+
opacity: 0.5;
|
|
193
|
+
cursor: not-allowed;
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
const PillCaret = styled.span `
|
|
197
|
+
width: 24px;
|
|
198
|
+
height: 24px;
|
|
199
|
+
border-radius: 999px;
|
|
200
|
+
background: #f1f3fb;
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
font-size: 13px;
|
|
205
|
+
line-height: 1;
|
|
206
|
+
color: #6b7280;
|
|
207
|
+
transform: rotate(${({ $expanded }) => ($expanded ? "180deg" : "0deg")});
|
|
208
|
+
transition:
|
|
209
|
+
transform 0.15s ease,
|
|
210
|
+
background 0.15s ease;
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
`;
|
|
213
|
+
const PillDetails = styled.div `
|
|
214
|
+
border-top: 1px solid #edf1f5;
|
|
215
|
+
margin-top: 12px;
|
|
216
|
+
padding-top: 12px;
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
`;
|
|
220
|
+
const PillDetailRow = styled.div `
|
|
40
221
|
display: flex;
|
|
41
222
|
align-items: center;
|
|
42
223
|
justify-content: space-between;
|
|
43
224
|
gap: 12px;
|
|
225
|
+
border-bottom: 1px solid #edf1f5;
|
|
226
|
+
padding: 9px 0;
|
|
227
|
+
|
|
228
|
+
&:last-child {
|
|
229
|
+
border-bottom: 0;
|
|
230
|
+
padding-bottom: 0;
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
const PillDetailLabel = styled.span `
|
|
234
|
+
font-size: 13px;
|
|
235
|
+
line-height: 1.3;
|
|
236
|
+
color: #475569;
|
|
44
237
|
`;
|
|
45
|
-
const
|
|
238
|
+
const PillDetailValue = styled.span `
|
|
239
|
+
display: inline-flex;
|
|
240
|
+
align-items: center;
|
|
241
|
+
justify-content: flex-end;
|
|
242
|
+
gap: 6px;
|
|
243
|
+
min-width: 0;
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
line-height: 1.3;
|
|
246
|
+
font-weight: 600;
|
|
247
|
+
color: #0f172a;
|
|
248
|
+
text-align: right;
|
|
249
|
+
`;
|
|
250
|
+
const SectionLabel = styled.div `
|
|
251
|
+
font-size: 11px;
|
|
252
|
+
font-weight: 600;
|
|
253
|
+
letter-spacing: 0.06em;
|
|
254
|
+
text-transform: uppercase;
|
|
255
|
+
color: #94a3b8;
|
|
256
|
+
padding: 0 2px;
|
|
257
|
+
`;
|
|
258
|
+
const SectionRow = styled.div `
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: baseline;
|
|
261
|
+
justify-content: space-between;
|
|
262
|
+
gap: 12px;
|
|
263
|
+
padding: 0 2px;
|
|
264
|
+
`;
|
|
265
|
+
const ConnectedWalletRow = styled.div `
|
|
46
266
|
display: flex;
|
|
47
267
|
align-items: center;
|
|
48
|
-
|
|
268
|
+
justify-content: space-between;
|
|
269
|
+
gap: 12px;
|
|
270
|
+
padding: 2px 4px;
|
|
271
|
+
`;
|
|
272
|
+
const ConnectedWalletIdentity = styled.div `
|
|
273
|
+
display: inline-flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
gap: 8px;
|
|
49
276
|
min-width: 0;
|
|
50
|
-
|
|
277
|
+
font-size: 12px;
|
|
278
|
+
line-height: 1.4;
|
|
279
|
+
color: #64748b;
|
|
280
|
+
`;
|
|
281
|
+
const ConnectedWalletAddress = styled.span `
|
|
282
|
+
min-width: 0;
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
text-overflow: ellipsis;
|
|
285
|
+
white-space: nowrap;
|
|
286
|
+
`;
|
|
287
|
+
const OptionsContainer = styled.div `
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
gap: 8px;
|
|
291
|
+
max-height: min(300px, 34vh);
|
|
292
|
+
overflow-y: auto;
|
|
293
|
+
margin: -4px -4px -6px;
|
|
294
|
+
padding: 4px 4px 6px;
|
|
295
|
+
overscroll-behavior: contain;
|
|
296
|
+
scrollbar-width: none;
|
|
297
|
+
|
|
298
|
+
&::-webkit-scrollbar {
|
|
299
|
+
display: none;
|
|
300
|
+
}
|
|
51
301
|
`;
|
|
52
|
-
const
|
|
302
|
+
const OptionCard = styled.button `
|
|
303
|
+
border: 1px solid #eef2f6;
|
|
304
|
+
border-radius: 16px;
|
|
305
|
+
padding: 12px 14px;
|
|
306
|
+
background: #ffffff;
|
|
307
|
+
cursor: pointer;
|
|
308
|
+
width: 100%;
|
|
309
|
+
text-align: left;
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
gap: 12px;
|
|
313
|
+
transition:
|
|
314
|
+
border-color 140ms ease,
|
|
315
|
+
box-shadow 140ms ease,
|
|
316
|
+
transform 140ms ease,
|
|
317
|
+
background-color 140ms ease;
|
|
318
|
+
|
|
319
|
+
&:hover {
|
|
320
|
+
border-color: #cdd9e3;
|
|
321
|
+
box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
|
|
322
|
+
transform: translateY(-1px);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&:focus-visible {
|
|
326
|
+
outline: 2px solid #a7f3d0;
|
|
327
|
+
outline-offset: 2px;
|
|
328
|
+
}
|
|
329
|
+
`;
|
|
330
|
+
const OptionTokenIconWrap = styled.div `
|
|
53
331
|
position: relative;
|
|
54
|
-
width:
|
|
55
|
-
height:
|
|
332
|
+
width: 40px;
|
|
333
|
+
height: 40px;
|
|
56
334
|
flex-shrink: 0;
|
|
57
335
|
`;
|
|
58
|
-
const
|
|
336
|
+
const OptionTokenIcon = styled.div `
|
|
59
337
|
width: 100%;
|
|
60
338
|
height: 100%;
|
|
61
339
|
border-radius: 999px;
|
|
@@ -73,7 +351,7 @@ const TokenIcon = styled.div `
|
|
|
73
351
|
background-position: center;
|
|
74
352
|
overflow: hidden;
|
|
75
353
|
`;
|
|
76
|
-
const
|
|
354
|
+
const OptionChainBadge = styled.div `
|
|
77
355
|
position: absolute;
|
|
78
356
|
right: -2px;
|
|
79
357
|
bottom: -2px;
|
|
@@ -100,24 +378,9 @@ const OptionBalance = styled.div `
|
|
|
100
378
|
display: flex;
|
|
101
379
|
flex-direction: column;
|
|
102
380
|
align-items: flex-end;
|
|
103
|
-
gap:
|
|
381
|
+
gap: 4px;
|
|
104
382
|
flex-shrink: 0;
|
|
105
383
|
`;
|
|
106
|
-
const OptionsHeaderRow = styled.div `
|
|
107
|
-
display: flex;
|
|
108
|
-
align-items: baseline;
|
|
109
|
-
justify-content: space-between;
|
|
110
|
-
gap: 12px;
|
|
111
|
-
`;
|
|
112
|
-
const OptionsHeaderLabel = styled.div `
|
|
113
|
-
font-size: 11px;
|
|
114
|
-
line-height: 1;
|
|
115
|
-
color: #64748b;
|
|
116
|
-
letter-spacing: 0.02em;
|
|
117
|
-
text-transform: none;
|
|
118
|
-
white-space: nowrap;
|
|
119
|
-
padding-right: 8px;
|
|
120
|
-
`;
|
|
121
384
|
const FastBadge = styled.span `
|
|
122
385
|
display: inline-flex;
|
|
123
386
|
align-items: center;
|
|
@@ -125,95 +388,106 @@ const FastBadge = styled.span `
|
|
|
125
388
|
gap: 4px;
|
|
126
389
|
background: #ecfdf5;
|
|
127
390
|
color: #047857;
|
|
128
|
-
font-size:
|
|
391
|
+
font-size: 11px;
|
|
129
392
|
font-weight: 600;
|
|
130
393
|
line-height: 1;
|
|
131
|
-
padding:
|
|
394
|
+
padding: 4px 8px;
|
|
132
395
|
white-space: nowrap;
|
|
133
396
|
`;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
background: #f9fafb;
|
|
140
|
-
`;
|
|
141
|
-
const confirmTrayEnter = keyframes `
|
|
142
|
-
from {
|
|
143
|
-
opacity: 0;
|
|
144
|
-
transform: perspective(1000px) rotateY(-86deg) scale(0.96);
|
|
145
|
-
transform-origin: center;
|
|
146
|
-
}
|
|
147
|
-
to {
|
|
148
|
-
opacity: 1;
|
|
149
|
-
opacity: 1;
|
|
150
|
-
transform: perspective(1000px) rotateY(0deg) scale(1);
|
|
151
|
-
}
|
|
397
|
+
const RoutedBadge = styled.span `
|
|
398
|
+
font-size: 11px;
|
|
399
|
+
font-weight: 500;
|
|
400
|
+
color: #94a3b8;
|
|
401
|
+
white-space: nowrap;
|
|
152
402
|
`;
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
border: 1px solid #
|
|
156
|
-
border-radius:
|
|
157
|
-
padding:
|
|
158
|
-
background: linear-gradient(180deg, #ecfdf5 0%, #dcfce7 100%);
|
|
159
|
-
box-shadow: 0 14px 30px rgba(16, 185, 129, 0.12);
|
|
403
|
+
const QuoteCard = styled.div `
|
|
404
|
+
background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
|
|
405
|
+
border: 1px solid #eef2f6;
|
|
406
|
+
border-radius: 18px;
|
|
407
|
+
padding: 16px 18px;
|
|
160
408
|
display: flex;
|
|
161
409
|
flex-direction: column;
|
|
162
|
-
gap:
|
|
163
|
-
|
|
410
|
+
gap: 10px;
|
|
411
|
+
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
|
|
164
412
|
`;
|
|
165
|
-
const
|
|
413
|
+
const QuoteRow = styled.div `
|
|
166
414
|
display: flex;
|
|
167
|
-
align-items:
|
|
415
|
+
align-items: baseline;
|
|
168
416
|
justify-content: space-between;
|
|
169
|
-
gap:
|
|
417
|
+
gap: 16px;
|
|
418
|
+
`;
|
|
419
|
+
const QuoteHairline = styled.div `
|
|
420
|
+
height: 1px;
|
|
421
|
+
background: #eef2f6;
|
|
422
|
+
margin: 2px 0;
|
|
170
423
|
`;
|
|
171
|
-
const
|
|
424
|
+
const QuoteFootnote = styled.div `
|
|
172
425
|
display: flex;
|
|
173
426
|
align-items: center;
|
|
174
|
-
gap:
|
|
427
|
+
gap: 6px;
|
|
428
|
+
font-size: 12px;
|
|
429
|
+
color: #94a3b8;
|
|
430
|
+
|
|
431
|
+
&::before {
|
|
432
|
+
content: "";
|
|
433
|
+
display: inline-block;
|
|
434
|
+
width: 6px;
|
|
435
|
+
height: 6px;
|
|
436
|
+
border-radius: 999px;
|
|
437
|
+
background: #22c55e;
|
|
438
|
+
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
|
|
439
|
+
}
|
|
175
440
|
`;
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
441
|
+
const QuoteFootnoteWarn = styled(QuoteFootnote) `
|
|
442
|
+
color: #b45309;
|
|
443
|
+
|
|
444
|
+
&::before {
|
|
445
|
+
background: #f59e0b;
|
|
446
|
+
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
|
|
447
|
+
}
|
|
180
448
|
`;
|
|
181
|
-
const
|
|
449
|
+
const SkeletonContainer = styled.div `
|
|
182
450
|
display: flex;
|
|
183
451
|
flex-direction: column;
|
|
184
|
-
gap:
|
|
452
|
+
gap: 8px;
|
|
453
|
+
`;
|
|
454
|
+
const skeletonShimmer = keyframes `
|
|
455
|
+
0% { background-position: -120% 0; }
|
|
456
|
+
100% { background-position: 220% 0; }
|
|
185
457
|
`;
|
|
186
|
-
const
|
|
458
|
+
const SkeletonRow = styled.div `
|
|
459
|
+
height: 64px;
|
|
460
|
+
border-radius: 16px;
|
|
461
|
+
border: 1px solid #eef2f6;
|
|
462
|
+
background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 50%, #f8fafc 100%);
|
|
463
|
+
background-size: 220% 100%;
|
|
464
|
+
animation: ${skeletonShimmer} 1.4s ease-in-out infinite;
|
|
465
|
+
`;
|
|
466
|
+
const EmptyState = styled.div `
|
|
467
|
+
position: relative;
|
|
468
|
+
border-radius: 22px;
|
|
469
|
+
padding: 22px 20px;
|
|
470
|
+
background: #ffffff;
|
|
471
|
+
border: 1px solid #ecf1ee;
|
|
187
472
|
display: flex;
|
|
188
473
|
flex-direction: column;
|
|
474
|
+
align-items: center;
|
|
189
475
|
gap: 10px;
|
|
476
|
+
text-align: center;
|
|
477
|
+
box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
|
|
190
478
|
`;
|
|
191
|
-
const
|
|
479
|
+
const EmptyHeadline = styled.div `
|
|
192
480
|
display: flex;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
481
|
+
flex-direction: column;
|
|
482
|
+
gap: 4px;
|
|
483
|
+
max-width: 300px;
|
|
196
484
|
`;
|
|
197
485
|
const ContentStage = styled.div `
|
|
198
486
|
display: flex;
|
|
199
487
|
flex-direction: column;
|
|
200
|
-
gap:
|
|
488
|
+
gap: 14px;
|
|
201
489
|
min-height: 0;
|
|
202
490
|
`;
|
|
203
|
-
const buildDefaultOption = (context) => ({
|
|
204
|
-
id: "direct-settlement",
|
|
205
|
-
label: `${context.settlementCurrency.asset_name} on ${context.settlementCurrency.chain_name}`,
|
|
206
|
-
subtitle: "Fastest Route. You can pay directly without needing to swap.",
|
|
207
|
-
badge: "Fastest",
|
|
208
|
-
fromChain: context.settlementCurrency.chain,
|
|
209
|
-
fromChainName: context.settlementCurrency.chain_name,
|
|
210
|
-
fromToken: context.settlementCurrency.asset,
|
|
211
|
-
fromTokenName: context.settlementCurrency.asset_name,
|
|
212
|
-
fromAmount: null,
|
|
213
|
-
quoteId: null,
|
|
214
|
-
routeId: null,
|
|
215
|
-
kind: "direct",
|
|
216
|
-
});
|
|
217
491
|
const formatDisplayAmount = (amount, maximumFractionDigits = 4) => {
|
|
218
492
|
if (!amount)
|
|
219
493
|
return null;
|
|
@@ -283,25 +557,50 @@ const buildDirectQuote = (option, context) => {
|
|
|
283
557
|
estimatedDurationMinutes: 1,
|
|
284
558
|
};
|
|
285
559
|
};
|
|
286
|
-
const
|
|
560
|
+
const CryptoIntentWalletPaymentOptionsAppKitViewContent = () => {
|
|
287
561
|
const modalRef = useRef(null);
|
|
562
|
+
const isChangingWalletRef = useRef(false);
|
|
563
|
+
const lastQuoteLoadKeyRef = useRef(null);
|
|
288
564
|
const { goToView } = useModalWithView();
|
|
565
|
+
const { open } = useAppKit();
|
|
289
566
|
const config = useMintMoneyConfig();
|
|
290
|
-
const
|
|
291
|
-
const {
|
|
567
|
+
const wagmiConfig = useConfig();
|
|
568
|
+
const { wallet, setWallet } = useContext(WalletContext);
|
|
569
|
+
const { initialiseWallets } = useWalletActions();
|
|
570
|
+
const account = useAccount();
|
|
571
|
+
const { payment, cryptoPaymentAttempt, cryptoCurrency, walletPayment, quote, loading, processing, } = useCheckoutStore();
|
|
292
572
|
const [executingId, setExecutingId] = useState(null);
|
|
573
|
+
const [paymentDetailsExpanded, setPaymentDetailsExpanded] = useState(false);
|
|
574
|
+
const connectorName = account.connector?.name || "Connected wallet";
|
|
575
|
+
const connectorIcon = typeof account.connector?.icon === "string"
|
|
576
|
+
? account.connector.icon
|
|
577
|
+
: undefined;
|
|
578
|
+
const connectedWagmiWallet = useMemo(() => {
|
|
579
|
+
if (!account.isConnected || !account.address || !account.connector) {
|
|
580
|
+
return null;
|
|
581
|
+
}
|
|
582
|
+
return new WagmiWalletInterface(account.connector, wagmiConfig);
|
|
583
|
+
}, [account.address, account.connector, account.isConnected, wagmiConfig]);
|
|
584
|
+
const activeWallet = connectedWagmiWallet ?? wallet;
|
|
585
|
+
useEffect(() => {
|
|
586
|
+
if (!connectedWagmiWallet) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
setWallet(connectedWagmiWallet);
|
|
590
|
+
initialiseWallets([() => connectedWagmiWallet]);
|
|
591
|
+
}, [connectedWagmiWallet, initialiseWallets, setWallet]);
|
|
293
592
|
const buildContext = useCallback(async (currentPayment) => {
|
|
294
593
|
const state = useCheckoutStore.getState();
|
|
295
594
|
const currentCheckout = state.checkout;
|
|
296
595
|
const currentCryptoCurrency = state.cryptoCurrency;
|
|
297
|
-
if (!currentCheckout || !currentCryptoCurrency || !
|
|
596
|
+
if (!currentCheckout || !currentCryptoCurrency || !activeWallet) {
|
|
298
597
|
throw new Error("Wallet payment context is not ready");
|
|
299
598
|
}
|
|
300
599
|
const resolvedPayment = currentPayment ?? state.payment;
|
|
301
600
|
if (!resolvedPayment) {
|
|
302
601
|
throw new Error("Missing payment");
|
|
303
602
|
}
|
|
304
|
-
const walletAddress = await
|
|
603
|
+
const walletAddress = await activeWallet.getAddress();
|
|
305
604
|
if (!walletAddress) {
|
|
306
605
|
throw new Error("Failed to get wallet address");
|
|
307
606
|
}
|
|
@@ -311,46 +610,69 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
311
610
|
settlementCurrency: currentCryptoCurrency,
|
|
312
611
|
walletAddress,
|
|
313
612
|
};
|
|
314
|
-
}, [
|
|
613
|
+
}, [activeWallet]);
|
|
614
|
+
const loadWalletPaymentOptions = useCallback(async (isCancelled) => {
|
|
615
|
+
setProcessing(true);
|
|
616
|
+
setSelectedCurrency(cryptoCurrency);
|
|
617
|
+
resetWalletPaymentState();
|
|
618
|
+
setWalletPaymentState({ status: "loading", error: null, options: [] });
|
|
619
|
+
const preparedContext = await buildContext();
|
|
620
|
+
const providerOptions = await findWalletPaymentOptions(preparedContext);
|
|
621
|
+
if (isCancelled()) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
setWalletPaymentState(buildWalletPaymentOptionsReadyState({
|
|
625
|
+
walletAddress: preparedContext.walletAddress,
|
|
626
|
+
options: providerOptions,
|
|
627
|
+
}));
|
|
628
|
+
}, [buildContext, cryptoCurrency]);
|
|
629
|
+
const handleMissingAccount = useCallback(() => {
|
|
630
|
+
resetWalletPaymentState();
|
|
631
|
+
clearQuoteRefresh();
|
|
632
|
+
setProcessing(false);
|
|
633
|
+
goToView("cryptoIntent");
|
|
634
|
+
}, [goToView]);
|
|
635
|
+
const handleMissingWalletConnection = useCallback(() => {
|
|
636
|
+
goToView("failed", { reason: "wallet_not_connected" });
|
|
637
|
+
}, [goToView]);
|
|
638
|
+
const handleWalletPaymentOptionsError = useCallback((error) => {
|
|
639
|
+
const message = error instanceof Error ? error.message : "Failed to load payment options";
|
|
640
|
+
setWalletPaymentState({
|
|
641
|
+
status: "failed",
|
|
642
|
+
error: message,
|
|
643
|
+
options: [],
|
|
644
|
+
});
|
|
645
|
+
}, []);
|
|
646
|
+
const shouldPreserveSubmittedFailure = walletPayment.status === "failed" &&
|
|
647
|
+
walletPayment.options.length > 0 &&
|
|
648
|
+
Boolean(walletPayment.sourceTxHash);
|
|
315
649
|
useEffect(() => {
|
|
316
|
-
if (!
|
|
317
|
-
|
|
650
|
+
if (!account.isConnected || !account.address) {
|
|
651
|
+
if (isChangingWalletRef.current) {
|
|
652
|
+
setProcessing(false);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
handleMissingAccount();
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
isChangingWalletRef.current = false;
|
|
659
|
+
if (!activeWallet || !cryptoCurrency) {
|
|
660
|
+
handleMissingWalletConnection();
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
if (shouldPreserveSubmittedFailure) {
|
|
664
|
+
setProcessing(false);
|
|
318
665
|
return;
|
|
319
666
|
}
|
|
320
667
|
let cancelled = false;
|
|
321
668
|
const loadOptions = async () => {
|
|
322
669
|
try {
|
|
323
|
-
|
|
324
|
-
setSelectedCurrency(cryptoCurrency);
|
|
325
|
-
resetWalletPaymentState();
|
|
326
|
-
setWalletPaymentState({ status: "loading", error: null, options: [] });
|
|
327
|
-
const preparedContext = await buildContext();
|
|
328
|
-
const providerOptions = await findWalletPaymentOptions(preparedContext);
|
|
329
|
-
const options = providerOptions.length > 0
|
|
330
|
-
? providerOptions
|
|
331
|
-
: [buildDefaultOption(preparedContext)];
|
|
332
|
-
if (cancelled)
|
|
333
|
-
return;
|
|
334
|
-
configureWalletAttemptRefresh(preparedContext.walletAddress);
|
|
335
|
-
setWalletPaymentState({
|
|
336
|
-
status: "ready",
|
|
337
|
-
walletAddress: preparedContext.walletAddress,
|
|
338
|
-
options,
|
|
339
|
-
selectedOptionId: null,
|
|
340
|
-
error: null,
|
|
341
|
-
});
|
|
670
|
+
await loadWalletPaymentOptions(() => cancelled);
|
|
342
671
|
}
|
|
343
672
|
catch (error) {
|
|
344
673
|
if (cancelled)
|
|
345
674
|
return;
|
|
346
|
-
|
|
347
|
-
? error.message
|
|
348
|
-
: "Failed to load payment options";
|
|
349
|
-
setWalletPaymentState({
|
|
350
|
-
status: "failed",
|
|
351
|
-
error: message,
|
|
352
|
-
options: [],
|
|
353
|
-
});
|
|
675
|
+
handleWalletPaymentOptionsError(error);
|
|
354
676
|
}
|
|
355
677
|
finally {
|
|
356
678
|
if (!cancelled) {
|
|
@@ -361,10 +683,32 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
361
683
|
void loadOptions();
|
|
362
684
|
return () => {
|
|
363
685
|
cancelled = true;
|
|
364
|
-
|
|
686
|
+
clearQuoteRefresh();
|
|
365
687
|
};
|
|
366
|
-
}, [
|
|
688
|
+
}, [
|
|
689
|
+
account.address,
|
|
690
|
+
account.isConnected,
|
|
691
|
+
activeWallet,
|
|
692
|
+
cryptoCurrency,
|
|
693
|
+
handleMissingAccount,
|
|
694
|
+
handleMissingWalletConnection,
|
|
695
|
+
handleWalletPaymentOptionsError,
|
|
696
|
+
loadWalletPaymentOptions,
|
|
697
|
+
shouldPreserveSubmittedFailure,
|
|
698
|
+
]);
|
|
367
699
|
const selectedOption = walletPayment.options.find((option) => option.id === walletPayment.selectedOptionId) ?? null;
|
|
700
|
+
const hasNoPaymentOptions = walletPayment.status === "ready" && walletPayment.options.length === 0;
|
|
701
|
+
const unsupportedWalletAddress = walletPayment.walletAddress ?? account.address ?? null;
|
|
702
|
+
const quoteLoadKey = buildWalletQuoteLoadKey({
|
|
703
|
+
paymentId: payment?.id,
|
|
704
|
+
paymentAmount: payment?.amount,
|
|
705
|
+
paymentCurrency: payment?.currency,
|
|
706
|
+
paymentExpiresAt: payment?.expires_at,
|
|
707
|
+
settlementChain: cryptoCurrency?.chain,
|
|
708
|
+
settlementAsset: cryptoCurrency?.asset,
|
|
709
|
+
walletAddress: walletPayment.walletAddress ?? account.address,
|
|
710
|
+
option: selectedOption,
|
|
711
|
+
});
|
|
368
712
|
const confirmationAmount = selectedOption && payment
|
|
369
713
|
? resolveWalletPaymentConfirmationAmount({
|
|
370
714
|
option: selectedOption,
|
|
@@ -372,8 +716,17 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
372
716
|
attempt: cryptoPaymentAttempt,
|
|
373
717
|
})
|
|
374
718
|
: null;
|
|
719
|
+
const displayedPayAmount = confirmationAmount?.amount ??
|
|
720
|
+
(selectedOption && walletPayment.quoteStatus === "loading"
|
|
721
|
+
? "Fetching quote..."
|
|
722
|
+
: selectedOption && walletPayment.quoteStatus === "failed"
|
|
723
|
+
? "Unavailable"
|
|
724
|
+
: null);
|
|
375
725
|
const formattedCost = formatMoneyAmount(payment?.currency ?? "USD", Number(payment?.amount ?? 0));
|
|
376
726
|
const handlePickOption = (option) => {
|
|
727
|
+
lastQuoteLoadKeyRef.current = null;
|
|
728
|
+
prepareWalletQuoteReplacement(walletPayment.walletAddress);
|
|
729
|
+
setPaymentDetailsExpanded(false);
|
|
377
730
|
setWalletPaymentState({
|
|
378
731
|
selectedOptionId: option.id,
|
|
379
732
|
error: null,
|
|
@@ -385,6 +738,9 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
385
738
|
});
|
|
386
739
|
};
|
|
387
740
|
const handleReturnToOptions = () => {
|
|
741
|
+
lastQuoteLoadKeyRef.current = null;
|
|
742
|
+
prepareWalletQuoteReplacement(walletPayment.walletAddress);
|
|
743
|
+
setPaymentDetailsExpanded(false);
|
|
388
744
|
setWalletPaymentState({
|
|
389
745
|
selectedOptionId: null,
|
|
390
746
|
error: null,
|
|
@@ -393,65 +749,122 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
393
749
|
quoteError: null,
|
|
394
750
|
});
|
|
395
751
|
};
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
752
|
+
const handleChangeWallet = useCallback(() => {
|
|
753
|
+
isChangingWalletRef.current = true;
|
|
754
|
+
void open({ view: "Connect" });
|
|
755
|
+
}, [open]);
|
|
756
|
+
const confirmDirectWalletPayment = async (txHash) => {
|
|
757
|
+
if (!payment) {
|
|
758
|
+
throw new Error("Missing payment");
|
|
399
759
|
}
|
|
400
760
|
try {
|
|
761
|
+
await confirmPayment(payment.id, { txHash });
|
|
762
|
+
}
|
|
763
|
+
catch (error) {
|
|
764
|
+
const message = messageForWalletError(error, "Failed to confirm wallet payment");
|
|
401
765
|
setWalletPaymentState({
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
quoteError: null,
|
|
405
|
-
quoteId: null,
|
|
406
|
-
routeId: null,
|
|
766
|
+
status: "failed",
|
|
767
|
+
error: message,
|
|
407
768
|
});
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
769
|
+
goToView("cryptoIntentWalletPaymentOptions");
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
useEffect(() => {
|
|
773
|
+
if (!selectedOption || !quoteLoadKey || !cryptoCurrency) {
|
|
774
|
+
if (!selectedOption) {
|
|
775
|
+
lastQuoteLoadKeyRef.current = null;
|
|
412
776
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (lastQuoteLoadKeyRef.current === quoteLoadKey) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
lastQuoteLoadKeyRef.current = quoteLoadKey;
|
|
783
|
+
let cancelled = false;
|
|
784
|
+
const loadQuote = async () => {
|
|
785
|
+
const currentPayment = useCheckoutStore.getState().payment;
|
|
786
|
+
if (!currentPayment?.id) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
try {
|
|
790
|
+
prepareWalletQuoteReplacement(walletPayment.walletAddress ?? account.address ?? null);
|
|
791
|
+
setWalletPaymentState({
|
|
792
|
+
quoteStatus: "loading",
|
|
793
|
+
quote: null,
|
|
794
|
+
quoteError: null,
|
|
795
|
+
quoteId: null,
|
|
796
|
+
routeId: null,
|
|
797
|
+
});
|
|
798
|
+
const preparedContext = await buildContext(currentPayment);
|
|
799
|
+
const walletAddress = await activeWallet?.getAddress();
|
|
800
|
+
if (!walletAddress) {
|
|
801
|
+
throw new Error("Failed to get wallet address");
|
|
802
|
+
}
|
|
803
|
+
const ensuredAttempt = await createWalletOptionPaymentAttempt(selectedOption, walletAddress, null);
|
|
804
|
+
if (cancelled) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
const quoteContext = {
|
|
808
|
+
...preparedContext,
|
|
809
|
+
cryptoPaymentAttempt: ensuredAttempt,
|
|
810
|
+
};
|
|
811
|
+
if (selectedOption.kind === "direct") {
|
|
812
|
+
const directQuote = buildDirectQuote(selectedOption, quoteContext);
|
|
813
|
+
setWalletPaymentState({
|
|
814
|
+
quoteStatus: "ready",
|
|
815
|
+
quote: directQuote,
|
|
816
|
+
quoteId: directQuote.quoteId,
|
|
817
|
+
routeId: directQuote.routeId,
|
|
818
|
+
quoteError: null,
|
|
819
|
+
});
|
|
820
|
+
configureWalletQuoteRefresh(walletAddress);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
const quote = await fetchWalletPaymentQuote({
|
|
824
|
+
option: selectedOption,
|
|
825
|
+
context: quoteContext,
|
|
826
|
+
});
|
|
827
|
+
if (cancelled) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
420
830
|
setWalletPaymentState({
|
|
421
831
|
quoteStatus: "ready",
|
|
422
|
-
quote
|
|
423
|
-
quoteId:
|
|
424
|
-
routeId:
|
|
832
|
+
quote,
|
|
833
|
+
quoteId: quote.quoteId,
|
|
834
|
+
routeId: quote.routeId,
|
|
425
835
|
quoteError: null,
|
|
426
836
|
});
|
|
427
|
-
|
|
837
|
+
configureWalletQuoteRefresh(walletAddress);
|
|
428
838
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
839
|
+
catch (error) {
|
|
840
|
+
if (cancelled) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const message = error instanceof Error ? error.message : "Failed to load route quote";
|
|
844
|
+
setWalletPaymentState({
|
|
845
|
+
quoteStatus: "failed",
|
|
846
|
+
quote: null,
|
|
847
|
+
quoteError: message,
|
|
848
|
+
});
|
|
849
|
+
clearQuoteRefresh({ preserveWalletAddress: true });
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
void loadQuote();
|
|
853
|
+
return () => {
|
|
854
|
+
cancelled = true;
|
|
855
|
+
};
|
|
856
|
+
}, [
|
|
857
|
+
account.address,
|
|
858
|
+
activeWallet,
|
|
859
|
+
buildContext,
|
|
860
|
+
cryptoCurrency,
|
|
861
|
+
goToView,
|
|
862
|
+
quoteLoadKey,
|
|
863
|
+
selectedOption,
|
|
864
|
+
walletPayment.walletAddress,
|
|
865
|
+
]);
|
|
453
866
|
const handleSelectOption = async (option) => {
|
|
454
|
-
if (!
|
|
867
|
+
if (!activeWallet || !payment || !cryptoCurrency) {
|
|
455
868
|
goToView("failed", { reason: "wallet_not_connected" });
|
|
456
869
|
return;
|
|
457
870
|
}
|
|
@@ -466,7 +879,7 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
466
879
|
quoteId: null,
|
|
467
880
|
routeId: null,
|
|
468
881
|
});
|
|
469
|
-
const walletAddress = await
|
|
882
|
+
const walletAddress = await activeWallet.getAddress();
|
|
470
883
|
if (!walletAddress) {
|
|
471
884
|
throw new Error("Failed to get wallet address");
|
|
472
885
|
}
|
|
@@ -476,12 +889,10 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
476
889
|
cryptoPaymentAttempt: ensuredAttempt,
|
|
477
890
|
};
|
|
478
891
|
if (option.kind === "direct") {
|
|
479
|
-
await
|
|
480
|
-
const txHash = useCheckoutStore.getState().transfer.transactionHash;
|
|
892
|
+
const txHash = await executeTransfer(activeWallet);
|
|
481
893
|
if (!txHash) {
|
|
482
|
-
throw new Error("
|
|
894
|
+
throw new Error("Failed to get transaction hash");
|
|
483
895
|
}
|
|
484
|
-
await confirmPayment(payment.id, { txHash });
|
|
485
896
|
setWalletPaymentState({
|
|
486
897
|
status: "submitted",
|
|
487
898
|
sourceTxHash: txHash,
|
|
@@ -489,6 +900,22 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
489
900
|
quoteId: null,
|
|
490
901
|
routeId: null,
|
|
491
902
|
});
|
|
903
|
+
goToView("paymentStatus");
|
|
904
|
+
void (async () => {
|
|
905
|
+
try {
|
|
906
|
+
await checkChainStatus(activeWallet);
|
|
907
|
+
await confirmDirectWalletPayment(txHash);
|
|
908
|
+
}
|
|
909
|
+
catch (error) {
|
|
910
|
+
const message = messageForWalletError(error, "Failed to confirm wallet payment");
|
|
911
|
+
setWalletPaymentState({
|
|
912
|
+
status: "failed",
|
|
913
|
+
error: message,
|
|
914
|
+
});
|
|
915
|
+
goToView("cryptoIntentWalletPaymentOptions");
|
|
916
|
+
}
|
|
917
|
+
})();
|
|
918
|
+
return;
|
|
492
919
|
}
|
|
493
920
|
else {
|
|
494
921
|
const freshQuote = await fetchWalletPaymentQuote({
|
|
@@ -507,7 +934,7 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
507
934
|
});
|
|
508
935
|
const result = await executeWalletPaymentOption({
|
|
509
936
|
option,
|
|
510
|
-
wallet,
|
|
937
|
+
wallet: activeWallet,
|
|
511
938
|
context: preparedContext,
|
|
512
939
|
quote: freshQuote,
|
|
513
940
|
});
|
|
@@ -534,48 +961,79 @@ const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
|
534
961
|
goToView("paymentStatus");
|
|
535
962
|
}
|
|
536
963
|
catch (error) {
|
|
537
|
-
const message = error
|
|
538
|
-
? error.message
|
|
539
|
-
: "Failed to execute wallet payment";
|
|
964
|
+
const message = messageForWalletError(error, "Failed to execute wallet payment");
|
|
540
965
|
setWalletPaymentState({
|
|
541
966
|
status: "failed",
|
|
542
967
|
error: message,
|
|
543
968
|
});
|
|
544
|
-
goToView("failed", { reason: message });
|
|
545
969
|
}
|
|
546
970
|
finally {
|
|
547
971
|
setExecutingId(null);
|
|
548
972
|
setProcessing(false);
|
|
549
973
|
}
|
|
550
974
|
};
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
975
|
+
const handleRetryWalletPayment = () => {
|
|
976
|
+
if (selectedOption) {
|
|
977
|
+
if (walletPayment.sourceTxHash &&
|
|
978
|
+
useCheckoutStore.getState().transfer.chainStatus === "confirmed") {
|
|
979
|
+
setWalletPaymentState({ status: "submitted", error: null });
|
|
980
|
+
goToView("paymentStatus");
|
|
981
|
+
void confirmDirectWalletPayment(walletPayment.sourceTxHash);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
setWalletPaymentState({ status: "ready", error: null });
|
|
985
|
+
void handleSelectOption(selectedOption);
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
const retry = async () => {
|
|
989
|
+
try {
|
|
990
|
+
await loadWalletPaymentOptions(() => false);
|
|
991
|
+
}
|
|
992
|
+
catch (error) {
|
|
993
|
+
handleWalletPaymentOptionsError(error);
|
|
994
|
+
}
|
|
995
|
+
finally {
|
|
996
|
+
setProcessing(false);
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
void retry();
|
|
1000
|
+
};
|
|
1001
|
+
const showWalletPill = account.isConnected &&
|
|
1002
|
+
Boolean(account.address) &&
|
|
1003
|
+
walletPayment.status !== "loading" &&
|
|
1004
|
+
walletPayment.status !== "failed";
|
|
1005
|
+
const walletAddressForPill = walletPayment.walletAddress ?? account.address ?? null;
|
|
1006
|
+
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
|
|
559
1007
|
? getTokenMonogram(selectedOption.fromTokenName, selectedOption.fromTokenSymbol)
|
|
560
|
-
: null }), _jsx(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
1008
|
+
: 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) => {
|
|
1009
|
+
event.stopPropagation();
|
|
1010
|
+
handleReturnToOptions();
|
|
1011
|
+
}, 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(walletAddressForPill), _jsx(WalletSwitchLink, { type: "button", onClick: handleChangeWallet, disabled: processing, "aria-label": "Switch wallet", title: "Switch wallet", children: _jsx(EditIcon, { size: 12 }) })] })] }), _jsxs(PillDetailRow, { children: [_jsx(PillDetailLabel, { children: "Route" }), _jsx(PillDetailValue, { children: selectedOption.kind === "direct"
|
|
1012
|
+
? "Direct transfer"
|
|
1013
|
+
: "Routed transfer" })] })] })) : null] })] })) : null, walletPayment.status === "failed" ? (_jsxs(ContentStage, { children: [_jsx(EmptyState, { children: _jsx(Text, { size: "sm", color: config.theme.font.color.secondary, children: walletPayment.error ||
|
|
1014
|
+
"We could not find wallet payment options right now." }) }), _jsx(StyledButton, { onClick: handleRetryWalletPayment, disabled: processing || loading.CREATE_PAYMENT_ATTEMPT, children: "Try again" }), _jsx(ModalBackButton, { view: "cryptoIntent", disabled: processing, label: "Choose another payment method" }), _jsx(StyledButton, { variant: "secondary", onClick: handleChangeWallet, disabled: processing, children: "Change wallet" })] })) : null, walletPayment.status === "loading" ? (_jsxs(ContentStage, { children: [_jsx(SectionLabel, { children: "Checking your wallet" }), _jsxs(SkeletonContainer, { children: [_jsx(SkeletonRow, {}), _jsx(SkeletonRow, { style: { opacity: 0.7 } }), _jsx(SkeletonRow, { style: { opacity: 0.4 } })] })] })) : null, walletPayment.status === "ready" ||
|
|
1015
|
+
walletPayment.status === "executing" ? (_jsx(ContentStage, { children: hasNoPaymentOptions ? (_jsxs(_Fragment, { children: [_jsxs(EmptyState, { children: [_jsxs(EmptyHeadline, { children: [_jsx(Text, { size: "base", weight: "semibold", color: config.theme.font.color.primary, children: NO_WALLET_PAYMENT_OPTIONS_TITLE }), _jsx(Text, { size: "sm", color: config.theme.font.color.secondary, children: NO_WALLET_PAYMENT_OPTIONS_DESCRIPTION })] }), unsupportedWalletAddress && !showWalletPill ? (_jsxs(Text, { size: "xs", color: config.theme.font.color.tertiary, children: [connectorName, " ", formatAddress(unsupportedWalletAddress)] })) : null] }), _jsx(ModalBackButton, { view: "cryptoIntent", disabled: processing, label: "Choose another payment method" }), _jsx(StyledButton, { variant: "secondary", onClick: handleChangeWallet, disabled: processing, children: "Change wallet" })] })) : !selectedOption ? (_jsxs(_Fragment, { children: [walletAddressForPill ? (_jsxs(ConnectedWalletRow, { children: [_jsxs(ConnectedWalletIdentity, { children: [_jsx(WalletDot, { "$iconUrl": connectorIcon, "aria-hidden": "true" }), _jsx(ConnectedWalletAddress, { children: formatAddress(walletAddressForPill) })] }), _jsx(WalletSwitchLink, { type: "button", onClick: handleChangeWallet, disabled: processing, "aria-label": "Switch wallet", title: "Switch wallet", children: _jsx(EditIcon, { size: 12 }) })] })) : null, _jsxs(SectionRow, { children: [_jsx(SectionLabel, { children: "Pay with" }), _jsx(SectionLabel, { children: "Balance" })] }), _jsx(OptionsContainer, { children: walletPayment.options.map((option) => (_jsxs(OptionCard, { type: "button", onClick: () => handlePickOption(option), "aria-pressed": walletPayment.selectedOptionId === option.id, children: [_jsxs(OptionTokenIconWrap, { children: [_jsx(OptionTokenIcon, { "$token": option.fromTokenName === "ETH" ? "ETH" : "USD", "$iconUrl": option.fromTokenIconUrl, children: !option.fromTokenIconUrl
|
|
1016
|
+
? getTokenMonogram(option.fromTokenName, option.fromTokenSymbol)
|
|
1017
|
+
: null }), option.fromChainIconUrl ? (_jsx(OptionChainBadge, { "$iconUrl": option.fromChainIconUrl })) : null] }), _jsxs(OptionIdentity, { children: [_jsx(Text, { size: "base", weight: "semibold", color: config.theme.font.color.primary, children: option.fromTokenName }), _jsxs(Text, { size: "sm", color: config.theme.font.color.secondary, children: ["On ", option.fromChainName] })] }), _jsxs(OptionBalance, { children: [_jsx(Text, { size: "base", weight: "semibold", color: config.theme.font.color.primary, children: formatTokenBalance(option.fromTokenName, option.fromAmount) ?? "0" }), option.kind === "direct" ? (_jsxs(FastBadge, { children: [_jsx("span", { children: "\u26A1" }), _jsx("span", { children: "Fast" })] })) : typeof option.estimatedDurationMinutes ===
|
|
1018
|
+
"number" ? (_jsxs(RoutedBadge, { children: ["~", option.estimatedDurationMinutes, " min"] })) : null] })] }, option.id))) }), _jsx(ModalBackButton, { view: "cryptoIntent", disabled: processing })] })) : (_jsxs(_Fragment, { children: [_jsxs(QuoteCard, { children: [_jsxs(QuoteRow, { children: [_jsx(Text, { size: "sm", color: config.theme.font.color.secondary, children: "Cost" }), _jsx(Text, { size: "base", weight: "semibold", color: config.theme.font.color.primary, children: formattedCost })] }), displayedPayAmount ? (_jsxs(QuoteRow, { children: [_jsx(Text, { size: "sm", color: config.theme.font.color.secondary, children: "You pay" }), _jsx(Text, { size: "base", weight: "semibold", color: config.theme.font.color.primary, children: displayedPayAmount })] })) : null, typeof walletPayment.quote?.estimatedDurationMinutes ===
|
|
1019
|
+
"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: ["~", walletPayment.quote.estimatedDurationMinutes, " min"] })] })) : null, walletPayment.quoteStatus === "loading" ? (_jsxs(_Fragment, { children: [_jsx(QuoteHairline, {}), _jsx(QuoteFootnote, { children: "Fetching the freshest quote\u2026" })] })) : null, walletPayment.quoteStatus === "failed" ? (_jsxs(_Fragment, { children: [_jsx(QuoteHairline, {}), _jsx(QuoteFootnoteWarn, { children: walletPayment.quoteError ||
|
|
1020
|
+
"We couldn't fetch a quote right now." })] })) : null] }), _jsx(StyledButton, { onClick: () => {
|
|
1021
|
+
if (selectedOption) {
|
|
1022
|
+
void handleSelectOption(selectedOption);
|
|
1023
|
+
}
|
|
1024
|
+
}, disabled: processing ||
|
|
1025
|
+
loading.CREATE_PAYMENT_ATTEMPT ||
|
|
1026
|
+
!selectedOption ||
|
|
1027
|
+
walletPayment.quoteStatus === "loading" ||
|
|
1028
|
+
(selectedOption.kind !== "direct" &&
|
|
1029
|
+
walletPayment.quoteStatus !== "ready"), children: executingId === selectedOption.id
|
|
1030
|
+
? "Preparing..."
|
|
1031
|
+
: walletPayment.quoteStatus === "loading"
|
|
1032
|
+
? "Fetching quote..."
|
|
1033
|
+
: `Pay with ${selectedOption.fromTokenName}` }), _jsx(StyledButton, { variant: "secondary", onClick: handleReturnToOptions, disabled: processing, children: "Back" })] })) })) : null] }));
|
|
1034
|
+
};
|
|
1035
|
+
const CryptoIntentWalletPaymentOptionsViewContent = () => {
|
|
1036
|
+
return _jsx(CryptoIntentWalletPaymentOptionsAppKitViewContent, {});
|
|
579
1037
|
};
|
|
580
1038
|
export { CryptoIntentWalletPaymentOptionsViewContent };
|
|
581
1039
|
//# sourceMappingURL=wallet-payment-options.js.map
|