@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.
@@ -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.17-staging.6";
33
+ var SDK_VERSION = "1.1.17-staging.7";
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.17-staging.6";
3
+ var SDK_VERSION = "1.1.17-staging.7";
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
@@ -132,7 +132,7 @@ var init_constants = __esm({
132
132
  "src/constants.ts"() {
133
133
  "use strict";
134
134
  SDK_NAME = "@trustware/sdk";
135
- SDK_VERSION = "1.1.17-staging.6";
135
+ SDK_VERSION = "1.1.17-staging.7";
136
136
  API_ROOT = "https://bv-staging-api.trustware.io";
137
137
  API_PREFIX = "/api";
138
138
  WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
package/dist/core.mjs CHANGED
@@ -110,7 +110,7 @@ var init_constants = __esm({
110
110
  "src/constants.ts"() {
111
111
  "use strict";
112
112
  SDK_NAME = "@trustware/sdk";
113
- SDK_VERSION = "1.1.17-staging.6";
113
+ SDK_VERSION = "1.1.17-staging.7";
114
114
  API_ROOT = "https://bv-staging-api.trustware.io";
115
115
  API_PREFIX = "/api";
116
116
  WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
package/dist/index.cjs CHANGED
@@ -633,7 +633,7 @@ var init_constants = __esm({
633
633
  "src/constants.ts"() {
634
634
  "use strict";
635
635
  SDK_NAME = "@trustware/sdk";
636
- SDK_VERSION = "1.1.17-staging.6";
636
+ SDK_VERSION = "1.1.17-staging.7";
637
637
  API_ROOT = "https://bv-staging-api.trustware.io";
638
638
  GTM_ID = "GTM-TZDGNCXB";
639
639
  API_PREFIX = "/api";
@@ -37947,6 +37947,26 @@ var init_currency = __esm({
37947
37947
  }
37948
37948
  });
37949
37949
 
37950
+ // src/modes/swap/amountFormat.ts
37951
+ function fmtAmount(n, maxFractionDigits = 6) {
37952
+ if (!isFinite(n) || n === 0) return "0";
37953
+ if (Math.abs(n) < 10 ** -maxFractionDigits) {
37954
+ return n.toLocaleString(void 0, {
37955
+ maximumSignificantDigits: SMALL_AMOUNT_SIGNIFICANT_DIGITS
37956
+ });
37957
+ }
37958
+ return n.toLocaleString(void 0, {
37959
+ maximumFractionDigits: maxFractionDigits
37960
+ });
37961
+ }
37962
+ var SMALL_AMOUNT_SIGNIFICANT_DIGITS;
37963
+ var init_amountFormat = __esm({
37964
+ "src/modes/swap/amountFormat.ts"() {
37965
+ "use strict";
37966
+ SMALL_AMOUNT_SIGNIFICANT_DIGITS = 2;
37967
+ }
37968
+ });
37969
+
37950
37970
  // src/widget/lib/quoteCountdown.ts
37951
37971
  function quoteCountdown(elapsedMs, intervalMs) {
37952
37972
  if (!Number.isFinite(intervalMs) || intervalMs <= 0) {
@@ -39265,10 +39285,6 @@ var init_components2 = __esm({
39265
39285
  });
39266
39286
 
39267
39287
  // src/modes/swap/SwapMode.tsx
39268
- function fmtAmount(n, max = 6) {
39269
- if (!isFinite(n) || n === 0) return "0";
39270
- return n.toLocaleString(void 0, { maximumFractionDigits: max });
39271
- }
39272
39288
  function buildExplorerUrl(hash, chain, backendUrl) {
39273
39289
  if (backendUrl) return backendUrl;
39274
39290
  const base2 = chain?.blockExplorerUrls?.[0];
@@ -41005,249 +41021,34 @@ function SwapMode({
41005
41021
  }
41006
41022
  ),
41007
41023
  completedStr && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(SuccessReceiptRow, { label: "Completed", value: completedStr }),
41008
- txHash && (() => {
41009
- const srcUrl = buildExplorerUrl(
41010
- txHash,
41011
- fromChain,
41012
- fromChainTxUrl
41013
- );
41014
- const isCopied = copiedHash === txHash;
41015
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41016
- "div",
41017
- {
41018
- style: {
41019
- display: "flex",
41020
- alignItems: "center",
41021
- justifyContent: "space-between"
41022
- },
41023
- children: [
41024
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { style: { color: colors.mutedForeground }, children: destTxHash ? "Source tx" : "Transaction" }),
41025
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41026
- "div",
41027
- {
41028
- style: {
41029
- display: "inline-flex",
41030
- alignItems: "center",
41031
- gap: spacing[2]
41032
- },
41033
- children: [
41034
- srcUrl && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41035
- "a",
41036
- {
41037
- href: srcUrl,
41038
- target: "_blank",
41039
- rel: "noopener noreferrer",
41040
- style: {
41041
- display: "inline-flex",
41042
- alignItems: "center",
41043
- gap: "0.25rem",
41044
- color: colors.foreground,
41045
- fontWeight: fontWeight.medium,
41046
- textDecorationLine: "underline",
41047
- textDecorationStyle: "dotted",
41048
- textUnderlineOffset: "4px"
41049
- },
41050
- children: [
41051
- txHash.slice(0, 6),
41052
- "\u2026",
41053
- txHash.slice(-4),
41054
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41055
- "svg",
41056
- {
41057
- style: { width: "0.75rem", height: "0.75rem" },
41058
- viewBox: "0 0 24 24",
41059
- fill: "none",
41060
- stroke: "currentColor",
41061
- strokeWidth: 2,
41062
- strokeLinecap: "round",
41063
- strokeLinejoin: "round",
41064
- children: [
41065
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
41066
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("polyline", { points: "15 3 21 3 21 9" }),
41067
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
41068
- ]
41069
- }
41070
- )
41071
- ]
41072
- }
41073
- ),
41074
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41075
- "button",
41076
- {
41077
- onClick: () => handleCopyHash(txHash),
41078
- title: "Copy full hash",
41079
- style: {
41080
- display: "inline-flex",
41081
- alignItems: "center",
41082
- gap: "0.2rem",
41083
- fontSize: fontSize.xs,
41084
- color: isCopied ? colors.green[500] : colors.mutedForeground,
41085
- backgroundColor: "transparent",
41086
- border: 0,
41087
- cursor: "pointer",
41088
- fontFamily: "inherit",
41089
- padding: 0,
41090
- transition: "color 0.15s"
41091
- },
41092
- children: isCopied ? "Copied!" : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41093
- "svg",
41094
- {
41095
- style: {
41096
- width: "0.875rem",
41097
- height: "0.875rem"
41098
- },
41099
- viewBox: "0 0 24 24",
41100
- fill: "none",
41101
- stroke: "currentColor",
41102
- strokeWidth: 2,
41103
- strokeLinecap: "round",
41104
- strokeLinejoin: "round",
41105
- children: [
41106
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41107
- "rect",
41108
- {
41109
- x: "9",
41110
- y: "9",
41111
- width: "13",
41112
- height: "13",
41113
- rx: "2",
41114
- ry: "2"
41115
- }
41116
- ),
41117
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
41118
- ]
41119
- }
41120
- )
41121
- }
41122
- )
41123
- ]
41124
- }
41125
- )
41126
- ]
41127
- }
41128
- );
41129
- })(),
41130
- destTxHash && (() => {
41131
- const destUrl = buildExplorerUrl(
41132
- destTxHash,
41133
- toChain,
41134
- toChainTxUrl
41135
- );
41136
- const isCopied = copiedHash === destTxHash;
41137
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41138
- "div",
41139
- {
41140
- style: {
41141
- display: "flex",
41142
- alignItems: "center",
41143
- justifyContent: "space-between"
41144
- },
41145
- children: [
41146
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { style: { color: colors.mutedForeground }, children: "Destination tx" }),
41147
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41148
- "div",
41149
- {
41150
- style: {
41151
- display: "inline-flex",
41152
- alignItems: "center",
41153
- gap: spacing[2]
41154
- },
41155
- children: [
41156
- destUrl && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41157
- "a",
41158
- {
41159
- href: destUrl,
41160
- target: "_blank",
41161
- rel: "noopener noreferrer",
41162
- style: {
41163
- display: "inline-flex",
41164
- alignItems: "center",
41165
- gap: "0.25rem",
41166
- color: colors.foreground,
41167
- fontWeight: fontWeight.medium,
41168
- textDecorationLine: "underline",
41169
- textDecorationStyle: "dotted",
41170
- textUnderlineOffset: "4px"
41171
- },
41172
- children: [
41173
- destTxHash.slice(0, 6),
41174
- "\u2026",
41175
- destTxHash.slice(-4),
41176
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41177
- "svg",
41178
- {
41179
- style: { width: "0.75rem", height: "0.75rem" },
41180
- viewBox: "0 0 24 24",
41181
- fill: "none",
41182
- stroke: "currentColor",
41183
- strokeWidth: 2,
41184
- strokeLinecap: "round",
41185
- strokeLinejoin: "round",
41186
- children: [
41187
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
41188
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("polyline", { points: "15 3 21 3 21 9" }),
41189
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
41190
- ]
41191
- }
41192
- )
41193
- ]
41194
- }
41195
- ),
41196
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41197
- "button",
41198
- {
41199
- onClick: () => handleCopyHash(destTxHash),
41200
- title: "Copy full hash",
41201
- style: {
41202
- display: "inline-flex",
41203
- alignItems: "center",
41204
- fontSize: fontSize.xs,
41205
- color: isCopied ? colors.green[500] : colors.mutedForeground,
41206
- backgroundColor: "transparent",
41207
- border: 0,
41208
- cursor: "pointer",
41209
- fontFamily: "inherit",
41210
- padding: 0,
41211
- transition: "color 0.15s"
41212
- },
41213
- children: isCopied ? "Copied!" : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
41214
- "svg",
41215
- {
41216
- style: {
41217
- width: "0.875rem",
41218
- height: "0.875rem"
41219
- },
41220
- viewBox: "0 0 24 24",
41221
- fill: "none",
41222
- stroke: "currentColor",
41223
- strokeWidth: 2,
41224
- strokeLinecap: "round",
41225
- strokeLinejoin: "round",
41226
- children: [
41227
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41228
- "rect",
41229
- {
41230
- x: "9",
41231
- y: "9",
41232
- width: "13",
41233
- height: "13",
41234
- rx: "2",
41235
- ry: "2"
41236
- }
41237
- ),
41238
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
41239
- ]
41240
- }
41241
- )
41242
- }
41243
- )
41244
- ]
41245
- }
41246
- )
41247
- ]
41248
- }
41249
- );
41250
- })()
41024
+ txHash && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41025
+ SuccessTxHashRow,
41026
+ {
41027
+ label: destTxHash ? "Source tx" : "Transaction",
41028
+ hash: txHash,
41029
+ explorerUrl: buildExplorerUrl(
41030
+ txHash,
41031
+ fromChain,
41032
+ fromChainTxUrl
41033
+ ),
41034
+ isCopied: copiedHash === txHash,
41035
+ onCopy: handleCopyHash
41036
+ }
41037
+ ),
41038
+ destTxHash && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
41039
+ SuccessTxHashRow,
41040
+ {
41041
+ label: "Destination tx",
41042
+ hash: destTxHash,
41043
+ explorerUrl: buildExplorerUrl(
41044
+ destTxHash,
41045
+ toChain,
41046
+ toChainTxUrl
41047
+ ),
41048
+ isCopied: copiedHash === destTxHash,
41049
+ onCopy: handleCopyHash
41050
+ }
41051
+ )
41251
41052
  ]
41252
41053
  }
41253
41054
  )
@@ -43596,6 +43397,119 @@ function SuccessReceiptRow({
43596
43397
  }
43597
43398
  );
43598
43399
  }
43400
+ function SuccessTxHashRow({
43401
+ label,
43402
+ hash,
43403
+ explorerUrl,
43404
+ isCopied,
43405
+ onCopy
43406
+ }) {
43407
+ const shortHash = `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
43408
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
43409
+ "div",
43410
+ {
43411
+ style: {
43412
+ display: "flex",
43413
+ alignItems: "center",
43414
+ justifyContent: "space-between"
43415
+ },
43416
+ children: [
43417
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { style: { color: colors.mutedForeground }, children: label }),
43418
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
43419
+ "div",
43420
+ {
43421
+ style: {
43422
+ display: "inline-flex",
43423
+ alignItems: "center",
43424
+ gap: spacing[2]
43425
+ },
43426
+ children: [
43427
+ explorerUrl ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
43428
+ "a",
43429
+ {
43430
+ href: explorerUrl,
43431
+ target: "_blank",
43432
+ rel: "noopener noreferrer",
43433
+ style: {
43434
+ display: "inline-flex",
43435
+ alignItems: "center",
43436
+ gap: "0.25rem",
43437
+ color: colors.foreground,
43438
+ fontWeight: fontWeight.medium,
43439
+ textDecorationLine: "underline",
43440
+ textDecorationStyle: "dotted",
43441
+ textUnderlineOffset: "4px"
43442
+ },
43443
+ children: [
43444
+ shortHash,
43445
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
43446
+ "svg",
43447
+ {
43448
+ style: { width: "0.75rem", height: "0.75rem" },
43449
+ viewBox: "0 0 24 24",
43450
+ fill: "none",
43451
+ stroke: "currentColor",
43452
+ strokeWidth: 2,
43453
+ strokeLinecap: "round",
43454
+ strokeLinejoin: "round",
43455
+ children: [
43456
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
43457
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("polyline", { points: "15 3 21 3 21 9" }),
43458
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
43459
+ ]
43460
+ }
43461
+ )
43462
+ ]
43463
+ }
43464
+ ) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
43465
+ "span",
43466
+ {
43467
+ style: { color: colors.foreground, fontWeight: fontWeight.medium },
43468
+ children: shortHash
43469
+ }
43470
+ ),
43471
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
43472
+ "button",
43473
+ {
43474
+ onClick: () => onCopy(hash),
43475
+ title: "Copy full hash",
43476
+ style: {
43477
+ display: "inline-flex",
43478
+ alignItems: "center",
43479
+ fontSize: fontSize.xs,
43480
+ color: isCopied ? colors.green[500] : colors.mutedForeground,
43481
+ backgroundColor: "transparent",
43482
+ border: 0,
43483
+ cursor: "pointer",
43484
+ fontFamily: "inherit",
43485
+ padding: 0,
43486
+ transition: "color 0.15s"
43487
+ },
43488
+ children: isCopied ? "Copied!" : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
43489
+ "svg",
43490
+ {
43491
+ style: { width: "0.875rem", height: "0.875rem" },
43492
+ viewBox: "0 0 24 24",
43493
+ fill: "none",
43494
+ stroke: "currentColor",
43495
+ strokeWidth: 2,
43496
+ strokeLinecap: "round",
43497
+ strokeLinejoin: "round",
43498
+ children: [
43499
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
43500
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
43501
+ ]
43502
+ }
43503
+ )
43504
+ }
43505
+ )
43506
+ ]
43507
+ }
43508
+ )
43509
+ ]
43510
+ }
43511
+ );
43512
+ }
43599
43513
  function ProcessingStepNode({
43600
43514
  active,
43601
43515
  done,
@@ -43752,6 +43666,7 @@ var init_SwapMode = __esm({
43752
43666
  init_SwapTokenSelect();
43753
43667
  init_VaultDiscovery();
43754
43668
  init_currency();
43669
+ init_amountFormat();
43755
43670
  init_quoteCountdown();
43756
43671
  init_components2();
43757
43672
  import_jsx_runtime57 = require("react/jsx-runtime");