@privy-io/api-types 0.4.0 → 0.5.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 +37 -0
  2. package/client.d.mts +18 -11
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +18 -11
  5. package/client.d.ts.map +1 -1
  6. package/client.js +17 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +17 -3
  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/package.json +1 -1
  17. package/resources/aggregations.d.mts +213 -2
  18. package/resources/aggregations.d.mts.map +1 -1
  19. package/resources/aggregations.d.ts +213 -2
  20. package/resources/aggregations.d.ts.map +1 -1
  21. package/resources/client-auth.d.mts +167 -1
  22. package/resources/client-auth.d.mts.map +1 -1
  23. package/resources/client-auth.d.ts +167 -1
  24. package/resources/client-auth.d.ts.map +1 -1
  25. package/resources/funding.d.mts +4 -4
  26. package/resources/funding.d.mts.map +1 -1
  27. package/resources/funding.d.ts +4 -4
  28. package/resources/funding.d.ts.map +1 -1
  29. package/resources/index.d.mts +7 -5
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +7 -5
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js +5 -1
  34. package/resources/index.js.map +1 -1
  35. package/resources/index.mjs +2 -0
  36. package/resources/index.mjs.map +1 -1
  37. package/resources/policies.d.mts +58 -60
  38. package/resources/policies.d.mts.map +1 -1
  39. package/resources/policies.d.ts +58 -60
  40. package/resources/policies.d.ts.map +1 -1
  41. package/resources/users.d.mts +72 -62
  42. package/resources/users.d.mts.map +1 -1
  43. package/resources/users.d.ts +72 -62
  44. package/resources/users.d.ts.map +1 -1
  45. package/resources/wallets/balance.d.mts +10 -5
  46. package/resources/wallets/balance.d.mts.map +1 -1
  47. package/resources/wallets/balance.d.ts +10 -5
  48. package/resources/wallets/balance.d.ts.map +1 -1
  49. package/resources/wallets/balance.js +1 -2
  50. package/resources/wallets/balance.js.map +1 -1
  51. package/resources/wallets/balance.mjs +1 -2
  52. package/resources/wallets/balance.mjs.map +1 -1
  53. package/resources/wallets/index.d.mts +1 -1
  54. package/resources/wallets/index.d.mts.map +1 -1
  55. package/resources/wallets/index.d.ts +1 -1
  56. package/resources/wallets/index.d.ts.map +1 -1
  57. package/resources/wallets/index.js.map +1 -1
  58. package/resources/wallets/index.mjs.map +1 -1
  59. package/resources/wallets/transactions.d.mts +2 -2
  60. package/resources/wallets/transactions.d.mts.map +1 -1
  61. package/resources/wallets/transactions.d.ts +2 -2
  62. package/resources/wallets/transactions.d.ts.map +1 -1
  63. package/resources/wallets/wallets.d.mts +192 -72
  64. package/resources/wallets/wallets.d.mts.map +1 -1
  65. package/resources/wallets/wallets.d.ts +192 -72
  66. package/resources/wallets/wallets.d.ts.map +1 -1
  67. package/resources/wallets/wallets.js.map +1 -1
  68. package/resources/wallets/wallets.mjs.map +1 -1
  69. package/resources/webhooks.d.mts +940 -0
  70. package/resources/webhooks.d.mts.map +1 -0
  71. package/resources/webhooks.d.ts +940 -0
  72. package/resources/webhooks.d.ts.map +1 -0
  73. package/resources/webhooks.js +9 -0
  74. package/resources/webhooks.js.map +1 -0
  75. package/resources/webhooks.mjs +5 -0
  76. package/resources/webhooks.mjs.map +1 -0
  77. package/resources/yield.d.mts +264 -0
  78. package/resources/yield.d.mts.map +1 -0
  79. package/resources/yield.d.ts +264 -0
  80. package/resources/yield.d.ts.map +1 -0
  81. package/resources/yield.js +9 -0
  82. package/resources/yield.js.map +1 -0
  83. package/resources/yield.mjs +5 -0
  84. package/resources/yield.mjs.map +1 -0
  85. package/src/client.ts +184 -14
  86. package/src/internal/parse.ts +6 -0
  87. package/src/resources/aggregations.ts +361 -5
  88. package/src/resources/client-auth.ts +287 -0
  89. package/src/resources/funding.ts +4 -1
  90. package/src/resources/index.ts +84 -8
  91. package/src/resources/policies.ts +78 -80
  92. package/src/resources/users.ts +128 -111
  93. package/src/resources/wallets/balance.ts +15 -5
  94. package/src/resources/wallets/index.ts +7 -3
  95. package/src/resources/wallets/transactions.ts +2 -2
  96. package/src/resources/wallets/wallets.ts +237 -91
  97. package/src/resources/webhooks.ts +1287 -0
  98. package/src/resources/yield.ts +330 -0
  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
package/src/client.ts CHANGED
@@ -22,6 +22,7 @@ import { APIPromise } from './core/api-promise';
22
22
  import {
23
23
  Aggregation,
24
24
  AggregationGroupBy,
25
+ AggregationInput,
25
26
  AggregationMethod,
26
27
  AggregationMetric,
27
28
  AggregationWindow,
@@ -30,7 +31,24 @@ import {
30
31
  import { Analytics, AnalyticsEventInput } from './resources/analytics';
31
32
  import { AppResponse, Apps } from './resources/apps';
32
33
  import {
34
+ BridgeBrlFiatVirtualAccountDepositInstructions,
35
+ BridgeDestinationAsset,
36
+ BridgeEurFiatVirtualAccountDepositInstructions,
37
+ BridgeFiatCustomerResponse,
38
+ BridgeFiatVirtualAccountDepositInstructions,
39
+ BridgeFiatVirtualAccountDestination,
40
+ BridgeFiatVirtualAccountRequest,
41
+ BridgeFiatVirtualAccountResponse,
42
+ BridgeFiatVirtualAccountSource,
43
+ BridgeGbpFiatVirtualAccountDepositInstructions,
44
+ BridgeMxnFiatVirtualAccountDepositInstructions,
45
+ BridgeSandboxFiatCustomerResponse,
46
+ BridgeSandboxFiatVirtualAccountRequest,
47
+ BridgeSandboxFiatVirtualAccountResponse,
48
+ BridgeSourceAsset,
49
+ BridgeUsdFiatVirtualAccountDepositInstructions,
33
50
  ClientAuth,
51
+ CreateOrUpdateFiatCustomerRequestInput,
34
52
  CustomJwtAuthenticateRequestBody,
35
53
  CustomJwtLinkRequestBody,
36
54
  CustomOAuthProviderID,
@@ -48,6 +66,10 @@ import {
48
66
  FarcasterV2AuthenticateRequestBody,
49
67
  FarcasterV2InitRequestBody,
50
68
  FarcasterV2InitResponseBody,
69
+ FiatCustomerResponse,
70
+ FiatVirtualAccountRequest,
71
+ FiatVirtualAccountResponse,
72
+ GetFiatCustomerRequestInput,
51
73
  GuestAuthenticateRequestBody,
52
74
  MfaPasskeyEnrollmentRequestBody,
53
75
  MfaPasskeyInitRequestBody,
@@ -69,6 +91,7 @@ import {
69
91
  OAuthUnlinkRequestBody,
70
92
  OAuthVerifyRequestBody,
71
93
  OAuthVerifyResponseBody,
94
+ OnrampProvider,
72
95
  OptionalRefreshTokenInput,
73
96
  PasskeyAuthenticateRequestBody,
74
97
  PasskeyInitAuthenticateResponseBody,
@@ -201,6 +224,7 @@ import {
201
224
  LinkedAccountLinkedInInput,
202
225
  LinkedAccountLinkedInOAuth,
203
226
  LinkedAccountPasskey,
227
+ LinkedAccountPasskeyInput,
204
228
  LinkedAccountPhone,
205
229
  LinkedAccountPhoneInput,
206
230
  LinkedAccountSmartWallet,
@@ -248,6 +272,54 @@ import {
248
272
  Users,
249
273
  UsersCursor,
250
274
  } from './resources/users';
275
+ import {
276
+ FundsDepositedWebhookPayload,
277
+ FundsWithdrawnWebhookPayload,
278
+ KrakenEmbedQuoteCancelledWebhookPayload,
279
+ KrakenEmbedQuoteExecutedWebhookPayload,
280
+ KrakenEmbedQuoteExecutionFailedWebhookPayload,
281
+ KrakenEmbedUserClosedWebhookPayload,
282
+ KrakenEmbedUserDisabledWebhookPayload,
283
+ KrakenEmbedUserVerifiedWebhookPayload,
284
+ KrakenEmbedVerificationCompletedWebhookPayload,
285
+ KrakenEmbedVerificationFailedWebhookPayload,
286
+ MfaDisabledWebhookPayload,
287
+ MfaEnabledWebhookPayload,
288
+ PrivateKeyExportWebhookPayload,
289
+ TransactionBroadcastedWebhookPayload,
290
+ TransactionConfirmedWebhookPayload,
291
+ TransactionExecutionRevertedWebhookPayload,
292
+ TransactionFailedWebhookPayload,
293
+ TransactionProviderErrorWebhookPayload,
294
+ TransactionReplacedWebhookPayload,
295
+ TransactionStillPendingWebhookPayload,
296
+ UserAuthenticatedWebhookPayload,
297
+ UserCreatedWebhookPayload,
298
+ UserLinkedAccountWebhookPayload,
299
+ UserTransferredAccountWebhookPayload,
300
+ UserUnlinkedAccountWebhookPayload,
301
+ UserUpdatedAccountWebhookPayload,
302
+ UserWalletCreatedWebhookPayload,
303
+ WalletRecoveredWebhookPayload,
304
+ WalletRecoverySetupWebhookPayload,
305
+ Webhooks,
306
+ } from './resources/webhooks';
307
+ import {
308
+ EthereumVaultDetailsInput,
309
+ EthereumVaultDetailsResponse,
310
+ EthereumVaultPosition,
311
+ EthereumVaultResponse,
312
+ EthereumYieldDepositInput,
313
+ EthereumYieldPositionResponse,
314
+ EthereumYieldPositionsInput,
315
+ EthereumYieldProvider,
316
+ EthereumYieldSweepIDInput,
317
+ EthereumYieldSweepResponse,
318
+ EthereumYieldSweepStatus,
319
+ EthereumYieldSweepType,
320
+ EthereumYieldWithdrawInput,
321
+ Yield,
322
+ } from './resources/yield';
251
323
  import {
252
324
  CurveSigningChainType,
253
325
  CustodialWallet,
@@ -281,6 +353,10 @@ import {
281
353
  Wallet,
282
354
  WalletAuthenticateWithJwtParams,
283
355
  WalletAuthenticateWithJwtResponse,
356
+ WalletBatchCreateInput,
357
+ WalletBatchCreateResponse,
358
+ WalletBatchCreateResult,
359
+ WalletBatchItemInput,
284
360
  WalletChainType,
285
361
  WalletCreateParams,
286
362
  WalletCreateWalletsWithRecoveryParams,
@@ -774,7 +850,7 @@ export class Privy {
774
850
  loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
775
851
 
776
852
  const errText = await response.text().catch((err: any) => castToError(err).message);
777
- const errJSON = safeJSON(errText);
853
+ const errJSON = safeJSON(errText) as any;
778
854
  const errMessage = errJSON ? undefined : errText;
779
855
 
780
856
  loggerFor(this).debug(
@@ -811,9 +887,14 @@ export class Privy {
811
887
  getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
812
888
  path: string,
813
889
  Page: new (...args: any[]) => PageClass,
814
- opts?: RequestOptions,
890
+ opts?: PromiseOrValue<RequestOptions>,
815
891
  ): Pagination.PagePromise<PageClass, Item> {
816
- return this.requestAPIList(Page, { method: 'get', path, ...opts });
892
+ return this.requestAPIList(
893
+ Page,
894
+ opts && 'then' in opts ?
895
+ opts.then((opts) => ({ method: 'get', path, ...opts }))
896
+ : { method: 'get', path, ...opts },
897
+ );
817
898
  }
818
899
 
819
900
  requestAPIList<
@@ -821,7 +902,7 @@ export class Privy {
821
902
  PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
822
903
  >(
823
904
  Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
824
- options: FinalRequestOptions,
905
+ options: PromiseOrValue<FinalRequestOptions>,
825
906
  ): Pagination.PagePromise<PageClass, Item> {
826
907
  const request = this.makeRequest(options, null, undefined);
827
908
  return new Pagination.PagePromise<PageClass, Item>(this as any as Privy, request, Page);
@@ -834,9 +915,10 @@ export class Privy {
834
915
  controller: AbortController,
835
916
  ): Promise<Response> {
836
917
  const { signal, method, ...options } = init || {};
837
- if (signal) signal.addEventListener('abort', () => controller.abort());
918
+ const abort = this._makeAbort(controller);
919
+ if (signal) signal.addEventListener('abort', abort, { once: true });
838
920
 
839
- const timeout = setTimeout(() => controller.abort(), ms);
921
+ const timeout = setTimeout(abort, ms);
840
922
 
841
923
  const isReadableBody =
842
924
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -1004,6 +1086,12 @@ export class Privy {
1004
1086
  return headers.values;
1005
1087
  }
1006
1088
 
1089
+ private _makeAbort(controller: AbortController) {
1090
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
1091
+ // would capture all request options, and cause a memory leak.
1092
+ return () => controller.abort();
1093
+ }
1094
+
1007
1095
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
1008
1096
  bodyHeaders: HeadersLike;
1009
1097
  body: BodyInit | undefined;
@@ -1072,6 +1160,8 @@ export class Privy {
1072
1160
  transactions: API.Transactions = new API.Transactions(this);
1073
1161
  keyQuorums: API.KeyQuorums = new API.KeyQuorums(this);
1074
1162
  aggregations: API.Aggregations = new API.Aggregations(this);
1163
+ webhooks: API.Webhooks = new API.Webhooks(this);
1164
+ yield: API.Yield = new API.Yield(this);
1075
1165
  }
1076
1166
 
1077
1167
  Privy.Wallets = Wallets;
@@ -1086,6 +1176,8 @@ Privy.Policies = Policies;
1086
1176
  Privy.Transactions = Transactions;
1087
1177
  Privy.KeyQuorums = KeyQuorums;
1088
1178
  Privy.Aggregations = Aggregations;
1179
+ Privy.Webhooks = Webhooks;
1180
+ Privy.Yield = Yield;
1089
1181
 
1090
1182
  export declare namespace Privy {
1091
1183
  export type RequestOptions = Opts.RequestOptions;
@@ -1095,12 +1187,11 @@ export declare namespace Privy {
1095
1187
 
1096
1188
  export {
1097
1189
  Wallets as Wallets,
1190
+ type WalletRevokeResponse as WalletRevokeResponse,
1098
1191
  type CurveSigningChainType as CurveSigningChainType,
1192
+ type ExtendedChainType as ExtendedChainType,
1099
1193
  type FirstClassChainType as FirstClassChainType,
1100
- type Wallet as Wallet,
1101
1194
  type WalletChainType as WalletChainType,
1102
- type WalletRevokeResponse as WalletRevokeResponse,
1103
- type ExtendedChainType as ExtendedChainType,
1104
1195
  type WalletCustodian as WalletCustodian,
1105
1196
  type CustodialWalletProvider as CustodialWalletProvider,
1106
1197
  type CustodialWalletChainType as CustodialWalletChainType,
@@ -1108,6 +1199,11 @@ export declare namespace Privy {
1108
1199
  type CustodialWallet as CustodialWallet,
1109
1200
  type HpkeImportConfig as HpkeImportConfig,
1110
1201
  type SuiCommandName as SuiCommandName,
1202
+ type Wallet as Wallet,
1203
+ type WalletBatchItemInput as WalletBatchItemInput,
1204
+ type WalletBatchCreateInput as WalletBatchCreateInput,
1205
+ type WalletBatchCreateResult as WalletBatchCreateResult,
1206
+ type WalletBatchCreateResponse as WalletBatchCreateResponse,
1111
1207
  type EthereumPersonalSignRpcInput as EthereumPersonalSignRpcInput,
1112
1208
  type EthereumSignTransactionRpcInput as EthereumSignTransactionRpcInput,
1113
1209
  type EthereumSendTransactionRpcInput as EthereumSendTransactionRpcInput,
@@ -1237,6 +1333,28 @@ export declare namespace Privy {
1237
1333
  type PrivyOAuthProviderID as PrivyOAuthProviderID,
1238
1334
  type CustomOAuthProviderID as CustomOAuthProviderID,
1239
1335
  type OAuthProviderID as OAuthProviderID,
1336
+ type OnrampProvider as OnrampProvider,
1337
+ type GetFiatCustomerRequestInput as GetFiatCustomerRequestInput,
1338
+ type CreateOrUpdateFiatCustomerRequestInput as CreateOrUpdateFiatCustomerRequestInput,
1339
+ type BridgeFiatCustomerResponse as BridgeFiatCustomerResponse,
1340
+ type BridgeSandboxFiatCustomerResponse as BridgeSandboxFiatCustomerResponse,
1341
+ type FiatCustomerResponse as FiatCustomerResponse,
1342
+ type BridgeDestinationAsset as BridgeDestinationAsset,
1343
+ type BridgeSourceAsset as BridgeSourceAsset,
1344
+ type BridgeFiatVirtualAccountSource as BridgeFiatVirtualAccountSource,
1345
+ type BridgeFiatVirtualAccountDestination as BridgeFiatVirtualAccountDestination,
1346
+ type BridgeFiatVirtualAccountRequest as BridgeFiatVirtualAccountRequest,
1347
+ type BridgeSandboxFiatVirtualAccountRequest as BridgeSandboxFiatVirtualAccountRequest,
1348
+ type FiatVirtualAccountRequest as FiatVirtualAccountRequest,
1349
+ type BridgeUsdFiatVirtualAccountDepositInstructions as BridgeUsdFiatVirtualAccountDepositInstructions,
1350
+ type BridgeEurFiatVirtualAccountDepositInstructions as BridgeEurFiatVirtualAccountDepositInstructions,
1351
+ type BridgeMxnFiatVirtualAccountDepositInstructions as BridgeMxnFiatVirtualAccountDepositInstructions,
1352
+ type BridgeBrlFiatVirtualAccountDepositInstructions as BridgeBrlFiatVirtualAccountDepositInstructions,
1353
+ type BridgeGbpFiatVirtualAccountDepositInstructions as BridgeGbpFiatVirtualAccountDepositInstructions,
1354
+ type BridgeFiatVirtualAccountDepositInstructions as BridgeFiatVirtualAccountDepositInstructions,
1355
+ type BridgeFiatVirtualAccountResponse as BridgeFiatVirtualAccountResponse,
1356
+ type BridgeSandboxFiatVirtualAccountResponse as BridgeSandboxFiatVirtualAccountResponse,
1357
+ type FiatVirtualAccountResponse as FiatVirtualAccountResponse,
1240
1358
  };
1241
1359
 
1242
1360
  export { CrossApp as CrossApp, type CrossAppConnectionsResponse as CrossAppConnectionsResponse };
@@ -1252,10 +1370,6 @@ export declare namespace Privy {
1252
1370
 
1253
1371
  export {
1254
1372
  Users as Users,
1255
- type AuthenticatedUser as AuthenticatedUser,
1256
- type LinkedAccount as LinkedAccount,
1257
- type User as User,
1258
- type UserWithIdentityToken as UserWithIdentityToken,
1259
1373
  type LinkedAccountEmail as LinkedAccountEmail,
1260
1374
  type LinkedAccountPhone as LinkedAccountPhone,
1261
1375
  type LinkedAccountBaseWallet as LinkedAccountBaseWallet,
@@ -1291,6 +1405,7 @@ export declare namespace Privy {
1291
1405
  type CrossAppSmartWallet as CrossAppSmartWallet,
1292
1406
  type LinkedAccountCrossApp as LinkedAccountCrossApp,
1293
1407
  type LinkedAccountAuthorizationKey as LinkedAccountAuthorizationKey,
1408
+ type LinkedAccount as LinkedAccount,
1294
1409
  type LinkedAccountType as LinkedAccountType,
1295
1410
  type CustomMetadata as CustomMetadata,
1296
1411
  type LinkedAccountWalletInput as LinkedAccountWalletInput,
@@ -1310,13 +1425,17 @@ export declare namespace Privy {
1310
1425
  type LinkedAccountFarcasterInput as LinkedAccountFarcasterInput,
1311
1426
  type LinkedAccountTelegramInput as LinkedAccountTelegramInput,
1312
1427
  type LinkedAccountCustomJwtInput as LinkedAccountCustomJwtInput,
1428
+ type LinkedAccountPasskeyInput as LinkedAccountPasskeyInput,
1313
1429
  type LinkedAccountInput as LinkedAccountInput,
1314
1430
  type UserBatchCreateInput as UserBatchCreateInput,
1315
1431
  type SMSMfaMethod as SMSMfaMethod,
1316
1432
  type TotpMfaMethod as TotpMfaMethod,
1317
1433
  type PasskeyMfaMethod as PasskeyMfaMethod,
1318
1434
  type LinkedMfaMethod as LinkedMfaMethod,
1435
+ type User as User,
1319
1436
  type OAuthTokens as OAuthTokens,
1437
+ type UserWithIdentityToken as UserWithIdentityToken,
1438
+ type AuthenticatedUser as AuthenticatedUser,
1320
1439
  type UsersCursor as UsersCursor,
1321
1440
  type UserCreateParams as UserCreateParams,
1322
1441
  type UserListParams as UserListParams,
@@ -1342,12 +1461,12 @@ export declare namespace Privy {
1342
1461
 
1343
1462
  export {
1344
1463
  Policies as Policies,
1345
- type Policy as Policy,
1346
1464
  type SuiTransactionCommandOperator as SuiTransactionCommandOperator,
1347
1465
  type SuiTransferObjectsCommandField as SuiTransferObjectsCommandField,
1348
1466
  type TronTransactionCondition as TronTransactionCondition,
1349
1467
  type SuiTransactionCommandCondition as SuiTransactionCommandCondition,
1350
1468
  type SuiTransferObjectsCommandCondition as SuiTransferObjectsCommandCondition,
1469
+ type Policy as Policy,
1351
1470
  type PolicyCreateRuleResponse as PolicyCreateRuleResponse,
1352
1471
  type PolicyDeleteResponse as PolicyDeleteResponse,
1353
1472
  type PolicyDeleteRuleResponse as PolicyDeleteRuleResponse,
@@ -1385,5 +1504,56 @@ export declare namespace Privy {
1385
1504
  type AggregationWindow as AggregationWindow,
1386
1505
  type AggregationGroupBy as AggregationGroupBy,
1387
1506
  type Aggregation as Aggregation,
1507
+ type AggregationInput as AggregationInput,
1508
+ };
1509
+
1510
+ export {
1511
+ Webhooks as Webhooks,
1512
+ type UserCreatedWebhookPayload as UserCreatedWebhookPayload,
1513
+ type UserAuthenticatedWebhookPayload as UserAuthenticatedWebhookPayload,
1514
+ type UserLinkedAccountWebhookPayload as UserLinkedAccountWebhookPayload,
1515
+ type UserUnlinkedAccountWebhookPayload as UserUnlinkedAccountWebhookPayload,
1516
+ type UserUpdatedAccountWebhookPayload as UserUpdatedAccountWebhookPayload,
1517
+ type UserTransferredAccountWebhookPayload as UserTransferredAccountWebhookPayload,
1518
+ type UserWalletCreatedWebhookPayload as UserWalletCreatedWebhookPayload,
1519
+ type TransactionBroadcastedWebhookPayload as TransactionBroadcastedWebhookPayload,
1520
+ type TransactionConfirmedWebhookPayload as TransactionConfirmedWebhookPayload,
1521
+ type TransactionExecutionRevertedWebhookPayload as TransactionExecutionRevertedWebhookPayload,
1522
+ type TransactionStillPendingWebhookPayload as TransactionStillPendingWebhookPayload,
1523
+ type TransactionFailedWebhookPayload as TransactionFailedWebhookPayload,
1524
+ type TransactionReplacedWebhookPayload as TransactionReplacedWebhookPayload,
1525
+ type TransactionProviderErrorWebhookPayload as TransactionProviderErrorWebhookPayload,
1526
+ type FundsDepositedWebhookPayload as FundsDepositedWebhookPayload,
1527
+ type FundsWithdrawnWebhookPayload as FundsWithdrawnWebhookPayload,
1528
+ type PrivateKeyExportWebhookPayload as PrivateKeyExportWebhookPayload,
1529
+ type WalletRecoverySetupWebhookPayload as WalletRecoverySetupWebhookPayload,
1530
+ type WalletRecoveredWebhookPayload as WalletRecoveredWebhookPayload,
1531
+ type MfaEnabledWebhookPayload as MfaEnabledWebhookPayload,
1532
+ type MfaDisabledWebhookPayload as MfaDisabledWebhookPayload,
1533
+ type KrakenEmbedVerificationCompletedWebhookPayload as KrakenEmbedVerificationCompletedWebhookPayload,
1534
+ type KrakenEmbedVerificationFailedWebhookPayload as KrakenEmbedVerificationFailedWebhookPayload,
1535
+ type KrakenEmbedQuoteExecutedWebhookPayload as KrakenEmbedQuoteExecutedWebhookPayload,
1536
+ type KrakenEmbedQuoteExecutionFailedWebhookPayload as KrakenEmbedQuoteExecutionFailedWebhookPayload,
1537
+ type KrakenEmbedQuoteCancelledWebhookPayload as KrakenEmbedQuoteCancelledWebhookPayload,
1538
+ type KrakenEmbedUserVerifiedWebhookPayload as KrakenEmbedUserVerifiedWebhookPayload,
1539
+ type KrakenEmbedUserDisabledWebhookPayload as KrakenEmbedUserDisabledWebhookPayload,
1540
+ type KrakenEmbedUserClosedWebhookPayload as KrakenEmbedUserClosedWebhookPayload,
1541
+ };
1542
+
1543
+ export {
1544
+ Yield as Yield,
1545
+ type EthereumYieldProvider as EthereumYieldProvider,
1546
+ type EthereumYieldSweepType as EthereumYieldSweepType,
1547
+ type EthereumYieldSweepStatus as EthereumYieldSweepStatus,
1548
+ type EthereumYieldDepositInput as EthereumYieldDepositInput,
1549
+ type EthereumYieldWithdrawInput as EthereumYieldWithdrawInput,
1550
+ type EthereumYieldSweepResponse as EthereumYieldSweepResponse,
1551
+ type EthereumVaultDetailsInput as EthereumVaultDetailsInput,
1552
+ type EthereumYieldSweepIDInput as EthereumYieldSweepIDInput,
1553
+ type EthereumVaultResponse as EthereumVaultResponse,
1554
+ type EthereumVaultDetailsResponse as EthereumVaultDetailsResponse,
1555
+ type EthereumYieldPositionsInput as EthereumYieldPositionsInput,
1556
+ type EthereumVaultPosition as EthereumVaultPosition,
1557
+ type EthereumYieldPositionResponse as EthereumYieldPositionResponse,
1388
1558
  };
1389
1559
  }
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Privy, props: APIResponseP
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }