@trustware/sdk-staging 1.1.3-staging.33 → 1.1.4-staging.35

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/wallet.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { f as WalletId, S as SolanaProviderLike, i as WalletMeta, D as DetectedWallet, l as SolanaWalletInterface } from './manager-BPgytsNL.cjs';
2
- export { a as WagmiBridge, b as WagmiConnector, u as useWireDetectionIntoManager, J as walletManager } from './manager-BPgytsNL.cjs';
3
- export { g as autoDetectWallet, f as buildDetectedWalletFromProvider, c as connectDetectedWallet, e as createWalletConnectEntry, t as toWalletInterfaceFromDetected, a as useEIP1193, d as useIsMobile, b as useWagmi, u as useWalletDetection } from './detect-DxT7Xlae.cjs';
1
+ import { f as WalletId, S as SolanaProviderLike, i as WalletMeta, D as DetectedWallet, l as SolanaWalletInterface } from './manager-D3wU_WjU.cjs';
2
+ export { a as WagmiBridge, b as WagmiConnector, u as useWireDetectionIntoManager, J as walletManager } from './manager-D3wU_WjU.cjs';
3
+ export { g as autoDetectWallet, f as buildDetectedWalletFromProvider, c as connectDetectedWallet, e as createWalletConnectEntry, t as toWalletInterfaceFromDetected, a as useEIP1193, d as useIsMobile, b as useWagmi, u as useWalletDetection } from './detect-BGnIuj2P.cjs';
4
4
 
5
5
  type SolanaEventHandlers = {
6
6
  onConnect?: () => void;
package/dist/wallet.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { f as WalletId, S as SolanaProviderLike, i as WalletMeta, D as DetectedWallet, l as SolanaWalletInterface } from './manager-BPgytsNL.js';
2
- export { a as WagmiBridge, b as WagmiConnector, u as useWireDetectionIntoManager, J as walletManager } from './manager-BPgytsNL.js';
3
- export { g as autoDetectWallet, f as buildDetectedWalletFromProvider, c as connectDetectedWallet, e as createWalletConnectEntry, t as toWalletInterfaceFromDetected, a as useEIP1193, d as useIsMobile, b as useWagmi, u as useWalletDetection } from './detect-BS03Cycm.js';
1
+ import { f as WalletId, S as SolanaProviderLike, i as WalletMeta, D as DetectedWallet, l as SolanaWalletInterface } from './manager-D3wU_WjU.js';
2
+ export { a as WagmiBridge, b as WagmiConnector, u as useWireDetectionIntoManager, J as walletManager } from './manager-D3wU_WjU.js';
3
+ export { g as autoDetectWallet, f as buildDetectedWalletFromProvider, c as connectDetectedWallet, e as createWalletConnectEntry, t as toWalletInterfaceFromDetected, a as useEIP1193, d as useIsMobile, b as useWagmi, u as useWalletDetection } from './detect-DSka5hlR.js';
4
4
 
5
5
  type SolanaEventHandlers = {
6
6
  onConnect?: () => void;
package/dist/wallet.mjs CHANGED
@@ -206,7 +206,7 @@ import { Transaction, VersionedTransaction } from "@solana/web3.js";
206
206
 
207
207
  // src/constants.ts
208
208
  var SDK_NAME = "@trustware/sdk";
209
- var SDK_VERSION = "1.1.3-staging.33";
209
+ var SDK_VERSION = "1.1.4-staging.35";
210
210
  var API_ROOT = "https://bv-staging-api.trustware.io";
211
211
  var API_PREFIX = "/api";
212
212
  var ASSETS_BASE_URL = "https://app.trustware.io";
@@ -727,9 +727,18 @@ async function connectDetectedWallet(dw, opts) {
727
727
  throw new Error("WalletConnect connection failed. Please try again.");
728
728
  }
729
729
  if (dw.via === "solana-window" || dw.meta.ecosystem === "solana") {
730
- const api2 = toWalletInterfaceFromDetected(dw);
731
- if (touchAddress) await api2.getAddress();
732
- return { via: "eip1193", api: api2 };
730
+ try {
731
+ const provider = dw.provider;
732
+ await provider.connect();
733
+ return {
734
+ via: "eip1193",
735
+ api: toWalletInterfaceFromDetected(dw),
736
+ error: null
737
+ };
738
+ } catch (err) {
739
+ const errorMsg = err instanceof Error ? err.message : String(err);
740
+ return { via: "eip1193", api: null, error: errorMsg };
741
+ }
733
742
  }
734
743
  if (wagmi) {
735
744
  const conn = pickWagmiConnector(
@@ -740,12 +749,12 @@ async function connectDetectedWallet(dw, opts) {
740
749
  );
741
750
  if (conn) {
742
751
  await wagmi.connect(conn);
743
- return { via: "wagmi", api: null };
752
+ return { via: "wagmi", api: null, error: null };
744
753
  }
745
754
  }
746
755
  const api = toWalletInterfaceFromDetected(dw);
747
756
  if (touchAddress) await api.getAddress();
748
- return { via: "eip1193", api };
757
+ return { via: "eip1193", api, error: null };
749
758
  }
750
759
 
751
760
  // src/wallets/detect.ts
@@ -2281,6 +2290,7 @@ var WalletManager = class {
2281
2290
  this._wallet = null;
2282
2291
  this._detected = [];
2283
2292
  this._listeners = /* @__PURE__ */ new Set();
2293
+ this._error = null;
2284
2294
  this._identity = new IdentityStore();
2285
2295
  this._providerCleanup = null;
2286
2296
  this._connectedWalletId = null;
@@ -2335,18 +2345,25 @@ var WalletManager = class {
2335
2345
  this.clearConnectedWalletState();
2336
2346
  this.emit();
2337
2347
  try {
2338
- const { api } = await connectDetectedWallet(target, {
2348
+ const { api, error } = await connectDetectedWallet(target, {
2339
2349
  wagmi: opts?.wagmi
2340
2350
  });
2341
- if (api) {
2351
+ if (api && !error) {
2342
2352
  this._wallet = api;
2343
2353
  this._connectedWalletId = target.meta.id;
2344
2354
  this.bindProviderEvents(target);
2345
2355
  await this.syncIdentityFromWallet(target.meta.id);
2356
+ this._status = "connected";
2357
+ this._error = null;
2358
+ return { error: null, api };
2359
+ }
2360
+ if (error) {
2361
+ this._status = "error";
2362
+ this._error = error;
2363
+ return { error, api };
2346
2364
  }
2347
- this._status = "connected";
2348
2365
  } catch (e2) {
2349
- this._error = e2;
2366
+ this._error = e2 instanceof Error ? e2.message : String(e2);
2350
2367
  this._status = "error";
2351
2368
  this.clearConnectedWalletState();
2352
2369
  } finally {