@trustware/sdk-staging 1.1.17-staging.6 → 1.1.17-staging.7

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/widget.mjs CHANGED
@@ -620,7 +620,7 @@ var init_constants = __esm({
620
620
  "src/constants.ts"() {
621
621
  "use strict";
622
622
  SDK_NAME = "@trustware/sdk";
623
- SDK_VERSION = "1.1.17-staging.6";
623
+ SDK_VERSION = "1.1.17-staging.7";
624
624
  API_ROOT = "https://bv-staging-api.trustware.io";
625
625
  GTM_ID = "GTM-TZDGNCXB";
626
626
  API_PREFIX = "/api";
@@ -37728,6 +37728,26 @@ var init_currency = __esm({
37728
37728
  }
37729
37729
  });
37730
37730
 
37731
+ // src/modes/swap/amountFormat.ts
37732
+ function fmtAmount(n, maxFractionDigits = 6) {
37733
+ if (!isFinite(n) || n === 0) return "0";
37734
+ if (Math.abs(n) < 10 ** -maxFractionDigits) {
37735
+ return n.toLocaleString(void 0, {
37736
+ maximumSignificantDigits: SMALL_AMOUNT_SIGNIFICANT_DIGITS
37737
+ });
37738
+ }
37739
+ return n.toLocaleString(void 0, {
37740
+ maximumFractionDigits: maxFractionDigits
37741
+ });
37742
+ }
37743
+ var SMALL_AMOUNT_SIGNIFICANT_DIGITS;
37744
+ var init_amountFormat = __esm({
37745
+ "src/modes/swap/amountFormat.ts"() {
37746
+ "use strict";
37747
+ SMALL_AMOUNT_SIGNIFICANT_DIGITS = 2;
37748
+ }
37749
+ });
37750
+
37731
37751
  // src/widget/lib/quoteCountdown.ts
37732
37752
  function quoteCountdown(elapsedMs, intervalMs) {
37733
37753
  if (!Number.isFinite(intervalMs) || intervalMs <= 0) {
@@ -39057,10 +39077,6 @@ import {
39057
39077
  } from "react";
39058
39078
  import ReactDOM from "react-dom";
39059
39079
  import { Fragment as Fragment15, jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
39060
- function fmtAmount(n, max = 6) {
39061
- if (!isFinite(n) || n === 0) return "0";
39062
- return n.toLocaleString(void 0, { maximumFractionDigits: max });
39063
- }
39064
39080
  function buildExplorerUrl(hash, chain, backendUrl) {
39065
39081
  if (backendUrl) return backendUrl;
39066
39082
  const base2 = chain?.blockExplorerUrls?.[0];
@@ -40797,249 +40813,34 @@ function SwapMode({
40797
40813
  }
40798
40814
  ),
40799
40815
  completedStr && /* @__PURE__ */ jsx57(SuccessReceiptRow, { label: "Completed", value: completedStr }),
40800
- txHash && (() => {
40801
- const srcUrl = buildExplorerUrl(
40802
- txHash,
40803
- fromChain,
40804
- fromChainTxUrl
40805
- );
40806
- const isCopied = copiedHash === txHash;
40807
- return /* @__PURE__ */ jsxs47(
40808
- "div",
40809
- {
40810
- style: {
40811
- display: "flex",
40812
- alignItems: "center",
40813
- justifyContent: "space-between"
40814
- },
40815
- children: [
40816
- /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: destTxHash ? "Source tx" : "Transaction" }),
40817
- /* @__PURE__ */ jsxs47(
40818
- "div",
40819
- {
40820
- style: {
40821
- display: "inline-flex",
40822
- alignItems: "center",
40823
- gap: spacing[2]
40824
- },
40825
- children: [
40826
- srcUrl && /* @__PURE__ */ jsxs47(
40827
- "a",
40828
- {
40829
- href: srcUrl,
40830
- target: "_blank",
40831
- rel: "noopener noreferrer",
40832
- style: {
40833
- display: "inline-flex",
40834
- alignItems: "center",
40835
- gap: "0.25rem",
40836
- color: colors.foreground,
40837
- fontWeight: fontWeight.medium,
40838
- textDecorationLine: "underline",
40839
- textDecorationStyle: "dotted",
40840
- textUnderlineOffset: "4px"
40841
- },
40842
- children: [
40843
- txHash.slice(0, 6),
40844
- "\u2026",
40845
- txHash.slice(-4),
40846
- /* @__PURE__ */ jsxs47(
40847
- "svg",
40848
- {
40849
- style: { width: "0.75rem", height: "0.75rem" },
40850
- viewBox: "0 0 24 24",
40851
- fill: "none",
40852
- stroke: "currentColor",
40853
- strokeWidth: 2,
40854
- strokeLinecap: "round",
40855
- strokeLinejoin: "round",
40856
- children: [
40857
- /* @__PURE__ */ jsx57("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
40858
- /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
40859
- /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
40860
- ]
40861
- }
40862
- )
40863
- ]
40864
- }
40865
- ),
40866
- /* @__PURE__ */ jsx57(
40867
- "button",
40868
- {
40869
- onClick: () => handleCopyHash(txHash),
40870
- title: "Copy full hash",
40871
- style: {
40872
- display: "inline-flex",
40873
- alignItems: "center",
40874
- gap: "0.2rem",
40875
- fontSize: fontSize.xs,
40876
- color: isCopied ? colors.green[500] : colors.mutedForeground,
40877
- backgroundColor: "transparent",
40878
- border: 0,
40879
- cursor: "pointer",
40880
- fontFamily: "inherit",
40881
- padding: 0,
40882
- transition: "color 0.15s"
40883
- },
40884
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
40885
- "svg",
40886
- {
40887
- style: {
40888
- width: "0.875rem",
40889
- height: "0.875rem"
40890
- },
40891
- viewBox: "0 0 24 24",
40892
- fill: "none",
40893
- stroke: "currentColor",
40894
- strokeWidth: 2,
40895
- strokeLinecap: "round",
40896
- strokeLinejoin: "round",
40897
- children: [
40898
- /* @__PURE__ */ jsx57(
40899
- "rect",
40900
- {
40901
- x: "9",
40902
- y: "9",
40903
- width: "13",
40904
- height: "13",
40905
- rx: "2",
40906
- ry: "2"
40907
- }
40908
- ),
40909
- /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
40910
- ]
40911
- }
40912
- )
40913
- }
40914
- )
40915
- ]
40916
- }
40917
- )
40918
- ]
40919
- }
40920
- );
40921
- })(),
40922
- destTxHash && (() => {
40923
- const destUrl = buildExplorerUrl(
40924
- destTxHash,
40925
- toChain,
40926
- toChainTxUrl
40927
- );
40928
- const isCopied = copiedHash === destTxHash;
40929
- return /* @__PURE__ */ jsxs47(
40930
- "div",
40931
- {
40932
- style: {
40933
- display: "flex",
40934
- alignItems: "center",
40935
- justifyContent: "space-between"
40936
- },
40937
- children: [
40938
- /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: "Destination tx" }),
40939
- /* @__PURE__ */ jsxs47(
40940
- "div",
40941
- {
40942
- style: {
40943
- display: "inline-flex",
40944
- alignItems: "center",
40945
- gap: spacing[2]
40946
- },
40947
- children: [
40948
- destUrl && /* @__PURE__ */ jsxs47(
40949
- "a",
40950
- {
40951
- href: destUrl,
40952
- target: "_blank",
40953
- rel: "noopener noreferrer",
40954
- style: {
40955
- display: "inline-flex",
40956
- alignItems: "center",
40957
- gap: "0.25rem",
40958
- color: colors.foreground,
40959
- fontWeight: fontWeight.medium,
40960
- textDecorationLine: "underline",
40961
- textDecorationStyle: "dotted",
40962
- textUnderlineOffset: "4px"
40963
- },
40964
- children: [
40965
- destTxHash.slice(0, 6),
40966
- "\u2026",
40967
- destTxHash.slice(-4),
40968
- /* @__PURE__ */ jsxs47(
40969
- "svg",
40970
- {
40971
- style: { width: "0.75rem", height: "0.75rem" },
40972
- viewBox: "0 0 24 24",
40973
- fill: "none",
40974
- stroke: "currentColor",
40975
- strokeWidth: 2,
40976
- strokeLinecap: "round",
40977
- strokeLinejoin: "round",
40978
- children: [
40979
- /* @__PURE__ */ jsx57("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
40980
- /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
40981
- /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
40982
- ]
40983
- }
40984
- )
40985
- ]
40986
- }
40987
- ),
40988
- /* @__PURE__ */ jsx57(
40989
- "button",
40990
- {
40991
- onClick: () => handleCopyHash(destTxHash),
40992
- title: "Copy full hash",
40993
- style: {
40994
- display: "inline-flex",
40995
- alignItems: "center",
40996
- fontSize: fontSize.xs,
40997
- color: isCopied ? colors.green[500] : colors.mutedForeground,
40998
- backgroundColor: "transparent",
40999
- border: 0,
41000
- cursor: "pointer",
41001
- fontFamily: "inherit",
41002
- padding: 0,
41003
- transition: "color 0.15s"
41004
- },
41005
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
41006
- "svg",
41007
- {
41008
- style: {
41009
- width: "0.875rem",
41010
- height: "0.875rem"
41011
- },
41012
- viewBox: "0 0 24 24",
41013
- fill: "none",
41014
- stroke: "currentColor",
41015
- strokeWidth: 2,
41016
- strokeLinecap: "round",
41017
- strokeLinejoin: "round",
41018
- children: [
41019
- /* @__PURE__ */ jsx57(
41020
- "rect",
41021
- {
41022
- x: "9",
41023
- y: "9",
41024
- width: "13",
41025
- height: "13",
41026
- rx: "2",
41027
- ry: "2"
41028
- }
41029
- ),
41030
- /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
41031
- ]
41032
- }
41033
- )
41034
- }
41035
- )
41036
- ]
41037
- }
41038
- )
41039
- ]
41040
- }
41041
- );
41042
- })()
40816
+ txHash && /* @__PURE__ */ jsx57(
40817
+ SuccessTxHashRow,
40818
+ {
40819
+ label: destTxHash ? "Source tx" : "Transaction",
40820
+ hash: txHash,
40821
+ explorerUrl: buildExplorerUrl(
40822
+ txHash,
40823
+ fromChain,
40824
+ fromChainTxUrl
40825
+ ),
40826
+ isCopied: copiedHash === txHash,
40827
+ onCopy: handleCopyHash
40828
+ }
40829
+ ),
40830
+ destTxHash && /* @__PURE__ */ jsx57(
40831
+ SuccessTxHashRow,
40832
+ {
40833
+ label: "Destination tx",
40834
+ hash: destTxHash,
40835
+ explorerUrl: buildExplorerUrl(
40836
+ destTxHash,
40837
+ toChain,
40838
+ toChainTxUrl
40839
+ ),
40840
+ isCopied: copiedHash === destTxHash,
40841
+ onCopy: handleCopyHash
40842
+ }
40843
+ )
41043
40844
  ]
41044
40845
  }
41045
40846
  )
@@ -43388,6 +43189,119 @@ function SuccessReceiptRow({
43388
43189
  }
43389
43190
  );
43390
43191
  }
43192
+ function SuccessTxHashRow({
43193
+ label,
43194
+ hash,
43195
+ explorerUrl,
43196
+ isCopied,
43197
+ onCopy
43198
+ }) {
43199
+ const shortHash = `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
43200
+ return /* @__PURE__ */ jsxs47(
43201
+ "div",
43202
+ {
43203
+ style: {
43204
+ display: "flex",
43205
+ alignItems: "center",
43206
+ justifyContent: "space-between"
43207
+ },
43208
+ children: [
43209
+ /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: label }),
43210
+ /* @__PURE__ */ jsxs47(
43211
+ "div",
43212
+ {
43213
+ style: {
43214
+ display: "inline-flex",
43215
+ alignItems: "center",
43216
+ gap: spacing[2]
43217
+ },
43218
+ children: [
43219
+ explorerUrl ? /* @__PURE__ */ jsxs47(
43220
+ "a",
43221
+ {
43222
+ href: explorerUrl,
43223
+ target: "_blank",
43224
+ rel: "noopener noreferrer",
43225
+ style: {
43226
+ display: "inline-flex",
43227
+ alignItems: "center",
43228
+ gap: "0.25rem",
43229
+ color: colors.foreground,
43230
+ fontWeight: fontWeight.medium,
43231
+ textDecorationLine: "underline",
43232
+ textDecorationStyle: "dotted",
43233
+ textUnderlineOffset: "4px"
43234
+ },
43235
+ children: [
43236
+ shortHash,
43237
+ /* @__PURE__ */ jsxs47(
43238
+ "svg",
43239
+ {
43240
+ style: { width: "0.75rem", height: "0.75rem" },
43241
+ viewBox: "0 0 24 24",
43242
+ fill: "none",
43243
+ stroke: "currentColor",
43244
+ strokeWidth: 2,
43245
+ strokeLinecap: "round",
43246
+ strokeLinejoin: "round",
43247
+ children: [
43248
+ /* @__PURE__ */ jsx57("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
43249
+ /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
43250
+ /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
43251
+ ]
43252
+ }
43253
+ )
43254
+ ]
43255
+ }
43256
+ ) : /* @__PURE__ */ jsx57(
43257
+ "span",
43258
+ {
43259
+ style: { color: colors.foreground, fontWeight: fontWeight.medium },
43260
+ children: shortHash
43261
+ }
43262
+ ),
43263
+ /* @__PURE__ */ jsx57(
43264
+ "button",
43265
+ {
43266
+ onClick: () => onCopy(hash),
43267
+ title: "Copy full hash",
43268
+ style: {
43269
+ display: "inline-flex",
43270
+ alignItems: "center",
43271
+ fontSize: fontSize.xs,
43272
+ color: isCopied ? colors.green[500] : colors.mutedForeground,
43273
+ backgroundColor: "transparent",
43274
+ border: 0,
43275
+ cursor: "pointer",
43276
+ fontFamily: "inherit",
43277
+ padding: 0,
43278
+ transition: "color 0.15s"
43279
+ },
43280
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
43281
+ "svg",
43282
+ {
43283
+ style: { width: "0.875rem", height: "0.875rem" },
43284
+ viewBox: "0 0 24 24",
43285
+ fill: "none",
43286
+ stroke: "currentColor",
43287
+ strokeWidth: 2,
43288
+ strokeLinecap: "round",
43289
+ strokeLinejoin: "round",
43290
+ children: [
43291
+ /* @__PURE__ */ jsx57("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
43292
+ /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
43293
+ ]
43294
+ }
43295
+ )
43296
+ }
43297
+ )
43298
+ ]
43299
+ }
43300
+ )
43301
+ ]
43302
+ }
43303
+ );
43304
+ }
43391
43305
  function ProcessingStepNode({
43392
43306
  active,
43393
43307
  done,
@@ -43542,6 +43456,7 @@ var init_SwapMode = __esm({
43542
43456
  init_SwapTokenSelect();
43543
43457
  init_VaultDiscovery();
43544
43458
  init_currency();
43459
+ init_amountFormat();
43545
43460
  init_quoteCountdown();
43546
43461
  init_components2();
43547
43462
  ConfettiEffect3 = lazy2(