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

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.cjs CHANGED
@@ -73,49 +73,7 @@ var init_config = __esm({
73
73
  }
74
74
  });
75
75
 
76
- // src/constants.ts
77
- var SDK_NAME, SDK_VERSION, API_ROOT, GTM_ID, API_PREFIX, ASSETS_BASE_URL, WALLETCONNECT_PROJECT_ID;
78
- var init_constants = __esm({
79
- "src/constants.ts"() {
80
- "use strict";
81
- SDK_NAME = "@trustware/sdk";
82
- SDK_VERSION = "1.1.4-staging.35";
83
- API_ROOT = "https://bv-staging-api.trustware.io";
84
- GTM_ID = "GTM-TZDGNCXB";
85
- API_PREFIX = "/api";
86
- ASSETS_BASE_URL = "https://app.trustware.io";
87
- WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
88
- }
89
- });
90
-
91
76
  // src/config/merge.ts
92
- function resolveWalletConnectConfig(input) {
93
- if (input?.disabled) return void 0;
94
- const projectId2 = input?.projectId ?? WALLETCONNECT_PROJECT_ID;
95
- return {
96
- projectId: projectId2,
97
- chains: input?.chains ?? [1],
98
- // Default to Ethereum mainnet
99
- optionalChains: input?.optionalChains ?? [
100
- 1,
101
- 10,
102
- 56,
103
- 137,
104
- 8453,
105
- 42161,
106
- 43114
107
- ],
108
- // ETH, OP, BSC, Polygon, Base, Arbitrum, Avalanche
109
- metadata: {
110
- name: input?.metadata?.name ?? "Trustware",
111
- description: input?.metadata?.description ?? "Cross-chain bridge & top-up",
112
- url: input?.metadata?.url ?? "https://trustware.io",
113
- icons: input?.metadata?.icons ?? ["https://app.trustware.io/icon.png"]
114
- },
115
- relayUrl: input?.relayUrl,
116
- showQrModal: input?.showQrModal ?? true
117
- };
118
- }
119
77
  function deepMerge(base, patch) {
120
78
  if (!patch) return { ...base };
121
79
  const out = Array.isArray(base) ? [...base] : { ...base };
@@ -170,7 +128,7 @@ function resolveConfig(input) {
170
128
  onRateLimited: input.retry?.onRateLimited,
171
129
  onRateLimitApproaching: input.retry?.onRateLimitApproaching
172
130
  };
173
- const walletConnect = resolveWalletConnectConfig(input.walletConnect);
131
+ const walletConnect = input.walletConnect;
174
132
  const features = {
175
133
  tokensPagination: input.features?.tokensPagination ?? DEFAULT_FEATURE_FLAGS.tokensPagination,
176
134
  balanceStreaming: input.features?.balanceStreaming ?? DEFAULT_FEATURE_FLAGS.balanceStreaming,
@@ -195,7 +153,6 @@ var init_merge = __esm({
195
153
  "use strict";
196
154
  init_defaults();
197
155
  init_config();
198
- init_constants();
199
156
  }
200
157
  });
201
158
 
@@ -282,6 +239,21 @@ var init_store = __esm({
282
239
  }
283
240
  });
284
241
 
242
+ // src/constants.ts
243
+ var SDK_NAME, SDK_VERSION, API_ROOT, GTM_ID, API_PREFIX, WALLETCONNECT_PROJECT_ID, ASSETS_BASE_URL;
244
+ var init_constants = __esm({
245
+ "src/constants.ts"() {
246
+ "use strict";
247
+ SDK_NAME = "@trustware/sdk";
248
+ SDK_VERSION = "1.1.4-staging.36";
249
+ API_ROOT = "https://bv-staging-api.trustware.io";
250
+ GTM_ID = "GTM-TZDGNCXB";
251
+ API_PREFIX = "/api";
252
+ WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
253
+ ASSETS_BASE_URL = "https://app.trustware.io";
254
+ }
255
+ });
256
+
285
257
  // src/config/index.ts
286
258
  var init_config2 = __esm({
287
259
  "src/config/index.ts"() {
@@ -11587,7 +11559,6 @@ function PaymentOptionRow({
11587
11559
  {
11588
11560
  type: "button",
11589
11561
  onClick,
11590
- disabled,
11591
11562
  style: {
11592
11563
  width: "100%",
11593
11564
  display: "flex",
@@ -12214,10 +12185,7 @@ var import_react32 = require("react");
12214
12185
  // src/config/walletconnect.ts
12215
12186
  var import_appkit_universal_connector = require("@reown/appkit-universal-connector");
12216
12187
  init_store();
12217
- var projectId = "896c4c8fa652baf14b9614e4026aff6a";
12218
- if (!projectId) {
12219
- throw new Error("Project ID is not defined");
12220
- }
12188
+ init_constants();
12221
12189
  var solanaMainnet = {
12222
12190
  id: 1,
12223
12191
  chainNamespace: "solana",
@@ -12284,7 +12252,9 @@ var seiMainnet = {
12284
12252
  };
12285
12253
  var universalConnectorPromise = null;
12286
12254
  function resolvedMetadata() {
12287
- const configured = TrustwareConfigStore.peek()?.walletConnect?.metadata;
12255
+ const cfg = TrustwareConfigStore.peek();
12256
+ const walletConnect = cfg ? cfg?.walletConnect : void 0;
12257
+ const configured = walletConnect?.metadata;
12288
12258
  const pageUrl = typeof window !== "undefined" && window.location?.origin ? window.location.origin : configured?.url;
12289
12259
  return {
12290
12260
  name: configured?.name ?? "Trustware",
@@ -12293,7 +12263,14 @@ function resolvedMetadata() {
12293
12263
  icons: configured?.icons?.length ? configured.icons : ["https://app.trustware.io/icon.png"]
12294
12264
  };
12295
12265
  }
12296
- async function getUniversalConnector() {
12266
+ async function getUniversalConnector(walletCfg) {
12267
+ const projectId = walletCfg?.projectId ?? WALLETCONNECT_PROJECT_ID;
12268
+ if (!projectId) {
12269
+ console.warn(
12270
+ "[Trustware SDK] WalletConnect disabled: no projectId. Set TRUSTWARE_WALLETCONNECT_PROJECT_ID at build time or pass walletConnect.projectId in config."
12271
+ );
12272
+ return void 0;
12273
+ }
12297
12274
  if (!universalConnectorPromise) {
12298
12275
  universalConnectorPromise = import_appkit_universal_connector.UniversalConnector.init({
12299
12276
  projectId,
@@ -12327,6 +12304,7 @@ async function getUniversalConnector() {
12327
12304
  }
12328
12305
 
12329
12306
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
12307
+ init_config2();
12330
12308
  function useHomeWalletActions({
12331
12309
  connectWallet,
12332
12310
  detectedWallets,
@@ -12338,6 +12316,15 @@ function useHomeWalletActions({
12338
12316
  const [universalConnector, setUniversalConnector] = (0, import_react32.useState)();
12339
12317
  const cryptoDropdownRef = (0, import_react32.useRef)(null);
12340
12318
  const fiatDropdownRef = (0, import_react32.useRef)(null);
12319
+ (0, import_react32.useEffect)(() => {
12320
+ if (typeof window === "undefined") {
12321
+ return;
12322
+ }
12323
+ const walletConnect = TrustwareConfigStore.peek()?.walletConnect;
12324
+ getUniversalConnector(walletConnect).then(
12325
+ setUniversalConnector
12326
+ );
12327
+ }, [TrustwareConfigStore.peek()?.walletConnect]);
12341
12328
  (0, import_react32.useEffect)(() => {
12342
12329
  const handleClickOutside = (event) => {
12343
12330
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
@@ -12350,9 +12337,6 @@ function useHomeWalletActions({
12350
12337
  document.addEventListener("mousedown", handleClickOutside);
12351
12338
  return () => document.removeEventListener("mousedown", handleClickOutside);
12352
12339
  }, []);
12353
- (0, import_react32.useEffect)(() => {
12354
- getUniversalConnector().then(setUniversalConnector);
12355
- }, []);
12356
12340
  const { resetNavigation } = useDepositNavigationState("home");
12357
12341
  const handleWalletSelect = async (wallet) => {
12358
12342
  setIsCryptoDropdownOpen(false);