@swype-org/react-sdk 0.2.224 → 0.2.232
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/index.cjs +309 -360
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +308 -361
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1616,6 +1616,93 @@ __export(api_exports, {
|
|
|
1616
1616
|
updateUserConfigBySession: () => updateUserConfigBySession,
|
|
1617
1617
|
waitForActionTransactionReceipt: () => waitForActionTransactionReceipt
|
|
1618
1618
|
});
|
|
1619
|
+
var DEBUG_BUFFER_CAPACITY = 200;
|
|
1620
|
+
var nextId = 1;
|
|
1621
|
+
var entries = [];
|
|
1622
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
1623
|
+
function notify() {
|
|
1624
|
+
for (const listener of listeners) {
|
|
1625
|
+
try {
|
|
1626
|
+
listener();
|
|
1627
|
+
} catch (err) {
|
|
1628
|
+
console.error("[blink-sdk][debug-log] listener threw:", err);
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
function appendDebug(level, message, data) {
|
|
1633
|
+
const entry = {
|
|
1634
|
+
id: nextId++,
|
|
1635
|
+
ts: Date.now(),
|
|
1636
|
+
level,
|
|
1637
|
+
message,
|
|
1638
|
+
data
|
|
1639
|
+
};
|
|
1640
|
+
const next = entries.length >= DEBUG_BUFFER_CAPACITY ? entries.slice(entries.length - DEBUG_BUFFER_CAPACITY + 1) : entries.slice();
|
|
1641
|
+
next.push(entry);
|
|
1642
|
+
entries = next;
|
|
1643
|
+
const prefix = "[blink-sdk][debug]";
|
|
1644
|
+
const sink = level === "error" ? console.error : level === "warn" ? console.warn : console.info;
|
|
1645
|
+
if (data !== void 0) {
|
|
1646
|
+
sink(`${prefix} ${message}`, data);
|
|
1647
|
+
} else {
|
|
1648
|
+
sink(`${prefix} ${message}`);
|
|
1649
|
+
}
|
|
1650
|
+
notify();
|
|
1651
|
+
}
|
|
1652
|
+
function subscribeDebug(listener) {
|
|
1653
|
+
listeners.add(listener);
|
|
1654
|
+
return () => {
|
|
1655
|
+
listeners.delete(listener);
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
function getDebugEntries() {
|
|
1659
|
+
return entries;
|
|
1660
|
+
}
|
|
1661
|
+
function clearDebugEntries() {
|
|
1662
|
+
entries = [];
|
|
1663
|
+
notify();
|
|
1664
|
+
}
|
|
1665
|
+
function useBlinkDebugLog() {
|
|
1666
|
+
return react.useSyncExternalStore(subscribeDebug, getDebugEntries, getDebugEntries);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// src/fetchWithRetry.ts
|
|
1670
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
1671
|
+
var DEFAULT_BASE_DELAY_MS = 500;
|
|
1672
|
+
var DEFAULT_MAX_JITTER_MS = 200;
|
|
1673
|
+
function isNetworkTypeError(err) {
|
|
1674
|
+
return err instanceof TypeError && /fetch|network|load failed/i.test(err.message);
|
|
1675
|
+
}
|
|
1676
|
+
async function fetchWithRetry(input, init, options) {
|
|
1677
|
+
const maxRetries = DEFAULT_MAX_RETRIES;
|
|
1678
|
+
const baseDelayMs = DEFAULT_BASE_DELAY_MS;
|
|
1679
|
+
const maxJitterMs = DEFAULT_MAX_JITTER_MS;
|
|
1680
|
+
const label = String(input).replace(/https?:\/\/[^/]+/, "");
|
|
1681
|
+
let lastError;
|
|
1682
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
1683
|
+
try {
|
|
1684
|
+
return await fetch(input, init);
|
|
1685
|
+
} catch (err) {
|
|
1686
|
+
lastError = err;
|
|
1687
|
+
if (!isNetworkTypeError(err)) {
|
|
1688
|
+
throw err;
|
|
1689
|
+
}
|
|
1690
|
+
if (attempt < maxRetries) {
|
|
1691
|
+
const delay = baseDelayMs * Math.pow(2, attempt) + Math.random() * maxJitterMs;
|
|
1692
|
+
appendDebug("warn", `fetchWithRetry: network error, retrying ${label}`, {
|
|
1693
|
+
attempt: attempt + 1,
|
|
1694
|
+
maxRetries,
|
|
1695
|
+
delayMs: Math.round(delay),
|
|
1696
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1697
|
+
});
|
|
1698
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
throw lastError;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
// src/api.ts
|
|
1619
1706
|
async function throwApiError(res) {
|
|
1620
1707
|
const body = await res.json().catch(() => null);
|
|
1621
1708
|
const detail = body?.error ?? body;
|
|
@@ -1628,13 +1715,13 @@ async function fetchProviders(apiBaseUrl, token) {
|
|
|
1628
1715
|
if (token) {
|
|
1629
1716
|
headers.Authorization = `Bearer ${token}`;
|
|
1630
1717
|
}
|
|
1631
|
-
const res = await
|
|
1718
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/providers`, { headers });
|
|
1632
1719
|
if (!res.ok) await throwApiError(res);
|
|
1633
1720
|
const data = await res.json();
|
|
1634
1721
|
return data.items;
|
|
1635
1722
|
}
|
|
1636
1723
|
async function fetchChains(apiBaseUrl, token) {
|
|
1637
|
-
const res = await
|
|
1724
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/chains`, {
|
|
1638
1725
|
headers: { Authorization: `Bearer ${token}` }
|
|
1639
1726
|
});
|
|
1640
1727
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1643,7 +1730,7 @@ async function fetchChains(apiBaseUrl, token) {
|
|
|
1643
1730
|
}
|
|
1644
1731
|
async function fetchAccounts(apiBaseUrl, token, credentialId) {
|
|
1645
1732
|
const params = new URLSearchParams({ credentialId });
|
|
1646
|
-
const res = await
|
|
1733
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/accounts?${params.toString()}`, {
|
|
1647
1734
|
headers: { Authorization: `Bearer ${token}` }
|
|
1648
1735
|
});
|
|
1649
1736
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1652,7 +1739,7 @@ async function fetchAccounts(apiBaseUrl, token, credentialId) {
|
|
|
1652
1739
|
}
|
|
1653
1740
|
async function fetchAccount(apiBaseUrl, token, accountId, credentialId) {
|
|
1654
1741
|
const params = new URLSearchParams({ credentialId });
|
|
1655
|
-
const res = await
|
|
1742
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/accounts/${accountId}?${params.toString()}`, {
|
|
1656
1743
|
headers: { Authorization: `Bearer ${token}` }
|
|
1657
1744
|
});
|
|
1658
1745
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1794,7 +1881,7 @@ async function postTransferQuote(apiBaseUrl, bearerToken, params) {
|
|
|
1794
1881
|
return await res.json();
|
|
1795
1882
|
}
|
|
1796
1883
|
async function fetchMerchantPublicKey(apiBaseUrl, merchantId) {
|
|
1797
|
-
const res = await
|
|
1884
|
+
const res = await fetchWithRetry(
|
|
1798
1885
|
`${apiBaseUrl}/v1/merchants/${encodeURIComponent(merchantId)}/public-key`
|
|
1799
1886
|
);
|
|
1800
1887
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1804,7 +1891,7 @@ async function fetchTransfer(apiBaseUrl, token, transferId, authorizationSession
|
|
|
1804
1891
|
if (!token && !authorizationSessionToken) {
|
|
1805
1892
|
throw new Error("Missing auth credentials for transfer fetch.");
|
|
1806
1893
|
}
|
|
1807
|
-
const res = await
|
|
1894
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/transfers/${transferId}`, {
|
|
1808
1895
|
headers: {
|
|
1809
1896
|
...token ? { Authorization: `Bearer ${token}` } : {},
|
|
1810
1897
|
...authorizationSessionToken ? { "x-authorization-session-token": authorizationSessionToken } : {}
|
|
@@ -1832,14 +1919,14 @@ async function signTransfer(apiBaseUrl, token, transferId, signedTransfer, autho
|
|
|
1832
1919
|
return await res.json();
|
|
1833
1920
|
}
|
|
1834
1921
|
async function fetchAuthorizationSession(apiBaseUrl, sessionId) {
|
|
1835
|
-
const res = await
|
|
1922
|
+
const res = await fetchWithRetry(
|
|
1836
1923
|
`${apiBaseUrl}/v1/authorization-sessions/${sessionId}`
|
|
1837
1924
|
);
|
|
1838
1925
|
if (!res.ok) await throwApiError(res);
|
|
1839
1926
|
return await res.json();
|
|
1840
1927
|
}
|
|
1841
1928
|
async function fetchAuthorizationSessionByToken(apiBaseUrl, token) {
|
|
1842
|
-
const res = await
|
|
1929
|
+
const res = await fetchWithRetry(
|
|
1843
1930
|
`${apiBaseUrl}/v1/authorization-sessions?token=${encodeURIComponent(token)}`
|
|
1844
1931
|
);
|
|
1845
1932
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1857,7 +1944,7 @@ async function registerPasskey(apiBaseUrl, token, credentialId, publicKey) {
|
|
|
1857
1944
|
if (!res.ok) await throwApiError(res);
|
|
1858
1945
|
}
|
|
1859
1946
|
async function reportPasskeyActivity(apiBaseUrl, token, credentialId) {
|
|
1860
|
-
const res = await
|
|
1947
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/users/config/passkey`, {
|
|
1861
1948
|
method: "PATCH",
|
|
1862
1949
|
headers: {
|
|
1863
1950
|
"Content-Type": "application/json",
|
|
@@ -1868,7 +1955,7 @@ async function reportPasskeyActivity(apiBaseUrl, token, credentialId) {
|
|
|
1868
1955
|
if (!res.ok) await throwApiError(res);
|
|
1869
1956
|
}
|
|
1870
1957
|
async function fetchUserConfig(apiBaseUrl, token) {
|
|
1871
|
-
const res = await
|
|
1958
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/users/config`, {
|
|
1872
1959
|
headers: { Authorization: `Bearer ${token}` }
|
|
1873
1960
|
});
|
|
1874
1961
|
if (!res.ok) await throwApiError(res);
|
|
@@ -1940,12 +2027,12 @@ async function createManualTransfer(apiBaseUrl, params) {
|
|
|
1940
2027
|
return await res.json();
|
|
1941
2028
|
}
|
|
1942
2029
|
async function fetchManualTransferSession(apiBaseUrl, sessionId) {
|
|
1943
|
-
const res = await
|
|
2030
|
+
const res = await fetchWithRetry(`${apiBaseUrl}/v1/manual-transfers/${sessionId}`);
|
|
1944
2031
|
if (!res.ok) await throwApiError(res);
|
|
1945
2032
|
return await res.json();
|
|
1946
2033
|
}
|
|
1947
2034
|
async function reportActionCompletion(apiBaseUrl, actionId, result) {
|
|
1948
|
-
const res = await
|
|
2035
|
+
const res = await fetchWithRetry(
|
|
1949
2036
|
`${apiBaseUrl}/v1/authorization-actions/${actionId}`,
|
|
1950
2037
|
{
|
|
1951
2038
|
method: "PATCH",
|
|
@@ -1969,7 +2056,7 @@ async function waitForActionTransactionReceipt(apiBaseUrl, actionId, txHash) {
|
|
|
1969
2056
|
return await res.json();
|
|
1970
2057
|
}
|
|
1971
2058
|
async function probeActionCompletion(apiBaseUrl, actionId) {
|
|
1972
|
-
const res = await
|
|
2059
|
+
const res = await fetchWithRetry(
|
|
1973
2060
|
`${apiBaseUrl}/v1/authorization-actions/${actionId}`,
|
|
1974
2061
|
{
|
|
1975
2062
|
method: "PATCH",
|
|
@@ -2809,55 +2896,6 @@ async function pollWalletCallsStatus(walletClient, callsId, options = {}) {
|
|
|
2809
2896
|
`Batch transaction did not confirm within ${maxAttempts * pollIntervalMs}ms. Last wallet status: ${lastStatusStr}. Please try again.`
|
|
2810
2897
|
);
|
|
2811
2898
|
}
|
|
2812
|
-
var DEBUG_BUFFER_CAPACITY = 200;
|
|
2813
|
-
var nextId = 1;
|
|
2814
|
-
var entries = [];
|
|
2815
|
-
var listeners = /* @__PURE__ */ new Set();
|
|
2816
|
-
function notify() {
|
|
2817
|
-
for (const listener of listeners) {
|
|
2818
|
-
try {
|
|
2819
|
-
listener();
|
|
2820
|
-
} catch (err) {
|
|
2821
|
-
console.error("[blink-sdk][debug-log] listener threw:", err);
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
function appendDebug(level, message, data) {
|
|
2826
|
-
const entry = {
|
|
2827
|
-
id: nextId++,
|
|
2828
|
-
ts: Date.now(),
|
|
2829
|
-
level,
|
|
2830
|
-
message,
|
|
2831
|
-
data
|
|
2832
|
-
};
|
|
2833
|
-
const next = entries.length >= DEBUG_BUFFER_CAPACITY ? entries.slice(entries.length - DEBUG_BUFFER_CAPACITY + 1) : entries.slice();
|
|
2834
|
-
next.push(entry);
|
|
2835
|
-
entries = next;
|
|
2836
|
-
const prefix = "[blink-sdk][debug]";
|
|
2837
|
-
const sink = level === "error" ? console.error : level === "warn" ? console.warn : console.info;
|
|
2838
|
-
if (data !== void 0) {
|
|
2839
|
-
sink(`${prefix} ${message}`, data);
|
|
2840
|
-
} else {
|
|
2841
|
-
sink(`${prefix} ${message}`);
|
|
2842
|
-
}
|
|
2843
|
-
notify();
|
|
2844
|
-
}
|
|
2845
|
-
function subscribeDebug(listener) {
|
|
2846
|
-
listeners.add(listener);
|
|
2847
|
-
return () => {
|
|
2848
|
-
listeners.delete(listener);
|
|
2849
|
-
};
|
|
2850
|
-
}
|
|
2851
|
-
function getDebugEntries() {
|
|
2852
|
-
return entries;
|
|
2853
|
-
}
|
|
2854
|
-
function clearDebugEntries() {
|
|
2855
|
-
entries = [];
|
|
2856
|
-
notify();
|
|
2857
|
-
}
|
|
2858
|
-
function useBlinkDebugLog() {
|
|
2859
|
-
return react.useSyncExternalStore(subscribeDebug, getDebugEntries, getDebugEntries);
|
|
2860
|
-
}
|
|
2861
2899
|
|
|
2862
2900
|
// src/withWatchdog.ts
|
|
2863
2901
|
var DEFAULT_WATCHDOG_INTERVAL_MS = 2e4;
|
|
@@ -3560,6 +3598,10 @@ function advanceTrackedEvmNonce(nonceTracker, trackerKey, nextNonce) {
|
|
|
3560
3598
|
nonceTracker.set(trackerKey, current == null ? nextNonce : Math.max(current, nextNonce));
|
|
3561
3599
|
}
|
|
3562
3600
|
async function waitForWalletClient(wagmiConfig, params = {}) {
|
|
3601
|
+
const initialAccount = core.getAccount(wagmiConfig);
|
|
3602
|
+
if (!initialAccount.isConnected) {
|
|
3603
|
+
await core.reconnect(wagmiConfig).catch(() => []);
|
|
3604
|
+
}
|
|
3563
3605
|
for (let i = 0; i < WALLET_CLIENT_MAX_ATTEMPTS; i++) {
|
|
3564
3606
|
try {
|
|
3565
3607
|
const account = core.getAccount(wagmiConfig);
|
|
@@ -6153,7 +6195,7 @@ function assertLinkedTransferBridgeExecuted(params) {
|
|
|
6153
6195
|
`Transfer session ${transferSessionId} has no EXECUTE_BRIDGE action. The bridge transaction was never presented to the wallet.`
|
|
6154
6196
|
);
|
|
6155
6197
|
}
|
|
6156
|
-
if (!completedIds.has(bridgeAction.id)) {
|
|
6198
|
+
if (!completedIds.has(bridgeAction.id) && bridgeAction.status !== "COMPLETED") {
|
|
6157
6199
|
throw new Error(
|
|
6158
6200
|
`Deposit flow finished without executing the bridge transaction (action ${bridgeAction.id} on session ${transferSessionId}).`
|
|
6159
6201
|
);
|
|
@@ -6161,6 +6203,47 @@ function assertLinkedTransferBridgeExecuted(params) {
|
|
|
6161
6203
|
}
|
|
6162
6204
|
}
|
|
6163
6205
|
|
|
6206
|
+
// src/authorizationOrchestratorOrdering.ts
|
|
6207
|
+
function getPendingActions2(session, completedIds) {
|
|
6208
|
+
return session.actions.filter((a) => a.status === "PENDING" && !completedIds.has(a.id)).sort((a, b) => a.orderIndex - b.orderIndex);
|
|
6209
|
+
}
|
|
6210
|
+
function isSvmSetupAction(action) {
|
|
6211
|
+
if (action.type === "APPROVE_SPL") {
|
|
6212
|
+
return true;
|
|
6213
|
+
}
|
|
6214
|
+
return action.type === "OPEN_PROVIDER" && action.metadata?.chainFamily === "svm";
|
|
6215
|
+
}
|
|
6216
|
+
function isSvmTransferBridgeAction(action) {
|
|
6217
|
+
return action.type === "EXECUTE_BRIDGE" && action.metadata?.chainFamily === "svm";
|
|
6218
|
+
}
|
|
6219
|
+
function isEvmBridgeAction(action) {
|
|
6220
|
+
return action.type === "EXECUTE_BRIDGE" && action.metadata?.chainFamily !== "svm";
|
|
6221
|
+
}
|
|
6222
|
+
function isEvmAccountAction(action) {
|
|
6223
|
+
return action.type === "SIGN_PERMIT2" || action.type === "APPROVE_PERMIT2";
|
|
6224
|
+
}
|
|
6225
|
+
function getMergedPending(sessions, completedIds) {
|
|
6226
|
+
const allActions = [];
|
|
6227
|
+
for (const { session } of sessions) {
|
|
6228
|
+
allActions.push(...getPendingActions2(session, completedIds));
|
|
6229
|
+
}
|
|
6230
|
+
const hasPendingSvmSetupAction = allActions.some((action) => isSvmSetupAction(action));
|
|
6231
|
+
const hasPendingEvmAccountAction = allActions.some((action) => isEvmAccountAction(action));
|
|
6232
|
+
return allActions.sort((a, b) => {
|
|
6233
|
+
const leftIsDeferredSvmBridge = hasPendingSvmSetupAction && isSvmTransferBridgeAction(a);
|
|
6234
|
+
const rightIsDeferredSvmBridge = hasPendingSvmSetupAction && isSvmTransferBridgeAction(b);
|
|
6235
|
+
if (leftIsDeferredSvmBridge !== rightIsDeferredSvmBridge) {
|
|
6236
|
+
return leftIsDeferredSvmBridge ? 1 : -1;
|
|
6237
|
+
}
|
|
6238
|
+
const leftIsDeferredEvmBridge = hasPendingEvmAccountAction && isEvmBridgeAction(a);
|
|
6239
|
+
const rightIsDeferredEvmBridge = hasPendingEvmAccountAction && isEvmBridgeAction(b);
|
|
6240
|
+
if (leftIsDeferredEvmBridge !== rightIsDeferredEvmBridge) {
|
|
6241
|
+
return leftIsDeferredEvmBridge ? 1 : -1;
|
|
6242
|
+
}
|
|
6243
|
+
return a.orderIndex - b.orderIndex;
|
|
6244
|
+
});
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6164
6247
|
// src/hooks/useAuthorizationOrchestrator.ts
|
|
6165
6248
|
var ACTION_POLL_INTERVAL_MS2 = 500;
|
|
6166
6249
|
var ACTION_POLL_MAX_RETRIES2 = 20;
|
|
@@ -6174,6 +6257,7 @@ function useAuthorizationOrchestrator(deps) {
|
|
|
6174
6257
|
const { authExecutor } = deps;
|
|
6175
6258
|
const pendingSessionIdsRef = react.useRef([]);
|
|
6176
6259
|
const lastRunRef = react.useRef(null);
|
|
6260
|
+
const inflightRunRef = react.useRef(null);
|
|
6177
6261
|
const [pendingSelectSourceAction, setPendingSelectSourceAction] = react.useState(null);
|
|
6178
6262
|
const [pendingOneTapAction, setPendingOneTapAction] = react.useState(null);
|
|
6179
6263
|
const [orchestratorCompleted, setOrchestratorCompleted] = react.useState(false);
|
|
@@ -6249,7 +6333,7 @@ function useAuthorizationOrchestrator(deps) {
|
|
|
6249
6333
|
}
|
|
6250
6334
|
oneTapPauseRequestedRef.current = false;
|
|
6251
6335
|
}, []);
|
|
6252
|
-
const
|
|
6336
|
+
const runInternal = react.useCallback(
|
|
6253
6337
|
async (sessionId, options) => {
|
|
6254
6338
|
const apiBaseUrl = resolvedApiBaseUrl;
|
|
6255
6339
|
if (!apiBaseUrl) {
|
|
@@ -6881,6 +6965,21 @@ function useAuthorizationOrchestrator(deps) {
|
|
|
6881
6965
|
},
|
|
6882
6966
|
[resolvedApiBaseUrl, authExecutor, waitForOneTapPause, waitForSourceSelection]
|
|
6883
6967
|
);
|
|
6968
|
+
const run = react.useCallback(
|
|
6969
|
+
(sessionId, options) => {
|
|
6970
|
+
const promise = runInternal(sessionId, options);
|
|
6971
|
+
if (inflightRunRef.current === null) {
|
|
6972
|
+
inflightRunRef.current = promise;
|
|
6973
|
+
void promise.finally(() => {
|
|
6974
|
+
if (inflightRunRef.current === promise) {
|
|
6975
|
+
inflightRunRef.current = null;
|
|
6976
|
+
}
|
|
6977
|
+
});
|
|
6978
|
+
}
|
|
6979
|
+
return promise;
|
|
6980
|
+
},
|
|
6981
|
+
[runInternal]
|
|
6982
|
+
);
|
|
6884
6983
|
const restart = react.useCallback(async () => {
|
|
6885
6984
|
const lastRun = lastRunRef.current;
|
|
6886
6985
|
if (!lastRun) {
|
|
@@ -6889,12 +6988,20 @@ function useAuthorizationOrchestrator(deps) {
|
|
|
6889
6988
|
appendDebug("info", "orchestrator:restart", {
|
|
6890
6989
|
sessionId: lastRun.sessionId
|
|
6891
6990
|
});
|
|
6991
|
+
const inflight = inflightRunRef.current;
|
|
6992
|
+
if (inflight) {
|
|
6993
|
+
cancelPendingFlow();
|
|
6994
|
+
try {
|
|
6995
|
+
await inflight;
|
|
6996
|
+
} catch {
|
|
6997
|
+
}
|
|
6998
|
+
}
|
|
6892
6999
|
authExecutor.setError(null);
|
|
6893
7000
|
return run(lastRun.sessionId, {
|
|
6894
7001
|
...lastRun.options,
|
|
6895
7002
|
probeBeforePrompt: true
|
|
6896
7003
|
});
|
|
6897
|
-
}, [authExecutor, run]);
|
|
7004
|
+
}, [authExecutor, run, cancelPendingFlow]);
|
|
6898
7005
|
return {
|
|
6899
7006
|
run,
|
|
6900
7007
|
restart,
|
|
@@ -6984,30 +7091,6 @@ async function waitForBatchableActionsReady(options) {
|
|
|
6984
7091
|
}
|
|
6985
7092
|
return batchable.map((action) => updatedActions.get(action.id) ?? action);
|
|
6986
7093
|
}
|
|
6987
|
-
function getMergedPending(sessions, completedIds) {
|
|
6988
|
-
const allActions = [];
|
|
6989
|
-
for (const { session } of sessions) {
|
|
6990
|
-
allActions.push(...getPendingActions(session, completedIds));
|
|
6991
|
-
}
|
|
6992
|
-
const hasPendingSvmSetupAction = allActions.some((action) => isSvmSetupAction(action));
|
|
6993
|
-
return allActions.sort((a, b) => {
|
|
6994
|
-
const leftIsDeferredSvmBridge = hasPendingSvmSetupAction && isSvmTransferBridgeAction(a);
|
|
6995
|
-
const rightIsDeferredSvmBridge = hasPendingSvmSetupAction && isSvmTransferBridgeAction(b);
|
|
6996
|
-
if (leftIsDeferredSvmBridge !== rightIsDeferredSvmBridge) {
|
|
6997
|
-
return leftIsDeferredSvmBridge ? 1 : -1;
|
|
6998
|
-
}
|
|
6999
|
-
return a.orderIndex - b.orderIndex;
|
|
7000
|
-
});
|
|
7001
|
-
}
|
|
7002
|
-
function isSvmSetupAction(action) {
|
|
7003
|
-
if (action.type === "APPROVE_SPL") {
|
|
7004
|
-
return true;
|
|
7005
|
-
}
|
|
7006
|
-
return action.type === "OPEN_PROVIDER" && action.metadata?.chainFamily === "svm";
|
|
7007
|
-
}
|
|
7008
|
-
function isSvmTransferBridgeAction(action) {
|
|
7009
|
-
return action.type === "EXECUTE_BRIDGE" && action.metadata?.chainFamily === "svm";
|
|
7010
|
-
}
|
|
7011
7094
|
function getWalletConnectRuntimeKeyForAction(action, ownerSessionId, sessions) {
|
|
7012
7095
|
const metadataKey = action?.metadata?.walletConnectAccountId;
|
|
7013
7096
|
if (typeof metadataKey === "string" && metadataKey.length > 0) {
|
|
@@ -7536,6 +7619,7 @@ function createInitialState(config) {
|
|
|
7536
7619
|
loginRequested: false,
|
|
7537
7620
|
standardDesktopInlineOpenWallet: false,
|
|
7538
7621
|
desktopWait: null,
|
|
7622
|
+
setupAuthorizationSessionId: null,
|
|
7539
7623
|
mobileTokenAuthorizationPending: false,
|
|
7540
7624
|
privyReady: false,
|
|
7541
7625
|
privyAuthenticated: false,
|
|
@@ -7580,6 +7664,7 @@ function clearAuthenticatedSessionState(state) {
|
|
|
7580
7664
|
loginRequested: false,
|
|
7581
7665
|
standardDesktopInlineOpenWallet: false,
|
|
7582
7666
|
desktopWait: null,
|
|
7667
|
+
setupAuthorizationSessionId: null,
|
|
7583
7668
|
mobileTokenAuthorizationPending: false,
|
|
7584
7669
|
setupDepositAmount: null,
|
|
7585
7670
|
setupDepositToken: null,
|
|
@@ -7775,14 +7860,15 @@ function applyAction(state, action) {
|
|
|
7775
7860
|
case "TRANSFER_CREATED":
|
|
7776
7861
|
return { ...state, transfer: action.transfer, pendingTransferId: null };
|
|
7777
7862
|
case "TRANSFER_SIGNED":
|
|
7778
|
-
return { ...state, transfer: action.transfer };
|
|
7863
|
+
return { ...state, transfer: action.transfer, setupAuthorizationSessionId: null };
|
|
7779
7864
|
case "TRANSFER_COMPLETED":
|
|
7780
7865
|
return {
|
|
7781
7866
|
...state,
|
|
7782
7867
|
transfer: action.transfer,
|
|
7783
7868
|
pendingTransferId: null,
|
|
7784
7869
|
mobileFlow: false,
|
|
7785
|
-
deeplinkUri: null
|
|
7870
|
+
deeplinkUri: null,
|
|
7871
|
+
setupAuthorizationSessionId: null
|
|
7786
7872
|
};
|
|
7787
7873
|
case "TRANSFER_FAILED":
|
|
7788
7874
|
return {
|
|
@@ -7828,7 +7914,8 @@ function applyAction(state, action) {
|
|
|
7828
7914
|
deeplinkUri: null,
|
|
7829
7915
|
mobileTokenAuthorizationPending: false,
|
|
7830
7916
|
guestWalletPrepared: null,
|
|
7831
|
-
guestWalletDeeplinksPreparing: false
|
|
7917
|
+
guestWalletDeeplinksPreparing: false,
|
|
7918
|
+
setupAuthorizationSessionId: null
|
|
7832
7919
|
};
|
|
7833
7920
|
case "MOBILE_SIGN_READY":
|
|
7834
7921
|
return {
|
|
@@ -7949,6 +8036,10 @@ function applyAction(state, action) {
|
|
|
7949
8036
|
walletName: action.walletName,
|
|
7950
8037
|
walletLogoUrl: action.walletLogoUrl
|
|
7951
8038
|
},
|
|
8039
|
+
// Mirror sessionId into the longer-lived slice so the wallet
|
|
8040
|
+
// account switch listener stays armed after `desktopWait` is
|
|
8041
|
+
// cleared by the inline-connect effect.
|
|
8042
|
+
setupAuthorizationSessionId: action.sessionId,
|
|
7952
8043
|
standardDesktopInlineOpenWallet: true
|
|
7953
8044
|
};
|
|
7954
8045
|
case "DESKTOP_WAIT_CLEARED":
|
|
@@ -7978,6 +8069,7 @@ function applyAction(state, action) {
|
|
|
7978
8069
|
oneTapLimitSavedDuringSetup: false,
|
|
7979
8070
|
standardDesktopInlineOpenWallet: false,
|
|
7980
8071
|
desktopWait: null,
|
|
8072
|
+
setupAuthorizationSessionId: null,
|
|
7981
8073
|
savedSelection: null,
|
|
7982
8074
|
setupDepositAmount: null,
|
|
7983
8075
|
setupDepositToken: null,
|
|
@@ -10975,10 +11067,7 @@ function DepositOptionsScreen({
|
|
|
10975
11067
|
name: "Connect Wallet",
|
|
10976
11068
|
icon: /* @__PURE__ */ jsxRuntime.jsx(WalletIcon, { color: tokens.text }),
|
|
10977
11069
|
onClick: onFromWallet,
|
|
10978
|
-
right: /* @__PURE__ */ jsxRuntime.
|
|
10979
|
-
/* @__PURE__ */ jsxRuntime.jsx(RecommendedBadge, { tokens }),
|
|
10980
|
-
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 6l6 6-6 6", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
10981
|
-
] })
|
|
11070
|
+
right: /* @__PURE__ */ jsxRuntime.jsx("span", { style: badgeWithArrowStyle, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 6l6 6-6 6", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
10982
11071
|
}
|
|
10983
11072
|
),
|
|
10984
11073
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11011,9 +11100,6 @@ function DepositTypeToggle({ tokens }) {
|
|
|
11011
11100
|
function ComingSoonBadge({ tokens }) {
|
|
11012
11101
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: comingSoonBadgeStyle(tokens.bgRecessed, tokens.textMuted), children: "Coming soon" });
|
|
11013
11102
|
}
|
|
11014
|
-
function RecommendedBadge({ tokens }) {
|
|
11015
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: recommendedBadgeStyle(tokens.successBg, tokens.success), children: "Recommended" });
|
|
11016
|
-
}
|
|
11017
11103
|
function WalletIcon({ color }) {
|
|
11018
11104
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
11019
11105
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11174,19 +11260,6 @@ var badgeWithArrowStyle = {
|
|
|
11174
11260
|
display: "flex",
|
|
11175
11261
|
alignItems: "center"
|
|
11176
11262
|
};
|
|
11177
|
-
var recommendedBadgeStyle = (bg, color) => ({
|
|
11178
|
-
display: "inline-flex",
|
|
11179
|
-
alignItems: "center",
|
|
11180
|
-
justifyContent: "center",
|
|
11181
|
-
background: bg,
|
|
11182
|
-
color,
|
|
11183
|
-
fontSize: 10,
|
|
11184
|
-
fontWeight: 500,
|
|
11185
|
-
lineHeight: 1,
|
|
11186
|
-
padding: "4px 8px",
|
|
11187
|
-
borderRadius: 8,
|
|
11188
|
-
whiteSpace: "nowrap"
|
|
11189
|
-
});
|
|
11190
11263
|
var linkIconImageStyle = (color) => ({
|
|
11191
11264
|
width: 24,
|
|
11192
11265
|
height: 24,
|
|
@@ -11318,7 +11391,7 @@ function AmountTooLowScreen({
|
|
|
11318
11391
|
}
|
|
11319
11392
|
);
|
|
11320
11393
|
}
|
|
11321
|
-
var DEFAULT_PRESETS = [
|
|
11394
|
+
var DEFAULT_PRESETS = [5, 25, 100, 250];
|
|
11322
11395
|
function EnterAmountScreen({
|
|
11323
11396
|
value,
|
|
11324
11397
|
onDigit,
|
|
@@ -11895,7 +11968,7 @@ function PasskeyPopupWelcomeScreen({
|
|
|
11895
11968
|
) }),
|
|
11896
11969
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Try the better way\nto deposit" }),
|
|
11897
11970
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: "From your wallet, to any app, in one tap." }),
|
|
11898
|
-
error &&
|
|
11971
|
+
error && false
|
|
11899
11972
|
] })
|
|
11900
11973
|
]
|
|
11901
11974
|
}
|
|
@@ -11951,17 +12024,6 @@ var footerButtonStyle = {
|
|
|
11951
12024
|
paddingTop: 48,
|
|
11952
12025
|
paddingBottom: 36
|
|
11953
12026
|
};
|
|
11954
|
-
var errorBannerStyle3 = (tokens) => ({
|
|
11955
|
-
background: tokens.errorBg,
|
|
11956
|
-
border: `1px solid ${tokens.error}66`,
|
|
11957
|
-
borderRadius: 16,
|
|
11958
|
-
padding: "11px 14px",
|
|
11959
|
-
color: tokens.error,
|
|
11960
|
-
fontSize: "0.84rem",
|
|
11961
|
-
lineHeight: 1.5,
|
|
11962
|
-
width: "100%",
|
|
11963
|
-
textAlign: "left"
|
|
11964
|
-
});
|
|
11965
12027
|
function PasskeyReadyScreen({
|
|
11966
12028
|
onLinkWallet,
|
|
11967
12029
|
onBack,
|
|
@@ -12065,7 +12127,7 @@ function VerifyPasskeyScreen({
|
|
|
12065
12127
|
] }) }),
|
|
12066
12128
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle7(tokens.text), children: "Verify your passkey" }),
|
|
12067
12129
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textSecondary), children: subtitle }),
|
|
12068
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
12130
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle3(tokens), children: error }),
|
|
12069
12131
|
/* @__PURE__ */ jsxRuntime.jsx(InfoBanner, { children: "Your passkey is stored securely on your device. Blink never sees your biometric data." })
|
|
12070
12132
|
] })
|
|
12071
12133
|
]
|
|
@@ -12094,7 +12156,7 @@ var subtitleStyle5 = (color) => ({
|
|
|
12094
12156
|
lineHeight: 1.5,
|
|
12095
12157
|
maxWidth: 280
|
|
12096
12158
|
});
|
|
12097
|
-
var
|
|
12159
|
+
var errorBannerStyle3 = (tokens) => ({
|
|
12098
12160
|
background: tokens.errorBg,
|
|
12099
12161
|
border: `1px solid ${tokens.error}66`,
|
|
12100
12162
|
borderRadius: 16,
|
|
@@ -12448,7 +12510,7 @@ function WalletPickerScreen({
|
|
|
12448
12510
|
}
|
|
12449
12511
|
),
|
|
12450
12512
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { style: titleStyle3(tokens.text), children: "Link wallet" }),
|
|
12451
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
12513
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle4(tokens), children: error }),
|
|
12452
12514
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: sheetStackStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: cardStyle2(tokens.bgCardTranslucent), children: showOtherWallets ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12453
12515
|
OtherWalletsPanel,
|
|
12454
12516
|
{
|
|
@@ -12759,7 +12821,7 @@ var loadingWrapperStyle = {
|
|
|
12759
12821
|
alignItems: "center",
|
|
12760
12822
|
justifyContent: "center"
|
|
12761
12823
|
};
|
|
12762
|
-
var
|
|
12824
|
+
var errorBannerStyle4 = (tokens) => ({
|
|
12763
12825
|
background: tokens.errorBg,
|
|
12764
12826
|
border: `1px solid ${tokens.error}66`,
|
|
12765
12827
|
borderRadius: 16,
|
|
@@ -12916,7 +12978,7 @@ function SetupScreen({
|
|
|
12916
12978
|
),
|
|
12917
12979
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle8(tokens.text), children: "Next time deposit\nUSDC in one tap" }),
|
|
12918
12980
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle6(tokens.textSecondary), children: "Set a cap for passkey deposits.\nYou always stay in control." }),
|
|
12919
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
12981
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle5(tokens), children: error }),
|
|
12920
12982
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: chipsRowStyle, children: PRESETS.map(({ label, value }) => {
|
|
12921
12983
|
const active = selectedPreset === value;
|
|
12922
12984
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13006,7 +13068,7 @@ var chipStyle = (themeTokens, active) => ({
|
|
|
13006
13068
|
color: active ? themeTokens.accentText : themeTokens.text,
|
|
13007
13069
|
whiteSpace: "nowrap"
|
|
13008
13070
|
});
|
|
13009
|
-
var
|
|
13071
|
+
var errorBannerStyle5 = (themeTokens) => ({
|
|
13010
13072
|
background: themeTokens.errorBg,
|
|
13011
13073
|
border: `1px solid ${themeTokens.error}66`,
|
|
13012
13074
|
borderRadius: 16,
|
|
@@ -13017,217 +13079,6 @@ var errorBannerStyle6 = (themeTokens) => ({
|
|
|
13017
13079
|
width: "100%",
|
|
13018
13080
|
textAlign: "left"
|
|
13019
13081
|
});
|
|
13020
|
-
function ManualTransferPasskeyScreen({
|
|
13021
|
-
onCreatePasskey,
|
|
13022
|
-
loading = false,
|
|
13023
|
-
error,
|
|
13024
|
-
onBack,
|
|
13025
|
-
onClose
|
|
13026
|
-
}) {
|
|
13027
|
-
const { tokens } = useBlinkConfig();
|
|
13028
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle8(tokens), children: [
|
|
13029
|
-
onBack && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13030
|
-
"button",
|
|
13031
|
-
{
|
|
13032
|
-
type: "button",
|
|
13033
|
-
onClick: onBack,
|
|
13034
|
-
"aria-label": "Go back",
|
|
13035
|
-
style: { ...navButtonStyle(tokens.bgRecessed, tokens.text), left: 16 },
|
|
13036
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13037
|
-
"path",
|
|
13038
|
-
{
|
|
13039
|
-
d: "M15 18l-6-6 6-6",
|
|
13040
|
-
stroke: "currentColor",
|
|
13041
|
-
strokeWidth: "2",
|
|
13042
|
-
strokeLinecap: "round",
|
|
13043
|
-
strokeLinejoin: "round"
|
|
13044
|
-
}
|
|
13045
|
-
) })
|
|
13046
|
-
}
|
|
13047
|
-
),
|
|
13048
|
-
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13049
|
-
"button",
|
|
13050
|
-
{
|
|
13051
|
-
type: "button",
|
|
13052
|
-
onClick: onClose,
|
|
13053
|
-
"aria-label": "Close",
|
|
13054
|
-
style: { ...navButtonStyle(tokens.bgRecessed, tokens.text), right: 16 },
|
|
13055
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13056
|
-
"path",
|
|
13057
|
-
{
|
|
13058
|
-
d: "M6 6l12 12M18 6L6 18",
|
|
13059
|
-
stroke: "currentColor",
|
|
13060
|
-
strokeWidth: "2",
|
|
13061
|
-
strokeLinecap: "round",
|
|
13062
|
-
strokeLinejoin: "round"
|
|
13063
|
-
}
|
|
13064
|
-
) })
|
|
13065
|
-
}
|
|
13066
|
-
),
|
|
13067
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle11, children: [
|
|
13068
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: heroStyle, children: [
|
|
13069
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13070
|
-
"img",
|
|
13071
|
-
{
|
|
13072
|
-
src: FACE_ID_ILLUSTRATION,
|
|
13073
|
-
alt: "",
|
|
13074
|
-
"aria-hidden": "true",
|
|
13075
|
-
style: illustrationStyle4
|
|
13076
|
-
}
|
|
13077
|
-
),
|
|
13078
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: copyStackStyle, children: [
|
|
13079
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle9(tokens.text), children: "Next time deposit USDC\nin one tap" }),
|
|
13080
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle7(tokens.text), children: "Set up once and never bother\nwith QR codes again" }),
|
|
13081
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle7(tokens), children: error })
|
|
13082
|
-
] })
|
|
13083
|
-
] }),
|
|
13084
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
13085
|
-
"button",
|
|
13086
|
-
{
|
|
13087
|
-
type: "button",
|
|
13088
|
-
onClick: onCreatePasskey,
|
|
13089
|
-
disabled: loading,
|
|
13090
|
-
style: ctaStyle(tokens, loading),
|
|
13091
|
-
children: [
|
|
13092
|
-
!loading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
13093
|
-
"img",
|
|
13094
|
-
{
|
|
13095
|
-
src: BLINK_QR_LOGO,
|
|
13096
|
-
alt: "",
|
|
13097
|
-
"aria-hidden": "true",
|
|
13098
|
-
style: ctaIconStyle
|
|
13099
|
-
}
|
|
13100
|
-
),
|
|
13101
|
-
"Create Blink Passkey"
|
|
13102
|
-
]
|
|
13103
|
-
}
|
|
13104
|
-
)
|
|
13105
|
-
] })
|
|
13106
|
-
] });
|
|
13107
|
-
}
|
|
13108
|
-
var containerStyle8 = (tokens) => ({
|
|
13109
|
-
position: "relative",
|
|
13110
|
-
display: "flex",
|
|
13111
|
-
flexDirection: "column",
|
|
13112
|
-
width: "100%",
|
|
13113
|
-
maxWidth: 420,
|
|
13114
|
-
height: "100%",
|
|
13115
|
-
margin: "0 auto",
|
|
13116
|
-
overflow: "hidden",
|
|
13117
|
-
borderRadius: tokens.radiusLg,
|
|
13118
|
-
background: tokens.bgCard,
|
|
13119
|
-
backdropFilter: "blur(16px)",
|
|
13120
|
-
WebkitBackdropFilter: "blur(16px)",
|
|
13121
|
-
fontFamily: tokens.fontFamily,
|
|
13122
|
-
boxSizing: "border-box"
|
|
13123
|
-
});
|
|
13124
|
-
var contentStyle11 = {
|
|
13125
|
-
flex: 1,
|
|
13126
|
-
minHeight: 0,
|
|
13127
|
-
display: "flex",
|
|
13128
|
-
flexDirection: "column",
|
|
13129
|
-
justifyContent: "space-between",
|
|
13130
|
-
alignItems: "center",
|
|
13131
|
-
padding: "80px 32px 32px",
|
|
13132
|
-
gap: 32,
|
|
13133
|
-
boxSizing: "border-box"
|
|
13134
|
-
};
|
|
13135
|
-
var heroStyle = {
|
|
13136
|
-
flex: 1,
|
|
13137
|
-
minHeight: 0,
|
|
13138
|
-
display: "flex",
|
|
13139
|
-
flexDirection: "column",
|
|
13140
|
-
justifyContent: "center",
|
|
13141
|
-
alignItems: "center",
|
|
13142
|
-
gap: 32,
|
|
13143
|
-
width: "100%"
|
|
13144
|
-
};
|
|
13145
|
-
var illustrationStyle4 = {
|
|
13146
|
-
width: 200,
|
|
13147
|
-
height: 200,
|
|
13148
|
-
objectFit: "contain",
|
|
13149
|
-
display: "block"
|
|
13150
|
-
};
|
|
13151
|
-
var copyStackStyle = {
|
|
13152
|
-
display: "flex",
|
|
13153
|
-
flexDirection: "column",
|
|
13154
|
-
alignItems: "center",
|
|
13155
|
-
gap: 16,
|
|
13156
|
-
width: "100%",
|
|
13157
|
-
textAlign: "center"
|
|
13158
|
-
};
|
|
13159
|
-
var headingStyle9 = (color) => ({
|
|
13160
|
-
margin: 0,
|
|
13161
|
-
color,
|
|
13162
|
-
fontSize: 24,
|
|
13163
|
-
fontWeight: 700,
|
|
13164
|
-
lineHeight: 1,
|
|
13165
|
-
letterSpacing: 0,
|
|
13166
|
-
whiteSpace: "pre-line"
|
|
13167
|
-
});
|
|
13168
|
-
var subtitleStyle7 = (color) => ({
|
|
13169
|
-
margin: 0,
|
|
13170
|
-
color,
|
|
13171
|
-
fontSize: 16,
|
|
13172
|
-
fontWeight: 400,
|
|
13173
|
-
lineHeight: 1.25,
|
|
13174
|
-
whiteSpace: "pre-line"
|
|
13175
|
-
});
|
|
13176
|
-
var ctaStyle = (tokens, disabled) => ({
|
|
13177
|
-
display: "flex",
|
|
13178
|
-
alignItems: "center",
|
|
13179
|
-
justifyContent: "center",
|
|
13180
|
-
gap: 8,
|
|
13181
|
-
width: "100%",
|
|
13182
|
-
height: 56,
|
|
13183
|
-
padding: "4px 24px",
|
|
13184
|
-
border: "none",
|
|
13185
|
-
borderRadius: 36,
|
|
13186
|
-
background: `linear-gradient(180deg, ${tokens.accent}, ${tokens.accentHover})`,
|
|
13187
|
-
color: tokens.accentText,
|
|
13188
|
-
fontSize: 20,
|
|
13189
|
-
fontWeight: 700,
|
|
13190
|
-
fontFamily: "inherit",
|
|
13191
|
-
cursor: disabled ? "default" : "pointer",
|
|
13192
|
-
opacity: disabled ? 0.5 : 1,
|
|
13193
|
-
transition: "opacity 0.15s ease",
|
|
13194
|
-
boxSizing: "border-box"
|
|
13195
|
-
});
|
|
13196
|
-
var ctaIconStyle = {
|
|
13197
|
-
width: 32,
|
|
13198
|
-
height: 32,
|
|
13199
|
-
objectFit: "contain",
|
|
13200
|
-
display: "block",
|
|
13201
|
-
borderRadius: 8
|
|
13202
|
-
};
|
|
13203
|
-
var navButtonStyle = (bg, color) => ({
|
|
13204
|
-
position: "absolute",
|
|
13205
|
-
top: 16,
|
|
13206
|
-
zIndex: 1,
|
|
13207
|
-
width: 44,
|
|
13208
|
-
height: 44,
|
|
13209
|
-
border: "none",
|
|
13210
|
-
borderRadius: 40,
|
|
13211
|
-
background: bg,
|
|
13212
|
-
color,
|
|
13213
|
-
display: "flex",
|
|
13214
|
-
alignItems: "center",
|
|
13215
|
-
justifyContent: "center",
|
|
13216
|
-
cursor: "pointer",
|
|
13217
|
-
padding: 0
|
|
13218
|
-
});
|
|
13219
|
-
var errorBannerStyle7 = (tokens) => ({
|
|
13220
|
-
width: "100%",
|
|
13221
|
-
borderRadius: 16,
|
|
13222
|
-
padding: "11px 14px",
|
|
13223
|
-
background: tokens.errorBg,
|
|
13224
|
-
border: `1px solid ${tokens.error}66`,
|
|
13225
|
-
color: tokens.error,
|
|
13226
|
-
fontSize: "0.84rem",
|
|
13227
|
-
lineHeight: 1.5,
|
|
13228
|
-
textAlign: "left",
|
|
13229
|
-
boxSizing: "border-box"
|
|
13230
|
-
});
|
|
13231
13082
|
function SetupSelectDepositSourceScreen({
|
|
13232
13083
|
tokenOptions,
|
|
13233
13084
|
selectedTokenSymbol,
|
|
@@ -14408,7 +14259,7 @@ function SelectSourceScreen({
|
|
|
14408
14259
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
|
|
14409
14260
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionNameStyle(tokens.text), children: [
|
|
14410
14261
|
chain.chainName,
|
|
14411
|
-
isRecommended && /* @__PURE__ */ jsxRuntime.jsx("span", { style:
|
|
14262
|
+
isRecommended && /* @__PURE__ */ jsxRuntime.jsx("span", { style: recommendedBadgeStyle(tokens.textMuted), children: " recommended" })
|
|
14412
14263
|
] }),
|
|
14413
14264
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
|
|
14414
14265
|
"$",
|
|
@@ -14504,7 +14355,7 @@ var optionNameStyle = (color) => ({
|
|
|
14504
14355
|
fontWeight: 600,
|
|
14505
14356
|
color
|
|
14506
14357
|
});
|
|
14507
|
-
var
|
|
14358
|
+
var recommendedBadgeStyle = (color) => ({
|
|
14508
14359
|
fontSize: "0.7rem",
|
|
14509
14360
|
fontWeight: 500,
|
|
14510
14361
|
color,
|
|
@@ -14804,7 +14655,7 @@ function TransferStatusLayout({
|
|
|
14804
14655
|
onLogout && /* @__PURE__ */ jsxRuntime.jsx("div", { style: menuOverlayStyle, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
|
|
14805
14656
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle16, children: [
|
|
14806
14657
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle13(tokens.text), children: heading }),
|
|
14807
|
-
visibleError && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
14658
|
+
visibleError && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle7(tokens), children: visibleError }),
|
|
14808
14659
|
children
|
|
14809
14660
|
] })
|
|
14810
14661
|
] })
|
|
@@ -14905,7 +14756,7 @@ var headingStyle13 = (color) => ({
|
|
|
14905
14756
|
margin: 0,
|
|
14906
14757
|
textAlign: "center"
|
|
14907
14758
|
});
|
|
14908
|
-
var
|
|
14759
|
+
var errorBannerStyle7 = (tokens) => ({
|
|
14909
14760
|
background: tokens.errorBg,
|
|
14910
14761
|
border: `1px solid ${tokens.error}66`,
|
|
14911
14762
|
borderRadius: 16,
|
|
@@ -15891,7 +15742,7 @@ function GuestTokenPickerScreen({
|
|
|
15891
15742
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
|
|
15892
15743
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle20, children: [
|
|
15893
15744
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle16(tokens.text), children: title }),
|
|
15894
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
15745
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle8(tokens), children: error }),
|
|
15895
15746
|
entries2.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle13(tokens.textMuted), children: emptyMessage ?? "No tokens available." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15896
15747
|
/* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle7(tokens.textSecondary), children: "Token" }),
|
|
15897
15748
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -16063,7 +15914,7 @@ var presetButtonStyle = (themeTokens, active) => ({
|
|
|
16063
15914
|
background: active ? `${themeTokens.accent}22` : "transparent",
|
|
16064
15915
|
color: themeTokens.text
|
|
16065
15916
|
});
|
|
16066
|
-
var
|
|
15917
|
+
var errorBannerStyle8 = (themeTokens) => ({
|
|
16067
15918
|
background: themeTokens.errorBg,
|
|
16068
15919
|
border: `1px solid ${themeTokens.error}66`,
|
|
16069
15920
|
borderRadius: 12,
|
|
@@ -16164,7 +16015,7 @@ function ManualTransferFlow({
|
|
|
16164
16015
|
);
|
|
16165
16016
|
} else if (screen === "deposit-complete") {
|
|
16166
16017
|
const transferAmount = Number(session?.deliveredAmountUsd ?? session?.minAmountUsd ?? 0);
|
|
16167
|
-
screenContent =
|
|
16018
|
+
screenContent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
16168
16019
|
SuccessScreen,
|
|
16169
16020
|
{
|
|
16170
16021
|
amount: transferAmount,
|
|
@@ -16173,16 +16024,7 @@ function ManualTransferFlow({
|
|
|
16173
16024
|
onDone: onDismiss,
|
|
16174
16025
|
onLogout
|
|
16175
16026
|
}
|
|
16176
|
-
)
|
|
16177
|
-
ManualTransferPasskeyScreen,
|
|
16178
|
-
{
|
|
16179
|
-
onCreatePasskey: onCreatePasskey ?? (() => void 0),
|
|
16180
|
-
loading: createPasskeyLoading,
|
|
16181
|
-
error: createPasskeyError,
|
|
16182
|
-
onBack,
|
|
16183
|
-
onClose: onDismiss ?? onLogout
|
|
16184
|
-
}
|
|
16185
|
-
);
|
|
16027
|
+
) ;
|
|
16186
16028
|
} else if (screen === "deposit-failed") {
|
|
16187
16029
|
screenContent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
16188
16030
|
BlinkErrorScreen,
|
|
@@ -17607,6 +17449,38 @@ function useMobileFlowHandlers(dispatch, polling, reloadAccounts, pollingTransfe
|
|
|
17607
17449
|
};
|
|
17608
17450
|
}
|
|
17609
17451
|
|
|
17452
|
+
// src/accountSwitchHelpers.ts
|
|
17453
|
+
var OPEN_PROVIDER_REPLACEMENT_CONFLICT_CODE = "OPEN_PROVIDER_REPLACEMENT_CONFLICT";
|
|
17454
|
+
var ACCOUNT_SWITCH_CONFLICT_MESSAGE = "You can't switch accounts after authorizing the source token. Please switch back to your previous account in your wallet.";
|
|
17455
|
+
async function replaceOpenProviderForAccountSwitch(input) {
|
|
17456
|
+
try {
|
|
17457
|
+
const session = await fetchAuthorizationSession(
|
|
17458
|
+
input.apiBaseUrl,
|
|
17459
|
+
input.sessionId
|
|
17460
|
+
);
|
|
17461
|
+
const openProvider = session.actions.find((a) => a.type === "OPEN_PROVIDER");
|
|
17462
|
+
if (!openProvider) {
|
|
17463
|
+
return { status: "no-open-provider" };
|
|
17464
|
+
}
|
|
17465
|
+
const result = { accounts: [...input.accounts] };
|
|
17466
|
+
if (input.chainId != null) {
|
|
17467
|
+
result.chainId = `0x${input.chainId.toString(16)}`;
|
|
17468
|
+
}
|
|
17469
|
+
const updated = await reportActionCompletion(
|
|
17470
|
+
input.apiBaseUrl,
|
|
17471
|
+
openProvider.id,
|
|
17472
|
+
result
|
|
17473
|
+
);
|
|
17474
|
+
return { status: "success", session: updated };
|
|
17475
|
+
} catch (err) {
|
|
17476
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
17477
|
+
if (error.message.includes(OPEN_PROVIDER_REPLACEMENT_CONFLICT_CODE)) {
|
|
17478
|
+
return { status: "conflict" };
|
|
17479
|
+
}
|
|
17480
|
+
return { status: "error", error };
|
|
17481
|
+
}
|
|
17482
|
+
}
|
|
17483
|
+
|
|
17610
17484
|
// src/hooks/providerSelectionGuards.ts
|
|
17611
17485
|
function resolveSetupFlowDepositAmount({
|
|
17612
17486
|
hasActiveWallet: hasActiveWallet2,
|
|
@@ -18856,6 +18730,33 @@ function useProviderHandlers(deps) {
|
|
|
18856
18730
|
setupFlowDepositAmount,
|
|
18857
18731
|
dispatch
|
|
18858
18732
|
]);
|
|
18733
|
+
const handleWalletAccountSwitch = react.useCallback(async (change, sessionId) => {
|
|
18734
|
+
const outcome = await replaceOpenProviderForAccountSwitch({
|
|
18735
|
+
apiBaseUrl,
|
|
18736
|
+
sessionId,
|
|
18737
|
+
accounts: change.accounts,
|
|
18738
|
+
chainId: change.chainId
|
|
18739
|
+
});
|
|
18740
|
+
if (outcome.status === "success") {
|
|
18741
|
+
dispatch({ type: "CLEAR_SETUP_DEPOSIT_TOKEN" });
|
|
18742
|
+
try {
|
|
18743
|
+
await orchestrator.restart();
|
|
18744
|
+
} catch (err) {
|
|
18745
|
+
captureException(err);
|
|
18746
|
+
onError?.(err instanceof Error ? err.message : "Failed to refresh authorization session.");
|
|
18747
|
+
}
|
|
18748
|
+
return;
|
|
18749
|
+
}
|
|
18750
|
+
if (outcome.status === "conflict") {
|
|
18751
|
+
onError?.(ACCOUNT_SWITCH_CONFLICT_MESSAGE);
|
|
18752
|
+
return;
|
|
18753
|
+
}
|
|
18754
|
+
if (outcome.status === "error") {
|
|
18755
|
+
captureException(outcome.error);
|
|
18756
|
+
onError?.(outcome.error.message);
|
|
18757
|
+
return;
|
|
18758
|
+
}
|
|
18759
|
+
}, [apiBaseUrl, dispatch, orchestrator, onError]);
|
|
18859
18760
|
return {
|
|
18860
18761
|
handlePrepareProvider,
|
|
18861
18762
|
handleSelectProvider,
|
|
@@ -18868,7 +18769,8 @@ function useProviderHandlers(deps) {
|
|
|
18868
18769
|
handleAuthorizeToken,
|
|
18869
18770
|
handlePrepareTokenAuthorization,
|
|
18870
18771
|
handleCommitTokenAuthorization,
|
|
18871
|
-
handlePrepareGuestDeeplinks
|
|
18772
|
+
handlePrepareGuestDeeplinks,
|
|
18773
|
+
handleWalletAccountSwitch
|
|
18872
18774
|
};
|
|
18873
18775
|
}
|
|
18874
18776
|
function useOneTapSetupHandlers(deps) {
|
|
@@ -19932,6 +19834,40 @@ function useDepositFeeEstimate({
|
|
|
19932
19834
|
}, [fetchQuote]);
|
|
19933
19835
|
return { quoteId, quoteFee, quoteLoading, quoteError };
|
|
19934
19836
|
}
|
|
19837
|
+
function useWalletAccountSwitchEffect(deps) {
|
|
19838
|
+
const { enabled = true, isDesktop = true, onAccountChanged } = deps;
|
|
19839
|
+
const account = wagmi.useAccount();
|
|
19840
|
+
const address = account.address ?? null;
|
|
19841
|
+
const chainId = account.chainId ?? null;
|
|
19842
|
+
const connectorId = account.connector?.id ?? null;
|
|
19843
|
+
const addresses = account.addresses;
|
|
19844
|
+
const baselineRef = react.useRef(null);
|
|
19845
|
+
react.useEffect(() => {
|
|
19846
|
+
if (!enabled || !isDesktop) {
|
|
19847
|
+
baselineRef.current = null;
|
|
19848
|
+
return;
|
|
19849
|
+
}
|
|
19850
|
+
if (!address) {
|
|
19851
|
+
return;
|
|
19852
|
+
}
|
|
19853
|
+
if (baselineRef.current === null) {
|
|
19854
|
+
baselineRef.current = address;
|
|
19855
|
+
return;
|
|
19856
|
+
}
|
|
19857
|
+
if (baselineRef.current.toLowerCase() === address.toLowerCase()) {
|
|
19858
|
+
return;
|
|
19859
|
+
}
|
|
19860
|
+
const previous = baselineRef.current;
|
|
19861
|
+
baselineRef.current = address;
|
|
19862
|
+
void onAccountChanged({
|
|
19863
|
+
previousAddress: previous,
|
|
19864
|
+
nextAddress: address,
|
|
19865
|
+
connectorId: connectorId ?? "injected",
|
|
19866
|
+
chainId,
|
|
19867
|
+
accounts: addresses ?? [address]
|
|
19868
|
+
});
|
|
19869
|
+
}, [enabled, isDesktop, address, chainId, connectorId, addresses, onAccountChanged]);
|
|
19870
|
+
}
|
|
19935
19871
|
function usePersistAmountToActiveSession({
|
|
19936
19872
|
apiBaseUrl,
|
|
19937
19873
|
accounts,
|
|
@@ -20231,6 +20167,17 @@ function BlinkPaymentInner({
|
|
|
20231
20167
|
activeCredentialId: state.activeCredentialId ?? void 0,
|
|
20232
20168
|
idempotencyKey
|
|
20233
20169
|
});
|
|
20170
|
+
const accountSwitchSessionId = state.setupAuthorizationSessionId;
|
|
20171
|
+
const handleProviderWalletAccountSwitch = provider.handleWalletAccountSwitch;
|
|
20172
|
+
const onWalletAccountChanged = react.useCallback(async (change) => {
|
|
20173
|
+
if (!accountSwitchSessionId) return;
|
|
20174
|
+
await handleProviderWalletAccountSwitch(change, accountSwitchSessionId);
|
|
20175
|
+
}, [handleProviderWalletAccountSwitch, accountSwitchSessionId]);
|
|
20176
|
+
useWalletAccountSwitchEffect({
|
|
20177
|
+
enabled: accountSwitchSessionId != null,
|
|
20178
|
+
isDesktop,
|
|
20179
|
+
onAccountChanged: onWalletAccountChanged
|
|
20180
|
+
});
|
|
20234
20181
|
const clearLocalSessionArtifacts = react.useCallback(() => {
|
|
20235
20182
|
popupAuthRef.current = null;
|
|
20236
20183
|
clearPopupAuth();
|
|
@@ -20667,6 +20614,7 @@ function getDeviceBiometricUnlockText() {
|
|
|
20667
20614
|
return FALLBACK;
|
|
20668
20615
|
}
|
|
20669
20616
|
|
|
20617
|
+
exports.ACCOUNT_SWITCH_CONFLICT_MESSAGE = ACCOUNT_SWITCH_CONFLICT_MESSAGE;
|
|
20670
20618
|
exports.AdvancedSourceScreen = AdvancedSourceScreen;
|
|
20671
20619
|
exports.AuthorizationSessionCancelledError = AuthorizationSessionCancelledError;
|
|
20672
20620
|
exports.BLINK_ERROR_ILLUSTRATION = BLINK_ERROR_ILLUSTRATION;
|
|
@@ -20744,6 +20692,7 @@ exports.lightThemeNew = lightThemeNew;
|
|
|
20744
20692
|
exports.lightTransparentTheme = lightTransparentTheme;
|
|
20745
20693
|
exports.lightTransparentThemeNew = lightTransparentThemeNew;
|
|
20746
20694
|
exports.mapGuestPickerEntries = mapGuestPickerEntries;
|
|
20695
|
+
exports.replaceOpenProviderForAccountSwitch = replaceOpenProviderForAccountSwitch;
|
|
20747
20696
|
exports.resolvePasskeyRpId = resolvePasskeyRpId;
|
|
20748
20697
|
exports.screenForPhase = screenForPhase;
|
|
20749
20698
|
exports.subscribeDebug = subscribeDebug;
|