@zkp2p/sdk 0.10.0-rc.4 → 0.10.0-rc.6

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
@@ -100,8 +100,8 @@ Indexer defaults by environment:
100
100
  | Seller automated release | `uploadSellerCredential`, `getSellerCredentialStatus`, `verifySellerPayment` |
101
101
  | Delegation and hooks | `setDelegate`, `removeDelegate`, `setRateManager`, `clearRateManager`, `setDepositRateManager`, `clearDepositRateManager`, `setDepositPreIntentHook`, `setDepositWhitelistHook` |
102
102
  | Vault / DRM | `createRateManager`, `setVaultMinRate`, `setVaultMinRatesBatch`, `setVaultFee`, `setVaultConfig`, `getDepositRateManager`, `getManagerFee`, `getEffectiveRate` |
103
- | Taker staking | `ensureStakeAllowance`, `depositStake`, `depositStakeFor`, partial withdrawal and full-exit methods, stake-owner permission methods, direct StakeVault reads, and exact risk-capacity math |
104
- | V3 settlement operations | `releaseMaturedPositions`, `reconcileSettlement(s)`, `reconcileCancellation(s)`, OrchestratorV3 intent prepares, and exported settlement event ABIs |
103
+ | Taker staking | `ensureStakeAllowance`, `depositStake`, `withdrawStake`, `claim`, `setTakerAuthorization`, `selectStakeOwner`, `clearStakeOwner`, direct StakeVault reads, and exact full-gross risk math |
104
+ | V3 settlement operations | `releaseMaturedPositions`, `reconcileCancellation(s)`, OrchestratorV3 intent prepares, and exported settlement event ABIs |
105
105
  | Oracle config | `setOracleRateConfig`, `setOracleRateConfigBatch`, `removeOracleRateConfig`, `updateCurrencyConfigBatch`, `deactivateCurrenciesBatch`, `supportsInlineOracleRateConfig`, `validateOracleFeedsOnChain` |
106
106
  | RPC reads | `getDeposits`, `getDeposit`, `getDepositsById`, `getIntents`, `getIntent`, `getPvDepositById`, `getPvDepositsFromIds`, `getPvAccountDeposits`, `getPvAccountIntents`, `getPvIntent` |
107
107
  | Indexer | `client.indexer.getDeposits`, `getDepositsWithRelations`, `getDepositById`, `getDepositsByIds`, `getDepositsByIdsWithRelations`, `getDepositsByPayeeHash`, `getIntentsForDeposits`, `getOwnerIntents`, `getIntentsByRateManager`, `getIntentByHash`, `getExpiredIntents`, `getFulfilledIntentEvents`, `getIntentFulfillmentAmounts`, `getFulfillmentAndPayment`, `getDepositFundActivities`, `getMakerFundActivities`, `getDepositDailySnapshots`, `getProfitSnapshotsByDeposits`, `getRateManagers`, `getRateManagerDetail`, `getRateManagerDelegations`, `getDelegationForDeposit`, `getManagerDailySnapshots`, `getManualRateUpdates`, `getOracleConfigUpdates`, `query` |
@@ -229,21 +229,24 @@ const amount = 250_000000n;
229
229
  const approval = await client.ensureStakeAllowance({ amount });
230
230
  // Wait for approval.hash to confirm when hadAllowance is false.
231
231
 
232
- await client.depositStake({ amount });
233
- // Or prepare for a smart account/relayer:
234
- const prepared = await client.depositStakeFor.prepare({
235
- taker: delegatedTakerAddress,
236
- amount,
237
- });
232
+ await client.depositStake({ amount }); // sender becomes the stake owner
233
+ await client.withdrawStake({ amount: 50_000000n }); // immediate, free stake only
234
+ await client.claim(); // withdraws the caller's full claimable balance
235
+
236
+ // Safe sponsorship is a two-actor flow:
237
+ await client.setTakerAuthorization({ taker, authorized: true }); // signed by the Safe
238
+ await client.selectStakeOwner({ stakeOwner: safeAddress }); // signed by the taker
239
+ await client.clearStakeOwner(); // taker returns to self-stake
238
240
 
239
241
  const stake = await client.getTakerStake({ owner: takerAddress, chainId: 8453 });
240
- // stake.responseObject.balances: stakedUsdc, pendingWithdrawalUsdc, eligibleUsdc,
241
- // reservedUsdc (locked), freeUsdc — each { raw, formatted } in 6-decimal base units.
242
+ // stake.responseObject: effective stakeOwner, selectedStakeOwner +
243
+ // selectionAuthorized, stake { totalUsdc, lockedUsdc, freeUsdc },
244
+ // claimableUsdc, riskTakingPaused — base-unit strings.
242
245
 
243
246
  const capacity = await client.getTakerCapacity({ owner: takerAddress, chainId: 8453 });
244
- // capacity.responseObject.platforms[]: bondedTakingCapacity, baseUnbonded,
245
- // totalTakingCapacity, griefing and chargeback curve terms, warnings;
246
- // operationalGates carries pause state.
247
+ // capacity.responseObject.platforms[]: enabled, chargebackable,
248
+ // deferredPayoutEnabled, riskWindowSeconds, extensionPenaltyBpsPerHour, and
249
+ // stakeBacked (1:1 free stake, or an explicit unbounded-by-stake state).
247
250
 
248
251
  const onchain = await client.getStakeVaultState({
249
252
  staker: stakeOwnerAddress,
@@ -252,15 +255,20 @@ const onchain = await client.getStakeVaultState({
252
255
  ```
253
256
 
254
257
  Stake writes expose direct and `.prepare()` variants: `depositStake`,
255
- `depositStakeFor`, `requestStakeWithdrawal`, `cancelStakeWithdrawal`,
256
- `withdrawRequestedStake`, `requestExit`, `cancelExit`, `withdrawStake`,
257
- `setStakeDelegationEnabled`, `setAllowedStakeOwner`, and `clearStakeOwner`.
258
- StakeVault is currently staging-only; SDK contract resolution fails closed in
259
- production/preproduction until a deployment exists.
260
-
261
- The same staging deployment exposes OrchestratorV3 and RiskManager through
262
- `getDeployedAddresses()`, `getOrchestratorV3Contract()`, and
263
- `getRiskManagerContract()`. Route an intent explicitly by passing
258
+ `withdrawStake`, `claim`, `setTakerAuthorization`, `selectStakeOwner`, and
259
+ `clearStakeOwner`. Post-PR #200 there is no withdrawal request, cooldown, or
260
+ exit lifecycle — `withdrawStake` is immediate up to `freeStake`, and `claim`
261
+ withdraws the complete claimable balance. Chargebackable capacity is exactly
262
+ the effective owner's free stake (full-gross 1:1); never sum a taker's
263
+ self-stake with a sponsor's stake. No post-#200 StakeVault/RiskManager
264
+ deployment exists yet in any environment, so SDK contract resolution fails
265
+ closed everywhere until one ships (a `VITE_BASE_STAGING_STAKE_VAULT_ADDRESS` /
266
+ `VITE_BASE_STAGING_RISK_MANAGER_ADDRESS` override supports local deployments).
267
+
268
+ The staging deployment exposes OrchestratorV3 through
269
+ `getDeployedAddresses()` and `getOrchestratorV3Contract()`;
270
+ `getRiskManagerContract()` resolves only once a post-#200 RiskManager is
271
+ deployed (or via the env-var override). Route an intent explicitly by passing
264
272
  `orchestratorAddress: client.getDeployedAddresses().orchestratorV3`.
265
273
  OrchestratorV3 signals are ungated: the SDK encodes an empty gating signature
266
274
  and zero expiration without calling the curator signing endpoint. Existing
@@ -279,10 +287,6 @@ const sweep = await client.releaseMaturedPositions.prepare({
279
287
  intentHashes: [intentHash],
280
288
  riskManagerAddress: snapshottedRiskManagerAddress,
281
289
  });
282
- const settlement = await client.reconcileSettlement.prepare({
283
- intentHash,
284
- riskManagerAddress: snapshottedRiskManagerAddress,
285
- });
286
290
  const cancellations = await client.reconcileCancellations.prepare({
287
291
  intentHashes: [intentHash],
288
292
  riskManagerAddress: snapshottedRiskManagerAddress,
@@ -290,25 +294,24 @@ const cancellations = await client.reconcileCancellations.prepare({
290
294
  ```
291
295
 
292
296
  Like `orchestratorAddress`, an explicit `riskManagerAddress` is caller-pinned
293
- and may be outside the client's configured deployment context. All five keeper
297
+ and may be outside the client's configured deployment context. All keeper
294
298
  methods honor it for direct and `.prepare()` calls, allowing sweepers to group
295
299
  positions by their snapshotted RiskManager deployment without a later SDK
296
300
  configuration change rerouting them.
297
301
 
298
302
  For receipt classification, import `RISK_POSITION_SETTLED_EVENT_ABI` and
299
- `DEFERRED_PAYOUT_RECORDED_EVENT_ABI` and pass them to viem's
303
+ `DEFERRED_SETTLEMENT_FUNDED_EVENT_ABI` and pass them to viem's
300
304
  `decodeEventLog()`.
301
305
 
302
306
  `getTakerStake()` and `getTakerCapacity()` wrap curator
303
- `GET /v2/taker/stake` and `GET /v2/taker/capacity`, the hard replacement for
304
- the removed `/v2/taker/tier` endpoint. Platform capacities are alternative
305
- views of one shared stake-owner portfolio — never sum them, and never filter
306
- quotes by capacity. The base unbonded tranche (`baseUnbonded`) is reusable on
307
- every intent and combines with bonded capacity into `totalTakingCapacity`;
308
- legacy free-take payloads from older curator deployments are normalized onto
309
- this model by the SDK. Capacity can change whenever any authorized relayer
310
- uses the shared stake, so refetch immediately before signaling; the contract
311
- stays authoritative.
307
+ `GET /v2/taker/stake` and `GET /v2/taker/capacity` on the post-PR #200
308
+ full-gross contract. Platform capacities are alternative views of one shared
309
+ stake-owner portfolio — never sum them, and never filter quotes by capacity.
310
+ Non-chargebackable platforms report an explicit unbounded-by-stake state, and
311
+ deferred payout is an alternative settlement mode that never adds to
312
+ stake-backed capacity. Capacity can change whenever any authorized taker uses
313
+ the shared stake, so refetch immediately before signaling; the contract stays
314
+ authoritative.
312
315
 
313
316
  For table-style liquidity UIs, the low-level `apiGetOrderbookTable()` adapter exposes curator's paginated public/private orderbook rows and row-level privacy metadata.
314
317