@zkp2p/sdk 0.15.0-rc.0 → 0.15.0-rc.1
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 +206 -145
- package/dist/build-metadata.json +4 -4
- package/dist/{chunk-6K2RTFER.mjs → chunk-FCGUBJAP.mjs} +3 -3
- package/dist/{chunk-6K2RTFER.mjs.map → chunk-FCGUBJAP.mjs.map} +1 -1
- package/dist/{chunk-ZYCDBPQR.mjs → chunk-KWAYQB7K.mjs} +49945 -39586
- package/dist/{chunk-ZYCDBPQR.mjs.map → chunk-KWAYQB7K.mjs.map} +1 -1
- package/dist/{currency-CSMMPWY5.mjs → currency-THZHOZ5A.mjs} +3 -3
- package/dist/{currency-CSMMPWY5.mjs.map → currency-THZHOZ5A.mjs.map} +1 -1
- package/dist/index.cjs +69971 -59008
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +66 -88
- package/dist/index.d.ts +66 -88
- package/dist/index.mjs +5413 -4875
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-SPW7UPEH.mjs +5 -0
- package/dist/{protocolViewerParsers-5IK7K5HX.mjs.map → protocolViewerParsers-SPW7UPEH.mjs.map} +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-CU53EYLL.mjs → timeout-JJJQO4B3.mjs} +3 -3
- package/dist/{timeout-CU53EYLL.mjs.map → timeout-JJJQO4B3.mjs.map} +1 -1
- package/dist/{vaultUtils-DUyYQUYu.d.mts → vaultUtils-BJhHYqte.d.mts} +264 -196
- package/dist/{vaultUtils-DUyYQUYu.d.ts → vaultUtils-BJhHYqte.d.ts} +264 -196
- package/package.json +3 -3
- package/dist/protocolViewerParsers-5IK7K5HX.mjs +0 -5
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ and chargeback-risk surface. The workspace version lives in `package.json`.
|
|
|
35
35
|
|
|
36
36
|
## Optional Venmo Gmail connection
|
|
37
37
|
|
|
38
|
-
For partner cash-out integrations, prefer stable `@zkp2p/cash@0.7.
|
|
38
|
+
For partner cash-out integrations, prefer stable `@zkp2p/cash@0.7.3` and its
|
|
39
39
|
[prepare/open/status flow](https://docs.peer.xyz/developer/peer-cash/guide#optional-venmo-receipt-linking).
|
|
40
40
|
It selects the matching environment and keeps linking separate from cash-out.
|
|
41
41
|
The direct SDK helpers below require `@zkp2p/sdk@0.14.2` or later.
|
|
@@ -79,6 +79,23 @@ hosts and custom window handling with account-status polling at least ten second
|
|
|
79
79
|
apart. Deploy the hosted page before using the SDK helper. See the
|
|
80
80
|
[flow specification](https://github.com/zkp2p/zkp2p-clients/blob/main/docs/venmo-gmail-connect.md).
|
|
81
81
|
|
|
82
|
+
### X Money receipt linking
|
|
83
|
+
|
|
84
|
+
SDK `0.14.10` adds `getXMoneyConnectUrl` and `openXMoneyConnect`, using the same mailbox flow at
|
|
85
|
+
`/connect/xmoney`. Pass the registered `payeeDetails` hash and `payeeUsername`.
|
|
86
|
+
The normalized X username must hash to that identity. Both stay in the URL
|
|
87
|
+
fragment. X Money email notifications must be enabled and the inbox must contain
|
|
88
|
+
a signed received-payment receipt for that account. Gmail, personal Outlook and
|
|
89
|
+
iCloud Mail are supported. Deploy the hosted page before enabling this helper.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { openXMoneyConnect } from '@zkp2p/sdk';
|
|
93
|
+
await openXMoneyConnect({ payeeDetails, payeeUsername: 'seller' });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The URL builder also accepts `returnUrl` for native hosts. Re-check the mailbox
|
|
97
|
+
credential status after return or dismissal, as with Venmo.
|
|
98
|
+
|
|
82
99
|
### Native app return
|
|
83
100
|
|
|
84
101
|
SDK `0.14.3` adds optional `returnUrl` to the URL builder. Partners
|
|
@@ -292,9 +309,10 @@ bundle `payeeIdHash`, and store the encrypted bundle with curator. Plaintext
|
|
|
292
309
|
seller session material is never returned to the page.
|
|
293
310
|
|
|
294
311
|
`Zkp2pClient.uploadSellerCredential()` supports Cash App, Wise, and Amazon Pay UPI
|
|
295
|
-
plaintext input from trusted runtimes.
|
|
296
|
-
|
|
297
|
-
|
|
312
|
+
plaintext input from trusted runtimes. It creates the encrypted bundle, then uses
|
|
313
|
+
`apiUploadSellerCredentialBundle()` for storage. Venmo, PayPal, and X Money use
|
|
314
|
+
the [mailbox upload helpers](#seller-credential-status) for Gmail, personal
|
|
315
|
+
Outlook, or iCloud Mail.
|
|
298
316
|
|
|
299
317
|
## Create a Deposit
|
|
300
318
|
|
|
@@ -314,14 +332,17 @@ console.log(result.hash);
|
|
|
314
332
|
console.log(result.depositDetails);
|
|
315
333
|
```
|
|
316
334
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
`
|
|
335
|
+
The trusted-group whitelist is opt-in via `enableTrustedGroupBypass: true`
|
|
336
|
+
(defaults to false). By default, `createDeposit()` sends only the deposit and
|
|
337
|
+
returns empty `result.accessPolicyTxHashes` without waiting for a receipt.
|
|
338
|
+
When opted in, after the deposit mines, it sends one `configureDeposit` on the
|
|
339
|
+
current deposit whitelist (see [Deposit Access Policy](#deposit-access-policy))
|
|
340
|
+
per Venmo/PayPal method with the Peer Pay
|
|
320
341
|
merchant group and returns the confirmed hashes as
|
|
321
342
|
`result.accessPolicyTxHashes` (empty for other methods). Members of that group
|
|
322
|
-
skip dispute-protection staking
|
|
323
|
-
|
|
324
|
-
|
|
343
|
+
skip dispute-protection staking. On OrchestratorV4 an enabled whitelist makes
|
|
344
|
+
the deposit private: only Peer Pay merchant-group members can signal.
|
|
345
|
+
When opted in, if the deposit was sent but the policy was not confirmed, it throws a
|
|
325
346
|
`ContractError` whose `details.hash` is the deposit transaction. `prepareCreateDeposit()` does not add
|
|
326
347
|
the policy; custom senders call `client.accessPolicy.prepareConfigurePeerPayMerchantDeposit()`
|
|
327
348
|
once the deposit ID is known.
|
|
@@ -390,6 +411,7 @@ await client.setTakerAuthorization({ taker, authorized: true }); // signed by th
|
|
|
390
411
|
await client.selectStakeOwner({ stakeOwner: safeAddress }); // signed by the taker
|
|
391
412
|
await client.clearStakeOwner(); // taker returns to self-stake
|
|
392
413
|
|
|
414
|
+
// Explicit vaults are verified through the live stack independently by each client.
|
|
393
415
|
const onchain = await client.getStakeVaultState({
|
|
394
416
|
staker: takerAddress,
|
|
395
417
|
taker: takerAddress,
|
|
@@ -451,32 +473,34 @@ withdraws the complete claimable balance. Chargebackable capacity is exactly
|
|
|
451
473
|
the effective owner's free stake (1:1); never sum a taker's self-stake with a
|
|
452
474
|
sponsor's stake.
|
|
453
475
|
|
|
454
|
-
`
|
|
455
|
-
and
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
`
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
`
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
`getDisputeProtectionStacks()` discovers `{ current, draining }` from
|
|
477
|
+
OrchestratorV4 and OrchestratorV3 respectively, following O4 settlementPolicy to its vault, and the August/O3 hook to its policy and
|
|
478
|
+
vault. Discovery is cached for 30 seconds; failures are retried. The active vault
|
|
479
|
+
is the V4 vault when V4 is deployed, otherwise the V3 vault. Known previous vaults
|
|
480
|
+
remain selectable with `stakeVaultAddress` for reads and withdrawals; on staging these
|
|
481
|
+
are the August and Bypass vaults. The Bypass policy also stays known, so O3 intents
|
|
482
|
+
holding records there still resolve. O4 discovery verifies
|
|
483
|
+
`policy.isOrchestratorAuthorized(O4)` and `vault.isController(policy)`. V2 uses
|
|
484
|
+
the StakeVaultV2 ABI; August vaults retain StakeVault and its single controller. A missing
|
|
485
|
+
current stack fails closed. `@zkp2p/contracts-v2@0.4.4-rc.6` exports the Base staging
|
|
486
|
+
V4 stack. Base exports zero placeholders, which never enable V4.
|
|
487
|
+
|
|
488
|
+
Explicit vault addresses passed to stake reads, writes and allowance setup are verified
|
|
489
|
+
against bundled deployments or the trusted V4 live stack, cached per client for 30 seconds.
|
|
490
|
+
Use `await client.resolveStakeVaultContract({ stakeVaultAddress })` when contract
|
|
491
|
+
coordinates are needed before a direct read. `getStakeVaultContract` remains a
|
|
492
|
+
synchronous lookup of already-known vaults.
|
|
493
|
+
|
|
494
|
+
`getAdmissionsPaused`, `getRiskWindow`, `isDisputeProtectionEnabled` and
|
|
495
|
+
`setDisputeProtectionEnabled` target only the August V1 policy behind
|
|
496
|
+
OrchestratorV3. An explicit V2 address or a missing V3 stack fails closed.
|
|
497
|
+
V2 has no on-chain risk-window or pause getter; `StakeVaultState.admissionsPaused`
|
|
498
|
+
is omitted for V2 vaults. Use the attestor rail policy for quote-time defaults.
|
|
499
|
+
Releases look up each intent's original policy;
|
|
500
|
+
a batch spanning policies throws `ValidationError`.
|
|
501
|
+
|
|
502
|
+
The August vault's controller is the `DisputeProtectionPolicy` contract. It owns
|
|
478
503
|
per-payment-method risk windows (`getRiskWindow(paymentMethodHash)`),
|
|
479
|
-
per-deposit chargeback enablement (`isDisputeProtectionEnabled(escrow, depositId)`),
|
|
480
504
|
and the global `admissionsPaused()` switch. The selected `@zkp2p/contracts-v2`
|
|
481
505
|
bundle resolves the StakeVault, DisputeProtectionPolicy, and OrchestratorV3 for
|
|
482
506
|
both the production and staging bundles; a bundle without them fails closed
|
|
@@ -487,9 +511,11 @@ deployments).
|
|
|
487
511
|
Keeper writes are direct and prepareable:
|
|
488
512
|
|
|
489
513
|
```ts
|
|
514
|
+
// August V1 policy behind OrchestratorV3 only.
|
|
490
515
|
const enableProtection = await client.setDisputeProtectionEnabled.prepare({
|
|
491
516
|
escrow: depositEscrow,
|
|
492
517
|
depositId: 42n,
|
|
518
|
+
paymentMethod: paymentMethodHash,
|
|
493
519
|
enabled: true,
|
|
494
520
|
});
|
|
495
521
|
|
|
@@ -523,24 +549,8 @@ same finalized cutoff for every cursor in one ingestion pass. Follow
|
|
|
523
549
|
`endCursor` with its final block/log position; `endCursor` is null only for an
|
|
524
550
|
empty page.
|
|
525
551
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
```ts
|
|
530
|
-
const readiness = await client.getDisputeProtectionReadiness();
|
|
531
|
-
|
|
532
|
-
if (readiness.state !== 'active_successor_verified' || !readiness.readyForDisputeProtection) {
|
|
533
|
-
throw new Error(`Dispute protection is unavailable: ${readiness.state}`);
|
|
534
|
-
}
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
Known results expose `verifiedStack`: `manifest` for the manifest path or
|
|
538
|
-
`bypass_records` for an active Bypass hook distinct from the manifest hook. The
|
|
539
|
-
Bypass path proves code presence and the specified hook/registry/policy/vault
|
|
540
|
-
relations at one block; it does not claim manifest runtime-hash or governance
|
|
541
|
-
verification for those new deployments. Missing records leave this path off.
|
|
542
|
-
On Base staging the manifest now names the Bypass stack, so its Bypass records
|
|
543
|
-
equal the manifest identities and readiness runs the full manifest path there.
|
|
552
|
+
The existing readiness API verifies the V3 manifest only. V4 readiness is pending
|
|
553
|
+
the new deployment manifest.
|
|
544
554
|
|
|
545
555
|
The manifest reader pins every code and state read to one `asOfBlock`, including exact
|
|
546
556
|
governance owners, authorization sets, attestation witnesses, and signature
|
|
@@ -588,13 +598,11 @@ selection hashes. A local build has the deterministic `development` identity
|
|
|
588
598
|
and is deliberately non-distributable, so its readiness reader returns
|
|
589
599
|
`mismatch` before making RPC calls.
|
|
590
600
|
|
|
591
|
-
Quote and orderbook requests accept `includeNoStakeCompatible?: boolean` to opt in to protected rows a taker may signal without stake (Venmo only today). Only `true` is sent; false and omitted values leave the field absent.
|
|
592
|
-
|
|
593
601
|
For table-style liquidity UIs, the low-level `apiGetOrderbookTable()` adapter exposes curator's paginated public/private orderbook rows and row-level privacy metadata.
|
|
594
602
|
|
|
595
603
|
## Seller Credential Status
|
|
596
604
|
|
|
597
|
-
Venmo and
|
|
605
|
+
Venmo, PayPal and X Money Seller Autopilot connections use `uploadGoogleOAuthSellerCredential` for Gmail, `uploadMicrosoftOAuthSellerCredential` for personal Outlook accounts, or `uploadICloudMailSellerCredential` for iCloud Mail. The normal `uploadSellerCredential` and extension seller-capture paths support Cash App, Wise (token upload only), and Amazon Pay UPI. Existing backend Venmo cookie bundles remain usable through status/verification and low-level encrypted-bundle APIs.
|
|
598
606
|
|
|
599
607
|
```ts
|
|
600
608
|
await client.uploadGoogleOAuthSellerCredential({
|
|
@@ -618,9 +626,11 @@ await client.uploadMicrosoftOAuthSellerCredential({
|
|
|
618
626
|
});
|
|
619
627
|
```
|
|
620
628
|
|
|
629
|
+
X Money mailbox uploads require SDK 0.14.9 or later. For Gmail and Outlook, pass `platform: 'xmoney'` with the registered maker hash and the same OAuth code fields; no `payeeEmail` is needed. Enable X Money email notifications and receive a payment before connecting. The server accepts a credential only after validating a received-payment email for the registered X account. A historical receipt establishes delivery, not the current notification-setting state; keep notifications enabled for future payments. A missing or invalid receipt returns `XMONEY_EMAIL_RECEIPT_NOT_FOUND`.
|
|
630
|
+
|
|
621
631
|
Validate OAuth state in the initiating browser tab before uploading. `redirectUri` must exactly match the one in the authorization request. Both methods exchange a one-time code without retrying; start fresh consent if the response is lost. The Microsoft client secret stays server-side. See [email connection setup](../../docs/email-oauth.md).
|
|
622
632
|
|
|
623
|
-
iCloud Mail has no OAuth. Pass the seller's Apple app-specific password with the registered maker hash; PayPal also passes its receiving email. For Venmo, the SDK fetches the maker's account ID from Curator (`GET /v2/makers/venmo/{payeeDetails}/payee-id`) and checks it against `payeeDetails` before any mailbox work, so sellers never enter it.
|
|
633
|
+
iCloud Mail has no OAuth. Pass the seller's Apple app-specific password with the registered maker hash; PayPal also passes its receiving email, and X Money passes `payeeUsername` (normalized lowercase and checked against the maker hash). For Venmo, the SDK fetches the maker's account ID from Curator (`GET /v2/makers/venmo/{payeeDetails}/payee-id`) and checks it against `payeeDetails` before any mailbox work, so sellers never enter it.
|
|
624
634
|
|
|
625
635
|
```ts
|
|
626
636
|
await client.uploadICloudMailSellerCredential({
|
|
@@ -675,90 +685,124 @@ await client.releaseFundsToPayer({
|
|
|
675
685
|
|
|
676
686
|
Use `referralFees[]` for multi-recipient fee distribution on OrchestratorV2 and V3.
|
|
677
687
|
|
|
678
|
-
### Signal
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
688
|
+
### Signal data and deferred payouts
|
|
689
|
+
|
|
690
|
+
New intents target OrchestratorV4 when its deployment is present, otherwise
|
|
691
|
+
OrchestratorV3. Caller `data?: Hex` and `postIntentHook` are O3-only;
|
|
692
|
+
O4 rejects non-empty caller data or a nonzero hook. Its `/v3/sign` request omits
|
|
693
|
+
`postIntentHook` and sends `data: '0x'`. O4 fulfilment contains only `paymentProof`, `intentHash`, and
|
|
694
|
+
`verificationData`; non-empty `postIntentHookData` is rejected. Existing intents resolve their original orchestrator through indexer
|
|
695
|
+
routing and on-chain reads; they keep fulfilling, cancelling and releasing there.
|
|
696
|
+
O4 reads use the package O4 ABI directly, including account-intent enumeration;
|
|
697
|
+
ProtocolViewerV2 only decodes O3 and older intents. O4 intents have no `postIntentHook`.
|
|
698
|
+
Use `getCurrentOrchestratorContract()` for new intents and
|
|
699
|
+
`resolveIntentOrchestrator(intentHash)` for existing ones.
|
|
700
|
+
|
|
701
|
+
Every O4 `signalIntent` struct ends with `bytes data`. The SDK always sends `0x`,
|
|
702
|
+
so the gating signature covers the plain V3 packed message. The contracts can
|
|
703
|
+
check a conditions hash carried in `data`, but nothing sets one yet. A stale O4
|
|
704
|
+
ABI fails before signing or encoding.
|
|
705
|
+
|
|
706
|
+
Attestation data retains the 448-byte UPV3 payload. For non-manual O4
|
|
707
|
+
fulfilment, extension word 0 is the required `disputeWindow` in seconds (0 means
|
|
708
|
+
pay now, maximum 180 days), so O4 payloads are 480 bytes. O3's 448-byte payload
|
|
709
|
+
is unchanged. The SDK forwards the attestor's bytes unchanged.
|
|
710
|
+
|
|
711
|
+
V2 may require stake or hold a payout when the rail default window is positive,
|
|
712
|
+
the deposit token is the vault's stake token (USDC), the deposit+method whitelist
|
|
713
|
+
is off, and the taker is not a registered relayer bypassing collateral.
|
|
714
|
+
Registered relayers bypass by default unless the deposit has opted out.
|
|
715
|
+
Registration means O4's current `relayerRegistry()`: the policy has no registry of
|
|
716
|
+
its own and reads O4's at settlement, so compute `takerIsRelayer` from O4's
|
|
717
|
+
registry at the same block as the other quote inputs. The SDK re-exports `DISPUTE_WINDOW_POLICY`,
|
|
718
|
+
`getDefaultDisputeWindow` and `DisputeWindowPaymentMethod` from the attestation
|
|
719
|
+
client. `mayRequireDisputeProtection({ paymentMethod, depositToken, stakeToken,
|
|
720
|
+
whitelistEnabled, takerIsRelayer, relayerBypassOptedOut })` implements this
|
|
721
|
+
quote-time rule. Venmo and PayPal default to 14 days; other supported rails default to zero. The attestor can sign a
|
|
722
|
+
shorter window, including zero for balance-funded Venmo buyer-TEE evidence or
|
|
723
|
+
when its window config switch is disabled.
|
|
724
|
+
|
|
725
|
+
Manual release, a signed zero window, or a non-stake deposit token pays now
|
|
726
|
+
without a policy record or event. With a positive window and USDC, an enabled
|
|
727
|
+
deposit+method whitelist with an allowed taker pays directly without a record
|
|
728
|
+
or policy event. Registered relayers also pay directly unless the deposit opts out.
|
|
729
|
+
Otherwise sufficient free stake produces `STAKE`, or the net payout is
|
|
730
|
+
held as `DEFERRED_PAYOUT` until `releaseEligibleAt = settlement time + window`.
|
|
731
|
+
Whitelist membership, relayer registration (O4's registry, read by the policy at
|
|
732
|
+
settlement) and the deposit opt-out are read live at fulfilment. O4 never executes post-intent hooks.
|
|
733
|
+
|
|
734
|
+
`setDepositOptOutForRelayerBypass({ escrow, depositId, optOut })` and its
|
|
735
|
+
`.prepare()` form configure a V2 deposit after creation. Only the depositor may
|
|
736
|
+
write, not a delegate (`NotDepositor`). Read the setting with
|
|
737
|
+
`isDepositOptedOutForRelayerBypass({ escrow, depositId })`; false is the default.
|
|
738
|
+
Both methods resolve and verify the current O4 `settlementPolicy()` and fail
|
|
739
|
+
closed without O4. This is deposit-wide, independent of payment method; indexer
|
|
740
|
+
projections use `relayerBypassOptedOut`. It does not disable protection generally
|
|
741
|
+
or change the whitelist. No deposit-creation setting is added.
|
|
742
|
+
|
|
743
|
+
`CollateralSource` is `NONE, STAKE, DEFERRED_PAYOUT`. A missing (`NONE`)
|
|
744
|
+
record returns `NOT_PROTECTED`; callers treat that as paid only after successful
|
|
745
|
+
fulfilment. Whitelisted orders also read as `NONE`. Deferred records are `SETTLED` from
|
|
746
|
+
creation. Classify a fulfil receipt using the policy's
|
|
747
|
+
`DisputeProtectionIntentSettled` log first (it has no `isManualRelease`), then
|
|
748
|
+
O4's `IntentPayoutDeferred` (deferred, including after policy rotation), then
|
|
749
|
+
`IntentFulfilled.isManualRelease` for direct/unprotected payouts.
|
|
750
|
+
`parsePayoutSettlementFromLogs(logs, intentHash, resolvedAddresses)` applies this
|
|
751
|
+
order and rejects logs from other addresses or intents; call it only for a successful receipt.
|
|
718
752
|
|
|
719
753
|
```ts
|
|
720
|
-
const
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
const prepared = await client.setIntentNoStake.prepare({
|
|
724
|
-
intentHash,
|
|
725
|
-
noStake: true,
|
|
726
|
-
});
|
|
727
|
-
// Or execute using client.setIntentNoStake({ intentHash, noStake: true }).
|
|
728
|
-
|
|
729
|
-
const noStake = await client.isIntentNoStake(intentHash);
|
|
730
|
-
const intent = await client.getDisputeProtectionIntent(intentHash, {
|
|
731
|
-
disputeProtectionPolicyAddress: policy.address,
|
|
732
|
-
blockNumber: 123456n, // Optional historical read
|
|
733
|
-
});
|
|
754
|
+
const payout = await client.getPayoutStatus(intentHash);
|
|
755
|
+
const payouts = await client.getPayoutStatuses(intentHashes);
|
|
756
|
+
const prepared = await client.claimFor.prepare({ intentHash });
|
|
734
757
|
```
|
|
735
758
|
|
|
736
|
-
`
|
|
737
|
-
`
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
`
|
|
745
|
-
policy
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
`
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
`
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
759
|
+
`PayoutState` contains `NOT_PROTECTED`, `PAID`, `HELD`,
|
|
760
|
+
`CLAIMABLE`, `CLAIMED`, `RELEASED_TO_STAKE`, and `DISPUTED`. Results include
|
|
761
|
+
`collateralSource`, `recipient`, `taker`, `lockedAmount`, `claimedAmount`,
|
|
762
|
+
`releaseEligibleAt`, and `claimable`. Reads pin the intent and dependent free-stake
|
|
763
|
+
batches to one block. A released payout can be claimed only up to the remaining
|
|
764
|
+
per-intent amount and the recipient's free stake. The taker or recipient may call
|
|
765
|
+
`claimFor`; funds always go to the recipient.
|
|
766
|
+
|
|
767
|
+
`claimFor({ intentHash, disputeProtectionPolicyAddress?, txOverrides? })` resolves
|
|
768
|
+
the policy holding the intent. An optional `disputeProtectionPolicyAddress` must
|
|
769
|
+
match that resolved policy; a mismatch, missing intent, invalid hash, or
|
|
770
|
+
non-cascade policy throws `ValidationError`. Both sending and `.prepare()` target
|
|
771
|
+
the resolved cascade policy. Omitting the address performs the same lookup.
|
|
772
|
+
Payout reads and `claimFor` first ask the client's indexer for the intent's
|
|
773
|
+
settlement policy (`IntentSettlementPolicyState`, recorded from O4's
|
|
774
|
+
`IntentSettlementPolicySnapshotted`; O4 deletes its own snapshot at settlement).
|
|
775
|
+
They read the record from that policy and use that policy's `stakeVault()`, so a
|
|
776
|
+
policy rotated out before a package update still resolves. Only rows for the
|
|
777
|
+
client's chain and packaged OrchestratorV4 count, and the indexed policy must
|
|
778
|
+
return a valid V2 record for the intent. When the indexer has no row (for example
|
|
779
|
+
just after fulfilment), fails, or does not serve the entity yet, or the indexed
|
|
780
|
+
policy has no record, the SDK falls back to the packaged `disputeProtectionPolicyV2`
|
|
781
|
+
and the live `settlementPolicy()` read from the packaged OrchestratorV4 address.
|
|
782
|
+
Zero addresses are skipped and candidates are deduplicated; both are classified
|
|
783
|
+
as V2. If the indexed policy's read fails and the fallback finds no record, the
|
|
784
|
+
read throws instead of returning `NOT_PROTECTED`. Payout reads pin every record,
|
|
785
|
+
each holding policy's `stakeVault()`, and its recipient's `freeStake` to one
|
|
786
|
+
block. No record returns `NOT_PROTECTED`; records on two fallback policies fail
|
|
787
|
+
closed. Claims target the policy holding the record, which pays only the
|
|
788
|
+
record's recipient. The standalone `getPayoutStatuses(publicClient, chainId, env,
|
|
789
|
+
hashes, { indexer? })` and `findDisputeProtectionIntent({ ..., indexer? })` use an
|
|
790
|
+
indexer only when one is passed. The strict current-stack checks for stake writes
|
|
791
|
+
are unchanged.
|
|
792
|
+
|
|
793
|
+
`client.parseDeferredPayoutFromLogs(logs, intentHash)` accepts only events from
|
|
794
|
+
its packaged cascade policy or V4 orchestrator. O4's `IntentPayoutDeferred` also identifies deferrals after policy rotation. The standalone parser additionally
|
|
795
|
+
requires `{ disputeProtectionPolicyV2Address, orchestratorV4Address }`.
|
|
796
|
+
|
|
797
|
+
`findDisputeProtectionIntent` returns a discriminated `generation`:
|
|
798
|
+
`PolicyGeneration.V2` has a validated ten-field record (no `riskWindow` or `releaseAmount`) and four statuses (`NONE`, `SETTLED`, `RELEASED`, `DISPUTED`, ordinals 0–3);
|
|
799
|
+
`PolicyGeneration.V1` retains the eight-field record and six statuses.
|
|
800
|
+
`readDisputeAttestationConfig({ policyAddress })` follows either known generation.
|
|
801
|
+
|
|
802
|
+
V4 readiness and indexer APIs that list deferred payouts await the new manifest
|
|
803
|
+
and indexer schema; payout reads already use the indexer's settlement-policy rows
|
|
804
|
+
when it serves them. The retained readiness reader verifies V3 only and is not V4 readiness
|
|
805
|
+
proof. This SDK version is `0.15.0-rc.1`, a prerelease on the npm `dev` tag.
|
|
762
806
|
|
|
763
807
|
## Extend an Intent Lifetime
|
|
764
808
|
|
|
@@ -807,15 +851,28 @@ The guardian charges the target deposit's token and pays the deposit owner.
|
|
|
807
851
|
Extension payments are prepaid and non-refundable. `extendIntentLifetime.prepare()`
|
|
808
852
|
returns calldata without sending it.
|
|
809
853
|
|
|
810
|
-
##
|
|
854
|
+
## Deposit Access Policy
|
|
811
855
|
|
|
812
856
|
`client.accessPolicy` exposes environment-aware reads and unwind-only prepared
|
|
813
857
|
transactions for policies written before Groups were retired. Gate use on
|
|
814
858
|
`client.accessPolicy.isSupported`; unsupported deployments fail closed.
|
|
815
859
|
|
|
860
|
+
It targets the current orchestrator's deposit whitelist. That is
|
|
861
|
+
`WhitelistPolicyV4` when OrchestratorV4 is deployed (Base staging), otherwise
|
|
862
|
+
`WhitelistPolicy` (Base production). `getContracts().addresses.whitelistPolicy`
|
|
863
|
+
and `client.whitelistPolicyAddress` resolve the same contract, which equals
|
|
864
|
+
`whitelistPolicy()` on OrchestratorV4 and DisputeProtectionPolicyV2. If
|
|
865
|
+
OrchestratorV4 is deployed without `WhitelistPolicyV4`, both are undefined and
|
|
866
|
+
access-policy calls fail closed. They never fall back to O3's whitelist.
|
|
867
|
+
Every deposit starts with the whitelist off on `WhitelistPolicyV4`. Entries on
|
|
868
|
+
O3's `WhitelistPolicy` don't carry over and only gate OrchestratorV3 signals.
|
|
869
|
+
|
|
816
870
|
Existing policies remain enforced on-chain until disabled or their deposits
|
|
817
|
-
close. The only new policy is the trusted
|
|
818
|
-
adds to Venmo and PayPal deposits
|
|
871
|
+
close. The only new policy is the opt-in trusted-group whitelist that
|
|
872
|
+
`createDeposit()` adds to Venmo and PayPal deposits only with
|
|
873
|
+
`enableTrustedGroupBypass: true` (defaults to false). On OrchestratorV4 an enabled
|
|
874
|
+
whitelist makes the deposit private: only Peer Pay merchant-group members can
|
|
875
|
+
signal, and members skip dispute-protection staking. Depositors can use
|
|
819
876
|
`prepareDisable`, `prepareRemoveAllowedGroups`, and
|
|
820
877
|
`prepareRemoveWhitelistedAddresses` to fail open and remove historical entries.
|
|
821
878
|
|
|
@@ -1325,11 +1382,15 @@ Amazon capture requires extension 0.6.8 or later. Staging SAR uses the trusted s
|
|
|
1325
1382
|
### Historical dispute policy lookup
|
|
1326
1383
|
|
|
1327
1384
|
`findDisputeProtectionIntent({ publicClient, chainId, environment, intentHash,
|
|
1328
|
-
blockNumber? })`
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1385
|
+
blockNumber?, indexer? })` first reads the indexer's settlement policy for the
|
|
1386
|
+
intent when an `indexer` is passed (see deferred payouts). Otherwise, or when that
|
|
1387
|
+
policy holds no record, it queries the packaged V2 and O4 live settlement policies, then
|
|
1388
|
+
canonical, manifest, and recognized predecessor policies, deduplicated at one
|
|
1389
|
+
block. Both V2 candidates use the cascade ABI. Multiple V2 records for one hash
|
|
1390
|
+
throw; otherwise the first intent whose status is not `None` wins. It returns `null` only when every intent read parses as
|
|
1391
|
+
`None`; an unreadable intent throws. The result contains the policy
|
|
1392
|
+
`generation` (`v2` or `v1`), `policyAddress`, and the `intent` parsed with
|
|
1393
|
+
that generation's struct and status enum.
|
|
1333
1394
|
All calls share a block. Use the returned policy for dispute submission and
|
|
1334
1395
|
`readDisputeAttestationConfig({ publicClient, chainId, environment, policyAddress })`.
|
|
1335
1396
|
For a known non-manifest policy, the latter follows `disputeVerifier()` and
|
package/dist/build-metadata.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"source": {
|
|
4
4
|
"repository": "zkp2p/zkp2p-clients",
|
|
5
|
-
"commitSha": "
|
|
5
|
+
"commitSha": "503d0587c1f674b6402f741b143a2881f0b55ca5",
|
|
6
6
|
"kind": "github",
|
|
7
7
|
"distributable": true
|
|
8
8
|
},
|
|
9
|
-
"sdkPackageVersion": "0.15.0-rc.
|
|
10
|
-
"contractsPackageVersion": "0.4.4-rc.
|
|
9
|
+
"sdkPackageVersion": "0.15.0-rc.1",
|
|
10
|
+
"contractsPackageVersion": "0.4.4-rc.6",
|
|
11
11
|
"indexerSchemaPackageVersion": "0.22.0",
|
|
12
12
|
"activeDisputeStack": {
|
|
13
13
|
"base": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"baseStaging": {
|
|
18
18
|
"version": 2,
|
|
19
|
-
"selectionHash": "
|
|
19
|
+
"selectionHash": "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -5,8 +5,8 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// <define:__ZKP2P_SDK_BUILD_METADATA__>
|
|
8
|
-
var define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "
|
|
8
|
+
var define_ZKP2P_SDK_BUILD_METADATA_default = { schemaVersion: 2, source: { repository: "zkp2p/zkp2p-clients", commitSha: "503d0587c1f674b6402f741b143a2881f0b55ca5", kind: "github", distributable: true }, sdkPackageVersion: "0.15.0-rc.1", contractsPackageVersion: "0.4.4-rc.6", indexerSchemaPackageVersion: "0.22.0", activeDisputeStack: { base: { version: 2, selectionHash: "ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c" }, baseStaging: { version: 2, selectionHash: "6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9" } } };
|
|
9
9
|
|
|
10
10
|
export { __export, define_ZKP2P_SDK_BUILD_METADATA_default };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-FCGUBJAP.mjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-FCGUBJAP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["%3Cdefine:__ZKP2P_SDK_BUILD_METADATA__%3E"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uCAAA,GAAA,EAAC,aAAA,EAAgB,CAAA,EAAE,MAAA,EAAS,EAAC,YAAa,qBAAA,EAAsB,SAAA,EAAY,0CAAA,EAA2C,IAAA,EAAO,UAAS,aAAA,EAAgB,IAAA,EAAI,EAAE,iBAAA,EAAoB,eAAc,uBAAA,EAA0B,YAAA,EAAa,2BAAA,EAA8B,QAAA,EAAS,oBAAqB,EAAC,IAAA,EAAO,EAAC,OAAA,EAAU,GAAE,aAAA,EAAgB,kEAAA,EAAkE,EAAE,WAAA,EAAc,EAAC,OAAA,EAAU,CAAA,EAAE,aAAA,EAAgB,kEAAA,IAAmE","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["%3Cdefine:__ZKP2P_SDK_BUILD_METADATA__%3E"],"names":[],"mappings":";;;;;;;AAAA,IAAA,uCAAA,GAAA,EAAC,aAAA,EAAgB,CAAA,EAAE,MAAA,EAAS,EAAC,YAAa,qBAAA,EAAsB,SAAA,EAAY,0CAAA,EAA2C,IAAA,EAAO,UAAS,aAAA,EAAgB,IAAA,EAAI,EAAE,iBAAA,EAAoB,eAAc,uBAAA,EAA0B,YAAA,EAAa,2BAAA,EAA8B,QAAA,EAAS,oBAAqB,EAAC,IAAA,EAAO,EAAC,OAAA,EAAU,GAAE,aAAA,EAAgB,kEAAA,EAAkE,EAAE,WAAA,EAAc,EAAC,OAAA,EAAU,CAAA,EAAE,aAAA,EAAgB,kEAAA,IAAmE","file":"chunk-FCGUBJAP.mjs","sourcesContent":["{\"schemaVersion\":2,\"source\":{\"repository\":\"zkp2p/zkp2p-clients\",\"commitSha\":\"503d0587c1f674b6402f741b143a2881f0b55ca5\",\"kind\":\"github\",\"distributable\":true},\"sdkPackageVersion\":\"0.15.0-rc.1\",\"contractsPackageVersion\":\"0.4.4-rc.6\",\"indexerSchemaPackageVersion\":\"0.22.0\",\"activeDisputeStack\":{\"base\":{\"version\":2,\"selectionHash\":\"ba40c2954b408d0c658881a8d28e5bfcc9bade5cc3d953fd17eae1eca69d841c\"},\"baseStaging\":{\"version\":2,\"selectionHash\":\"6c49c1ce51eec594a22385c4efcab08aa9926b6b63a725e14a0027ec5d2f4fc9\"}}}"]}
|