@privy-io/api-types 0.4.0 → 0.6.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 (142) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/client.d.mts +25 -12
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +25 -12
  5. package/client.d.ts.map +1 -1
  6. package/client.js +32 -5
  7. package/client.js.map +1 -1
  8. package/client.mjs +32 -5
  9. package/client.mjs.map +1 -1
  10. package/internal/parse.d.mts.map +1 -1
  11. package/internal/parse.d.ts.map +1 -1
  12. package/internal/parse.js +5 -0
  13. package/internal/parse.js.map +1 -1
  14. package/internal/parse.mjs +5 -0
  15. package/internal/parse.mjs.map +1 -1
  16. package/internal/tslib.js +17 -17
  17. package/internal/utils/query.d.mts +2 -0
  18. package/internal/utils/query.d.mts.map +1 -0
  19. package/internal/utils/query.d.ts +2 -0
  20. package/internal/utils/query.d.ts.map +1 -0
  21. package/internal/utils/query.js +10 -0
  22. package/internal/utils/query.js.map +1 -0
  23. package/internal/utils/query.mjs +6 -0
  24. package/internal/utils/query.mjs.map +1 -0
  25. package/internal/utils.d.mts +1 -0
  26. package/internal/utils.d.ts +1 -0
  27. package/internal/utils.js +1 -0
  28. package/internal/utils.js.map +1 -1
  29. package/internal/utils.mjs +1 -0
  30. package/package.json +1 -1
  31. package/resources/accounts.d.mts +85 -0
  32. package/resources/accounts.d.mts.map +1 -0
  33. package/resources/accounts.d.ts +85 -0
  34. package/resources/accounts.d.ts.map +1 -0
  35. package/resources/accounts.js +9 -0
  36. package/resources/accounts.js.map +1 -0
  37. package/resources/accounts.mjs +5 -0
  38. package/resources/accounts.mjs.map +1 -0
  39. package/resources/aggregations.d.mts +213 -2
  40. package/resources/aggregations.d.mts.map +1 -1
  41. package/resources/aggregations.d.ts +213 -2
  42. package/resources/aggregations.d.ts.map +1 -1
  43. package/resources/client-auth.d.mts +181 -1
  44. package/resources/client-auth.d.mts.map +1 -1
  45. package/resources/client-auth.d.ts +181 -1
  46. package/resources/client-auth.d.ts.map +1 -1
  47. package/resources/funding.d.mts +4 -4
  48. package/resources/funding.d.mts.map +1 -1
  49. package/resources/funding.d.ts +4 -4
  50. package/resources/funding.d.ts.map +1 -1
  51. package/resources/index.d.mts +9 -5
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +9 -5
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +9 -1
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +4 -0
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/intents.d.mts +104 -0
  60. package/resources/intents.d.mts.map +1 -0
  61. package/resources/intents.d.ts +104 -0
  62. package/resources/intents.d.ts.map +1 -0
  63. package/resources/intents.js +9 -0
  64. package/resources/intents.js.map +1 -0
  65. package/resources/intents.mjs +5 -0
  66. package/resources/intents.mjs.map +1 -0
  67. package/resources/key-quorums.d.mts +14 -0
  68. package/resources/key-quorums.d.mts.map +1 -1
  69. package/resources/key-quorums.d.ts +14 -0
  70. package/resources/key-quorums.d.ts.map +1 -1
  71. package/resources/policies.d.mts +66 -68
  72. package/resources/policies.d.mts.map +1 -1
  73. package/resources/policies.d.ts +66 -68
  74. package/resources/policies.d.ts.map +1 -1
  75. package/resources/users.d.mts +72 -62
  76. package/resources/users.d.mts.map +1 -1
  77. package/resources/users.d.ts +72 -62
  78. package/resources/users.d.ts.map +1 -1
  79. package/resources/wallets/balance.d.mts +10 -5
  80. package/resources/wallets/balance.d.mts.map +1 -1
  81. package/resources/wallets/balance.d.ts +10 -5
  82. package/resources/wallets/balance.d.ts.map +1 -1
  83. package/resources/wallets/balance.js +1 -2
  84. package/resources/wallets/balance.js.map +1 -1
  85. package/resources/wallets/balance.mjs +1 -2
  86. package/resources/wallets/balance.mjs.map +1 -1
  87. package/resources/wallets/index.d.mts +1 -1
  88. package/resources/wallets/index.d.mts.map +1 -1
  89. package/resources/wallets/index.d.ts +1 -1
  90. package/resources/wallets/index.d.ts.map +1 -1
  91. package/resources/wallets/index.js.map +1 -1
  92. package/resources/wallets/index.mjs.map +1 -1
  93. package/resources/wallets/transactions.d.mts +2 -2
  94. package/resources/wallets/transactions.d.mts.map +1 -1
  95. package/resources/wallets/transactions.d.ts +2 -2
  96. package/resources/wallets/transactions.d.ts.map +1 -1
  97. package/resources/wallets/wallets.d.mts +203 -76
  98. package/resources/wallets/wallets.d.mts.map +1 -1
  99. package/resources/wallets/wallets.d.ts +203 -76
  100. package/resources/wallets/wallets.d.ts.map +1 -1
  101. package/resources/wallets/wallets.js.map +1 -1
  102. package/resources/wallets/wallets.mjs.map +1 -1
  103. package/resources/webhooks.d.mts +977 -0
  104. package/resources/webhooks.d.mts.map +1 -0
  105. package/resources/webhooks.d.ts +977 -0
  106. package/resources/webhooks.d.ts.map +1 -0
  107. package/resources/webhooks.js +9 -0
  108. package/resources/webhooks.js.map +1 -0
  109. package/resources/webhooks.mjs +5 -0
  110. package/resources/webhooks.mjs.map +1 -0
  111. package/resources/yield.d.mts +311 -0
  112. package/resources/yield.d.mts.map +1 -0
  113. package/resources/yield.d.ts +311 -0
  114. package/resources/yield.d.ts.map +1 -0
  115. package/resources/yield.js +9 -0
  116. package/resources/yield.js.map +1 -0
  117. package/resources/yield.mjs +5 -0
  118. package/resources/yield.mjs.map +1 -0
  119. package/src/client.ts +240 -18
  120. package/src/internal/parse.ts +6 -0
  121. package/src/internal/utils/query.ts +7 -0
  122. package/src/internal/utils.ts +1 -0
  123. package/src/resources/accounts.ts +106 -0
  124. package/src/resources/aggregations.ts +361 -5
  125. package/src/resources/client-auth.ts +309 -0
  126. package/src/resources/funding.ts +4 -1
  127. package/src/resources/index.ts +101 -8
  128. package/src/resources/intents.ts +138 -0
  129. package/src/resources/key-quorums.ts +17 -0
  130. package/src/resources/policies.ts +86 -88
  131. package/src/resources/users.ts +128 -111
  132. package/src/resources/wallets/balance.ts +15 -5
  133. package/src/resources/wallets/index.ts +7 -3
  134. package/src/resources/wallets/transactions.ts +2 -2
  135. package/src/resources/wallets/wallets.ts +250 -96
  136. package/src/resources/webhooks.ts +1347 -0
  137. package/src/resources/yield.ts +389 -0
  138. package/src/version.ts +1 -1
  139. package/version.d.mts +1 -1
  140. package/version.d.ts +1 -1
  141. package/version.js +1 -1
  142. package/version.mjs +1 -1
@@ -318,112 +318,6 @@ export class Users extends APIResource {
318
318
 
319
319
  export type UsersCursor = Cursor<User>;
320
320
 
321
- /**
322
- * The authenticated user.
323
- */
324
- export interface AuthenticatedUser {
325
- token: string | null;
326
-
327
- privy_access_token: string | null;
328
-
329
- refresh_token: string | null;
330
-
331
- /**
332
- * Instructs the client on how to handle tokens received
333
- */
334
- session_update_action: 'set' | 'ignore' | 'clear';
335
-
336
- /**
337
- * A Privy user object.
338
- */
339
- user: User;
340
-
341
- identity_token?: string;
342
-
343
- is_new_user?: boolean;
344
-
345
- /**
346
- * OAuth tokens associated with the user.
347
- */
348
- oauth_tokens?: OAuthTokens;
349
- }
350
-
351
- /**
352
- * A linked account for the user.
353
- */
354
- export type LinkedAccount =
355
- | LinkedAccountEmail
356
- | LinkedAccountPhone
357
- | LinkedAccountEthereum
358
- | LinkedAccountSolana
359
- | LinkedAccountSmartWallet
360
- | LinkedAccountEthereumEmbeddedWallet
361
- | LinkedAccountSolanaEmbeddedWallet
362
- | LinkedAccountBitcoinSegwitEmbeddedWallet
363
- | LinkedAccountBitcoinTaprootEmbeddedWallet
364
- | LinkedAccountCurveSigningEmbeddedWallet
365
- | LinkedAccountGoogleOAuth
366
- | LinkedAccountTwitterOAuth
367
- | LinkedAccountDiscordOAuth
368
- | LinkedAccountGitHubOAuth
369
- | LinkedAccountSpotifyOAuth
370
- | LinkedAccountInstagramOAuth
371
- | LinkedAccountTiktokOAuth
372
- | LinkedAccountLineOAuth
373
- | LinkedAccountTwitchOAuth
374
- | LinkedAccountLinkedInOAuth
375
- | LinkedAccountAppleOAuth
376
- | LinkedAccountCustomOAuth
377
- | LinkedAccountCustomJwt
378
- | LinkedAccountFarcaster
379
- | LinkedAccountPasskey
380
- | LinkedAccountTelegram
381
- | LinkedAccountCrossApp
382
- | LinkedAccountAuthorizationKey;
383
-
384
- /**
385
- * A Privy user object.
386
- */
387
- export interface User {
388
- id: string;
389
-
390
- /**
391
- * Unix timestamp of when the user was created in milliseconds.
392
- */
393
- created_at: number;
394
-
395
- /**
396
- * Indicates if the user has accepted the terms of service.
397
- */
398
- has_accepted_terms: boolean;
399
-
400
- /**
401
- * Indicates if the user is a guest account user.
402
- */
403
- is_guest: boolean;
404
-
405
- linked_accounts: Array<LinkedAccount>;
406
-
407
- mfa_methods: Array<LinkedMfaMethod>;
408
-
409
- /**
410
- * Custom metadata associated with the user.
411
- */
412
- custom_metadata?: CustomMetadata;
413
- }
414
-
415
- /**
416
- * The user object along their identity token.
417
- */
418
- export interface UserWithIdentityToken {
419
- identity_token: string | null;
420
-
421
- /**
422
- * A Privy user object.
423
- */
424
- user: User;
425
- }
426
-
427
321
  /**
428
322
  * An email account linked to the user.
429
323
  */
@@ -1213,6 +1107,39 @@ export interface LinkedAccountAuthorizationKey {
1213
1107
  verified_at: number;
1214
1108
  }
1215
1109
 
1110
+ /**
1111
+ * A linked account for the user.
1112
+ */
1113
+ export type LinkedAccount =
1114
+ | LinkedAccountEmail
1115
+ | LinkedAccountPhone
1116
+ | LinkedAccountEthereum
1117
+ | LinkedAccountSolana
1118
+ | LinkedAccountSmartWallet
1119
+ | LinkedAccountEthereumEmbeddedWallet
1120
+ | LinkedAccountSolanaEmbeddedWallet
1121
+ | LinkedAccountBitcoinSegwitEmbeddedWallet
1122
+ | LinkedAccountBitcoinTaprootEmbeddedWallet
1123
+ | LinkedAccountCurveSigningEmbeddedWallet
1124
+ | LinkedAccountGoogleOAuth
1125
+ | LinkedAccountTwitterOAuth
1126
+ | LinkedAccountDiscordOAuth
1127
+ | LinkedAccountGitHubOAuth
1128
+ | LinkedAccountSpotifyOAuth
1129
+ | LinkedAccountInstagramOAuth
1130
+ | LinkedAccountTiktokOAuth
1131
+ | LinkedAccountLineOAuth
1132
+ | LinkedAccountTwitchOAuth
1133
+ | LinkedAccountLinkedInOAuth
1134
+ | LinkedAccountAppleOAuth
1135
+ | LinkedAccountCustomOAuth
1136
+ | LinkedAccountCustomJwt
1137
+ | LinkedAccountFarcaster
1138
+ | LinkedAccountPasskey
1139
+ | LinkedAccountTelegram
1140
+ | LinkedAccountCrossApp
1141
+ | LinkedAccountAuthorizationKey;
1142
+
1216
1143
  /**
1217
1144
  * The possible types of linked accounts.
1218
1145
  */
@@ -1466,6 +1393,21 @@ export interface LinkedAccountCustomJwtInput {
1466
1393
  type: 'custom_auth';
1467
1394
  }
1468
1395
 
1396
+ /**
1397
+ * The payload for importing a passkey account.
1398
+ */
1399
+ export interface LinkedAccountPasskeyInput {
1400
+ credential_device_type: 'singleDevice' | 'multiDevice';
1401
+
1402
+ credential_id: string;
1403
+
1404
+ credential_public_key: string;
1405
+
1406
+ credential_username: string;
1407
+
1408
+ type: 'passkey';
1409
+ }
1410
+
1469
1411
  /**
1470
1412
  * The input for adding a linked account to a user.
1471
1413
  */
@@ -1486,7 +1428,8 @@ export type LinkedAccountInput =
1486
1428
  | LinkedAccountLinkedInInput
1487
1429
  | LinkedAccountFarcasterInput
1488
1430
  | LinkedAccountTelegramInput
1489
- | LinkedAccountCustomJwtInput;
1431
+ | LinkedAccountCustomJwtInput
1432
+ | LinkedAccountPasskeyInput;
1490
1433
 
1491
1434
  /**
1492
1435
  * The payload for batch creating users.
@@ -1575,6 +1518,37 @@ export interface PasskeyMfaMethod {
1575
1518
  */
1576
1519
  export type LinkedMfaMethod = SMSMfaMethod | TotpMfaMethod | PasskeyMfaMethod;
1577
1520
 
1521
+ /**
1522
+ * A Privy user object.
1523
+ */
1524
+ export interface User {
1525
+ id: string;
1526
+
1527
+ /**
1528
+ * Unix timestamp of when the user was created in milliseconds.
1529
+ */
1530
+ created_at: number;
1531
+
1532
+ /**
1533
+ * Indicates if the user has accepted the terms of service.
1534
+ */
1535
+ has_accepted_terms: boolean;
1536
+
1537
+ /**
1538
+ * Indicates if the user is a guest account user.
1539
+ */
1540
+ is_guest: boolean;
1541
+
1542
+ linked_accounts: Array<LinkedAccount>;
1543
+
1544
+ mfa_methods: Array<LinkedMfaMethod>;
1545
+
1546
+ /**
1547
+ * Custom metadata associated with the user.
1548
+ */
1549
+ custom_metadata?: CustomMetadata;
1550
+ }
1551
+
1578
1552
  /**
1579
1553
  * OAuth tokens associated with the user.
1580
1554
  */
@@ -1592,6 +1566,48 @@ export interface OAuthTokens {
1592
1566
  scopes?: Array<string>;
1593
1567
  }
1594
1568
 
1569
+ /**
1570
+ * The user object along their identity token.
1571
+ */
1572
+ export interface UserWithIdentityToken {
1573
+ identity_token: string | null;
1574
+
1575
+ /**
1576
+ * A Privy user object.
1577
+ */
1578
+ user: User;
1579
+ }
1580
+
1581
+ /**
1582
+ * The authenticated user.
1583
+ */
1584
+ export interface AuthenticatedUser {
1585
+ token: string | null;
1586
+
1587
+ privy_access_token: string | null;
1588
+
1589
+ refresh_token: string | null;
1590
+
1591
+ /**
1592
+ * Instructs the client on how to handle tokens received
1593
+ */
1594
+ session_update_action: 'set' | 'ignore' | 'clear';
1595
+
1596
+ /**
1597
+ * A Privy user object.
1598
+ */
1599
+ user: User;
1600
+
1601
+ identity_token?: string;
1602
+
1603
+ is_new_user?: boolean;
1604
+
1605
+ /**
1606
+ * OAuth tokens associated with the user.
1607
+ */
1608
+ oauth_tokens?: OAuthTokens;
1609
+ }
1610
+
1595
1611
  export interface UserCreateParams {
1596
1612
  linked_accounts: Array<LinkedAccountInput>;
1597
1613
 
@@ -1761,10 +1777,6 @@ export interface UserUnlinkLinkedAccountParams {
1761
1777
 
1762
1778
  export declare namespace Users {
1763
1779
  export {
1764
- type AuthenticatedUser as AuthenticatedUser,
1765
- type LinkedAccount as LinkedAccount,
1766
- type User as User,
1767
- type UserWithIdentityToken as UserWithIdentityToken,
1768
1780
  type LinkedAccountEmail as LinkedAccountEmail,
1769
1781
  type LinkedAccountPhone as LinkedAccountPhone,
1770
1782
  type LinkedAccountBaseWallet as LinkedAccountBaseWallet,
@@ -1800,6 +1812,7 @@ export declare namespace Users {
1800
1812
  type CrossAppSmartWallet as CrossAppSmartWallet,
1801
1813
  type LinkedAccountCrossApp as LinkedAccountCrossApp,
1802
1814
  type LinkedAccountAuthorizationKey as LinkedAccountAuthorizationKey,
1815
+ type LinkedAccount as LinkedAccount,
1803
1816
  type LinkedAccountType as LinkedAccountType,
1804
1817
  type CustomMetadata as CustomMetadata,
1805
1818
  type LinkedAccountWalletInput as LinkedAccountWalletInput,
@@ -1819,13 +1832,17 @@ export declare namespace Users {
1819
1832
  type LinkedAccountFarcasterInput as LinkedAccountFarcasterInput,
1820
1833
  type LinkedAccountTelegramInput as LinkedAccountTelegramInput,
1821
1834
  type LinkedAccountCustomJwtInput as LinkedAccountCustomJwtInput,
1835
+ type LinkedAccountPasskeyInput as LinkedAccountPasskeyInput,
1822
1836
  type LinkedAccountInput as LinkedAccountInput,
1823
1837
  type UserBatchCreateInput as UserBatchCreateInput,
1824
1838
  type SMSMfaMethod as SMSMfaMethod,
1825
1839
  type TotpMfaMethod as TotpMfaMethod,
1826
1840
  type PasskeyMfaMethod as PasskeyMfaMethod,
1827
1841
  type LinkedMfaMethod as LinkedMfaMethod,
1842
+ type User as User,
1828
1843
  type OAuthTokens as OAuthTokens,
1844
+ type UserWithIdentityToken as UserWithIdentityToken,
1845
+ type AuthenticatedUser as AuthenticatedUser,
1829
1846
  type UsersCursor as UsersCursor,
1830
1847
  type UserCreateParams as UserCreateParams,
1831
1848
  type UserListParams as UserListParams,
@@ -13,11 +13,14 @@ export class Balance extends APIResource {
13
13
  * ```ts
14
14
  * const balance = await client.wallets.balance.get(
15
15
  * 'wallet_id',
16
- * { asset: 'usdc', chain: 'ethereum' },
17
16
  * );
18
17
  * ```
19
18
  */
20
- get(walletID: string, query: BalanceGetParams, options?: RequestOptions): APIPromise<BalanceGetResponse> {
19
+ get(
20
+ walletID: string,
21
+ query: BalanceGetParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): APIPromise<BalanceGetResponse> {
21
24
  return this._client.get(path`/v1/wallets/${walletID}/balance`, { query, ...options });
22
25
  }
23
26
  }
@@ -28,7 +31,7 @@ export interface BalanceGetResponse {
28
31
 
29
32
  export namespace BalanceGetResponse {
30
33
  export interface Balance {
31
- asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol';
34
+ asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol' | (string & {});
32
35
 
33
36
  chain:
34
37
  | 'ethereum'
@@ -57,7 +60,14 @@ export namespace BalanceGetResponse {
57
60
  }
58
61
 
59
62
  export interface BalanceGetParams {
60
- asset:
63
+ /**
64
+ * The token contract address(es) to query in format "chain:address" (e.g.,
65
+ * "base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" or
66
+ * "solana:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v").
67
+ */
68
+ token?: string | Array<string>;
69
+
70
+ asset?:
61
71
  | 'usdc'
62
72
  | 'eth'
63
73
  | 'pol'
@@ -67,7 +77,7 @@ export interface BalanceGetParams {
67
77
  | 'sol'
68
78
  | Array<'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol'>;
69
79
 
70
- chain:
80
+ chain?:
71
81
  | 'ethereum'
72
82
  | 'arbitrum'
73
83
  | 'base'
@@ -4,12 +4,11 @@ export { Balance, type BalanceGetResponse, type BalanceGetParams } from './balan
4
4
  export { Transactions, type TransactionGetResponse, type TransactionGetParams } from './transactions';
5
5
  export {
6
6
  Wallets,
7
+ type WalletRevokeResponse,
7
8
  type CurveSigningChainType,
9
+ type ExtendedChainType,
8
10
  type FirstClassChainType,
9
- type Wallet,
10
11
  type WalletChainType,
11
- type WalletRevokeResponse,
12
- type ExtendedChainType,
13
12
  type WalletCustodian,
14
13
  type CustodialWalletProvider,
15
14
  type CustodialWalletChainType,
@@ -17,6 +16,11 @@ export {
17
16
  type CustodialWallet,
18
17
  type HpkeImportConfig,
19
18
  type SuiCommandName,
19
+ type Wallet,
20
+ type WalletBatchItemInput,
21
+ type WalletBatchCreateInput,
22
+ type WalletBatchCreateResult,
23
+ type WalletBatchCreateResponse,
20
24
  type EthereumPersonalSignRpcInput,
21
25
  type EthereumSignTransactionRpcInput,
22
26
  type EthereumSendTransactionRpcInput,
@@ -61,7 +61,7 @@ export namespace TransactionGetResponse {
61
61
 
62
62
  export namespace Transaction {
63
63
  export interface UnionMember0 {
64
- asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol';
64
+ asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol' | (string & {});
65
65
 
66
66
  chain:
67
67
  | 'ethereum'
@@ -99,7 +99,7 @@ export namespace TransactionGetResponse {
99
99
  }
100
100
 
101
101
  export interface UnionMember1 {
102
- asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol';
102
+ asset: 'usdc' | 'eth' | 'pol' | 'usdt' | 'eurc' | 'usdb' | 'sol' | (string & {});
103
103
 
104
104
  chain:
105
105
  | 'ethereum'