@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/index.mjs CHANGED
@@ -611,7 +611,7 @@ var init_constants = __esm({
611
611
  "src/constants.ts"() {
612
612
  "use strict";
613
613
  SDK_NAME = "@trustware/sdk";
614
- SDK_VERSION = "1.1.17-staging.6";
614
+ SDK_VERSION = "1.1.17-staging.7";
615
615
  API_ROOT = "https://bv-staging-api.trustware.io";
616
616
  GTM_ID = "GTM-TZDGNCXB";
617
617
  API_PREFIX = "/api";
@@ -37890,6 +37890,26 @@ var init_currency = __esm({
37890
37890
  }
37891
37891
  });
37892
37892
 
37893
+ // src/modes/swap/amountFormat.ts
37894
+ function fmtAmount(n, maxFractionDigits = 6) {
37895
+ if (!isFinite(n) || n === 0) return "0";
37896
+ if (Math.abs(n) < 10 ** -maxFractionDigits) {
37897
+ return n.toLocaleString(void 0, {
37898
+ maximumSignificantDigits: SMALL_AMOUNT_SIGNIFICANT_DIGITS
37899
+ });
37900
+ }
37901
+ return n.toLocaleString(void 0, {
37902
+ maximumFractionDigits: maxFractionDigits
37903
+ });
37904
+ }
37905
+ var SMALL_AMOUNT_SIGNIFICANT_DIGITS;
37906
+ var init_amountFormat = __esm({
37907
+ "src/modes/swap/amountFormat.ts"() {
37908
+ "use strict";
37909
+ SMALL_AMOUNT_SIGNIFICANT_DIGITS = 2;
37910
+ }
37911
+ });
37912
+
37893
37913
  // src/widget/lib/quoteCountdown.ts
37894
37914
  function quoteCountdown(elapsedMs, intervalMs) {
37895
37915
  if (!Number.isFinite(intervalMs) || intervalMs <= 0) {
@@ -39219,10 +39239,6 @@ import {
39219
39239
  } from "react";
39220
39240
  import ReactDOM from "react-dom";
39221
39241
  import { Fragment as Fragment15, jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
39222
- function fmtAmount(n, max = 6) {
39223
- if (!isFinite(n) || n === 0) return "0";
39224
- return n.toLocaleString(void 0, { maximumFractionDigits: max });
39225
- }
39226
39242
  function buildExplorerUrl(hash, chain, backendUrl) {
39227
39243
  if (backendUrl) return backendUrl;
39228
39244
  const base2 = chain?.blockExplorerUrls?.[0];
@@ -40959,249 +40975,34 @@ function SwapMode({
40959
40975
  }
40960
40976
  ),
40961
40977
  completedStr && /* @__PURE__ */ jsx57(SuccessReceiptRow, { label: "Completed", value: completedStr }),
40962
- txHash && (() => {
40963
- const srcUrl = buildExplorerUrl(
40964
- txHash,
40965
- fromChain,
40966
- fromChainTxUrl
40967
- );
40968
- const isCopied = copiedHash === txHash;
40969
- return /* @__PURE__ */ jsxs47(
40970
- "div",
40971
- {
40972
- style: {
40973
- display: "flex",
40974
- alignItems: "center",
40975
- justifyContent: "space-between"
40976
- },
40977
- children: [
40978
- /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: destTxHash ? "Source tx" : "Transaction" }),
40979
- /* @__PURE__ */ jsxs47(
40980
- "div",
40981
- {
40982
- style: {
40983
- display: "inline-flex",
40984
- alignItems: "center",
40985
- gap: spacing[2]
40986
- },
40987
- children: [
40988
- srcUrl && /* @__PURE__ */ jsxs47(
40989
- "a",
40990
- {
40991
- href: srcUrl,
40992
- target: "_blank",
40993
- rel: "noopener noreferrer",
40994
- style: {
40995
- display: "inline-flex",
40996
- alignItems: "center",
40997
- gap: "0.25rem",
40998
- color: colors.foreground,
40999
- fontWeight: fontWeight.medium,
41000
- textDecorationLine: "underline",
41001
- textDecorationStyle: "dotted",
41002
- textUnderlineOffset: "4px"
41003
- },
41004
- children: [
41005
- txHash.slice(0, 6),
41006
- "\u2026",
41007
- txHash.slice(-4),
41008
- /* @__PURE__ */ jsxs47(
41009
- "svg",
41010
- {
41011
- style: { width: "0.75rem", height: "0.75rem" },
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("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
41020
- /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
41021
- /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
41022
- ]
41023
- }
41024
- )
41025
- ]
41026
- }
41027
- ),
41028
- /* @__PURE__ */ jsx57(
41029
- "button",
41030
- {
41031
- onClick: () => handleCopyHash(txHash),
41032
- title: "Copy full hash",
41033
- style: {
41034
- display: "inline-flex",
41035
- alignItems: "center",
41036
- gap: "0.2rem",
41037
- fontSize: fontSize.xs,
41038
- color: isCopied ? colors.green[500] : colors.mutedForeground,
41039
- backgroundColor: "transparent",
41040
- border: 0,
41041
- cursor: "pointer",
41042
- fontFamily: "inherit",
41043
- padding: 0,
41044
- transition: "color 0.15s"
41045
- },
41046
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
41047
- "svg",
41048
- {
41049
- style: {
41050
- width: "0.875rem",
41051
- height: "0.875rem"
41052
- },
41053
- viewBox: "0 0 24 24",
41054
- fill: "none",
41055
- stroke: "currentColor",
41056
- strokeWidth: 2,
41057
- strokeLinecap: "round",
41058
- strokeLinejoin: "round",
41059
- children: [
41060
- /* @__PURE__ */ jsx57(
41061
- "rect",
41062
- {
41063
- x: "9",
41064
- y: "9",
41065
- width: "13",
41066
- height: "13",
41067
- rx: "2",
41068
- ry: "2"
41069
- }
41070
- ),
41071
- /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
41072
- ]
41073
- }
41074
- )
41075
- }
41076
- )
41077
- ]
41078
- }
41079
- )
41080
- ]
41081
- }
41082
- );
41083
- })(),
41084
- destTxHash && (() => {
41085
- const destUrl = buildExplorerUrl(
41086
- destTxHash,
41087
- toChain,
41088
- toChainTxUrl
41089
- );
41090
- const isCopied = copiedHash === destTxHash;
41091
- return /* @__PURE__ */ jsxs47(
41092
- "div",
41093
- {
41094
- style: {
41095
- display: "flex",
41096
- alignItems: "center",
41097
- justifyContent: "space-between"
41098
- },
41099
- children: [
41100
- /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: "Destination tx" }),
41101
- /* @__PURE__ */ jsxs47(
41102
- "div",
41103
- {
41104
- style: {
41105
- display: "inline-flex",
41106
- alignItems: "center",
41107
- gap: spacing[2]
41108
- },
41109
- children: [
41110
- destUrl && /* @__PURE__ */ jsxs47(
41111
- "a",
41112
- {
41113
- href: destUrl,
41114
- target: "_blank",
41115
- rel: "noopener noreferrer",
41116
- style: {
41117
- display: "inline-flex",
41118
- alignItems: "center",
41119
- gap: "0.25rem",
41120
- color: colors.foreground,
41121
- fontWeight: fontWeight.medium,
41122
- textDecorationLine: "underline",
41123
- textDecorationStyle: "dotted",
41124
- textUnderlineOffset: "4px"
41125
- },
41126
- children: [
41127
- destTxHash.slice(0, 6),
41128
- "\u2026",
41129
- destTxHash.slice(-4),
41130
- /* @__PURE__ */ jsxs47(
41131
- "svg",
41132
- {
41133
- style: { width: "0.75rem", height: "0.75rem" },
41134
- viewBox: "0 0 24 24",
41135
- fill: "none",
41136
- stroke: "currentColor",
41137
- strokeWidth: 2,
41138
- strokeLinecap: "round",
41139
- strokeLinejoin: "round",
41140
- children: [
41141
- /* @__PURE__ */ jsx57("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
41142
- /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
41143
- /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
41144
- ]
41145
- }
41146
- )
41147
- ]
41148
- }
41149
- ),
41150
- /* @__PURE__ */ jsx57(
41151
- "button",
41152
- {
41153
- onClick: () => handleCopyHash(destTxHash),
41154
- title: "Copy full hash",
41155
- style: {
41156
- display: "inline-flex",
41157
- alignItems: "center",
41158
- fontSize: fontSize.xs,
41159
- color: isCopied ? colors.green[500] : colors.mutedForeground,
41160
- backgroundColor: "transparent",
41161
- border: 0,
41162
- cursor: "pointer",
41163
- fontFamily: "inherit",
41164
- padding: 0,
41165
- transition: "color 0.15s"
41166
- },
41167
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
41168
- "svg",
41169
- {
41170
- style: {
41171
- width: "0.875rem",
41172
- height: "0.875rem"
41173
- },
41174
- viewBox: "0 0 24 24",
41175
- fill: "none",
41176
- stroke: "currentColor",
41177
- strokeWidth: 2,
41178
- strokeLinecap: "round",
41179
- strokeLinejoin: "round",
41180
- children: [
41181
- /* @__PURE__ */ jsx57(
41182
- "rect",
41183
- {
41184
- x: "9",
41185
- y: "9",
41186
- width: "13",
41187
- height: "13",
41188
- rx: "2",
41189
- ry: "2"
41190
- }
41191
- ),
41192
- /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
41193
- ]
41194
- }
41195
- )
41196
- }
41197
- )
41198
- ]
41199
- }
41200
- )
41201
- ]
41202
- }
41203
- );
41204
- })()
40978
+ txHash && /* @__PURE__ */ jsx57(
40979
+ SuccessTxHashRow,
40980
+ {
40981
+ label: destTxHash ? "Source tx" : "Transaction",
40982
+ hash: txHash,
40983
+ explorerUrl: buildExplorerUrl(
40984
+ txHash,
40985
+ fromChain,
40986
+ fromChainTxUrl
40987
+ ),
40988
+ isCopied: copiedHash === txHash,
40989
+ onCopy: handleCopyHash
40990
+ }
40991
+ ),
40992
+ destTxHash && /* @__PURE__ */ jsx57(
40993
+ SuccessTxHashRow,
40994
+ {
40995
+ label: "Destination tx",
40996
+ hash: destTxHash,
40997
+ explorerUrl: buildExplorerUrl(
40998
+ destTxHash,
40999
+ toChain,
41000
+ toChainTxUrl
41001
+ ),
41002
+ isCopied: copiedHash === destTxHash,
41003
+ onCopy: handleCopyHash
41004
+ }
41005
+ )
41205
41006
  ]
41206
41007
  }
41207
41008
  )
@@ -43550,6 +43351,119 @@ function SuccessReceiptRow({
43550
43351
  }
43551
43352
  );
43552
43353
  }
43354
+ function SuccessTxHashRow({
43355
+ label,
43356
+ hash,
43357
+ explorerUrl,
43358
+ isCopied,
43359
+ onCopy
43360
+ }) {
43361
+ const shortHash = `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
43362
+ return /* @__PURE__ */ jsxs47(
43363
+ "div",
43364
+ {
43365
+ style: {
43366
+ display: "flex",
43367
+ alignItems: "center",
43368
+ justifyContent: "space-between"
43369
+ },
43370
+ children: [
43371
+ /* @__PURE__ */ jsx57("span", { style: { color: colors.mutedForeground }, children: label }),
43372
+ /* @__PURE__ */ jsxs47(
43373
+ "div",
43374
+ {
43375
+ style: {
43376
+ display: "inline-flex",
43377
+ alignItems: "center",
43378
+ gap: spacing[2]
43379
+ },
43380
+ children: [
43381
+ explorerUrl ? /* @__PURE__ */ jsxs47(
43382
+ "a",
43383
+ {
43384
+ href: explorerUrl,
43385
+ target: "_blank",
43386
+ rel: "noopener noreferrer",
43387
+ style: {
43388
+ display: "inline-flex",
43389
+ alignItems: "center",
43390
+ gap: "0.25rem",
43391
+ color: colors.foreground,
43392
+ fontWeight: fontWeight.medium,
43393
+ textDecorationLine: "underline",
43394
+ textDecorationStyle: "dotted",
43395
+ textUnderlineOffset: "4px"
43396
+ },
43397
+ children: [
43398
+ shortHash,
43399
+ /* @__PURE__ */ jsxs47(
43400
+ "svg",
43401
+ {
43402
+ style: { width: "0.75rem", height: "0.75rem" },
43403
+ viewBox: "0 0 24 24",
43404
+ fill: "none",
43405
+ stroke: "currentColor",
43406
+ strokeWidth: 2,
43407
+ strokeLinecap: "round",
43408
+ strokeLinejoin: "round",
43409
+ children: [
43410
+ /* @__PURE__ */ jsx57("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
43411
+ /* @__PURE__ */ jsx57("polyline", { points: "15 3 21 3 21 9" }),
43412
+ /* @__PURE__ */ jsx57("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
43413
+ ]
43414
+ }
43415
+ )
43416
+ ]
43417
+ }
43418
+ ) : /* @__PURE__ */ jsx57(
43419
+ "span",
43420
+ {
43421
+ style: { color: colors.foreground, fontWeight: fontWeight.medium },
43422
+ children: shortHash
43423
+ }
43424
+ ),
43425
+ /* @__PURE__ */ jsx57(
43426
+ "button",
43427
+ {
43428
+ onClick: () => onCopy(hash),
43429
+ title: "Copy full hash",
43430
+ style: {
43431
+ display: "inline-flex",
43432
+ alignItems: "center",
43433
+ fontSize: fontSize.xs,
43434
+ color: isCopied ? colors.green[500] : colors.mutedForeground,
43435
+ backgroundColor: "transparent",
43436
+ border: 0,
43437
+ cursor: "pointer",
43438
+ fontFamily: "inherit",
43439
+ padding: 0,
43440
+ transition: "color 0.15s"
43441
+ },
43442
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs47(
43443
+ "svg",
43444
+ {
43445
+ style: { width: "0.875rem", height: "0.875rem" },
43446
+ viewBox: "0 0 24 24",
43447
+ fill: "none",
43448
+ stroke: "currentColor",
43449
+ strokeWidth: 2,
43450
+ strokeLinecap: "round",
43451
+ strokeLinejoin: "round",
43452
+ children: [
43453
+ /* @__PURE__ */ jsx57("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
43454
+ /* @__PURE__ */ jsx57("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
43455
+ ]
43456
+ }
43457
+ )
43458
+ }
43459
+ )
43460
+ ]
43461
+ }
43462
+ )
43463
+ ]
43464
+ }
43465
+ );
43466
+ }
43553
43467
  function ProcessingStepNode({
43554
43468
  active,
43555
43469
  done,
@@ -43704,6 +43618,7 @@ var init_SwapMode = __esm({
43704
43618
  init_SwapTokenSelect();
43705
43619
  init_VaultDiscovery();
43706
43620
  init_currency();
43621
+ init_amountFormat();
43707
43622
  init_quoteCountdown();
43708
43623
  init_components2();
43709
43624
  ConfettiEffect3 = lazy2(