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

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
@@ -80,7 +80,7 @@ const client = new Zkp2pClient({
80
80
  - `indexerUrl` and `baseApiUrl`: override defaults when you are targeting custom deployments
81
81
  - `timeouts`: `{ api?: number }` — API timeout in milliseconds (default 15000)
82
82
 
83
- **No external API key is required.** `createDeposit`, `registerPayeeDetails`, `getQuote`, `signalIntent`, and the rest of the public SDK flows work without `apiKey` or `authorizationToken`. When `baseApiUrl` is configured, `signalIntent()` can auto-fetch a gating service signature from curator `/v3/intent/sign` without auth. Quote responses include resolved maker payee details (`offchainId`, `telegramUsername`, `metadata`) when curator has them.
83
+ **No external API key is required.** `createDeposit`, `registerPayeeDetails`, `getQuote`, `getTakerTier`, `signalIntent`, and the rest of the public SDK flows work without `apiKey` or `authorizationToken`. When `baseApiUrl` is configured, `signalIntent()` can auto-fetch a gating service signature from curator `/v3/intent/sign` without auth. Quote responses include resolved maker payee details (`offchainId`, `telegramUsername`, `metadata`) when curator has them.
84
84
 
85
85
  Indexer defaults by environment:
86
86
 
@@ -94,18 +94,16 @@ Indexer defaults by environment:
94
94
  | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
95
95
  | Deposits | `createDeposit`, `addFunds`, `removeFunds`, `withdrawDeposit`, `ensureAllowance`, `setAcceptingIntents`, `setIntentRange`, `setCurrencyMinRate`, `setRetainOnEmpty` |
96
96
  | Payment methods and currencies | `addPaymentMethods`, `removePaymentMethod`, `setPaymentMethodActive`, `addCurrencies`, `removeCurrency`, `deactivateCurrency`, `pruneExpiredIntents` |
97
- | Intents | `signalIntent`, `fulfillIntent`, `cancelIntent`, `releaseFundsToPayer`, `getFulfillIntentInputs`, including explicit staging OrchestratorV3 routing |
97
+ | Intents | `signalIntent`, `fulfillIntent`, `cancelIntent`, `releaseFundsToPayer`, `getFulfillIntentInputs` |
98
98
  | Prepared transactions | `client.prepareCreateDeposit(...)`, `client.signalIntent.prepare(...)`, `client.fulfillIntent.prepare(...)`, `client.setVaultFee.prepare(...)`, and equivalent prepare flows across the rest of the prepareable write surface |
99
- | Payee and quote APIs | `registerPayeeDetails`, `resolvePayeeHash`, `getQuote`, `getQuotesBestByPlatform` |
99
+ | Payee and quote APIs | `registerPayeeDetails`, `resolvePayeeHash`, `getQuote`, `getQuotesBestByPlatform`, `getTakerTier` |
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 |
105
103
  | Oracle config | `setOracleRateConfig`, `setOracleRateConfigBatch`, `removeOracleRateConfig`, `updateCurrencyConfigBatch`, `deactivateCurrenciesBatch`, `supportsInlineOracleRateConfig`, `validateOracleFeedsOnChain` |
106
104
  | RPC reads | `getDeposits`, `getDeposit`, `getDepositsById`, `getIntents`, `getIntent`, `getPvDepositById`, `getPvDepositsFromIds`, `getPvAccountDeposits`, `getPvAccountIntents`, `getPvIntent` |
107
105
  | 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` |
108
- | React hooks | `@zkp2p/sdk/react` exports hooks for deposits, intents, delegation, vaults, and payment methods |
106
+ | React hooks | `@zkp2p/sdk/react` exports hooks for deposits, intents, delegation, vaults, payment methods, and taker tier |
109
107
  | Attribution | ERC-8021 helpers like `sendTransactionWithAttribution`, `encodeWithAttribution`, and `txOverrides.referrer` support |
110
108
 
111
109
  ## Extension Metadata Bridge
@@ -182,7 +180,7 @@ console.log(result.depositDetails);
182
180
 
183
181
  If you do not pass `payeeDetailsHashes`, `createDeposit()` can register the payee details for you. If you want to pre-register or reuse hashes across deposits, use `registerPayeeDetails()` first.
184
182
 
185
- ## Payee Registration and Quotes
183
+ ## Payee Registration, Quotes, and Taker Tier
186
184
 
187
185
  ```ts
188
186
  import { resolvePaymentMethodHash } from '@zkp2p/sdk';
@@ -206,106 +204,26 @@ const { hashedOnchainIds } = await client.registerPayeeDetails({
206
204
  const quote = await client.getQuote({
207
205
  paymentPlatforms: ['wise'],
208
206
  fiatCurrency: 'USD',
209
- user: '0xBuyer',
210
- recipient: '0xBuyer',
207
+ user: '0x1111111111111111111111111111111111111111',
208
+ recipient: '0x1111111111111111111111111111111111111111',
211
209
  destinationChainId: 8453,
212
210
  destinationToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
213
211
  amount: '250',
214
212
  isExactFiat: true,
215
213
  });
216
214
 
215
+ const takerTier = await client.getTakerTier({
216
+ owner: '0x1111111111111111111111111111111111111111',
217
+ chainId: 8453,
218
+ });
219
+
217
220
  const payeeHash = await client.resolvePayeeHash(
218
221
  42n,
219
222
  resolvePaymentMethodHash('wise', { env: 'production' }),
220
223
  );
221
224
  ```
222
225
 
223
- `getQuote()` returns available liquidity plus payee details when authenticated. Use `getQuotesBestByPlatform()` to fetch the best quote per supported payment platform in a single call (handy for cross-platform comparison UIs). Quotes do not reserve or filter by OrchestratorV3 stake capacity; fetch the configured Curator environment's capacity view separately and treat on-chain admission as final.
224
-
225
- ## Taker Stake & Capacity
226
-
227
- ```ts
228
- const amount = 250_000000n;
229
- const approval = await client.ensureStakeAllowance({ amount });
230
- // Wait for approval.hash to confirm when hadAllowance is false.
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
- });
238
-
239
- 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
-
243
- const capacity = await client.getTakerCapacity({ owner: takerAddress, chainId: 8453 });
244
- // capacity.responseObject.platforms[]: bondedTakingCapacity, freeTakes, griefing and
245
- // chargeback curve terms, warnings; operationalGates carries pause state.
246
-
247
- const onchain = await client.getStakeVaultState({
248
- staker: stakeOwnerAddress,
249
- taker: takerAddress,
250
- });
251
- ```
252
-
253
- Stake writes expose direct and `.prepare()` variants: `depositStake`,
254
- `depositStakeFor`, `requestStakeWithdrawal`, `cancelStakeWithdrawal`,
255
- `withdrawRequestedStake`, `requestExit`, `cancelExit`, `withdrawStake`,
256
- `setStakeDelegationEnabled`, `setAllowedStakeOwner`, and `clearStakeOwner`.
257
- StakeVault is currently staging-only; SDK contract resolution fails closed in
258
- production/preproduction until a deployment exists.
259
-
260
- The same staging deployment exposes OrchestratorV3 and RiskManager through
261
- `getDeployedAddresses()`, `getOrchestratorV3Contract()`, and
262
- `getRiskManagerContract()`. Route an intent explicitly by passing
263
- `orchestratorAddress: client.getDeployedAddresses().orchestratorV3`.
264
- OrchestratorV3 signals are ungated: the SDK encodes an empty gating signature
265
- and zero expiration without calling the curator signing endpoint. Existing
266
- OrchestratorV2 signaling remains gated.
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
-
274
- Keeper writes are direct and prepareable:
275
-
276
- ```ts
277
- const sweep = await client.releaseMaturedPositions.prepare({
278
- intentHashes: [intentHash],
279
- riskManagerAddress: snapshottedRiskManagerAddress,
280
- });
281
- const settlement = await client.reconcileSettlement.prepare({
282
- intentHash,
283
- riskManagerAddress: snapshottedRiskManagerAddress,
284
- });
285
- const cancellations = await client.reconcileCancellations.prepare({
286
- intentHashes: [intentHash],
287
- riskManagerAddress: snapshottedRiskManagerAddress,
288
- });
289
- ```
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
-
297
- For receipt classification, import `RISK_POSITION_SETTLED_EVENT_ABI` and
298
- `DEFERRED_PAYOUT_RECORDED_EVENT_ABI` and pass them to viem's
299
- `decodeEventLog()`.
300
-
301
- `getTakerStake()` and `getTakerCapacity()` wrap curator
302
- `GET /v2/taker/stake` and `GET /v2/taker/capacity`, the hard replacement for
303
- the removed `/v2/taker/tier` endpoint. Platform capacities are alternative
304
- views of one shared stake-owner portfolio — never sum them, and never filter
305
- quotes by capacity. Free takes are separate whole intents (at most
306
- `amountPerTakeUsdc` each) and cannot be combined with bonded capacity.
307
- Capacity can change whenever any authorized relayer uses the shared stake, so
308
- refetch immediately before signaling; the contract stays authoritative.
226
+ `getQuote()` returns available liquidity plus payee details when authenticated. Use `getQuotesBestByPlatform()` to fetch the best quote per supported payment platform in a single call (handy for cross-platform comparison UIs). `getTakerTier()` returns limits, cooldown data, Peer Pay volume progression, and `volumeBreakdown` rows for taker UX.
309
227
 
310
228
  For table-style liquidity UIs, the low-level `apiGetOrderbookTable()` adapter exposes curator's paginated public/private orderbook rows and row-level privacy metadata.
311
229
 
@@ -708,12 +626,14 @@ import {
708
626
  useSignalIntent,
709
627
  useCreateVault,
710
628
  useVaultDelegation,
629
+ useGetTakerTier,
711
630
  } from '@zkp2p/sdk/react';
712
631
 
713
632
  const createDeposit = useCreateDeposit({ client });
714
633
  const signalIntent = useSignalIntent({ client });
715
634
  const createVault = useCreateVault({ client, sendTransaction });
716
635
  const vaultDelegation = useVaultDelegation({ client, sendTransaction, sendBatch });
636
+ const takerTier = useGetTakerTier({ client, owner, chainId, autoFetch: true });
717
637
  ```
718
638
 
719
639
  Hook groups:
@@ -723,7 +643,7 @@ Hook groups:
723
643
  - Intent lifecycle: `useSignalIntent`, `useFulfillIntent`, `useReleaseFundsToPayer`, `usePruneExpiredIntents`
724
644
  - Delegation: `useSetDelegate`, `useRemoveDelegate`
725
645
  - Vault / DRM: `useCreateVault`, `useVaultDelegation`, `useSetVaultFee`, `useSetVaultMinRate`, `useSetVaultConfig`
726
- - Taker stake and capacity: `useGetTakerStake`, `useGetTakerCapacity`
646
+ - Taker tier: `useGetTakerTier`, plus `getTierDisplayInfo()` and `getNextTierCap()` helpers
727
647
 
728
648
  `useVaultDelegation()` is the batching-oriented hook. It returns `delegateDeposit`, `delegateDeposits`, `clearDelegation`, and `clearDelegations`.
729
649
 
@@ -731,23 +651,15 @@ Hook groups:
731
651
 
732
652
  ```ts
733
653
  import {
734
- DEFERRED_PAYOUT_RECORDED_EVENT_ABI,
735
654
  getContracts,
736
- getOrchestratorV3Contract,
737
655
  getPaymentMethodsCatalog,
738
656
  getRateManagerContracts,
739
- getRiskManagerContract,
740
- getStakeVaultContract,
741
- RISK_POSITION_SETTLED_EVENT_ABI,
742
657
  resolveFiatCurrencyBytes32,
743
658
  resolvePaymentMethodHash,
744
659
  } from '@zkp2p/sdk';
745
660
 
746
661
  const contracts = getContracts(8453, 'production');
747
662
  const rateManagerContracts = getRateManagerContracts(8453, 'production');
748
- const stakeVault = getStakeVaultContract(8453, 'staging');
749
- const orchestratorV3 = getOrchestratorV3Contract(8453, 'staging');
750
- const riskManager = getRiskManagerContract(8453, 'staging');
751
663
  const paymentMethods = getPaymentMethodsCatalog(8453, 'production');
752
664
  const usdHash = resolveFiatCurrencyBytes32('USD');
753
665
  const wiseHash = resolvePaymentMethodHash('wise', { env: 'production' });
@@ -792,7 +704,7 @@ The package already includes TypeDoc configuration. Generate the full API refere
792
704
  pnpm --filter @zkp2p/sdk docs
793
705
  ```
794
706
 
795
- This writes documentation to [`packages/sdk/docs`](./docs) and now includes the React entry point as well as the main SDK and extension surfaces.
707
+ This writes generated documentation to `packages/sdk/docs` and includes the React entry point as well as the main SDK and extension surfaces.
796
708
 
797
709
  ## Debug Logging
798
710
 
@@ -822,4 +734,4 @@ pnpm docs
822
734
  - NPM: https://www.npmjs.com/package/@zkp2p/sdk
823
735
  - Docs: https://docs.peer.xyz
824
736
  - Monorepo: https://github.com/zkp2p/zkp2p-clients
825
- - TypeDoc output: [`packages/sdk/docs`](./docs)
737
+ - TypeDoc output: `packages/sdk/docs` (generated locally by `pnpm --filter @zkp2p/sdk docs`)