@zkp2p/sdk 0.12.2-rc.0 → 0.12.2-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.
Files changed (36) hide show
  1. package/README.md +96 -24
  2. package/dist/build-metadata.json +22 -0
  3. package/dist/{chunk-GHQK65J2.mjs → chunk-3J4FPMPW.mjs} +2 -2
  4. package/dist/{chunk-GHQK65J2.mjs.map → chunk-3J4FPMPW.mjs.map} +1 -1
  5. package/dist/chunk-NCX4BO7G.mjs +12 -0
  6. package/dist/chunk-NCX4BO7G.mjs.map +1 -0
  7. package/dist/{chunk-4U4GTDCJ.mjs → chunk-QVEW2DTE.mjs} +373 -373
  8. package/dist/{chunk-4U4GTDCJ.mjs.map → chunk-QVEW2DTE.mjs.map} +1 -1
  9. package/dist/{chunk-FCOH36IX.mjs → chunk-YA67SM3A.mjs} +2 -2
  10. package/dist/{chunk-FCOH36IX.mjs.map → chunk-YA67SM3A.mjs.map} +1 -1
  11. package/dist/{chunk-ZFBH4HD7.mjs → chunk-ZB22BZLZ.mjs} +2 -2
  12. package/dist/{chunk-ZFBH4HD7.mjs.map → chunk-ZB22BZLZ.mjs.map} +1 -1
  13. package/dist/{currency-MARF3D2J.mjs → currency-XA62DCJH.mjs} +4 -4
  14. package/dist/{currency-MARF3D2J.mjs.map → currency-XA62DCJH.mjs.map} +1 -1
  15. package/dist/index.cjs +2263 -561
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +34 -9
  18. package/dist/index.d.ts +34 -9
  19. package/dist/index.mjs +1638 -105
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/protocolViewerParsers-KB2FTOE6.mjs +5 -0
  22. package/dist/{protocolViewerParsers-JGW65QV4.mjs.map → protocolViewerParsers-KB2FTOE6.mjs.map} +1 -1
  23. package/dist/react.cjs +41 -0
  24. package/dist/react.cjs.map +1 -1
  25. package/dist/react.d.mts +15 -3
  26. package/dist/react.d.ts +15 -3
  27. package/dist/react.mjs +44 -4
  28. package/dist/react.mjs.map +1 -1
  29. package/dist/{timeout-YLP3WHZF.mjs → timeout-7UJ6HZ4K.mjs} +4 -4
  30. package/dist/{timeout-YLP3WHZF.mjs.map → timeout-7UJ6HZ4K.mjs.map} +1 -1
  31. package/dist/{vaultUtils-BmJ6T8rn.d.mts → vaultUtils-Dla_eG15.d.mts} +203 -40
  32. package/dist/{vaultUtils-BmJ6T8rn.d.ts → vaultUtils-Dla_eG15.d.ts} +203 -40
  33. package/package.json +22 -21
  34. package/dist/chunk-J5LGTIGS.mjs +0 -9
  35. package/dist/chunk-J5LGTIGS.mjs.map +0 -1
  36. package/dist/protocolViewerParsers-JGW65QV4.mjs +0 -5
package/README.md CHANGED
@@ -108,7 +108,7 @@ Indexer defaults by environment:
108
108
  | React hooks | `@zkp2p/sdk/react` exports hooks for deposits, intents, delegation, vaults, and payment methods |
109
109
  | Attribution | ERC-8021 helpers like `sendTransactionWithAttribution`, `encodeWithAttribution`, and `txOverrides.referrer` support |
110
110
  | Taker staking | `ensureStakeAllowance`, `depositStake`, `withdrawStake`, `claim`, `setTakerAuthorization`, `selectStakeOwner`, `clearStakeOwner`, direct StakeVault reads, and `client.indexer.getStakingState()` |
111
- | Chargeback keepers | `releaseMaturedChargebackIntent`, `releaseMaturedChargebackIntents`, with caller-pinned `chargebackPolicyAddress` support |
111
+ | Chargeback keepers | `releaseMaturedDisputeProtectionIntent`, `releaseMaturedDisputeProtectionIntents`, with caller-pinned `disputeProtectionPolicyAddress` support |
112
112
 
113
113
  ## Extension Metadata Bridge
114
114
 
@@ -256,53 +256,123 @@ const indexed = await client.indexer.getStakingState({
256
256
  chainId: 8453,
257
257
  environment: 'base',
258
258
  vaultAddress: client.getStakeVaultContract().address,
259
- chargebackPolicyAddress: client.getChargebackPolicyContract().address,
259
+ disputeProtectionPolicyAddress: client.getDisputeProtectionPolicyContract().address,
260
260
  taker: takerAddress,
261
261
  // Always supply the effective owner from the fresh on-chain read.
262
262
  stakeOwner: onchain.stakeOwner,
263
263
  });
264
264
  // indexed: effective/raw ownership, total/locked/free stake, claimable,
265
- // authorizations, admissions-pause state, Vault controller, and per-row
266
- // freshness.
265
+ // authorizations, Vault controller, per-row provenance, and the indexer head.
266
+
267
+ const locks = await client.indexer.getStakeLocks({
268
+ chainId: 8453,
269
+ vaultAddress: client.getStakeVaultContract().address,
270
+ stakeOwner: onchain.stakeOwner,
271
+ status: 'ACTIVE',
272
+ limit: 50,
273
+ });
274
+
275
+ const activity = await client.indexer.getStakeActivity({
276
+ chainId: 8453,
277
+ vaultAddress: client.getStakeVaultContract().address,
278
+ merchant: takerAddress,
279
+ limit: 50,
280
+ });
281
+
282
+ const finalizedDisputes = await client.indexer.getDisputeProtectionIntents({
283
+ chainId: 8453,
284
+ policyAddress: client.getDisputeProtectionPolicyContract().address,
285
+ throughBlockNumber: finalizedBlockNumber.toString(),
286
+ limit: 50,
287
+ });
267
288
  ```
268
289
 
269
- Stake writes expose direct and `.prepare()` variants: `depositStake`,
270
- `withdrawStake`, `claim`, `setTakerAuthorization`, `selectStakeOwner`, and
271
- `clearStakeOwner`. There is no withdrawal request, cooldown, or exit
290
+ Stake and deposit-protection writes expose direct and `.prepare()` variants:
291
+ `depositStake`, `withdrawStake`, `claim`, `setTakerAuthorization`,
292
+ `selectStakeOwner`, `clearStakeOwner`, and `setDisputeProtectionEnabled`.
293
+ There is no withdrawal request, cooldown, or exit
272
294
  lifecycle — `withdrawStake` is immediate up to `freeStake`, and `claim`
273
295
  withdraws the complete claimable balance. Chargebackable capacity is exactly
274
296
  the effective owner's free stake (1:1); never sum a taker's self-stake with a
275
297
  sponsor's stake.
276
298
 
277
- The vault's controller is the `ChargebackPolicy` contract. It owns
299
+ The vault's controller is the `DisputeProtectionPolicy` contract. It owns
278
300
  per-payment-method risk windows (`getRiskWindow(paymentMethodHash)`),
279
- per-deposit chargeback enablement (`isChargebackEnabled(escrow, depositId)`),
280
- and the global `admissionsPaused()` switch. `@zkp2p/contracts-v2@0.4.0`
281
- resolves the deployed StakeVault, ChargebackPolicy, and OrchestratorV3 for
301
+ per-deposit chargeback enablement (`isDisputeProtectionEnabled(escrow, depositId)`),
302
+ and the global `admissionsPaused()` switch. The selected `@zkp2p/contracts-v2`
303
+ bundle resolves the StakeVault, DisputeProtectionPolicy, and OrchestratorV3 for
282
304
  both the production and staging bundles; a bundle without them fails closed
283
305
  (`VITE_BASE_STAGING_STAKE_VAULT_ADDRESS` /
284
- `VITE_BASE_STAGING_CHARGEBACK_POLICY_ADDRESS` overrides support local
306
+ `VITE_BASE_STAGING_DISPUTE_PROTECTION_POLICY_ADDRESS` overrides support local
285
307
  deployments).
286
308
 
287
309
  Keeper writes are direct and prepareable:
288
310
 
289
311
  ```ts
290
- const release = await client.releaseMaturedChargebackIntents.prepare({
312
+ const enableProtection = await client.setDisputeProtectionEnabled.prepare({
313
+ escrow: depositEscrow,
314
+ depositId: 42n,
315
+ enabled: true,
316
+ });
317
+
318
+ const release = await client.releaseMaturedDisputeProtectionIntents.prepare({
291
319
  intentHashes: [intentHash],
292
- chargebackPolicyAddress: snapshottedPolicyAddress,
320
+ disputeProtectionPolicyAddress: snapshottedPolicyAddress,
293
321
  });
294
322
  ```
295
323
 
296
- An explicit `chargebackPolicyAddress` is caller-pinned and may be outside the
324
+ An explicit `disputeProtectionPolicyAddress` is caller-pinned and may be outside the
297
325
  client's configured deployment context, allowing sweepers to group intents by
298
326
  their snapshotted policy deployment without a later SDK configuration change
299
327
  rerouting them.
300
328
 
301
- `client.indexer.getStakingState()` composes the `@zkp2p/indexer-schema@0.20.0`
302
- account rows and preserves their individual freshness. Its caller-supplied
303
- `stakeOwner` must come from a fresh on-chain `stakeOwnerOf(taker)` read; stale
304
- indexed ownership is reported without attributing another owner's balance.
305
- Refetch immediately before signaling; the contract stays authoritative.
329
+ `client.indexer.getStakingState()` composes the `@zkp2p/indexer-schema`
330
+ account rows, preserves their individual update blocks, and reports the
331
+ chain's actual indexer head as `freshness.indexerHeadBlockNumber`. Its
332
+ caller-supplied `stakeOwner` must come from a fresh on-chain
333
+ `stakeOwnerOf(taker)` read; stale indexed ownership is reported without
334
+ attributing another owner's balance. Refetch immediately before signaling; the
335
+ contract stays authoritative.
336
+
337
+ The three history methods return `{ items, nextCursor, asOf }`; finalized
338
+ disputes also return `endCursor`. Cursors are
339
+ opaque keysets, limits are integers from 1 through 100, and all numeric values
340
+ are unsigned decimal strings. `asOf` identifies the latest row observed in the
341
+ returned page; it is not an indexer-head or strong-consistency guarantee.
342
+ The finalized-dispute page requires a code-owned `throughBlockNumber`; use the
343
+ same finalized cutoff for every cursor in one ingestion pass. Follow
344
+ `nextCursor` while it is non-null, then atomically persist the terminal page's
345
+ `endCursor` with its final block/log position; `endCursor` is null only for an
346
+ empty page.
347
+
348
+ Before enabling dispute-protected admission, prove that the live Base contracts
349
+ still match the deployment manifest embedded in the exact SDK artifact:
350
+
351
+ ```ts
352
+ const readiness = await client.getDisputeProtectionReadiness();
353
+
354
+ if (readiness.state !== 'active_successor_verified' || !readiness.readyForDisputeProtection) {
355
+ throw new Error(`Dispute protection is unavailable: ${readiness.state}`);
356
+ }
357
+ ```
358
+
359
+ The reader pins every code and state read to one `asOfBlock`, including exact
360
+ governance owners, authorization sets, attestation witnesses, and signature
361
+ thresholds. It distinguishes
362
+ `recognized_predecessor`, `passive_successor`, `active_successor_verified`,
363
+ `verified_no_hook`, and `mismatch`. A dormant successor is checked only when
364
+ `{ verifyPassiveSuccessor: true }` is supplied. An exact active successor stays
365
+ verified while `orchestratorPaused`, `allowMultipleIntents`, and
366
+ `policyAdmissionsPaused` report operational traffic gates;
367
+ `readyForDisputeProtection` is true only when all three allow new protected
368
+ traffic. Unknown hooks, misconfigured successors, runtime-code changes,
369
+ dependency mismatches, and RPC failures return `mismatch` and fail closed.
370
+
371
+ `SDK_BUILD_METADATA` and the `@zkp2p/sdk/build-metadata.json` export identify
372
+ the SDK commit, contracts package, indexer schema package, and active manifest
373
+ selection hashes. A local build has the deterministic `development` identity
374
+ and is deliberately non-distributable, so its readiness reader returns
375
+ `mismatch` before making RPC calls.
306
376
 
307
377
  For table-style liquidity UIs, the low-level `apiGetOrderbookTable()` adapter exposes curator's paginated public/private orderbook rows and row-level privacy metadata.
308
378
 
@@ -726,7 +796,7 @@ const stakingState = await client.indexer.getStakingState({
726
796
  chainId: 8453,
727
797
  environment: 'base',
728
798
  vaultAddress: '0xStakeVault',
729
- chargebackPolicyAddress: '0xChargebackPolicy',
799
+ disputeProtectionPolicyAddress: '0xDisputeProtectionPolicy',
730
800
  taker: '0xTaker',
731
801
  stakeOwner: '0xEffectiveStakeOwner',
732
802
  });
@@ -775,6 +845,7 @@ import {
775
845
  useCreateDeposit,
776
846
  useSignalIntent,
777
847
  useExtendIntentLifetime,
848
+ useSetDisputeProtectionEnabled,
778
849
  useCreateVault,
779
850
  useVaultDelegation,
780
851
  } from '@zkp2p/sdk/react';
@@ -782,13 +853,14 @@ import {
782
853
  const createDeposit = useCreateDeposit({ client });
783
854
  const signalIntent = useSignalIntent({ client });
784
855
  const extendIntent = useExtendIntentLifetime({ client });
856
+ const disputeProtection = useSetDisputeProtectionEnabled({ client });
785
857
  const createVault = useCreateVault({ client, sendTransaction });
786
858
  const vaultDelegation = useVaultDelegation({ client, sendTransaction, sendBatch });
787
859
  ```
788
860
 
789
861
  Hook groups:
790
862
 
791
- - Deposit lifecycle: `useCreateDeposit`, `useAddFunds`, `useRemoveFunds`, `useWithdrawDeposit`, `useSetAcceptingIntents`, `useSetIntentRange`, `useSetCurrencyMinRate`, `useSetRetainOnEmpty`
863
+ - Deposit lifecycle: `useCreateDeposit`, `useAddFunds`, `useRemoveFunds`, `useWithdrawDeposit`, `useSetAcceptingIntents`, `useSetIntentRange`, `useSetCurrencyMinRate`, `useSetRetainOnEmpty`, `useSetDisputeProtectionEnabled`
792
864
  - Payment and currency management: `useAddPaymentMethods`, `useRemovePaymentMethod`, `useSetPaymentMethodActive`, `useAddCurrencies`, `useRemoveCurrency`, `useDeactivateCurrency`
793
865
  - Intent lifecycle: `useSignalIntent`, `useFulfillIntent`, `useReleaseFundsToPayer`, `usePruneExpiredIntents`, `useExtendIntentLifetime`
794
866
  - Delegation: `useSetDelegate`, `useRemoveDelegate`
@@ -805,7 +877,7 @@ import {
805
877
  getOrchestratorV3Contract,
806
878
  getPaymentMethodsCatalog,
807
879
  getRateManagerContracts,
808
- getChargebackPolicyContract,
880
+ getDisputeProtectionPolicyContract,
809
881
  getStakeVaultContract,
810
882
  RISK_POSITION_SETTLED_EVENT_ABI,
811
883
  resolveFiatCurrencyBytes32,
@@ -816,7 +888,7 @@ const contracts = getContracts(8453, 'production');
816
888
  const rateManagerContracts = getRateManagerContracts(8453, 'production');
817
889
  const stakeVault = getStakeVaultContract(8453, 'staging');
818
890
  const orchestratorV3 = getOrchestratorV3Contract(8453, 'staging');
819
- const chargebackPolicy = getChargebackPolicyContract(8453, 'staging');
891
+ const disputeProtectionPolicy = getDisputeProtectionPolicyContract(8453, 'staging');
820
892
  const paymentMethods = getPaymentMethodsCatalog(8453, 'production');
821
893
  const usdHash = resolveFiatCurrencyBytes32('USD');
822
894
  const wiseHash = resolvePaymentMethodHash('wise', { env: 'production' });
@@ -0,0 +1,22 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "source": {
4
+ "repository": "zkp2p/zkp2p-clients",
5
+ "commitSha": "3a56c340d516a948d0c0f715722d37cf95a11b2b",
6
+ "kind": "github",
7
+ "distributable": true
8
+ },
9
+ "sdkPackageVersion": "0.12.2-rc.1",
10
+ "contractsPackageVersion": "0.4.1-rc.6",
11
+ "indexerSchemaPackageVersion": "0.22.0-rc.1",
12
+ "activeDisputeStack": {
13
+ "base": {
14
+ "version": 1,
15
+ "selectionHash": "a4f17ae7c1620ecfe7d036f0b9cc7b39c50e1382dc8dc14d2e5f7f21061cd5ad"
16
+ },
17
+ "baseStaging": {
18
+ "version": 1,
19
+ "selectionHash": "586c90f9de3d10b6d48f4286c709aa7f870fc2fdcfb0af1da947c1da76132dd0"
20
+ }
21
+ }
22
+ }
@@ -43,5 +43,5 @@ var ContractError = class extends ZKP2PError {
43
43
  };
44
44
 
45
45
  export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError };
46
- //# sourceMappingURL=chunk-GHQK65J2.mjs.map
47
- //# sourceMappingURL=chunk-GHQK65J2.mjs.map
46
+ //# sourceMappingURL=chunk-3J4FPMPW.mjs.map
47
+ //# sourceMappingURL=chunk-3J4FPMPW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors/index.ts"],"names":["ErrorCode"],"mappings":";AAGO,IAAK,SAAA,qBAAAA,UAAAA,KAAL;AAEL,EAAAA,WAAA,YAAA,CAAA,GAAa,YAAA;AAEb,EAAAA,WAAA,SAAA,CAAA,GAAU,SAAA;AAEV,EAAAA,WAAA,KAAA,CAAA,GAAM,KAAA;AAEN,EAAAA,WAAA,UAAA,CAAA,GAAW,UAAA;AAEX,EAAAA,WAAA,SAAA,CAAA,GAAU,SAAA;AAVA,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;AA+BL,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EAQpC,WAAA,CAAY,OAAA,EAAiB,IAAA,GAAkB,SAAA,gBAAmB,SAAmB,KAAA,EAAgB;AACnG,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAUO,IAAM,eAAA,GAAN,cAA8B,UAAA,CAAW;AAAA,EAC9C,WAAA,CAAY,OAAA,EAAiB,KAAA,EAAgB,OAAA,EAAmB;AAC9D,IAAA,KAAA,CAAM,OAAA,EAAS,YAAA,mBAAsB,OAAA,EAAS,KAAK,CAAA;AACnD,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AAAA,EACd;AACF;AAKO,IAAM,YAAA,GAAN,cAA2B,UAAA,CAAW;AAAA,EAC3C,WAAA,CAAY,SAAiB,OAAA,EAAmB;AAC9C,IAAA,KAAA,CAAM,OAAA,EAAS,yBAAmB,OAAO,CAAA;AACzC,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAcO,IAAM,QAAA,GAAN,cAAuB,UAAA,CAAW;AAAA,EAIvC,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAiB,OAAA,EAAmB;AAC/D,IAAA,KAAA,CAAM,OAAA,EAAS,iBAAe,OAAO,CAAA;AACrC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AAAA,EACd;AACF;AAOO,IAAM,aAAA,GAAN,cAA4B,UAAA,CAAW;AAAA,EAC5C,WAAA,CAAY,SAAiB,OAAA,EAAmB;AAC9C,IAAA,KAAA,CAAM,OAAA,EAAS,2BAAoB,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF","file":"chunk-GHQK65J2.mjs","sourcesContent":["/**\n * Error codes for categorizing SDK errors.\n */\nexport enum ErrorCode {\n /** Input validation failed */\n VALIDATION = 'VALIDATION',\n /** Network/RPC error */\n NETWORK = 'NETWORK',\n /** API request failed */\n API = 'API',\n /** Smart contract error */\n CONTRACT = 'CONTRACT',\n /** Unknown/uncategorized error */\n UNKNOWN = 'UNKNOWN'\n}\n\n/**\n * Base error class for all SDK errors.\n *\n * All SDK-specific errors extend this class, making it easy to catch\n * and handle SDK errors uniformly.\n *\n * @example\n * ```typescript\n * try {\n * await client.createDeposit(...);\n * } catch (error) {\n * if (error instanceof ZKP2PError) {\n * console.log('SDK Error:', error.code, error.message);\n * console.log('Details:', error.details);\n * }\n * }\n * ```\n */\nexport class ZKP2PError extends Error {\n /** Error category code */\n code: ErrorCode;\n /** Additional error details (varies by error type) */\n details?: unknown;\n /** Field that caused the error (for validation errors) */\n field?: string;\n\n constructor(message: string, code: ErrorCode = ErrorCode.UNKNOWN, details?: unknown, field?: string) {\n super(message);\n this.name = 'ZKP2PError';\n this.code = code;\n this.details = details;\n this.field = field;\n }\n}\n\n/**\n * Thrown when input validation fails.\n *\n * @example\n * ```typescript\n * throw new ValidationError('Amount must be positive', 'amount');\n * ```\n */\nexport class ValidationError extends ZKP2PError {\n constructor(message: string, field?: string, details?: unknown) {\n super(message, ErrorCode.VALIDATION, details, field);\n this.name = 'ValidationError';\n }\n}\n\n/**\n * Thrown when a network or RPC request fails.\n */\nexport class NetworkError extends ZKP2PError {\n constructor(message: string, details?: unknown) {\n super(message, ErrorCode.NETWORK, details);\n this.name = 'NetworkError';\n }\n}\n\n/**\n * Thrown when an API request fails.\n *\n * @example\n * ```typescript\n * catch (error) {\n * if (error instanceof APIError) {\n * console.log('HTTP Status:', error.status);\n * }\n * }\n * ```\n */\nexport class APIError extends ZKP2PError {\n /** HTTP status code (if applicable) */\n status?: number;\n\n constructor(message: string, status?: number, details?: unknown) {\n super(message, ErrorCode.API, details);\n this.status = status;\n this.name = 'APIError';\n }\n}\n\n/**\n * Thrown when a smart contract call fails.\n *\n * Check the `details` property for the underlying viem error.\n */\nexport class ContractError extends ZKP2PError {\n constructor(message: string, details?: unknown) {\n super(message, ErrorCode.CONTRACT, details);\n this.name = 'ContractError';\n }\n}\n\n"]}
1
+ {"version":3,"sources":["../src/errors/index.ts"],"names":["ErrorCode"],"mappings":";AAGO,IAAK,SAAA,qBAAAA,UAAAA,KAAL;AAEL,EAAAA,WAAA,YAAA,CAAA,GAAa,YAAA;AAEb,EAAAA,WAAA,SAAA,CAAA,GAAU,SAAA;AAEV,EAAAA,WAAA,KAAA,CAAA,GAAM,KAAA;AAEN,EAAAA,WAAA,UAAA,CAAA,GAAW,UAAA;AAEX,EAAAA,WAAA,SAAA,CAAA,GAAU,SAAA;AAVA,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;AA+BL,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EAQpC,WAAA,CAAY,OAAA,EAAiB,IAAA,GAAkB,SAAA,gBAAmB,SAAmB,KAAA,EAAgB;AACnG,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAUO,IAAM,eAAA,GAAN,cAA8B,UAAA,CAAW;AAAA,EAC9C,WAAA,CAAY,OAAA,EAAiB,KAAA,EAAgB,OAAA,EAAmB;AAC9D,IAAA,KAAA,CAAM,OAAA,EAAS,YAAA,mBAAsB,OAAA,EAAS,KAAK,CAAA;AACnD,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AAAA,EACd;AACF;AAKO,IAAM,YAAA,GAAN,cAA2B,UAAA,CAAW;AAAA,EAC3C,WAAA,CAAY,SAAiB,OAAA,EAAmB;AAC9C,IAAA,KAAA,CAAM,OAAA,EAAS,yBAAmB,OAAO,CAAA;AACzC,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAAA,EACd;AACF;AAcO,IAAM,QAAA,GAAN,cAAuB,UAAA,CAAW;AAAA,EAIvC,WAAA,CAAY,OAAA,EAAiB,MAAA,EAAiB,OAAA,EAAmB;AAC/D,IAAA,KAAA,CAAM,OAAA,EAAS,iBAAe,OAAO,CAAA;AACrC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,UAAA;AAAA,EACd;AACF;AAOO,IAAM,aAAA,GAAN,cAA4B,UAAA,CAAW;AAAA,EAC5C,WAAA,CAAY,SAAiB,OAAA,EAAmB;AAC9C,IAAA,KAAA,CAAM,OAAA,EAAS,2BAAoB,OAAO,CAAA;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF","file":"chunk-3J4FPMPW.mjs","sourcesContent":["/**\n * Error codes for categorizing SDK errors.\n */\nexport enum ErrorCode {\n /** Input validation failed */\n VALIDATION = 'VALIDATION',\n /** Network/RPC error */\n NETWORK = 'NETWORK',\n /** API request failed */\n API = 'API',\n /** Smart contract error */\n CONTRACT = 'CONTRACT',\n /** Unknown/uncategorized error */\n UNKNOWN = 'UNKNOWN'\n}\n\n/**\n * Base error class for all SDK errors.\n *\n * All SDK-specific errors extend this class, making it easy to catch\n * and handle SDK errors uniformly.\n *\n * @example\n * ```typescript\n * try {\n * await client.createDeposit(...);\n * } catch (error) {\n * if (error instanceof ZKP2PError) {\n * console.log('SDK Error:', error.code, error.message);\n * console.log('Details:', error.details);\n * }\n * }\n * ```\n */\nexport class ZKP2PError extends Error {\n /** Error category code */\n code: ErrorCode;\n /** Additional error details (varies by error type) */\n details?: unknown;\n /** Field that caused the error (for validation errors) */\n field?: string;\n\n constructor(message: string, code: ErrorCode = ErrorCode.UNKNOWN, details?: unknown, field?: string) {\n super(message);\n this.name = 'ZKP2PError';\n this.code = code;\n this.details = details;\n this.field = field;\n }\n}\n\n/**\n * Thrown when input validation fails.\n *\n * @example\n * ```typescript\n * throw new ValidationError('Amount must be positive', 'amount');\n * ```\n */\nexport class ValidationError extends ZKP2PError {\n constructor(message: string, field?: string, details?: unknown) {\n super(message, ErrorCode.VALIDATION, details, field);\n this.name = 'ValidationError';\n }\n}\n\n/**\n * Thrown when a network or RPC request fails.\n */\nexport class NetworkError extends ZKP2PError {\n constructor(message: string, details?: unknown) {\n super(message, ErrorCode.NETWORK, details);\n this.name = 'NetworkError';\n }\n}\n\n/**\n * Thrown when an API request fails.\n *\n * @example\n * ```typescript\n * catch (error) {\n * if (error instanceof APIError) {\n * console.log('HTTP Status:', error.status);\n * }\n * }\n * ```\n */\nexport class APIError extends ZKP2PError {\n /** HTTP status code (if applicable) */\n status?: number;\n\n constructor(message: string, status?: number, details?: unknown) {\n super(message, ErrorCode.API, details);\n this.status = status;\n this.name = 'APIError';\n }\n}\n\n/**\n * Thrown when a smart contract call fails.\n *\n * Check the `details` property for the underlying viem error.\n */\nexport class ContractError extends ZKP2PError {\n constructor(message: string, details?: unknown) {\n super(message, ErrorCode.CONTRACT, details);\n this.name = 'ContractError';\n }\n}\n\n"]}
@@ -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: 1, source: { repository: "zkp2p/zkp2p-clients", commitSha: "3a56c340d516a948d0c0f715722d37cf95a11b2b", kind: "github", distributable: true }, sdkPackageVersion: "0.12.2-rc.1", contractsPackageVersion: "0.4.1-rc.6", indexerSchemaPackageVersion: "0.22.0-rc.1", activeDisputeStack: { base: { version: 1, selectionHash: "a4f17ae7c1620ecfe7d036f0b9cc7b39c50e1382dc8dc14d2e5f7f21061cd5ad" }, baseStaging: { version: 1, selectionHash: "586c90f9de3d10b6d48f4286c709aa7f870fc2fdcfb0af1da947c1da76132dd0" } } };
9
+
10
+ export { __export, define_ZKP2P_SDK_BUILD_METADATA_default };
11
+ //# sourceMappingURL=chunk-NCX4BO7G.mjs.map
12
+ //# sourceMappingURL=chunk-NCX4BO7G.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,aAAA,EAAc,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-NCX4BO7G.mjs","sourcesContent":["{\"schemaVersion\":1,\"source\":{\"repository\":\"zkp2p/zkp2p-clients\",\"commitSha\":\"3a56c340d516a948d0c0f715722d37cf95a11b2b\",\"kind\":\"github\",\"distributable\":true},\"sdkPackageVersion\":\"0.12.2-rc.1\",\"contractsPackageVersion\":\"0.4.1-rc.6\",\"indexerSchemaPackageVersion\":\"0.22.0-rc.1\",\"activeDisputeStack\":{\"base\":{\"version\":1,\"selectionHash\":\"a4f17ae7c1620ecfe7d036f0b9cc7b39c50e1382dc8dc14d2e5f7f21061cd5ad\"},\"baseStaging\":{\"version\":1,\"selectionHash\":\"586c90f9de3d10b6d48f4286c709aa7f870fc2fdcfb0af1da947c1da76132dd0\"}}}"]}