@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.
@@ -30,7 +30,7 @@ __export(constants_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(constants_exports);
32
32
  var SDK_NAME = "@trustware/sdk";
33
- var SDK_VERSION = "1.1.12-staging.1";
33
+ var SDK_VERSION = "1.1.12-staging.2";
34
34
  var API_ROOT = "https://bv-staging-api.trustware.io";
35
35
  var GTM_ID = "GTM-TZDGNCXB";
36
36
  var API_PREFIX = "/api";
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
2
  var SDK_NAME = "@trustware/sdk";
3
- var SDK_VERSION = "1.1.12-staging.1";
3
+ var SDK_VERSION = "1.1.12-staging.2";
4
4
  var API_ROOT = "https://bv-staging-api.trustware.io";
5
5
  var GTM_ID = "GTM-TZDGNCXB";
6
6
  var API_PREFIX = "/api";
package/dist/core.cjs CHANGED
@@ -83,7 +83,7 @@ var init_constants = __esm({
83
83
  "src/constants.ts"() {
84
84
  "use strict";
85
85
  SDK_NAME = "@trustware/sdk";
86
- SDK_VERSION = "1.1.12-staging.1";
86
+ SDK_VERSION = "1.1.12-staging.2";
87
87
  API_ROOT = "https://bv-staging-api.trustware.io";
88
88
  API_PREFIX = "/api";
89
89
  WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
package/dist/core.mjs CHANGED
@@ -61,7 +61,7 @@ var init_constants = __esm({
61
61
  "src/constants.ts"() {
62
62
  "use strict";
63
63
  SDK_NAME = "@trustware/sdk";
64
- SDK_VERSION = "1.1.12-staging.1";
64
+ SDK_VERSION = "1.1.12-staging.2";
65
65
  API_ROOT = "https://bv-staging-api.trustware.io";
66
66
  API_PREFIX = "/api";
67
67
  WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
package/dist/index.cjs CHANGED
@@ -514,7 +514,7 @@ var init_constants = __esm({
514
514
  "src/constants.ts"() {
515
515
  "use strict";
516
516
  SDK_NAME = "@trustware/sdk";
517
- SDK_VERSION = "1.1.12-staging.1";
517
+ SDK_VERSION = "1.1.12-staging.2";
518
518
  API_ROOT = "https://bv-staging-api.trustware.io";
519
519
  GTM_ID = "GTM-TZDGNCXB";
520
520
  API_PREFIX = "/api";
@@ -31882,7 +31882,18 @@ async function sendRouteAsUserOperation(params) {
31882
31882
  );
31883
31883
  }
31884
31884
  console.debug("[send] UserOp included", { userOpHash, txHash });
31885
- await submitReceipt(intentId, txHash, getSponsorshipRequestId(), eoaAddress);
31885
+ try {
31886
+ void submitReceipt(
31887
+ intentId,
31888
+ txHash,
31889
+ getSponsorshipRequestId(),
31890
+ eoaAddress
31891
+ ).catch((err) => {
31892
+ console.debug("[send] receipt submission failed (non-fatal)", err);
31893
+ });
31894
+ } catch (err) {
31895
+ console.debug("[send] receipt submission failed (non-fatal)", err);
31896
+ }
31886
31897
  return { userOpHash, txHash, intentId };
31887
31898
  }
31888
31899
  var NATIVE_ADDRS;
@@ -34106,10 +34117,6 @@ function useSwapExecution(fromChain) {
34106
34117
  numericChainId,
34107
34118
  { approvalsEnsured: ownsApprovals }
34108
34119
  );
34109
- try {
34110
- await submitReceipt(routeResult.intentId, hash);
34111
- } catch {
34112
- }
34113
34120
  setState((p) => ({
34114
34121
  ...p,
34115
34122
  isSubmitting: false,
@@ -34118,6 +34125,8 @@ function useSwapExecution(fromChain) {
34118
34125
  txStatus: "processing"
34119
34126
  }));
34120
34127
  startPolling(routeResult.intentId, onSuccess, onError);
34128
+ void submitReceipt(routeResult.intentId, hash).catch(() => {
34129
+ });
34121
34130
  } catch (err) {
34122
34131
  const msg = mapTxError(err);
34123
34132
  setState((p) => ({
@@ -36553,6 +36562,7 @@ function SwapMode({
36553
36562
  }, [route.loading]);
36554
36563
  (0, import_react50.useEffect)(() => {
36555
36564
  if (!route.data) return;
36565
+ if (stage !== "home" && stage !== "review") return;
36556
36566
  const id = setInterval(() => {
36557
36567
  const ts = quoteTimestampRef.current;
36558
36568
  if (ts === null) return;
@@ -36564,7 +36574,11 @@ function SwapMode({
36564
36574
  }
36565
36575
  }, 1e3);
36566
36576
  return () => clearInterval(id);
36567
- }, [route.data]);
36577
+ }, [route.data, stage]);
36578
+ const handleRetryQuote = (0, import_react50.useCallback)(() => {
36579
+ if (!latestFetchParamsRef.current) return;
36580
+ void fetchRef.current(latestFetchParamsRef.current);
36581
+ }, []);
36568
36582
  (0, import_react50.useEffect)(() => {
36569
36583
  if (stage !== "review") return;
36570
36584
  if (!route.data || !walletAddress) return;
@@ -38093,6 +38107,10 @@ function SwapMode({
38093
38107
  txStatus: execution.txStatus,
38094
38108
  isSubmitting: execution.isSubmitting,
38095
38109
  isGasSponsored,
38110
+ hasQuote: !!route.data,
38111
+ isQuoteRefreshing: route.loading,
38112
+ quoteError: route.error,
38113
+ onRetryQuote: handleRetryQuote,
38096
38114
  onExecute: () => void handleExecute()
38097
38115
  }
38098
38116
  )
@@ -39429,10 +39447,15 @@ function SwapActionArea({
39429
39447
  txStatus,
39430
39448
  isSubmitting,
39431
39449
  isGasSponsored,
39450
+ hasQuote,
39451
+ isQuoteRefreshing,
39452
+ quoteError,
39453
+ onRetryQuote,
39432
39454
  onExecute
39433
39455
  }) {
39434
39456
  const needsApproval = allowanceStatus === "needed" && !isGasSponsored;
39435
39457
  const isChecking = allowanceStatus === "checking";
39458
+ const quoteUnavailable = !hasQuote && !isQuoteRefreshing && !isSubmitting && txStatus === "idle";
39436
39459
  let label;
39437
39460
  if (isChecking) {
39438
39461
  label = "Checking approval...";
@@ -39440,12 +39463,14 @@ function SwapActionArea({
39440
39463
  label = `Approving ${fromTokenSymbol}...`;
39441
39464
  } else if (isSubmitting) {
39442
39465
  label = "Confirm in wallet...";
39466
+ } else if (isQuoteRefreshing) {
39467
+ label = "Refreshing quote...";
39443
39468
  } else if (needsApproval) {
39444
39469
  label = `Approve ${fromTokenSymbol}`;
39445
39470
  } else {
39446
39471
  label = "Swap";
39447
39472
  }
39448
- const isDisabled = isSubmitting || isChecking;
39473
+ const isDisabled = isSubmitting || isChecking || isQuoteRefreshing || !hasQuote;
39449
39474
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { style: { marginTop: spacing[6] }, children: [
39450
39475
  isGasSponsored && !isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
39451
39476
  "div",
@@ -39485,7 +39510,38 @@ function SwapActionArea({
39485
39510
  ]
39486
39511
  }
39487
39512
  ),
39488
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39513
+ quoteUnavailable ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
39514
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39515
+ "p",
39516
+ {
39517
+ style: {
39518
+ fontSize: fontSize.xs,
39519
+ color: colors.destructive,
39520
+ textAlign: "center",
39521
+ marginBottom: spacing[3]
39522
+ },
39523
+ children: quoteError ?? "This quote expired."
39524
+ }
39525
+ ),
39526
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39527
+ "button",
39528
+ {
39529
+ onClick: onRetryQuote,
39530
+ style: {
39531
+ width: "100%",
39532
+ height: "3.5rem",
39533
+ borderRadius: "1.5rem",
39534
+ backgroundColor: colors.primary,
39535
+ color: colors.primaryForeground,
39536
+ fontSize: fontSize.base,
39537
+ fontWeight: fontWeight.semibold,
39538
+ border: 0,
39539
+ cursor: "pointer"
39540
+ },
39541
+ children: "Get a new quote"
39542
+ }
39543
+ )
39544
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
39489
39545
  "button",
39490
39546
  {
39491
39547
  onClick: onExecute,