@privy-io/api-types 0.10.0 → 0.11.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 (103) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +18 -24
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +18 -24
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -12
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -12
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/client-auth.d.mts +496 -514
  12. package/resources/client-auth.d.mts.map +1 -1
  13. package/resources/client-auth.d.ts +496 -514
  14. package/resources/client-auth.d.ts.map +1 -1
  15. package/resources/client-auth.js.map +1 -1
  16. package/resources/client-auth.mjs.map +1 -1
  17. package/resources/embedded-wallets.d.mts +9 -9
  18. package/resources/embedded-wallets.d.mts.map +1 -1
  19. package/resources/embedded-wallets.d.ts +9 -9
  20. package/resources/embedded-wallets.d.ts.map +1 -1
  21. package/resources/fiat.d.mts +110 -0
  22. package/resources/fiat.d.mts.map +1 -0
  23. package/resources/fiat.d.ts +110 -0
  24. package/resources/fiat.d.ts.map +1 -0
  25. package/resources/fiat.js +9 -0
  26. package/resources/fiat.js.map +1 -0
  27. package/resources/fiat.mjs +5 -0
  28. package/resources/fiat.mjs.map +1 -0
  29. package/resources/funding.d.mts +46 -46
  30. package/resources/funding.d.mts.map +1 -1
  31. package/resources/funding.d.ts +46 -46
  32. package/resources/funding.d.ts.map +1 -1
  33. package/resources/index.d.mts +9 -8
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +9 -8
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +3 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +1 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/key-quorums.d.mts +1 -132
  42. package/resources/key-quorums.d.mts.map +1 -1
  43. package/resources/key-quorums.d.ts +1 -132
  44. package/resources/key-quorums.d.ts.map +1 -1
  45. package/resources/key-quorums.js +0 -92
  46. package/resources/key-quorums.js.map +1 -1
  47. package/resources/key-quorums.mjs +0 -92
  48. package/resources/key-quorums.mjs.map +1 -1
  49. package/resources/policies.d.mts +1 -311
  50. package/resources/policies.d.mts.map +1 -1
  51. package/resources/policies.d.ts +1 -311
  52. package/resources/policies.d.ts.map +1 -1
  53. package/resources/policies.js +0 -229
  54. package/resources/policies.js.map +1 -1
  55. package/resources/policies.mjs +0 -229
  56. package/resources/policies.mjs.map +1 -1
  57. package/resources/transactions.d.mts +28 -44
  58. package/resources/transactions.d.mts.map +1 -1
  59. package/resources/transactions.d.ts +28 -44
  60. package/resources/transactions.d.ts.map +1 -1
  61. package/resources/transactions.js +0 -17
  62. package/resources/transactions.js.map +1 -1
  63. package/resources/transactions.mjs +0 -17
  64. package/resources/transactions.mjs.map +1 -1
  65. package/resources/users.d.mts +1 -345
  66. package/resources/users.d.mts.map +1 -1
  67. package/resources/users.d.ts +1 -345
  68. package/resources/users.d.ts.map +1 -1
  69. package/resources/users.js +0 -272
  70. package/resources/users.js.map +1 -1
  71. package/resources/users.mjs +0 -272
  72. package/resources/users.mjs.map +1 -1
  73. package/resources/wallets/index.d.mts +1 -1
  74. package/resources/wallets/index.d.mts.map +1 -1
  75. package/resources/wallets/index.d.ts +1 -1
  76. package/resources/wallets/index.d.ts.map +1 -1
  77. package/resources/wallets/index.js.map +1 -1
  78. package/resources/wallets/index.mjs.map +1 -1
  79. package/resources/wallets/wallets.d.mts +130 -315
  80. package/resources/wallets/wallets.d.mts.map +1 -1
  81. package/resources/wallets/wallets.d.ts +130 -315
  82. package/resources/wallets/wallets.d.ts.map +1 -1
  83. package/resources/wallets/wallets.js +41 -102
  84. package/resources/wallets/wallets.js.map +1 -1
  85. package/resources/wallets/wallets.mjs +41 -102
  86. package/resources/wallets/wallets.mjs.map +1 -1
  87. package/src/client.ts +106 -152
  88. package/src/resources/client-auth.ts +743 -787
  89. package/src/resources/embedded-wallets.ts +14 -14
  90. package/src/resources/fiat.ts +177 -0
  91. package/src/resources/funding.ts +65 -65
  92. package/src/resources/index.ts +86 -106
  93. package/src/resources/key-quorums.ts +1 -203
  94. package/src/resources/policies.ts +1 -493
  95. package/src/resources/transactions.ts +35 -55
  96. package/src/resources/users.ts +1 -479
  97. package/src/resources/wallets/index.ts +4 -9
  98. package/src/resources/wallets/wallets.ts +182 -423
  99. package/src/version.ts +1 -1
  100. package/version.d.mts +1 -1
  101. package/version.d.ts +1 -1
  102. package/version.js +1 -1
  103. package/version.mjs +1 -1
@@ -4,324 +4,9 @@ import { APIResource } from '../core/resource';
4
4
  import * as UsersAPI from './users';
5
5
  import * as ClientAuthAPI from './client-auth';
6
6
  import * as EmbeddedWalletsAPI from './embedded-wallets';
7
- import * as SharedAPI from './shared';
8
7
  import * as WalletsAPI from './wallets/wallets';
9
- import { APIPromise } from '../core/api-promise';
10
- import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
11
- import { buildHeaders } from '../internal/headers';
12
- import { RequestOptions } from '../internal/request-options';
13
- import { path } from '../internal/utils/path';
14
8
 
15
- /**
16
- * Operations related to users
17
- */
18
- export class Users extends APIResource {
19
- /**
20
- * Create a new user with linked accounts. Optionally pre-generate embedded wallets
21
- * for the user.
22
- *
23
- * @example
24
- * ```ts
25
- * const user = await client.users.create({
26
- * linked_accounts: [
27
- * { address: 'tom.bombadill@privy.io', type: 'email' },
28
- * ],
29
- * });
30
- * ```
31
- */
32
- create(body: UserCreateParams, options?: RequestOptions): APIPromise<User> {
33
- return this._client.post('/v1/users', { body, ...options });
34
- }
35
-
36
- /**
37
- * Get all users in your app.
38
- *
39
- * @example
40
- * ```ts
41
- * // Automatically fetches more pages as needed.
42
- * for await (const user of client.users.list()) {
43
- * // ...
44
- * }
45
- * ```
46
- */
47
- list(
48
- query: UserListParams | null | undefined = {},
49
- options?: RequestOptions,
50
- ): PagePromise<UsersCursor, User> {
51
- return this._client.getAPIList('/v1/users', Cursor<User>, { query, ...options });
52
- }
53
-
54
- /**
55
- * Delete a user by user ID.
56
- *
57
- * @example
58
- * ```ts
59
- * await client.users.delete('user_id');
60
- * ```
61
- */
62
- delete(userID: string, options?: RequestOptions): APIPromise<void> {
63
- return this._client.delete(path`/v1/users/${userID}`, {
64
- ...options,
65
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
66
- });
67
- }
68
-
69
- /**
70
- * Get a user by user ID.
71
- *
72
- * @example
73
- * ```ts
74
- * const user = await client.users._get('user_id');
75
- * ```
76
- */
77
- _get(userID: string, options?: RequestOptions): APIPromise<User> {
78
- return this._client.get(path`/v1/users/${userID}`, options);
79
- }
80
-
81
- /**
82
- * Looks up a user by their custom auth ID.
83
- *
84
- * @example
85
- * ```ts
86
- * const user = await client.users.getByCustomAuthID({
87
- * custom_user_id: 'custom_user_id',
88
- * });
89
- * ```
90
- */
91
- getByCustomAuthID(body: UserGetByCustomAuthIDParams, options?: RequestOptions): APIPromise<User> {
92
- return this._client.post('/v1/users/custom_auth/id', { body, ...options });
93
- }
94
-
95
- /**
96
- * Looks up a user by their Discord username.
97
- *
98
- * @example
99
- * ```ts
100
- * const user = await client.users.getByDiscordUsername({
101
- * username: 'username',
102
- * });
103
- * ```
104
- */
105
- getByDiscordUsername(body: UserGetByDiscordUsernameParams, options?: RequestOptions): APIPromise<User> {
106
- return this._client.post('/v1/users/discord/username', { body, ...options });
107
- }
108
-
109
- /**
110
- * Looks up a user by their email address.
111
- *
112
- * @example
113
- * ```ts
114
- * const user = await client.users.getByEmailAddress({
115
- * address: 'dev@stainless.com',
116
- * });
117
- * ```
118
- */
119
- getByEmailAddress(body: UserGetByEmailAddressParams, options?: RequestOptions): APIPromise<User> {
120
- return this._client.post('/v1/users/email/address', { body, ...options });
121
- }
122
-
123
- /**
124
- * Looks up a user by their Farcaster ID.
125
- *
126
- * @example
127
- * ```ts
128
- * const user = await client.users.getByFarcasterID({
129
- * fid: 0,
130
- * });
131
- * ```
132
- */
133
- getByFarcasterID(body: UserGetByFarcasterIDParams, options?: RequestOptions): APIPromise<User> {
134
- return this._client.post('/v1/users/farcaster/fid', { body, ...options });
135
- }
136
-
137
- /**
138
- * Looks up a user by their Github username.
139
- *
140
- * @example
141
- * ```ts
142
- * const user = await client.users.getByGitHubUsername({
143
- * username: 'username',
144
- * });
145
- * ```
146
- */
147
- getByGitHubUsername(body: UserGetByGitHubUsernameParams, options?: RequestOptions): APIPromise<User> {
148
- return this._client.post('/v1/users/github/username', { body, ...options });
149
- }
150
-
151
- /**
152
- * Looks up a user by their phone number.
153
- *
154
- * @example
155
- * ```ts
156
- * const user = await client.users.getByPhoneNumber({
157
- * number: 'number',
158
- * });
159
- * ```
160
- */
161
- getByPhoneNumber(body: UserGetByPhoneNumberParams, options?: RequestOptions): APIPromise<User> {
162
- return this._client.post('/v1/users/phone/number', { body, ...options });
163
- }
164
-
165
- /**
166
- * Looks up a user by their smart wallet address.
167
- *
168
- * @example
169
- * ```ts
170
- * const user = await client.users.getBySmartWalletAddress({
171
- * address: 'address',
172
- * });
173
- * ```
174
- */
175
- getBySmartWalletAddress(
176
- body: UserGetBySmartWalletAddressParams,
177
- options?: RequestOptions,
178
- ): APIPromise<User> {
179
- return this._client.post('/v1/users/smart_wallet/address', { body, ...options });
180
- }
181
-
182
- /**
183
- * Looks up a user by their Telegram user ID.
184
- *
185
- * @example
186
- * ```ts
187
- * const user = await client.users.getByTelegramUserID({
188
- * telegram_user_id: 'telegram_user_id',
189
- * });
190
- * ```
191
- */
192
- getByTelegramUserID(body: UserGetByTelegramUserIDParams, options?: RequestOptions): APIPromise<User> {
193
- return this._client.post('/v1/users/telegram/telegram_user_id', { body, ...options });
194
- }
195
-
196
- /**
197
- * Looks up a user by their Telegram username.
198
- *
199
- * @example
200
- * ```ts
201
- * const user = await client.users.getByTelegramUsername({
202
- * username: 'username',
203
- * });
204
- * ```
205
- */
206
- getByTelegramUsername(body: UserGetByTelegramUsernameParams, options?: RequestOptions): APIPromise<User> {
207
- return this._client.post('/v1/users/telegram/username', { body, ...options });
208
- }
209
-
210
- /**
211
- * Looks up a user by their Twitter subject.
212
- *
213
- * @example
214
- * ```ts
215
- * const user = await client.users.getByTwitterSubject({
216
- * subject: 'subject',
217
- * });
218
- * ```
219
- */
220
- getByTwitterSubject(body: UserGetByTwitterSubjectParams, options?: RequestOptions): APIPromise<User> {
221
- return this._client.post('/v1/users/twitter/subject', { body, ...options });
222
- }
223
-
224
- /**
225
- * Looks up a user by their Twitter username.
226
- *
227
- * @example
228
- * ```ts
229
- * const user = await client.users.getByTwitterUsername({
230
- * username: 'username',
231
- * });
232
- * ```
233
- */
234
- getByTwitterUsername(body: UserGetByTwitterUsernameParams, options?: RequestOptions): APIPromise<User> {
235
- return this._client.post('/v1/users/twitter/username', { body, ...options });
236
- }
237
-
238
- /**
239
- * Looks up a user by their wallet address.
240
- *
241
- * @example
242
- * ```ts
243
- * const user = await client.users.getByWalletAddress({
244
- * address: 'address',
245
- * });
246
- * ```
247
- */
248
- getByWalletAddress(body: UserGetByWalletAddressParams, options?: RequestOptions): APIPromise<User> {
249
- return this._client.post('/v1/users/wallet/address', { body, ...options });
250
- }
251
-
252
- /**
253
- * Creates an embedded wallet for an existing user.
254
- *
255
- * @example
256
- * ```ts
257
- * const user = await client.users.pregenerateWallets(
258
- * 'user_id',
259
- * { wallets: [{ chain_type: 'ethereum' }] },
260
- * );
261
- * ```
262
- */
263
- pregenerateWallets(
264
- userID: string,
265
- body: UserPregenerateWalletsParams,
266
- options?: RequestOptions,
267
- ): APIPromise<User> {
268
- return this._client.post(path`/v1/users/${userID}/wallets`, { body, ...options });
269
- }
270
-
271
- /**
272
- * Search users by search term, emails, phone numbers, or wallet addresses.
273
- *
274
- * @example
275
- * ```ts
276
- * const user = await client.users.search({
277
- * searchTerm: 'searchTerm',
278
- * });
279
- * ```
280
- */
281
- search(body: UserSearchParams, options?: RequestOptions): APIPromise<User> {
282
- return this._client.post('/v1/users/search', { body, ...options });
283
- }
284
-
285
- /**
286
- * Adds custom metadata to a user by user ID.
287
- *
288
- * @example
289
- * ```ts
290
- * const user = await client.users.setCustomMetadata(
291
- * 'user_id',
292
- * { custom_metadata: { key: 'value' } },
293
- * );
294
- * ```
295
- */
296
- setCustomMetadata(
297
- userID: string,
298
- body: UserSetCustomMetadataParams,
299
- options?: RequestOptions,
300
- ): APIPromise<User> {
301
- return this._client.post(path`/v1/users/${userID}/custom_metadata`, { body, ...options });
302
- }
303
-
304
- /**
305
- * Unlinks a user linked account.
306
- *
307
- * @example
308
- * ```ts
309
- * const user = await client.users.unlinkLinkedAccount(
310
- * 'user_id',
311
- * { handle: 'test@test.com', type: 'email' },
312
- * );
313
- * ```
314
- */
315
- unlinkLinkedAccount(
316
- userID: string,
317
- body: UserUnlinkLinkedAccountParams,
318
- options?: RequestOptions,
319
- ): APIPromise<User> {
320
- return this._client.post(path`/v1/users/${userID}/accounts/unlink`, { body, ...options });
321
- }
322
- }
323
-
324
- export type UsersCursor = Cursor<User>;
9
+ export class Users extends APIResource {}
325
10
 
326
11
  /**
327
12
  * The authenticated user.
@@ -1592,150 +1277,6 @@ export interface UserWithIdentityToken {
1592
1277
  user: User;
1593
1278
  }
1594
1279
 
1595
- export interface UserCreateParams {
1596
- linked_accounts: Array<LinkedAccountInput>;
1597
-
1598
- /**
1599
- * Custom metadata associated with the user.
1600
- */
1601
- custom_metadata?: CustomMetadata;
1602
-
1603
- /**
1604
- * Wallets to create for the user.
1605
- */
1606
- wallets?: Array<UserCreateParams.Wallet>;
1607
- }
1608
-
1609
- export namespace UserCreateParams {
1610
- export interface Wallet {
1611
- /**
1612
- * The wallet chain types.
1613
- */
1614
- chain_type: WalletsAPI.WalletChainType;
1615
-
1616
- /**
1617
- * Additional signers for the wallet.
1618
- */
1619
- additional_signers?: Array<Wallet.AdditionalSigner>;
1620
-
1621
- /**
1622
- * Create a smart wallet with this wallet as the signer. Only supported for wallets
1623
- * with `chain_type: "ethereum"`.
1624
- */
1625
- create_smart_wallet?: boolean;
1626
-
1627
- /**
1628
- * Policy IDs to enforce on the wallet. Currently, only one policy is supported per
1629
- * wallet.
1630
- */
1631
- policy_ids?: Array<string>;
1632
- }
1633
-
1634
- export namespace Wallet {
1635
- export interface AdditionalSigner {
1636
- /**
1637
- * A unique identifier for a key quorum.
1638
- */
1639
- signer_id: SharedAPI.KeyQuorumID;
1640
-
1641
- /**
1642
- * The array of policy IDs that will be applied to wallet requests. If specified,
1643
- * this will override the base policy IDs set on the wallet. Currently, only one
1644
- * policy is supported per signer.
1645
- */
1646
- override_policy_ids?: Array<string>;
1647
- }
1648
- }
1649
- }
1650
-
1651
- export interface UserListParams extends CursorParams {}
1652
-
1653
- export interface UserGetByCustomAuthIDParams {
1654
- custom_user_id: string;
1655
- }
1656
-
1657
- export interface UserGetByDiscordUsernameParams {
1658
- username: string;
1659
- }
1660
-
1661
- export interface UserGetByEmailAddressParams {
1662
- address: string;
1663
- }
1664
-
1665
- export interface UserGetByFarcasterIDParams {
1666
- fid: number;
1667
- }
1668
-
1669
- export interface UserGetByGitHubUsernameParams {
1670
- username: string;
1671
- }
1672
-
1673
- export interface UserGetByPhoneNumberParams {
1674
- number: string;
1675
- }
1676
-
1677
- export interface UserGetBySmartWalletAddressParams {
1678
- address: string;
1679
- }
1680
-
1681
- export interface UserGetByTelegramUserIDParams {
1682
- telegram_user_id: string;
1683
- }
1684
-
1685
- export interface UserGetByTelegramUsernameParams {
1686
- username: string;
1687
- }
1688
-
1689
- export interface UserGetByTwitterSubjectParams {
1690
- subject: string;
1691
- }
1692
-
1693
- export interface UserGetByTwitterUsernameParams {
1694
- username: string;
1695
- }
1696
-
1697
- export interface UserGetByWalletAddressParams {
1698
- address: string;
1699
- }
1700
-
1701
- export interface UserPregenerateWalletsParams {
1702
- wallets: Array<EmbeddedWalletsAPI.WalletCreationInput>;
1703
- }
1704
-
1705
- export type UserSearchParams = UserSearchParams.Variant0 | UserSearchParams.Variant1;
1706
-
1707
- export declare namespace UserSearchParams {
1708
- export interface Variant0 {
1709
- searchTerm: string;
1710
- }
1711
-
1712
- export interface Variant1 {
1713
- emails: Array<string>;
1714
-
1715
- phoneNumbers: Array<string>;
1716
-
1717
- walletAddresses: Array<string>;
1718
- }
1719
- }
1720
-
1721
- export interface UserSetCustomMetadataParams {
1722
- /**
1723
- * Custom metadata associated with the user.
1724
- */
1725
- custom_metadata: CustomMetadata;
1726
- }
1727
-
1728
- export interface UserUnlinkLinkedAccountParams {
1729
- handle: string;
1730
-
1731
- /**
1732
- * The possible types of linked accounts.
1733
- */
1734
- type: LinkedAccountType;
1735
-
1736
- provider?: string;
1737
- }
1738
-
1739
1280
  export declare namespace Users {
1740
1281
  export {
1741
1282
  type AuthenticatedUser as AuthenticatedUser,
@@ -1804,24 +1345,5 @@ export declare namespace Users {
1804
1345
  type User as User,
1805
1346
  type UserBatchCreateInput as UserBatchCreateInput,
1806
1347
  type UserWithIdentityToken as UserWithIdentityToken,
1807
- type UsersCursor as UsersCursor,
1808
- type UserCreateParams as UserCreateParams,
1809
- type UserListParams as UserListParams,
1810
- type UserGetByCustomAuthIDParams as UserGetByCustomAuthIDParams,
1811
- type UserGetByDiscordUsernameParams as UserGetByDiscordUsernameParams,
1812
- type UserGetByEmailAddressParams as UserGetByEmailAddressParams,
1813
- type UserGetByFarcasterIDParams as UserGetByFarcasterIDParams,
1814
- type UserGetByGitHubUsernameParams as UserGetByGitHubUsernameParams,
1815
- type UserGetByPhoneNumberParams as UserGetByPhoneNumberParams,
1816
- type UserGetBySmartWalletAddressParams as UserGetBySmartWalletAddressParams,
1817
- type UserGetByTelegramUserIDParams as UserGetByTelegramUserIDParams,
1818
- type UserGetByTelegramUsernameParams as UserGetByTelegramUsernameParams,
1819
- type UserGetByTwitterSubjectParams as UserGetByTwitterSubjectParams,
1820
- type UserGetByTwitterUsernameParams as UserGetByTwitterUsernameParams,
1821
- type UserGetByWalletAddressParams as UserGetByWalletAddressParams,
1822
- type UserPregenerateWalletsParams as UserPregenerateWalletsParams,
1823
- type UserSearchParams as UserSearchParams,
1824
- type UserSetCustomMetadataParams as UserSetCustomMetadataParams,
1825
- type UserUnlinkLinkedAccountParams as UserUnlinkLinkedAccountParams,
1826
1348
  };
1827
1349
  }
@@ -4,7 +4,6 @@ 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,
8
7
  type AdditionalSignerInput,
9
8
  type AdditionalSignerItemInput,
10
9
  type Address,
@@ -176,12 +175,14 @@ export {
176
175
  type WalletAPIRevokeAuthorizationKeyInput,
177
176
  type WalletAsset,
178
177
  type WalletAuthenticateRequestBody,
178
+ type WalletAuthenticateWithJwtResponse,
179
179
  type WalletAuthorizationHeaders,
180
180
  type WalletBatchCreateInput,
181
181
  type WalletBatchCreateResponse,
182
182
  type WalletBatchCreateResult,
183
183
  type WalletBatchItemInput,
184
184
  type WalletChainType,
185
+ type WalletCreateWalletsWithRecoveryResponse,
185
186
  type WalletCustodian,
186
187
  type WalletEntropyType,
187
188
  type WalletEthereumAsset,
@@ -190,22 +191,16 @@ export {
190
191
  type WalletImportInitResponse,
191
192
  type WalletImportSupportedChains,
192
193
  type WalletImportSupportedEntropyTypes,
194
+ type WalletRevokeResponse,
193
195
  type WalletRpcRequestBody,
194
196
  type WalletRpcResponse,
195
197
  type WalletSolanaAsset,
196
198
  type WalletUpdateRequestBody,
197
- type WalletInitImportResponse,
198
- type WalletAuthenticateWithJwtResponse,
199
- type WalletCreateWalletsWithRecoveryResponse,
200
199
  type WalletCreateParams,
200
+ type WalletUpdateParams,
201
201
  type WalletListParams,
202
202
  type WalletExportParams,
203
- type WalletInitImportParams,
204
203
  type WalletRawSignParams,
205
204
  type WalletRpcParams,
206
- type WalletSubmitImportParams,
207
- type WalletUpdateParams,
208
- type WalletAuthenticateWithJwtParams,
209
- type WalletCreateWalletsWithRecoveryParams,
210
205
  type WalletsCursor,
211
206
  } from './wallets';