@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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { PrivyAPI } from '../../client';
|
|
2
|
+
import { APIPromise } from '../../core/api-promise';
|
|
2
3
|
import { PrivyAPIError } from '../../core/error';
|
|
3
4
|
import { generateAuthorizationSignatures } from '../../lib/authorization';
|
|
4
5
|
import { setupHPKERecipient, setupHPKESender } from '../../lib/cryptography';
|
|
5
6
|
import { entropyToBytes } from '../../lib/wallet-entropy';
|
|
6
7
|
import {
|
|
7
8
|
Wallet,
|
|
9
|
+
WalletCreateParams,
|
|
8
10
|
WalletExportParams,
|
|
9
11
|
WalletRawSignParams,
|
|
10
12
|
WalletRawSignResponse,
|
|
@@ -39,6 +41,16 @@ export class PrivyWalletsService extends Wallets {
|
|
|
39
41
|
return this.solanaService;
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
public override create({
|
|
45
|
+
idempotency_key: idempotencyKey,
|
|
46
|
+
...params
|
|
47
|
+
}: PrivyWalletsService.CreateInput): APIPromise<Wallet> {
|
|
48
|
+
return super.create({
|
|
49
|
+
...params,
|
|
50
|
+
...(idempotencyKey && { 'privy-idempotency-key': idempotencyKey }),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
public async rpc<Params extends PrivyWalletsService.RpcInput>(
|
|
43
55
|
walletId: string,
|
|
44
56
|
params: Params,
|
|
@@ -218,6 +230,8 @@ export class PrivyWalletsService extends Wallets {
|
|
|
218
230
|
* @see {@link PrivyWalletsService} class.
|
|
219
231
|
*/
|
|
220
232
|
export namespace PrivyWalletsService {
|
|
233
|
+
/** The input type for the {@link PrivyWalletsService.create} method. */
|
|
234
|
+
export type CreateInput = Prettify<WithIdempotency<WalletCreateParams>>;
|
|
221
235
|
/** The input type for the {@link PrivyWalletsService.rpc} method. */
|
|
222
236
|
export type RpcInput = Prettify<WithIdempotency<WithAuthorization<WalletRpcParams>>>;
|
|
223
237
|
/** The input type for the {@link PrivyWalletsService.rawSign} method. */
|
|
@@ -65,19 +65,44 @@ export interface AccountWalletConfigurationItem {
|
|
|
65
65
|
custody?: WalletsAPI.WalletCustodian;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* An optional display name for the account.
|
|
70
|
+
*/
|
|
71
|
+
export type AccountDisplayName = string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Configuration for the wallets on this account.
|
|
75
|
+
*/
|
|
76
|
+
export type AccountWalletsConfiguration = Array<AccountWalletConfigurationItem>;
|
|
77
|
+
|
|
68
78
|
/**
|
|
69
79
|
* Input for creating a digital asset account.
|
|
70
80
|
*/
|
|
71
81
|
export interface CreateAccountInput {
|
|
72
82
|
/**
|
|
73
|
-
* Configuration for wallets
|
|
83
|
+
* Configuration for the wallets on this account.
|
|
74
84
|
*/
|
|
75
|
-
wallets_configuration:
|
|
85
|
+
wallets_configuration: AccountWalletsConfiguration;
|
|
76
86
|
|
|
77
87
|
/**
|
|
78
88
|
* An optional display name for the account.
|
|
79
89
|
*/
|
|
80
|
-
display_name?:
|
|
90
|
+
display_name?: AccountDisplayName;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Input for updating a digital asset account.
|
|
95
|
+
*/
|
|
96
|
+
export interface UpdateAccountInput {
|
|
97
|
+
/**
|
|
98
|
+
* An optional display name for the account.
|
|
99
|
+
*/
|
|
100
|
+
display_name?: AccountDisplayName;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Configuration for the wallets on this account.
|
|
104
|
+
*/
|
|
105
|
+
wallets_configuration?: AccountWalletsConfiguration;
|
|
81
106
|
}
|
|
82
107
|
|
|
83
108
|
/**
|
|
@@ -95,12 +120,201 @@ export interface AccountsListResponse {
|
|
|
95
120
|
next_cursor: string | null;
|
|
96
121
|
}
|
|
97
122
|
|
|
123
|
+
/**
|
|
124
|
+
* A digital asset account with its aggregated balance across all wallets and
|
|
125
|
+
* chains.
|
|
126
|
+
*/
|
|
127
|
+
export interface AssetAccountWithBalance {
|
|
128
|
+
/**
|
|
129
|
+
* The account ID.
|
|
130
|
+
*/
|
|
131
|
+
id: string;
|
|
132
|
+
|
|
133
|
+
balance: AssetAccountWithBalance.Balance;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* An optional display name for the account.
|
|
137
|
+
*/
|
|
138
|
+
display_name: string | null;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The wallets belonging to this account.
|
|
142
|
+
*/
|
|
143
|
+
wallets: Array<AccountWallet>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export namespace AssetAccountWithBalance {
|
|
147
|
+
export interface Balance {
|
|
148
|
+
/**
|
|
149
|
+
* The individual asset balances, each computed across all supported chains.
|
|
150
|
+
*/
|
|
151
|
+
assets: Array<Balance.Asset>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The total balance across all assets.
|
|
155
|
+
*/
|
|
156
|
+
total: Balance.Total;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export namespace Balance {
|
|
160
|
+
export interface Asset {
|
|
161
|
+
/**
|
|
162
|
+
* The amount of the asset held, denominated in the unit of the asset itself, with
|
|
163
|
+
* 1 decimal of precision.
|
|
164
|
+
*/
|
|
165
|
+
amount: string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The price of the asset in the provided currency.
|
|
169
|
+
*/
|
|
170
|
+
price: Asset.Price;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The symbol of the asset (e.g. USDC, ETH).
|
|
174
|
+
*/
|
|
175
|
+
symbol: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export namespace Asset {
|
|
179
|
+
/**
|
|
180
|
+
* The price of the asset in the provided currency.
|
|
181
|
+
*/
|
|
182
|
+
export interface Price {
|
|
183
|
+
/**
|
|
184
|
+
* The currency code.
|
|
185
|
+
*/
|
|
186
|
+
currency: 'usd';
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The monetary value as a string.
|
|
190
|
+
*/
|
|
191
|
+
value: string;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The total balance across all assets.
|
|
197
|
+
*/
|
|
198
|
+
export interface Total {
|
|
199
|
+
/**
|
|
200
|
+
* The currency code.
|
|
201
|
+
*/
|
|
202
|
+
currency: 'usd';
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The monetary value as a string.
|
|
206
|
+
*/
|
|
207
|
+
value: string;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Paginated list of digital asset accounts for the dashboard.
|
|
214
|
+
*/
|
|
215
|
+
export interface AccountsDashboardListResponse {
|
|
216
|
+
/**
|
|
217
|
+
* The list of accounts, with balances included for dashboard display.
|
|
218
|
+
*/
|
|
219
|
+
data: Array<AssetAccountWithBalance>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Cursor for fetching the next page of results, or null if no more results.
|
|
223
|
+
*/
|
|
224
|
+
next_cursor: string | null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* The balance of a digital asset account, aggregated across all wallets and
|
|
229
|
+
* supported chains.
|
|
230
|
+
*/
|
|
231
|
+
export interface AccountBalanceResponse {
|
|
232
|
+
/**
|
|
233
|
+
* The individual asset balances, each computed across all supported chains.
|
|
234
|
+
*/
|
|
235
|
+
assets: Array<AccountBalanceResponse.Asset>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The total balance across all assets.
|
|
239
|
+
*/
|
|
240
|
+
total: AccountBalanceResponse.Total;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export namespace AccountBalanceResponse {
|
|
244
|
+
export interface Asset {
|
|
245
|
+
/**
|
|
246
|
+
* The amount of the asset held, denominated in the unit of the asset itself, with
|
|
247
|
+
* 1 decimal of precision.
|
|
248
|
+
*/
|
|
249
|
+
amount: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The price of the asset in the provided currency.
|
|
253
|
+
*/
|
|
254
|
+
price: Asset.Price;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The symbol of the asset (e.g. USDC, ETH).
|
|
258
|
+
*/
|
|
259
|
+
symbol: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export namespace Asset {
|
|
263
|
+
/**
|
|
264
|
+
* The price of the asset in the provided currency.
|
|
265
|
+
*/
|
|
266
|
+
export interface Price {
|
|
267
|
+
/**
|
|
268
|
+
* The currency code.
|
|
269
|
+
*/
|
|
270
|
+
currency: 'usd';
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The monetary value as a string.
|
|
274
|
+
*/
|
|
275
|
+
value: string;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The total balance across all assets.
|
|
281
|
+
*/
|
|
282
|
+
export interface Total {
|
|
283
|
+
/**
|
|
284
|
+
* The currency code.
|
|
285
|
+
*/
|
|
286
|
+
currency: 'usd';
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The monetary value as a string.
|
|
290
|
+
*/
|
|
291
|
+
value: string;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Query parameters for the account balance endpoint.
|
|
297
|
+
*/
|
|
298
|
+
export interface AccountBalanceParams {
|
|
299
|
+
/**
|
|
300
|
+
* When set to true, returns balances from testnet chains instead of mainnets.
|
|
301
|
+
*/
|
|
302
|
+
testnet_mode?: 'true' | 'false';
|
|
303
|
+
}
|
|
304
|
+
|
|
98
305
|
export declare namespace Accounts {
|
|
99
306
|
export {
|
|
100
307
|
type AccountWallet as AccountWallet,
|
|
101
308
|
type AccountResponse as AccountResponse,
|
|
102
309
|
type AccountWalletConfigurationItem as AccountWalletConfigurationItem,
|
|
310
|
+
type AccountDisplayName as AccountDisplayName,
|
|
311
|
+
type AccountWalletsConfiguration as AccountWalletsConfiguration,
|
|
103
312
|
type CreateAccountInput as CreateAccountInput,
|
|
313
|
+
type UpdateAccountInput as UpdateAccountInput,
|
|
104
314
|
type AccountsListResponse as AccountsListResponse,
|
|
315
|
+
type AssetAccountWithBalance as AssetAccountWithBalance,
|
|
316
|
+
type AccountsDashboardListResponse as AccountsDashboardListResponse,
|
|
317
|
+
type AccountBalanceResponse as AccountBalanceResponse,
|
|
318
|
+
type AccountBalanceParams as AccountBalanceParams,
|
|
105
319
|
};
|
|
106
320
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as AppsAPI from './apps';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Operations related to app settings and allowlist management
|
|
11
|
+
*/
|
|
12
|
+
export class Allowlist extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Add a new entry to the allowlist for an app. The allowlist must be enabled.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const allowlistEntry = await client.apps.allowlist.create(
|
|
19
|
+
* 'app_id',
|
|
20
|
+
* { type: 'email', value: 'batman@privy.io' },
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
create(
|
|
25
|
+
appID: string,
|
|
26
|
+
body: AllowlistCreateParams,
|
|
27
|
+
options?: RequestOptions,
|
|
28
|
+
): APIPromise<AppsAPI.AllowlistEntry> {
|
|
29
|
+
return this._client.post(path`/v1/apps/${appID}/allowlist`, { body, ...options });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get all allowlist entries for an app. Returns the list of users allowed to
|
|
34
|
+
* access the app when the allowlist is enabled.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const allowlistEntries = await client.apps.allowlist.list(
|
|
39
|
+
* 'app_id',
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
list(appID: string, options?: RequestOptions): APIPromise<AllowlistListResponse> {
|
|
44
|
+
return this._client.get(path`/v1/apps/${appID}/allowlist`, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Remove an entry from the allowlist for an app. The allowlist must be enabled.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const allowlistDeletionResponse =
|
|
53
|
+
* await client.apps.allowlist.delete('app_id', {
|
|
54
|
+
* type: 'email',
|
|
55
|
+
* value: 'batman@privy.io',
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
delete(
|
|
60
|
+
appID: string,
|
|
61
|
+
body: AllowlistDeleteParams,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): APIPromise<AppsAPI.AllowlistDeletionResponse> {
|
|
64
|
+
return this._client.delete(path`/v1/apps/${appID}/allowlist`, { body, ...options });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type AllowlistListResponse = Array<AppsAPI.AllowlistEntry>;
|
|
69
|
+
|
|
70
|
+
export type AllowlistCreateParams =
|
|
71
|
+
| AllowlistCreateParams.EmailInviteInput
|
|
72
|
+
| AllowlistCreateParams.WalletInviteInput
|
|
73
|
+
| AllowlistCreateParams.PhoneInviteInput;
|
|
74
|
+
|
|
75
|
+
export declare namespace AllowlistCreateParams {
|
|
76
|
+
export interface EmailInviteInput {
|
|
77
|
+
type: 'email';
|
|
78
|
+
|
|
79
|
+
value: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface WalletInviteInput {
|
|
83
|
+
type: 'wallet';
|
|
84
|
+
|
|
85
|
+
value: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface PhoneInviteInput {
|
|
89
|
+
type: 'phone';
|
|
90
|
+
|
|
91
|
+
value: string;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type AllowlistDeleteParams =
|
|
96
|
+
| AllowlistDeleteParams.EmailInviteInput
|
|
97
|
+
| AllowlistDeleteParams.WalletInviteInput
|
|
98
|
+
| AllowlistDeleteParams.PhoneInviteInput;
|
|
99
|
+
|
|
100
|
+
export declare namespace AllowlistDeleteParams {
|
|
101
|
+
export interface EmailInviteInput {
|
|
102
|
+
type: 'email';
|
|
103
|
+
|
|
104
|
+
value: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface WalletInviteInput {
|
|
108
|
+
type: 'wallet';
|
|
109
|
+
|
|
110
|
+
value: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface PhoneInviteInput {
|
|
114
|
+
type: 'phone';
|
|
115
|
+
|
|
116
|
+
value: string;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare namespace Allowlist {
|
|
121
|
+
export {
|
|
122
|
+
type AllowlistListResponse as AllowlistListResponse,
|
|
123
|
+
type AllowlistCreateParams as AllowlistCreateParams,
|
|
124
|
+
type AllowlistDeleteParams as AllowlistDeleteParams,
|
|
125
|
+
};
|
|
126
|
+
}
|