@getpara/rest-sdk 3.24.0 → 3.25.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 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
- Para enables gas sponsorship per partner through its existing admin-managed `featureFlags.restGasSponsorship` setting.
141
- For enabled partners, eligible EVM token transfers return HTTP 202 with
142
- `executionMode: 'sponsored'`, a `transactionId`, and a status. The response has no `signedTransaction`.
143
- The SDK request is unchanged. Check `executionMode` before reading legacy response fields.
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.executionMode === 'sponsored') {
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: omit nonce, transaction type and gas/fee overrides; omit `broadcast` or set it to `true`.
165
- The server applies its configured supported chains and tokens. With the partner flag enabled, pausing global or
166
- chain sponsorship rejects matching transfers rather than falling back to wallet-paid gas. Turning the partner flag
167
- off routes new requests through the ordinary transfer path; existing sponsored operations retain their tracking IDs.
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"),
@@ -70,13 +70,13 @@ function requirementPath(reference) {
70
70
  )}`;
71
71
  }
72
72
  class RestPermissionsClient {
73
- listPartnerPolicies(options) {
73
+ listPolicies(options) {
74
74
  return this.request("GET", `${basePath}/policies`, { options });
75
75
  }
76
- getPartnerPolicy(policyId, options) {
76
+ getPolicy(policyId, options) {
77
77
  return this.request("GET", `${basePath}/policies/${(0, import_validation.pathSegment)("policyId", policyId)}`, { options });
78
78
  }
79
- listPartnerPolicyVersions(policyId, options) {
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
- listPartnerApprovalCases(query, options) {
204
+ listApprovalCases(query, options) {
205
205
  return this.request("GET", `${basePath}/approval-cases${queryString(query)}`, { options });
206
206
  }
207
- getPartnerApprovalCase(caseId, options) {
207
+ getApprovalCase(caseId, options) {
208
208
  return this.request("GET", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}`, { options });
209
209
  }
210
- cancelPartnerApprovalCase(caseId, options) {
210
+ cancelApprovalCase(caseId, options) {
211
211
  return this.request("POST", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}/cancel`, { options });
212
212
  }
213
- getPartnerPolicyUsage(policyId, context, options) {
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/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
  };
@@ -50,13 +50,13 @@ function requirementPath(reference) {
50
50
  )}`;
51
51
  }
52
52
  class RestPermissionsClient {
53
- listPartnerPolicies(options) {
53
+ listPolicies(options) {
54
54
  return this.request("GET", `${basePath}/policies`, { options });
55
55
  }
56
- getPartnerPolicy(policyId, options) {
56
+ getPolicy(policyId, options) {
57
57
  return this.request("GET", `${basePath}/policies/${pathSegment("policyId", policyId)}`, { options });
58
58
  }
59
- listPartnerPolicyVersions(policyId, options) {
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
- listPartnerApprovalCases(query, options) {
184
+ listApprovalCases(query, options) {
185
185
  return this.request("GET", `${basePath}/approval-cases${queryString(query)}`, { options });
186
186
  }
187
- getPartnerApprovalCase(caseId, options) {
187
+ getApprovalCase(caseId, options) {
188
188
  return this.request("GET", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}`, { options });
189
189
  }
190
- cancelPartnerApprovalCase(caseId, options) {
190
+ cancelApprovalCase(caseId, options) {
191
191
  return this.request("POST", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}/cancel`, { options });
192
192
  }
193
- getPartnerPolicyUsage(policyId, context, options) {
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;
@@ -71,7 +71,10 @@ export interface WalletBalanceResponse {
71
71
  rawBalance: string;
72
72
  }
73
73
  export type RestSigningInitiator = PermissionsV2SigningInitiatorRequest;
74
- export interface SignRawRequest extends RestSigningInitiator {
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,45 @@ export interface SignRawRequest extends RestSigningInitiator {
79
82
  export interface SignRawResponse {
80
83
  signature: string;
81
84
  }
82
- export interface SignMessageRequest extends RestSigningInitiator {
85
+ export interface SignMessageRequest extends RestSigningRequestContext {
83
86
  message: string;
84
87
  }
85
88
  export interface SignMessageResponse {
86
89
  signature: string;
87
90
  }
88
- export interface SignTransactionRequest extends RestSigningInitiator {
91
+ export interface SignTransactionRequest extends RestSigningRequestContext {
89
92
  transaction: EvmSignTransactionRequest | string;
90
93
  broadcast?: boolean;
91
94
  network?: SolanaNetwork | SuiNetwork;
92
95
  networkPassphrase?: string;
93
- }
96
+ autoRetry?: never;
97
+ }
98
+ export interface EvmAutoRetryAuthorization {
99
+ /** Per-attempt execution-gas ceiling in wei; excludes separate chain fees. */
100
+ maxExecutionFeeWei: string;
101
+ expiresAt: string;
102
+ }
103
+ export interface SolanaAutoRetryAuthorization {
104
+ /** Per-attempt base plus priority transaction fee ceiling; excludes rent. */
105
+ maxExecutionFeeLamports: string;
106
+ expiresAt: string;
107
+ }
108
+ export type AutoRetrySignTransactionRequest = {
109
+ transaction: EvmAutoRetrySignTransactionRequest;
110
+ broadcast: true;
111
+ walletType?: 'EVM';
112
+ autoRetry: EvmAutoRetryAuthorization;
113
+ } | {
114
+ /** Unsigned legacy transaction: sole wallet signer/fee payer, still-valid finalized blockhash,
115
+ * one 120000-unit limit and one compute-unit-price instruction. */
116
+ transaction: string;
117
+ broadcast: true;
118
+ walletType?: 'SOLANA';
119
+ network?: SolanaNetwork;
120
+ versioned?: false;
121
+ autoRetry: SolanaAutoRetryAuthorization;
122
+ };
123
+ export type AnySignTransactionRequest = SignTransactionRequest | AutoRetrySignTransactionRequest;
94
124
  export interface EvmSignTransactionRequest {
95
125
  to: string;
96
126
  chainId: string | number;
@@ -103,11 +133,26 @@ export interface EvmSignTransactionRequest {
103
133
  maxPriorityFeePerGas?: string;
104
134
  gasPrice?: string;
105
135
  }
136
+ export interface EvmAutoRetrySignTransactionRequest extends EvmSignTransactionRequest {
137
+ /** Managed retry only. Ordinary signTransaction does not preserve access lists. */
138
+ accessList?: Array<{
139
+ address: string;
140
+ storageKeys: string[];
141
+ } | [string, string[]]>;
142
+ }
106
143
  export interface SignTransactionResponse {
107
144
  signedTransaction: string;
108
145
  txHash?: string;
109
146
  transactionId?: string;
147
+ autoRetry?: never;
148
+ }
149
+ /** HTTP 202 is durable admission, before signing or broadcast. */
150
+ export interface AutoRetrySignTransactionResponse extends RestTransaction {
151
+ autoRetry: RestAutoRetryDetails;
152
+ signedTransaction?: never;
153
+ txHash?: never;
110
154
  }
155
+ export type AnySignTransactionResponse = SignTransactionResponse | AutoRetrySignTransactionResponse;
111
156
  export interface TypedDataPayload {
112
157
  domain: Record<string, unknown>;
113
158
  types: Record<string, Array<{
@@ -117,13 +162,13 @@ export interface TypedDataPayload {
117
162
  primaryType: string;
118
163
  message: Record<string, unknown>;
119
164
  }
120
- export interface SignTypedDataRequest extends RestSigningInitiator {
165
+ export interface SignTypedDataRequest extends RestSigningRequestContext {
121
166
  typedData: TypedDataPayload;
122
167
  }
123
168
  export interface SignTypedDataResponse {
124
169
  signature: string;
125
170
  }
126
- export interface SignAuthorizationRequest extends RestSigningInitiator {
171
+ export interface SignAuthorizationRequest extends RestSigningRequestContext {
127
172
  authorization: SignAuthorizationPayload;
128
173
  }
129
174
  export type SignAuthorizationPayload = ({
@@ -145,9 +190,17 @@ export interface SignAuthorizationResponse {
145
190
  yParity: 0 | 1;
146
191
  signature: string;
147
192
  }
148
- export interface TransferRequest extends RestSigningInitiator {
193
+ export type EvmFeeUrgency = 'normal' | 'urgent';
194
+ export interface TransferRequest extends RestSigningRequestContext {
149
195
  to: string;
150
196
  value: string;
197
+ /**
198
+ * Only true requires Para-paid gas with Para-managed nonce, gas and fees; false or omission requires wallet-paid gas.
199
+ * Unsupported explicit controls produce an API error; the SDK preserves them and never changes the payer.
200
+ */
201
+ sponsoredGas?: boolean;
202
+ /** Generated self-funded EVM prices only; omission means normal. Explicit prices remain pinned. */
203
+ urgency?: EvmFeeUrgency;
151
204
  chainId?: string | number;
152
205
  tokenAddress?: string;
153
206
  nonce?: number;
@@ -161,12 +214,16 @@ export interface TransferRequest extends RestSigningInitiator {
161
214
  network?: SolanaNetwork;
162
215
  }
163
216
  export interface LegacyTransferResponse {
217
+ sponsoredGas?: false;
218
+ /** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
164
219
  executionMode?: 'legacy';
165
220
  signedTransaction: string;
166
221
  txHash?: string;
167
222
  transactionId?: string;
168
223
  }
169
224
  export interface SponsoredTransferResponse extends RestSponsorshipDetails {
225
+ sponsoredGas?: true;
226
+ /** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
170
227
  executionMode: 'sponsored';
171
228
  transactionId: string;
172
229
  status: RestTransactionKnownStatus;
@@ -174,6 +231,34 @@ export interface SponsoredTransferResponse extends RestSponsorshipDetails {
174
231
  signedTransaction?: never;
175
232
  }
176
233
  export type TransferResponse = LegacyTransferResponse | SponsoredTransferResponse;
234
+ export type EvmAutoRetryTransferRequest = Pick<TransferRequest, 'to' | 'value' | 'tokenAddress' | 'nonce' | 'gasLimit' | 'maxFeePerGas' | 'maxPriorityFeePerGas' | 'gasPrice' | 'type' | 'urgency'> & {
235
+ chainId: string | number;
236
+ kind?: 'NATIVE' | 'ERC20';
237
+ sponsoredGas?: false;
238
+ broadcast?: true;
239
+ addressScreening?: true;
240
+ autoRetry: EvmAutoRetryAuthorization;
241
+ };
242
+ /** HTTP 202 is durable admission, before signing or broadcast. */
243
+ export interface AutoRetryTransferResponse extends RestTransaction {
244
+ sponsoredGas: false;
245
+ autoRetry: RestAutoRetryDetails;
246
+ signedTransaction?: never;
247
+ txHash?: never;
248
+ }
249
+ export interface ManualRecoveryRequest {
250
+ maxExecutionFeeWei: string;
251
+ urgency?: EvmFeeUrgency;
252
+ }
253
+ export interface ManualRecoveryTransferResponse extends RestTransaction {
254
+ manualRecovery: RestManualRecoveryDetails;
255
+ }
256
+ /** Identify Para-paid transfers, including older responses without sponsoredGas. The Boolean takes precedence. */
257
+ export declare function isSponsoredTransfer(result: TransferResponse): result is SponsoredTransferResponse;
258
+ export declare class ParaRestSponsorshipError extends Error {
259
+ readonly response: TransferResponse;
260
+ constructor(requestedSponsorship: boolean, response: TransferResponse);
261
+ }
177
262
  export interface EstimateFeeRequest {
178
263
  to: string;
179
264
  value: string;
@@ -181,6 +266,21 @@ export interface EstimateFeeRequest {
181
266
  tokenAddress?: string;
182
267
  network?: SolanaNetwork;
183
268
  }
269
+ export type EvmFeeOption = {
270
+ gasLimit: string;
271
+ maxExecutionFeeWei: string;
272
+ maxExecutionCostWei: string;
273
+ } & ({
274
+ type: 0;
275
+ gasPrice: string;
276
+ maxFeePerGas?: never;
277
+ maxPriorityFeePerGas?: never;
278
+ } | {
279
+ type: 2;
280
+ maxFeePerGas: string;
281
+ maxPriorityFeePerGas: string;
282
+ gasPrice?: never;
283
+ });
184
284
  export interface EstimateFeeResponse {
185
285
  estimatedFee: string;
186
286
  transferAmount: string;
@@ -189,6 +289,12 @@ export interface EstimateFeeResponse {
189
289
  maxFeePerGas?: string;
190
290
  maxPriorityFeePerGas?: string;
191
291
  gasPrice?: string;
292
+ type?: 0 | 2;
293
+ maxExecutionFeeWei?: string;
294
+ maxExecutionCostWei?: string;
295
+ feeOptions?: Record<EvmFeeUrgency, EvmFeeOption>;
296
+ quotedAt?: string;
297
+ blockNumber?: string;
192
298
  warning?: string;
193
299
  }
194
300
  export interface FaucetRequest {
@@ -204,7 +310,7 @@ export interface FaucetResponse {
204
310
  }
205
311
  export type RestTransactionKnownStatus = 'pending' | 'submitted' | 'confirmed' | 'reverted' | 'failed';
206
312
  export type RestTransactionStatus = RestTransactionKnownStatus | (string & {});
207
- export type RestTransactionIntentKind = 'transfer' | 'sign_transaction';
313
+ export type RestTransactionIntentKind = 'transfer' | 'sign_transaction' | 'yield';
208
314
  export type RestTransactionFailureStage = 'mpc_sign' | 'signature_apply' | 'signer_verify' | 'broadcast' | 'monitor_timeout';
209
315
  export type RestTransactionWalletType = 'EVM' | 'SOLANA';
210
316
  export type RestSponsoredTransactionStage = 'requires_action' | 'preparing' | 'signed' | 'submission_unknown' | 'included' | 'delivery_unverified';
@@ -230,13 +336,15 @@ export interface RestTransaction extends RestSponsorshipDetails {
230
336
  walletType: RestTransactionWalletType;
231
337
  intentKind: RestTransactionIntentKind;
232
338
  status: RestTransactionStatus;
339
+ sponsoredGas?: boolean;
340
+ /** @deprecated Use sponsoredGas. Retained for compatibility with older responses. */
233
341
  executionMode?: 'legacy' | 'sponsored';
234
342
  chainId?: string;
235
343
  network?: SolanaNetwork;
236
344
  to?: string;
237
345
  value?: string;
238
346
  tokenAddress?: string;
239
- hash?: string;
347
+ hash?: string | null;
240
348
  blockNumber?: string;
241
349
  blockHash?: string;
242
350
  failureStage?: RestTransactionFailureStage;
@@ -245,6 +353,97 @@ export interface RestTransaction extends RestSponsorshipDetails {
245
353
  createdAt: string;
246
354
  submittedAt?: string;
247
355
  resolvedAt?: string;
356
+ autoRetry?: RestAutoRetryDetails;
357
+ manualRecovery?: RestManualRecoveryDetails;
358
+ monitoring?: {
359
+ state: string;
360
+ reason?: string;
361
+ winningHash?: string;
362
+ };
363
+ }
364
+ export interface RestAutoRetryDetails {
365
+ state: 'active' | 'stopped' | 'resolved';
366
+ reason?: string;
367
+ nonce?: number;
368
+ network?: SolanaNetwork;
369
+ maxExecutionFeeWei?: string;
370
+ maxExecutionFeeLamports?: string;
371
+ expiresAt: string;
372
+ bumpCount: number;
373
+ latestAttemptHash?: string;
374
+ attempts: Array<{
375
+ ordinal: number;
376
+ stage: 'prepared' | 'signing' | 'rejected' | 'signed' | 'submission_unknown' | 'submitted';
377
+ hash?: string;
378
+ preparedAt: string;
379
+ lastBroadcastAt?: string;
380
+ lastValidBlockHeight?: number;
381
+ }>;
382
+ }
383
+ export interface RestManualRecoveryDetails {
384
+ action: 'speed_up' | 'cancel';
385
+ state: RestAutoRetryDetails['state'];
386
+ reason?: string;
387
+ nonce: number;
388
+ originalHash: string;
389
+ attempt: Pick<RestAutoRetryDetails['attempts'][number], 'stage' | 'hash' | 'preparedAt' | 'lastBroadcastAt'>;
390
+ }
391
+ export type RestYieldPhase = 'approval' | 'action';
392
+ export interface RestYieldAutoRetryAuthorization {
393
+ /** One original operation deadline, shared by every phase and replay. */
394
+ expiresAt: string;
395
+ action: {
396
+ maxExecutionFeeWei: string;
397
+ };
398
+ /** Required before a needed token approval can be signed; never inferred from action. */
399
+ approval?: {
400
+ maxExecutionFeeWei: string;
401
+ };
402
+ }
403
+ export type CreateYieldRequest = ({
404
+ marketId: string;
405
+ chainId?: string | number;
406
+ } | {
407
+ chainId: string | number;
408
+ marketId?: string;
409
+ }) & {
410
+ /** USDC decimal units; withdrawals also accept "all". */
411
+ amount: string;
412
+ /** Applied to fresh approval/action prices; retained across phases, retries, and replays. */
413
+ urgency?: EvmFeeUrgency;
414
+ autoRetry?: RestYieldAutoRetryAuthorization;
415
+ };
416
+ export interface RestYieldOperation {
417
+ id: string;
418
+ walletId: string;
419
+ chainId: number;
420
+ source: 'aave-v3' | 'morpho-v2';
421
+ marketId: string;
422
+ action: 'deposit' | 'withdraw';
423
+ amount: string;
424
+ status: 'pending' | 'submitted' | 'confirmed' | 'failed' | 'requires_action' | 'cancelled';
425
+ transactions: Array<{
426
+ phase: RestYieldPhase;
427
+ transactionId: string;
428
+ hash: string;
429
+ nonce: number;
430
+ status: 'signed' | 'submitted' | 'confirmed' | 'reverted' | 'failed';
431
+ blockNumber?: number;
432
+ blockHash?: string;
433
+ }>;
434
+ autoRetry?: RestYieldAutoRetryAuthorization & {
435
+ phases: Array<RestAutoRetryDetails & {
436
+ phase: RestYieldPhase;
437
+ transactionId: string;
438
+ }>;
439
+ };
440
+ error?: {
441
+ code: string;
442
+ message: string | null;
443
+ reviewId?: string;
444
+ };
445
+ createdAt: string;
446
+ updatedAt: string;
248
447
  }
249
448
  export type RestOnRampPurchaseKnownStatus = 'INITIATED' | 'FINISHED' | 'CANCELLED';
250
449
  /**
@@ -330,13 +529,32 @@ export declare class ParaRestClient extends RestPermissionsClient {
330
529
  signRaw(walletId: string, body: SignRawRequest, options?: ParaRestCallOptions): Promise<SignRawResponse>;
331
530
  signMessage(walletId: string, body: SignMessageRequest, options?: ParaRestCallOptions): Promise<SignMessageResponse>;
332
531
  signTransaction(walletId: string, body: SignTransactionRequest, options?: ParaRestCallOptions): Promise<SignTransactionResponse>;
532
+ signTransactionWithAutoRetry(walletId: string, body: AutoRetrySignTransactionRequest, options: ParaRestCallOptions & {
533
+ idempotencyKey: string;
534
+ }): Promise<AutoRetrySignTransactionResponse>;
333
535
  signTypedData(walletId: string, body: SignTypedDataRequest, options?: ParaRestCallOptions): Promise<SignTypedDataResponse>;
334
536
  signAuthorization(walletId: string, body: SignAuthorizationRequest, options?: ParaRestCallOptions): Promise<SignAuthorizationResponse>;
335
537
  transfer(walletId: string, body: TransferRequest, options?: ParaRestCallOptions): Promise<TransferResponse>;
538
+ transferWithAutoRetry(walletId: string, body: EvmAutoRetryTransferRequest, options: ParaRestCallOptions & {
539
+ idempotencyKey: string;
540
+ }): Promise<AutoRetryTransferResponse>;
336
541
  estimateFee(walletId: string, body: EstimateFeeRequest, options?: ParaRestCallOptions): Promise<EstimateFeeResponse>;
337
542
  requestFaucet(body: FaucetRequest, options?: ParaRestCallOptions): Promise<FaucetResponse>;
338
543
  listRestTransactions(walletId: string, query?: ListRestTransactionsRequest, options?: ParaRestCallOptions): Promise<RestListResponse<RestTransaction>>;
339
544
  getRestTransaction(walletId: string, transactionId: string, options?: ParaRestCallOptions): Promise<RestTransaction>;
545
+ speedUpRestTransaction(walletId: string, transactionId: string, body: ManualRecoveryRequest, options: ParaRestCallOptions & {
546
+ idempotencyKey: string;
547
+ }): Promise<ManualRecoveryTransferResponse>;
548
+ cancelRestTransaction(walletId: string, transactionId: string, body: ManualRecoveryRequest, options: ParaRestCallOptions & {
549
+ idempotencyKey: string;
550
+ }): Promise<ManualRecoveryTransferResponse>;
551
+ createYieldDeposit(walletId: string, body: CreateYieldRequest, options: ParaRestCallOptions & {
552
+ idempotencyKey: string;
553
+ }): Promise<RestYieldOperation>;
554
+ createYieldWithdrawal(walletId: string, body: CreateYieldRequest, options: ParaRestCallOptions & {
555
+ idempotencyKey: string;
556
+ }): Promise<RestYieldOperation>;
557
+ getYieldOperation(walletId: string, operationId: string, options?: ParaRestCallOptions): Promise<RestYieldOperation>;
340
558
  resumeRestTransaction(walletId: string, transactionId: string, body: ResumeRestTransactionRequest, options?: ParaRestCallOptions): Promise<SponsoredTransferResponse>;
341
559
  /**
342
560
  * 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, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyUsageMeter, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, } from '@getpara/shared';
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 PermissionsV2PartnerUsageContext extends PermissionsV2WalletContext {
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
- listPartnerPolicies(options?: ParaRestCallOptions): Promise<PermissionsV2PolicyListResponse>;
47
- getPartnerPolicy(policyId: string, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyResponse>;
48
- listPartnerPolicyVersions(policyId: string, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyVersionsResponse>;
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
- listPartnerApprovalCases(query?: PermissionsV2CaseListOptions, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalPartnerCaseList>;
69
- getPartnerApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<Omit<PermissionsV2ConditionalApprovalCaseView, 'decision'>>;
70
- cancelPartnerApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalCaseSummary>;
71
- getPartnerPolicyUsage(policyId: string, context: PermissionsV2PartnerUsageContext, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyUsage>;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/rest-sdk",
3
- "version": "3.24.0",
3
+ "version": "3.25.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.38.0"
30
+ "@getpara/shared": "^1.40.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": "205cf865b2dff48339a919ecaa46aab3da211218"
114
+ "gitHead": "757f086d7e0ff8adcc488ad0fc0801ec56366ee2"
115
115
  }