@bit-buccaneers/wallet-abstraction 0.0.4 → 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/dev.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();
@@ -565,11 +607,11 @@ var disconnectWcOrSolana = async () => {
565
607
  }
566
608
  };
567
609
  var createWcEvmConnector = (config2) => {
568
- const walletConfig = WALLETS.find((w) => w.id === config2.walletId);
610
+ const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
569
611
  const getDeeplink = createDeeplink(config2.wcDeeplink);
570
612
  const isInWallet = () => isInWalletBrowser(config2.injectedKey);
571
613
  return {
572
- ...walletConfig,
614
+ ...walletConfig2,
573
615
  type: "evm",
574
616
  wallet: {
575
617
  _connector: null,
@@ -610,11 +652,11 @@ var createWcEvmConnector = (config2) => {
610
652
  };
611
653
  };
612
654
  var createWcSolanaConnector = (config2) => {
613
- const walletConfig = WALLETS.find((w) => w.id === config2.walletId);
655
+ const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
614
656
  const getDeeplink = createDeeplink(config2.wcDeeplink);
615
657
  const isInWallet = () => isInWalletBrowser(config2.injectedKey);
616
658
  return {
617
- ...walletConfig,
659
+ ...walletConfig2,
618
660
  type: "solana",
619
661
  wallet: {
620
662
  _provider: null,
@@ -641,7 +683,7 @@ var createWcSolanaConnector = (config2) => {
641
683
  const messageBytes = new TextEncoder().encode(message);
642
684
  const result = await requestWalletConnect(
643
685
  "solana_signMessage",
644
- { message: bs58.encode(messageBytes), pubkey },
686
+ { message: bs582.encode(messageBytes), pubkey },
645
687
  WC_CHAINS.SOLANA_MAINNET
646
688
  );
647
689
  return result.signature;
@@ -654,6 +696,11 @@ var createWcSolanaConnector = (config2) => {
654
696
  var PHANTOM_CONNECT_URL = "https://phantom.app/ul/v1/connect";
655
697
  var PHANTOM_SIGN_MESSAGE_URL = "https://phantom.app/ul/v1/signMessage";
656
698
  var PHANTOM_BROWSE_URL = "https://phantom.app/ul/browse";
699
+ var createPhantomSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
700
+ walletId: "phantom",
701
+ browseUrl: PHANTOM_BROWSE_URL,
702
+ injectedKey: "isPhantom"
703
+ });
657
704
  var PHANTOM_CONFIG = {
658
705
  connectUrl: PHANTOM_CONNECT_URL,
659
706
  storageKeyPrefix: "phantom_mobile",
@@ -750,11 +797,24 @@ var METAMASK_CONFIG = {
750
797
  wcDeeplink: "https://metamask.app.link/wc",
751
798
  injectedKey: "isMetaMask"
752
799
  };
800
+ var METAMASK_BROWSE_URL = "https://metamask.app.link/dapp";
753
801
  var createMetaMaskEvmConnector = () => createWcEvmConnector(METAMASK_CONFIG);
802
+ var createMetaMaskSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
803
+ walletId: "metamask",
804
+ browseUrl: METAMASK_BROWSE_URL,
805
+ injectedKey: "isMetaMask",
806
+ stripProtocol: true
807
+ });
754
808
 
755
809
  // src/lib/connectors/solflare.ts
756
810
  var SOLFLARE_CONNECT_URL = "https://solflare.com/ul/v1/connect";
757
811
  var SOLFLARE_SIGN_MESSAGE_URL = "https://solflare.com/ul/v1/signMessage";
812
+ var SOLFLARE_BROWSE_URL = "https://solflare.com/ul/v1/browse";
813
+ var createSolflareSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
814
+ walletId: "solflare",
815
+ browseUrl: SOLFLARE_BROWSE_URL,
816
+ injectedKey: "isSolflare"
817
+ });
758
818
  var SOLFLARE_CONFIG = {
759
819
  connectUrl: SOLFLARE_CONNECT_URL,
760
820
  storageKeyPrefix: "solflare_mobile",
@@ -824,8 +884,14 @@ var TRUST_CONFIG = {
824
884
  wcDeeplink: "https://link.trustwallet.com/wc",
825
885
  injectedKey: "isTrust"
826
886
  };
887
+ var TRUST_BROWSE_URL = "https://link.trustwallet.com/open_url";
827
888
  var createTrustEvmMobileConnector = () => createWcEvmConnector(TRUST_CONFIG);
828
889
  var createTrustSolanaMobileConnector = () => createWcSolanaConnector(TRUST_CONFIG);
890
+ var createTrustSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
891
+ walletId: "trust",
892
+ browseUrl: TRUST_BROWSE_URL,
893
+ injectedKey: "isTrust"
894
+ });
829
895
 
830
896
  // src/lib/connectors/rainbow.ts
831
897
  var RAINBOW_CONFIG = {
@@ -841,8 +907,14 @@ var EXODUS_CONFIG = {
841
907
  wcDeeplink: "https://exodus.com/wc",
842
908
  injectedKey: "isExodus"
843
909
  };
910
+ var EXODUS_BROWSE_URL = "https://exodus.com/m/browser";
844
911
  var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
845
912
  var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
913
+ var createExodusSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
914
+ walletId: "exodus",
915
+ browseUrl: EXODUS_BROWSE_URL,
916
+ injectedKey: "isExodus"
917
+ });
846
918
 
847
919
  // src/lib/connectors/binance.ts
848
920
  var BINANCE_CONFIG = {
@@ -850,8 +922,115 @@ var BINANCE_CONFIG = {
850
922
  wcDeeplink: "bnc://app.binance.com/cedefi/wc",
851
923
  injectedKey: "isBinance"
852
924
  };
925
+ var BINANCE_BROWSE_URL = "bnc://app.binance.com/cedefi/dapp/browser";
853
926
  var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
854
927
  var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
928
+ var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
929
+ walletId: "binance",
930
+ browseUrl: BINANCE_BROWSE_URL,
931
+ injectedKey: "isBinance"
932
+ });
933
+
934
+ // src/lib/connectors/okx.ts
935
+ var OKX_BROWSE_URL = "https://www.okx.com/download?deeplink=";
936
+ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
937
+ walletId: "okx",
938
+ browseUrl: OKX_BROWSE_URL,
939
+ injectedKey: "isOkxWallet"
940
+ });
941
+
942
+ // src/lib/connectors/coinbase.ts
943
+ var COINBASE_BROWSE_URL = "https://go.cb-w.com/dapp";
944
+ var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
945
+ walletId: "coinbase",
946
+ browseUrl: COINBASE_BROWSE_URL,
947
+ injectedKey: "isCoinbaseWallet",
948
+ stripProtocol: true
949
+ });
950
+
951
+ // src/lib/connectors/bitget.ts
952
+ var BITGET_BROWSE_URL = "https://bkcode.vip/dapp";
953
+ var createBitgetSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
954
+ walletId: "bitget",
955
+ browseUrl: BITGET_BROWSE_URL,
956
+ injectedKey: "isBitKeep",
957
+ stripProtocol: true
958
+ });
959
+ var walletConfig = WALLETS.find((w) => w.id === "walletconnect");
960
+ var disconnectWc2 = async () => {
961
+ if (getCurrentSession()) {
962
+ await disconnectWalletConnect();
963
+ }
964
+ };
965
+ var createWalletConnectEvmConnector = () => {
966
+ if (isMobile()) return null;
967
+ return {
968
+ id: walletConfig.id,
969
+ name: walletConfig.name,
970
+ icon: walletConfig.icon,
971
+ type: "evm",
972
+ installed: true,
973
+ wallet: {
974
+ _connector: null,
975
+ connect: async () => {
976
+ return connectViaWalletConnect(EVM_WC_CONFIG, getEvmAccountFromSession);
977
+ },
978
+ disconnect: disconnectWc2,
979
+ signMessage: async (message) => {
980
+ const session = getCurrentSession();
981
+ if (!session) {
982
+ throw new Error("No WalletConnect session");
983
+ }
984
+ const account = session.namespaces.eip155?.accounts?.[0];
985
+ if (!account) {
986
+ throw new Error("No EVM account in session");
987
+ }
988
+ const address = account.split(":")[2];
989
+ const result = await requestWalletConnect(
990
+ "personal_sign",
991
+ [message, address],
992
+ WC_CHAINS.EVM_MAINNET
993
+ );
994
+ return result;
995
+ }
996
+ }
997
+ };
998
+ };
999
+ var createWalletConnectSolanaConnector = () => {
1000
+ if (isMobile()) return null;
1001
+ return {
1002
+ id: walletConfig.id,
1003
+ name: walletConfig.name,
1004
+ icon: walletConfig.icon,
1005
+ type: "solana",
1006
+ installed: true,
1007
+ wallet: {
1008
+ _provider: null,
1009
+ connect: async () => {
1010
+ return connectViaWalletConnect(SOLANA_WC_CONFIG, getSolanaAccountFromSession);
1011
+ },
1012
+ disconnect: disconnectWc2,
1013
+ signMessage: async (message) => {
1014
+ const session = getCurrentSession();
1015
+ if (!session) {
1016
+ throw new Error("No WalletConnect session");
1017
+ }
1018
+ const account = session.namespaces.solana?.accounts?.[0];
1019
+ if (!account) {
1020
+ throw new Error("No Solana account in session");
1021
+ }
1022
+ const pubkey = account.split(":")[2];
1023
+ const messageBytes = new TextEncoder().encode(message);
1024
+ const result = await requestWalletConnect(
1025
+ "solana_signMessage",
1026
+ { message: bs582.encode(messageBytes), pubkey },
1027
+ WC_CHAINS.SOLANA_MAINNET
1028
+ );
1029
+ return result.signature;
1030
+ }
1031
+ }
1032
+ };
1033
+ };
855
1034
 
856
1035
  // src/lib/evm/connectors.ts
857
1036
  var EVM_FALLBACK_CONNECTORS = [
@@ -955,7 +1134,7 @@ var createSolanaConnector = (provider) => {
955
1134
  const result = await signFeature.signMessage({ message: encodedMessage, account });
956
1135
  const signature = result[0]?.signature;
957
1136
  if (!signature) throw new Error("No signature returned");
958
- return bs58.encode(signature);
1137
+ return bs582.encode(signature);
959
1138
  }
960
1139
  }
961
1140
  };
@@ -972,16 +1151,59 @@ var createSolanaMobileConnector = (connector) => ({
972
1151
  }
973
1152
  }
974
1153
  });
975
- var SOLANA_FALLBACK_CONNECTORS = [
1154
+ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
1155
+ {
1156
+ id: "phantom",
1157
+ create: () => createSolanaMobileConnector(createPhantomSolanaDappBrowserConnector())
1158
+ },
1159
+ {
1160
+ id: "solflare",
1161
+ create: () => createSolanaMobileConnector(createSolflareSolanaDappBrowserConnector())
1162
+ },
1163
+ {
1164
+ id: "metamask",
1165
+ create: () => createSolanaMobileConnector(createMetaMaskSolanaDappBrowserConnector())
1166
+ },
1167
+ {
1168
+ id: "okx",
1169
+ create: () => createSolanaMobileConnector(createOkxSolanaDappBrowserConnector())
1170
+ },
1171
+ {
1172
+ id: "coinbase",
1173
+ create: () => createSolanaMobileConnector(createCoinbaseSolanaDappBrowserConnector())
1174
+ },
1175
+ {
1176
+ id: "bitget",
1177
+ create: () => createSolanaMobileConnector(createBitgetSolanaDappBrowserConnector())
1178
+ },
1179
+ {
1180
+ id: "trust",
1181
+ create: () => createSolanaMobileConnector(createTrustSolanaDappBrowserConnector())
1182
+ },
1183
+ {
1184
+ id: "binance",
1185
+ create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
1186
+ },
1187
+ {
1188
+ id: "exodus",
1189
+ create: () => createSolanaMobileConnector(createExodusSolanaDappBrowserConnector())
1190
+ }
1191
+ ] : [
976
1192
  { id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
977
1193
  // { id: 'metamask', create: () => createSolanaMobileConnector(createMetaMaskSolanaConnector()) },
978
1194
  {
979
1195
  id: "solflare",
980
1196
  create: () => createSolanaMobileConnector(createSolflareSolanaMobileConnector())
981
1197
  },
982
- { id: "trust", create: () => createSolanaMobileConnector(createTrustSolanaMobileConnector()) },
1198
+ {
1199
+ id: "trust",
1200
+ create: () => createSolanaMobileConnector(createTrustSolanaMobileConnector())
1201
+ },
983
1202
  { id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
984
- { id: "exodus", create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector()) }
1203
+ {
1204
+ id: "exodus",
1205
+ create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
1206
+ }
985
1207
  ];
986
1208
  var getSolanaWallets = () => {
987
1209
  const { get } = getWallets();
@@ -1082,7 +1304,12 @@ var useEvmWallet = (options) => {
1082
1304
  const [connectedConnector, setConnectedConnector] = createSignal(null);
1083
1305
  onMount(() => {
1084
1306
  createEvmConfig(options.chains);
1085
- setEvmConnectors(getEvmConnectors());
1307
+ const connectors = getEvmConnectors();
1308
+ const wcConnector = createWalletConnectEvmConnector();
1309
+ if (wcConnector) {
1310
+ connectors.unshift(wcConnector);
1311
+ }
1312
+ setEvmConnectors(connectors);
1086
1313
  const unsubscribe = watchEvmConnections((connections) => {
1087
1314
  const connection = connections[0];
1088
1315
  if (connection && connection.accounts[0]) {
@@ -1128,7 +1355,12 @@ var useSolanaWallet = () => {
1128
1355
  null
1129
1356
  );
1130
1357
  onMount(() => {
1131
- setSolanaConnectors(getSolanaWallets());
1358
+ const connectors = getSolanaWallets();
1359
+ const wcConnector = createWalletConnectSolanaConnector();
1360
+ if (wcConnector) {
1361
+ connectors.unshift(wcConnector);
1362
+ }
1363
+ setSolanaConnectors(connectors);
1132
1364
  const unsubscribeWallets = onSolanaWalletsChange(setSolanaConnectors);
1133
1365
  const unsubscribeConnection = watchSolanaConnection((state) => {
1134
1366
  setSolanaConnection(state.connection);
@@ -1232,7 +1464,7 @@ var useWalletConnect = (options) => {
1232
1464
  const messageBytes = new TextEncoder().encode(message);
1233
1465
  const result = await requestWalletConnect(
1234
1466
  "solana_signMessage",
1235
- { message: bs58.encode(messageBytes), pubkey },
1467
+ { message: bs582.encode(messageBytes), pubkey },
1236
1468
  WC_CHAINS.SOLANA_MAINNET
1237
1469
  );
1238
1470
  return result.signature;
@@ -1341,4 +1573,4 @@ function useWallet() {
1341
1573
  return context;
1342
1574
  }
1343
1575
 
1344
- export { WALLETS, WalletProvider, checkPhantomSignCallback, checkSolflareSignCallback, createEvmConfig, getEvmConfig, getEvmConnectors, getSolanaWallets, initWalletConnect, onSolanaWalletsChange, reconnectSolana, useWallet, watchEvmConnections, watchSolanaConnection };
1576
+ export { WALLETS, WalletProvider, checkPhantomSignCallback, checkSolflareSignCallback, createEvmConfig, getCurrentSession, getEvmConfig, getEvmConnectors, getSolanaWallets, initWalletConnect, onSolanaWalletsChange, onWalletConnectSessionChange, reconnectSolana, useWallet, watchEvmConnections, watchSolanaConnection };