@dynamic-labs/global-wallet-client 4.0.0-alpha.52 → 4.0.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -7
  5. package/src/lib/actions/connectAction/createConnectAction.cjs +17 -6
  6. package/src/lib/actions/connectAction/createConnectAction.d.ts +2 -1
  7. package/src/lib/actions/connectAction/createConnectAction.js +17 -6
  8. package/src/lib/createGlobalWalletClient.cjs +2 -0
  9. package/src/lib/createGlobalWalletClient.d.ts +5 -0
  10. package/src/lib/createGlobalWalletClient.js +2 -0
  11. package/src/lib/ethereum/functions/eip1193Provider/createEIP1193Provider.cjs +86 -57
  12. package/src/lib/ethereum/functions/eip1193Provider/createEIP1193Provider.js +87 -58
  13. package/src/lib/ethereum/functions/isNetworkSupported/index.d.ts +1 -0
  14. package/src/lib/ethereum/functions/isNetworkSupported/isNetworkSupported.cjs +8 -0
  15. package/src/lib/ethereum/functions/isNetworkSupported/isNetworkSupported.d.ts +3 -0
  16. package/src/lib/ethereum/functions/isNetworkSupported/isNetworkSupported.js +4 -0
  17. package/src/lib/functions/createEthereumModule/createEthereumModule.cjs +3 -0
  18. package/src/lib/functions/createEthereumModule/createEthereumModule.d.ts +1 -0
  19. package/src/lib/functions/createEthereumModule/createEthereumModule.js +3 -0
  20. package/src/lib/functions/createPopupOpener/createPopupOpener.cjs +2 -1
  21. package/src/lib/functions/createPopupOpener/createPopupOpener.js +2 -1
  22. package/src/lib/functions/createSolanaModule/createSolanaModule.cjs +17 -0
  23. package/src/lib/functions/createSolanaModule/createSolanaModule.d.ts +9 -0
  24. package/src/lib/functions/createSolanaModule/createSolanaModule.js +13 -0
  25. package/src/lib/functions/createSolanaModule/index.d.ts +1 -0
  26. package/src/lib/solana/functions/convertBaseWalletToWalletAccount/convertBaseWalletToWalletAccount.cjs +36 -0
  27. package/src/lib/solana/functions/convertBaseWalletToWalletAccount/convertBaseWalletToWalletAccount.d.ts +4 -0
  28. package/src/lib/solana/functions/convertBaseWalletToWalletAccount/convertBaseWalletToWalletAccount.js +32 -0
  29. package/src/lib/solana/functions/convertBaseWalletToWalletAccount/index.d.ts +1 -0
  30. package/src/lib/solana/functions/createSolanaSignAndSendTransactionFeature/createSolanaSignAndSendTransactionFeature.cjs +14 -0
  31. package/src/lib/solana/functions/createSolanaSignAndSendTransactionFeature/createSolanaSignAndSendTransactionFeature.d.ts +2 -0
  32. package/src/lib/solana/functions/createSolanaSignAndSendTransactionFeature/createSolanaSignAndSendTransactionFeature.js +10 -0
  33. package/src/lib/solana/functions/createSolanaSignAndSendTransactionFeature/index.d.ts +1 -0
  34. package/src/lib/solana/functions/createSolanaSignMessageFeature/createSolanaSignMessageFeature.cjs +29 -0
  35. package/src/lib/solana/functions/createSolanaSignMessageFeature/createSolanaSignMessageFeature.d.ts +3 -0
  36. package/src/lib/solana/functions/createSolanaSignMessageFeature/createSolanaSignMessageFeature.js +25 -0
  37. package/src/lib/solana/functions/createSolanaSignMessageFeature/index.d.ts +1 -0
  38. package/src/lib/solana/functions/createSolanaSignTransactionFeature/createSolanaSignTransactionFeature.cjs +14 -0
  39. package/src/lib/solana/functions/createSolanaSignTransactionFeature/createSolanaSignTransactionFeature.d.ts +2 -0
  40. package/src/lib/solana/functions/createSolanaSignTransactionFeature/createSolanaSignTransactionFeature.js +10 -0
  41. package/src/lib/solana/functions/createSolanaSignTransactionFeature/index.d.ts +1 -0
  42. package/src/lib/solana/functions/createSolanaWallet/createSolanaWallet.cjs +47 -0
  43. package/src/lib/solana/functions/createSolanaWallet/createSolanaWallet.d.ts +17 -0
  44. package/src/lib/solana/functions/createSolanaWallet/createSolanaWallet.js +43 -0
  45. package/src/lib/solana/functions/createSolanaWallet/index.d.ts +1 -0
  46. package/src/lib/solana/functions/createStandardConnectFeature/createStandardConnectFeature.cjs +21 -0
  47. package/src/lib/solana/functions/createStandardConnectFeature/createStandardConnectFeature.d.ts +3 -0
  48. package/src/lib/solana/functions/createStandardConnectFeature/createStandardConnectFeature.js +17 -0
  49. package/src/lib/solana/functions/createStandardConnectFeature/index.d.ts +1 -0
  50. package/src/lib/solana/functions/createStandardDisconnectFeature/createStandardDisconnectFeature.cjs +13 -0
  51. package/src/lib/solana/functions/createStandardDisconnectFeature/createStandardDisconnectFeature.d.ts +3 -0
  52. package/src/lib/solana/functions/createStandardDisconnectFeature/createStandardDisconnectFeature.js +9 -0
  53. package/src/lib/solana/functions/createStandardDisconnectFeature/index.d.ts +1 -0
  54. package/src/lib/solana/functions/createStandardEventsFeature/createStandardEventsFeature.cjs +38 -0
  55. package/src/lib/solana/functions/createStandardEventsFeature/createStandardEventsFeature.d.ts +13 -0
  56. package/src/lib/solana/functions/createStandardEventsFeature/createStandardEventsFeature.js +34 -0
  57. package/src/lib/solana/functions/createStandardEventsFeature/index.d.ts +1 -0
  58. package/src/lib/solana/functions/getSolanaChains/getSolanaChains.cjs +13 -0
  59. package/src/lib/solana/functions/getSolanaChains/getSolanaChains.d.ts +2 -0
  60. package/src/lib/solana/functions/getSolanaChains/getSolanaChains.js +9 -0
  61. package/src/lib/solana/functions/getSolanaChains/index.d.ts +1 -0
  62. package/src/lib/solana/index.d.ts +1 -0
  63. package/src/lib/store/createClientStore.cjs +24 -2
  64. package/src/lib/store/createClientStore.d.ts +18 -1
  65. package/src/lib/store/createClientStore.js +24 -2
  66. package/src/solana.cjs +10 -0
  67. package/src/solana.d.ts +1 -0
  68. package/src/solana.js +2 -0
@@ -13,6 +13,7 @@ const createClientStore = ({ storage = localStorage, } = {}) => {
13
13
  store: store.createStore(() => ({
14
14
  connection: null,
15
15
  ethereum: null,
16
+ solana: null,
16
17
  wallets: [],
17
18
  })),
18
19
  });
@@ -51,8 +52,29 @@ const createClientStore = ({ storage = localStorage, } = {}) => {
51
52
  * Used when the popup confirm a connection
52
53
  * @param {GlobalWalletConnection | null} connection - The connection to store, or null to clear it
53
54
  */
54
- setInitialConnectionState: ({ connection, wallets, ethereum, }) => {
55
- store$1.setState({ connection, ethereum, wallets });
55
+ setInitialConnectionState: ({ connection, wallets, ethereum, solana, }) => {
56
+ store$1.setState({ connection, ethereum, solana, wallets });
57
+ },
58
+ /**
59
+ * Get all Solana wallets connected to the current connection
60
+ */
61
+ get solana() {
62
+ this.getActiveConnection();
63
+ return store$1.getState().solana;
64
+ },
65
+ /**
66
+ * Switches the Ethereum network
67
+ * @param {number} networkId - The network ID to switch to
68
+ */
69
+ switchEthereumNetwork(networkId) {
70
+ this.getActiveConnection();
71
+ const { ethereum } = store$1.getState();
72
+ if (!ethereum) {
73
+ throw new Error('No connection found');
74
+ }
75
+ store$1.setState({
76
+ ethereum: Object.assign(Object.assign({}, ethereum), { currentNetworkId: networkId }),
77
+ });
56
78
  },
57
79
  /**
58
80
  * Get all wallets connected to the current connection
@@ -20,6 +20,12 @@ type ClientStoreState = {
20
20
  }[];
21
21
  currentNetworkId: number;
22
22
  } | null;
23
+ /**
24
+ * Solana specific state
25
+ */
26
+ solana: {
27
+ currentNetwork: string;
28
+ } | null;
23
29
  };
24
30
  export declare const createClientStore: ({ storage, }?: CreateClientStoreProps) => {
25
31
  /**
@@ -45,7 +51,18 @@ export declare const createClientStore: ({ storage, }?: CreateClientStoreProps)
45
51
  * Used when the popup confirm a connection
46
52
  * @param {GlobalWalletConnection | null} connection - The connection to store, or null to clear it
47
53
  */
48
- setInitialConnectionState: ({ connection, wallets, ethereum, }: Pick<ClientStoreState, 'connection' | 'wallets' | 'ethereum'>) => void;
54
+ setInitialConnectionState: ({ connection, wallets, ethereum, solana, }: Pick<ClientStoreState, 'connection' | 'wallets' | 'ethereum' | 'solana'>) => void;
55
+ /**
56
+ * Get all Solana wallets connected to the current connection
57
+ */
58
+ readonly solana: {
59
+ currentNetwork: string;
60
+ } | null;
61
+ /**
62
+ * Switches the Ethereum network
63
+ * @param {number} networkId - The network ID to switch to
64
+ */
65
+ switchEthereumNetwork(networkId: number): void;
49
66
  /**
50
67
  * Get all wallets connected to the current connection
51
68
  */
@@ -9,6 +9,7 @@ const createClientStore = ({ storage = localStorage, } = {}) => {
9
9
  store: createStore(() => ({
10
10
  connection: null,
11
11
  ethereum: null,
12
+ solana: null,
12
13
  wallets: [],
13
14
  })),
14
15
  });
@@ -47,8 +48,29 @@ const createClientStore = ({ storage = localStorage, } = {}) => {
47
48
  * Used when the popup confirm a connection
48
49
  * @param {GlobalWalletConnection | null} connection - The connection to store, or null to clear it
49
50
  */
50
- setInitialConnectionState: ({ connection, wallets, ethereum, }) => {
51
- store.setState({ connection, ethereum, wallets });
51
+ setInitialConnectionState: ({ connection, wallets, ethereum, solana, }) => {
52
+ store.setState({ connection, ethereum, solana, wallets });
53
+ },
54
+ /**
55
+ * Get all Solana wallets connected to the current connection
56
+ */
57
+ get solana() {
58
+ this.getActiveConnection();
59
+ return store.getState().solana;
60
+ },
61
+ /**
62
+ * Switches the Ethereum network
63
+ * @param {number} networkId - The network ID to switch to
64
+ */
65
+ switchEthereumNetwork(networkId) {
66
+ this.getActiveConnection();
67
+ const { ethereum } = store.getState();
68
+ if (!ethereum) {
69
+ throw new Error('No connection found');
70
+ }
71
+ store.setState({
72
+ ethereum: Object.assign(Object.assign({}, ethereum), { currentNetworkId: networkId }),
73
+ });
52
74
  },
53
75
  /**
54
76
  * Get all wallets connected to the current connection
package/src/solana.cjs ADDED
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var createSolanaWallet = require('./lib/solana/functions/createSolanaWallet/createSolanaWallet.cjs');
7
+
8
+
9
+
10
+ exports.createSolanaWallet = createSolanaWallet.createSolanaWallet;
@@ -0,0 +1 @@
1
+ export { createSolanaWallet } from './lib/solana';
package/src/solana.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use client'
2
+ export { createSolanaWallet } from './lib/solana/functions/createSolanaWallet/createSolanaWallet.js';