@getpara/rest-sdk 3.24.0 → 3.26.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/README.md +198 -10
- package/dist/cjs/index.js +84 -0
- package/dist/cjs/permissions.js +13 -7
- package/dist/cjs/viem/index.js +21 -1
- package/dist/esm/index.js +82 -0
- package/dist/esm/permissions.js +13 -7
- package/dist/esm/viem/index.js +21 -2
- package/dist/types/index.d.ts +229 -9
- package/dist/types/permissions.d.ts +23 -9
- package/dist/types/viem/index.d.ts +19 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -108,6 +108,32 @@ await para.createWallet(
|
|
|
108
108
|
Use an idempotency key when a retry could create duplicate state or submit duplicate signing/broadcast work. The SDK
|
|
109
109
|
does not generate one for you because it does not retry requests internally.
|
|
110
110
|
|
|
111
|
+
## EVM fee urgency
|
|
112
|
+
|
|
113
|
+
Set `urgency: 'normal' | 'urgent'` on a self-funded EVM `transfer`, `transferWithAutoRetry`,
|
|
114
|
+
`speedUpRestTransaction`, `cancelRestTransaction`, `createYieldDeposit`, or `createYieldWithdrawal` request.
|
|
115
|
+
Omission means normal. Para selects fresh recommended prices; the SDK forwards the choice without calculating fees.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
await para.transfer(wallet.id, {
|
|
119
|
+
to: '0x1111111111111111111111111111111111111111',
|
|
120
|
+
value: '1000000000000',
|
|
121
|
+
chainId: '11155111',
|
|
122
|
+
urgency: 'urgent',
|
|
123
|
+
}, { idempotencyKey: 'saved-payment-key' });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Explicit initial prices, including zero, stay pinned. Urgency changes generated prices, not gas units; an inconsistent
|
|
127
|
+
fee pair is rejected. Urgent does not guarantee confirmation time. Sponsored transfers, non-EVM execution, and
|
|
128
|
+
caller-built `signTransaction`/`signTransactionWithAutoRetry` requests reject urgency. EVM fee estimates return
|
|
129
|
+
both options and do not take a selector. `estimateFee()` exposes typed `feeOptions.normal` and `feeOptions.urgent`,
|
|
130
|
+
with their fee-family fields, execution budgets, quote timestamp and block number. These optional fields are absent
|
|
131
|
+
on non-EVM or older responses.
|
|
132
|
+
|
|
133
|
+
Durable recovery and yield retain the choice across worker restarts and approval/action phases. Omitted and explicit
|
|
134
|
+
normal share the legacy durable identity; changing urgency under the same key conflicts. Replays retain prepared and
|
|
135
|
+
signed bytes. Fee ceilings and deadlines remain unchanged; urgent never enlarges spending authorization.
|
|
136
|
+
|
|
111
137
|
## Transaction History
|
|
112
138
|
|
|
113
139
|
When REST broadcasts a transaction, `signTransaction(..., { broadcast: true })` and `transfer(...)` return a
|
|
@@ -135,23 +161,178 @@ methods as the read model: fetch the record immediately after a broadcast, backf
|
|
|
135
161
|
reconcile your database against Para's persisted transaction state. See the Para webhook docs for signature
|
|
136
162
|
verification and `rest.transaction.confirmed` / `rest.transaction.failed` payload examples.
|
|
137
163
|
|
|
164
|
+
## Automatic retry for EVM transfers
|
|
165
|
+
|
|
166
|
+
Use `transferWithAutoRetry` for self-funded native/ERC-20 EVM transfers. Save the body and key before sending;
|
|
167
|
+
reuse both after a timeout. HTTP 202 means durable admission before signing or broadcast and returns the original
|
|
168
|
+
transaction ID and `autoRetry` state instead of signed bytes.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const key = crypto.randomUUID();
|
|
172
|
+
const request = {
|
|
173
|
+
to: '0x1111111111111111111111111111111111111111',
|
|
174
|
+
value: '1000000000000',
|
|
175
|
+
chainId: '11155111',
|
|
176
|
+
urgency: 'urgent' as const,
|
|
177
|
+
autoRetry: {
|
|
178
|
+
maxExecutionFeeWei: '1000000000000000',
|
|
179
|
+
expiresAt: new Date(Date.now() + 30 * 60 * 1000).toISOString(),
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
// Persist { key, request } before submitting. Never renew the deadline on replay.
|
|
183
|
+
const accepted = await para.transferWithAutoRetry(wallet.id, request, { idempotencyKey: key });
|
|
184
|
+
const current = await para.getRestTransaction(wallet.id, accepted.transactionId);
|
|
185
|
+
console.log(current.status, current.autoRetry?.state);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`maxExecutionFeeWei` is the per-attempt execution-gas ceiling, excluding separate chain fees. Initial fees must fit;
|
|
189
|
+
later recommendations remain subject to the original ceiling and historical replacement minimum. This SDK method
|
|
190
|
+
supports EVM transfers; it does not add urgency to Solana recovery. See [Automatic fee retry](https://docs.getpara.com/v3/rest/automatic-retry).
|
|
191
|
+
|
|
192
|
+
## Manual EVM recovery
|
|
193
|
+
|
|
194
|
+
For an eligible unresolved ordinary self-funded EVM transfer, use `speedUpRestTransaction` or
|
|
195
|
+
`cancelRestTransaction` with a new saved idempotency key and a replacement fee ceiling:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
const recovery = await para.speedUpRestTransaction(wallet.id, transactionId, {
|
|
199
|
+
maxExecutionFeeWei: '1000000000000000',
|
|
200
|
+
urgency: 'urgent',
|
|
201
|
+
}, { idempotencyKey: recoveryKey });
|
|
202
|
+
console.log(recovery.manualRecovery.state, recovery.manualRecovery.attempt.hash);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Both methods return the original transaction ID and typed `manualRecovery` metadata. Read progress with
|
|
206
|
+
`getRestTransaction`. Use `cancelRestTransaction` with the same body shape to request cancellation. Only one manual
|
|
207
|
+
speed-up or cancellation is accepted per original transfer; HTTP acceptance does not prove inclusion or cancellation.
|
|
208
|
+
The original payment can still win. Replaying the saved key/body keeps the selected replacement bytes.
|
|
209
|
+
See [Manual EVM recovery](https://docs.getpara.com/v3/rest/transaction-history#manual-evm-recovery) for eligibility.
|
|
210
|
+
|
|
211
|
+
## Automatic retry for broadcast signing
|
|
212
|
+
|
|
213
|
+
Use `signTransactionWithAutoRetry` with `autoRetry` and `broadcast: true` to authorize recovery of one EVM transaction or supported legacy Solana
|
|
214
|
+
transaction. Save the key and entire request before submitting; HTTP retries reuse both, including the original deadline.
|
|
215
|
+
The server returns HTTP 202 before signing or broadcasting, with `transactionId`, `status`, and `autoRetry` instead of signed bytes.
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
const key = crypto.randomUUID();
|
|
219
|
+
const request = {
|
|
220
|
+
transaction: { ...transaction, type: 2 as const },
|
|
221
|
+
broadcast: true as const,
|
|
222
|
+
autoRetry: {
|
|
223
|
+
maxExecutionFeeWei: '1000000000000000',
|
|
224
|
+
expiresAt: new Date(Date.now() + 30 * 60 * 1000).toISOString(),
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
// Persist { key, request } in your job record before this call.
|
|
228
|
+
const result = await para.signTransactionWithAutoRetry(wallet.id, request, { idempotencyKey: key });
|
|
229
|
+
const record = await para.getRestTransaction(wallet.id, result.transactionId);
|
|
230
|
+
console.log(record.status, record.autoRetry?.state, record.monitoring?.winningHash);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
EVM supports type 0 and 2 contract calls, including type 2 access lists. Fees and gas limits use decimal integer
|
|
234
|
+
strings. Same-nonce replacements preserve the destination, value, calldata, gas limit and access list; fee caps
|
|
235
|
+
increase by at least 12.5%, rounded up, at least 60 seconds after the last broadcast. There is no fixed attempt limit.
|
|
236
|
+
`maxExecutionFeeWei` caps each attempt's execution gas; separate chain fees are excluded.
|
|
237
|
+
|
|
238
|
+
For Solana, send an unsigned legacy transaction with the wallet as the sole signer and fee payer, a still-valid finalized
|
|
239
|
+
recent blockhash, exactly one 120000-unit compute limit and one compute-unit-price instruction. Use `maxExecutionFeeLamports`
|
|
240
|
+
instead of `maxExecutionFeeWei`; it caps base plus priority fees and excludes account rent. Versioned and durable-nonce
|
|
241
|
+
transactions and unsupported system/account instructions are rejected. Para must locate the original hash in its
|
|
242
|
+
512-slot finalized history window; missing or older anchor history is rejected before signing. The original transaction
|
|
243
|
+
bytes are preserved even when a newer finalized hash exists. Solana resends exact bytes until expiry and
|
|
244
|
+
requires finalized non-execution proof before rebuilding with a new blockhash.
|
|
245
|
+
|
|
246
|
+
The enrolling secret key, wallet and current policies must authorize every attempt. A transaction-bound approval
|
|
247
|
+
does not authorize changed fees: retry requests do not accept `reviewId` or `initiatorUserId`. A stopped retry can
|
|
248
|
+
still have a pending on-chain transaction. Continue polling its original ID; do not submit the operation again with a
|
|
249
|
+
new key. Signer adapters keep their sign-only behavior. See [Automatic fee retry](https://docs.getpara.com/v3/rest/automatic-retry).
|
|
250
|
+
|
|
251
|
+
## Yield deposits and withdrawals
|
|
252
|
+
|
|
253
|
+
Use `createYieldDeposit`, `createYieldWithdrawal` and `getYieldOperation` for the existing Aave/Morpho yield routes.
|
|
254
|
+
Save the complete request and idempotency key before the first call. Amounts are USDC decimal units; withdrawals
|
|
255
|
+
also accept `'all'`. Select a supported `marketId`, or use `chainId` to select its Aave market.
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
const key = crypto.randomUUID();
|
|
259
|
+
const request = {
|
|
260
|
+
marketId: 'aave-v3:11155111:usdc',
|
|
261
|
+
amount: '10',
|
|
262
|
+
autoRetry: {
|
|
263
|
+
expiresAt: new Date(Date.now() + 30 * 60 * 1000).toISOString(),
|
|
264
|
+
approval: { maxExecutionFeeWei: '200000000000000' },
|
|
265
|
+
action: { maxExecutionFeeWei: '1000000000000000' },
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
// Persist { key, request } before submitting; replay both unchanged.
|
|
269
|
+
const accepted = await para.createYieldDeposit(wallet.id, request, { idempotencyKey: key });
|
|
270
|
+
const operation = await para.getYieldOperation(wallet.id, accepted.id);
|
|
271
|
+
console.log(operation.status, operation.transactions, operation.autoRetry?.phases);
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
`autoRetry` is optional. Its required action ceiling authorizes one deposit/withdrawal transaction, including all
|
|
275
|
+
same-nonce fee replacements. A needed approval requires its own explicit ceiling; Para never copies the action
|
|
276
|
+
ceiling or rolls unused authorization forward. Include approval authorization on deposits unless existing allowance
|
|
277
|
+
is known to cover the amount; withdrawals never need it. Each ceiling uses the existing
|
|
278
|
+
per-transaction execution-gas semantics, excluding separate chain charges. This is not a cumulative operation budget.
|
|
279
|
+
|
|
280
|
+
A missing approval ceiling or a first transaction above its ceiling cannot be fixed by replaying the same request.
|
|
281
|
+
Cancel the proven-unsigned operation first with
|
|
282
|
+
`POST /v1/wallets/{walletId}/yield/operations/{operationId}/cancel`, then use a new key and adequate ceilings.
|
|
283
|
+
The SDK does not wrap this cancellation route. Signed or uncertain phases remain tracked and cannot be replaced this way.
|
|
284
|
+
|
|
285
|
+
The original deadline applies across approval, action and every replay. If it expires after approval, the confirmed
|
|
286
|
+
approval remains visible and the unsigned action does not run. `autoRetry.phases` exposes each phase's transaction
|
|
287
|
+
ID, attempts and retry state. An initial reviewed transaction retains its exact bytes; replacements require a fresh
|
|
288
|
+
policy allow and reuse that phase's principal accounting. Current policy and accounting must be re-proven;
|
|
289
|
+
incompatible reuse, including unsupported approved spend overage, stops signing before MPC. A stopped retry can still
|
|
290
|
+
be pending on-chain: track the
|
|
291
|
+
same operation and transaction IDs until resolved. Omission retains existing exact-byte recovery.
|
|
292
|
+
|
|
138
293
|
## Sponsored Transfers
|
|
139
294
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
295
|
+
Set `sponsoredGas: true` to require Para-paid gas on an eligible EVM token transfer. Para must enable your
|
|
296
|
+
partner's existing admin-managed `featureFlags.restGasSponsorship` setting. If sponsorship cannot be honored, the
|
|
297
|
+
request fails with an actionable error; it never falls back to wallet-paid gas. Accepted sponsored transfers return HTTP 202 with
|
|
298
|
+
`sponsoredGas: true`, a `transactionId`, and a status. The response has no `signedTransaction`.
|
|
299
|
+
|
|
300
|
+
For a common transfer, provide the recipient, amount and asset (chain and token) with `sponsoredGas: true`;
|
|
301
|
+
Para chooses the nonce, gas and fees. If you require an explicit nonce, fee cap or other control, the SDK forwards
|
|
302
|
+
it unchanged. The current sponsorship API rejects unsupported controls with an actionable error. The SDK never
|
|
303
|
+
drops those controls, flips `sponsoredGas` to `false`, or retries through wallet-paid execution.
|
|
304
|
+
|
|
305
|
+
Set `sponsoredGas: false` or omit it to require wallet-paid gas, regardless of partner sponsorship eligibility.
|
|
306
|
+
Only `sponsoredGas: true` requests Para-paid gas. Transfer responses and transaction
|
|
307
|
+
history/detail include `sponsoredGas: true` for Para-paid gas or `false` for wallet-paid gas. Older API versions may omit it;
|
|
308
|
+
the deprecated response-only `executionMode` field remains for compatibility (`'sponsored'` or `'legacy'`). Do not send
|
|
309
|
+
`executionMode` in requests: the API rejects it with an actionable error.
|
|
310
|
+
|
|
311
|
+
The server must support `sponsoredGas` before you use it. The SDK expects wallet-paid gas when the field is omitted
|
|
312
|
+
and leaves the request unchanged. If a server returns a different sponsorship choice, the SDK
|
|
313
|
+
throws `ParaRestSponsorshipError` and preserves the result in `error.response`. For older responses, the SDK infers
|
|
314
|
+
sponsorship from `executionMode === 'sponsored'`. A transaction may already have been submitted: reconcile its tracking
|
|
315
|
+
ID/hash before retrying. This response check cannot undo a broadcast.
|
|
316
|
+
|
|
317
|
+
Upgrading an integration that previously relied on partner enrollment alone changes its gas-payment contract:
|
|
318
|
+
send `sponsoredGas: true` on each new transfer that requires Para-paid gas. Omitted requests now require wallet-paid
|
|
319
|
+
gas, and the SDK rejects an unexpected sponsored response, including an older response without the Boolean.
|
|
320
|
+
Replaying an existing sponsored key requires `sponsoredGas: true` and unchanged economic intent. Replaying that key
|
|
321
|
+
with `false` or an omitted flag returns `409 IDEMPOTENCY_CONFLICT` without creating another transfer. Recover the
|
|
322
|
+
original tracking ID or replay the original sponsored request; never retry the payout with a fresh idempotency key.
|
|
144
323
|
|
|
145
324
|
```ts
|
|
325
|
+
import { isSponsoredTransfer } from '@getpara/rest-sdk';
|
|
326
|
+
|
|
146
327
|
// Save this key with your payout before the request. Reuse it if the response is lost.
|
|
147
328
|
const requestKey = crypto.randomUUID();
|
|
148
329
|
const result = await para.transfer(
|
|
149
330
|
wallet.id,
|
|
150
|
-
{ to: recipient, value: '1000000', chainId, tokenAddress, kind: 'ERC20' },
|
|
331
|
+
{ to: recipient, value: '1000000', chainId, tokenAddress, kind: 'ERC20', sponsoredGas: true },
|
|
151
332
|
{ idempotencyKey: requestKey },
|
|
152
333
|
);
|
|
153
334
|
|
|
154
|
-
if (result
|
|
335
|
+
if (isSponsoredTransfer(result)) {
|
|
155
336
|
// Save the tracking ID, then poll this lookup from your background job.
|
|
156
337
|
const record = await para.getRestTransaction(wallet.id, result.transactionId);
|
|
157
338
|
console.log(record.status, record.stage, record.hash, record.actualGasCost);
|
|
@@ -160,11 +341,18 @@ if (result.executionMode === 'sponsored') {
|
|
|
160
341
|
}
|
|
161
342
|
```
|
|
162
343
|
|
|
344
|
+
`isSponsoredTransfer()` narrows the response for tracking or reading signed bytes. It uses `sponsoredGas` when present
|
|
345
|
+
and falls back to the older response-only `executionMode` field when the Boolean is absent.
|
|
346
|
+
|
|
163
347
|
Sponsored requests require an idempotency key and a positive integer `value` in token base units. Sponsorship manages
|
|
164
|
-
gas and submission
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
348
|
+
nonce, gas, fees and submission. The only accepted body fields are `to`, `value`, `chainId`, `tokenAddress`, `kind`, `broadcast`,
|
|
349
|
+
`addressScreening`, and `sponsoredGas`. All other fields are rejected, even when null or empty, including `autoRetry`,
|
|
350
|
+
nonce/type/fee overrides, `reviewId`, `initiatorUserId`, and `network`. The generic `TransferRequest` still exposes
|
|
351
|
+
initiator and network fields for legacy transfers. Omit `kind` or set it to `'ERC20'`; omit `broadcast` and
|
|
352
|
+
`addressScreening` or set them to `true`. Explicit sponsorship does not support Solana or disabled recipient screening.
|
|
353
|
+
The server enforces partner eligibility and its supported chain/token configuration.
|
|
354
|
+
Unavailable or paused sponsorship rejects explicit sponsored requests. The partner flag controls sponsorship eligibility;
|
|
355
|
+
it never selects sponsorship for requests with `sponsoredGas: false` or an omitted field. Existing sponsored operations retain their tracking IDs.
|
|
168
356
|
|
|
169
357
|
Poll `getRestTransaction` until the status is `confirmed`, `reverted`, or `failed`; stop polling for policy approval when
|
|
170
358
|
`stage` is `requires_action`. `submitted` with stage `included` is still awaiting receipt verification. `submission_unknown` means
|
package/dist/cjs/index.js
CHANGED
|
@@ -41,7 +41,9 @@ __export(index_exports, {
|
|
|
41
41
|
ParaRestClient: () => ParaRestClient,
|
|
42
42
|
ParaRestError: () => ParaRestError,
|
|
43
43
|
ParaRestSerializationError: () => ParaRestSerializationError,
|
|
44
|
+
ParaRestSponsorshipError: () => ParaRestSponsorshipError,
|
|
44
45
|
ParaRestValidationError: () => import_validation2.ParaRestValidationError,
|
|
46
|
+
isSponsoredTransfer: () => isSponsoredTransfer,
|
|
45
47
|
toRestJson: () => toRestJson
|
|
46
48
|
});
|
|
47
49
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -51,6 +53,19 @@ __reExport(index_exports, require("./permissions.js"), module.exports);
|
|
|
51
53
|
__reExport(index_exports, require("./webhooks.js"), module.exports);
|
|
52
54
|
__reExport(index_exports, require("./webhookVerification.js"), module.exports);
|
|
53
55
|
var import_validation2 = require("./validation.js");
|
|
56
|
+
function isSponsoredTransfer(result) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = result.sponsoredGas) != null ? _a : result.executionMode === "sponsored";
|
|
59
|
+
}
|
|
60
|
+
class ParaRestSponsorshipError extends Error {
|
|
61
|
+
constructor(requestedSponsorship, response) {
|
|
62
|
+
super(
|
|
63
|
+
`Sponsorship mismatch: requested sponsoredGas: ${requestedSponsorship} but received ${isSponsoredTransfer(response)}. Reconcile the response before retrying; a transaction may already have been submitted.`
|
|
64
|
+
);
|
|
65
|
+
this.name = "ParaRestSponsorshipError";
|
|
66
|
+
this.response = response;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
54
69
|
class ParaRestError extends Error {
|
|
55
70
|
constructor({
|
|
56
71
|
status,
|
|
@@ -170,6 +185,17 @@ class ParaRestClient extends import_permissions.RestPermissionsClient {
|
|
|
170
185
|
}
|
|
171
186
|
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/sign-transaction`, { body, options });
|
|
172
187
|
}
|
|
188
|
+
signTransactionWithAutoRetry(walletId, body, options) {
|
|
189
|
+
(0, import_validation.requireNonEmpty)(walletId, "walletId");
|
|
190
|
+
(0, import_validation.requireBody)(body, "body");
|
|
191
|
+
if (body.transaction == null || body.transaction === "") {
|
|
192
|
+
throw new import_validation.ParaRestValidationError("transaction is required");
|
|
193
|
+
}
|
|
194
|
+
if (body.broadcast !== true) throw new import_validation.ParaRestValidationError("autoRetry requires broadcast:true");
|
|
195
|
+
(0, import_validation.requireBody)(body.autoRetry, "autoRetry");
|
|
196
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
197
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/sign-transaction`, { body, options });
|
|
198
|
+
}
|
|
173
199
|
signTypedData(walletId, body, options) {
|
|
174
200
|
(0, import_validation.requireNonEmpty)(walletId, "walletId");
|
|
175
201
|
(0, import_validation.requireBody)(body, "body");
|
|
@@ -200,6 +226,23 @@ class ParaRestClient extends import_permissions.RestPermissionsClient {
|
|
|
200
226
|
(0, import_validation.requireBody)(body, "body");
|
|
201
227
|
(0, import_validation.requireNonEmpty)(body.to, "to");
|
|
202
228
|
(0, import_validation.requireNonEmpty)(body.value, "value");
|
|
229
|
+
const sponsoredGas = body.sponsoredGas === true;
|
|
230
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/transfer`, { body, options }).then(
|
|
231
|
+
(result) => {
|
|
232
|
+
if (isSponsoredTransfer(result) !== sponsoredGas) {
|
|
233
|
+
throw new ParaRestSponsorshipError(sponsoredGas, result);
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
transferWithAutoRetry(walletId, body, options) {
|
|
240
|
+
(0, import_validation.requireNonEmpty)(walletId, "walletId");
|
|
241
|
+
(0, import_validation.requireBody)(body, "body");
|
|
242
|
+
(0, import_validation.requireNonEmpty)(body.to, "to");
|
|
243
|
+
(0, import_validation.requireNonEmpty)(body.value, "value");
|
|
244
|
+
(0, import_validation.requireBody)(body.autoRetry, "autoRetry");
|
|
245
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
203
246
|
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/transfer`, { body, options });
|
|
204
247
|
}
|
|
205
248
|
estimateFee(walletId, body, options) {
|
|
@@ -226,6 +269,45 @@ class ParaRestClient extends import_permissions.RestPermissionsClient {
|
|
|
226
269
|
}
|
|
227
270
|
);
|
|
228
271
|
}
|
|
272
|
+
speedUpRestTransaction(walletId, transactionId, body, options) {
|
|
273
|
+
(0, import_validation.requireBody)(body, "body");
|
|
274
|
+
(0, import_validation.requireNonEmpty)(body.maxExecutionFeeWei, "maxExecutionFeeWei");
|
|
275
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
276
|
+
return this.request(
|
|
277
|
+
"POST",
|
|
278
|
+
`/v1/wallets/${walletPath(walletId)}/transactions/${(0, import_validation.pathSegment)("transactionId", transactionId)}/speed-up`,
|
|
279
|
+
{ body, options }
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
cancelRestTransaction(walletId, transactionId, body, options) {
|
|
283
|
+
(0, import_validation.requireBody)(body, "body");
|
|
284
|
+
(0, import_validation.requireNonEmpty)(body.maxExecutionFeeWei, "maxExecutionFeeWei");
|
|
285
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
286
|
+
return this.request(
|
|
287
|
+
"POST",
|
|
288
|
+
`/v1/wallets/${walletPath(walletId)}/transactions/${(0, import_validation.pathSegment)("transactionId", transactionId)}/cancel`,
|
|
289
|
+
{ body, options }
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
createYieldDeposit(walletId, body, options) {
|
|
293
|
+
(0, import_validation.requireBody)(body, "body");
|
|
294
|
+
(0, import_validation.requireNonEmpty)(body.amount, "amount");
|
|
295
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
296
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/yield/deposits`, { body, options });
|
|
297
|
+
}
|
|
298
|
+
createYieldWithdrawal(walletId, body, options) {
|
|
299
|
+
(0, import_validation.requireBody)(body, "body");
|
|
300
|
+
(0, import_validation.requireNonEmpty)(body.amount, "amount");
|
|
301
|
+
(0, import_validation.requireNonEmpty)(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
302
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/yield/withdrawals`, { body, options });
|
|
303
|
+
}
|
|
304
|
+
getYieldOperation(walletId, operationId, options) {
|
|
305
|
+
return this.request(
|
|
306
|
+
"GET",
|
|
307
|
+
`/v1/wallets/${walletPath(walletId)}/yield/operations/${(0, import_validation.pathSegment)("operationId", operationId)}`,
|
|
308
|
+
{ options }
|
|
309
|
+
);
|
|
310
|
+
}
|
|
229
311
|
resumeRestTransaction(walletId, transactionId, body, options) {
|
|
230
312
|
(0, import_validation.requireBody)(body, "body");
|
|
231
313
|
(0, import_validation.requireNonEmpty)(body.reviewId, "reviewId");
|
|
@@ -346,7 +428,9 @@ function stringField(value) {
|
|
|
346
428
|
ParaRestClient,
|
|
347
429
|
ParaRestError,
|
|
348
430
|
ParaRestSerializationError,
|
|
431
|
+
ParaRestSponsorshipError,
|
|
349
432
|
ParaRestValidationError,
|
|
433
|
+
isSponsoredTransfer,
|
|
350
434
|
toRestJson,
|
|
351
435
|
...require("./permissions.js"),
|
|
352
436
|
...require("./webhooks.js"),
|
package/dist/cjs/permissions.js
CHANGED
|
@@ -70,13 +70,13 @@ function requirementPath(reference) {
|
|
|
70
70
|
)}`;
|
|
71
71
|
}
|
|
72
72
|
class RestPermissionsClient {
|
|
73
|
-
|
|
73
|
+
listPolicies(options) {
|
|
74
74
|
return this.request("GET", `${basePath}/policies`, { options });
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
getPolicy(policyId, options) {
|
|
77
77
|
return this.request("GET", `${basePath}/policies/${(0, import_validation.pathSegment)("policyId", policyId)}`, { options });
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
listPolicyVersions(policyId, options) {
|
|
80
80
|
return this.request("GET", `${basePath}/policies/${(0, import_validation.pathSegment)("policyId", policyId)}/versions`, { options });
|
|
81
81
|
}
|
|
82
82
|
listUserPolicyConsents(userId, context, options) {
|
|
@@ -201,16 +201,22 @@ class RestPermissionsClient {
|
|
|
201
201
|
{ options }
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
listApprovalCases(query, options) {
|
|
205
205
|
return this.request("GET", `${basePath}/approval-cases${queryString(query)}`, { options });
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
getApprovalCase(caseId, options) {
|
|
208
208
|
return this.request("GET", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}`, { options });
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
cancelApprovalCase(caseId, options) {
|
|
211
211
|
return this.request("POST", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}/cancel`, { options });
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
approveReview(reviewId, options) {
|
|
214
|
+
return this.request("POST", `${basePath}/reviews/${(0, import_validation.pathSegment)("reviewId", reviewId)}/approve`, { options });
|
|
215
|
+
}
|
|
216
|
+
rejectReview(reviewId, options) {
|
|
217
|
+
return this.request("POST", `${basePath}/reviews/${(0, import_validation.pathSegment)("reviewId", reviewId)}/reject`, { options });
|
|
218
|
+
}
|
|
219
|
+
getPolicyUsage(policyId, context, options) {
|
|
214
220
|
const _a = context, { userId, walletId } = _a, query = __objRest(_a, ["userId", "walletId"]);
|
|
215
221
|
const subjectPath = userId ? `users/${(0, import_validation.pathSegment)("userId", userId)}` : `wallets/${(0, import_validation.pathSegment)("walletId", walletId)}`;
|
|
216
222
|
const usageQuery = userId ? __spreadValues({ walletId }, query) : query;
|
package/dist/cjs/viem/index.js
CHANGED
|
@@ -51,11 +51,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
var viem_exports = {};
|
|
53
53
|
__export(viem_exports, {
|
|
54
|
+
createParaDelegatedViemAccount: () => createParaDelegatedViemAccount,
|
|
54
55
|
createParaRestViemAccount: () => createParaRestViemAccount
|
|
55
56
|
});
|
|
56
57
|
module.exports = __toCommonJS(viem_exports);
|
|
57
58
|
var import_viem = require("viem");
|
|
58
59
|
var import__ = require("../index.js");
|
|
60
|
+
function hasDelegatedClient(options) {
|
|
61
|
+
return options.client !== void 0;
|
|
62
|
+
}
|
|
63
|
+
function createParaDelegatedViemAccount(options) {
|
|
64
|
+
const client = hasDelegatedClient(options) ? options.client : new import__.ParaRestClient({
|
|
65
|
+
apiKey: options.apiKey,
|
|
66
|
+
env: options.env,
|
|
67
|
+
fetch: options.fetch,
|
|
68
|
+
requestIdGenerator: options.requestIdGenerator
|
|
69
|
+
});
|
|
70
|
+
return createParaRestViemAccount({
|
|
71
|
+
client,
|
|
72
|
+
walletId: options.walletId,
|
|
73
|
+
address: options.address,
|
|
74
|
+
publicKey: options.publicKey
|
|
75
|
+
});
|
|
76
|
+
}
|
|
59
77
|
function createParaRestViemAccount(options) {
|
|
60
78
|
const { client, walletId, address, publicKey = "0x" } = options;
|
|
61
79
|
return {
|
|
@@ -80,7 +98,7 @@ function createParaRestViemAccount(options) {
|
|
|
80
98
|
});
|
|
81
99
|
return normalizeSignature(res2.signature);
|
|
82
100
|
}
|
|
83
|
-
const res = yield client.signMessage(walletId, { message });
|
|
101
|
+
const res = yield client.signMessage(walletId, { message, walletType: "EVM" });
|
|
84
102
|
return normalizeSignature(res.signature);
|
|
85
103
|
}),
|
|
86
104
|
signTypedData: (typedDataDefinition) => __async(null, null, function* () {
|
|
@@ -94,6 +112,7 @@ function createParaRestViemAccount(options) {
|
|
|
94
112
|
throw new import__.ParaRestValidationError("custom transaction serializers are not supported by the REST signer");
|
|
95
113
|
}
|
|
96
114
|
const res = yield client.signTransaction(walletId, {
|
|
115
|
+
walletType: "EVM",
|
|
97
116
|
transaction: toRestTransaction(transaction)
|
|
98
117
|
});
|
|
99
118
|
return res.signedTransaction;
|
|
@@ -174,5 +193,6 @@ function omitUndefined(value) {
|
|
|
174
193
|
}
|
|
175
194
|
// Annotate the CommonJS export names for ESM import in node:
|
|
176
195
|
0 && (module.exports = {
|
|
196
|
+
createParaDelegatedViemAccount,
|
|
177
197
|
createParaRestViemAccount
|
|
178
198
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -24,6 +24,19 @@ export * from "./permissions.js";
|
|
|
24
24
|
export * from "./webhooks.js";
|
|
25
25
|
export * from "./webhookVerification.js";
|
|
26
26
|
import { ParaRestValidationError as ParaRestValidationError2 } from "./validation.js";
|
|
27
|
+
function isSponsoredTransfer(result) {
|
|
28
|
+
var _a;
|
|
29
|
+
return (_a = result.sponsoredGas) != null ? _a : result.executionMode === "sponsored";
|
|
30
|
+
}
|
|
31
|
+
class ParaRestSponsorshipError extends Error {
|
|
32
|
+
constructor(requestedSponsorship, response) {
|
|
33
|
+
super(
|
|
34
|
+
`Sponsorship mismatch: requested sponsoredGas: ${requestedSponsorship} but received ${isSponsoredTransfer(response)}. Reconcile the response before retrying; a transaction may already have been submitted.`
|
|
35
|
+
);
|
|
36
|
+
this.name = "ParaRestSponsorshipError";
|
|
37
|
+
this.response = response;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
27
40
|
class ParaRestError extends Error {
|
|
28
41
|
constructor({
|
|
29
42
|
status,
|
|
@@ -143,6 +156,17 @@ class ParaRestClient extends RestPermissionsClient {
|
|
|
143
156
|
}
|
|
144
157
|
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/sign-transaction`, { body, options });
|
|
145
158
|
}
|
|
159
|
+
signTransactionWithAutoRetry(walletId, body, options) {
|
|
160
|
+
requireNonEmpty(walletId, "walletId");
|
|
161
|
+
requireBody(body, "body");
|
|
162
|
+
if (body.transaction == null || body.transaction === "") {
|
|
163
|
+
throw new ParaRestValidationError("transaction is required");
|
|
164
|
+
}
|
|
165
|
+
if (body.broadcast !== true) throw new ParaRestValidationError("autoRetry requires broadcast:true");
|
|
166
|
+
requireBody(body.autoRetry, "autoRetry");
|
|
167
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
168
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/sign-transaction`, { body, options });
|
|
169
|
+
}
|
|
146
170
|
signTypedData(walletId, body, options) {
|
|
147
171
|
requireNonEmpty(walletId, "walletId");
|
|
148
172
|
requireBody(body, "body");
|
|
@@ -173,6 +197,23 @@ class ParaRestClient extends RestPermissionsClient {
|
|
|
173
197
|
requireBody(body, "body");
|
|
174
198
|
requireNonEmpty(body.to, "to");
|
|
175
199
|
requireNonEmpty(body.value, "value");
|
|
200
|
+
const sponsoredGas = body.sponsoredGas === true;
|
|
201
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/transfer`, { body, options }).then(
|
|
202
|
+
(result) => {
|
|
203
|
+
if (isSponsoredTransfer(result) !== sponsoredGas) {
|
|
204
|
+
throw new ParaRestSponsorshipError(sponsoredGas, result);
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
transferWithAutoRetry(walletId, body, options) {
|
|
211
|
+
requireNonEmpty(walletId, "walletId");
|
|
212
|
+
requireBody(body, "body");
|
|
213
|
+
requireNonEmpty(body.to, "to");
|
|
214
|
+
requireNonEmpty(body.value, "value");
|
|
215
|
+
requireBody(body.autoRetry, "autoRetry");
|
|
216
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
176
217
|
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/transfer`, { body, options });
|
|
177
218
|
}
|
|
178
219
|
estimateFee(walletId, body, options) {
|
|
@@ -199,6 +240,45 @@ class ParaRestClient extends RestPermissionsClient {
|
|
|
199
240
|
}
|
|
200
241
|
);
|
|
201
242
|
}
|
|
243
|
+
speedUpRestTransaction(walletId, transactionId, body, options) {
|
|
244
|
+
requireBody(body, "body");
|
|
245
|
+
requireNonEmpty(body.maxExecutionFeeWei, "maxExecutionFeeWei");
|
|
246
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
247
|
+
return this.request(
|
|
248
|
+
"POST",
|
|
249
|
+
`/v1/wallets/${walletPath(walletId)}/transactions/${pathSegment("transactionId", transactionId)}/speed-up`,
|
|
250
|
+
{ body, options }
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
cancelRestTransaction(walletId, transactionId, body, options) {
|
|
254
|
+
requireBody(body, "body");
|
|
255
|
+
requireNonEmpty(body.maxExecutionFeeWei, "maxExecutionFeeWei");
|
|
256
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
257
|
+
return this.request(
|
|
258
|
+
"POST",
|
|
259
|
+
`/v1/wallets/${walletPath(walletId)}/transactions/${pathSegment("transactionId", transactionId)}/cancel`,
|
|
260
|
+
{ body, options }
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
createYieldDeposit(walletId, body, options) {
|
|
264
|
+
requireBody(body, "body");
|
|
265
|
+
requireNonEmpty(body.amount, "amount");
|
|
266
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
267
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/yield/deposits`, { body, options });
|
|
268
|
+
}
|
|
269
|
+
createYieldWithdrawal(walletId, body, options) {
|
|
270
|
+
requireBody(body, "body");
|
|
271
|
+
requireNonEmpty(body.amount, "amount");
|
|
272
|
+
requireNonEmpty(options == null ? void 0 : options.idempotencyKey, "idempotencyKey");
|
|
273
|
+
return this.request("POST", `/v1/wallets/${walletPath(walletId)}/yield/withdrawals`, { body, options });
|
|
274
|
+
}
|
|
275
|
+
getYieldOperation(walletId, operationId, options) {
|
|
276
|
+
return this.request(
|
|
277
|
+
"GET",
|
|
278
|
+
`/v1/wallets/${walletPath(walletId)}/yield/operations/${pathSegment("operationId", operationId)}`,
|
|
279
|
+
{ options }
|
|
280
|
+
);
|
|
281
|
+
}
|
|
202
282
|
resumeRestTransaction(walletId, transactionId, body, options) {
|
|
203
283
|
requireBody(body, "body");
|
|
204
284
|
requireNonEmpty(body.reviewId, "reviewId");
|
|
@@ -318,6 +398,8 @@ export {
|
|
|
318
398
|
ParaRestClient,
|
|
319
399
|
ParaRestError,
|
|
320
400
|
ParaRestSerializationError,
|
|
401
|
+
ParaRestSponsorshipError,
|
|
321
402
|
ParaRestValidationError2 as ParaRestValidationError,
|
|
403
|
+
isSponsoredTransfer,
|
|
322
404
|
toRestJson
|
|
323
405
|
};
|
package/dist/esm/permissions.js
CHANGED
|
@@ -50,13 +50,13 @@ function requirementPath(reference) {
|
|
|
50
50
|
)}`;
|
|
51
51
|
}
|
|
52
52
|
class RestPermissionsClient {
|
|
53
|
-
|
|
53
|
+
listPolicies(options) {
|
|
54
54
|
return this.request("GET", `${basePath}/policies`, { options });
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
getPolicy(policyId, options) {
|
|
57
57
|
return this.request("GET", `${basePath}/policies/${pathSegment("policyId", policyId)}`, { options });
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
listPolicyVersions(policyId, options) {
|
|
60
60
|
return this.request("GET", `${basePath}/policies/${pathSegment("policyId", policyId)}/versions`, { options });
|
|
61
61
|
}
|
|
62
62
|
listUserPolicyConsents(userId, context, options) {
|
|
@@ -181,16 +181,22 @@ class RestPermissionsClient {
|
|
|
181
181
|
{ options }
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
listApprovalCases(query, options) {
|
|
185
185
|
return this.request("GET", `${basePath}/approval-cases${queryString(query)}`, { options });
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
getApprovalCase(caseId, options) {
|
|
188
188
|
return this.request("GET", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}`, { options });
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
cancelApprovalCase(caseId, options) {
|
|
191
191
|
return this.request("POST", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}/cancel`, { options });
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
approveReview(reviewId, options) {
|
|
194
|
+
return this.request("POST", `${basePath}/reviews/${pathSegment("reviewId", reviewId)}/approve`, { options });
|
|
195
|
+
}
|
|
196
|
+
rejectReview(reviewId, options) {
|
|
197
|
+
return this.request("POST", `${basePath}/reviews/${pathSegment("reviewId", reviewId)}/reject`, { options });
|
|
198
|
+
}
|
|
199
|
+
getPolicyUsage(policyId, context, options) {
|
|
194
200
|
const _a = context, { userId, walletId } = _a, query = __objRest(_a, ["userId", "walletId"]);
|
|
195
201
|
const subjectPath = userId ? `users/${pathSegment("userId", userId)}` : `wallets/${pathSegment("walletId", walletId)}`;
|
|
196
202
|
const usageQuery = userId ? __spreadValues({ walletId }, query) : query;
|
package/dist/esm/viem/index.js
CHANGED
|
@@ -35,7 +35,24 @@ var __async = (__this, __arguments, generator) => {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
import { hashMessage, parseSignature, serializeSignature } from "viem";
|
|
38
|
-
import { ParaRestValidationError } from "../index.js";
|
|
38
|
+
import { ParaRestClient as ParaRestClientImplementation, ParaRestValidationError } from "../index.js";
|
|
39
|
+
function hasDelegatedClient(options) {
|
|
40
|
+
return options.client !== void 0;
|
|
41
|
+
}
|
|
42
|
+
function createParaDelegatedViemAccount(options) {
|
|
43
|
+
const client = hasDelegatedClient(options) ? options.client : new ParaRestClientImplementation({
|
|
44
|
+
apiKey: options.apiKey,
|
|
45
|
+
env: options.env,
|
|
46
|
+
fetch: options.fetch,
|
|
47
|
+
requestIdGenerator: options.requestIdGenerator
|
|
48
|
+
});
|
|
49
|
+
return createParaRestViemAccount({
|
|
50
|
+
client,
|
|
51
|
+
walletId: options.walletId,
|
|
52
|
+
address: options.address,
|
|
53
|
+
publicKey: options.publicKey
|
|
54
|
+
});
|
|
55
|
+
}
|
|
39
56
|
function createParaRestViemAccount(options) {
|
|
40
57
|
const { client, walletId, address, publicKey = "0x" } = options;
|
|
41
58
|
return {
|
|
@@ -60,7 +77,7 @@ function createParaRestViemAccount(options) {
|
|
|
60
77
|
});
|
|
61
78
|
return normalizeSignature(res2.signature);
|
|
62
79
|
}
|
|
63
|
-
const res = yield client.signMessage(walletId, { message });
|
|
80
|
+
const res = yield client.signMessage(walletId, { message, walletType: "EVM" });
|
|
64
81
|
return normalizeSignature(res.signature);
|
|
65
82
|
}),
|
|
66
83
|
signTypedData: (typedDataDefinition) => __async(null, null, function* () {
|
|
@@ -74,6 +91,7 @@ function createParaRestViemAccount(options) {
|
|
|
74
91
|
throw new ParaRestValidationError("custom transaction serializers are not supported by the REST signer");
|
|
75
92
|
}
|
|
76
93
|
const res = yield client.signTransaction(walletId, {
|
|
94
|
+
walletType: "EVM",
|
|
77
95
|
transaction: toRestTransaction(transaction)
|
|
78
96
|
});
|
|
79
97
|
return res.signedTransaction;
|
|
@@ -153,5 +171,6 @@ function omitUndefined(value) {
|
|
|
153
171
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
154
172
|
}
|
|
155
173
|
export {
|
|
174
|
+
createParaDelegatedViemAccount,
|
|
156
175
|
createParaRestViemAccount
|
|
157
176
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -71,7 +71,10 @@ export interface WalletBalanceResponse {
|
|
|
71
71
|
rawBalance: string;
|
|
72
72
|
}
|
|
73
73
|
export type RestSigningInitiator = PermissionsV2SigningInitiatorRequest;
|
|
74
|
-
export interface
|
|
74
|
+
export interface RestSigningRequestContext extends RestSigningInitiator {
|
|
75
|
+
reviewId?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface SignRawRequest extends RestSigningRequestContext {
|
|
75
78
|
data: string;
|
|
76
79
|
encoding?: 'hex';
|
|
77
80
|
walletType?: WalletType;
|
|
@@ -79,18 +82,47 @@ export interface SignRawRequest extends RestSigningInitiator {
|
|
|
79
82
|
export interface SignRawResponse {
|
|
80
83
|
signature: string;
|
|
81
84
|
}
|
|
82
|
-
export interface SignMessageRequest extends
|
|
85
|
+
export interface SignMessageRequest extends RestSigningRequestContext {
|
|
83
86
|
message: string;
|
|
87
|
+
walletType?: WalletType;
|
|
84
88
|
}
|
|
85
89
|
export interface SignMessageResponse {
|
|
86
90
|
signature: string;
|
|
87
91
|
}
|
|
88
|
-
export interface SignTransactionRequest extends
|
|
92
|
+
export interface SignTransactionRequest extends RestSigningRequestContext {
|
|
89
93
|
transaction: EvmSignTransactionRequest | string;
|
|
94
|
+
walletType?: WalletType;
|
|
90
95
|
broadcast?: boolean;
|
|
91
96
|
network?: SolanaNetwork | SuiNetwork;
|
|
92
97
|
networkPassphrase?: string;
|
|
93
|
-
|
|
98
|
+
autoRetry?: never;
|
|
99
|
+
}
|
|
100
|
+
export interface EvmAutoRetryAuthorization {
|
|
101
|
+
/** Per-attempt execution-gas ceiling in wei; excludes separate chain fees. */
|
|
102
|
+
maxExecutionFeeWei: string;
|
|
103
|
+
expiresAt: string;
|
|
104
|
+
}
|
|
105
|
+
export interface SolanaAutoRetryAuthorization {
|
|
106
|
+
/** Per-attempt base plus priority transaction fee ceiling; excludes rent. */
|
|
107
|
+
maxExecutionFeeLamports: string;
|
|
108
|
+
expiresAt: string;
|
|
109
|
+
}
|
|
110
|
+
export type AutoRetrySignTransactionRequest = {
|
|
111
|
+
transaction: EvmAutoRetrySignTransactionRequest;
|
|
112
|
+
broadcast: true;
|
|
113
|
+
walletType?: 'EVM';
|
|
114
|
+
autoRetry: EvmAutoRetryAuthorization;
|
|
115
|
+
} | {
|
|
116
|
+
/** Unsigned legacy transaction: sole wallet signer/fee payer, still-valid finalized blockhash,
|
|
117
|
+
* one 120000-unit limit and one compute-unit-price instruction. */
|
|
118
|
+
transaction: string;
|
|
119
|
+
broadcast: true;
|
|
120
|
+
walletType?: 'SOLANA';
|
|
121
|
+
network?: SolanaNetwork;
|
|
122
|
+
versioned?: false;
|
|
123
|
+
autoRetry: SolanaAutoRetryAuthorization;
|
|
124
|
+
};
|
|
125
|
+
export type AnySignTransactionRequest = SignTransactionRequest | AutoRetrySignTransactionRequest;
|
|
94
126
|
export interface EvmSignTransactionRequest {
|
|
95
127
|
to: string;
|
|
96
128
|
chainId: string | number;
|
|
@@ -103,11 +135,26 @@ export interface EvmSignTransactionRequest {
|
|
|
103
135
|
maxPriorityFeePerGas?: string;
|
|
104
136
|
gasPrice?: string;
|
|
105
137
|
}
|
|
138
|
+
export interface EvmAutoRetrySignTransactionRequest extends EvmSignTransactionRequest {
|
|
139
|
+
/** Managed retry only. Ordinary signTransaction does not preserve access lists. */
|
|
140
|
+
accessList?: Array<{
|
|
141
|
+
address: string;
|
|
142
|
+
storageKeys: string[];
|
|
143
|
+
} | [string, string[]]>;
|
|
144
|
+
}
|
|
106
145
|
export interface SignTransactionResponse {
|
|
107
146
|
signedTransaction: string;
|
|
108
147
|
txHash?: string;
|
|
109
148
|
transactionId?: string;
|
|
149
|
+
autoRetry?: never;
|
|
110
150
|
}
|
|
151
|
+
/** HTTP 202 is durable admission, before signing or broadcast. */
|
|
152
|
+
export interface AutoRetrySignTransactionResponse extends RestTransaction {
|
|
153
|
+
autoRetry: RestAutoRetryDetails;
|
|
154
|
+
signedTransaction?: never;
|
|
155
|
+
txHash?: never;
|
|
156
|
+
}
|
|
157
|
+
export type AnySignTransactionResponse = SignTransactionResponse | AutoRetrySignTransactionResponse;
|
|
111
158
|
export interface TypedDataPayload {
|
|
112
159
|
domain: Record<string, unknown>;
|
|
113
160
|
types: Record<string, Array<{
|
|
@@ -117,13 +164,13 @@ export interface TypedDataPayload {
|
|
|
117
164
|
primaryType: string;
|
|
118
165
|
message: Record<string, unknown>;
|
|
119
166
|
}
|
|
120
|
-
export interface SignTypedDataRequest extends
|
|
167
|
+
export interface SignTypedDataRequest extends RestSigningRequestContext {
|
|
121
168
|
typedData: TypedDataPayload;
|
|
122
169
|
}
|
|
123
170
|
export interface SignTypedDataResponse {
|
|
124
171
|
signature: string;
|
|
125
172
|
}
|
|
126
|
-
export interface SignAuthorizationRequest extends
|
|
173
|
+
export interface SignAuthorizationRequest extends RestSigningRequestContext {
|
|
127
174
|
authorization: SignAuthorizationPayload;
|
|
128
175
|
}
|
|
129
176
|
export type SignAuthorizationPayload = ({
|
|
@@ -145,9 +192,17 @@ export interface SignAuthorizationResponse {
|
|
|
145
192
|
yParity: 0 | 1;
|
|
146
193
|
signature: string;
|
|
147
194
|
}
|
|
148
|
-
export
|
|
195
|
+
export type EvmFeeUrgency = 'normal' | 'urgent';
|
|
196
|
+
export interface TransferRequest extends RestSigningRequestContext {
|
|
149
197
|
to: string;
|
|
150
198
|
value: string;
|
|
199
|
+
/**
|
|
200
|
+
* Only true requires Para-paid gas with Para-managed nonce, gas and fees; false or omission requires wallet-paid gas.
|
|
201
|
+
* Unsupported explicit controls produce an API error; the SDK preserves them and never changes the payer.
|
|
202
|
+
*/
|
|
203
|
+
sponsoredGas?: boolean;
|
|
204
|
+
/** Generated self-funded EVM prices only; omission means normal. Explicit prices remain pinned. */
|
|
205
|
+
urgency?: EvmFeeUrgency;
|
|
151
206
|
chainId?: string | number;
|
|
152
207
|
tokenAddress?: string;
|
|
153
208
|
nonce?: number;
|
|
@@ -161,12 +216,16 @@ export interface TransferRequest extends RestSigningInitiator {
|
|
|
161
216
|
network?: SolanaNetwork;
|
|
162
217
|
}
|
|
163
218
|
export interface LegacyTransferResponse {
|
|
219
|
+
sponsoredGas?: false;
|
|
220
|
+
/** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
|
|
164
221
|
executionMode?: 'legacy';
|
|
165
222
|
signedTransaction: string;
|
|
166
223
|
txHash?: string;
|
|
167
224
|
transactionId?: string;
|
|
168
225
|
}
|
|
169
226
|
export interface SponsoredTransferResponse extends RestSponsorshipDetails {
|
|
227
|
+
sponsoredGas?: true;
|
|
228
|
+
/** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
|
|
170
229
|
executionMode: 'sponsored';
|
|
171
230
|
transactionId: string;
|
|
172
231
|
status: RestTransactionKnownStatus;
|
|
@@ -174,6 +233,34 @@ export interface SponsoredTransferResponse extends RestSponsorshipDetails {
|
|
|
174
233
|
signedTransaction?: never;
|
|
175
234
|
}
|
|
176
235
|
export type TransferResponse = LegacyTransferResponse | SponsoredTransferResponse;
|
|
236
|
+
export type EvmAutoRetryTransferRequest = Pick<TransferRequest, 'to' | 'value' | 'tokenAddress' | 'nonce' | 'gasLimit' | 'maxFeePerGas' | 'maxPriorityFeePerGas' | 'gasPrice' | 'type' | 'urgency'> & {
|
|
237
|
+
chainId: string | number;
|
|
238
|
+
kind?: 'NATIVE' | 'ERC20';
|
|
239
|
+
sponsoredGas?: false;
|
|
240
|
+
broadcast?: true;
|
|
241
|
+
addressScreening?: true;
|
|
242
|
+
autoRetry: EvmAutoRetryAuthorization;
|
|
243
|
+
};
|
|
244
|
+
/** HTTP 202 is durable admission, before signing or broadcast. */
|
|
245
|
+
export interface AutoRetryTransferResponse extends RestTransaction {
|
|
246
|
+
sponsoredGas: false;
|
|
247
|
+
autoRetry: RestAutoRetryDetails;
|
|
248
|
+
signedTransaction?: never;
|
|
249
|
+
txHash?: never;
|
|
250
|
+
}
|
|
251
|
+
export interface ManualRecoveryRequest {
|
|
252
|
+
maxExecutionFeeWei: string;
|
|
253
|
+
urgency?: EvmFeeUrgency;
|
|
254
|
+
}
|
|
255
|
+
export interface ManualRecoveryTransferResponse extends RestTransaction {
|
|
256
|
+
manualRecovery: RestManualRecoveryDetails;
|
|
257
|
+
}
|
|
258
|
+
/** Identify Para-paid transfers, including older responses without sponsoredGas. The Boolean takes precedence. */
|
|
259
|
+
export declare function isSponsoredTransfer(result: TransferResponse): result is SponsoredTransferResponse;
|
|
260
|
+
export declare class ParaRestSponsorshipError extends Error {
|
|
261
|
+
readonly response: TransferResponse;
|
|
262
|
+
constructor(requestedSponsorship: boolean, response: TransferResponse);
|
|
263
|
+
}
|
|
177
264
|
export interface EstimateFeeRequest {
|
|
178
265
|
to: string;
|
|
179
266
|
value: string;
|
|
@@ -181,6 +268,21 @@ export interface EstimateFeeRequest {
|
|
|
181
268
|
tokenAddress?: string;
|
|
182
269
|
network?: SolanaNetwork;
|
|
183
270
|
}
|
|
271
|
+
export type EvmFeeOption = {
|
|
272
|
+
gasLimit: string;
|
|
273
|
+
maxExecutionFeeWei: string;
|
|
274
|
+
maxExecutionCostWei: string;
|
|
275
|
+
} & ({
|
|
276
|
+
type: 0;
|
|
277
|
+
gasPrice: string;
|
|
278
|
+
maxFeePerGas?: never;
|
|
279
|
+
maxPriorityFeePerGas?: never;
|
|
280
|
+
} | {
|
|
281
|
+
type: 2;
|
|
282
|
+
maxFeePerGas: string;
|
|
283
|
+
maxPriorityFeePerGas: string;
|
|
284
|
+
gasPrice?: never;
|
|
285
|
+
});
|
|
184
286
|
export interface EstimateFeeResponse {
|
|
185
287
|
estimatedFee: string;
|
|
186
288
|
transferAmount: string;
|
|
@@ -189,6 +291,12 @@ export interface EstimateFeeResponse {
|
|
|
189
291
|
maxFeePerGas?: string;
|
|
190
292
|
maxPriorityFeePerGas?: string;
|
|
191
293
|
gasPrice?: string;
|
|
294
|
+
type?: 0 | 2;
|
|
295
|
+
maxExecutionFeeWei?: string;
|
|
296
|
+
maxExecutionCostWei?: string;
|
|
297
|
+
feeOptions?: Record<EvmFeeUrgency, EvmFeeOption>;
|
|
298
|
+
quotedAt?: string;
|
|
299
|
+
blockNumber?: string;
|
|
192
300
|
warning?: string;
|
|
193
301
|
}
|
|
194
302
|
export interface FaucetRequest {
|
|
@@ -204,7 +312,7 @@ export interface FaucetResponse {
|
|
|
204
312
|
}
|
|
205
313
|
export type RestTransactionKnownStatus = 'pending' | 'submitted' | 'confirmed' | 'reverted' | 'failed';
|
|
206
314
|
export type RestTransactionStatus = RestTransactionKnownStatus | (string & {});
|
|
207
|
-
export type RestTransactionIntentKind = 'transfer' | 'sign_transaction';
|
|
315
|
+
export type RestTransactionIntentKind = 'transfer' | 'sign_transaction' | 'yield';
|
|
208
316
|
export type RestTransactionFailureStage = 'mpc_sign' | 'signature_apply' | 'signer_verify' | 'broadcast' | 'monitor_timeout';
|
|
209
317
|
export type RestTransactionWalletType = 'EVM' | 'SOLANA';
|
|
210
318
|
export type RestSponsoredTransactionStage = 'requires_action' | 'preparing' | 'signed' | 'submission_unknown' | 'included' | 'delivery_unverified';
|
|
@@ -230,13 +338,15 @@ export interface RestTransaction extends RestSponsorshipDetails {
|
|
|
230
338
|
walletType: RestTransactionWalletType;
|
|
231
339
|
intentKind: RestTransactionIntentKind;
|
|
232
340
|
status: RestTransactionStatus;
|
|
341
|
+
sponsoredGas?: boolean;
|
|
342
|
+
/** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
|
|
233
343
|
executionMode?: 'legacy' | 'sponsored';
|
|
234
344
|
chainId?: string;
|
|
235
345
|
network?: SolanaNetwork;
|
|
236
346
|
to?: string;
|
|
237
347
|
value?: string;
|
|
238
348
|
tokenAddress?: string;
|
|
239
|
-
hash?: string;
|
|
349
|
+
hash?: string | null;
|
|
240
350
|
blockNumber?: string;
|
|
241
351
|
blockHash?: string;
|
|
242
352
|
failureStage?: RestTransactionFailureStage;
|
|
@@ -245,6 +355,97 @@ export interface RestTransaction extends RestSponsorshipDetails {
|
|
|
245
355
|
createdAt: string;
|
|
246
356
|
submittedAt?: string;
|
|
247
357
|
resolvedAt?: string;
|
|
358
|
+
autoRetry?: RestAutoRetryDetails;
|
|
359
|
+
manualRecovery?: RestManualRecoveryDetails;
|
|
360
|
+
monitoring?: {
|
|
361
|
+
state: string;
|
|
362
|
+
reason?: string;
|
|
363
|
+
winningHash?: string;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
export interface RestAutoRetryDetails {
|
|
367
|
+
state: 'active' | 'stopped' | 'resolved';
|
|
368
|
+
reason?: string;
|
|
369
|
+
nonce?: number;
|
|
370
|
+
network?: SolanaNetwork;
|
|
371
|
+
maxExecutionFeeWei?: string;
|
|
372
|
+
maxExecutionFeeLamports?: string;
|
|
373
|
+
expiresAt: string;
|
|
374
|
+
bumpCount: number;
|
|
375
|
+
latestAttemptHash?: string;
|
|
376
|
+
attempts: Array<{
|
|
377
|
+
ordinal: number;
|
|
378
|
+
stage: 'prepared' | 'signing' | 'rejected' | 'signed' | 'submission_unknown' | 'submitted';
|
|
379
|
+
hash?: string;
|
|
380
|
+
preparedAt: string;
|
|
381
|
+
lastBroadcastAt?: string;
|
|
382
|
+
lastValidBlockHeight?: number;
|
|
383
|
+
}>;
|
|
384
|
+
}
|
|
385
|
+
export interface RestManualRecoveryDetails {
|
|
386
|
+
action: 'speed_up' | 'cancel';
|
|
387
|
+
state: RestAutoRetryDetails['state'];
|
|
388
|
+
reason?: string;
|
|
389
|
+
nonce: number;
|
|
390
|
+
originalHash: string;
|
|
391
|
+
attempt: Pick<RestAutoRetryDetails['attempts'][number], 'stage' | 'hash' | 'preparedAt' | 'lastBroadcastAt'>;
|
|
392
|
+
}
|
|
393
|
+
export type RestYieldPhase = 'approval' | 'action';
|
|
394
|
+
export interface RestYieldAutoRetryAuthorization {
|
|
395
|
+
/** One original operation deadline, shared by every phase and replay. */
|
|
396
|
+
expiresAt: string;
|
|
397
|
+
action: {
|
|
398
|
+
maxExecutionFeeWei: string;
|
|
399
|
+
};
|
|
400
|
+
/** Required before a needed token approval can be signed; never inferred from action. */
|
|
401
|
+
approval?: {
|
|
402
|
+
maxExecutionFeeWei: string;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
export type CreateYieldRequest = ({
|
|
406
|
+
marketId: string;
|
|
407
|
+
chainId?: string | number;
|
|
408
|
+
} | {
|
|
409
|
+
chainId: string | number;
|
|
410
|
+
marketId?: string;
|
|
411
|
+
}) & {
|
|
412
|
+
/** USDC decimal units; withdrawals also accept "all". */
|
|
413
|
+
amount: string;
|
|
414
|
+
/** Applied to fresh approval/action prices; retained across phases, retries, and replays. */
|
|
415
|
+
urgency?: EvmFeeUrgency;
|
|
416
|
+
autoRetry?: RestYieldAutoRetryAuthorization;
|
|
417
|
+
};
|
|
418
|
+
export interface RestYieldOperation {
|
|
419
|
+
id: string;
|
|
420
|
+
walletId: string;
|
|
421
|
+
chainId: number;
|
|
422
|
+
source: 'aave-v3' | 'morpho-v2';
|
|
423
|
+
marketId: string;
|
|
424
|
+
action: 'deposit' | 'withdraw';
|
|
425
|
+
amount: string;
|
|
426
|
+
status: 'pending' | 'submitted' | 'confirmed' | 'failed' | 'requires_action' | 'cancelled';
|
|
427
|
+
transactions: Array<{
|
|
428
|
+
phase: RestYieldPhase;
|
|
429
|
+
transactionId: string;
|
|
430
|
+
hash: string;
|
|
431
|
+
nonce: number;
|
|
432
|
+
status: 'signed' | 'submitted' | 'confirmed' | 'reverted' | 'failed';
|
|
433
|
+
blockNumber?: number;
|
|
434
|
+
blockHash?: string;
|
|
435
|
+
}>;
|
|
436
|
+
autoRetry?: RestYieldAutoRetryAuthorization & {
|
|
437
|
+
phases: Array<RestAutoRetryDetails & {
|
|
438
|
+
phase: RestYieldPhase;
|
|
439
|
+
transactionId: string;
|
|
440
|
+
}>;
|
|
441
|
+
};
|
|
442
|
+
error?: {
|
|
443
|
+
code: string;
|
|
444
|
+
message: string | null;
|
|
445
|
+
reviewId?: string;
|
|
446
|
+
};
|
|
447
|
+
createdAt: string;
|
|
448
|
+
updatedAt: string;
|
|
248
449
|
}
|
|
249
450
|
export type RestOnRampPurchaseKnownStatus = 'INITIATED' | 'FINISHED' | 'CANCELLED';
|
|
250
451
|
/**
|
|
@@ -330,13 +531,32 @@ export declare class ParaRestClient extends RestPermissionsClient {
|
|
|
330
531
|
signRaw(walletId: string, body: SignRawRequest, options?: ParaRestCallOptions): Promise<SignRawResponse>;
|
|
331
532
|
signMessage(walletId: string, body: SignMessageRequest, options?: ParaRestCallOptions): Promise<SignMessageResponse>;
|
|
332
533
|
signTransaction(walletId: string, body: SignTransactionRequest, options?: ParaRestCallOptions): Promise<SignTransactionResponse>;
|
|
534
|
+
signTransactionWithAutoRetry(walletId: string, body: AutoRetrySignTransactionRequest, options: ParaRestCallOptions & {
|
|
535
|
+
idempotencyKey: string;
|
|
536
|
+
}): Promise<AutoRetrySignTransactionResponse>;
|
|
333
537
|
signTypedData(walletId: string, body: SignTypedDataRequest, options?: ParaRestCallOptions): Promise<SignTypedDataResponse>;
|
|
334
538
|
signAuthorization(walletId: string, body: SignAuthorizationRequest, options?: ParaRestCallOptions): Promise<SignAuthorizationResponse>;
|
|
335
539
|
transfer(walletId: string, body: TransferRequest, options?: ParaRestCallOptions): Promise<TransferResponse>;
|
|
540
|
+
transferWithAutoRetry(walletId: string, body: EvmAutoRetryTransferRequest, options: ParaRestCallOptions & {
|
|
541
|
+
idempotencyKey: string;
|
|
542
|
+
}): Promise<AutoRetryTransferResponse>;
|
|
336
543
|
estimateFee(walletId: string, body: EstimateFeeRequest, options?: ParaRestCallOptions): Promise<EstimateFeeResponse>;
|
|
337
544
|
requestFaucet(body: FaucetRequest, options?: ParaRestCallOptions): Promise<FaucetResponse>;
|
|
338
545
|
listRestTransactions(walletId: string, query?: ListRestTransactionsRequest, options?: ParaRestCallOptions): Promise<RestListResponse<RestTransaction>>;
|
|
339
546
|
getRestTransaction(walletId: string, transactionId: string, options?: ParaRestCallOptions): Promise<RestTransaction>;
|
|
547
|
+
speedUpRestTransaction(walletId: string, transactionId: string, body: ManualRecoveryRequest, options: ParaRestCallOptions & {
|
|
548
|
+
idempotencyKey: string;
|
|
549
|
+
}): Promise<ManualRecoveryTransferResponse>;
|
|
550
|
+
cancelRestTransaction(walletId: string, transactionId: string, body: ManualRecoveryRequest, options: ParaRestCallOptions & {
|
|
551
|
+
idempotencyKey: string;
|
|
552
|
+
}): Promise<ManualRecoveryTransferResponse>;
|
|
553
|
+
createYieldDeposit(walletId: string, body: CreateYieldRequest, options: ParaRestCallOptions & {
|
|
554
|
+
idempotencyKey: string;
|
|
555
|
+
}): Promise<RestYieldOperation>;
|
|
556
|
+
createYieldWithdrawal(walletId: string, body: CreateYieldRequest, options: ParaRestCallOptions & {
|
|
557
|
+
idempotencyKey: string;
|
|
558
|
+
}): Promise<RestYieldOperation>;
|
|
559
|
+
getYieldOperation(walletId: string, operationId: string, options?: ParaRestCallOptions): Promise<RestYieldOperation>;
|
|
340
560
|
resumeRestTransaction(walletId: string, transactionId: string, body: ResumeRestTransactionRequest, options?: ParaRestCallOptions): Promise<SponsoredTransferResponse>;
|
|
341
561
|
/**
|
|
342
562
|
* Look up a fiat on-ramp purchase by id — the id the SDK reports on the `ONRAMP_LAUNCHED` event, and the
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetView, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationView, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingView, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseSummary, PermissionsV2ConditionalApprovalCaseView, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2DelegationConsentDiscoveryResponse, PermissionsV2DelegationConsentView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, PermissionsV2UserParameterHistory, PermissionsV2UserParameterView } from '@getpara/shared';
|
|
2
2
|
import type { ParaRestCallOptions } from './index.js';
|
|
3
|
-
export type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseSummary,
|
|
3
|
+
export type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseSummary, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyUsageMeter, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, } from '@getpara/shared';
|
|
4
4
|
type PermissionsRequestOptions = {
|
|
5
5
|
body?: unknown;
|
|
6
6
|
options?: ParaRestCallOptions;
|
|
7
7
|
expectedStatus?: number;
|
|
8
8
|
};
|
|
9
9
|
export type PermissionsV2PolicyLifecycle = PermissionsV2PolicyView['lifecycle'];
|
|
10
|
+
export type PermissionsV2ConditionalApprovalCaseSummaryList = PermissionsV2ConditionalApprovalPartnerCaseList;
|
|
10
11
|
export interface PermissionsV2ApprovalRequirementReference {
|
|
11
12
|
authorizationScopeId: string;
|
|
12
13
|
policyId: string;
|
|
@@ -31,7 +32,7 @@ export interface PermissionsV2AuthorizationScopeMemberListOptions {
|
|
|
31
32
|
limit?: number;
|
|
32
33
|
afterUserId?: string;
|
|
33
34
|
}
|
|
34
|
-
export interface
|
|
35
|
+
export interface PermissionsV2PolicyUsageContext extends PermissionsV2WalletContext {
|
|
35
36
|
userId?: string;
|
|
36
37
|
chainId?: string;
|
|
37
38
|
tokenAddress?: string;
|
|
@@ -40,12 +41,23 @@ export interface PermissionsV2PartnerUsageContext extends PermissionsV2WalletCon
|
|
|
40
41
|
export interface PermissionsV2UserAdjustablePolicyListResponse {
|
|
41
42
|
policies: PermissionsV2UserParameterView[];
|
|
42
43
|
}
|
|
44
|
+
export type PermissionsV2ReviewStatus = 'pending' | 'approved' | 'rejected' | 'expired' | 'consumed';
|
|
45
|
+
export interface PermissionsV2ReviewApproval {
|
|
46
|
+
reviewId: string;
|
|
47
|
+
status: PermissionsV2ReviewStatus;
|
|
48
|
+
approvedAt?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface PermissionsV2ReviewRejection {
|
|
51
|
+
reviewId: string;
|
|
52
|
+
status: PermissionsV2ReviewStatus;
|
|
53
|
+
rejectedAt?: string;
|
|
54
|
+
}
|
|
43
55
|
/** Partner-secret permissions methods inherited by {@link ParaRestClient}. */
|
|
44
56
|
export declare abstract class RestPermissionsClient {
|
|
45
57
|
protected abstract request<T>(method: string, path: string, options?: PermissionsRequestOptions): Promise<T>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
listPolicies(options?: ParaRestCallOptions): Promise<PermissionsV2PolicyListResponse>;
|
|
59
|
+
getPolicy(policyId: string, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyResponse>;
|
|
60
|
+
listPolicyVersions(policyId: string, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyVersionsResponse>;
|
|
49
61
|
listUserPolicyConsents(userId: string, context: PermissionsV2ConsentListContext, options?: ParaRestCallOptions): Promise<PermissionsV2DelegationConsentDiscoveryResponse>;
|
|
50
62
|
getUserPolicyConsent(userId: string, policyId: string, context: PermissionsV2WalletContext, options?: ParaRestCallOptions): Promise<PermissionsV2DelegationConsentView>;
|
|
51
63
|
listUserAdjustablePolicies(userId: string, options?: ParaRestCallOptions): Promise<PermissionsV2UserAdjustablePolicyListResponse>;
|
|
@@ -65,8 +77,10 @@ export declare abstract class RestPermissionsClient {
|
|
|
65
77
|
getWalletAuthorizationScope(walletId: string, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationScopeBindingView>;
|
|
66
78
|
setWalletAuthorizationScope(walletId: string, body: PermissionsV2AuthorizationScopeBindingWrite, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationScopeBindingView>;
|
|
67
79
|
listWalletAuthorizationScopeHistory(walletId: string, query?: PermissionsV2HistoryOptions, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationScopeBindingHistory>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
listApprovalCases(query?: PermissionsV2CaseListOptions, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalCaseSummaryList>;
|
|
81
|
+
getApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<Omit<PermissionsV2ConditionalApprovalCaseView, 'decision'>>;
|
|
82
|
+
cancelApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalCaseSummary>;
|
|
83
|
+
approveReview(reviewId: string, options?: ParaRestCallOptions): Promise<PermissionsV2ReviewApproval>;
|
|
84
|
+
rejectReview(reviewId: string, options?: ParaRestCallOptions): Promise<PermissionsV2ReviewRejection>;
|
|
85
|
+
getPolicyUsage(policyId: string, context: PermissionsV2PolicyUsageContext, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyUsage>;
|
|
72
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Hex, LocalAccount } from 'viem';
|
|
2
|
-
import type { ParaRestClient } from '../index.js';
|
|
2
|
+
import type { ParaRestClient, ParaRestClientOptions } from '../index.js';
|
|
3
3
|
type ParaRestViemClient = Pick<ParaRestClient, 'signRaw' | 'signMessage' | 'signTypedData' | 'signTransaction' | 'signAuthorization'>;
|
|
4
4
|
export interface CreateParaRestViemAccountOptions {
|
|
5
5
|
client: ParaRestViemClient;
|
|
@@ -7,5 +7,23 @@ export interface CreateParaRestViemAccountOptions {
|
|
|
7
7
|
address: Address;
|
|
8
8
|
publicKey?: Hex;
|
|
9
9
|
}
|
|
10
|
+
type ParaDelegatedViemAccountIdentity = Omit<CreateParaRestViemAccountOptions, 'client'>;
|
|
11
|
+
export type CreateParaDelegatedViemAccountOptions = ParaDelegatedViemAccountIdentity & ({
|
|
12
|
+
client: ParaRestViemClient;
|
|
13
|
+
apiKey?: never;
|
|
14
|
+
} | (ParaRestClientOptions & {
|
|
15
|
+
client?: never;
|
|
16
|
+
}));
|
|
17
|
+
/**
|
|
18
|
+
* Creates a server-side viem account for a user-owned wallet whose signing
|
|
19
|
+
* authority is enforced by an active Para signing grant.
|
|
20
|
+
*
|
|
21
|
+
* This intentionally accepts partner REST credentials and a wallet id, never a
|
|
22
|
+
* ParaCore user session or grant id. Para resolves the active grant on every
|
|
23
|
+
* normal REST signing request. While the grant is active, only a request that
|
|
24
|
+
* its policy allows is signed. Every other request fails with 403
|
|
25
|
+
* `SIGNING_GRANT_REQUIRED`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createParaDelegatedViemAccount(options: CreateParaDelegatedViemAccountOptions): LocalAccount;
|
|
10
28
|
export declare function createParaRestViemAccount(options: CreateParaRestViemAccountOptions): LocalAccount;
|
|
11
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/rest-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Typed server-side SDK for Para REST wallet management and signing",
|
|
5
5
|
"author": "Para Team <hello@getpara.com> (https://getpara.com)",
|
|
6
6
|
"homepage": "https://docs.getpara.com/v3/rest/sdk",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vitest": "^3.2.4"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@getpara/shared": "^1.
|
|
30
|
+
"@getpara/shared": "^1.42.0"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"typings": "dist/types/index.d.ts",
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "3da03ae598e47dddcad44773264bcba424537e9d"
|
|
115
115
|
}
|