@zkp2p/sdk 0.10.0-rc.1 → 0.10.0-rc.3

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
@@ -265,18 +265,35 @@ OrchestratorV3 signals are ungated: the SDK encodes an empty gating signature
265
265
  and zero expiration without calling the curator signing endpoint. Existing
266
266
  OrchestratorV2 signaling remains gated.
267
267
 
268
+ An explicit `orchestratorAddress` is caller-pinned. The SDK honors it even when
269
+ the address is outside the client's configured deployment context, using the
270
+ OrchestratorV3 ABI for signal, cancel, and fulfill preparation. This lets
271
+ integrators snapshot the target when a payment is created and keep every
272
+ lifecycle transaction on that target across later SDK or deployment changes.
273
+
268
274
  Keeper writes are direct and prepareable:
269
275
 
270
276
  ```ts
271
277
  const sweep = await client.releaseMaturedPositions.prepare({
272
278
  intentHashes: [intentHash],
279
+ riskManagerAddress: snapshottedRiskManagerAddress,
280
+ });
281
+ const settlement = await client.reconcileSettlement.prepare({
282
+ intentHash,
283
+ riskManagerAddress: snapshottedRiskManagerAddress,
273
284
  });
274
- const settlement = await client.reconcileSettlement.prepare({ intentHash });
275
285
  const cancellations = await client.reconcileCancellations.prepare({
276
286
  intentHashes: [intentHash],
287
+ riskManagerAddress: snapshottedRiskManagerAddress,
277
288
  });
278
289
  ```
279
290
 
291
+ Like `orchestratorAddress`, an explicit `riskManagerAddress` is caller-pinned
292
+ and may be outside the client's configured deployment context. All five keeper
293
+ methods honor it for direct and `.prepare()` calls, allowing sweepers to group
294
+ positions by their snapshotted RiskManager deployment without a later SDK
295
+ configuration change rerouting them.
296
+
280
297
  For receipt classification, import `RISK_POSITION_SETTLED_EVENT_ABI` and
281
298
  `DEFERRED_PAYOUT_RECORDED_EVENT_ABI` and pass them to viem's
282
299
  `decodeEventLog()`.
package/dist/index.cjs CHANGED
@@ -76536,7 +76536,8 @@ var IntentOperations = class {
76536
76536
  const currentEscrow = this.config.getEscrowV2Address();
76537
76537
  const currentOrchestrator = this.config.getOrchestratorV2Address();
76538
76538
  const isOrchestratorV3 = orchestratorContext.version === "v3";
76539
- if (currentEscrow && escrowContext.address.toLowerCase() !== currentEscrow.toLowerCase()) {
76539
+ const hasPinnedV3Target = isOrchestratorV3 && params.orchestratorAddress !== void 0;
76540
+ if (!hasPinnedV3Target && currentEscrow && escrowContext.address.toLowerCase() !== currentEscrow.toLowerCase()) {
76540
76541
  throw new Error("signalIntent is only supported on the current EscrowV2 deployment");
76541
76542
  }
76542
76543
  if (!isOrchestratorV3 && currentOrchestrator && orchestratorContext.address.toLowerCase() !== currentOrchestrator.toLowerCase()) {
@@ -81831,15 +81832,30 @@ var Zkp2pClient = class {
81831
81832
  "clearStakeOwner",
81832
81833
  () => []
81833
81834
  );
81834
- /** Release one or more RiskManager positions whose chargeback window matured. */
81835
+ /**
81836
+ * Release one or more RiskManager positions whose chargeback window matured.
81837
+ * Pass `riskManagerAddress` to pin the transaction to a snapshotted deployment.
81838
+ */
81835
81839
  this.releaseMaturedPositions = this.buildRiskManagerMethod("releaseMaturedPositions", (params) => [params.intentHashes]);
81836
- /** Reconcile one failed OrchestratorV3 settlement callback. */
81840
+ /**
81841
+ * Reconcile one failed OrchestratorV3 settlement callback.
81842
+ * Pass `riskManagerAddress` to pin the transaction to a snapshotted deployment.
81843
+ */
81837
81844
  this.reconcileSettlement = this.buildRiskManagerMethod("reconcileSettlement", (params) => [params.intentHash]);
81838
- /** Reconcile multiple failed OrchestratorV3 settlement callbacks. */
81845
+ /**
81846
+ * Reconcile multiple failed OrchestratorV3 settlement callbacks.
81847
+ * Pass `riskManagerAddress` to pin the transaction to a snapshotted deployment.
81848
+ */
81839
81849
  this.reconcileSettlements = this.buildRiskManagerMethod("reconcileSettlements", (params) => [params.intentHashes]);
81840
- /** Reconcile one failed OrchestratorV3 cancellation callback. */
81850
+ /**
81851
+ * Reconcile one failed OrchestratorV3 cancellation callback.
81852
+ * Pass `riskManagerAddress` to pin the transaction to a snapshotted deployment.
81853
+ */
81841
81854
  this.reconcileCancellation = this.buildRiskManagerMethod("reconcileCancellation", (params) => [params.intentHash]);
81842
- /** Reconcile multiple failed OrchestratorV3 cancellation callbacks. */
81855
+ /**
81856
+ * Reconcile multiple failed OrchestratorV3 cancellation callbacks.
81857
+ * Pass `riskManagerAddress` to pin the transaction to a snapshotted deployment.
81858
+ */
81843
81859
  this.reconcileCancellations = this.buildRiskManagerMethod("reconcileCancellations", (params) => [params.intentHashes]);
81844
81860
  // ╔═══════════════════════════════════════════════════════════════════════════╗
81845
81861
  // ║ CORE: DEPOSIT MANAGEMENT ║
@@ -83064,10 +83080,13 @@ var Zkp2pClient = class {
83064
83080
  const explicit = this.getOrchestratorContextByAddress(options?.orchestratorAddress);
83065
83081
  if (explicit) return explicit;
83066
83082
  if (options?.orchestratorAddress) {
83067
- const addr = options.orchestratorAddress;
83068
- const abi = this.orchestratorV2Abi ?? this.orchestratorAbi;
83083
+ const abi = this.orchestratorV3Abi ?? this.orchestratorAbi ?? this.orchestratorV2Abi;
83069
83084
  if (!abi) throw new Error("Orchestrator not available");
83070
- return { address: addr, abi, version: "v2" };
83085
+ return {
83086
+ address: options.orchestratorAddress,
83087
+ abi,
83088
+ version: this.orchestratorV3Abi ? "v3" : "v2"
83089
+ };
83071
83090
  }
83072
83091
  if (options?.intentHash) {
83073
83092
  try {
@@ -83253,7 +83272,7 @@ var Zkp2pClient = class {
83253
83272
  buildContractMethod(resolveContract, functionName, buildArgs, buildValue) {
83254
83273
  return Object.assign(
83255
83274
  async (params) => {
83256
- const contract = resolveContract();
83275
+ const contract = resolveContract(params);
83257
83276
  if (!contract.address || !contract.abi) {
83258
83277
  throw new Error(`${contract.label} not available`);
83259
83278
  }
@@ -83269,7 +83288,7 @@ var Zkp2pClient = class {
83269
83288
  },
83270
83289
  {
83271
83290
  prepare: async (params) => {
83272
- const contract = resolveContract();
83291
+ const contract = resolveContract(params);
83273
83292
  if (!contract.address || !contract.abi) {
83274
83293
  throw new Error(`${contract.label} not available`);
83275
83294
  }
@@ -83304,8 +83323,8 @@ var Zkp2pClient = class {
83304
83323
  }
83305
83324
  buildRiskManagerMethod(functionName, buildArgs) {
83306
83325
  return this.buildContractMethod(
83307
- () => ({
83308
- address: this.riskManagerAddress,
83326
+ (params) => ({
83327
+ address: params.riskManagerAddress ?? this.riskManagerAddress,
83309
83328
  abi: this.riskManagerAbi,
83310
83329
  label: "RiskManager"
83311
83330
  }),