@trustware/sdk-staging 1.1.12-staging.1 → 1.1.12-staging.2
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/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/index.cjs +65 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +65 -9
- package/dist/index.mjs.map +1 -1
- package/dist/smart-account.cjs +13 -2
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.mjs +13 -2
- package/dist/smart-account.mjs.map +1 -1
- package/dist/wallet.cjs +1 -1
- package/dist/wallet.mjs +1 -1
- package/dist/widget.cjs +65 -9
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +65 -9
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -492,7 +492,7 @@ var init_constants = __esm({
|
|
|
492
492
|
"src/constants.ts"() {
|
|
493
493
|
"use strict";
|
|
494
494
|
SDK_NAME = "@trustware/sdk";
|
|
495
|
-
SDK_VERSION = "1.1.12-staging.
|
|
495
|
+
SDK_VERSION = "1.1.12-staging.2";
|
|
496
496
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
497
497
|
GTM_ID = "GTM-TZDGNCXB";
|
|
498
498
|
API_PREFIX = "/api";
|
|
@@ -31827,7 +31827,18 @@ async function sendRouteAsUserOperation(params) {
|
|
|
31827
31827
|
);
|
|
31828
31828
|
}
|
|
31829
31829
|
console.debug("[send] UserOp included", { userOpHash, txHash });
|
|
31830
|
-
|
|
31830
|
+
try {
|
|
31831
|
+
void submitReceipt(
|
|
31832
|
+
intentId,
|
|
31833
|
+
txHash,
|
|
31834
|
+
getSponsorshipRequestId(),
|
|
31835
|
+
eoaAddress
|
|
31836
|
+
).catch((err) => {
|
|
31837
|
+
console.debug("[send] receipt submission failed (non-fatal)", err);
|
|
31838
|
+
});
|
|
31839
|
+
} catch (err) {
|
|
31840
|
+
console.debug("[send] receipt submission failed (non-fatal)", err);
|
|
31841
|
+
}
|
|
31831
31842
|
return { userOpHash, txHash, intentId };
|
|
31832
31843
|
}
|
|
31833
31844
|
var NATIVE_ADDRS;
|
|
@@ -34049,10 +34060,6 @@ function useSwapExecution(fromChain) {
|
|
|
34049
34060
|
numericChainId,
|
|
34050
34061
|
{ approvalsEnsured: ownsApprovals }
|
|
34051
34062
|
);
|
|
34052
|
-
try {
|
|
34053
|
-
await submitReceipt(routeResult.intentId, hash);
|
|
34054
|
-
} catch {
|
|
34055
|
-
}
|
|
34056
34063
|
setState((p) => ({
|
|
34057
34064
|
...p,
|
|
34058
34065
|
isSubmitting: false,
|
|
@@ -34061,6 +34068,8 @@ function useSwapExecution(fromChain) {
|
|
|
34061
34068
|
txStatus: "processing"
|
|
34062
34069
|
}));
|
|
34063
34070
|
startPolling(routeResult.intentId, onSuccess, onError);
|
|
34071
|
+
void submitReceipt(routeResult.intentId, hash).catch(() => {
|
|
34072
|
+
});
|
|
34064
34073
|
} catch (err) {
|
|
34065
34074
|
const msg = mapTxError(err);
|
|
34066
34075
|
setState((p) => ({
|
|
@@ -36503,6 +36512,7 @@ function SwapMode({
|
|
|
36503
36512
|
}, [route.loading]);
|
|
36504
36513
|
useEffect34(() => {
|
|
36505
36514
|
if (!route.data) return;
|
|
36515
|
+
if (stage !== "home" && stage !== "review") return;
|
|
36506
36516
|
const id = setInterval(() => {
|
|
36507
36517
|
const ts = quoteTimestampRef.current;
|
|
36508
36518
|
if (ts === null) return;
|
|
@@ -36514,7 +36524,11 @@ function SwapMode({
|
|
|
36514
36524
|
}
|
|
36515
36525
|
}, 1e3);
|
|
36516
36526
|
return () => clearInterval(id);
|
|
36517
|
-
}, [route.data]);
|
|
36527
|
+
}, [route.data, stage]);
|
|
36528
|
+
const handleRetryQuote = useCallback22(() => {
|
|
36529
|
+
if (!latestFetchParamsRef.current) return;
|
|
36530
|
+
void fetchRef.current(latestFetchParamsRef.current);
|
|
36531
|
+
}, []);
|
|
36518
36532
|
useEffect34(() => {
|
|
36519
36533
|
if (stage !== "review") return;
|
|
36520
36534
|
if (!route.data || !walletAddress) return;
|
|
@@ -38043,6 +38057,10 @@ function SwapMode({
|
|
|
38043
38057
|
txStatus: execution.txStatus,
|
|
38044
38058
|
isSubmitting: execution.isSubmitting,
|
|
38045
38059
|
isGasSponsored,
|
|
38060
|
+
hasQuote: !!route.data,
|
|
38061
|
+
isQuoteRefreshing: route.loading,
|
|
38062
|
+
quoteError: route.error,
|
|
38063
|
+
onRetryQuote: handleRetryQuote,
|
|
38046
38064
|
onExecute: () => void handleExecute()
|
|
38047
38065
|
}
|
|
38048
38066
|
)
|
|
@@ -39379,10 +39397,15 @@ function SwapActionArea({
|
|
|
39379
39397
|
txStatus,
|
|
39380
39398
|
isSubmitting,
|
|
39381
39399
|
isGasSponsored,
|
|
39400
|
+
hasQuote,
|
|
39401
|
+
isQuoteRefreshing,
|
|
39402
|
+
quoteError,
|
|
39403
|
+
onRetryQuote,
|
|
39382
39404
|
onExecute
|
|
39383
39405
|
}) {
|
|
39384
39406
|
const needsApproval = allowanceStatus === "needed" && !isGasSponsored;
|
|
39385
39407
|
const isChecking = allowanceStatus === "checking";
|
|
39408
|
+
const quoteUnavailable = !hasQuote && !isQuoteRefreshing && !isSubmitting && txStatus === "idle";
|
|
39386
39409
|
let label;
|
|
39387
39410
|
if (isChecking) {
|
|
39388
39411
|
label = "Checking approval...";
|
|
@@ -39390,12 +39413,14 @@ function SwapActionArea({
|
|
|
39390
39413
|
label = `Approving ${fromTokenSymbol}...`;
|
|
39391
39414
|
} else if (isSubmitting) {
|
|
39392
39415
|
label = "Confirm in wallet...";
|
|
39416
|
+
} else if (isQuoteRefreshing) {
|
|
39417
|
+
label = "Refreshing quote...";
|
|
39393
39418
|
} else if (needsApproval) {
|
|
39394
39419
|
label = `Approve ${fromTokenSymbol}`;
|
|
39395
39420
|
} else {
|
|
39396
39421
|
label = "Swap";
|
|
39397
39422
|
}
|
|
39398
|
-
const isDisabled = isSubmitting || isChecking;
|
|
39423
|
+
const isDisabled = isSubmitting || isChecking || isQuoteRefreshing || !hasQuote;
|
|
39399
39424
|
return /* @__PURE__ */ jsxs47("div", { style: { marginTop: spacing[6] }, children: [
|
|
39400
39425
|
isGasSponsored && !isSubmitting && /* @__PURE__ */ jsxs47(
|
|
39401
39426
|
"div",
|
|
@@ -39435,7 +39460,38 @@ function SwapActionArea({
|
|
|
39435
39460
|
]
|
|
39436
39461
|
}
|
|
39437
39462
|
),
|
|
39438
|
-
/* @__PURE__ */
|
|
39463
|
+
quoteUnavailable ? /* @__PURE__ */ jsxs47(Fragment13, { children: [
|
|
39464
|
+
/* @__PURE__ */ jsx59(
|
|
39465
|
+
"p",
|
|
39466
|
+
{
|
|
39467
|
+
style: {
|
|
39468
|
+
fontSize: fontSize.xs,
|
|
39469
|
+
color: colors.destructive,
|
|
39470
|
+
textAlign: "center",
|
|
39471
|
+
marginBottom: spacing[3]
|
|
39472
|
+
},
|
|
39473
|
+
children: quoteError ?? "This quote expired."
|
|
39474
|
+
}
|
|
39475
|
+
),
|
|
39476
|
+
/* @__PURE__ */ jsx59(
|
|
39477
|
+
"button",
|
|
39478
|
+
{
|
|
39479
|
+
onClick: onRetryQuote,
|
|
39480
|
+
style: {
|
|
39481
|
+
width: "100%",
|
|
39482
|
+
height: "3.5rem",
|
|
39483
|
+
borderRadius: "1.5rem",
|
|
39484
|
+
backgroundColor: colors.primary,
|
|
39485
|
+
color: colors.primaryForeground,
|
|
39486
|
+
fontSize: fontSize.base,
|
|
39487
|
+
fontWeight: fontWeight.semibold,
|
|
39488
|
+
border: 0,
|
|
39489
|
+
cursor: "pointer"
|
|
39490
|
+
},
|
|
39491
|
+
children: "Get a new quote"
|
|
39492
|
+
}
|
|
39493
|
+
)
|
|
39494
|
+
] }) : /* @__PURE__ */ jsx59(
|
|
39439
39495
|
"button",
|
|
39440
39496
|
{
|
|
39441
39497
|
onClick: onExecute,
|