@coinbase/cdp-solana-standard-wallet 0.0.98 → 0.0.100

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.
@@ -1,4 +1,4 @@
1
- const o = "0.0.98";
1
+ const o = "0.0.100";
2
2
  export {
3
3
  o as VERSION
4
4
  };
@@ -15,37 +15,178 @@ export declare const CDP_SOLANA_WALLET_STANDARD_VERSION: "1.0.0";
15
15
 
16
16
  export declare const CDP_STANDARD_SOLANA_WALLET_FEATURES: readonly ["solana:signAndSendTransaction", "solana:signTransaction", "solana:signMessage"];
17
17
 
18
+ /**
19
+ * Custom feature to distinguish CDP Solana Wallet from other standard Solana wallets.
20
+ *
21
+ * This feature flag allows dapps to identify CDP wallets specifically.
22
+ */
18
23
  export declare type CdpFeature = {
19
24
  "cdp:": true;
20
25
  };
21
26
 
27
+ /**
28
+ * Supported Solana chains for CDP wallets.
29
+ *
30
+ * Union type of supported Solana chain identifiers.
31
+ */
22
32
  export declare type CdpSolanaChain = (typeof CDP_SOLANA_CHAINS)[number];
23
33
 
34
+ /**
35
+ * CDP Solana Wallet implementation for the Wallet Standard.
36
+ *
37
+ * This wallet integrates CDP's embedded Solana accounts with the wallet standard ecosystem,
38
+ * allowing dapps to interact with CDP wallets through standardized interfaces.
39
+ */
24
40
  export declare class CdpSolanaWallet implements Wallet {
25
41
  #private;
42
+ /**
43
+ * Create a new CDP Solana Wallet instance.
44
+ *
45
+ * @param solanaAddresses - Array of Solana addresses (base58 encoded)
46
+ */
26
47
  constructor(solanaAddresses: string[]);
48
+ /**
49
+ * Get the wallet name.
50
+ *
51
+ * @returns The wallet name
52
+ */
27
53
  get name(): "CDP Solana Wallet";
54
+ /**
55
+ * Get the wallet icon.
56
+ *
57
+ * @returns The wallet icon as base64 data URI
58
+ */
28
59
  get icon(): "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9Ijg4IiB2aWV3Qm94PSIwIDAgMTAxIDg4I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tLjMzNjk1LS4zOTktLjYyMzc4NC0uNzE0LS44MjUyNTctLjMxNTYtLjIwMTQ3NC0uNjg0NS0uMzA4ODEwNTktMS4wNjE2LS4zMDg4MjNoLTc5LjAzNDNjLS41Mjk5LjAwMDg3ODQtMS4wNTM5LjEwNzY5OS0xLjUzOTcuMzEzODQ4LS40ODU3LjIwNjE1LS45MjI4LjUwNzIzOS0xLjI4NDMuODg0NjMybC0xNi42ODEzNzcgMTcuNDE5ODJjLS4yNTcwNDIuMjY4My0uNDI4MTAzMi42MDQtLjQ5MjIwNDUuOTY1Ni0uMDY0MTAxNC4zNjE3LS4wMTg0NTYxLjczMzguMTMxMzM3NSAxLjA3MDYuMTQ5Nzk0LjMzNjguMzk3MjI1LjYyMzYuNzExOTQ4LjgyNTQuMzE0NzI2LjIwMTguNjgzMDU2LjMwOTcgMS4wNTk4MjYuMzEwNnoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=";
60
+ /**
61
+ * Get the supported chains.
62
+ *
63
+ * @returns Array of supported Solana chains
64
+ */
29
65
  get chains(): readonly ["solana:mainnet", "solana:devnet"];
66
+ /**
67
+ * Get the wallet standard version.
68
+ *
69
+ * @returns The wallet standard version
70
+ */
30
71
  get version(): "1.0.0";
72
+ /**
73
+ * Get the wallet accounts.
74
+ *
75
+ * @returns Array of readonly wallet accounts
76
+ */
31
77
  get accounts(): ReadonlyWalletAccount[];
78
+ /**
79
+ * Get the wallet features.
80
+ *
81
+ * @returns Wallet standard features supported by this wallet
82
+ */
32
83
  get features(): StandardConnectFeature & StandardDisconnectFeature & StandardEventsFeature & SolanaSignAndSendTransactionFeature & SolanaSignTransactionFeature & SolanaSignMessageFeature & CdpFeature;
33
84
  }
34
85
 
86
+ /**
87
+ * CDP Wallet Account implementation for Solana accounts.
88
+ *
89
+ * This class represents a Solana account within the CDP wallet ecosystem.
90
+ */
35
91
  export declare class CdpWalletAccount implements WalletAccount {
36
92
  #private;
93
+ /**
94
+ * Create a new CDP Wallet Account.
95
+ *
96
+ * @param publicKey - The public key bytes for this account (must be exactly 32 bytes for Solana)
97
+ * @throws {Error} If publicKey is null, undefined, or not exactly 32 bytes
98
+ */
37
99
  constructor(publicKey: Uint8Array);
100
+ /**
101
+ * Get the base58 encoded address of this account.
102
+ *
103
+ * @returns The base58 encoded Solana address
104
+ */
38
105
  get address(): string;
106
+ /**
107
+ * Get the public key bytes of this account.
108
+ *
109
+ * @returns A copy of the public key bytes
110
+ */
39
111
  get publicKey(): Uint8Array<ArrayBuffer>;
112
+ /**
113
+ * Get the supported chains for this account.
114
+ *
115
+ * @returns Array of supported Solana chains
116
+ */
40
117
  get chains(): readonly ["solana:mainnet", "solana:devnet"];
118
+ /**
119
+ * Get the supported features for this account.
120
+ *
121
+ * @returns Array of supported wallet standard features
122
+ */
41
123
  get features(): readonly ["solana:signAndSendTransaction", "solana:signTransaction", "solana:signMessage"];
42
124
  }
43
125
 
126
+ /**
127
+ * Hook to get the CDP Standard Solana Wallet with ready state.
128
+ *
129
+ * This hook monitors the user's Solana accounts from CDP core and:
130
+ * - Creates and registers a CdpSolanaWallet when accounts are available
131
+ * - Returns a ready flag indicating when the wallet is instantiated and registered
132
+ * - Returns the wallet instance for direct usage
133
+ * - Handles cleanup/unregistration on unmount
134
+ *
135
+ * @param config - Optional CDP configuration. If provided, will initialize the SDK.
136
+ * If omitted, assumes SDK is already initialized (e.g., via CDPHooksProvider).
137
+ *
138
+ * @example
139
+ * ```tsx
140
+ * // Within CDPHooksProvider (SDK already initialized)
141
+ * function MyComponent() {
142
+ * const { ready, wallet } = useCdpSolanaStandardWallet();
143
+ * // ...
144
+ * }
145
+ *
146
+ * // Standalone usage (initialize SDK)
147
+ * function MyComponent() {
148
+ * const { ready, wallet } = useCdpSolanaStandardWallet({
149
+ * projectId: "your-project-id"
150
+ * });
151
+ * // ...
152
+ * }
153
+ * ```
154
+ *
155
+ * @returns Object containing ready flag and wallet instance
156
+ */
44
157
  export declare const useCdpSolanaStandardWallet: (config?: Config) => {
45
158
  ready: boolean;
46
159
  wallet: CdpSolanaWallet | null;
47
160
  };
48
161
 
162
+ /**
163
+ * Hook to get all Standard Solana Wallets registered in the wallet standard.
164
+ *
165
+ * This hook:
166
+ * - Gets all wallets using getWallets().get()
167
+ * - Listens for wallet registration/unregistration events
168
+ * - Returns the complete list including the CDP wallet once registered
169
+ *
170
+ * @example
171
+ * ```tsx
172
+ * function WalletList() {
173
+ * const { wallets } = useSolanaStandardWallets();
174
+ *
175
+ * return (
176
+ * <div>
177
+ * <h3>Available Wallets:</h3>
178
+ * {wallets.map((wallet) => (
179
+ * <div key={wallet.name}>
180
+ * {wallet.name} {wallet.features['cdp:'] ? '(CDP)' : ''}
181
+ * </div>
182
+ * ))}
183
+ * </div>
184
+ * );
185
+ * }
186
+ * ```
187
+ *
188
+ * @returns Object containing array of all registered wallets
189
+ */
49
190
  export declare const useSolanaStandardWallets: () => {
50
191
  wallets: readonly Wallet[];
51
192
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-solana-standard-wallet",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**",
@@ -22,7 +22,7 @@
22
22
  "@wallet-standard/wallet": "^1.1.0",
23
23
  "@wallet-standard/features": "^1.1.0",
24
24
  "@wallet-standard/app": "^1.1.0",
25
- "@coinbase/cdp-core": "^0.0.98"
25
+ "@coinbase/cdp-core": "^0.0.100"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@testing-library/jest-dom": "^6.6.3",
@@ -37,7 +37,7 @@
37
37
  "@size-limit/webpack": "^11.2.0",
38
38
  "@size-limit/webpack-why": "^11.2.0",
39
39
  "size-limit": "^11.2.0",
40
- "@coinbase/cdp-core": "^0.0.98"
40
+ "@coinbase/cdp-core": "^0.0.100"
41
41
  },
42
42
  "size-limit": [
43
43
  {