@chipi-stack/types 11.21.0 → 12.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.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TypedData, Call } from 'starknet';
2
+ export { Call } from 'starknet';
2
3
 
3
4
  /**
4
5
  * Core configuration and environment types
@@ -38,21 +39,39 @@ declare const STARKNET_CONTRACTS: Record<ChainToken, {
38
39
  /**
39
40
  * Wallet-related types
40
41
  */
42
+ /**
43
+ * Supported wallet types
44
+ * - CHIPI: OpenZeppelin account with SNIP-9 session keys support (default)
45
+ * - READY: Argent X Account v0.4.0
46
+ */
47
+ type WalletType = "CHIPI" | "READY";
41
48
  interface WalletData {
42
49
  publicKey: string;
43
50
  encryptedPrivateKey: string;
51
+ walletType?: WalletType;
52
+ normalizedPublicKey?: string;
53
+ }
54
+ interface DeploymentData {
55
+ class_hash: string;
56
+ salt: string;
57
+ unique: string;
58
+ calldata: string[];
44
59
  }
45
60
  interface CreateWalletParams {
46
61
  encryptKey: string;
47
62
  externalUserId: string;
48
63
  userId?: string;
64
+ /**
65
+ * The type of wallet to create.
66
+ * - "CHIPI" (default): OpenZeppelin account with SNIP-9 session keys support
67
+ * - "ARGENT": Argent X Account v0.4.0
68
+ */
69
+ walletType?: WalletType;
49
70
  }
50
71
  interface CreateWalletResponse {
51
72
  txHash: string;
52
73
  walletPublicKey: string;
53
- wallet: WalletData & {
54
- normalizedPublicKey: string;
55
- };
74
+ wallet: WalletData;
56
75
  }
57
76
  interface GetWalletParams {
58
77
  externalUserId: string;
@@ -74,9 +93,7 @@ interface GetWalletResponse {
74
93
  id: string;
75
94
  userId?: string;
76
95
  orgId?: string;
77
- publicKey: string;
78
- encryptedPrivateKey: string;
79
- normalizedPublicKey: string;
96
+ wallet: WalletData;
80
97
  externalUserId?: string;
81
98
  createdAt?: string;
82
99
  updatedAt?: string;
@@ -374,4 +391,143 @@ interface GetUserParams {
374
391
  includeStarknetWallet?: boolean;
375
392
  }
376
393
 
377
- export { type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type CallAnyContractParams, type Chain, type ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSkuTransactionParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, type DeepPartial, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type GetMerchantWalletParams, type GetSkuListQuery, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type NonEmptyArray, type Optional, type PaginatedResponse, type PaginationQuery, type PrepareTypedDataParams, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type Prettify, type RecordSendTransactionParams, type RequireAtLeastOne, STARKNET_CONTRACTS, type Sku, type SkuCategory, type SkuTransaction, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type Transaction, type TransferHookInput, type TransferParams, type User, type ValueOrFunction, type WalletData, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type alphaUrl };
394
+ /**
395
+ * Session key types for CHIPI wallets (SNIP-9 compatible)
396
+ *
397
+ * Session keys enable temporary, delegated access to execute transactions
398
+ * without requiring the owner's private key for each operation.
399
+ *
400
+ * @see https://github.com/chipi-pay/sessions-smart-contract
401
+ */
402
+ /**
403
+ * Session key data returned to developer for self-custodial storage.
404
+ * The SDK generates this data but does NOT store it - developers must
405
+ * persist it externally (e.g., in Clerk metadata, database, etc.)
406
+ */
407
+ interface SessionKeyData {
408
+ /** Stark public key (hex format, e.g., "0x...") */
409
+ publicKey: string;
410
+ /** AES encrypted private key - encrypt with user's encryptKey */
411
+ encryptedPrivateKey: string;
412
+ /** Unix timestamp (seconds) when this session expires */
413
+ validUntil: number;
414
+ }
415
+ /**
416
+ * Full session configuration for on-chain registration.
417
+ * Used when calling add_or_update_session_key on the contract.
418
+ */
419
+ interface SessionConfig {
420
+ /** Stark public key of the session (hex format) */
421
+ sessionPublicKey: string;
422
+ /** Unix timestamp (seconds) - u64 on-chain */
423
+ validUntil: number;
424
+ /** Maximum number of transactions allowed - u32 on-chain */
425
+ maxCalls: number;
426
+ /**
427
+ * Whitelisted function selectors (hex format).
428
+ * Empty array = all entrypoints allowed.
429
+ * Non-empty = only these selectors can be called with this session.
430
+ */
431
+ allowedEntrypoints: string[];
432
+ }
433
+ /**
434
+ * Parameters for creating a session keypair locally.
435
+ * This only generates keys - does NOT register on-chain.
436
+ */
437
+ interface CreateSessionKeyParams {
438
+ /** Encryption key to encrypt the session private key */
439
+ encryptKey: string;
440
+ /**
441
+ * Session duration in seconds.
442
+ * @default 21600 (6 hours)
443
+ */
444
+ durationSeconds?: number;
445
+ }
446
+ /**
447
+ * Parameters for registering a session key on the smart contract.
448
+ * Requires owner signature (uses owner's encrypted private key).
449
+ *
450
+ * NOTE: walletType is intentionally optional for backward compatibility.
451
+ * Legacy wallets from getWallet() may not have walletType set (defaults to ARGENT).
452
+ * Runtime validation in ChipiSessions ensures only CHIPI wallets are used.
453
+ * Making walletType required here would be a breaking change for existing users.
454
+ * @see ChipiSessions.validateChipiWallet() for runtime validation.
455
+ */
456
+ interface AddSessionKeyParams {
457
+ /** Encryption key to decrypt the owner's private key for signing */
458
+ encryptKey: string;
459
+ /** Wallet data including encrypted owner private key */
460
+ wallet: WalletData & {
461
+ walletType?: WalletType;
462
+ };
463
+ /** Session configuration to register on-chain */
464
+ sessionConfig: SessionConfig;
465
+ }
466
+ /**
467
+ * Parameters for executing a transaction using a session key.
468
+ * Uses session signature (4-element format) instead of owner signature.
469
+ *
470
+ * NOTE: walletType is intentionally optional for backward compatibility.
471
+ * @see AddSessionKeyParams for detailed reasoning.
472
+ */
473
+ interface ExecuteWithSessionParams {
474
+ /** Encryption key to decrypt the session private key */
475
+ encryptKey: string;
476
+ /** Wallet data (session executes on behalf of this wallet) */
477
+ wallet: WalletData & {
478
+ walletType?: WalletType;
479
+ };
480
+ /** Session key data (must be registered on-chain first) */
481
+ session: SessionKeyData;
482
+ /** Calls to execute */
483
+ calls: Call[];
484
+ }
485
+ /**
486
+ * Parameters for revoking a session key from the smart contract.
487
+ * Requires owner signature.
488
+ *
489
+ * NOTE: walletType is intentionally optional for backward compatibility.
490
+ * @see AddSessionKeyParams for detailed reasoning.
491
+ */
492
+ interface RevokeSessionKeyParams {
493
+ /** Encryption key to decrypt the owner's private key for signing */
494
+ encryptKey: string;
495
+ /** Wallet data including encrypted owner private key */
496
+ wallet: WalletData & {
497
+ walletType?: WalletType;
498
+ };
499
+ /** Public key of the session to revoke */
500
+ sessionPublicKey: string;
501
+ }
502
+ /**
503
+ * Parameters for querying session data from the contract.
504
+ */
505
+ interface GetSessionDataParams {
506
+ /** Wallet address to query */
507
+ walletAddress: string;
508
+ /** Session public key to query */
509
+ sessionPublicKey: string;
510
+ }
511
+ /**
512
+ * Response from get_session_data contract call.
513
+ * Represents the on-chain state of a session key.
514
+ */
515
+ interface SessionDataResponse {
516
+ /** Whether the session is currently active (not revoked, not expired) */
517
+ isActive: boolean;
518
+ /** Unix timestamp when the session expires */
519
+ validUntil: number;
520
+ /** Number of calls remaining (decrements with each use) */
521
+ remainingCalls: number;
522
+ /** Whitelisted selectors (empty = all allowed) */
523
+ allowedEntrypoints: string[];
524
+ }
525
+ /**
526
+ * Extended wallet data with required walletType for session operations.
527
+ * Session keys only work with CHIPI wallets.
528
+ */
529
+ interface SessionWalletData extends WalletData {
530
+ walletType: WalletType;
531
+ }
532
+
533
+ export { type AddSessionKeyParams, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type CallAnyContractParams, type Chain, type ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuTransactionParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type NonEmptyArray, type Optional, type PaginatedResponse, type PaginationQuery, type PrepareTypedDataParams, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type Prettify, type RecordSendTransactionParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionWalletData, type Sku, type SkuCategory, type SkuTransaction, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type Transaction, type TransferHookInput, type TransferParams, type User, type ValueOrFunction, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type alphaUrl };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TypedData, Call } from 'starknet';
2
+ export { Call } from 'starknet';
2
3
 
3
4
  /**
4
5
  * Core configuration and environment types
@@ -38,21 +39,39 @@ declare const STARKNET_CONTRACTS: Record<ChainToken, {
38
39
  /**
39
40
  * Wallet-related types
40
41
  */
42
+ /**
43
+ * Supported wallet types
44
+ * - CHIPI: OpenZeppelin account with SNIP-9 session keys support (default)
45
+ * - READY: Argent X Account v0.4.0
46
+ */
47
+ type WalletType = "CHIPI" | "READY";
41
48
  interface WalletData {
42
49
  publicKey: string;
43
50
  encryptedPrivateKey: string;
51
+ walletType?: WalletType;
52
+ normalizedPublicKey?: string;
53
+ }
54
+ interface DeploymentData {
55
+ class_hash: string;
56
+ salt: string;
57
+ unique: string;
58
+ calldata: string[];
44
59
  }
45
60
  interface CreateWalletParams {
46
61
  encryptKey: string;
47
62
  externalUserId: string;
48
63
  userId?: string;
64
+ /**
65
+ * The type of wallet to create.
66
+ * - "CHIPI" (default): OpenZeppelin account with SNIP-9 session keys support
67
+ * - "ARGENT": Argent X Account v0.4.0
68
+ */
69
+ walletType?: WalletType;
49
70
  }
50
71
  interface CreateWalletResponse {
51
72
  txHash: string;
52
73
  walletPublicKey: string;
53
- wallet: WalletData & {
54
- normalizedPublicKey: string;
55
- };
74
+ wallet: WalletData;
56
75
  }
57
76
  interface GetWalletParams {
58
77
  externalUserId: string;
@@ -74,9 +93,7 @@ interface GetWalletResponse {
74
93
  id: string;
75
94
  userId?: string;
76
95
  orgId?: string;
77
- publicKey: string;
78
- encryptedPrivateKey: string;
79
- normalizedPublicKey: string;
96
+ wallet: WalletData;
80
97
  externalUserId?: string;
81
98
  createdAt?: string;
82
99
  updatedAt?: string;
@@ -374,4 +391,143 @@ interface GetUserParams {
374
391
  includeStarknetWallet?: boolean;
375
392
  }
376
393
 
377
- export { type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type CallAnyContractParams, type Chain, type ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSkuTransactionParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, type DeepPartial, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type GetMerchantWalletParams, type GetSkuListQuery, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type NonEmptyArray, type Optional, type PaginatedResponse, type PaginationQuery, type PrepareTypedDataParams, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type Prettify, type RecordSendTransactionParams, type RequireAtLeastOne, STARKNET_CONTRACTS, type Sku, type SkuCategory, type SkuTransaction, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type Transaction, type TransferHookInput, type TransferParams, type User, type ValueOrFunction, type WalletData, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type alphaUrl };
394
+ /**
395
+ * Session key types for CHIPI wallets (SNIP-9 compatible)
396
+ *
397
+ * Session keys enable temporary, delegated access to execute transactions
398
+ * without requiring the owner's private key for each operation.
399
+ *
400
+ * @see https://github.com/chipi-pay/sessions-smart-contract
401
+ */
402
+ /**
403
+ * Session key data returned to developer for self-custodial storage.
404
+ * The SDK generates this data but does NOT store it - developers must
405
+ * persist it externally (e.g., in Clerk metadata, database, etc.)
406
+ */
407
+ interface SessionKeyData {
408
+ /** Stark public key (hex format, e.g., "0x...") */
409
+ publicKey: string;
410
+ /** AES encrypted private key - encrypt with user's encryptKey */
411
+ encryptedPrivateKey: string;
412
+ /** Unix timestamp (seconds) when this session expires */
413
+ validUntil: number;
414
+ }
415
+ /**
416
+ * Full session configuration for on-chain registration.
417
+ * Used when calling add_or_update_session_key on the contract.
418
+ */
419
+ interface SessionConfig {
420
+ /** Stark public key of the session (hex format) */
421
+ sessionPublicKey: string;
422
+ /** Unix timestamp (seconds) - u64 on-chain */
423
+ validUntil: number;
424
+ /** Maximum number of transactions allowed - u32 on-chain */
425
+ maxCalls: number;
426
+ /**
427
+ * Whitelisted function selectors (hex format).
428
+ * Empty array = all entrypoints allowed.
429
+ * Non-empty = only these selectors can be called with this session.
430
+ */
431
+ allowedEntrypoints: string[];
432
+ }
433
+ /**
434
+ * Parameters for creating a session keypair locally.
435
+ * This only generates keys - does NOT register on-chain.
436
+ */
437
+ interface CreateSessionKeyParams {
438
+ /** Encryption key to encrypt the session private key */
439
+ encryptKey: string;
440
+ /**
441
+ * Session duration in seconds.
442
+ * @default 21600 (6 hours)
443
+ */
444
+ durationSeconds?: number;
445
+ }
446
+ /**
447
+ * Parameters for registering a session key on the smart contract.
448
+ * Requires owner signature (uses owner's encrypted private key).
449
+ *
450
+ * NOTE: walletType is intentionally optional for backward compatibility.
451
+ * Legacy wallets from getWallet() may not have walletType set (defaults to ARGENT).
452
+ * Runtime validation in ChipiSessions ensures only CHIPI wallets are used.
453
+ * Making walletType required here would be a breaking change for existing users.
454
+ * @see ChipiSessions.validateChipiWallet() for runtime validation.
455
+ */
456
+ interface AddSessionKeyParams {
457
+ /** Encryption key to decrypt the owner's private key for signing */
458
+ encryptKey: string;
459
+ /** Wallet data including encrypted owner private key */
460
+ wallet: WalletData & {
461
+ walletType?: WalletType;
462
+ };
463
+ /** Session configuration to register on-chain */
464
+ sessionConfig: SessionConfig;
465
+ }
466
+ /**
467
+ * Parameters for executing a transaction using a session key.
468
+ * Uses session signature (4-element format) instead of owner signature.
469
+ *
470
+ * NOTE: walletType is intentionally optional for backward compatibility.
471
+ * @see AddSessionKeyParams for detailed reasoning.
472
+ */
473
+ interface ExecuteWithSessionParams {
474
+ /** Encryption key to decrypt the session private key */
475
+ encryptKey: string;
476
+ /** Wallet data (session executes on behalf of this wallet) */
477
+ wallet: WalletData & {
478
+ walletType?: WalletType;
479
+ };
480
+ /** Session key data (must be registered on-chain first) */
481
+ session: SessionKeyData;
482
+ /** Calls to execute */
483
+ calls: Call[];
484
+ }
485
+ /**
486
+ * Parameters for revoking a session key from the smart contract.
487
+ * Requires owner signature.
488
+ *
489
+ * NOTE: walletType is intentionally optional for backward compatibility.
490
+ * @see AddSessionKeyParams for detailed reasoning.
491
+ */
492
+ interface RevokeSessionKeyParams {
493
+ /** Encryption key to decrypt the owner's private key for signing */
494
+ encryptKey: string;
495
+ /** Wallet data including encrypted owner private key */
496
+ wallet: WalletData & {
497
+ walletType?: WalletType;
498
+ };
499
+ /** Public key of the session to revoke */
500
+ sessionPublicKey: string;
501
+ }
502
+ /**
503
+ * Parameters for querying session data from the contract.
504
+ */
505
+ interface GetSessionDataParams {
506
+ /** Wallet address to query */
507
+ walletAddress: string;
508
+ /** Session public key to query */
509
+ sessionPublicKey: string;
510
+ }
511
+ /**
512
+ * Response from get_session_data contract call.
513
+ * Represents the on-chain state of a session key.
514
+ */
515
+ interface SessionDataResponse {
516
+ /** Whether the session is currently active (not revoked, not expired) */
517
+ isActive: boolean;
518
+ /** Unix timestamp when the session expires */
519
+ validUntil: number;
520
+ /** Number of calls remaining (decrements with each use) */
521
+ remainingCalls: number;
522
+ /** Whitelisted selectors (empty = all allowed) */
523
+ allowedEntrypoints: string[];
524
+ }
525
+ /**
526
+ * Extended wallet data with required walletType for session operations.
527
+ * Session keys only work with CHIPI wallets.
528
+ */
529
+ interface SessionWalletData extends WalletData {
530
+ walletType: WalletType;
531
+ }
532
+
533
+ export { type AddSessionKeyParams, type ApiError, type ApiKey, type ApiResponse, type ApproveHookInput, type ApproveParams, type AsyncReturnType, type AuthContext, type CallAnyContractParams, type Chain, type ChainToken, type ChipiBrowserSDKConfig, type ChipiSDKConfig, type ChipiServerSDKConfig, type Country, type CreateCustodialWalletParams, type CreateSessionKeyParams, type CreateSkuTransactionParams, type CreateUserParams, type CreateWalletParams, type CreateWalletResponse, type DeepPartial, type DeploymentData, type ErrorWithCode, type ExecuteSponsoredTransactionParams, type ExecuteSponsoredTransactionResponse, type ExecuteTransactionParams, type ExecuteWithSessionParams, type GetMerchantWalletParams, type GetSessionDataParams, type GetSkuListQuery, type GetTokenBalanceParams, type GetTokenBalanceResponse, type GetTransactionListQuery, type GetTransactionsParams, type GetUserParams, type GetWalletParams, type GetWalletResponse, type JwtPayload, type MaybePromise, type NonEmptyArray, type Optional, type PaginatedResponse, type PaginationQuery, type PrepareTypedDataParams, type PrepareWalletCreationParams, type PrepareWalletCreationResponse, type Prettify, type RecordSendTransactionParams, type RequireAtLeastOne, type RevokeSessionKeyParams, STARKNET_CONTRACTS, type SessionConfig, type SessionDataResponse, type SessionKeyData, type SessionWalletData, type Sku, type SkuCategory, type SkuTransaction, type StakeVesuUsdcHookInputParams, type StakeVesuUsdcParams, type Transaction, type TransferHookInput, type TransferParams, type User, type ValueOrFunction, type WalletData, type WalletType, type WithdrawVesuUsdcHookInputParams, type WithdrawVesuUsdcParams, type alphaUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipi-stack/types",
3
- "version": "11.21.0",
3
+ "version": "12.0.0",
4
4
  "description": "Type definitions for Chipi SDK packages",
5
5
  "keywords": [
6
6
  "chipi",