@swype-org/react-sdk 0.2.233 → 0.2.237
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 +75 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.js +76 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1605,6 +1605,7 @@ __export(api_exports, {
|
|
|
1605
1605
|
fetchUserConfig: () => fetchUserConfig,
|
|
1606
1606
|
postTransferQuote: () => postTransferQuote,
|
|
1607
1607
|
probeActionCompletion: () => probeActionCompletion,
|
|
1608
|
+
refreshManualTransferQuote: () => refreshManualTransferQuote,
|
|
1608
1609
|
registerPasskey: () => registerPasskey,
|
|
1609
1610
|
reportActionCompletion: () => reportActionCompletion,
|
|
1610
1611
|
reportPasskeyActivity: () => reportPasskeyActivity,
|
|
@@ -2031,6 +2032,14 @@ async function fetchManualTransferSession(apiBaseUrl, sessionId) {
|
|
|
2031
2032
|
if (!res.ok) await throwApiError(res);
|
|
2032
2033
|
return await res.json();
|
|
2033
2034
|
}
|
|
2035
|
+
async function refreshManualTransferQuote(apiBaseUrl, sessionId) {
|
|
2036
|
+
const res = await fetch(
|
|
2037
|
+
`${apiBaseUrl}/v1/manual-transfers/${sessionId}/refresh-quote`,
|
|
2038
|
+
{ method: "POST" }
|
|
2039
|
+
);
|
|
2040
|
+
if (!res.ok) await throwApiError(res);
|
|
2041
|
+
return await res.json();
|
|
2042
|
+
}
|
|
2034
2043
|
async function reportActionCompletion(apiBaseUrl, actionId, result) {
|
|
2035
2044
|
const res = await fetchWithRetry(
|
|
2036
2045
|
`${apiBaseUrl}/v1/authorization-actions/${actionId}`,
|
|
@@ -8305,11 +8314,11 @@ function useManualTransferSession({
|
|
|
8305
8314
|
setSourceOptions(sources);
|
|
8306
8315
|
setLoadingSources(false);
|
|
8307
8316
|
const defaultOption = sources.find(
|
|
8308
|
-
(opt) => opt.tokenSymbol === "USDC" && opt.chainId ===
|
|
8317
|
+
(opt) => opt.tokenSymbol === "USDC" && opt.chainId === 792703809
|
|
8309
8318
|
);
|
|
8310
8319
|
if (defaultOption) {
|
|
8311
8320
|
setSelectedToken("USDC");
|
|
8312
|
-
setSelectedChainId("
|
|
8321
|
+
setSelectedChainId("792703809");
|
|
8313
8322
|
}
|
|
8314
8323
|
}
|
|
8315
8324
|
}).catch((err) => {
|
|
@@ -8331,7 +8340,9 @@ function useManualTransferSession({
|
|
|
8331
8340
|
const timer = window.setTimeout(() => setQrReady(true), 1200);
|
|
8332
8341
|
return () => window.clearTimeout(timer);
|
|
8333
8342
|
}, [depositAddress]);
|
|
8334
|
-
const
|
|
8343
|
+
const lastFeeCopyRef = react.useRef(null);
|
|
8344
|
+
const nextFeeCopy = session ? feeCopy(session) : null;
|
|
8345
|
+
const sessionFeeCopy = nextFeeCopy === lastFeeCopyRef.current ? lastFeeCopyRef.current : lastFeeCopyRef.current = nextFeeCopy;
|
|
8335
8346
|
const advanceMockStatus = react.useCallback((status) => {
|
|
8336
8347
|
setSession((prev) => prev ? { ...prev, status } : prev);
|
|
8337
8348
|
}, []);
|
|
@@ -8343,6 +8354,21 @@ function useManualTransferSession({
|
|
|
8343
8354
|
}, 2e3);
|
|
8344
8355
|
return () => window.clearInterval(timer);
|
|
8345
8356
|
}, [apiBaseUrl, mock, session?.sessionId, session?.status]);
|
|
8357
|
+
react.useEffect(() => {
|
|
8358
|
+
if (mock) return;
|
|
8359
|
+
if (!session?.sessionId || session.status !== "awaiting_deposit") return;
|
|
8360
|
+
const sessionId = session.sessionId;
|
|
8361
|
+
const timer = window.setInterval(() => {
|
|
8362
|
+
refreshManualTransferQuote(apiBaseUrl, sessionId).then(({ quoteValidUntil, minAmountUsd, slippage }) => {
|
|
8363
|
+
setSession(
|
|
8364
|
+
(prev) => prev && prev.sessionId === sessionId ? { ...prev, quoteValidUntil, minAmountUsd, slippage } : prev
|
|
8365
|
+
);
|
|
8366
|
+
}).catch((err) => {
|
|
8367
|
+
console.warn("[manual-transfer] refresh quote failed", err);
|
|
8368
|
+
});
|
|
8369
|
+
}, 1e4);
|
|
8370
|
+
return () => window.clearInterval(timer);
|
|
8371
|
+
}, [apiBaseUrl, mock, session?.sessionId, session?.status]);
|
|
8346
8372
|
react.useEffect(() => {
|
|
8347
8373
|
if (session?.status !== "completed") return;
|
|
8348
8374
|
if (completedRef.current === session.sessionId) return;
|
|
@@ -8365,6 +8391,15 @@ function useManualTransferSession({
|
|
|
8365
8391
|
return true;
|
|
8366
8392
|
});
|
|
8367
8393
|
}, [sourceOptions]);
|
|
8394
|
+
const tokenLogoUriBySymbol = react.useMemo(() => {
|
|
8395
|
+
const out = {};
|
|
8396
|
+
for (const opt of sourceOptions ?? []) {
|
|
8397
|
+
if (out[opt.tokenSymbol] == null) {
|
|
8398
|
+
out[opt.tokenSymbol] = opt.tokenLogoUri;
|
|
8399
|
+
}
|
|
8400
|
+
}
|
|
8401
|
+
return out;
|
|
8402
|
+
}, [sourceOptions]);
|
|
8368
8403
|
const selectedOption = react.useMemo(
|
|
8369
8404
|
() => (sourceOptions ?? []).find(
|
|
8370
8405
|
(opt) => opt.tokenSymbol === selectedToken && String(opt.chainId) === selectedChainId
|
|
@@ -8517,6 +8552,7 @@ function useManualTransferSession({
|
|
|
8517
8552
|
copiedAddress,
|
|
8518
8553
|
tokenChoices,
|
|
8519
8554
|
chainChoices,
|
|
8555
|
+
tokenLogoUriBySymbol,
|
|
8520
8556
|
selectedOption,
|
|
8521
8557
|
tokensForSelectedChain,
|
|
8522
8558
|
chainsForSelectedToken,
|
|
@@ -9849,12 +9885,14 @@ var trailingStyle = {
|
|
|
9849
9885
|
function TokenChainIcons({
|
|
9850
9886
|
tokenSymbol,
|
|
9851
9887
|
chainName,
|
|
9888
|
+
tokenLogoUri,
|
|
9889
|
+
chainLogoUri,
|
|
9852
9890
|
size = 28,
|
|
9853
9891
|
overlap = 12
|
|
9854
9892
|
}) {
|
|
9855
|
-
const tokenLogo = tokenSymbol ? TOKEN_LOGOS[tokenSymbol] : void 0;
|
|
9893
|
+
const tokenLogo = tokenLogoUri ?? (tokenSymbol ? TOKEN_LOGOS[tokenSymbol] : void 0);
|
|
9856
9894
|
const chainKey = chainName ? chainName.toLowerCase() : void 0;
|
|
9857
|
-
const chainLogo = chainKey ? CHAIN_LOGOS[chainKey] : void 0;
|
|
9895
|
+
const chainLogo = chainLogoUri ?? (chainKey ? CHAIN_LOGOS[chainKey] : void 0);
|
|
9858
9896
|
const chainInitial = chainName ? chainName.charAt(0).toUpperCase() : "?";
|
|
9859
9897
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { style: wrapStyle2(overlap), children: [
|
|
9860
9898
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenCircleStyle(size, overlap, 2), children: tokenLogo ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10066,6 +10104,7 @@ function formatUsdTwoDecimals2(value) {
|
|
|
10066
10104
|
function TokenSourceRow({
|
|
10067
10105
|
symbol,
|
|
10068
10106
|
chainName,
|
|
10107
|
+
tokenLogoUri,
|
|
10069
10108
|
balance,
|
|
10070
10109
|
selected,
|
|
10071
10110
|
requiresAuth,
|
|
@@ -10073,7 +10112,7 @@ function TokenSourceRow({
|
|
|
10073
10112
|
}) {
|
|
10074
10113
|
const { tokens } = useBlinkConfig();
|
|
10075
10114
|
const [hovered, setHovered] = react.useState(false);
|
|
10076
|
-
const tokenLogo = TOKEN_LOGOS[symbol];
|
|
10115
|
+
const tokenLogo = tokenLogoUri ?? TOKEN_LOGOS[symbol];
|
|
10077
10116
|
const ariaLabel = [
|
|
10078
10117
|
`${symbol} on ${chainName}`,
|
|
10079
10118
|
balance != null ? `$${formatUsdTwoDecimals2(balance)} balance` : null,
|
|
@@ -10337,7 +10376,7 @@ var errorBoxStyle = (size, bg, color) => ({
|
|
|
10337
10376
|
textAlign: "center"
|
|
10338
10377
|
});
|
|
10339
10378
|
var QR_BOX_SIZE = 251;
|
|
10340
|
-
function
|
|
10379
|
+
function DepositQrCodeImpl({
|
|
10341
10380
|
address,
|
|
10342
10381
|
chainId,
|
|
10343
10382
|
depToken
|
|
@@ -10366,6 +10405,7 @@ function DepositQrCode({
|
|
|
10366
10405
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: BLINK_QR_LOGO, alt: "", style: qrLogoStyle })
|
|
10367
10406
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: tokens.textMuted, fontSize: 13 }, children: "QR unavailable" }) });
|
|
10368
10407
|
}
|
|
10408
|
+
var DepositQrCode = react.memo(DepositQrCodeImpl);
|
|
10369
10409
|
var qrFrameStyle = (bgCardTranslucent) => ({
|
|
10370
10410
|
alignItems: "center",
|
|
10371
10411
|
alignSelf: "center",
|
|
@@ -10503,7 +10543,8 @@ function CompactTokenSelect({
|
|
|
10503
10543
|
value,
|
|
10504
10544
|
onValueChange,
|
|
10505
10545
|
options,
|
|
10506
|
-
availableTokens
|
|
10546
|
+
availableTokens,
|
|
10547
|
+
tokenLogoUriBySymbol
|
|
10507
10548
|
}) {
|
|
10508
10549
|
const { tokens } = useBlinkConfig();
|
|
10509
10550
|
const [hovered, setHovered] = react.useState(false);
|
|
@@ -10528,7 +10569,7 @@ function CompactTokenSelect({
|
|
|
10528
10569
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10529
10570
|
LogoCircle,
|
|
10530
10571
|
{
|
|
10531
|
-
src: TOKEN_LOGOS[value],
|
|
10572
|
+
src: tokenLogoUriBySymbol?.[value] ?? TOKEN_LOGOS[value],
|
|
10532
10573
|
fallback: (value || "?").charAt(0),
|
|
10533
10574
|
size: 28
|
|
10534
10575
|
}
|
|
@@ -10575,7 +10616,7 @@ function CompactTokenSelect({
|
|
|
10575
10616
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10576
10617
|
LogoCircle,
|
|
10577
10618
|
{
|
|
10578
|
-
src: TOKEN_LOGOS[token],
|
|
10619
|
+
src: tokenLogoUriBySymbol?.[token] ?? TOKEN_LOGOS[token],
|
|
10579
10620
|
fallback: token.charAt(0),
|
|
10580
10621
|
size: 28
|
|
10581
10622
|
}
|
|
@@ -10625,7 +10666,7 @@ function CompactChainSelect({
|
|
|
10625
10666
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10626
10667
|
LogoCircle,
|
|
10627
10668
|
{
|
|
10628
|
-
src: CHAIN_LOGOS[selected?.chainName.toLowerCase() ?? ""],
|
|
10669
|
+
src: selected?.chainLogoUri ?? CHAIN_LOGOS[selected?.chainName.toLowerCase() ?? ""],
|
|
10629
10670
|
fallback: (selected?.chainName ?? "?").charAt(0),
|
|
10630
10671
|
size: 28,
|
|
10631
10672
|
preserveShape: true
|
|
@@ -10673,7 +10714,7 @@ function CompactChainSelect({
|
|
|
10673
10714
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10674
10715
|
LogoCircle,
|
|
10675
10716
|
{
|
|
10676
|
-
src: CHAIN_LOGOS[opt.chainName.toLowerCase()],
|
|
10717
|
+
src: opt.chainLogoUri ?? CHAIN_LOGOS[opt.chainName.toLowerCase()],
|
|
10677
10718
|
fallback: opt.chainName.charAt(0),
|
|
10678
10719
|
size: 28,
|
|
10679
10720
|
preserveShape: true
|
|
@@ -13206,6 +13247,8 @@ function SetupDepositScreen({
|
|
|
13206
13247
|
tokenSelectionLoading = false,
|
|
13207
13248
|
selectedTokenSymbol,
|
|
13208
13249
|
selectedChainName,
|
|
13250
|
+
selectedTokenLogoUri,
|
|
13251
|
+
selectedChainLogoUri,
|
|
13209
13252
|
tokenOptions,
|
|
13210
13253
|
onSelectToken,
|
|
13211
13254
|
quoteFee,
|
|
@@ -13333,7 +13376,9 @@ function SetupDepositScreen({
|
|
|
13333
13376
|
TokenChainIcons,
|
|
13334
13377
|
{
|
|
13335
13378
|
tokenSymbol: selectedTokenSymbol,
|
|
13336
|
-
chainName: selectedChainName
|
|
13379
|
+
chainName: selectedChainName,
|
|
13380
|
+
tokenLogoUri: selectedTokenLogoUri,
|
|
13381
|
+
chainLogoUri: selectedChainLogoUri
|
|
13337
13382
|
}
|
|
13338
13383
|
),
|
|
13339
13384
|
name: selectedTokenSymbol,
|
|
@@ -13845,6 +13890,8 @@ function DepositScreen({
|
|
|
13845
13890
|
onCommitTokenAuthorization,
|
|
13846
13891
|
selectedTokenSymbol,
|
|
13847
13892
|
selectedChainName,
|
|
13893
|
+
selectedTokenLogoUri,
|
|
13894
|
+
selectedChainLogoUri,
|
|
13848
13895
|
selectedWalletId,
|
|
13849
13896
|
selectedTokenStatus,
|
|
13850
13897
|
onAuthorizeSelectedToken,
|
|
@@ -13948,7 +13995,9 @@ function DepositScreen({
|
|
|
13948
13995
|
TokenChainIcons,
|
|
13949
13996
|
{
|
|
13950
13997
|
tokenSymbol: selectedTokenSymbol,
|
|
13951
|
-
chainName: selectedChainName
|
|
13998
|
+
chainName: selectedChainName,
|
|
13999
|
+
tokenLogoUri: selectedTokenLogoUri,
|
|
14000
|
+
chainLogoUri: selectedChainLogoUri
|
|
13952
14001
|
}
|
|
13953
14002
|
),
|
|
13954
14003
|
name: selectedProviderName,
|
|
@@ -14851,6 +14900,7 @@ function DepositAddressScreen({
|
|
|
14851
14900
|
selectedChainId,
|
|
14852
14901
|
tokenChoices,
|
|
14853
14902
|
chainChoices,
|
|
14903
|
+
tokenLogoUriBySymbol,
|
|
14854
14904
|
selectedOption,
|
|
14855
14905
|
tokensForSelectedChain,
|
|
14856
14906
|
chainsForSelectedToken,
|
|
@@ -14945,7 +14995,8 @@ function DepositAddressScreen({
|
|
|
14945
14995
|
value: selectedToken,
|
|
14946
14996
|
onValueChange: selectToken,
|
|
14947
14997
|
options: tokenChoices,
|
|
14948
|
-
availableTokens: tokensForSelectedChain
|
|
14998
|
+
availableTokens: tokensForSelectedChain,
|
|
14999
|
+
tokenLogoUriBySymbol
|
|
14949
15000
|
}
|
|
14950
15001
|
),
|
|
14951
15002
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14983,12 +15034,18 @@ function DepositAddressScreen({
|
|
|
14983
15034
|
}
|
|
14984
15035
|
),
|
|
14985
15036
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: bodyStyle3(tokens.textMuted), children: selectedOption ? session ? `Send ${selectedOption.tokenSymbol} on ${selectedOption.chainName}. Minimum $${session.minAmountUsd}.` : `Send ${selectedOption.tokenSymbol} on ${selectedOption.chainName}.` : "\xA0" }),
|
|
14986
|
-
sessionFeeCopy && /* @__PURE__ */ jsxRuntime.jsx(
|
|
15037
|
+
sessionFeeCopy && /* @__PURE__ */ jsxRuntime.jsx(FeeRow, { feeCopy: sessionFeeCopy, color: tokens.textMuted })
|
|
14987
15038
|
] }),
|
|
14988
15039
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: errorStyle2(tokens.error), children: error })
|
|
14989
15040
|
] })
|
|
14990
15041
|
] });
|
|
14991
15042
|
}
|
|
15043
|
+
var FeeRow = react.memo(function FeeRow2({
|
|
15044
|
+
feeCopy: feeCopy2,
|
|
15045
|
+
color
|
|
15046
|
+
}) {
|
|
15047
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { style: bodyStyle3(color), children: feeCopy2 });
|
|
15048
|
+
});
|
|
14992
15049
|
var contentStyle17 = {
|
|
14993
15050
|
alignItems: "center",
|
|
14994
15051
|
display: "flex",
|
|
@@ -15945,6 +16002,7 @@ function ManualTransferFlow({
|
|
|
15945
16002
|
copiedAddress,
|
|
15946
16003
|
tokenChoices,
|
|
15947
16004
|
chainChoices,
|
|
16005
|
+
tokenLogoUriBySymbol,
|
|
15948
16006
|
selectedOption,
|
|
15949
16007
|
tokensForSelectedChain,
|
|
15950
16008
|
chainsForSelectedToken,
|
|
@@ -15998,6 +16056,7 @@ function ManualTransferFlow({
|
|
|
15998
16056
|
selectedChainId,
|
|
15999
16057
|
tokenChoices,
|
|
16000
16058
|
chainChoices,
|
|
16059
|
+
tokenLogoUriBySymbol,
|
|
16001
16060
|
selectedOption,
|
|
16002
16061
|
tokensForSelectedChain,
|
|
16003
16062
|
chainsForSelectedToken,
|