@zkp2p/sdk 0.14.10 → 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 +211 -28
- package/dist/build-metadata.json +3 -3
- package/dist/chunk-FCGUBJAP.mjs +12 -0
- package/dist/chunk-FCGUBJAP.mjs.map +1 -0
- package/dist/{chunk-PLUTAOT5.mjs → chunk-KWAYQB7K.mjs} +74222 -54270
- package/dist/chunk-KWAYQB7K.mjs.map +1 -0
- package/dist/{currency-74LZHM6Q.mjs → currency-THZHOZ5A.mjs} +3 -3
- package/dist/{currency-74LZHM6Q.mjs.map → currency-THZHOZ5A.mjs.map} +1 -1
- package/dist/index.cjs +80787 -59614
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +48 -65
- package/dist/index.d.ts +48 -65
- package/dist/index.mjs +9062 -7954
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-SPW7UPEH.mjs +5 -0
- package/dist/{protocolViewerParsers-6BOFKH3F.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-WX76D6NU.mjs → timeout-JJJQO4B3.mjs} +3 -3
- package/dist/{timeout-WX76D6NU.mjs.map → timeout-JJJQO4B3.mjs.map} +1 -1
- package/dist/{vaultUtils-PRhZBjwX.d.mts → vaultUtils-BJhHYqte.d.mts} +335 -52
- package/dist/{vaultUtils-PRhZBjwX.d.ts → vaultUtils-BJhHYqte.d.ts} +335 -52
- package/package.json +3 -3
- package/dist/chunk-DIHRDN2W.mjs +0 -12
- package/dist/chunk-DIHRDN2W.mjs.map +0 -1
- package/dist/chunk-PLUTAOT5.mjs.map +0 -1
- package/dist/protocolViewerParsers-6BOFKH3F.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.
|
|
@@ -81,7 +81,7 @@ apart. Deploy the hosted page before using the SDK helper. See the
|
|
|
81
81
|
|
|
82
82
|
### X Money receipt linking
|
|
83
83
|
|
|
84
|
-
`getXMoneyConnectUrl` and `openXMoneyConnect
|
|
84
|
+
SDK `0.14.10` adds `getXMoneyConnectUrl` and `openXMoneyConnect`, using the same mailbox flow at
|
|
85
85
|
`/connect/xmoney`. Pass the registered `payeeDetails` hash and `payeeUsername`.
|
|
86
86
|
The normalized X username must hash to that identity. Both stay in the URL
|
|
87
87
|
fragment. X Money email notifications must be enabled and the inbox must contain
|
|
@@ -332,14 +332,17 @@ console.log(result.hash);
|
|
|
332
332
|
console.log(result.depositDetails);
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
`
|
|
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
|
|
338
341
|
merchant group and returns the confirmed hashes as
|
|
339
342
|
`result.accessPolicyTxHashes` (empty for other methods). Members of that group
|
|
340
|
-
skip dispute-protection staking
|
|
341
|
-
|
|
342
|
-
|
|
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
|
|
343
346
|
`ContractError` whose `details.hash` is the deposit transaction. `prepareCreateDeposit()` does not add
|
|
344
347
|
the policy; custom senders call `client.accessPolicy.prepareConfigurePeerPayMerchantDeposit()`
|
|
345
348
|
once the deposit ID is known.
|
|
@@ -408,6 +411,7 @@ await client.setTakerAuthorization({ taker, authorized: true }); // signed by th
|
|
|
408
411
|
await client.selectStakeOwner({ stakeOwner: safeAddress }); // signed by the taker
|
|
409
412
|
await client.clearStakeOwner(); // taker returns to self-stake
|
|
410
413
|
|
|
414
|
+
// Explicit vaults are verified through the live stack independently by each client.
|
|
411
415
|
const onchain = await client.getStakeVaultState({
|
|
412
416
|
staker: takerAddress,
|
|
413
417
|
taker: takerAddress,
|
|
@@ -416,7 +420,7 @@ const onchain = await client.getStakeVaultState({
|
|
|
416
420
|
const indexed = await client.indexer.getStakingState({
|
|
417
421
|
chainId: 8453,
|
|
418
422
|
environment: 'base',
|
|
419
|
-
vaultAddress: client.
|
|
423
|
+
vaultAddress: (await client.getActiveStakeVaultContract()).address,
|
|
420
424
|
disputeProtectionPolicyAddress: client.getDisputeProtectionPolicyContract().address,
|
|
421
425
|
taker: takerAddress,
|
|
422
426
|
// Always supply the effective owner from the fresh on-chain read.
|
|
@@ -427,7 +431,7 @@ const indexed = await client.indexer.getStakingState({
|
|
|
427
431
|
|
|
428
432
|
const locks = await client.indexer.getStakeLocks({
|
|
429
433
|
chainId: 8453,
|
|
430
|
-
vaultAddress: client.
|
|
434
|
+
vaultAddress: (await client.getActiveStakeVaultContract()).address,
|
|
431
435
|
stakeOwner: onchain.stakeOwner,
|
|
432
436
|
status: 'ACTIVE',
|
|
433
437
|
limit: 50,
|
|
@@ -435,7 +439,7 @@ const locks = await client.indexer.getStakeLocks({
|
|
|
435
439
|
|
|
436
440
|
const activity = await client.indexer.getStakeActivity({
|
|
437
441
|
chainId: 8453,
|
|
438
|
-
vaultAddress: client.
|
|
442
|
+
vaultAddress: (await client.getActiveStakeVaultContract()).address,
|
|
439
443
|
merchant: takerAddress,
|
|
440
444
|
orderDirection: 'desc', // Newest first; defaults to asc for chronological ingestion.
|
|
441
445
|
limit: 50,
|
|
@@ -447,7 +451,7 @@ const activity = await client.indexer.getStakeActivity({
|
|
|
447
451
|
|
|
448
452
|
const totals = await client.indexer.getStakeTotals({
|
|
449
453
|
chainId: 8453,
|
|
450
|
-
vaultAddress: client.
|
|
454
|
+
vaultAddress: (await client.getActiveStakeVaultContract()).address,
|
|
451
455
|
});
|
|
452
456
|
// totals.totalStaked and totals.totalLocked are decimal strings in token base units.
|
|
453
457
|
// totals.stakerCount counts owners whose stake balance is greater than zero.
|
|
@@ -469,9 +473,34 @@ withdraws the complete claimable balance. Chargebackable capacity is exactly
|
|
|
469
473
|
the effective owner's free stake (1:1); never sum a taker's self-stake with a
|
|
470
474
|
sponsor's stake.
|
|
471
475
|
|
|
472
|
-
|
|
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
|
|
473
503
|
per-payment-method risk windows (`getRiskWindow(paymentMethodHash)`),
|
|
474
|
-
per-deposit chargeback enablement (`isDisputeProtectionEnabled(escrow, depositId)`),
|
|
475
504
|
and the global `admissionsPaused()` switch. The selected `@zkp2p/contracts-v2`
|
|
476
505
|
bundle resolves the StakeVault, DisputeProtectionPolicy, and OrchestratorV3 for
|
|
477
506
|
both the production and staging bundles; a bundle without them fails closed
|
|
@@ -482,9 +511,11 @@ deployments).
|
|
|
482
511
|
Keeper writes are direct and prepareable:
|
|
483
512
|
|
|
484
513
|
```ts
|
|
514
|
+
// August V1 policy behind OrchestratorV3 only.
|
|
485
515
|
const enableProtection = await client.setDisputeProtectionEnabled.prepare({
|
|
486
516
|
escrow: depositEscrow,
|
|
487
517
|
depositId: 42n,
|
|
518
|
+
paymentMethod: paymentMethodHash,
|
|
488
519
|
enabled: true,
|
|
489
520
|
});
|
|
490
521
|
|
|
@@ -518,18 +549,10 @@ same finalized cutoff for every cursor in one ingestion pass. Follow
|
|
|
518
549
|
`endCursor` with its final block/log position; `endCursor` is null only for an
|
|
519
550
|
empty page.
|
|
520
551
|
|
|
521
|
-
|
|
522
|
-
|
|
552
|
+
The existing readiness API verifies the V3 manifest only. V4 readiness is pending
|
|
553
|
+
the new deployment manifest.
|
|
523
554
|
|
|
524
|
-
|
|
525
|
-
const readiness = await client.getDisputeProtectionReadiness();
|
|
526
|
-
|
|
527
|
-
if (readiness.state !== 'active_successor_verified' || !readiness.readyForDisputeProtection) {
|
|
528
|
-
throw new Error(`Dispute protection is unavailable: ${readiness.state}`);
|
|
529
|
-
}
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
The reader pins every code and state read to one `asOfBlock`, including exact
|
|
555
|
+
The manifest reader pins every code and state read to one `asOfBlock`, including exact
|
|
533
556
|
governance owners, authorization sets, attestation witnesses, and signature
|
|
534
557
|
thresholds. It distinguishes
|
|
535
558
|
`recognized_predecessor`, `passive_successor`, `active_successor_verified`,
|
|
@@ -541,6 +564,15 @@ verified while `orchestratorPaused`, `allowMultipleIntents`, and
|
|
|
541
564
|
traffic. Unknown hooks, misconfigured successors, runtime-code changes,
|
|
542
565
|
dependency mismatches, and RPC failures return `mismatch` and fail closed.
|
|
543
566
|
|
|
567
|
+
An activated successor may keep its recognized predecessor policy as a
|
|
568
|
+
`DisputeNullifierRegistry` writer while that predecessor's intents drain. The
|
|
569
|
+
active state therefore requires every active writer and accepts the
|
|
570
|
+
manifest's `RecognizedPredecessorPolicy` as the only additional writer, after
|
|
571
|
+
verifying its packaged runtime hash at `asOfBlock`. Any other writer, or a
|
|
572
|
+
missing active writer, is a `mismatch`. The passive state keeps its exact
|
|
573
|
+
writer set, and an orchestrator the manifest does not list is always a
|
|
574
|
+
`mismatch`.
|
|
575
|
+
|
|
544
576
|
Dispute evidence callers should read the current attestation trust roots before
|
|
545
577
|
requesting evidence and again before submitting it:
|
|
546
578
|
|
|
@@ -549,6 +581,7 @@ const attestationConfig = await readDisputeAttestationConfig({
|
|
|
549
581
|
publicClient,
|
|
550
582
|
chainId: 8453,
|
|
551
583
|
environment: 'production',
|
|
584
|
+
// policyAddress: found.policyAddress, // optional known historical policy
|
|
552
585
|
});
|
|
553
586
|
|
|
554
587
|
if (attestationConfig.requiredSignatures !== 1) {
|
|
@@ -652,6 +685,125 @@ await client.releaseFundsToPayer({
|
|
|
652
685
|
|
|
653
686
|
Use `referralFees[]` for multi-recipient fee distribution on OrchestratorV2 and V3.
|
|
654
687
|
|
|
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.
|
|
752
|
+
|
|
753
|
+
```ts
|
|
754
|
+
const payout = await client.getPayoutStatus(intentHash);
|
|
755
|
+
const payouts = await client.getPayoutStatuses(intentHashes);
|
|
756
|
+
const prepared = await client.claimFor.prepare({ intentHash });
|
|
757
|
+
```
|
|
758
|
+
|
|
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.
|
|
806
|
+
|
|
655
807
|
## Extend an Intent Lifetime
|
|
656
808
|
|
|
657
809
|
The standalone `IntentGuardian` lets any payer buy more time for a live intent.
|
|
@@ -699,15 +851,28 @@ The guardian charges the target deposit's token and pays the deposit owner.
|
|
|
699
851
|
Extension payments are prepaid and non-refundable. `extendIntentLifetime.prepare()`
|
|
700
852
|
returns calldata without sending it.
|
|
701
853
|
|
|
702
|
-
##
|
|
854
|
+
## Deposit Access Policy
|
|
703
855
|
|
|
704
856
|
`client.accessPolicy` exposes environment-aware reads and unwind-only prepared
|
|
705
857
|
transactions for policies written before Groups were retired. Gate use on
|
|
706
858
|
`client.accessPolicy.isSupported`; unsupported deployments fail closed.
|
|
707
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
|
+
|
|
708
870
|
Existing policies remain enforced on-chain until disabled or their deposits
|
|
709
|
-
close. The only new policy is the trusted
|
|
710
|
-
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
|
|
711
876
|
`prepareDisable`, `prepareRemoveAllowedGroups`, and
|
|
712
877
|
`prepareRemoveWhitelistedAddresses` to fail open and remove historical entries.
|
|
713
878
|
|
|
@@ -1213,3 +1378,21 @@ pnpm docs
|
|
|
1213
1378
|
Use `platform: 'upi'` with `callerAddress` and `sessionMaterial: { sessionCookie, userAgent }` in the private extension runtime. Omit `payeeId` and `offchainId` when creating the bundle: the attestor derives the receiving VPA from Amazon's current QR. `getAmazonPaySellerIdentity(bundle)` reads that returned identity; storage registers that exact VPA and checks its maker hash against the sealed bundle. Never expose session material to the requesting page.
|
|
1214
1379
|
|
|
1215
1380
|
Amazon capture requires extension 0.6.8 or later. Staging SAR uses the trusted staging attestor and staging provider templates; production requires its Amazon template and backend rollout. This source change does not publish either package or extension.
|
|
1381
|
+
|
|
1382
|
+
### Historical dispute policy lookup
|
|
1383
|
+
|
|
1384
|
+
`findDisputeProtectionIntent({ publicClient, chainId, environment, intentHash,
|
|
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.
|
|
1394
|
+
All calls share a block. Use the returned policy for dispute submission and
|
|
1395
|
+
`readDisputeAttestationConfig({ publicClient, chainId, environment, policyAddress })`.
|
|
1396
|
+
For a known non-manifest policy, the latter follows `disputeVerifier()` and
|
|
1397
|
+
`attestationVerifier()` before reading witnesses and threshold at one block.
|
|
1398
|
+
Unknown policies throw. Omitting `policyAddress` preserves manifest behavior.
|
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.
|
|
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": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// <define:__ZKP2P_SDK_BUILD_METADATA__>
|
|
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
|
+
|
|
10
|
+
export { __export, define_ZKP2P_SDK_BUILD_METADATA_default };
|
|
11
|
+
//# sourceMappingURL=chunk-FCGUBJAP.mjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-FCGUBJAP.mjs.map
|
|
@@ -0,0 +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-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\"}}}"]}
|