@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 +40 -37
- package/dist/{chunk-7Z77SXI3.mjs → chunk-3XY3E4VH.mjs} +2634 -1438
- package/dist/{chunk-7Z77SXI3.mjs.map → chunk-3XY3E4VH.mjs.map} +1 -1
- package/dist/index.cjs +2711 -1697
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +26 -41
- package/dist/index.d.ts +26 -41
- package/dist/index.mjs +117 -298
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-HMOHJWSP.mjs +5 -0
- package/dist/{protocolViewerParsers-IJKEPSWS.mjs.map → protocolViewerParsers-HMOHJWSP.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-C7yGNmLy.d.mts → vaultUtils-B2FVQeaS.d.mts} +90 -277
- package/dist/{vaultUtils-C7yGNmLy.d.ts → vaultUtils-B2FVQeaS.d.ts} +90 -277
- package/package.json +1 -1
- package/dist/protocolViewerParsers-IJKEPSWS.mjs +0 -5
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`, `
|
|
104
|
-
| V3 settlement operations | `releaseMaturedPositions`, `
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
|
241
|
-
//
|
|
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[]:
|
|
245
|
-
//
|
|
246
|
-
//
|
|
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
|
-
`
|
|
256
|
-
`
|
|
257
|
-
`
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
`
|
|
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
|
|
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
|
-
`
|
|
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
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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
|
|