@trustware/sdk-staging 1.1.4-staging.35 → 1.1.4-staging.37

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
@@ -51,49 +51,7 @@ var init_config = __esm({
51
51
  }
52
52
  });
53
53
 
54
- // src/constants.ts
55
- var SDK_NAME, SDK_VERSION, API_ROOT, GTM_ID, API_PREFIX, ASSETS_BASE_URL, WALLETCONNECT_PROJECT_ID;
56
- var init_constants = __esm({
57
- "src/constants.ts"() {
58
- "use strict";
59
- SDK_NAME = "@trustware/sdk";
60
- SDK_VERSION = "1.1.4-staging.35";
61
- API_ROOT = "https://bv-staging-api.trustware.io";
62
- GTM_ID = "GTM-TZDGNCXB";
63
- API_PREFIX = "/api";
64
- ASSETS_BASE_URL = "https://app.trustware.io";
65
- WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
66
- }
67
- });
68
-
69
54
  // src/config/merge.ts
70
- function resolveWalletConnectConfig(input) {
71
- if (input?.disabled) return void 0;
72
- const projectId2 = input?.projectId ?? WALLETCONNECT_PROJECT_ID;
73
- return {
74
- projectId: projectId2,
75
- chains: input?.chains ?? [1],
76
- // Default to Ethereum mainnet
77
- optionalChains: input?.optionalChains ?? [
78
- 1,
79
- 10,
80
- 56,
81
- 137,
82
- 8453,
83
- 42161,
84
- 43114
85
- ],
86
- // ETH, OP, BSC, Polygon, Base, Arbitrum, Avalanche
87
- metadata: {
88
- name: input?.metadata?.name ?? "Trustware",
89
- description: input?.metadata?.description ?? "Cross-chain bridge & top-up",
90
- url: input?.metadata?.url ?? "https://trustware.io",
91
- icons: input?.metadata?.icons ?? ["https://app.trustware.io/icon.png"]
92
- },
93
- relayUrl: input?.relayUrl,
94
- showQrModal: input?.showQrModal ?? true
95
- };
96
- }
97
55
  function deepMerge(base, patch) {
98
56
  if (!patch) return { ...base };
99
57
  const out = Array.isArray(base) ? [...base] : { ...base };
@@ -148,7 +106,7 @@ function resolveConfig(input) {
148
106
  onRateLimited: input.retry?.onRateLimited,
149
107
  onRateLimitApproaching: input.retry?.onRateLimitApproaching
150
108
  };
151
- const walletConnect = resolveWalletConnectConfig(input.walletConnect);
109
+ const walletConnect = input.walletConnect;
152
110
  const features = {
153
111
  tokensPagination: input.features?.tokensPagination ?? DEFAULT_FEATURE_FLAGS.tokensPagination,
154
112
  balanceStreaming: input.features?.balanceStreaming ?? DEFAULT_FEATURE_FLAGS.balanceStreaming,
@@ -173,7 +131,6 @@ var init_merge = __esm({
173
131
  "use strict";
174
132
  init_defaults();
175
133
  init_config();
176
- init_constants();
177
134
  }
178
135
  });
179
136
 
@@ -260,6 +217,21 @@ var init_store = __esm({
260
217
  }
261
218
  });
262
219
 
220
+ // src/constants.ts
221
+ var SDK_NAME, SDK_VERSION, API_ROOT, GTM_ID, API_PREFIX, WALLETCONNECT_PROJECT_ID, ASSETS_BASE_URL;
222
+ var init_constants = __esm({
223
+ "src/constants.ts"() {
224
+ "use strict";
225
+ SDK_NAME = "@trustware/sdk";
226
+ SDK_VERSION = "1.1.4-staging.37";
227
+ API_ROOT = "https://bv-staging-api.trustware.io";
228
+ GTM_ID = "GTM-TZDGNCXB";
229
+ API_PREFIX = "/api";
230
+ WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
231
+ ASSETS_BASE_URL = "https://app.trustware.io";
232
+ }
233
+ });
234
+
263
235
  // src/config/index.ts
264
236
  var init_config2 = __esm({
265
237
  "src/config/index.ts"() {
@@ -11577,7 +11549,6 @@ function PaymentOptionRow({
11577
11549
  {
11578
11550
  type: "button",
11579
11551
  onClick,
11580
- disabled,
11581
11552
  style: {
11582
11553
  width: "100%",
11583
11554
  display: "flex",
@@ -12203,11 +12174,8 @@ import { useEffect as useEffect22, useRef as useRef10, useState as useState21 }
12203
12174
 
12204
12175
  // src/config/walletconnect.ts
12205
12176
  init_store();
12177
+ init_constants();
12206
12178
  import { UniversalConnector } from "@reown/appkit-universal-connector";
12207
- var projectId = "896c4c8fa652baf14b9614e4026aff6a";
12208
- if (!projectId) {
12209
- throw new Error("Project ID is not defined");
12210
- }
12211
12179
  var solanaMainnet = {
12212
12180
  id: 1,
12213
12181
  chainNamespace: "solana",
@@ -12274,7 +12242,9 @@ var seiMainnet = {
12274
12242
  };
12275
12243
  var universalConnectorPromise = null;
12276
12244
  function resolvedMetadata() {
12277
- const configured = TrustwareConfigStore.peek()?.walletConnect?.metadata;
12245
+ const cfg = TrustwareConfigStore.peek();
12246
+ const walletConnect = cfg ? cfg?.walletConnect : void 0;
12247
+ const configured = walletConnect?.metadata;
12278
12248
  const pageUrl = typeof window !== "undefined" && window.location?.origin ? window.location.origin : configured?.url;
12279
12249
  return {
12280
12250
  name: configured?.name ?? "Trustware",
@@ -12283,7 +12253,14 @@ function resolvedMetadata() {
12283
12253
  icons: configured?.icons?.length ? configured.icons : ["https://app.trustware.io/icon.png"]
12284
12254
  };
12285
12255
  }
12286
- async function getUniversalConnector() {
12256
+ async function getUniversalConnector(walletCfg) {
12257
+ const projectId = walletCfg?.projectId ?? WALLETCONNECT_PROJECT_ID;
12258
+ if (!projectId) {
12259
+ console.warn(
12260
+ "[Trustware SDK] WalletConnect disabled: no projectId. Set TRUSTWARE_WALLETCONNECT_PROJECT_ID at build time or pass walletConnect.projectId in config."
12261
+ );
12262
+ return void 0;
12263
+ }
12287
12264
  if (!universalConnectorPromise) {
12288
12265
  universalConnectorPromise = UniversalConnector.init({
12289
12266
  projectId,
@@ -12317,6 +12294,7 @@ async function getUniversalConnector() {
12317
12294
  }
12318
12295
 
12319
12296
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
12297
+ init_config2();
12320
12298
  function useHomeWalletActions({
12321
12299
  connectWallet,
12322
12300
  detectedWallets,
@@ -12328,6 +12306,15 @@ function useHomeWalletActions({
12328
12306
  const [universalConnector, setUniversalConnector] = useState21();
12329
12307
  const cryptoDropdownRef = useRef10(null);
12330
12308
  const fiatDropdownRef = useRef10(null);
12309
+ useEffect22(() => {
12310
+ if (typeof window === "undefined") {
12311
+ return;
12312
+ }
12313
+ const walletConnect = TrustwareConfigStore.peek()?.walletConnect;
12314
+ getUniversalConnector(walletConnect).then(
12315
+ setUniversalConnector
12316
+ );
12317
+ }, [TrustwareConfigStore.peek()?.walletConnect]);
12331
12318
  useEffect22(() => {
12332
12319
  const handleClickOutside = (event) => {
12333
12320
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
@@ -12340,9 +12327,6 @@ function useHomeWalletActions({
12340
12327
  document.addEventListener("mousedown", handleClickOutside);
12341
12328
  return () => document.removeEventListener("mousedown", handleClickOutside);
12342
12329
  }, []);
12343
- useEffect22(() => {
12344
- getUniversalConnector().then(setUniversalConnector);
12345
- }, []);
12346
12330
  const { resetNavigation } = useDepositNavigationState("home");
12347
12331
  const handleWalletSelect = async (wallet) => {
12348
12332
  setIsCryptoDropdownOpen(false);