@bit-buccaneers/wallet-abstraction 0.0.3 → 0.0.6

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/index.js CHANGED
@@ -2,7 +2,7 @@ import { injected, metaMask, coinbaseWallet } from '@wagmi/connectors';
2
2
  import { createConfig, getConnectors, signMessage, disconnect, connect, watchConnections } from '@wagmi/core';
3
3
  import { http } from 'viem';
4
4
  import { mainnet } from 'viem/chains';
5
- import bs58 from 'bs58';
5
+ import bs582 from 'bs58';
6
6
  import nacl from 'tweetnacl';
7
7
  import { SignClient } from '@walletconnect/sign-client';
8
8
  import { isWalletAdapterCompatibleStandardWallet } from '@solana/wallet-adapter-base';
@@ -154,6 +154,11 @@ var WALLETS = [
154
154
  name: "Exodus",
155
155
  icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#exodus",
156
156
  chromeExtensionUrl: "https://chromewebstore.google.com/detail/aholpfdialjgjfhomihkjbmgjidlcdno"
157
+ },
158
+ {
159
+ id: "walletconnect",
160
+ name: "WalletConnect",
161
+ icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#walletconnect"
157
162
  }
158
163
  ];
159
164
 
@@ -204,6 +209,89 @@ var SOLANA_WC_CONFIG = {
204
209
  methods: WC_METHODS.SOLANA,
205
210
  events: WC_EVENTS.SOLANA
206
211
  };
212
+ var connectEvmInjected = async () => {
213
+ if (!window.ethereum) throw new Error("No injected EVM provider");
214
+ const accounts = await window.ethereum.request({
215
+ method: "eth_requestAccounts"
216
+ });
217
+ if (!accounts[0]) throw new Error("No accounts returned");
218
+ const chainId = await window.ethereum.request({ method: "eth_chainId" });
219
+ return connectedResult(accounts[0], { chainId: parseInt(chainId, 16) });
220
+ };
221
+ var connectSolanaInjected = async () => {
222
+ if (!window.solana) throw new Error("No injected Solana provider");
223
+ const response = await window.solana.connect();
224
+ const publicKey = response.publicKey;
225
+ return connectedResult(publicKey.toBase58(), { publicKey: publicKey.toBytes() });
226
+ };
227
+ var signSolanaInjected = async (message) => {
228
+ if (!window.solana?.signMessage) {
229
+ throw new Error("No injected Solana provider or signMessage not supported");
230
+ }
231
+ const encodedMessage = new TextEncoder().encode(message);
232
+ const result = await window.solana.signMessage(encodedMessage, "utf8");
233
+ return bs582.encode(new Uint8Array(result.signature));
234
+ };
235
+
236
+ // src/lib/connectors/shared/utils.ts
237
+ var isMobile = () => {
238
+ return typeof window !== "undefined" && /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent);
239
+ };
240
+ var isInWalletBrowser = (key) => {
241
+ return typeof window !== "undefined" && !!window.ethereum?.[key];
242
+ };
243
+ var openDeeplink = (url) => {
244
+ const link = document.createElement("a");
245
+ link.href = url;
246
+ link.click();
247
+ };
248
+ var waitForValue = (getValue) => {
249
+ return new Promise((resolve) => {
250
+ const check = () => {
251
+ const value = getValue();
252
+ if (value != null) resolve(value);
253
+ else window.setTimeout(check, 50);
254
+ };
255
+ check();
256
+ });
257
+ };
258
+
259
+ // src/lib/connectors/shared/dapp-browser.ts
260
+ var buildBrowseUrl = (baseUrl, stripProtocol) => {
261
+ if (stripProtocol) {
262
+ return `${baseUrl}/${window.location.host}${window.location.pathname}${window.location.search}`;
263
+ }
264
+ return `${baseUrl}/${encodeURIComponent(window.location.href)}`;
265
+ };
266
+ var createDappBrowserSolanaConnector = (config2) => {
267
+ const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
268
+ const isInWallet = () => isInWalletBrowser(config2.injectedKey);
269
+ return {
270
+ ...walletConfig2,
271
+ type: "solana",
272
+ wallet: {
273
+ _provider: null,
274
+ connect: async () => {
275
+ if (isInWallet() && window.solana) {
276
+ return connectSolanaInjected();
277
+ }
278
+ window.location.href = buildBrowseUrl(config2.browseUrl, config2.stripProtocol);
279
+ return pendingResult();
280
+ },
281
+ disconnect: async () => {
282
+ if (window.solana?.disconnect) {
283
+ await window.solana.disconnect();
284
+ }
285
+ },
286
+ signMessage: async (message) => {
287
+ if (isInWallet() && window.solana) {
288
+ return signSolanaInjected(message);
289
+ }
290
+ throw new Error("signMessage requires dApp browser");
291
+ }
292
+ }
293
+ };
294
+ };
207
295
  var getDappKeyPair = (storageKey) => {
208
296
  const stored = storage.get(storageKey);
209
297
  if (stored) {
@@ -223,7 +311,7 @@ var buildConnectUrl = (config2, params) => {
223
311
  const keyPair = getDappKeyPair(`${config2.storageKeyPrefix}_keypair`);
224
312
  const url = new URL(config2.connectUrl);
225
313
  url.searchParams.set("app_url", params.appUrl);
226
- url.searchParams.set("dapp_encryption_public_key", bs58.encode(keyPair.publicKey));
314
+ url.searchParams.set("dapp_encryption_public_key", bs582.encode(keyPair.publicKey));
227
315
  url.searchParams.set("redirect_link", params.redirectUrl);
228
316
  if (params.cluster) {
229
317
  url.searchParams.set("cluster", params.cluster);
@@ -242,8 +330,8 @@ var parseConnectResponse = (urlParams, config2) => {
242
330
  }
243
331
  try {
244
332
  const keyPair = getDappKeyPair(`${config2.storageKeyPrefix}_keypair`);
245
- const sharedSecret = nacl.box.before(bs58.decode(walletPublicKey), keyPair.secretKey);
246
- const decrypted = nacl.box.open.after(bs58.decode(data), bs58.decode(nonce), sharedSecret);
333
+ const sharedSecret = nacl.box.before(bs582.decode(walletPublicKey), keyPair.secretKey);
334
+ const decrypted = nacl.box.open.after(bs582.decode(data), bs582.decode(nonce), sharedSecret);
247
335
  if (!decrypted) {
248
336
  return null;
249
337
  }
@@ -293,7 +381,7 @@ var buildSignMessageUrl = (signUrl, config2, sessionKey, message, redirectUrl) =
293
381
  const keyPair = getDappKeyPair(`${config2.storageKeyPrefix}_keypair`);
294
382
  const sharedSecret = new Uint8Array(session.sharedSecret);
295
383
  const payload = {
296
- message: bs58.encode(new TextEncoder().encode(message)),
384
+ message: bs582.encode(new TextEncoder().encode(message)),
297
385
  session: session.session,
298
386
  display: "utf8"
299
387
  };
@@ -304,10 +392,10 @@ var buildSignMessageUrl = (signUrl, config2, sessionKey, message, redirectUrl) =
304
392
  sharedSecret
305
393
  );
306
394
  const url = new URL(signUrl);
307
- url.searchParams.set("dapp_encryption_public_key", bs58.encode(keyPair.publicKey));
308
- url.searchParams.set("nonce", bs58.encode(nonce));
395
+ url.searchParams.set("dapp_encryption_public_key", bs582.encode(keyPair.publicKey));
396
+ url.searchParams.set("nonce", bs582.encode(nonce));
309
397
  url.searchParams.set("redirect_link", redirectUrl);
310
- url.searchParams.set("payload", bs58.encode(encrypted));
398
+ url.searchParams.set("payload", bs582.encode(encrypted));
311
399
  return url.toString();
312
400
  };
313
401
  var parseSignMessageResponse = (config2, sessionKey) => {
@@ -319,7 +407,7 @@ var parseSignMessageResponse = (config2, sessionKey) => {
319
407
  if (!session) return null;
320
408
  try {
321
409
  const sharedSecret = new Uint8Array(session.sharedSecret);
322
- const decrypted = nacl.box.open.after(bs58.decode(data), bs58.decode(nonce), sharedSecret);
410
+ const decrypted = nacl.box.open.after(bs582.decode(data), bs582.decode(nonce), sharedSecret);
323
411
  if (!decrypted) return null;
324
412
  const response = JSON.parse(new TextDecoder().decode(decrypted));
325
413
  return response.signature;
@@ -327,29 +415,6 @@ var parseSignMessageResponse = (config2, sessionKey) => {
327
415
  return null;
328
416
  }
329
417
  };
330
- var connectEvmInjected = async () => {
331
- if (!window.ethereum) throw new Error("No injected EVM provider");
332
- const accounts = await window.ethereum.request({
333
- method: "eth_requestAccounts"
334
- });
335
- if (!accounts[0]) throw new Error("No accounts returned");
336
- const chainId = await window.ethereum.request({ method: "eth_chainId" });
337
- return connectedResult(accounts[0], { chainId: parseInt(chainId, 16) });
338
- };
339
- var connectSolanaInjected = async () => {
340
- if (!window.solana) throw new Error("No injected Solana provider");
341
- const response = await window.solana.connect();
342
- const publicKey = response.publicKey;
343
- return connectedResult(publicKey.toBase58(), { publicKey: publicKey.toBytes() });
344
- };
345
- var signSolanaInjected = async (message) => {
346
- if (!window.solana?.signMessage) {
347
- throw new Error("No injected Solana provider or signMessage not supported");
348
- }
349
- const encodedMessage = new TextEncoder().encode(message);
350
- const result = await window.solana.signMessage(encodedMessage, "utf8");
351
- return bs58.encode(new Uint8Array(result.signature));
352
- };
353
418
 
354
419
  // src/lib/connectors/shared/parsers.ts
355
420
  var parseEvmAccount = (account) => {
@@ -360,8 +425,8 @@ var parseEvmAccount = (account) => {
360
425
  var parseSolanaAccount = async (account) => {
361
426
  const address = account.split(":")[2];
362
427
  if (!address) throw new Error("Invalid Solana account format");
363
- const { default: bs586 } = await import('bs58');
364
- return connectedResult(address, { publicKey: bs586.decode(address) });
428
+ const { default: bs587 } = await import('bs58');
429
+ return connectedResult(address, { publicKey: bs587.decode(address) });
365
430
  };
366
431
  var getEvmAccountFromSession = (namespaces) => {
367
432
  const account = namespaces.eip155?.accounts?.[0];
@@ -373,29 +438,6 @@ var getSolanaAccountFromSession = async (namespaces) => {
373
438
  if (!account) throw new Error("No Solana accounts returned");
374
439
  return parseSolanaAccount(account);
375
440
  };
376
-
377
- // src/lib/connectors/shared/utils.ts
378
- var isMobile = () => {
379
- return typeof window !== "undefined" && /iPhone|iPad|iPod|Android/i.test(window.navigator.userAgent);
380
- };
381
- var isInWalletBrowser = (key) => {
382
- return typeof window !== "undefined" && !!window.ethereum?.[key];
383
- };
384
- var openDeeplink = (url) => {
385
- const link = document.createElement("a");
386
- link.href = url;
387
- link.click();
388
- };
389
- var waitForValue = (getValue) => {
390
- return new Promise((resolve) => {
391
- const check = () => {
392
- const value = getValue();
393
- if (value != null) resolve(value);
394
- else window.setTimeout(check, 50);
395
- };
396
- check();
397
- });
398
- };
399
441
  var signClient = null;
400
442
  var currentSession = null;
401
443
  var sessionChangeCallbacks = /* @__PURE__ */ new Set();
@@ -560,11 +602,11 @@ var disconnectWcOrSolana = async () => {
560
602
  }
561
603
  };
562
604
  var createWcEvmConnector = (config2) => {
563
- const walletConfig = WALLETS.find((w) => w.id === config2.walletId);
605
+ const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
564
606
  const getDeeplink = createDeeplink(config2.wcDeeplink);
565
607
  const isInWallet = () => isInWalletBrowser(config2.injectedKey);
566
608
  return {
567
- ...walletConfig,
609
+ ...walletConfig2,
568
610
  type: "evm",
569
611
  wallet: {
570
612
  _connector: null,
@@ -605,11 +647,11 @@ var createWcEvmConnector = (config2) => {
605
647
  };
606
648
  };
607
649
  var createWcSolanaConnector = (config2) => {
608
- const walletConfig = WALLETS.find((w) => w.id === config2.walletId);
650
+ const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
609
651
  const getDeeplink = createDeeplink(config2.wcDeeplink);
610
652
  const isInWallet = () => isInWalletBrowser(config2.injectedKey);
611
653
  return {
612
- ...walletConfig,
654
+ ...walletConfig2,
613
655
  type: "solana",
614
656
  wallet: {
615
657
  _provider: null,
@@ -636,7 +678,7 @@ var createWcSolanaConnector = (config2) => {
636
678
  const messageBytes = new TextEncoder().encode(message);
637
679
  const result = await requestWalletConnect(
638
680
  "solana_signMessage",
639
- { message: bs58.encode(messageBytes), pubkey },
681
+ { message: bs582.encode(messageBytes), pubkey },
640
682
  WC_CHAINS.SOLANA_MAINNET
641
683
  );
642
684
  return result.signature;
@@ -649,6 +691,11 @@ var createWcSolanaConnector = (config2) => {
649
691
  var PHANTOM_CONNECT_URL = "https://phantom.app/ul/v1/connect";
650
692
  var PHANTOM_SIGN_MESSAGE_URL = "https://phantom.app/ul/v1/signMessage";
651
693
  var PHANTOM_BROWSE_URL = "https://phantom.app/ul/browse";
694
+ var createPhantomSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
695
+ walletId: "phantom",
696
+ browseUrl: PHANTOM_BROWSE_URL,
697
+ injectedKey: "isPhantom"
698
+ });
652
699
  var PHANTOM_CONFIG = {
653
700
  connectUrl: PHANTOM_CONNECT_URL,
654
701
  storageKeyPrefix: "phantom_mobile",
@@ -745,11 +792,24 @@ var METAMASK_CONFIG = {
745
792
  wcDeeplink: "https://metamask.app.link/wc",
746
793
  injectedKey: "isMetaMask"
747
794
  };
795
+ var METAMASK_BROWSE_URL = "https://metamask.app.link/dapp";
748
796
  var createMetaMaskEvmConnector = () => createWcEvmConnector(METAMASK_CONFIG);
797
+ var createMetaMaskSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
798
+ walletId: "metamask",
799
+ browseUrl: METAMASK_BROWSE_URL,
800
+ injectedKey: "isMetaMask",
801
+ stripProtocol: true
802
+ });
749
803
 
750
804
  // src/lib/connectors/solflare.ts
751
805
  var SOLFLARE_CONNECT_URL = "https://solflare.com/ul/v1/connect";
752
806
  var SOLFLARE_SIGN_MESSAGE_URL = "https://solflare.com/ul/v1/signMessage";
807
+ var SOLFLARE_BROWSE_URL = "https://solflare.com/ul/v1/browse";
808
+ var createSolflareSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
809
+ walletId: "solflare",
810
+ browseUrl: SOLFLARE_BROWSE_URL,
811
+ injectedKey: "isSolflare"
812
+ });
753
813
  var SOLFLARE_CONFIG = {
754
814
  connectUrl: SOLFLARE_CONNECT_URL,
755
815
  storageKeyPrefix: "solflare_mobile",
@@ -819,8 +879,14 @@ var TRUST_CONFIG = {
819
879
  wcDeeplink: "https://link.trustwallet.com/wc",
820
880
  injectedKey: "isTrust"
821
881
  };
882
+ var TRUST_BROWSE_URL = "https://link.trustwallet.com/open_url";
822
883
  var createTrustEvmMobileConnector = () => createWcEvmConnector(TRUST_CONFIG);
823
884
  var createTrustSolanaMobileConnector = () => createWcSolanaConnector(TRUST_CONFIG);
885
+ var createTrustSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
886
+ walletId: "trust",
887
+ browseUrl: TRUST_BROWSE_URL,
888
+ injectedKey: "isTrust"
889
+ });
824
890
 
825
891
  // src/lib/connectors/rainbow.ts
826
892
  var RAINBOW_CONFIG = {
@@ -836,8 +902,14 @@ var EXODUS_CONFIG = {
836
902
  wcDeeplink: "https://exodus.com/wc",
837
903
  injectedKey: "isExodus"
838
904
  };
905
+ var EXODUS_BROWSE_URL = "https://exodus.com/m/browser";
839
906
  var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
840
907
  var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
908
+ var createExodusSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
909
+ walletId: "exodus",
910
+ browseUrl: EXODUS_BROWSE_URL,
911
+ injectedKey: "isExodus"
912
+ });
841
913
 
842
914
  // src/lib/connectors/binance.ts
843
915
  var BINANCE_CONFIG = {
@@ -845,8 +917,115 @@ var BINANCE_CONFIG = {
845
917
  wcDeeplink: "bnc://app.binance.com/cedefi/wc",
846
918
  injectedKey: "isBinance"
847
919
  };
920
+ var BINANCE_BROWSE_URL = "bnc://app.binance.com/cedefi/dapp/browser";
848
921
  var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
849
922
  var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
923
+ var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
924
+ walletId: "binance",
925
+ browseUrl: BINANCE_BROWSE_URL,
926
+ injectedKey: "isBinance"
927
+ });
928
+
929
+ // src/lib/connectors/okx.ts
930
+ var OKX_BROWSE_URL = "https://www.okx.com/download?deeplink=";
931
+ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
932
+ walletId: "okx",
933
+ browseUrl: OKX_BROWSE_URL,
934
+ injectedKey: "isOkxWallet"
935
+ });
936
+
937
+ // src/lib/connectors/coinbase.ts
938
+ var COINBASE_BROWSE_URL = "https://go.cb-w.com/dapp";
939
+ var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
940
+ walletId: "coinbase",
941
+ browseUrl: COINBASE_BROWSE_URL,
942
+ injectedKey: "isCoinbaseWallet",
943
+ stripProtocol: true
944
+ });
945
+
946
+ // src/lib/connectors/bitget.ts
947
+ var BITGET_BROWSE_URL = "https://bkcode.vip/dapp";
948
+ var createBitgetSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
949
+ walletId: "bitget",
950
+ browseUrl: BITGET_BROWSE_URL,
951
+ injectedKey: "isBitKeep",
952
+ stripProtocol: true
953
+ });
954
+ var walletConfig = WALLETS.find((w) => w.id === "walletconnect");
955
+ var disconnectWc2 = async () => {
956
+ if (getCurrentSession()) {
957
+ await disconnectWalletConnect();
958
+ }
959
+ };
960
+ var createWalletConnectEvmConnector = () => {
961
+ if (isMobile()) return null;
962
+ return {
963
+ id: walletConfig.id,
964
+ name: walletConfig.name,
965
+ icon: walletConfig.icon,
966
+ type: "evm",
967
+ installed: true,
968
+ wallet: {
969
+ _connector: null,
970
+ connect: async () => {
971
+ return connectViaWalletConnect(EVM_WC_CONFIG, getEvmAccountFromSession);
972
+ },
973
+ disconnect: disconnectWc2,
974
+ signMessage: async (message) => {
975
+ const session = getCurrentSession();
976
+ if (!session) {
977
+ throw new Error("No WalletConnect session");
978
+ }
979
+ const account = session.namespaces.eip155?.accounts?.[0];
980
+ if (!account) {
981
+ throw new Error("No EVM account in session");
982
+ }
983
+ const address = account.split(":")[2];
984
+ const result = await requestWalletConnect(
985
+ "personal_sign",
986
+ [message, address],
987
+ WC_CHAINS.EVM_MAINNET
988
+ );
989
+ return result;
990
+ }
991
+ }
992
+ };
993
+ };
994
+ var createWalletConnectSolanaConnector = () => {
995
+ if (isMobile()) return null;
996
+ return {
997
+ id: walletConfig.id,
998
+ name: walletConfig.name,
999
+ icon: walletConfig.icon,
1000
+ type: "solana",
1001
+ installed: true,
1002
+ wallet: {
1003
+ _provider: null,
1004
+ connect: async () => {
1005
+ return connectViaWalletConnect(SOLANA_WC_CONFIG, getSolanaAccountFromSession);
1006
+ },
1007
+ disconnect: disconnectWc2,
1008
+ signMessage: async (message) => {
1009
+ const session = getCurrentSession();
1010
+ if (!session) {
1011
+ throw new Error("No WalletConnect session");
1012
+ }
1013
+ const account = session.namespaces.solana?.accounts?.[0];
1014
+ if (!account) {
1015
+ throw new Error("No Solana account in session");
1016
+ }
1017
+ const pubkey = account.split(":")[2];
1018
+ const messageBytes = new TextEncoder().encode(message);
1019
+ const result = await requestWalletConnect(
1020
+ "solana_signMessage",
1021
+ { message: bs582.encode(messageBytes), pubkey },
1022
+ WC_CHAINS.SOLANA_MAINNET
1023
+ );
1024
+ return result.signature;
1025
+ }
1026
+ }
1027
+ };
1028
+ };
850
1029
 
851
1030
  // src/lib/evm/connectors.ts
852
1031
  var EVM_FALLBACK_CONNECTORS = [
@@ -950,7 +1129,7 @@ var createSolanaConnector = (provider) => {
950
1129
  const result = await signFeature.signMessage({ message: encodedMessage, account });
951
1130
  const signature = result[0]?.signature;
952
1131
  if (!signature) throw new Error("No signature returned");
953
- return bs58.encode(signature);
1132
+ return bs582.encode(signature);
954
1133
  }
955
1134
  }
956
1135
  };
@@ -967,16 +1146,59 @@ var createSolanaMobileConnector = (connector) => ({
967
1146
  }
968
1147
  }
969
1148
  });
970
- var SOLANA_FALLBACK_CONNECTORS = [
1149
+ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
1150
+ {
1151
+ id: "phantom",
1152
+ create: () => createSolanaMobileConnector(createPhantomSolanaDappBrowserConnector())
1153
+ },
1154
+ {
1155
+ id: "solflare",
1156
+ create: () => createSolanaMobileConnector(createSolflareSolanaDappBrowserConnector())
1157
+ },
1158
+ {
1159
+ id: "metamask",
1160
+ create: () => createSolanaMobileConnector(createMetaMaskSolanaDappBrowserConnector())
1161
+ },
1162
+ {
1163
+ id: "okx",
1164
+ create: () => createSolanaMobileConnector(createOkxSolanaDappBrowserConnector())
1165
+ },
1166
+ {
1167
+ id: "coinbase",
1168
+ create: () => createSolanaMobileConnector(createCoinbaseSolanaDappBrowserConnector())
1169
+ },
1170
+ {
1171
+ id: "bitget",
1172
+ create: () => createSolanaMobileConnector(createBitgetSolanaDappBrowserConnector())
1173
+ },
1174
+ {
1175
+ id: "trust",
1176
+ create: () => createSolanaMobileConnector(createTrustSolanaDappBrowserConnector())
1177
+ },
1178
+ {
1179
+ id: "binance",
1180
+ create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
1181
+ },
1182
+ {
1183
+ id: "exodus",
1184
+ create: () => createSolanaMobileConnector(createExodusSolanaDappBrowserConnector())
1185
+ }
1186
+ ] : [
971
1187
  { id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
972
1188
  // { id: 'metamask', create: () => createSolanaMobileConnector(createMetaMaskSolanaConnector()) },
973
1189
  {
974
1190
  id: "solflare",
975
1191
  create: () => createSolanaMobileConnector(createSolflareSolanaMobileConnector())
976
1192
  },
977
- { id: "trust", create: () => createSolanaMobileConnector(createTrustSolanaMobileConnector()) },
1193
+ {
1194
+ id: "trust",
1195
+ create: () => createSolanaMobileConnector(createTrustSolanaMobileConnector())
1196
+ },
978
1197
  { id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
979
- { id: "exodus", create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector()) }
1198
+ {
1199
+ id: "exodus",
1200
+ create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
1201
+ }
980
1202
  ];
981
1203
  var getSolanaWallets = () => {
982
1204
  const { get } = getWallets();
@@ -1077,7 +1299,12 @@ var useEvmWallet = (options) => {
1077
1299
  const [connectedConnector, setConnectedConnector] = createSignal(null);
1078
1300
  onMount(() => {
1079
1301
  createEvmConfig(options.chains);
1080
- setEvmConnectors(getEvmConnectors());
1302
+ const connectors = getEvmConnectors();
1303
+ const wcConnector = createWalletConnectEvmConnector();
1304
+ if (wcConnector) {
1305
+ connectors.unshift(wcConnector);
1306
+ }
1307
+ setEvmConnectors(connectors);
1081
1308
  const unsubscribe = watchEvmConnections((connections) => {
1082
1309
  const connection = connections[0];
1083
1310
  if (connection && connection.accounts[0]) {
@@ -1123,7 +1350,12 @@ var useSolanaWallet = () => {
1123
1350
  null
1124
1351
  );
1125
1352
  onMount(() => {
1126
- setSolanaConnectors(getSolanaWallets());
1353
+ const connectors = getSolanaWallets();
1354
+ const wcConnector = createWalletConnectSolanaConnector();
1355
+ if (wcConnector) {
1356
+ connectors.unshift(wcConnector);
1357
+ }
1358
+ setSolanaConnectors(connectors);
1127
1359
  const unsubscribeWallets = onSolanaWalletsChange(setSolanaConnectors);
1128
1360
  const unsubscribeConnection = watchSolanaConnection((state) => {
1129
1361
  setSolanaConnection(state.connection);
@@ -1227,7 +1459,7 @@ var useWalletConnect = (options) => {
1227
1459
  const messageBytes = new TextEncoder().encode(message);
1228
1460
  const result = await requestWalletConnect(
1229
1461
  "solana_signMessage",
1230
- { message: bs58.encode(messageBytes), pubkey },
1462
+ { message: bs582.encode(messageBytes), pubkey },
1231
1463
  WC_CHAINS.SOLANA_MAINNET
1232
1464
  );
1233
1465
  return result.signature;
@@ -1336,4 +1568,4 @@ function useWallet() {
1336
1568
  return context;
1337
1569
  }
1338
1570
 
1339
- export { WALLETS, WalletProvider, checkPhantomSignCallback, checkSolflareSignCallback, createEvmConfig, getEvmConfig, getEvmConnectors, getSolanaWallets, initWalletConnect, onSolanaWalletsChange, reconnectSolana, useWallet, watchEvmConnections, watchSolanaConnection };
1571
+ export { WALLETS, WalletProvider, checkPhantomSignCallback, checkSolflareSignCallback, createEvmConfig, getCurrentSession, getEvmConfig, getEvmConnectors, getSolanaWallets, initWalletConnect, onSolanaWalletsChange, onWalletConnectSessionChange, reconnectSolana, useWallet, watchEvmConnections, watchSolanaConnection };