@zkp2p/sdk 0.10.0-rc.5 → 0.10.0-rc.7

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
@@ -94,7 +94,7 @@ Indexer defaults by environment:
94
94
  | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
95
  | Deposits | `createDeposit`, `addFunds`, `removeFunds`, `withdrawDeposit`, `ensureAllowance`, `setAcceptingIntents`, `setIntentRange`, `setCurrencyMinRate`, `setRetainOnEmpty` |
96
96
  | Payment methods and currencies | `addPaymentMethods`, `removePaymentMethod`, `setPaymentMethodActive`, `addCurrencies`, `removeCurrency`, `deactivateCurrency`, `pruneExpiredIntents` |
97
- | Intents | `signalIntent`, `fulfillIntent`, `cancelIntent`, `releaseFundsToPayer`, `getFulfillIntentInputs` |
97
+ | Intents | `signalIntent`, `fulfillIntent`, `cancelIntent`, `releaseFundsToPayer`, `getFulfillIntentInputs`, `getIntentGuardianPolicy`, `quoteIntentExtension`, `getIntentGuardianPayerFunding`, `extendIntentLifetime` |
98
98
  | Prepared transactions | `client.prepareCreateDeposit(...)`, `client.signalIntent.prepare(...)`, `client.fulfillIntent.prepare(...)`, `client.setVaultFee.prepare(...)`, and equivalent prepare flows across the rest of the prepareable write surface |
99
99
  | Payee and quote APIs | `registerPayeeDetails`, `resolvePayeeHash`, `getQuote`, `getQuotesBestByPlatform`, `getTakerTier` |
100
100
  | Seller automated release | `uploadSellerCredential`, `getSellerCredentialStatus`, `verifySellerPayment` |
@@ -284,6 +284,53 @@ await client.releaseFundsToPayer({
284
284
 
285
285
  Use `referralFees[]` for multi-recipient fee distribution on OrchestratorV2.
286
286
 
287
+ ## Extend an Intent Lifetime
288
+
289
+ The standalone `IntentGuardian` lets any payer buy more time for a live intent.
290
+ The fee is owner-governed, so read a fresh quote immediately before signing and
291
+ use `maxCost` as the payer's hard ceiling.
292
+
293
+ ```ts
294
+ const policy = await client.getIntentGuardianPolicy();
295
+ if (!policy.extensionsEnabled) {
296
+ throw new Error('Intent extensions are disabled');
297
+ }
298
+
299
+ const quote = await client.quoteIntentExtension({
300
+ intentAmount: 250_000n,
301
+ additionalTime: 60n * 60n,
302
+ });
303
+
304
+ const depositToken = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
305
+ const payer = walletClient.account.address;
306
+ const funding = await client.getIntentGuardianPayerFunding({
307
+ payer,
308
+ token: depositToken,
309
+ });
310
+
311
+ if (funding.balance < quote.cost) {
312
+ throw new Error('Insufficient token balance');
313
+ }
314
+
315
+ await client.ensureAllowance({
316
+ token: depositToken,
317
+ spender: policy.guardian,
318
+ amount: quote.cost,
319
+ });
320
+
321
+ await client.extendIntentLifetime({
322
+ escrow: '0xEscrow',
323
+ depositId: 42n,
324
+ intentHash,
325
+ additionalTime: 60n * 60n,
326
+ maxCost: quote.cost,
327
+ });
328
+ ```
329
+
330
+ The guardian charges the target deposit's token and pays the deposit owner.
331
+ Extension payments are prepaid and non-refundable. `extendIntentLifetime.prepare()`
332
+ returns calldata without sending it.
333
+
287
334
  ## Referral Account API
288
335
 
289
336
  Apps can read referral data publicly by wallet address and can write with either