@privy-io/api-types 0.10.0 → 0.12.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 +27 -0
- package/client.d.mts +22 -28
- package/client.d.mts.map +1 -1
- package/client.d.ts +22 -28
- package/client.d.ts.map +1 -1
- package/client.js +6 -12
- package/client.js.map +1 -1
- package/client.mjs +7 -13
- package/client.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/apps.d.mts +5 -0
- package/resources/apps.d.mts.map +1 -1
- package/resources/apps.d.ts +5 -0
- package/resources/apps.d.ts.map +1 -1
- package/resources/client-auth.d.mts +496 -514
- package/resources/client-auth.d.mts.map +1 -1
- package/resources/client-auth.d.ts +496 -514
- package/resources/client-auth.d.ts.map +1 -1
- package/resources/client-auth.js.map +1 -1
- package/resources/client-auth.mjs.map +1 -1
- package/resources/cross-app.d.mts +5 -0
- package/resources/cross-app.d.mts.map +1 -1
- package/resources/cross-app.d.ts +5 -0
- package/resources/cross-app.d.ts.map +1 -1
- package/resources/embedded-wallets.d.mts +10 -10
- package/resources/embedded-wallets.d.mts.map +1 -1
- package/resources/embedded-wallets.d.ts +10 -10
- package/resources/embedded-wallets.d.ts.map +1 -1
- package/resources/fiat.d.mts +110 -0
- package/resources/fiat.d.mts.map +1 -0
- package/resources/fiat.d.ts +110 -0
- package/resources/fiat.d.ts.map +1 -0
- package/resources/fiat.js +9 -0
- package/resources/fiat.js.map +1 -0
- package/resources/fiat.mjs +5 -0
- package/resources/fiat.mjs.map +1 -0
- package/resources/funding.d.mts +46 -46
- package/resources/funding.d.mts.map +1 -1
- package/resources/funding.d.ts +46 -46
- package/resources/funding.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 +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/key-quorums.d.mts +1 -132
- package/resources/key-quorums.d.mts.map +1 -1
- package/resources/key-quorums.d.ts +1 -132
- package/resources/key-quorums.d.ts.map +1 -1
- package/resources/key-quorums.js +0 -92
- package/resources/key-quorums.js.map +1 -1
- package/resources/key-quorums.mjs +0 -92
- package/resources/key-quorums.mjs.map +1 -1
- package/resources/policies.d.mts +2 -312
- package/resources/policies.d.mts.map +1 -1
- package/resources/policies.d.ts +2 -312
- package/resources/policies.d.ts.map +1 -1
- package/resources/policies.js +0 -229
- package/resources/policies.js.map +1 -1
- package/resources/policies.mjs +0 -229
- package/resources/policies.mjs.map +1 -1
- package/resources/swaps.d.mts +54 -26
- package/resources/swaps.d.mts.map +1 -1
- package/resources/swaps.d.ts +54 -26
- package/resources/swaps.d.ts.map +1 -1
- package/resources/transactions.d.mts +28 -44
- package/resources/transactions.d.mts.map +1 -1
- package/resources/transactions.d.ts +28 -44
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js +0 -17
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs +0 -17
- package/resources/transactions.mjs.map +1 -1
- package/resources/users.d.mts +1 -345
- package/resources/users.d.mts.map +1 -1
- package/resources/users.d.ts +1 -345
- package/resources/users.d.ts.map +1 -1
- package/resources/users.js +0 -272
- package/resources/users.js.map +1 -1
- package/resources/users.mjs +0 -272
- package/resources/users.mjs.map +1 -1
- package/resources/wallet-actions.d.mts +22 -3
- package/resources/wallet-actions.d.mts.map +1 -1
- package/resources/wallet-actions.d.ts +22 -3
- package/resources/wallet-actions.d.ts.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 +6 -2
- package/resources/wallets/transactions.d.mts.map +1 -1
- package/resources/wallets/transactions.d.ts +6 -2
- package/resources/wallets/transactions.d.ts.map +1 -1
- package/resources/wallets/wallets.d.mts +184 -342
- package/resources/wallets/wallets.d.mts.map +1 -1
- package/resources/wallets/wallets.d.ts +184 -342
- package/resources/wallets/wallets.d.ts.map +1 -1
- package/resources/wallets/wallets.js +41 -102
- package/resources/wallets/wallets.js.map +1 -1
- package/resources/wallets/wallets.mjs +41 -102
- package/resources/wallets/wallets.mjs.map +1 -1
- package/src/client.ts +122 -153
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/apps.ts +6 -0
- package/src/resources/client-auth.ts +743 -787
- package/src/resources/cross-app.ts +6 -0
- package/src/resources/embedded-wallets.ts +16 -15
- package/src/resources/fiat.ts +177 -0
- package/src/resources/funding.ts +65 -65
- package/src/resources/index.ts +97 -107
- package/src/resources/key-quorums.ts +1 -203
- package/src/resources/policies.ts +1 -495
- package/src/resources/swaps.ts +59 -25
- package/src/resources/transactions.ts +35 -55
- package/src/resources/users.ts +1 -479
- package/src/resources/wallet-actions.ts +38 -2
- package/src/resources/wallets/index.ts +4 -9
- package/src/resources/wallets/transactions.ts +6 -2
- package/src/resources/wallets/wallets.ts +236 -450
- 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
|
@@ -4,287 +4,8 @@ import { APIResource } from '../core/resource';
|
|
|
4
4
|
import * as PoliciesAPI from './policies';
|
|
5
5
|
import * as SharedAPI from './shared';
|
|
6
6
|
import * as WalletsAPI from './wallets/wallets';
|
|
7
|
-
import { APIPromise } from '../core/api-promise';
|
|
8
|
-
import { buildHeaders } from '../internal/headers';
|
|
9
|
-
import { RequestOptions } from '../internal/request-options';
|
|
10
|
-
import { path } from '../internal/utils/path';
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
* Operations related to policies
|
|
14
|
-
*/
|
|
15
|
-
export class Policies extends APIResource {
|
|
16
|
-
/**
|
|
17
|
-
* Create a new policy.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* const policy = await client.policies.create({
|
|
22
|
-
* chain_type: 'ethereum',
|
|
23
|
-
* name: 'x',
|
|
24
|
-
* rules: [
|
|
25
|
-
* {
|
|
26
|
-
* action: 'ALLOW',
|
|
27
|
-
* conditions: [
|
|
28
|
-
* {
|
|
29
|
-
* field: 'to',
|
|
30
|
-
* field_source: 'ethereum_transaction',
|
|
31
|
-
* operator: 'eq',
|
|
32
|
-
* value: 'string',
|
|
33
|
-
* },
|
|
34
|
-
* ],
|
|
35
|
-
* method: 'eth_sendTransaction',
|
|
36
|
-
* name: 'x',
|
|
37
|
-
* },
|
|
38
|
-
* ],
|
|
39
|
-
* version: '1.0',
|
|
40
|
-
* });
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
create(params: PolicyCreateParams, options?: RequestOptions): APIPromise<Policy> {
|
|
44
|
-
const { 'privy-idempotency-key': privyIdempotencyKey, ...body } = params;
|
|
45
|
-
return this._client.post('/v1/policies', {
|
|
46
|
-
body,
|
|
47
|
-
...options,
|
|
48
|
-
headers: buildHeaders([
|
|
49
|
-
{ ...(privyIdempotencyKey != null ? { 'privy-idempotency-key': privyIdempotencyKey } : undefined) },
|
|
50
|
-
options?.headers,
|
|
51
|
-
]),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create a new rule for a policy.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* const policyRuleResponse =
|
|
61
|
-
* await client.policies._createRule(
|
|
62
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
63
|
-
* {
|
|
64
|
-
* action: 'ALLOW',
|
|
65
|
-
* conditions: [
|
|
66
|
-
* {
|
|
67
|
-
* field: 'to',
|
|
68
|
-
* field_source: 'ethereum_transaction',
|
|
69
|
-
* operator: 'eq',
|
|
70
|
-
* value: 'string',
|
|
71
|
-
* },
|
|
72
|
-
* ],
|
|
73
|
-
* method: 'eth_sendTransaction',
|
|
74
|
-
* name: 'x',
|
|
75
|
-
* },
|
|
76
|
-
* );
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
_createRule(
|
|
80
|
-
policyID: string,
|
|
81
|
-
params: PolicyCreateRuleParams,
|
|
82
|
-
options?: RequestOptions,
|
|
83
|
-
): APIPromise<PolicyRuleResponse> {
|
|
84
|
-
const {
|
|
85
|
-
'privy-authorization-signature': privyAuthorizationSignature,
|
|
86
|
-
'privy-request-expiry': privyRequestExpiry,
|
|
87
|
-
...body
|
|
88
|
-
} = params;
|
|
89
|
-
return this._client.post(path`/v1/policies/${policyID}/rules`, {
|
|
90
|
-
body,
|
|
91
|
-
...options,
|
|
92
|
-
headers: buildHeaders([
|
|
93
|
-
{
|
|
94
|
-
...(privyAuthorizationSignature != null ?
|
|
95
|
-
{ 'privy-authorization-signature': privyAuthorizationSignature }
|
|
96
|
-
: undefined),
|
|
97
|
-
...(privyRequestExpiry != null ? { 'privy-request-expiry': privyRequestExpiry } : undefined),
|
|
98
|
-
},
|
|
99
|
-
options?.headers,
|
|
100
|
-
]),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Delete a policy by policy ID.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```ts
|
|
109
|
-
* const successResponse = await client.policies._delete(
|
|
110
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
111
|
-
* );
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
_delete(
|
|
115
|
-
policyID: string,
|
|
116
|
-
params: PolicyDeleteParams | null | undefined = {},
|
|
117
|
-
options?: RequestOptions,
|
|
118
|
-
): APIPromise<SharedAPI.SuccessResponse> {
|
|
119
|
-
const {
|
|
120
|
-
'privy-authorization-signature': privyAuthorizationSignature,
|
|
121
|
-
'privy-request-expiry': privyRequestExpiry,
|
|
122
|
-
} = params ?? {};
|
|
123
|
-
return this._client.delete(path`/v1/policies/${policyID}`, {
|
|
124
|
-
...options,
|
|
125
|
-
headers: buildHeaders([
|
|
126
|
-
{
|
|
127
|
-
...(privyAuthorizationSignature != null ?
|
|
128
|
-
{ 'privy-authorization-signature': privyAuthorizationSignature }
|
|
129
|
-
: undefined),
|
|
130
|
-
...(privyRequestExpiry != null ? { 'privy-request-expiry': privyRequestExpiry } : undefined),
|
|
131
|
-
},
|
|
132
|
-
options?.headers,
|
|
133
|
-
]),
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Delete a rule by policy ID and rule ID.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* const successResponse = await client.policies._deleteRule(
|
|
143
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
144
|
-
* { policy_id: 'xxxxxxxxxxxxxxxxxxxxxxxx' },
|
|
145
|
-
* );
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
_deleteRule(
|
|
149
|
-
ruleID: string,
|
|
150
|
-
params: PolicyDeleteRuleParams,
|
|
151
|
-
options?: RequestOptions,
|
|
152
|
-
): APIPromise<SharedAPI.SuccessResponse> {
|
|
153
|
-
const {
|
|
154
|
-
policy_id,
|
|
155
|
-
'privy-authorization-signature': privyAuthorizationSignature,
|
|
156
|
-
'privy-request-expiry': privyRequestExpiry,
|
|
157
|
-
} = params;
|
|
158
|
-
return this._client.delete(path`/v1/policies/${policy_id}/rules/${ruleID}`, {
|
|
159
|
-
...options,
|
|
160
|
-
headers: buildHeaders([
|
|
161
|
-
{
|
|
162
|
-
...(privyAuthorizationSignature != null ?
|
|
163
|
-
{ 'privy-authorization-signature': privyAuthorizationSignature }
|
|
164
|
-
: undefined),
|
|
165
|
-
...(privyRequestExpiry != null ? { 'privy-request-expiry': privyRequestExpiry } : undefined),
|
|
166
|
-
},
|
|
167
|
-
options?.headers,
|
|
168
|
-
]),
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Update a policy by policy ID.
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```ts
|
|
177
|
-
* const policy = await client.policies._update(
|
|
178
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
179
|
-
* );
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
_update(policyID: string, params: PolicyUpdateParams, options?: RequestOptions): APIPromise<Policy> {
|
|
183
|
-
const {
|
|
184
|
-
'privy-authorization-signature': privyAuthorizationSignature,
|
|
185
|
-
'privy-request-expiry': privyRequestExpiry,
|
|
186
|
-
...body
|
|
187
|
-
} = params;
|
|
188
|
-
return this._client.patch(path`/v1/policies/${policyID}`, {
|
|
189
|
-
body,
|
|
190
|
-
...options,
|
|
191
|
-
headers: buildHeaders([
|
|
192
|
-
{
|
|
193
|
-
...(privyAuthorizationSignature != null ?
|
|
194
|
-
{ 'privy-authorization-signature': privyAuthorizationSignature }
|
|
195
|
-
: undefined),
|
|
196
|
-
...(privyRequestExpiry != null ? { 'privy-request-expiry': privyRequestExpiry } : undefined),
|
|
197
|
-
},
|
|
198
|
-
options?.headers,
|
|
199
|
-
]),
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Update a rule by policy ID and rule ID.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* const policyRuleResponse =
|
|
209
|
-
* await client.policies._updateRule(
|
|
210
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
211
|
-
* {
|
|
212
|
-
* policy_id: 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
213
|
-
* action: 'ALLOW',
|
|
214
|
-
* conditions: [
|
|
215
|
-
* {
|
|
216
|
-
* field: 'to',
|
|
217
|
-
* field_source: 'ethereum_transaction',
|
|
218
|
-
* operator: 'eq',
|
|
219
|
-
* value: 'string',
|
|
220
|
-
* },
|
|
221
|
-
* ],
|
|
222
|
-
* method: 'eth_sendTransaction',
|
|
223
|
-
* name: 'x',
|
|
224
|
-
* },
|
|
225
|
-
* );
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
_updateRule(
|
|
229
|
-
ruleID: string,
|
|
230
|
-
params: PolicyUpdateRuleParams,
|
|
231
|
-
options?: RequestOptions,
|
|
232
|
-
): APIPromise<PolicyRuleResponse> {
|
|
233
|
-
const {
|
|
234
|
-
policy_id,
|
|
235
|
-
'privy-authorization-signature': privyAuthorizationSignature,
|
|
236
|
-
'privy-request-expiry': privyRequestExpiry,
|
|
237
|
-
...body
|
|
238
|
-
} = params;
|
|
239
|
-
return this._client.patch(path`/v1/policies/${policy_id}/rules/${ruleID}`, {
|
|
240
|
-
body,
|
|
241
|
-
...options,
|
|
242
|
-
headers: buildHeaders([
|
|
243
|
-
{
|
|
244
|
-
...(privyAuthorizationSignature != null ?
|
|
245
|
-
{ 'privy-authorization-signature': privyAuthorizationSignature }
|
|
246
|
-
: undefined),
|
|
247
|
-
...(privyRequestExpiry != null ? { 'privy-request-expiry': privyRequestExpiry } : undefined),
|
|
248
|
-
},
|
|
249
|
-
options?.headers,
|
|
250
|
-
]),
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Get a policy by policy ID.
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```ts
|
|
259
|
-
* const policy = await client.policies.get(
|
|
260
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
261
|
-
* );
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
get(policyID: string, options?: RequestOptions): APIPromise<Policy> {
|
|
265
|
-
return this._client.get(path`/v1/policies/${policyID}`, options);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Get a rule by policy ID and rule ID.
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* ```ts
|
|
273
|
-
* const policyRuleResponse = await client.policies.getRule(
|
|
274
|
-
* 'xxxxxxxxxxxxxxxxxxxxxxxx',
|
|
275
|
-
* { policy_id: 'xxxxxxxxxxxxxxxxxxxxxxxx' },
|
|
276
|
-
* );
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
getRule(
|
|
280
|
-
ruleID: string,
|
|
281
|
-
params: PolicyGetRuleParams,
|
|
282
|
-
options?: RequestOptions,
|
|
283
|
-
): APIPromise<PolicyRuleResponse> {
|
|
284
|
-
const { policy_id } = params;
|
|
285
|
-
return this._client.get(path`/v1/policies/${policy_id}/rules/${ruleID}`, options);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
8
|
+
export class Policies extends APIResource {}
|
|
288
9
|
|
|
289
10
|
/**
|
|
290
11
|
* A parameter in a Solidity ABI function or event definition.
|
|
@@ -734,11 +455,9 @@ export type PolicyMethod =
|
|
|
734
455
|
| 'eth_signUserOperation'
|
|
735
456
|
| 'eth_signTypedData_v4'
|
|
736
457
|
| 'eth_sign7702Authorization'
|
|
737
|
-
| 'personal_sign'
|
|
738
458
|
| 'wallet_sendCalls'
|
|
739
459
|
| 'signTransaction'
|
|
740
460
|
| 'signAndSendTransaction'
|
|
741
|
-
| 'signMessage'
|
|
742
461
|
| 'exportPrivateKey'
|
|
743
462
|
| 'exportSeedPhrase'
|
|
744
463
|
| 'signTransactionBytes'
|
|
@@ -1046,212 +765,6 @@ export interface UpdateConditionSetRequestBody {
|
|
|
1046
765
|
owner_id?: SharedAPI.OwnerIDInput | null;
|
|
1047
766
|
}
|
|
1048
767
|
|
|
1049
|
-
export interface PolicyCreateParams {
|
|
1050
|
-
/**
|
|
1051
|
-
* Body param: The wallet chain types.
|
|
1052
|
-
*/
|
|
1053
|
-
chain_type: WalletsAPI.WalletChainType;
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* Body param: Name to assign to policy.
|
|
1057
|
-
*/
|
|
1058
|
-
name: string;
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* Body param
|
|
1062
|
-
*/
|
|
1063
|
-
rules: Array<PolicyCreateParams.Rule>;
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
* Body param: Version of the policy. Currently, 1.0 is the only version.
|
|
1067
|
-
*/
|
|
1068
|
-
version: '1.0';
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* Body param: The owner of the resource, specified as a Privy user ID, a P-256
|
|
1072
|
-
* public key, or null to remove the current owner.
|
|
1073
|
-
*/
|
|
1074
|
-
owner?: SharedAPI.OwnerInput | null;
|
|
1075
|
-
|
|
1076
|
-
/**
|
|
1077
|
-
* Body param: The key quorum ID to set as the owner of the resource. If you
|
|
1078
|
-
* provide this, do not specify an owner.
|
|
1079
|
-
*/
|
|
1080
|
-
owner_id?: SharedAPI.OwnerIDInput | null;
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Header param: Idempotency keys ensure API requests are executed only once within
|
|
1084
|
-
* a 24-hour window.
|
|
1085
|
-
*/
|
|
1086
|
-
'privy-idempotency-key'?: string;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
export namespace PolicyCreateParams {
|
|
1090
|
-
export interface Rule {
|
|
1091
|
-
/**
|
|
1092
|
-
* The action to take when a policy rule matches.
|
|
1093
|
-
*/
|
|
1094
|
-
action: PoliciesAPI.PolicyAction;
|
|
1095
|
-
|
|
1096
|
-
conditions: Array<PoliciesAPI.PolicyCondition>;
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* Method the rule applies to.
|
|
1100
|
-
*/
|
|
1101
|
-
method: PoliciesAPI.PolicyMethod;
|
|
1102
|
-
|
|
1103
|
-
name: string;
|
|
1104
|
-
|
|
1105
|
-
id?: string;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
export interface PolicyCreateRuleParams {
|
|
1110
|
-
/**
|
|
1111
|
-
* Body param: The action to take when a policy rule matches.
|
|
1112
|
-
*/
|
|
1113
|
-
action: PolicyAction;
|
|
1114
|
-
|
|
1115
|
-
/**
|
|
1116
|
-
* Body param
|
|
1117
|
-
*/
|
|
1118
|
-
conditions: Array<PolicyCondition>;
|
|
1119
|
-
|
|
1120
|
-
/**
|
|
1121
|
-
* Body param: Method the rule applies to.
|
|
1122
|
-
*/
|
|
1123
|
-
method: PolicyMethod;
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* Body param
|
|
1127
|
-
*/
|
|
1128
|
-
name: string;
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* Header param: Request authorization signature. If multiple signatures are
|
|
1132
|
-
* required, they should be comma separated.
|
|
1133
|
-
*/
|
|
1134
|
-
'privy-authorization-signature'?: string;
|
|
1135
|
-
|
|
1136
|
-
/**
|
|
1137
|
-
* Header param: Request expiry. Value is a Unix timestamp in milliseconds
|
|
1138
|
-
* representing the deadline by which the request must be processed.
|
|
1139
|
-
*/
|
|
1140
|
-
'privy-request-expiry'?: string;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
export interface PolicyDeleteParams {
|
|
1144
|
-
/**
|
|
1145
|
-
* Request authorization signature. If multiple signatures are required, they
|
|
1146
|
-
* should be comma separated.
|
|
1147
|
-
*/
|
|
1148
|
-
'privy-authorization-signature'?: string;
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Request expiry. Value is a Unix timestamp in milliseconds representing the
|
|
1152
|
-
* deadline by which the request must be processed.
|
|
1153
|
-
*/
|
|
1154
|
-
'privy-request-expiry'?: string;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
export interface PolicyDeleteRuleParams {
|
|
1158
|
-
/**
|
|
1159
|
-
* Path param
|
|
1160
|
-
*/
|
|
1161
|
-
policy_id: string;
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* Header param: Request authorization signature. If multiple signatures are
|
|
1165
|
-
* required, they should be comma separated.
|
|
1166
|
-
*/
|
|
1167
|
-
'privy-authorization-signature'?: string;
|
|
1168
|
-
|
|
1169
|
-
/**
|
|
1170
|
-
* Header param: Request expiry. Value is a Unix timestamp in milliseconds
|
|
1171
|
-
* representing the deadline by which the request must be processed.
|
|
1172
|
-
*/
|
|
1173
|
-
'privy-request-expiry'?: string;
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
export interface PolicyUpdateParams {
|
|
1177
|
-
/**
|
|
1178
|
-
* Body param: Name to assign to policy.
|
|
1179
|
-
*/
|
|
1180
|
-
name?: string;
|
|
1181
|
-
|
|
1182
|
-
/**
|
|
1183
|
-
* Body param: The owner of the resource, specified as a Privy user ID, a P-256
|
|
1184
|
-
* public key, or null to remove the current owner.
|
|
1185
|
-
*/
|
|
1186
|
-
owner?: SharedAPI.OwnerInput | null;
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* Body param: The key quorum ID to set as the owner of the resource. If you
|
|
1190
|
-
* provide this, do not specify an owner.
|
|
1191
|
-
*/
|
|
1192
|
-
owner_id?: SharedAPI.OwnerIDInput | null;
|
|
1193
|
-
|
|
1194
|
-
/**
|
|
1195
|
-
* Body param
|
|
1196
|
-
*/
|
|
1197
|
-
rules?: Array<PolicyRuleRequestBody>;
|
|
1198
|
-
|
|
1199
|
-
/**
|
|
1200
|
-
* Header param: Request authorization signature. If multiple signatures are
|
|
1201
|
-
* required, they should be comma separated.
|
|
1202
|
-
*/
|
|
1203
|
-
'privy-authorization-signature'?: string;
|
|
1204
|
-
|
|
1205
|
-
/**
|
|
1206
|
-
* Header param: Request expiry. Value is a Unix timestamp in milliseconds
|
|
1207
|
-
* representing the deadline by which the request must be processed.
|
|
1208
|
-
*/
|
|
1209
|
-
'privy-request-expiry'?: string;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
export interface PolicyUpdateRuleParams {
|
|
1213
|
-
/**
|
|
1214
|
-
* Path param
|
|
1215
|
-
*/
|
|
1216
|
-
policy_id: string;
|
|
1217
|
-
|
|
1218
|
-
/**
|
|
1219
|
-
* Body param: The action to take when a policy rule matches.
|
|
1220
|
-
*/
|
|
1221
|
-
action: PolicyAction;
|
|
1222
|
-
|
|
1223
|
-
/**
|
|
1224
|
-
* Body param
|
|
1225
|
-
*/
|
|
1226
|
-
conditions: Array<PolicyCondition>;
|
|
1227
|
-
|
|
1228
|
-
/**
|
|
1229
|
-
* Body param: Method the rule applies to.
|
|
1230
|
-
*/
|
|
1231
|
-
method: PolicyMethod;
|
|
1232
|
-
|
|
1233
|
-
/**
|
|
1234
|
-
* Body param
|
|
1235
|
-
*/
|
|
1236
|
-
name: string;
|
|
1237
|
-
|
|
1238
|
-
/**
|
|
1239
|
-
* Header param: Request authorization signature. If multiple signatures are
|
|
1240
|
-
* required, they should be comma separated.
|
|
1241
|
-
*/
|
|
1242
|
-
'privy-authorization-signature'?: string;
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* Header param: Request expiry. Value is a Unix timestamp in milliseconds
|
|
1246
|
-
* representing the deadline by which the request must be processed.
|
|
1247
|
-
*/
|
|
1248
|
-
'privy-request-expiry'?: string;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
export interface PolicyGetRuleParams {
|
|
1252
|
-
policy_id: string;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
768
|
export declare namespace Policies {
|
|
1256
769
|
export {
|
|
1257
770
|
type AbiParameter as AbiParameter,
|
|
@@ -1295,12 +808,5 @@ export declare namespace Policies {
|
|
|
1295
808
|
type TronCalldataCondition as TronCalldataCondition,
|
|
1296
809
|
type TronTransactionCondition as TronTransactionCondition,
|
|
1297
810
|
type UpdateConditionSetRequestBody as UpdateConditionSetRequestBody,
|
|
1298
|
-
type PolicyCreateParams as PolicyCreateParams,
|
|
1299
|
-
type PolicyCreateRuleParams as PolicyCreateRuleParams,
|
|
1300
|
-
type PolicyDeleteParams as PolicyDeleteParams,
|
|
1301
|
-
type PolicyDeleteRuleParams as PolicyDeleteRuleParams,
|
|
1302
|
-
type PolicyUpdateParams as PolicyUpdateParams,
|
|
1303
|
-
type PolicyUpdateRuleParams as PolicyUpdateRuleParams,
|
|
1304
|
-
type PolicyGetRuleParams as PolicyGetRuleParams,
|
|
1305
811
|
};
|
|
1306
812
|
}
|
package/src/resources/swaps.ts
CHANGED
|
@@ -6,28 +6,55 @@ import * as WalletsAPI from './wallets/wallets';
|
|
|
6
6
|
export class Swaps extends APIResource {}
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The output side of a swap execution request.
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
11
|
+
export interface SwapDestination {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Token contract address to buy, or "native" for the chain's native token.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
asset_address: string;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* CAIP-2 chain identifier for the destination. Must match source chain —
|
|
19
|
+
* cross-chain swaps are not yet supported. Defaults to source chain if omitted.
|
|
19
20
|
*/
|
|
20
|
-
caip2
|
|
21
|
+
caip2?: string;
|
|
22
|
+
}
|
|
21
23
|
|
|
24
|
+
/**
|
|
25
|
+
* The output side of a swap quote request.
|
|
26
|
+
*/
|
|
27
|
+
export interface SwapQuoteDestination {
|
|
22
28
|
/**
|
|
23
|
-
* Token address to
|
|
29
|
+
* Token contract address to buy, or "native" for the chain's native token.
|
|
24
30
|
*/
|
|
25
|
-
|
|
31
|
+
asset_address: string;
|
|
26
32
|
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
34
|
+
* CAIP-2 chain identifier for the destination. Must match source chain —
|
|
35
|
+
* cross-chain swaps are not yet supported. Defaults to source chain if omitted.
|
|
29
36
|
*/
|
|
30
|
-
|
|
37
|
+
caip2?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Input for requesting a token swap quote.
|
|
42
|
+
*/
|
|
43
|
+
export interface SwapQuoteRequestBody {
|
|
44
|
+
/**
|
|
45
|
+
* Amount in base units (e.g., wei for ETH). Must be a non-negative integer string.
|
|
46
|
+
*/
|
|
47
|
+
base_amount: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The output side of a swap quote request.
|
|
51
|
+
*/
|
|
52
|
+
destination: SwapQuoteDestination;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The input side of a swap request, including token and chain.
|
|
56
|
+
*/
|
|
57
|
+
source: SwapSource;
|
|
31
58
|
|
|
32
59
|
/**
|
|
33
60
|
* Whether the amount refers to the input token or output token.
|
|
@@ -86,46 +113,53 @@ export interface SwapQuoteResponse {
|
|
|
86
113
|
*/
|
|
87
114
|
export interface SwapRequestBody {
|
|
88
115
|
/**
|
|
89
|
-
* Amount in base units (e.g., wei for ETH).
|
|
116
|
+
* Amount in base units (e.g., wei for ETH). Must be a non-negative integer string.
|
|
90
117
|
*/
|
|
91
|
-
|
|
118
|
+
base_amount: string;
|
|
92
119
|
|
|
93
120
|
/**
|
|
94
|
-
*
|
|
121
|
+
* The output side of a swap execution request.
|
|
95
122
|
*/
|
|
96
|
-
|
|
123
|
+
destination: SwapDestination;
|
|
97
124
|
|
|
98
125
|
/**
|
|
99
|
-
*
|
|
126
|
+
* The input side of a swap request, including token and chain.
|
|
100
127
|
*/
|
|
101
|
-
|
|
128
|
+
source: SwapSource;
|
|
102
129
|
|
|
103
130
|
/**
|
|
104
|
-
*
|
|
131
|
+
* Whether the amount refers to the input token or output token.
|
|
105
132
|
*/
|
|
106
|
-
|
|
133
|
+
amount_type?: WalletsAPI.AmountType;
|
|
107
134
|
|
|
108
135
|
/**
|
|
109
|
-
*
|
|
136
|
+
* Maximum slippage tolerance in basis points (e.g., 50 for 0.5%).
|
|
110
137
|
*/
|
|
111
|
-
|
|
138
|
+
slippage_bps?: number;
|
|
139
|
+
}
|
|
112
140
|
|
|
141
|
+
/**
|
|
142
|
+
* The input side of a swap request, including token and chain.
|
|
143
|
+
*/
|
|
144
|
+
export interface SwapSource {
|
|
113
145
|
/**
|
|
114
|
-
*
|
|
115
|
-
* specified.
|
|
146
|
+
* Token contract address to sell, or "native" for the chain's native token.
|
|
116
147
|
*/
|
|
117
|
-
|
|
148
|
+
asset_address: string;
|
|
118
149
|
|
|
119
150
|
/**
|
|
120
|
-
*
|
|
151
|
+
* CAIP-2 chain identifier (e.g., "eip155:1").
|
|
121
152
|
*/
|
|
122
|
-
|
|
153
|
+
caip2: string;
|
|
123
154
|
}
|
|
124
155
|
|
|
125
156
|
export declare namespace Swaps {
|
|
126
157
|
export {
|
|
158
|
+
type SwapDestination as SwapDestination,
|
|
159
|
+
type SwapQuoteDestination as SwapQuoteDestination,
|
|
127
160
|
type SwapQuoteRequestBody as SwapQuoteRequestBody,
|
|
128
161
|
type SwapQuoteResponse as SwapQuoteResponse,
|
|
129
162
|
type SwapRequestBody as SwapRequestBody,
|
|
163
|
+
type SwapSource as SwapSource,
|
|
130
164
|
};
|
|
131
165
|
}
|