@trustware/sdk-staging 1.1.3-staging.32 → 1.1.4-staging.34

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/core.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { a as Trustware, e as TrustwareCore } from './core-DIWJpcYO.cjs';
2
- import './manager-BPgytsNL.cjs';
1
+ export { a as Trustware, e as TrustwareCore } from './core-DMGD8t0k.cjs';
2
+ import './manager-D3wU_WjU.cjs';
3
3
  import './types-BrVfNxND.cjs';
package/dist/core.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { a as Trustware, e as TrustwareCore } from './core-DtweriN4.js';
2
- import './manager-BPgytsNL.js';
1
+ export { a as Trustware, e as TrustwareCore } from './core-Dioy8MFJ.js';
2
+ import './manager-D3wU_WjU.js';
3
3
  import './types-BrVfNxND.js';
package/dist/core.mjs CHANGED
@@ -57,7 +57,7 @@ var init_constants = __esm({
57
57
  "src/constants.ts"() {
58
58
  "use strict";
59
59
  SDK_NAME = "@trustware/sdk";
60
- SDK_VERSION = "1.1.3";
60
+ SDK_VERSION = "1.1.4-staging.34";
61
61
  API_ROOT = "https://bv-staging-api.trustware.io";
62
62
  API_PREFIX = "/api";
63
63
  WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
@@ -1077,9 +1077,18 @@ async function connectDetectedWallet(dw, opts) {
1077
1077
  throw new Error("WalletConnect connection failed. Please try again.");
1078
1078
  }
1079
1079
  if (dw.via === "solana-window" || dw.meta.ecosystem === "solana") {
1080
- const api2 = toWalletInterfaceFromDetected(dw);
1081
- if (touchAddress) await api2.getAddress();
1082
- return { via: "eip1193", api: api2 };
1080
+ try {
1081
+ const provider = dw.provider;
1082
+ await provider.connect();
1083
+ return {
1084
+ via: "eip1193",
1085
+ api: toWalletInterfaceFromDetected(dw),
1086
+ error: null
1087
+ };
1088
+ } catch (err) {
1089
+ const errorMsg = err instanceof Error ? err.message : String(err);
1090
+ return { via: "eip1193", api: null, error: errorMsg };
1091
+ }
1083
1092
  }
1084
1093
  if (wagmi) {
1085
1094
  const conn = pickWagmiConnector(
@@ -1090,12 +1099,12 @@ async function connectDetectedWallet(dw, opts) {
1090
1099
  );
1091
1100
  if (conn) {
1092
1101
  await wagmi.connect(conn);
1093
- return { via: "wagmi", api: null };
1102
+ return { via: "wagmi", api: null, error: null };
1094
1103
  }
1095
1104
  }
1096
1105
  const api = toWalletInterfaceFromDetected(dw);
1097
1106
  if (touchAddress) await api.getAddress();
1098
- return { via: "eip1193", api };
1107
+ return { via: "eip1193", api, error: null };
1099
1108
  }
1100
1109
 
1101
1110
  // src/validation/address.ts
@@ -2214,6 +2223,7 @@ var WalletManager = class {
2214
2223
  this._wallet = null;
2215
2224
  this._detected = [];
2216
2225
  this._listeners = /* @__PURE__ */ new Set();
2226
+ this._error = null;
2217
2227
  this._identity = new IdentityStore();
2218
2228
  this._providerCleanup = null;
2219
2229
  this._connectedWalletId = null;
@@ -2268,18 +2278,25 @@ var WalletManager = class {
2268
2278
  this.clearConnectedWalletState();
2269
2279
  this.emit();
2270
2280
  try {
2271
- const { api } = await connectDetectedWallet(target, {
2281
+ const { api, error } = await connectDetectedWallet(target, {
2272
2282
  wagmi: opts?.wagmi
2273
2283
  });
2274
- if (api) {
2284
+ if (api && !error) {
2275
2285
  this._wallet = api;
2276
2286
  this._connectedWalletId = target.meta.id;
2277
2287
  this.bindProviderEvents(target);
2278
2288
  await this.syncIdentityFromWallet(target.meta.id);
2289
+ this._status = "connected";
2290
+ this._error = null;
2291
+ return { error: null, api };
2292
+ }
2293
+ if (error) {
2294
+ this._status = "error";
2295
+ this._error = error;
2296
+ return { error, api };
2279
2297
  }
2280
- this._status = "connected";
2281
2298
  } catch (e2) {
2282
- this._error = e2;
2299
+ this._error = e2 instanceof Error ? e2.message : String(e2);
2283
2300
  this._status = "error";
2284
2301
  this.clearConnectedWalletState();
2285
2302
  } finally {