@privy-io/node 0.10.1 → 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.
- package/CHANGELOG.md +50 -0
- package/client.d.mts +37 -19
- package/client.d.mts.map +1 -1
- package/client.d.ts +37 -19
- package/client.d.ts.map +1 -1
- package/client.js +29 -10
- package/client.js.map +1 -1
- package/client.mjs +30 -11
- package/client.mjs.map +1 -1
- package/index.d.mts +2 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs.map +1 -1
- package/package.json +12 -1
- package/public-api/PrivyClient.d.mts +3 -0
- package/public-api/PrivyClient.d.mts.map +1 -1
- package/public-api/PrivyClient.d.ts +3 -0
- package/public-api/PrivyClient.d.ts.map +1 -1
- package/public-api/PrivyClient.js +5 -0
- package/public-api/PrivyClient.js.map +1 -1
- package/public-api/PrivyClient.mjs +5 -0
- package/public-api/PrivyClient.mjs.map +1 -1
- package/public-api/services/apps.d.mts +25 -0
- package/public-api/services/apps.d.mts.map +1 -0
- package/public-api/services/apps.d.ts +25 -0
- package/public-api/services/apps.d.ts.map +1 -0
- package/public-api/services/apps.js +56 -0
- package/public-api/services/apps.js.map +1 -0
- package/public-api/services/apps.mjs +52 -0
- package/public-api/services/apps.mjs.map +1 -0
- package/public-api/services/policies.d.mts +6 -2
- package/public-api/services/policies.d.mts.map +1 -1
- package/public-api/services/policies.d.ts +6 -2
- package/public-api/services/policies.d.ts.map +1 -1
- package/public-api/services/policies.js +6 -0
- package/public-api/services/policies.js.map +1 -1
- package/public-api/services/policies.mjs +6 -0
- package/public-api/services/policies.mjs.map +1 -1
- package/public-api/services/wallets.d.mts +5 -1
- package/public-api/services/wallets.d.mts.map +1 -1
- package/public-api/services/wallets.d.ts +5 -1
- package/public-api/services/wallets.d.ts.map +1 -1
- package/public-api/services/wallets.js +6 -0
- package/public-api/services/wallets.js.map +1 -1
- package/public-api/services/wallets.mjs +6 -0
- package/public-api/services/wallets.mjs.map +1 -1
- package/resources/accounts.d.mts +182 -4
- package/resources/accounts.d.mts.map +1 -1
- package/resources/accounts.d.ts +182 -4
- package/resources/accounts.d.ts.map +1 -1
- package/resources/apps/allowlist.d.mts +81 -0
- package/resources/apps/allowlist.d.mts.map +1 -0
- package/resources/apps/allowlist.d.ts +81 -0
- package/resources/apps/allowlist.d.ts.map +1 -0
- package/resources/apps/allowlist.js +56 -0
- package/resources/apps/allowlist.js.map +1 -0
- package/resources/apps/allowlist.mjs +52 -0
- package/resources/apps/allowlist.mjs.map +1 -0
- package/resources/apps/apps.d.mts +238 -0
- package/resources/apps/apps.d.mts.map +1 -0
- package/resources/apps/apps.d.ts +238 -0
- package/resources/apps/apps.d.ts.map +1 -0
- package/resources/apps/apps.js +44 -0
- package/resources/apps/apps.js.map +1 -0
- package/resources/apps/apps.mjs +39 -0
- package/resources/apps/apps.mjs.map +1 -0
- package/resources/apps/index.d.mts +3 -0
- package/resources/apps/index.d.mts.map +1 -0
- package/resources/apps/index.d.ts +3 -0
- package/resources/apps/index.d.ts.map +1 -0
- package/resources/apps/index.js +9 -0
- package/resources/apps/index.js.map +1 -0
- package/resources/apps/index.mjs +4 -0
- package/resources/apps/index.mjs.map +1 -0
- package/resources/apps.d.mts +1 -151
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +1 -151
- package/resources/apps.d.ts.map +1 -1
- package/resources/apps.js +2 -5
- package/resources/apps.js.map +1 -1
- package/resources/apps.mjs +1 -3
- package/resources/apps.mjs.map +1 -1
- package/resources/client-auth.d.mts +144 -1
- package/resources/client-auth.d.mts.map +1 -1
- package/resources/client-auth.d.ts +144 -1
- package/resources/client-auth.d.ts.map +1 -1
- package/resources/index.d.mts +11 -10
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +11 -10
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -2
- package/resources/index.mjs.map +1 -1
- package/resources/intents.d.mts +2815 -31
- package/resources/intents.d.mts.map +1 -1
- package/resources/intents.d.ts +2815 -31
- package/resources/intents.d.ts.map +1 -1
- package/resources/intents.js +156 -0
- package/resources/intents.js.map +1 -1
- package/resources/intents.mjs +156 -0
- package/resources/intents.mjs.map +1 -1
- package/resources/key-quorums.d.mts +45 -2
- package/resources/key-quorums.d.mts.map +1 -1
- package/resources/key-quorums.d.ts +45 -2
- package/resources/key-quorums.d.ts.map +1 -1
- package/resources/key-quorums.js +18 -1
- package/resources/key-quorums.js.map +1 -1
- package/resources/key-quorums.mjs +18 -1
- package/resources/key-quorums.mjs.map +1 -1
- package/resources/kraken-embed.d.mts +62 -0
- package/resources/kraken-embed.d.mts.map +1 -0
- package/resources/kraken-embed.d.ts +62 -0
- package/resources/kraken-embed.d.ts.map +1 -0
- package/resources/kraken-embed.js +9 -0
- package/resources/kraken-embed.js.map +1 -0
- package/resources/kraken-embed.mjs +5 -0
- package/resources/kraken-embed.mjs.map +1 -0
- package/resources/policies.d.mts +63 -56
- package/resources/policies.d.mts.map +1 -1
- package/resources/policies.d.ts +63 -56
- package/resources/policies.d.ts.map +1 -1
- package/resources/policies.js +3 -0
- package/resources/policies.js.map +1 -1
- package/resources/policies.mjs +3 -0
- package/resources/policies.mjs.map +1 -1
- package/resources/transactions.d.mts +3 -0
- package/resources/transactions.d.mts.map +1 -1
- package/resources/transactions.d.ts +3 -0
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js +3 -0
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs +3 -0
- package/resources/transactions.mjs.map +1 -1
- package/resources/users.d.mts +50 -47
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts +50 -47
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +3 -0
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +3 -0
- package/resources/users.mjs.map +1 -1
- package/resources/wallets/balance.d.mts +7 -4
- package/resources/wallets/balance.d.mts.map +1 -1
- package/resources/wallets/balance.d.ts +7 -4
- package/resources/wallets/balance.d.ts.map +1 -1
- package/resources/wallets/balance.js +3 -0
- package/resources/wallets/balance.js.map +1 -1
- package/resources/wallets/balance.mjs +3 -0
- package/resources/wallets/balance.mjs.map +1 -1
- package/resources/wallets/index.d.mts +1 -1
- package/resources/wallets/index.d.mts.map +1 -1
- package/resources/wallets/index.d.ts +1 -1
- package/resources/wallets/index.d.ts.map +1 -1
- package/resources/wallets/index.js.map +1 -1
- package/resources/wallets/index.mjs.map +1 -1
- package/resources/wallets/transactions.d.mts +9 -6
- package/resources/wallets/transactions.d.mts.map +1 -1
- package/resources/wallets/transactions.d.ts +9 -6
- package/resources/wallets/transactions.d.ts.map +1 -1
- package/resources/wallets/transactions.js +3 -0
- package/resources/wallets/transactions.js.map +1 -1
- package/resources/wallets/transactions.mjs +3 -0
- package/resources/wallets/transactions.mjs.map +1 -1
- package/resources/wallets/wallets.d.mts +126 -69
- package/resources/wallets/wallets.d.mts.map +1 -1
- package/resources/wallets/wallets.d.ts +126 -69
- package/resources/wallets/wallets.d.ts.map +1 -1
- package/resources/wallets/wallets.js +11 -5
- package/resources/wallets/wallets.js.map +1 -1
- package/resources/wallets/wallets.mjs +11 -5
- package/resources/wallets/wallets.mjs.map +1 -1
- package/resources/webhooks.d.mts +319 -283
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +319 -283
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs.map +1 -1
- package/resources/yield.d.mts +26 -9
- package/resources/yield.d.mts.map +1 -1
- package/resources/yield.d.ts +26 -9
- package/resources/yield.d.ts.map +1 -1
- package/src/client.ts +196 -37
- package/src/index.ts +10 -0
- package/src/public-api/PrivyClient.ts +7 -0
- package/src/public-api/services/apps.ts +85 -0
- package/src/public-api/services/policies.ts +15 -1
- package/src/public-api/services/wallets.ts +14 -0
- package/src/resources/accounts.ts +217 -3
- package/src/resources/apps/allowlist.ts +126 -0
- package/src/resources/apps/apps.ts +391 -0
- package/src/resources/apps/index.ts +20 -0
- package/src/resources/apps.ts +1 -257
- package/src/resources/client-auth.ts +202 -0
- package/src/resources/index.ts +93 -21
- package/src/resources/intents.ts +4579 -40
- package/src/resources/key-quorums.ts +50 -2
- package/src/resources/kraken-embed.ts +85 -0
- package/src/resources/policies.ts +83 -76
- package/src/resources/transactions.ts +3 -0
- package/src/resources/users.ts +66 -63
- package/src/resources/wallets/balance.ts +9 -2
- package/src/resources/wallets/index.ts +4 -2
- package/src/resources/wallets/transactions.ts +10 -4
- package/src/resources/wallets/wallets.ts +171 -93
- package/src/resources/webhooks.ts +454 -438
- package/src/resources/yield.ts +39 -10
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/client.ts
CHANGED
|
@@ -20,12 +20,19 @@ import * as Uploads from './core/uploads';
|
|
|
20
20
|
import * as API from './resources/index';
|
|
21
21
|
import { APIPromise } from './core/api-promise';
|
|
22
22
|
import {
|
|
23
|
+
AccountBalanceParams,
|
|
24
|
+
AccountBalanceResponse,
|
|
25
|
+
AccountDisplayName,
|
|
23
26
|
AccountResponse,
|
|
24
27
|
AccountWallet,
|
|
25
28
|
AccountWalletConfigurationItem,
|
|
29
|
+
AccountWalletsConfiguration,
|
|
26
30
|
Accounts,
|
|
31
|
+
AccountsDashboardListResponse,
|
|
27
32
|
AccountsListResponse,
|
|
33
|
+
AssetAccountWithBalance,
|
|
28
34
|
CreateAccountInput,
|
|
35
|
+
UpdateAccountInput,
|
|
29
36
|
} from './resources/accounts';
|
|
30
37
|
import {
|
|
31
38
|
Aggregation,
|
|
@@ -37,7 +44,6 @@ import {
|
|
|
37
44
|
Aggregations,
|
|
38
45
|
} from './resources/aggregations';
|
|
39
46
|
import { Analytics, AnalyticsEventInput } from './resources/analytics';
|
|
40
|
-
import { AppResponse, Apps } from './resources/apps';
|
|
41
47
|
import {
|
|
42
48
|
BridgeBrlFiatVirtualAccountDepositInstructions,
|
|
43
49
|
BridgeDestinationAsset,
|
|
@@ -57,19 +63,59 @@ import {
|
|
|
57
63
|
BridgeSandboxFiatVirtualAccountResponse,
|
|
58
64
|
BridgeSourceAsset,
|
|
59
65
|
BridgeUsdFiatVirtualAccountDepositInstructions,
|
|
66
|
+
Caip2ChainID,
|
|
60
67
|
ClientAuth,
|
|
61
68
|
CreateOrUpdateFiatCustomerRequestInput,
|
|
69
|
+
CryptoCurrencyCode,
|
|
62
70
|
CustomOAuthProviderID,
|
|
63
71
|
ExternalOAuthProviderID,
|
|
72
|
+
FiatAmount,
|
|
73
|
+
FiatCurrencyCode,
|
|
64
74
|
FiatCustomerResponse,
|
|
75
|
+
FiatOnrampDestination,
|
|
76
|
+
FiatOnrampEnvironment,
|
|
77
|
+
FiatOnrampProvider,
|
|
78
|
+
FiatOnrampQuote,
|
|
79
|
+
FiatOnrampSource,
|
|
80
|
+
FiatOnrampTransactionStatus,
|
|
65
81
|
FiatVirtualAccountRequest,
|
|
66
82
|
FiatVirtualAccountResponse,
|
|
67
83
|
GetFiatCustomerRequestInput,
|
|
84
|
+
GetFiatOnrampQuotesInput,
|
|
85
|
+
GetFiatOnrampQuotesResponse,
|
|
86
|
+
GetFiatOnrampTransactionStatusInput,
|
|
87
|
+
GetFiatOnrampTransactionStatusResponse,
|
|
88
|
+
GetFiatOnrampURLInput,
|
|
89
|
+
GetFiatOnrampURLResponse,
|
|
68
90
|
OAuthProviderID,
|
|
69
91
|
OnrampProvider,
|
|
70
92
|
PrivyOAuthProviderID,
|
|
71
93
|
} from './resources/client-auth';
|
|
72
|
-
import {
|
|
94
|
+
import {
|
|
95
|
+
BaseActionResult,
|
|
96
|
+
IntentAuthorization,
|
|
97
|
+
IntentAuthorizationKeyQuorumMember,
|
|
98
|
+
IntentAuthorizationMember,
|
|
99
|
+
IntentCreatePolicyRuleParams,
|
|
100
|
+
IntentDeletePolicyRuleParams,
|
|
101
|
+
IntentListParams,
|
|
102
|
+
IntentResponse,
|
|
103
|
+
IntentResponsesCursor,
|
|
104
|
+
IntentRpcParams,
|
|
105
|
+
IntentStatus,
|
|
106
|
+
IntentType,
|
|
107
|
+
IntentUpdateKeyQuorumParams,
|
|
108
|
+
IntentUpdatePolicyParams,
|
|
109
|
+
IntentUpdatePolicyRuleParams,
|
|
110
|
+
IntentUpdateWalletParams,
|
|
111
|
+
Intents,
|
|
112
|
+
KeyQuorumIntentResponse,
|
|
113
|
+
PolicyIntentResponse,
|
|
114
|
+
RpcIntentResponse,
|
|
115
|
+
RuleIntentRequestDetails,
|
|
116
|
+
RuleIntentResponse,
|
|
117
|
+
WalletIntentResponse,
|
|
118
|
+
} from './resources/intents';
|
|
73
119
|
import {
|
|
74
120
|
KeyQuorum,
|
|
75
121
|
KeyQuorumCreateParams,
|
|
@@ -78,6 +124,12 @@ import {
|
|
|
78
124
|
KeyQuorumUpdateParams,
|
|
79
125
|
KeyQuorums,
|
|
80
126
|
} from './resources/key-quorums';
|
|
127
|
+
import {
|
|
128
|
+
KrakenEmbed,
|
|
129
|
+
KrakenEmbedCurrentDayPnl,
|
|
130
|
+
KrakenEmbedGetPortfolioSummaryQueryParams,
|
|
131
|
+
KrakenEmbedGetPortfolioSummaryResponse,
|
|
132
|
+
} from './resources/kraken-embed';
|
|
81
133
|
import {
|
|
82
134
|
Policies,
|
|
83
135
|
Policy,
|
|
@@ -191,14 +243,16 @@ import {
|
|
|
191
243
|
import {
|
|
192
244
|
FundsDepositedWebhookPayload,
|
|
193
245
|
FundsWithdrawnWebhookPayload,
|
|
246
|
+
IntentAuthorizedWebhookPayload,
|
|
247
|
+
IntentCreatedWebhookPayload,
|
|
248
|
+
IntentExecutedWebhookPayload,
|
|
249
|
+
IntentFailedWebhookPayload,
|
|
194
250
|
KrakenEmbedQuoteCancelledWebhookPayload,
|
|
195
251
|
KrakenEmbedQuoteExecutedWebhookPayload,
|
|
196
252
|
KrakenEmbedQuoteExecutionFailedWebhookPayload,
|
|
197
253
|
KrakenEmbedUserClosedWebhookPayload,
|
|
198
254
|
KrakenEmbedUserDisabledWebhookPayload,
|
|
199
255
|
KrakenEmbedUserVerifiedWebhookPayload,
|
|
200
|
-
KrakenEmbedVerificationCompletedWebhookPayload,
|
|
201
|
-
KrakenEmbedVerificationFailedWebhookPayload,
|
|
202
256
|
MfaDisabledWebhookPayload,
|
|
203
257
|
MfaEnabledWebhookPayload,
|
|
204
258
|
PrivateKeyExportWebhookPayload,
|
|
@@ -212,13 +266,16 @@ import {
|
|
|
212
266
|
UserAuthenticatedWebhookPayload,
|
|
213
267
|
UserCreatedWebhookPayload,
|
|
214
268
|
UserLinkedAccountWebhookPayload,
|
|
269
|
+
UserOperationCompletedWebhookPayload,
|
|
215
270
|
UserTransferredAccountWebhookPayload,
|
|
216
271
|
UserUnlinkedAccountWebhookPayload,
|
|
217
272
|
UserUpdatedAccountWebhookPayload,
|
|
218
273
|
UserWalletCreatedWebhookPayload,
|
|
219
274
|
WalletRecoveredWebhookPayload,
|
|
220
275
|
WalletRecoverySetupWebhookPayload,
|
|
276
|
+
WebhookPayload,
|
|
221
277
|
Webhooks,
|
|
278
|
+
YieldClaimConfirmedWebhookPayload,
|
|
222
279
|
YieldDepositConfirmedWebhookPayload,
|
|
223
280
|
YieldWithdrawConfirmedWebhookPayload,
|
|
224
281
|
} from './resources/webhooks';
|
|
@@ -227,6 +284,7 @@ import {
|
|
|
227
284
|
EthereumVaultDetailsResponse,
|
|
228
285
|
EthereumVaultPosition,
|
|
229
286
|
EthereumVaultResponse,
|
|
287
|
+
EthereumYieldClaimIDInput,
|
|
230
288
|
EthereumYieldClaimInput,
|
|
231
289
|
EthereumYieldClaimResponse,
|
|
232
290
|
EthereumYieldClaimReward,
|
|
@@ -242,6 +300,18 @@ import {
|
|
|
242
300
|
EvmCaip2ChainID,
|
|
243
301
|
Yield,
|
|
244
302
|
} from './resources/yield';
|
|
303
|
+
import {
|
|
304
|
+
AllowlistDeletionResponse,
|
|
305
|
+
AllowlistEntry,
|
|
306
|
+
AppResponse,
|
|
307
|
+
Apps,
|
|
308
|
+
EmailInviteInput,
|
|
309
|
+
PhoneInviteInput,
|
|
310
|
+
TestAccount,
|
|
311
|
+
TestAccountsResponse,
|
|
312
|
+
UserInviteInput,
|
|
313
|
+
WalletInviteInput,
|
|
314
|
+
} from './resources/apps/apps';
|
|
245
315
|
import {
|
|
246
316
|
CurveSigningChainType,
|
|
247
317
|
CustodialWallet,
|
|
@@ -292,9 +362,11 @@ import {
|
|
|
292
362
|
WalletRawSignParams,
|
|
293
363
|
WalletRawSignResponse,
|
|
294
364
|
WalletRpcParams,
|
|
365
|
+
WalletRpcRequestBody,
|
|
295
366
|
WalletRpcResponse,
|
|
296
367
|
WalletSubmitImportParams,
|
|
297
368
|
WalletUpdateParams,
|
|
369
|
+
WalletUpdateRequestBody,
|
|
298
370
|
Wallets,
|
|
299
371
|
WalletsCursor,
|
|
300
372
|
} from './resources/wallets/wallets';
|
|
@@ -582,8 +654,9 @@ export class PrivyAPI {
|
|
|
582
654
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
583
655
|
|
|
584
656
|
const defaultQuery = this.defaultQuery();
|
|
585
|
-
|
|
586
|
-
|
|
657
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
658
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
659
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
587
660
|
}
|
|
588
661
|
|
|
589
662
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
@@ -916,9 +989,9 @@ export class PrivyAPI {
|
|
|
916
989
|
}
|
|
917
990
|
}
|
|
918
991
|
|
|
919
|
-
// If the API asks us to wait a certain amount of time
|
|
920
|
-
//
|
|
921
|
-
if (
|
|
992
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
993
|
+
// says, but otherwise calculate a default
|
|
994
|
+
if (timeoutMillis === undefined) {
|
|
922
995
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
923
996
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
924
997
|
}
|
|
@@ -1078,18 +1151,34 @@ export class PrivyAPI {
|
|
|
1078
1151
|
static toFile = Uploads.toFile;
|
|
1079
1152
|
|
|
1080
1153
|
wallets: API.Wallets = new API.Wallets(this);
|
|
1154
|
+
/**
|
|
1155
|
+
* Operations related to users
|
|
1156
|
+
*/
|
|
1081
1157
|
users: API.Users = new API.Users(this);
|
|
1158
|
+
/**
|
|
1159
|
+
* Operations related to policies
|
|
1160
|
+
*/
|
|
1082
1161
|
policies: API.Policies = new API.Policies(this);
|
|
1162
|
+
/**
|
|
1163
|
+
* Operations related to transactions
|
|
1164
|
+
*/
|
|
1083
1165
|
transactions: API.Transactions = new API.Transactions(this);
|
|
1166
|
+
/**
|
|
1167
|
+
* Operations related to key quorums
|
|
1168
|
+
*/
|
|
1084
1169
|
keyQuorums: API.KeyQuorums = new API.KeyQuorums(this);
|
|
1170
|
+
intents: API.Intents = new API.Intents(this);
|
|
1171
|
+
/**
|
|
1172
|
+
* Operations related to app settings and allowlist management
|
|
1173
|
+
*/
|
|
1174
|
+
apps: API.Apps = new API.Apps(this);
|
|
1085
1175
|
clientAuth: API.ClientAuth = new API.ClientAuth(this);
|
|
1086
1176
|
analytics: API.Analytics = new API.Analytics(this);
|
|
1087
|
-
apps: API.Apps = new API.Apps(this);
|
|
1088
1177
|
aggregations: API.Aggregations = new API.Aggregations(this);
|
|
1089
1178
|
webhooks: API.Webhooks = new API.Webhooks(this);
|
|
1090
1179
|
accounts: API.Accounts = new API.Accounts(this);
|
|
1091
1180
|
yield: API.Yield = new API.Yield(this);
|
|
1092
|
-
|
|
1181
|
+
krakenEmbed: API.KrakenEmbed = new API.KrakenEmbed(this);
|
|
1093
1182
|
}
|
|
1094
1183
|
|
|
1095
1184
|
PrivyAPI.Wallets = Wallets;
|
|
@@ -1097,14 +1186,15 @@ PrivyAPI.Users = Users;
|
|
|
1097
1186
|
PrivyAPI.Policies = Policies;
|
|
1098
1187
|
PrivyAPI.Transactions = Transactions;
|
|
1099
1188
|
PrivyAPI.KeyQuorums = KeyQuorums;
|
|
1189
|
+
PrivyAPI.Intents = Intents;
|
|
1190
|
+
PrivyAPI.Apps = Apps;
|
|
1100
1191
|
PrivyAPI.ClientAuth = ClientAuth;
|
|
1101
1192
|
PrivyAPI.Analytics = Analytics;
|
|
1102
|
-
PrivyAPI.Apps = Apps;
|
|
1103
1193
|
PrivyAPI.Aggregations = Aggregations;
|
|
1104
1194
|
PrivyAPI.Webhooks = Webhooks;
|
|
1105
1195
|
PrivyAPI.Accounts = Accounts;
|
|
1106
1196
|
PrivyAPI.Yield = Yield;
|
|
1107
|
-
PrivyAPI.
|
|
1197
|
+
PrivyAPI.KrakenEmbed = KrakenEmbed;
|
|
1108
1198
|
|
|
1109
1199
|
export declare namespace PrivyAPI {
|
|
1110
1200
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -1114,7 +1204,6 @@ export declare namespace PrivyAPI {
|
|
|
1114
1204
|
|
|
1115
1205
|
export {
|
|
1116
1206
|
Wallets as Wallets,
|
|
1117
|
-
type Wallet as Wallet,
|
|
1118
1207
|
type CurveSigningChainType as CurveSigningChainType,
|
|
1119
1208
|
type ExtendedChainType as ExtendedChainType,
|
|
1120
1209
|
type FirstClassChainType as FirstClassChainType,
|
|
@@ -1126,6 +1215,8 @@ export declare namespace PrivyAPI {
|
|
|
1126
1215
|
type CustodialWallet as CustodialWallet,
|
|
1127
1216
|
type HpkeImportConfig as HpkeImportConfig,
|
|
1128
1217
|
type SuiCommandName as SuiCommandName,
|
|
1218
|
+
type Wallet as Wallet,
|
|
1219
|
+
type WalletUpdateRequestBody as WalletUpdateRequestBody,
|
|
1129
1220
|
type WalletBatchItemInput as WalletBatchItemInput,
|
|
1130
1221
|
type WalletBatchCreateInput as WalletBatchCreateInput,
|
|
1131
1222
|
type WalletBatchCreateResult as WalletBatchCreateResult,
|
|
@@ -1150,10 +1241,11 @@ export declare namespace PrivyAPI {
|
|
|
1150
1241
|
type SolanaSignTransactionRpcResponse as SolanaSignTransactionRpcResponse,
|
|
1151
1242
|
type SolanaSignAndSendTransactionRpcResponse as SolanaSignAndSendTransactionRpcResponse,
|
|
1152
1243
|
type SolanaSignMessageRpcResponse as SolanaSignMessageRpcResponse,
|
|
1244
|
+
type WalletRpcRequestBody as WalletRpcRequestBody,
|
|
1245
|
+
type WalletRpcResponse as WalletRpcResponse,
|
|
1153
1246
|
type WalletExportResponse as WalletExportResponse,
|
|
1154
1247
|
type WalletInitImportResponse as WalletInitImportResponse,
|
|
1155
1248
|
type WalletRawSignResponse as WalletRawSignResponse,
|
|
1156
|
-
type WalletRpcResponse as WalletRpcResponse,
|
|
1157
1249
|
type WalletAuthenticateWithJwtResponse as WalletAuthenticateWithJwtResponse,
|
|
1158
1250
|
type WalletCreateWalletsWithRecoveryResponse as WalletCreateWalletsWithRecoveryResponse,
|
|
1159
1251
|
type WalletsCursor as WalletsCursor,
|
|
@@ -1171,8 +1263,6 @@ export declare namespace PrivyAPI {
|
|
|
1171
1263
|
|
|
1172
1264
|
export {
|
|
1173
1265
|
Users as Users,
|
|
1174
|
-
type AuthenticatedUser as AuthenticatedUser,
|
|
1175
|
-
type User as User,
|
|
1176
1266
|
type LinkedAccountEmail as LinkedAccountEmail,
|
|
1177
1267
|
type LinkedAccountPhone as LinkedAccountPhone,
|
|
1178
1268
|
type LinkedAccountBaseWallet as LinkedAccountBaseWallet,
|
|
@@ -1235,8 +1325,10 @@ export declare namespace PrivyAPI {
|
|
|
1235
1325
|
type TotpMfaMethod as TotpMfaMethod,
|
|
1236
1326
|
type PasskeyMfaMethod as PasskeyMfaMethod,
|
|
1237
1327
|
type LinkedMfaMethod as LinkedMfaMethod,
|
|
1328
|
+
type User as User,
|
|
1238
1329
|
type OAuthTokens as OAuthTokens,
|
|
1239
1330
|
type UserWithIdentityToken as UserWithIdentityToken,
|
|
1331
|
+
type AuthenticatedUser as AuthenticatedUser,
|
|
1240
1332
|
type UsersCursor as UsersCursor,
|
|
1241
1333
|
type UserCreateParams as UserCreateParams,
|
|
1242
1334
|
type UserListParams as UserListParams,
|
|
@@ -1260,12 +1352,12 @@ export declare namespace PrivyAPI {
|
|
|
1260
1352
|
|
|
1261
1353
|
export {
|
|
1262
1354
|
Policies as Policies,
|
|
1263
|
-
type Policy as Policy,
|
|
1264
1355
|
type SuiTransactionCommandOperator as SuiTransactionCommandOperator,
|
|
1265
1356
|
type SuiTransferObjectsCommandField as SuiTransferObjectsCommandField,
|
|
1266
1357
|
type TronTransactionCondition as TronTransactionCondition,
|
|
1267
1358
|
type SuiTransactionCommandCondition as SuiTransactionCommandCondition,
|
|
1268
1359
|
type SuiTransferObjectsCommandCondition as SuiTransferObjectsCommandCondition,
|
|
1360
|
+
type Policy as Policy,
|
|
1269
1361
|
type PolicyCreateRuleResponse as PolicyCreateRuleResponse,
|
|
1270
1362
|
type PolicyDeleteResponse as PolicyDeleteResponse,
|
|
1271
1363
|
type PolicyDeleteRuleResponse as PolicyDeleteRuleResponse,
|
|
@@ -1284,13 +1376,52 @@ export declare namespace PrivyAPI {
|
|
|
1284
1376
|
|
|
1285
1377
|
export {
|
|
1286
1378
|
KeyQuorums as KeyQuorums,
|
|
1379
|
+
type KeyQuorumCreateParams as KeyQuorumCreateParams,
|
|
1287
1380
|
type KeyQuorum as KeyQuorum,
|
|
1288
1381
|
type KeyQuorumDeleteResponse as KeyQuorumDeleteResponse,
|
|
1289
|
-
type KeyQuorumCreateParams as KeyQuorumCreateParams,
|
|
1290
1382
|
type KeyQuorumDeleteParams as KeyQuorumDeleteParams,
|
|
1291
1383
|
type KeyQuorumUpdateParams as KeyQuorumUpdateParams,
|
|
1292
1384
|
};
|
|
1293
1385
|
|
|
1386
|
+
export {
|
|
1387
|
+
Intents as Intents,
|
|
1388
|
+
type IntentType as IntentType,
|
|
1389
|
+
type IntentStatus as IntentStatus,
|
|
1390
|
+
type RuleIntentRequestDetails as RuleIntentRequestDetails,
|
|
1391
|
+
type IntentAuthorizationKeyQuorumMember as IntentAuthorizationKeyQuorumMember,
|
|
1392
|
+
type IntentAuthorizationMember as IntentAuthorizationMember,
|
|
1393
|
+
type IntentAuthorization as IntentAuthorization,
|
|
1394
|
+
type BaseActionResult as BaseActionResult,
|
|
1395
|
+
type RpcIntentResponse as RpcIntentResponse,
|
|
1396
|
+
type WalletIntentResponse as WalletIntentResponse,
|
|
1397
|
+
type PolicyIntentResponse as PolicyIntentResponse,
|
|
1398
|
+
type KeyQuorumIntentResponse as KeyQuorumIntentResponse,
|
|
1399
|
+
type RuleIntentResponse as RuleIntentResponse,
|
|
1400
|
+
type IntentResponse as IntentResponse,
|
|
1401
|
+
type IntentResponsesCursor as IntentResponsesCursor,
|
|
1402
|
+
type IntentListParams as IntentListParams,
|
|
1403
|
+
type IntentCreatePolicyRuleParams as IntentCreatePolicyRuleParams,
|
|
1404
|
+
type IntentDeletePolicyRuleParams as IntentDeletePolicyRuleParams,
|
|
1405
|
+
type IntentRpcParams as IntentRpcParams,
|
|
1406
|
+
type IntentUpdateKeyQuorumParams as IntentUpdateKeyQuorumParams,
|
|
1407
|
+
type IntentUpdatePolicyParams as IntentUpdatePolicyParams,
|
|
1408
|
+
type IntentUpdatePolicyRuleParams as IntentUpdatePolicyRuleParams,
|
|
1409
|
+
type IntentUpdateWalletParams as IntentUpdateWalletParams,
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
export {
|
|
1413
|
+
Apps as Apps,
|
|
1414
|
+
type AppResponse as AppResponse,
|
|
1415
|
+
type EmailInviteInput as EmailInviteInput,
|
|
1416
|
+
type WalletInviteInput as WalletInviteInput,
|
|
1417
|
+
type PhoneInviteInput as PhoneInviteInput,
|
|
1418
|
+
type UserInviteInput as UserInviteInput,
|
|
1419
|
+
type AllowlistEntry as AllowlistEntry,
|
|
1420
|
+
type AllowlistDeletionResponse as AllowlistDeletionResponse,
|
|
1421
|
+
type TestAccount as TestAccount,
|
|
1422
|
+
type TestAccountsResponse as TestAccountsResponse,
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1294
1425
|
export {
|
|
1295
1426
|
ClientAuth as ClientAuth,
|
|
1296
1427
|
type ExternalOAuthProviderID as ExternalOAuthProviderID,
|
|
@@ -1305,6 +1436,22 @@ export declare namespace PrivyAPI {
|
|
|
1305
1436
|
type BridgeFiatCustomerResponse as BridgeFiatCustomerResponse,
|
|
1306
1437
|
type BridgeSandboxFiatCustomerResponse as BridgeSandboxFiatCustomerResponse,
|
|
1307
1438
|
type FiatCustomerResponse as FiatCustomerResponse,
|
|
1439
|
+
type FiatCurrencyCode as FiatCurrencyCode,
|
|
1440
|
+
type CryptoCurrencyCode as CryptoCurrencyCode,
|
|
1441
|
+
type Caip2ChainID as Caip2ChainID,
|
|
1442
|
+
type FiatAmount as FiatAmount,
|
|
1443
|
+
type FiatOnrampSource as FiatOnrampSource,
|
|
1444
|
+
type FiatOnrampDestination as FiatOnrampDestination,
|
|
1445
|
+
type FiatOnrampEnvironment as FiatOnrampEnvironment,
|
|
1446
|
+
type FiatOnrampProvider as FiatOnrampProvider,
|
|
1447
|
+
type GetFiatOnrampQuotesInput as GetFiatOnrampQuotesInput,
|
|
1448
|
+
type FiatOnrampQuote as FiatOnrampQuote,
|
|
1449
|
+
type GetFiatOnrampQuotesResponse as GetFiatOnrampQuotesResponse,
|
|
1450
|
+
type GetFiatOnrampURLInput as GetFiatOnrampURLInput,
|
|
1451
|
+
type GetFiatOnrampURLResponse as GetFiatOnrampURLResponse,
|
|
1452
|
+
type FiatOnrampTransactionStatus as FiatOnrampTransactionStatus,
|
|
1453
|
+
type GetFiatOnrampTransactionStatusInput as GetFiatOnrampTransactionStatusInput,
|
|
1454
|
+
type GetFiatOnrampTransactionStatusResponse as GetFiatOnrampTransactionStatusResponse,
|
|
1308
1455
|
type BridgeDestinationAsset as BridgeDestinationAsset,
|
|
1309
1456
|
type BridgeSourceAsset as BridgeSourceAsset,
|
|
1310
1457
|
type BridgeFiatVirtualAccountSource as BridgeFiatVirtualAccountSource,
|
|
@@ -1325,8 +1472,6 @@ export declare namespace PrivyAPI {
|
|
|
1325
1472
|
|
|
1326
1473
|
export { Analytics as Analytics, type AnalyticsEventInput as AnalyticsEventInput };
|
|
1327
1474
|
|
|
1328
|
-
export { Apps as Apps, type AppResponse as AppResponse };
|
|
1329
|
-
|
|
1330
1475
|
export {
|
|
1331
1476
|
Aggregations as Aggregations,
|
|
1332
1477
|
type AggregationMethod as AggregationMethod,
|
|
@@ -1339,13 +1484,12 @@ export declare namespace PrivyAPI {
|
|
|
1339
1484
|
|
|
1340
1485
|
export {
|
|
1341
1486
|
Webhooks as Webhooks,
|
|
1342
|
-
type
|
|
1343
|
-
type
|
|
1344
|
-
type
|
|
1345
|
-
type
|
|
1346
|
-
type
|
|
1347
|
-
type
|
|
1348
|
-
type UserWalletCreatedWebhookPayload as UserWalletCreatedWebhookPayload,
|
|
1487
|
+
type IntentCreatedWebhookPayload as IntentCreatedWebhookPayload,
|
|
1488
|
+
type IntentAuthorizedWebhookPayload as IntentAuthorizedWebhookPayload,
|
|
1489
|
+
type IntentExecutedWebhookPayload as IntentExecutedWebhookPayload,
|
|
1490
|
+
type IntentFailedWebhookPayload as IntentFailedWebhookPayload,
|
|
1491
|
+
type MfaEnabledWebhookPayload as MfaEnabledWebhookPayload,
|
|
1492
|
+
type MfaDisabledWebhookPayload as MfaDisabledWebhookPayload,
|
|
1349
1493
|
type TransactionBroadcastedWebhookPayload as TransactionBroadcastedWebhookPayload,
|
|
1350
1494
|
type TransactionConfirmedWebhookPayload as TransactionConfirmedWebhookPayload,
|
|
1351
1495
|
type TransactionExecutionRevertedWebhookPayload as TransactionExecutionRevertedWebhookPayload,
|
|
@@ -1353,23 +1497,29 @@ export declare namespace PrivyAPI {
|
|
|
1353
1497
|
type TransactionFailedWebhookPayload as TransactionFailedWebhookPayload,
|
|
1354
1498
|
type TransactionReplacedWebhookPayload as TransactionReplacedWebhookPayload,
|
|
1355
1499
|
type TransactionProviderErrorWebhookPayload as TransactionProviderErrorWebhookPayload,
|
|
1500
|
+
type UserOperationCompletedWebhookPayload as UserOperationCompletedWebhookPayload,
|
|
1501
|
+
type UserCreatedWebhookPayload as UserCreatedWebhookPayload,
|
|
1502
|
+
type UserAuthenticatedWebhookPayload as UserAuthenticatedWebhookPayload,
|
|
1503
|
+
type UserLinkedAccountWebhookPayload as UserLinkedAccountWebhookPayload,
|
|
1504
|
+
type UserUnlinkedAccountWebhookPayload as UserUnlinkedAccountWebhookPayload,
|
|
1505
|
+
type UserUpdatedAccountWebhookPayload as UserUpdatedAccountWebhookPayload,
|
|
1506
|
+
type UserTransferredAccountWebhookPayload as UserTransferredAccountWebhookPayload,
|
|
1507
|
+
type UserWalletCreatedWebhookPayload as UserWalletCreatedWebhookPayload,
|
|
1356
1508
|
type FundsDepositedWebhookPayload as FundsDepositedWebhookPayload,
|
|
1357
1509
|
type FundsWithdrawnWebhookPayload as FundsWithdrawnWebhookPayload,
|
|
1358
1510
|
type PrivateKeyExportWebhookPayload as PrivateKeyExportWebhookPayload,
|
|
1359
1511
|
type WalletRecoverySetupWebhookPayload as WalletRecoverySetupWebhookPayload,
|
|
1360
1512
|
type WalletRecoveredWebhookPayload as WalletRecoveredWebhookPayload,
|
|
1361
|
-
type
|
|
1362
|
-
type
|
|
1363
|
-
type
|
|
1364
|
-
type
|
|
1513
|
+
type YieldDepositConfirmedWebhookPayload as YieldDepositConfirmedWebhookPayload,
|
|
1514
|
+
type YieldWithdrawConfirmedWebhookPayload as YieldWithdrawConfirmedWebhookPayload,
|
|
1515
|
+
type YieldClaimConfirmedWebhookPayload as YieldClaimConfirmedWebhookPayload,
|
|
1516
|
+
type WebhookPayload as WebhookPayload,
|
|
1365
1517
|
type KrakenEmbedQuoteExecutedWebhookPayload as KrakenEmbedQuoteExecutedWebhookPayload,
|
|
1366
1518
|
type KrakenEmbedQuoteExecutionFailedWebhookPayload as KrakenEmbedQuoteExecutionFailedWebhookPayload,
|
|
1367
1519
|
type KrakenEmbedQuoteCancelledWebhookPayload as KrakenEmbedQuoteCancelledWebhookPayload,
|
|
1368
1520
|
type KrakenEmbedUserVerifiedWebhookPayload as KrakenEmbedUserVerifiedWebhookPayload,
|
|
1369
1521
|
type KrakenEmbedUserDisabledWebhookPayload as KrakenEmbedUserDisabledWebhookPayload,
|
|
1370
1522
|
type KrakenEmbedUserClosedWebhookPayload as KrakenEmbedUserClosedWebhookPayload,
|
|
1371
|
-
type YieldDepositConfirmedWebhookPayload as YieldDepositConfirmedWebhookPayload,
|
|
1372
|
-
type YieldWithdrawConfirmedWebhookPayload as YieldWithdrawConfirmedWebhookPayload,
|
|
1373
1523
|
};
|
|
1374
1524
|
|
|
1375
1525
|
export {
|
|
@@ -1377,8 +1527,15 @@ export declare namespace PrivyAPI {
|
|
|
1377
1527
|
type AccountWallet as AccountWallet,
|
|
1378
1528
|
type AccountResponse as AccountResponse,
|
|
1379
1529
|
type AccountWalletConfigurationItem as AccountWalletConfigurationItem,
|
|
1530
|
+
type AccountDisplayName as AccountDisplayName,
|
|
1531
|
+
type AccountWalletsConfiguration as AccountWalletsConfiguration,
|
|
1380
1532
|
type CreateAccountInput as CreateAccountInput,
|
|
1533
|
+
type UpdateAccountInput as UpdateAccountInput,
|
|
1381
1534
|
type AccountsListResponse as AccountsListResponse,
|
|
1535
|
+
type AssetAccountWithBalance as AssetAccountWithBalance,
|
|
1536
|
+
type AccountsDashboardListResponse as AccountsDashboardListResponse,
|
|
1537
|
+
type AccountBalanceResponse as AccountBalanceResponse,
|
|
1538
|
+
type AccountBalanceParams as AccountBalanceParams,
|
|
1382
1539
|
};
|
|
1383
1540
|
|
|
1384
1541
|
export {
|
|
@@ -1400,11 +1557,13 @@ export declare namespace PrivyAPI {
|
|
|
1400
1557
|
type EthereumYieldClaimInput as EthereumYieldClaimInput,
|
|
1401
1558
|
type EthereumYieldClaimReward as EthereumYieldClaimReward,
|
|
1402
1559
|
type EthereumYieldClaimResponse as EthereumYieldClaimResponse,
|
|
1560
|
+
type EthereumYieldClaimIDInput as EthereumYieldClaimIDInput,
|
|
1403
1561
|
};
|
|
1404
1562
|
|
|
1405
1563
|
export {
|
|
1406
|
-
|
|
1407
|
-
type
|
|
1408
|
-
type
|
|
1564
|
+
KrakenEmbed as KrakenEmbed,
|
|
1565
|
+
type KrakenEmbedGetPortfolioSummaryQueryParams as KrakenEmbedGetPortfolioSummaryQueryParams,
|
|
1566
|
+
type KrakenEmbedCurrentDayPnl as KrakenEmbedCurrentDayPnl,
|
|
1567
|
+
type KrakenEmbedGetPortfolioSummaryResponse as KrakenEmbedGetPortfolioSummaryResponse,
|
|
1409
1568
|
};
|
|
1410
1569
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { type PrivyPoliciesService } from './public-api/services/policies';
|
|
|
6
6
|
export { type PrivyTransactionsService } from './public-api/services/transactions';
|
|
7
7
|
export { type PrivyKeyQuorumsService } from './public-api/services/key-quorums';
|
|
8
8
|
export { type PrivyUsersService } from './public-api/services/users';
|
|
9
|
+
export { type PrivyAppsService } from './public-api/services/apps';
|
|
9
10
|
export { type PrivyUtils } from './public-api/services/utils';
|
|
10
11
|
export {
|
|
11
12
|
InvalidAuthTokenError,
|
|
@@ -20,6 +21,15 @@ export {
|
|
|
20
21
|
} from './lib/auth';
|
|
21
22
|
|
|
22
23
|
export { type User, type LinkedAccountEmbeddedWallet, type LinkedAccount } from './resources/users';
|
|
24
|
+
export {
|
|
25
|
+
type AppResponse,
|
|
26
|
+
type AllowlistEntry,
|
|
27
|
+
type AllowlistDeletionResponse,
|
|
28
|
+
type UserInviteInput,
|
|
29
|
+
type EmailInviteInput,
|
|
30
|
+
type WalletInviteInput,
|
|
31
|
+
type PhoneInviteInput,
|
|
32
|
+
} from './resources/apps/apps';
|
|
23
33
|
export { type Wallet } from './resources/wallets';
|
|
24
34
|
export { type Policy } from './resources/policies';
|
|
25
35
|
export { type KeyQuorum } from './resources/key-quorums';
|
|
@@ -5,6 +5,7 @@ import { PrivyPoliciesService } from './services/policies';
|
|
|
5
5
|
import { PrivyTransactionsService } from './services/transactions';
|
|
6
6
|
import { PrivyKeyQuorumsService } from './services/key-quorums';
|
|
7
7
|
import { PrivyUsersService } from './services/users';
|
|
8
|
+
import { PrivyAppsService } from './services/apps';
|
|
8
9
|
import { PrivyUtils } from './services/utils';
|
|
9
10
|
import { JwtExchangeService } from '../lib/jwt-exchange';
|
|
10
11
|
import { VERSION } from '../version';
|
|
@@ -31,6 +32,7 @@ export class PrivyClient {
|
|
|
31
32
|
private transactionsService: PrivyTransactionsService;
|
|
32
33
|
private keyQuorumsService: PrivyKeyQuorumsService;
|
|
33
34
|
private usersService: PrivyUsersService;
|
|
35
|
+
private appsService: PrivyAppsService;
|
|
34
36
|
private utilsService: PrivyUtils;
|
|
35
37
|
private jwtExchangeService: JwtExchangeService;
|
|
36
38
|
|
|
@@ -76,6 +78,7 @@ export class PrivyClient {
|
|
|
76
78
|
this.transactionsService = new PrivyTransactionsService(this.privyApiClient);
|
|
77
79
|
this.keyQuorumsService = new PrivyKeyQuorumsService(this.privyApiClient, this);
|
|
78
80
|
this.usersService = new PrivyUsersService(this.privyApiClient, appJwks);
|
|
81
|
+
this.appsService = new PrivyAppsService(this.privyApiClient);
|
|
79
82
|
this.utilsService = new PrivyUtils(this.privyApiClient, this, appJwks);
|
|
80
83
|
this.webhooksService = new PrivyWebhooksService(webhookSigningSecret);
|
|
81
84
|
}
|
|
@@ -104,6 +107,10 @@ export class PrivyClient {
|
|
|
104
107
|
return this.usersService;
|
|
105
108
|
}
|
|
106
109
|
|
|
110
|
+
public apps(): PrivyAppsService {
|
|
111
|
+
return this.appsService;
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
public utils(): PrivyUtils {
|
|
108
115
|
return this.utilsService;
|
|
109
116
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { PrivyAPI } from '../../client';
|
|
2
|
+
import type {
|
|
3
|
+
AllowlistEntry,
|
|
4
|
+
AllowlistDeletionResponse,
|
|
5
|
+
AppResponse,
|
|
6
|
+
UserInviteInput,
|
|
7
|
+
} from '../../resources/apps/apps';
|
|
8
|
+
import type { AllowlistListResponse } from '../../resources/apps/allowlist';
|
|
9
|
+
import { Apps } from '../../resources/apps/apps';
|
|
10
|
+
import { AuthenticatedUser } from '../../resources';
|
|
11
|
+
|
|
12
|
+
export class PrivyAppsService extends Apps {
|
|
13
|
+
constructor(privyApiClient: PrivyAPI) {
|
|
14
|
+
super(privyApiClient);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async getAllowlist(): Promise<AllowlistListResponse> {
|
|
18
|
+
return this.allowlist.list(this._client.appID);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async inviteToAllowlist(entry: UserInviteInput): Promise<AllowlistEntry> {
|
|
22
|
+
return this.allowlist.create(this._client.appID, entry);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async removeFromAllowlist(entry: UserInviteInput): Promise<AllowlistDeletionResponse> {
|
|
26
|
+
return this.allowlist.delete(this._client.appID, entry);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async getSettings(): Promise<AppResponse> {
|
|
30
|
+
return this.get(this._client.appID);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async getTestAccessToken(
|
|
34
|
+
params?: PrivyAppsService.GetTestAccessTokenParams,
|
|
35
|
+
): Promise<PrivyAppsService.TestAccessTokenResponse> {
|
|
36
|
+
const { data: testAccounts } = await this.getTestCredentials(this._client.appID);
|
|
37
|
+
|
|
38
|
+
if (!testAccounts || testAccounts.length === 0) {
|
|
39
|
+
throw new Error('No test accounts found for this app. Create test accounts in the Privy dashboard.');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let account;
|
|
43
|
+
if (params && 'email' in params) {
|
|
44
|
+
account = testAccounts.find((a) => a.email === params.email);
|
|
45
|
+
if (!account) {
|
|
46
|
+
throw new Error(
|
|
47
|
+
`No test account found with email "${params.email}". Available: ${testAccounts
|
|
48
|
+
.map((a) => a.email)
|
|
49
|
+
.join(', ')}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
} else if (params && 'phone_number' in params) {
|
|
53
|
+
account = testAccounts.find((a) => a.phone_number === params.phone_number);
|
|
54
|
+
if (!account) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`No test account found with phone number "${params.phone_number}". Available: ${testAccounts
|
|
57
|
+
.map((a) => a.phone_number)
|
|
58
|
+
.join(', ')}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
account = testAccounts[0]!;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const authResponse = await this._client.post<AuthenticatedUser>('/v1/passwordless/authenticate', {
|
|
66
|
+
body: { email: account.email, code: account.otp_code },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (!authResponse.token) {
|
|
70
|
+
throw new Error('Unable to authenticate with the test account.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { access_token: authResponse.token };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export namespace PrivyAppsService {
|
|
78
|
+
export type GetTestAccessTokenParams =
|
|
79
|
+
| { email: string; phone_number?: never }
|
|
80
|
+
| { phone_number: string; email?: never };
|
|
81
|
+
|
|
82
|
+
export interface TestAccessTokenResponse {
|
|
83
|
+
access_token: string;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Prettify } from 'viem';
|
|
2
2
|
import { PrivyAPI } from '../../client';
|
|
3
|
+
import { APIPromise } from '../../core/api-promise';
|
|
3
4
|
import { generateAuthorizationSignatures } from '../../lib/authorization';
|
|
4
5
|
import {
|
|
5
6
|
Policies,
|
|
6
7
|
Policy,
|
|
8
|
+
PolicyCreateParams,
|
|
7
9
|
PolicyCreateRuleParams,
|
|
8
10
|
PolicyCreateRuleResponse,
|
|
9
11
|
PolicyDeleteParams,
|
|
@@ -15,7 +17,7 @@ import {
|
|
|
15
17
|
PolicyUpdateRuleResponse,
|
|
16
18
|
} from '../../resources';
|
|
17
19
|
import { PrivyClient } from '../PrivyClient';
|
|
18
|
-
import { WithAuthorization } from './types';
|
|
20
|
+
import { WithAuthorization, WithIdempotency } from './types';
|
|
19
21
|
|
|
20
22
|
export class PrivyPoliciesService extends Policies {
|
|
21
23
|
private privyClient: PrivyClient;
|
|
@@ -25,6 +27,16 @@ export class PrivyPoliciesService extends Policies {
|
|
|
25
27
|
this.privyClient = privyClient;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
public override create({
|
|
31
|
+
idempotency_key: idempotencyKey,
|
|
32
|
+
...params
|
|
33
|
+
}: PrivyPoliciesService.CreateInput): APIPromise<Policy> {
|
|
34
|
+
return super.create({
|
|
35
|
+
...params,
|
|
36
|
+
...(idempotencyKey && { 'privy-idempotency-key': idempotencyKey }),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
public async update(
|
|
29
41
|
policyId: string,
|
|
30
42
|
{ authorization_context: authorizationContext = {}, ...params }: PrivyPoliciesService.UpdateInput,
|
|
@@ -162,6 +174,8 @@ export class PrivyPoliciesService extends Policies {
|
|
|
162
174
|
}
|
|
163
175
|
|
|
164
176
|
export namespace PrivyPoliciesService {
|
|
177
|
+
/** The input type for the {@link PrivyPoliciesService.create} method. */
|
|
178
|
+
export type CreateInput = Prettify<WithIdempotency<PolicyCreateParams>>;
|
|
165
179
|
/** The input type for the {@link PrivyPoliciesService.update} method. */
|
|
166
180
|
export type UpdateInput = Prettify<WithAuthorization<PolicyUpdateParams>>;
|
|
167
181
|
/** The input type for the {@link PrivyPoliciesService.delete} method. */
|