@meshconnect/web-link-sdk 3.1.0 → 3.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/web-link-sdk",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "A client-side JS library for integrating with Mesh Connect",
5
5
  "exports": "./index.js",
6
6
  "license": "MIT",
@@ -40,38 +40,41 @@ if (typeof window !== 'undefined') {
40
40
  window.Buffer = window.Buffer || Buffer;
41
41
  }
42
42
  export var connectToSolanaWallet = function (walletName) { return __awaiter(void 0, void 0, void 0, function () {
43
- var provider_1, error_1;
43
+ var provider_1, response, error_1;
44
44
  return __generator(this, function (_a) {
45
45
  switch (_a.label) {
46
46
  case 0:
47
47
  _a.trys.push([0, 2, , 3]);
48
48
  provider_1 = getSolanaProvider(walletName);
49
- if (provider_1.publicKey && provider_1.isConnected) {
49
+ return [4 /*yield*/, provider_1
50
+ .connect({ onlyIfTrusted: true })
51
+ .catch(function () { return provider_1.connect(); })
52
+ // Handle Phantom wallet which returns response.publicKey
53
+ ];
54
+ case 1:
55
+ response = _a.sent();
56
+ // Handle Phantom wallet which returns response.publicKey
57
+ if (response === null || response === void 0 ? void 0 : response.publicKey) {
50
58
  return [2 /*return*/, {
51
- accounts: [provider_1.publicKey.toString()],
59
+ accounts: [response.publicKey.toString()],
52
60
  chainId: '101',
53
61
  isConnected: true
54
62
  }];
55
63
  }
56
- return [4 /*yield*/, provider_1
57
- .connect({ onlyIfTrusted: true })
58
- .catch(function () { return provider_1.connect(); })];
59
- case 1:
60
- _a.sent();
61
- if (!provider_1.publicKey) {
62
- throw new Error("".concat(walletName, " connection failed - no public key available"));
64
+ // Handle other wallets that update provider.publicKey directly
65
+ if (provider_1.publicKey) {
66
+ return [2 /*return*/, {
67
+ accounts: [provider_1.publicKey.toString()],
68
+ chainId: '101',
69
+ isConnected: true
70
+ }];
63
71
  }
64
- return [2 /*return*/, {
65
- accounts: [provider_1.publicKey.toString()],
66
- chainId: '101',
67
- isConnected: true
68
- }];
72
+ throw new Error("".concat(walletName, " connection failed - no public key returned"));
69
73
  case 2:
70
74
  error_1 = _a.sent();
71
- console.error('Solana wallet connection error:', error_1);
72
75
  return [2 /*return*/, error_1 instanceof Error
73
76
  ? error_1
74
- : new Error("Failed to connect to ".concat(walletName, " wallet: ").concat(error_1))];
77
+ : new Error("Failed to connect to ".concat(walletName, " wallet"))];
75
78
  case 3: return [2 /*return*/];
76
79
  }
77
80
  });
@@ -1 +1 @@
1
- export declare const sdkVersion = "3.1.0";
1
+ export declare const sdkVersion = "3.1.1";
package/utils/version.js CHANGED
@@ -1 +1 @@
1
- export var sdkVersion = '3.1.0';
1
+ export var sdkVersion = '3.1.1';