@cavos/kit 0.0.1 → 0.0.2

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.d.mts CHANGED
@@ -1,244 +1,7 @@
1
- import { Account, Signer, ArraySignatureType } from 'starknet';
2
- import { D as DevicePublicKey, S as StarknetNetwork, a as DeviceSigner, C as ChainCall, b as DeviceSignature, c as ChainAdapter, d as ComputeAddressParams } from './constants-C530TZFF.mjs';
3
- export { e as DEVICE_ACCOUNT_CLASS_HASH, f as STARKNET_NETWORKS, U as UDC_ADDRESS } from './constants-C530TZFF.mjs';
4
-
5
- /**
6
- * Identity for a Cavos wallet. Login (email / social / OTP) only ever produces a
7
- * stable `userId`; that's all the wallet needs to derive its address. Auth never
8
- * touches signing — the device key does that, silently.
9
- *
10
- * Privy-style UX: the user "logs in" and the wallet is provisioned behind the
11
- * scenes (device key + auto-deployed smart account). The app never handles keys.
12
- */
13
- interface Identity {
14
- /** Stable, backend-managed user identifier. */
15
- userId: string;
16
- /** Optional metadata (email, provider) for display only. */
17
- email?: string;
18
- provider?: "google" | "apple" | "email" | "otp" | string;
19
- }
20
- /**
21
- * Authenticates a user and returns their stable identity. Implementations:
22
- * - `CavosAuth` (hosted, mirrors `@cavos/react`: Google/Apple/email/OTP via the
23
- * Cavos backend) — the default, Privy-like experience.
24
- * - any custom provider (the app already authenticated the user elsewhere).
25
- */
26
- interface AuthProvider {
27
- authenticate(): Promise<Identity>;
28
- }
29
- /** Trivial provider when the app already has the user's stable id. */
30
- declare class StaticIdentity implements AuthProvider {
31
- private readonly identity;
32
- constructor(identity: Identity);
33
- authenticate(): Promise<Identity>;
34
- }
35
-
36
- /**
37
- * Off-chain map of `user_id -> wallet`. Because the account address is
38
- * `f(identity, first_device_pubkey)` (unforgeable, secure), it is NOT derivable
39
- * from the identity alone on a new device. The backend is the source of truth
40
- * for "does this user already have a wallet?" — enabling multi-device:
41
- *
42
- * - First device, unknown user -> deploy a new wallet, then `register`.
43
- * - Same user, new device -> `lookup` returns the existing wallet; the
44
- * new device is added as a signer (recovery
45
- * approval), NOT a new wallet.
46
- *
47
- * The backend implements this (it already manages the user<->address binding).
48
- */
49
- interface WalletRegistry {
50
- /** The user's existing wallet, or null if they don't have one yet. */
51
- lookup(userId: string): Promise<RegisteredWallet | null>;
52
- /** Record a freshly deployed wallet for the user (first device). */
53
- register(params: {
54
- userId: string;
55
- address: string;
56
- initialSigner: DevicePublicKey;
57
- }): Promise<void>;
58
- /** Note an additional device signer for the user's wallet (after approval). */
59
- addDevice?(params: {
60
- userId: string;
61
- address: string;
62
- signer: DevicePublicKey;
63
- }): Promise<void>;
64
- }
65
- interface RegisteredWallet {
66
- address: string;
67
- /** Public keys of the devices registered on this wallet (if tracked). */
68
- devices?: DevicePublicKey[];
69
- }
70
- /** Simple in-memory registry for demos / tests. */
71
- declare class InMemoryWalletRegistry implements WalletRegistry {
72
- private wallets;
73
- lookup(userId: string): Promise<RegisteredWallet | null>;
74
- register(params: {
75
- userId: string;
76
- address: string;
77
- initialSigner: DevicePublicKey;
78
- }): Promise<void>;
79
- addDevice(params: {
80
- userId: string;
81
- address: string;
82
- signer: DevicePublicKey;
83
- }): Promise<void>;
84
- }
85
-
86
- /**
87
- * Multi-device / recovery flow (roadmap §1.2). A new device requests addition;
88
- * the backend emails an approval prompt styled as a login request; the user
89
- * approves on an ALREADY-registered device, which signs `add_signer` for the
90
- * new pubkey. There is no legacy JWT path — recovery is purely device-signer
91
- * based.
92
- *
93
- * The backend lives outside this repo; this is the client contract the kit
94
- * speaks to. Provide an implementation (HTTP, etc.) when wiring an app.
95
- */
96
- interface RecoveryClient {
97
- /**
98
- * Step 1 (new device): request that this pubkey be added to the user's
99
- * account. Triggers the approval email. Returns a request id to poll.
100
- */
101
- requestDeviceAddition(params: {
102
- userId: string;
103
- accountAddress: string;
104
- newSigner: DevicePublicKey;
105
- /** Owner email to send the approval link to (the SDK has it from login). */
106
- email?: string;
107
- /** Optional device label (browser/UA) shown in the approval email. */
108
- deviceLabel?: string;
109
- }): Promise<{
110
- requestId: string;
111
- }>;
112
- /**
113
- * Step 3-4 (existing device): fetch a pending addition request so the
114
- * registered device can approve it by signing `add_signer`.
115
- */
116
- getPendingRequest(requestId: string): Promise<PendingDeviceRequest | null>;
117
- /** Mark a request approved after the `add_signer` tx is submitted. */
118
- confirmDeviceAddition(params: {
119
- requestId: string;
120
- txHash: string;
121
- }): Promise<void>;
122
- }
123
- interface PendingDeviceRequest {
124
- requestId: string;
125
- appId?: string;
126
- userId: string;
127
- accountAddress: string;
128
- newSigner: DevicePublicKey;
129
- createdAt: string;
130
- status: "pending" | "approved" | "expired";
131
- }
132
-
133
- interface ConnectOptions {
134
- network: StarknetNetwork;
135
- /** Authenticated user (pass `identity` directly, or an `auth` provider). */
136
- auth?: AuthProvider;
137
- identity?: Identity;
138
- appSalt: string;
139
- /**
140
- * Cavos App ID. When set (with `backendUrl`), the kit uses the hosted
141
- * WalletRegistry + RecoveryClient by default for real multi-device support.
142
- */
143
- appId?: string;
144
- /** Cavos backend base URL. Defaults to https://cavos.xyz. */
145
- backendUrl?: string;
146
- /**
147
- * Off-chain user_id -> wallet map. Defaults to the hosted HttpWalletRegistry
148
- * when `appId` is set, else an in-memory registry (single-device only).
149
- */
150
- registry?: WalletRegistry;
151
- /**
152
- * Device-approval relay. Defaults to HttpRecoveryClient when `appId` is set;
153
- * used to request addition of this device when it isn't an authorized signer.
154
- */
155
- recovery?: RecoveryClient;
156
- /** Cavos paymaster API key (sponsors deploy + execute). */
157
- paymasterApiKey: string;
158
- paymasterUrl?: string;
159
- rpcUrl?: string;
160
- classHash?: string;
161
- /** Override the device signer factory (native / tests); default WebCrypto. */
162
- createSigner?: (keyId: string) => Promise<DeviceSigner>;
163
- }
164
- /** Whether this device can already operate the wallet, or needs to be added. */
165
- type ConnectStatus = "ready" | "needs-device-approval";
166
- /** Options for recovering an account after losing every device signer. */
167
- interface RecoveryOptions {
168
- /** The recovery code the user stored when they ran setupRecovery. */
169
- code: string;
170
- /** Authenticated identity (same user who owns the account). */
171
- identity: Identity;
172
- network: StarknetNetwork;
173
- appSalt: string;
174
- paymasterApiKey: string;
175
- appId?: string;
176
- backendUrl?: string;
177
- rpcUrl?: string;
178
- paymasterUrl?: string;
179
- classHash?: string;
180
- /** Off-chain user_id -> wallet map. Defaults to the hosted registry. */
181
- registry?: WalletRegistry;
182
- /** Override the new device's signer (native / tests); default WebCrypto. */
183
- createSigner?: (keyId: string) => Promise<DeviceSigner>;
184
- }
185
- /**
186
- * High-level Cavos wallet. One call logs the user in and returns a ready, gas-
187
- * sponsored smart account controlled by a silent device key.
188
- *
189
- * const cavos = await Cavos.connect({ network, identity, appSalt, registry, paymasterApiKey });
190
- * if (cavos.status === "ready") await cavos.execute(calls);
191
- *
192
- * The account address is `f(identity, device_pubkey)` — unforgeable, so it can't
193
- * be hijacked. The `registry` recognizes returning users across devices: a new
194
- * device on an existing account is flagged `needs-device-approval` (add it via
195
- * an already-registered device) instead of creating a second wallet.
196
- */
197
- declare class Cavos {
198
- readonly identity: Identity;
199
- readonly address: string;
200
- readonly status: ConnectStatus;
201
- readonly account: Account;
202
- private readonly adapter;
203
- private readonly devicePubkey;
204
- /** Request id of the pending device-addition, when status is needs-device-approval. */
205
- pendingRequestId: string | null;
206
- private constructor();
207
- static connect(opts: ConnectOptions): Promise<Cavos>;
208
- /** This device's public key (e.g. to request addition to an existing wallet). */
209
- get publicKey(): DevicePublicKey;
210
- /** Execute a sponsored (gasless) multicall, signed silently by the device. */
211
- execute(calls: ChainCall[]): Promise<{
212
- transactionHash: string;
213
- }>;
214
- /** Authorize an additional device signer (sponsored). Self-submitted. */
215
- addSigner(pubkey: DevicePublicKey): Promise<{
216
- transactionHash: string;
217
- }>;
218
- /**
219
- * Register a self-custodial backup signer derived from `code`, so the account
220
- * can be recovered after the user loses every device. Idempotent: if the
221
- * derived backup key is already an authorised signer, this is a no-op.
222
- *
223
- * The code never leaves the device — only its deterministic public key is
224
- * added on-chain as an ordinary signer. Sponsor this like any other
225
- * add_signer (gasless). Returns the transaction hash (or undefined when the
226
- * backup was already set up).
227
- */
228
- setupRecovery(code: string): Promise<{
229
- transactionHash: string;
230
- } | undefined>;
231
- /**
232
- * Recover an account after losing every device signer. Derives the backup key
233
- * from `code`, uses it (not the new device key) to sign an `add_signer` for
234
- * the new device, and returns a ready Cavos bound to the new device. The
235
- * account address is unchanged.
236
- *
237
- * Self-custodial: only someone holding the code (i.e. the rightful owner) can
238
- * re-derive the backup key. The backend never sees the code.
239
- */
240
- static recover(opts: RecoveryOptions): Promise<Cavos>;
241
- }
1
+ import { A as AuthProvider, I as Identity, W as WalletRegistry, R as RegisteredWallet, D as DevicePublicKey, a as RecoveryClient, P as PendingDeviceRequest, b as DeviceSigner, c as DeviceSignature, C as ChainAdapter, d as ComputeAddressParams, e as ChainCall } from './Cavos-C2KHZxxu.mjs';
2
+ export { f as Cavos, g as CavosSolana, h as CavosWallet, i as Chain, j as ConnectOptions, k as ConnectSolanaOptions, l as ConnectStatus, m as DEVICE_ACCOUNT_PROGRAM_ID, n as InMemoryWalletRegistry, o as InstructionAccount, p as InstructionData, N as NetworkEnv, q as RecoverSolanaOptions, r as RecoveryOptions, S as SECP256R1_PROGRAM_ID, s as SOLANA_NETWORKS, t as SolanaAdapter, u as SolanaAdapterOptions, v as SolanaNetwork, w as SolanaRelayer, x as SolanaRelayerOptions, y as StaticIdentity, z as anchorDiscriminator, B as buildSecp256r1Instruction, E as compressedPubkey, F as encodeLowSSignature, G as serializeInstructions } from './Cavos-C2KHZxxu.mjs';
3
+ import { Signer, ArraySignatureType } from 'starknet';
4
+ import '@solana/web3.js';
242
5
 
243
6
  interface CavosAuthOptions {
244
7
  /** Cavos backend base URL. Defaults to the hosted service (same as @cavos/react). */
@@ -320,6 +83,14 @@ interface IdentityInput {
320
83
  }
321
84
  /** Derive the felt `address_seed` passed to the contract constructor. */
322
85
  declare function deriveAddressSeed({ userId, appSalt }: IdentityInput): bigint;
86
+ /**
87
+ * Solana variant: a 32-byte `address_seed` for the Cavos device-account PDA.
88
+ * Uses the SAME identity input as Starknet (`userId + appSalt`) but hashes with
89
+ * SHA-256 instead of Poseidon, since Solana has no native Poseidon and the PDA
90
+ * seed is raw bytes. The same user therefore maps to a stable, app-scoped
91
+ * address on each chain (different address spaces, one identity).
92
+ */
93
+ declare function deriveAddressSeedSolana({ userId, appSalt }: IdentityInput): Uint8Array;
323
94
 
324
95
  interface HttpWalletRegistryOptions {
325
96
  /** Cavos backend base URL (e.g. https://cavos.xyz). */
@@ -501,6 +272,29 @@ declare class StarknetDeviceSigner extends Signer {
501
272
  protected signRaw(msgHash: string): Promise<ArraySignatureType>;
502
273
  }
503
274
 
275
+ /** Starknet network presets and well-known addresses for the kit. */
276
+ declare const STARKNET_NETWORKS: {
277
+ readonly sepolia: {
278
+ readonly chainId: "0x534e5f5345504f4c4941";
279
+ readonly rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia";
280
+ };
281
+ readonly mainnet: {
282
+ readonly chainId: "0x534e5f4d41494e";
283
+ readonly rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet";
284
+ };
285
+ };
286
+ type StarknetNetwork = keyof typeof STARKNET_NETWORKS;
287
+ /** Universal Deployer Contract (same address on mainnet & sepolia). */
288
+ declare const UDC_ADDRESS = "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf";
289
+ /**
290
+ * DeviceAccount class hash, per network. Populated from
291
+ * `account-contracts/starknet/deployments/<network>.json` after declaring.
292
+ *
293
+ * Both networks were re-declared 2026-06-26 (code changed) to the same class
294
+ * hash, so mainnet and sepolia run identical contract source.
295
+ */
296
+ declare const DEVICE_ACCOUNT_CLASS_HASH: Record<StarknetNetwork, string>;
297
+
504
298
  /**
505
299
  * Serialize a device signature to the felt array for `tx_info.signature`:
506
300
  * [ r_low, r_high, s_low, s_high, y_parity ]
@@ -526,4 +320,4 @@ declare function hexToBytes(hex: string): Uint8Array;
526
320
  /** A felt/bigint -> 32-byte big-endian Uint8Array (the tx-hash width). */
527
321
  declare function bigIntTo32Bytes(value: bigint): Uint8Array;
528
322
 
529
- export { type AuthProvider, BackupSigner, Cavos, CavosAuth, type CavosAuthOptions, ChainAdapter, ChainCall, ComputeAddressParams, type ConnectOptions, type ConnectStatus, DevicePublicKey, DeviceSignature, DeviceSigner, HttpRecoveryClient, type HttpRecoveryClientOptions, HttpWalletRegistry, type HttpWalletRegistryOptions, type Identity, type IdentityInput, InMemoryWalletRegistry, type PendingDeviceRequest, type RecoveryClient, type RecoveryOptions, type RegisteredWallet, StarknetAdapter, type StarknetAdapterOptions, StarknetDeviceSigner, StarknetNetwork, StaticIdentity, type WalletRegistry, WebCryptoSigner, type WebCryptoSignerOptions, bigIntTo32Bytes, bytesToBigInt, bytesToHex, deriveAddressSeed, deriveBackupKey, generateRecoveryCode, hexToBytes, recoverYParity, signatureToFelts, u256ToFelts };
323
+ export { AuthProvider, BackupSigner, CavosAuth, type CavosAuthOptions, ChainAdapter, ChainCall, ComputeAddressParams, DEVICE_ACCOUNT_CLASS_HASH, DevicePublicKey, DeviceSignature, DeviceSigner, HttpRecoveryClient, type HttpRecoveryClientOptions, HttpWalletRegistry, type HttpWalletRegistryOptions, Identity, type IdentityInput, PendingDeviceRequest, RecoveryClient, RegisteredWallet, STARKNET_NETWORKS, StarknetAdapter, type StarknetAdapterOptions, StarknetDeviceSigner, type StarknetNetwork, UDC_ADDRESS, WalletRegistry, WebCryptoSigner, type WebCryptoSignerOptions, bigIntTo32Bytes, bytesToBigInt, bytesToHex, deriveAddressSeed, deriveAddressSeedSolana, deriveBackupKey, generateRecoveryCode, hexToBytes, recoverYParity, signatureToFelts, u256ToFelts };
package/dist/index.d.ts CHANGED
@@ -1,244 +1,7 @@
1
- import { Account, Signer, ArraySignatureType } from 'starknet';
2
- import { D as DevicePublicKey, S as StarknetNetwork, a as DeviceSigner, C as ChainCall, b as DeviceSignature, c as ChainAdapter, d as ComputeAddressParams } from './constants-C530TZFF.js';
3
- export { e as DEVICE_ACCOUNT_CLASS_HASH, f as STARKNET_NETWORKS, U as UDC_ADDRESS } from './constants-C530TZFF.js';
4
-
5
- /**
6
- * Identity for a Cavos wallet. Login (email / social / OTP) only ever produces a
7
- * stable `userId`; that's all the wallet needs to derive its address. Auth never
8
- * touches signing — the device key does that, silently.
9
- *
10
- * Privy-style UX: the user "logs in" and the wallet is provisioned behind the
11
- * scenes (device key + auto-deployed smart account). The app never handles keys.
12
- */
13
- interface Identity {
14
- /** Stable, backend-managed user identifier. */
15
- userId: string;
16
- /** Optional metadata (email, provider) for display only. */
17
- email?: string;
18
- provider?: "google" | "apple" | "email" | "otp" | string;
19
- }
20
- /**
21
- * Authenticates a user and returns their stable identity. Implementations:
22
- * - `CavosAuth` (hosted, mirrors `@cavos/react`: Google/Apple/email/OTP via the
23
- * Cavos backend) — the default, Privy-like experience.
24
- * - any custom provider (the app already authenticated the user elsewhere).
25
- */
26
- interface AuthProvider {
27
- authenticate(): Promise<Identity>;
28
- }
29
- /** Trivial provider when the app already has the user's stable id. */
30
- declare class StaticIdentity implements AuthProvider {
31
- private readonly identity;
32
- constructor(identity: Identity);
33
- authenticate(): Promise<Identity>;
34
- }
35
-
36
- /**
37
- * Off-chain map of `user_id -> wallet`. Because the account address is
38
- * `f(identity, first_device_pubkey)` (unforgeable, secure), it is NOT derivable
39
- * from the identity alone on a new device. The backend is the source of truth
40
- * for "does this user already have a wallet?" — enabling multi-device:
41
- *
42
- * - First device, unknown user -> deploy a new wallet, then `register`.
43
- * - Same user, new device -> `lookup` returns the existing wallet; the
44
- * new device is added as a signer (recovery
45
- * approval), NOT a new wallet.
46
- *
47
- * The backend implements this (it already manages the user<->address binding).
48
- */
49
- interface WalletRegistry {
50
- /** The user's existing wallet, or null if they don't have one yet. */
51
- lookup(userId: string): Promise<RegisteredWallet | null>;
52
- /** Record a freshly deployed wallet for the user (first device). */
53
- register(params: {
54
- userId: string;
55
- address: string;
56
- initialSigner: DevicePublicKey;
57
- }): Promise<void>;
58
- /** Note an additional device signer for the user's wallet (after approval). */
59
- addDevice?(params: {
60
- userId: string;
61
- address: string;
62
- signer: DevicePublicKey;
63
- }): Promise<void>;
64
- }
65
- interface RegisteredWallet {
66
- address: string;
67
- /** Public keys of the devices registered on this wallet (if tracked). */
68
- devices?: DevicePublicKey[];
69
- }
70
- /** Simple in-memory registry for demos / tests. */
71
- declare class InMemoryWalletRegistry implements WalletRegistry {
72
- private wallets;
73
- lookup(userId: string): Promise<RegisteredWallet | null>;
74
- register(params: {
75
- userId: string;
76
- address: string;
77
- initialSigner: DevicePublicKey;
78
- }): Promise<void>;
79
- addDevice(params: {
80
- userId: string;
81
- address: string;
82
- signer: DevicePublicKey;
83
- }): Promise<void>;
84
- }
85
-
86
- /**
87
- * Multi-device / recovery flow (roadmap §1.2). A new device requests addition;
88
- * the backend emails an approval prompt styled as a login request; the user
89
- * approves on an ALREADY-registered device, which signs `add_signer` for the
90
- * new pubkey. There is no legacy JWT path — recovery is purely device-signer
91
- * based.
92
- *
93
- * The backend lives outside this repo; this is the client contract the kit
94
- * speaks to. Provide an implementation (HTTP, etc.) when wiring an app.
95
- */
96
- interface RecoveryClient {
97
- /**
98
- * Step 1 (new device): request that this pubkey be added to the user's
99
- * account. Triggers the approval email. Returns a request id to poll.
100
- */
101
- requestDeviceAddition(params: {
102
- userId: string;
103
- accountAddress: string;
104
- newSigner: DevicePublicKey;
105
- /** Owner email to send the approval link to (the SDK has it from login). */
106
- email?: string;
107
- /** Optional device label (browser/UA) shown in the approval email. */
108
- deviceLabel?: string;
109
- }): Promise<{
110
- requestId: string;
111
- }>;
112
- /**
113
- * Step 3-4 (existing device): fetch a pending addition request so the
114
- * registered device can approve it by signing `add_signer`.
115
- */
116
- getPendingRequest(requestId: string): Promise<PendingDeviceRequest | null>;
117
- /** Mark a request approved after the `add_signer` tx is submitted. */
118
- confirmDeviceAddition(params: {
119
- requestId: string;
120
- txHash: string;
121
- }): Promise<void>;
122
- }
123
- interface PendingDeviceRequest {
124
- requestId: string;
125
- appId?: string;
126
- userId: string;
127
- accountAddress: string;
128
- newSigner: DevicePublicKey;
129
- createdAt: string;
130
- status: "pending" | "approved" | "expired";
131
- }
132
-
133
- interface ConnectOptions {
134
- network: StarknetNetwork;
135
- /** Authenticated user (pass `identity` directly, or an `auth` provider). */
136
- auth?: AuthProvider;
137
- identity?: Identity;
138
- appSalt: string;
139
- /**
140
- * Cavos App ID. When set (with `backendUrl`), the kit uses the hosted
141
- * WalletRegistry + RecoveryClient by default for real multi-device support.
142
- */
143
- appId?: string;
144
- /** Cavos backend base URL. Defaults to https://cavos.xyz. */
145
- backendUrl?: string;
146
- /**
147
- * Off-chain user_id -> wallet map. Defaults to the hosted HttpWalletRegistry
148
- * when `appId` is set, else an in-memory registry (single-device only).
149
- */
150
- registry?: WalletRegistry;
151
- /**
152
- * Device-approval relay. Defaults to HttpRecoveryClient when `appId` is set;
153
- * used to request addition of this device when it isn't an authorized signer.
154
- */
155
- recovery?: RecoveryClient;
156
- /** Cavos paymaster API key (sponsors deploy + execute). */
157
- paymasterApiKey: string;
158
- paymasterUrl?: string;
159
- rpcUrl?: string;
160
- classHash?: string;
161
- /** Override the device signer factory (native / tests); default WebCrypto. */
162
- createSigner?: (keyId: string) => Promise<DeviceSigner>;
163
- }
164
- /** Whether this device can already operate the wallet, or needs to be added. */
165
- type ConnectStatus = "ready" | "needs-device-approval";
166
- /** Options for recovering an account after losing every device signer. */
167
- interface RecoveryOptions {
168
- /** The recovery code the user stored when they ran setupRecovery. */
169
- code: string;
170
- /** Authenticated identity (same user who owns the account). */
171
- identity: Identity;
172
- network: StarknetNetwork;
173
- appSalt: string;
174
- paymasterApiKey: string;
175
- appId?: string;
176
- backendUrl?: string;
177
- rpcUrl?: string;
178
- paymasterUrl?: string;
179
- classHash?: string;
180
- /** Off-chain user_id -> wallet map. Defaults to the hosted registry. */
181
- registry?: WalletRegistry;
182
- /** Override the new device's signer (native / tests); default WebCrypto. */
183
- createSigner?: (keyId: string) => Promise<DeviceSigner>;
184
- }
185
- /**
186
- * High-level Cavos wallet. One call logs the user in and returns a ready, gas-
187
- * sponsored smart account controlled by a silent device key.
188
- *
189
- * const cavos = await Cavos.connect({ network, identity, appSalt, registry, paymasterApiKey });
190
- * if (cavos.status === "ready") await cavos.execute(calls);
191
- *
192
- * The account address is `f(identity, device_pubkey)` — unforgeable, so it can't
193
- * be hijacked. The `registry` recognizes returning users across devices: a new
194
- * device on an existing account is flagged `needs-device-approval` (add it via
195
- * an already-registered device) instead of creating a second wallet.
196
- */
197
- declare class Cavos {
198
- readonly identity: Identity;
199
- readonly address: string;
200
- readonly status: ConnectStatus;
201
- readonly account: Account;
202
- private readonly adapter;
203
- private readonly devicePubkey;
204
- /** Request id of the pending device-addition, when status is needs-device-approval. */
205
- pendingRequestId: string | null;
206
- private constructor();
207
- static connect(opts: ConnectOptions): Promise<Cavos>;
208
- /** This device's public key (e.g. to request addition to an existing wallet). */
209
- get publicKey(): DevicePublicKey;
210
- /** Execute a sponsored (gasless) multicall, signed silently by the device. */
211
- execute(calls: ChainCall[]): Promise<{
212
- transactionHash: string;
213
- }>;
214
- /** Authorize an additional device signer (sponsored). Self-submitted. */
215
- addSigner(pubkey: DevicePublicKey): Promise<{
216
- transactionHash: string;
217
- }>;
218
- /**
219
- * Register a self-custodial backup signer derived from `code`, so the account
220
- * can be recovered after the user loses every device. Idempotent: if the
221
- * derived backup key is already an authorised signer, this is a no-op.
222
- *
223
- * The code never leaves the device — only its deterministic public key is
224
- * added on-chain as an ordinary signer. Sponsor this like any other
225
- * add_signer (gasless). Returns the transaction hash (or undefined when the
226
- * backup was already set up).
227
- */
228
- setupRecovery(code: string): Promise<{
229
- transactionHash: string;
230
- } | undefined>;
231
- /**
232
- * Recover an account after losing every device signer. Derives the backup key
233
- * from `code`, uses it (not the new device key) to sign an `add_signer` for
234
- * the new device, and returns a ready Cavos bound to the new device. The
235
- * account address is unchanged.
236
- *
237
- * Self-custodial: only someone holding the code (i.e. the rightful owner) can
238
- * re-derive the backup key. The backend never sees the code.
239
- */
240
- static recover(opts: RecoveryOptions): Promise<Cavos>;
241
- }
1
+ import { A as AuthProvider, I as Identity, W as WalletRegistry, R as RegisteredWallet, D as DevicePublicKey, a as RecoveryClient, P as PendingDeviceRequest, b as DeviceSigner, c as DeviceSignature, C as ChainAdapter, d as ComputeAddressParams, e as ChainCall } from './Cavos-C2KHZxxu.js';
2
+ export { f as Cavos, g as CavosSolana, h as CavosWallet, i as Chain, j as ConnectOptions, k as ConnectSolanaOptions, l as ConnectStatus, m as DEVICE_ACCOUNT_PROGRAM_ID, n as InMemoryWalletRegistry, o as InstructionAccount, p as InstructionData, N as NetworkEnv, q as RecoverSolanaOptions, r as RecoveryOptions, S as SECP256R1_PROGRAM_ID, s as SOLANA_NETWORKS, t as SolanaAdapter, u as SolanaAdapterOptions, v as SolanaNetwork, w as SolanaRelayer, x as SolanaRelayerOptions, y as StaticIdentity, z as anchorDiscriminator, B as buildSecp256r1Instruction, E as compressedPubkey, F as encodeLowSSignature, G as serializeInstructions } from './Cavos-C2KHZxxu.js';
3
+ import { Signer, ArraySignatureType } from 'starknet';
4
+ import '@solana/web3.js';
242
5
 
243
6
  interface CavosAuthOptions {
244
7
  /** Cavos backend base URL. Defaults to the hosted service (same as @cavos/react). */
@@ -320,6 +83,14 @@ interface IdentityInput {
320
83
  }
321
84
  /** Derive the felt `address_seed` passed to the contract constructor. */
322
85
  declare function deriveAddressSeed({ userId, appSalt }: IdentityInput): bigint;
86
+ /**
87
+ * Solana variant: a 32-byte `address_seed` for the Cavos device-account PDA.
88
+ * Uses the SAME identity input as Starknet (`userId + appSalt`) but hashes with
89
+ * SHA-256 instead of Poseidon, since Solana has no native Poseidon and the PDA
90
+ * seed is raw bytes. The same user therefore maps to a stable, app-scoped
91
+ * address on each chain (different address spaces, one identity).
92
+ */
93
+ declare function deriveAddressSeedSolana({ userId, appSalt }: IdentityInput): Uint8Array;
323
94
 
324
95
  interface HttpWalletRegistryOptions {
325
96
  /** Cavos backend base URL (e.g. https://cavos.xyz). */
@@ -501,6 +272,29 @@ declare class StarknetDeviceSigner extends Signer {
501
272
  protected signRaw(msgHash: string): Promise<ArraySignatureType>;
502
273
  }
503
274
 
275
+ /** Starknet network presets and well-known addresses for the kit. */
276
+ declare const STARKNET_NETWORKS: {
277
+ readonly sepolia: {
278
+ readonly chainId: "0x534e5f5345504f4c4941";
279
+ readonly rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia";
280
+ };
281
+ readonly mainnet: {
282
+ readonly chainId: "0x534e5f4d41494e";
283
+ readonly rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet";
284
+ };
285
+ };
286
+ type StarknetNetwork = keyof typeof STARKNET_NETWORKS;
287
+ /** Universal Deployer Contract (same address on mainnet & sepolia). */
288
+ declare const UDC_ADDRESS = "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf";
289
+ /**
290
+ * DeviceAccount class hash, per network. Populated from
291
+ * `account-contracts/starknet/deployments/<network>.json` after declaring.
292
+ *
293
+ * Both networks were re-declared 2026-06-26 (code changed) to the same class
294
+ * hash, so mainnet and sepolia run identical contract source.
295
+ */
296
+ declare const DEVICE_ACCOUNT_CLASS_HASH: Record<StarknetNetwork, string>;
297
+
504
298
  /**
505
299
  * Serialize a device signature to the felt array for `tx_info.signature`:
506
300
  * [ r_low, r_high, s_low, s_high, y_parity ]
@@ -526,4 +320,4 @@ declare function hexToBytes(hex: string): Uint8Array;
526
320
  /** A felt/bigint -> 32-byte big-endian Uint8Array (the tx-hash width). */
527
321
  declare function bigIntTo32Bytes(value: bigint): Uint8Array;
528
322
 
529
- export { type AuthProvider, BackupSigner, Cavos, CavosAuth, type CavosAuthOptions, ChainAdapter, ChainCall, ComputeAddressParams, type ConnectOptions, type ConnectStatus, DevicePublicKey, DeviceSignature, DeviceSigner, HttpRecoveryClient, type HttpRecoveryClientOptions, HttpWalletRegistry, type HttpWalletRegistryOptions, type Identity, type IdentityInput, InMemoryWalletRegistry, type PendingDeviceRequest, type RecoveryClient, type RecoveryOptions, type RegisteredWallet, StarknetAdapter, type StarknetAdapterOptions, StarknetDeviceSigner, StarknetNetwork, StaticIdentity, type WalletRegistry, WebCryptoSigner, type WebCryptoSignerOptions, bigIntTo32Bytes, bytesToBigInt, bytesToHex, deriveAddressSeed, deriveBackupKey, generateRecoveryCode, hexToBytes, recoverYParity, signatureToFelts, u256ToFelts };
323
+ export { AuthProvider, BackupSigner, CavosAuth, type CavosAuthOptions, ChainAdapter, ChainCall, ComputeAddressParams, DEVICE_ACCOUNT_CLASS_HASH, DevicePublicKey, DeviceSignature, DeviceSigner, HttpRecoveryClient, type HttpRecoveryClientOptions, HttpWalletRegistry, type HttpWalletRegistryOptions, Identity, type IdentityInput, PendingDeviceRequest, RecoveryClient, RegisteredWallet, STARKNET_NETWORKS, StarknetAdapter, type StarknetAdapterOptions, StarknetDeviceSigner, type StarknetNetwork, UDC_ADDRESS, WalletRegistry, WebCryptoSigner, type WebCryptoSignerOptions, bigIntTo32Bytes, bytesToBigInt, bytesToHex, deriveAddressSeed, deriveAddressSeedSolana, deriveBackupKey, generateRecoveryCode, hexToBytes, recoverYParity, signatureToFelts, u256ToFelts };