@zkp2p/sdk 0.0.13 → 0.0.14-rc.2

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/dist/{Zkp2pClient-B0l_kPQB.d.mts → Zkp2pClient-B4BoFznc.d.mts} +353 -3
  2. package/dist/{Zkp2pClient-B0l_kPQB.d.ts → Zkp2pClient-B4BoFznc.d.ts} +353 -3
  3. package/dist/{chunk-2J2N74ZD.mjs → chunk-DJ7FJLYA.mjs} +44 -15
  4. package/dist/chunk-DJ7FJLYA.mjs.map +1 -0
  5. package/dist/chunk-PQQWQF3C.mjs +375 -0
  6. package/dist/chunk-PQQWQF3C.mjs.map +1 -0
  7. package/dist/{chunk-2CLQDBR3.mjs → chunk-RLCHSX5F.mjs} +5 -2
  8. package/dist/chunk-RLCHSX5F.mjs.map +1 -0
  9. package/dist/{chunk-QLGMIRQ5.mjs → chunk-YMWVT5KP.mjs} +2 -2
  10. package/dist/{chunk-QLGMIRQ5.mjs.map → chunk-YMWVT5KP.mjs.map} +1 -1
  11. package/dist/{constants-F3MNDOGF.mjs → constants-MCRAVLDF.mjs} +4 -4
  12. package/dist/{constants-F3MNDOGF.mjs.map → constants-MCRAVLDF.mjs.map} +1 -1
  13. package/dist/{currency-P4HY7S34.mjs → currency-5RZ6VCEA.mjs} +3 -3
  14. package/dist/{currency-P4HY7S34.mjs.map → currency-5RZ6VCEA.mjs.map} +1 -1
  15. package/dist/index.cjs +1183 -77
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.mjs +858 -44
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/{paymentResolution-F4I7TTEW.mjs → paymentResolution-HBYLUETP.mjs} +3 -3
  22. package/dist/{paymentResolution-F4I7TTEW.mjs.map → paymentResolution-HBYLUETP.mjs.map} +1 -1
  23. package/dist/protocolViewerParsers-DDQ4TKNB.mjs +6 -0
  24. package/dist/{protocolViewerParsers-5WBXCEHR.mjs.map → protocolViewerParsers-DDQ4TKNB.mjs.map} +1 -1
  25. package/dist/react.cjs +434 -0
  26. package/dist/react.cjs.map +1 -1
  27. package/dist/react.d.mts +86 -2
  28. package/dist/react.d.ts +86 -2
  29. package/dist/react.mjs +429 -1
  30. package/dist/react.mjs.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/chunk-2CLQDBR3.mjs.map +0 -1
  33. package/dist/chunk-2J2N74ZD.mjs.map +0 -1
  34. package/dist/chunk-MDLTLKWK.mjs +0 -126
  35. package/dist/chunk-MDLTLKWK.mjs.map +0 -1
  36. package/dist/protocolViewerParsers-5WBXCEHR.mjs +0 -6
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { ValidationError, APIError, NetworkError } from './chunk-GHQK65J2.mjs';
2
2
  export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-GHQK65J2.mjs';
3
- export { PAYMENT_PLATFORMS, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA } from './chunk-QLGMIRQ5.mjs';
4
- import { getContracts, getPaymentMethodsCatalog, getGatingServiceAddress } from './chunk-2J2N74ZD.mjs';
5
- export { enrichPvDepositView, enrichPvIntentView, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, parseDepositView, parseIntentView } from './chunk-2J2N74ZD.mjs';
6
- import { resolvePaymentMethodHashFromCatalog, resolveFiatCurrencyBytes32 } from './chunk-2CLQDBR3.mjs';
7
- export { asciiToBytes32, ensureBytes32, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-2CLQDBR3.mjs';
8
- export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-MDLTLKWK.mjs';
3
+ export { PAYMENT_PLATFORMS, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA } from './chunk-YMWVT5KP.mjs';
4
+ import { getContracts, getRateManagerContracts, getPaymentMethodsCatalog, getGatingServiceAddress } from './chunk-DJ7FJLYA.mjs';
5
+ export { enrichPvDepositView, enrichPvIntentView, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, getRateManagerContracts, parseDepositView, parseIntentView } from './chunk-DJ7FJLYA.mjs';
6
+ import { resolvePaymentMethodHashFromCatalog, resolveFiatCurrencyBytes32 } from './chunk-RLCHSX5F.mjs';
7
+ export { asciiToBytes32, ensureBytes32, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-RLCHSX5F.mjs';
8
+ export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchainMinRate } from './chunk-PQQWQF3C.mjs';
9
9
  import { currencyKeccak256 } from './chunk-37HJPVJE.mjs';
10
10
  import { concatHex, encodeFunctionData, createPublicClient, http } from 'viem';
11
11
  import { hardhat, baseSepolia, base } from 'viem/chains';
@@ -165,7 +165,6 @@ function defaultIndexerEndpoint(env = "PRODUCTION") {
165
165
  return "https://indexer-staging.zkp2p.xyz/v1/graphql";
166
166
  case "DEV":
167
167
  case "LOCAL":
168
- case "STAGING_TESTNET":
169
168
  return "https://indexer-staging.zkp2p.xyz/v1/graphql";
170
169
  default:
171
170
  return "https://indexer.zkp2p.xyz/v1/graphql";
@@ -180,6 +179,8 @@ var DEPOSIT_FIELDS = `
180
179
  depositId
181
180
  depositor
182
181
  delegate
182
+ rateManagerId
183
+ rateManagerRegistry
183
184
  token
184
185
  remainingDeposits
185
186
  intentAmountMin
@@ -239,7 +240,15 @@ var DEPOSIT_RELATIONS_QUERY = (
239
240
  payeeDetailsHash
240
241
  active
241
242
  }
242
- MethodCurrency(where: { depositId: { _in: $depositIds } }) {
243
+ MethodCurrency(
244
+ where: {
245
+ depositId: { _in: $depositIds }
246
+ _or: [
247
+ { conversionRate: { _gt: "0" } }
248
+ { conversionRate: { _is_null: true }, minConversionRate: { _gt: "0" } }
249
+ ]
250
+ }
251
+ ) {
243
252
  id
244
253
  chainId
245
254
  depositIdOnContract
@@ -247,6 +256,9 @@ var DEPOSIT_RELATIONS_QUERY = (
247
256
  paymentMethodHash
248
257
  currencyCode
249
258
  minConversionRate
259
+ conversionRate
260
+ managerRate
261
+ rateManagerId
250
262
  }
251
263
  }
252
264
  `
@@ -254,10 +266,7 @@ var DEPOSIT_RELATIONS_QUERY = (
254
266
  var PAYMENT_METHODS_BY_PAYEE_HASH_QUERY = (
255
267
  /* GraphQL */
256
268
  `
257
- query GetPaymentMethodsByPayeeHash(
258
- $where: DepositPaymentMethod_bool_exp!
259
- $limit: Int
260
- ) {
269
+ query GetPaymentMethodsByPayeeHash($where: DepositPaymentMethod_bool_exp!, $limit: Int) {
261
270
  DepositPaymentMethod(where: $where, limit: $limit) {
262
271
  id
263
272
  chainId
@@ -290,7 +299,15 @@ var DEPOSIT_WITH_RELATIONS_QUERY = (
290
299
  payeeDetailsHash
291
300
  active
292
301
  }
293
- MethodCurrency(where: { depositId: { _eq: $id } }) {
302
+ MethodCurrency(
303
+ where: {
304
+ depositId: { _eq: $id }
305
+ _or: [
306
+ { conversionRate: { _gt: "0" } }
307
+ { conversionRate: { _is_null: true }, minConversionRate: { _gt: "0" } }
308
+ ]
309
+ }
310
+ ) {
294
311
  id
295
312
  chainId
296
313
  depositIdOnContract
@@ -298,6 +315,9 @@ var DEPOSIT_WITH_RELATIONS_QUERY = (
298
315
  paymentMethodHash
299
316
  currencyCode
300
317
  minConversionRate
318
+ conversionRate
319
+ managerRate
320
+ rateManagerId
301
321
  }
302
322
  }
303
323
  `
@@ -333,6 +353,11 @@ var INTENTS_QUERY = (
333
353
  fulfillTxHash
334
354
  pruneTxHash
335
355
  paymentMethodHash
356
+ rateManagerId
357
+ manager
358
+ managerFee
359
+ managerFeeRecipient
360
+ managerFeeAmount
336
361
  paymentAmount
337
362
  paymentCurrency
338
363
  paymentTimestamp
@@ -343,14 +368,228 @@ var INTENTS_QUERY = (
343
368
  }
344
369
  `
345
370
  );
346
- var EXPIRED_INTENTS_QUERY = (
371
+ var RATE_MANAGER_FIELDS = `
372
+ id
373
+ chainId
374
+ registry
375
+ rateManagerId
376
+ manager
377
+ feeRecipient
378
+ maxFee
379
+ fee
380
+ depositHook
381
+ name
382
+ uri
383
+ createdAt
384
+ updatedAt
385
+ `;
386
+ var RATE_MANAGER_AGGREGATE_FIELDS = `
387
+ id
388
+ chainId
389
+ rateManagerId
390
+ manager
391
+ totalFilledVolume
392
+ totalFeeAmount
393
+ totalPnlUsdCents
394
+ fulfilledIntents
395
+ currentDelegatedBalance
396
+ currentDelegatedDeposits
397
+ firstSeenAt
398
+ updatedAt
399
+ `;
400
+ var RATE_MANAGER_RATE_FIELDS = `
401
+ id
402
+ chainId
403
+ rateManagerId
404
+ registry
405
+ paymentMethodHash
406
+ currencyCode
407
+ managerRate
408
+ updatedAt
409
+ `;
410
+ var RATE_MANAGER_DELEGATION_FIELDS = `
411
+ id
412
+ chainId
413
+ rateManagerId
414
+ registry
415
+ depositId
416
+ createdAt
417
+ updatedAt
418
+ `;
419
+ var MANAGER_STATS_FIELDS = `
420
+ id
421
+ chainId
422
+ rateManagerId
423
+ manager
424
+ intentId
425
+ depositId
426
+ paymentMethodHash
427
+ currencyCode
428
+ amount
429
+ quoteConversionRate
430
+ marketRate
431
+ spreadBps
432
+ pnlUsdCents
433
+ managerFee
434
+ managerFeeAmount
435
+ createdAt
436
+ `;
437
+ var MANAGER_DAILY_SNAPSHOT_FIELDS = `
438
+ id
439
+ chainId
440
+ rateManagerId
441
+ dayTimestamp
442
+ tvl
443
+ delegatedDeposits
444
+ dailyVolume
445
+ dailyFees
446
+ dailyPnlUsdCents
447
+ dailyFulfilledIntents
448
+ cumulativeVolume
449
+ cumulativeFees
450
+ cumulativePnlUsdCents
451
+ cumulativeFulfilledIntents
452
+ updatedAt
453
+ `;
454
+ var RATE_MANAGER_ORACLE_CONFIG_FIELDS = `
455
+ id
456
+ chainId
457
+ rateManagerId
458
+ registry
459
+ paymentMethodHash
460
+ currencyCode
461
+ adapter
462
+ adapterConfig
463
+ feed
464
+ feedDecimals
465
+ spreadBps
466
+ maxStaleness
467
+ invert
468
+ lastOracleUpdatedAt
469
+ kind
470
+ createdAt
471
+ updatedAt
472
+ `;
473
+ var RATE_MANAGER_HOOK_MIN_LIQUIDITY_FIELDS = `
474
+ id
475
+ chainId
476
+ registry
477
+ rateManagerId
478
+ minLiquidity
479
+ createdAt
480
+ updatedAt
481
+ `;
482
+ var RATE_MANAGER_LIST_QUERY = (
483
+ /* GraphQL */
484
+ `
485
+ query VaultList(
486
+ $where: RateManager_bool_exp
487
+ $order_by: [RateManager_order_by!]
488
+ $limit: Int
489
+ $offset: Int
490
+ ) {
491
+ RateManager(where: $where, order_by: $order_by, limit: $limit, offset: $offset) {
492
+ ${RATE_MANAGER_FIELDS}
493
+ }
494
+ ManagerAggregateStats {
495
+ ${RATE_MANAGER_AGGREGATE_FIELDS}
496
+ }
497
+ }
498
+ `
499
+ );
500
+ var RATE_MANAGER_DETAIL_QUERY = (
501
+ /* GraphQL */
502
+ `
503
+ query VaultDetail(
504
+ $managerWhere: RateManager_bool_exp!
505
+ $rateWhere: RateManagerRate_bool_exp!
506
+ $aggregateWhere: ManagerAggregateStats_bool_exp!
507
+ $statsWhere: ManagerStats_bool_exp!
508
+ $delegationWhere: RateManagerDelegation_bool_exp!
509
+ $oracleWhere: RateManagerOracleConfig_bool_exp!
510
+ $hookWhere: RateManagerHookMinLiquidity_bool_exp!
511
+ $statsLimit: Int
512
+ ) {
513
+ RateManager(where: $managerWhere) {
514
+ ${RATE_MANAGER_FIELDS}
515
+ }
516
+ RateManagerRate(where: $rateWhere) {
517
+ ${RATE_MANAGER_RATE_FIELDS}
518
+ }
519
+ ManagerAggregateStats(where: $aggregateWhere) {
520
+ ${RATE_MANAGER_AGGREGATE_FIELDS}
521
+ }
522
+ ManagerStats(
523
+ where: $statsWhere
524
+ order_by: { createdAt: desc }
525
+ limit: $statsLimit
526
+ ) {
527
+ ${MANAGER_STATS_FIELDS}
528
+ }
529
+ RateManagerDelegation(where: $delegationWhere) {
530
+ ${RATE_MANAGER_DELEGATION_FIELDS}
531
+ }
532
+ RateManagerOracleConfig(where: $oracleWhere) {
533
+ ${RATE_MANAGER_ORACLE_CONFIG_FIELDS}
534
+ }
535
+ RateManagerHookMinLiquidity(where: $hookWhere, limit: 1) {
536
+ ${RATE_MANAGER_HOOK_MIN_LIQUIDITY_FIELDS}
537
+ }
538
+ }
539
+ `
540
+ );
541
+ var MANAGER_DAILY_SNAPSHOTS_QUERY = (
542
+ /* GraphQL */
543
+ `
544
+ query ManagerDailySnapshots(
545
+ $where: ManagerDailySnapshot_bool_exp!
546
+ $order_by: [ManagerDailySnapshot_order_by!]
547
+ $limit: Int
548
+ ) {
549
+ ManagerDailySnapshot(
550
+ where: $where
551
+ order_by: $order_by
552
+ limit: $limit
553
+ ) {
554
+ ${MANAGER_DAILY_SNAPSHOT_FIELDS}
555
+ }
556
+ }
557
+ `
558
+ );
559
+ var RATE_MANAGER_DELEGATIONS_QUERY = (
347
560
  /* GraphQL */
348
561
  `
349
- query GetExpiredIntents(
350
- $now: numeric!
562
+ query VaultDelegations(
563
+ $where: RateManagerDelegation_bool_exp!
564
+ $order_by: [RateManagerDelegation_order_by!]
351
565
  $limit: Int
352
- $depositIds: [String!]
566
+ $offset: Int
353
567
  ) {
568
+ RateManagerDelegation(
569
+ where: $where
570
+ order_by: $order_by
571
+ limit: $limit
572
+ offset: $offset
573
+ ) {
574
+ ${RATE_MANAGER_DELEGATION_FIELDS}
575
+ }
576
+ }
577
+ `
578
+ );
579
+ var DEPOSIT_DELEGATION_QUERY = (
580
+ /* GraphQL */
581
+ `
582
+ query DepositDelegation($depositId: String!) {
583
+ RateManagerDelegation(where: { depositId: { _eq: $depositId } }, limit: 1) {
584
+ ${RATE_MANAGER_DELEGATION_FIELDS}
585
+ }
586
+ }
587
+ `
588
+ );
589
+ var EXPIRED_INTENTS_QUERY = (
590
+ /* GraphQL */
591
+ `
592
+ query GetExpiredIntents($now: numeric!, $limit: Int, $depositIds: [String!]) {
354
593
  Intent(
355
594
  where: {
356
595
  status: { _eq: "SIGNALED" }
@@ -378,9 +617,7 @@ var INTENT_FULFILLMENTS_QUERY = (
378
617
  /* GraphQL */
379
618
  `
380
619
  query GetFulfilledIntents($intentHashes: [String!]) {
381
- Orchestrator_V21_IntentFulfilled(
382
- where: { intentHash: { _in: $intentHashes } }
383
- ) {
620
+ Orchestrator_V21_IntentFulfilled(where: { intentHash: { _in: $intentHashes } }) {
384
621
  intentHash
385
622
  isManualRelease
386
623
  fundsTransferredTo
@@ -388,22 +625,65 @@ var INTENT_FULFILLMENTS_QUERY = (
388
625
  }
389
626
  `
390
627
  );
628
+ var MANUAL_RATE_UPDATES_QUERY = (
629
+ /* GraphQL */
630
+ `
631
+ query ManualRateUpdates(
632
+ $where: ManualRateManagerRegistry_RateManagerMinRateUpdated_bool_exp!
633
+ $order_by: [ManualRateManagerRegistry_RateManagerMinRateUpdated_order_by!]
634
+ $limit: Int
635
+ ) {
636
+ ManualRateManagerRegistry_RateManagerMinRateUpdated(
637
+ where: $where
638
+ order_by: $order_by
639
+ limit: $limit
640
+ ) {
641
+ id
642
+ rateManagerId
643
+ paymentMethod
644
+ currency
645
+ minRate
646
+ }
647
+ }
648
+ `
649
+ );
650
+ var ORACLE_CONFIG_UPDATES_QUERY = (
651
+ /* GraphQL */
652
+ `
653
+ query OracleConfigUpdates(
654
+ $where: OracleRateManagerRegistry_RateManagerOracleConfigUpdated_bool_exp!
655
+ $order_by: [OracleRateManagerRegistry_RateManagerOracleConfigUpdated_order_by!]
656
+ $limit: Int
657
+ ) {
658
+ OracleRateManagerRegistry_RateManagerOracleConfigUpdated(
659
+ where: $where
660
+ order_by: $order_by
661
+ limit: $limit
662
+ ) {
663
+ id
664
+ rateManagerId
665
+ paymentMethod
666
+ currency
667
+ adapter
668
+ spreadBps
669
+ maxStaleness
670
+ adapterConfig
671
+ }
672
+ }
673
+ `
674
+ );
391
675
  var FULFILLMENT_AND_PAYMENT_QUERY = (
392
676
  /* GraphQL */
393
677
  `
394
678
  query PaymentVerificationForFulfilledIntent($intentHash: String!) {
395
- Orchestrator_V21_IntentFulfilled(
396
- where: { intentHash: { _eq: $intentHash } }
397
- ) {
679
+ Orchestrator_V21_IntentFulfilled(where: { intentHash: { _eq: $intentHash } }) {
398
680
  id
399
681
  intentHash
400
682
  amount
401
683
  isManualRelease
402
684
  fundsTransferredTo
403
685
  }
404
- UnifiedVerifier_V21_PaymentVerified(
405
- where: { intentHash: { _eq: $intentHash } }
406
- ) {
686
+ UnifiedVerifier_V21_PaymentVerified(where: { intentHash: { _eq: $intentHash } }) {
407
687
  id
408
688
  intentHash
409
689
  method
@@ -439,7 +719,9 @@ function createCompositeDepositId(escrowAddress, depositId) {
439
719
  return `${escrowAddress.toLowerCase()}_${depositId.toString()}`;
440
720
  }
441
721
  function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
442
- const paymentMethods = (deposit.paymentMethods ?? []).filter((pm) => pm.active !== false);
722
+ const paymentMethods = (deposit.paymentMethods ?? []).filter(
723
+ (pm) => pm.active !== false
724
+ );
443
725
  const currencies = deposit.currencies ?? [];
444
726
  const currenciesByPaymentMethod = /* @__PURE__ */ new Map();
445
727
  for (const c of currencies) {
@@ -456,7 +738,7 @@ function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
456
738
  },
457
739
  currencies: (currenciesByPaymentMethod.get(pm.paymentMethodHash) ?? []).map((cur) => ({
458
740
  code: cur.currencyCode,
459
- conversionRate: toBigInt(cur.minConversionRate)
741
+ conversionRate: toBigInt(cur.conversionRate ?? cur.minConversionRate)
460
742
  })),
461
743
  methodHash: pm.paymentMethodHash
462
744
  }));
@@ -470,7 +752,10 @@ function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
470
752
  depositor: normalizeAddress(deposit.depositor),
471
753
  token: normalizeAddress(deposit.token),
472
754
  depositAmount,
473
- intentAmountRange: { min: toBigInt(deposit.intentAmountMin), max: toBigInt(deposit.intentAmountMax) },
755
+ intentAmountRange: {
756
+ min: toBigInt(deposit.intentAmountMin),
757
+ max: toBigInt(deposit.intentAmountMax)
758
+ },
474
759
  acceptingIntents: Boolean(deposit.acceptingIntents),
475
760
  remainingDepositAmount: remaining,
476
761
  outstandingIntentAmount: outstanding,
@@ -480,7 +765,9 @@ function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
480
765
  };
481
766
  }
482
767
  function convertDepositsForLiquidity(deposits, chainId, escrowAddress) {
483
- return deposits.filter((d) => d.depositor && d.depositor.toLowerCase() !== ZERO && d.acceptingIntents && toBigInt(d.remainingDeposits) > 0n && d.status === "ACTIVE").map((d) => convertIndexerDepositToEscrowView(d));
768
+ return deposits.filter(
769
+ (d) => d.depositor && d.depositor.toLowerCase() !== ZERO && d.acceptingIntents && toBigInt(d.remainingDeposits) > 0n && d.status === "ACTIVE"
770
+ ).map((d) => convertIndexerDepositToEscrowView(d));
484
771
  }
485
772
  function convertIndexerIntentsToEscrowViews(intents, depositViewsById) {
486
773
  const result = [];
@@ -705,6 +992,287 @@ var IndexerDepositService = class {
705
992
  }
706
993
  };
707
994
 
995
+ // src/indexer/rateManagerService.ts
996
+ var DEFAULT_LIMIT2 = 50;
997
+ var ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000";
998
+ function normalizeRateManagerId(value) {
999
+ if (!value) return "";
1000
+ return value.toLowerCase();
1001
+ }
1002
+ function normalizeRegistry(value) {
1003
+ if (!value) return "";
1004
+ return value.toLowerCase();
1005
+ }
1006
+ function getManagerScopeKey(rateManagerId, registry) {
1007
+ const normalizedId = normalizeRateManagerId(rateManagerId);
1008
+ const normalizedRegistry = normalizeRegistry(registry);
1009
+ return normalizedRegistry ? `${normalizedRegistry}:${normalizedId}` : normalizedId;
1010
+ }
1011
+ function extractRegistryFromScopedId(id) {
1012
+ if (!id) return null;
1013
+ const parts = id.split("_");
1014
+ if (parts.length < 3) return null;
1015
+ const registry = parts[1] ?? "";
1016
+ return registry.startsWith("0x") ? registry.toLowerCase() : null;
1017
+ }
1018
+ function buildRegistryScopedIdPattern(rateManagerId, registry) {
1019
+ const normalizedId = normalizeRateManagerId(rateManagerId);
1020
+ const normalizedRegistry = normalizeRegistry(registry);
1021
+ return `%_${normalizedRegistry}_${normalizedId}`;
1022
+ }
1023
+ function buildDailySnapshotScopedIdPattern(rateManagerId, registry) {
1024
+ return `${buildRegistryScopedIdPattern(rateManagerId, registry)}_%`;
1025
+ }
1026
+ function toSafeBigInt(value) {
1027
+ if (!value) return 0n;
1028
+ try {
1029
+ return BigInt(value);
1030
+ } catch {
1031
+ return 0n;
1032
+ }
1033
+ }
1034
+ function compareBigInt(a, b, direction) {
1035
+ if (a === b) return 0;
1036
+ if (direction === "asc") return a < b ? -1 : 1;
1037
+ return a > b ? -1 : 1;
1038
+ }
1039
+ function isAggregateOrderField(field) {
1040
+ return field === "currentDelegatedBalance" || field === "totalFilledVolume";
1041
+ }
1042
+ var IndexerRateManagerService = class {
1043
+ constructor(client) {
1044
+ this.client = client;
1045
+ }
1046
+ buildWhere(filter) {
1047
+ if (!filter) return void 0;
1048
+ const where = {};
1049
+ if (filter.manager) {
1050
+ where.manager = { _ilike: filter.manager };
1051
+ }
1052
+ if (filter.name) {
1053
+ where.name = { _ilike: `%${filter.name}%` };
1054
+ }
1055
+ if (filter.maxFee) {
1056
+ where.maxFee = { _lte: filter.maxFee };
1057
+ }
1058
+ if (filter.hasHook !== void 0) {
1059
+ where.depositHook = filter.hasHook ? { _neq: ZERO_ADDRESS2 } : { _eq: ZERO_ADDRESS2 };
1060
+ }
1061
+ if (filter.rateManagerIds?.length) {
1062
+ where.rateManagerId = { _in: filter.rateManagerIds };
1063
+ }
1064
+ return Object.keys(where).length ? where : void 0;
1065
+ }
1066
+ buildOrderBy(pagination) {
1067
+ const rawField = pagination?.orderBy ?? "createdAt";
1068
+ const field = isAggregateOrderField(rawField) ? "createdAt" : rawField;
1069
+ const direction = pagination?.orderDirection === "asc" ? "asc" : "desc";
1070
+ return [{ [field]: direction }];
1071
+ }
1072
+ toRateManagerListItems(result) {
1073
+ const managers = result.RateManager ?? [];
1074
+ const aggregatesByScope = /* @__PURE__ */ new Map();
1075
+ for (const aggregate of result.ManagerAggregateStats ?? []) {
1076
+ const aggregateRegistry = extractRegistryFromScopedId(aggregate.id);
1077
+ const scopeKey = getManagerScopeKey(aggregate.rateManagerId, aggregateRegistry);
1078
+ aggregatesByScope.set(scopeKey, aggregate);
1079
+ }
1080
+ return managers.map((manager) => ({
1081
+ manager,
1082
+ aggregate: aggregatesByScope.get(getManagerScopeKey(manager.rateManagerId, manager.registry)) ?? aggregatesByScope.get(getManagerScopeKey(manager.rateManagerId)) ?? null
1083
+ }));
1084
+ }
1085
+ buildDelegationOrderBy(pagination) {
1086
+ const field = pagination?.orderBy ?? "updatedAt";
1087
+ const direction = pagination?.orderDirection === "asc" ? "asc" : "desc";
1088
+ return [{ [field]: direction }];
1089
+ }
1090
+ async fetchRateManagers(pagination, filter) {
1091
+ const orderBy = pagination?.orderBy ?? "createdAt";
1092
+ const direction = pagination?.orderDirection === "asc" ? "asc" : "desc";
1093
+ const limit = pagination?.limit ?? DEFAULT_LIMIT2;
1094
+ const offset = pagination?.offset ?? 0;
1095
+ if (isAggregateOrderField(orderBy)) {
1096
+ const result2 = await this.client.query({
1097
+ query: RATE_MANAGER_LIST_QUERY,
1098
+ variables: {
1099
+ where: this.buildWhere(filter),
1100
+ order_by: [{ createdAt: "desc" }]
1101
+ }
1102
+ });
1103
+ const sorted = this.toRateManagerListItems(result2).sort((a, b) => {
1104
+ const av = orderBy === "currentDelegatedBalance" ? toSafeBigInt(a.aggregate?.currentDelegatedBalance) : toSafeBigInt(a.aggregate?.totalFilledVolume);
1105
+ const bv = orderBy === "currentDelegatedBalance" ? toSafeBigInt(b.aggregate?.currentDelegatedBalance) : toSafeBigInt(b.aggregate?.totalFilledVolume);
1106
+ const aggregateCmp = compareBigInt(av, bv, direction);
1107
+ if (aggregateCmp !== 0) return aggregateCmp;
1108
+ const createdAtCmp = compareBigInt(
1109
+ toSafeBigInt(a.manager.createdAt),
1110
+ toSafeBigInt(b.manager.createdAt),
1111
+ "desc"
1112
+ );
1113
+ if (createdAtCmp !== 0) return createdAtCmp;
1114
+ return a.manager.rateManagerId.localeCompare(b.manager.rateManagerId);
1115
+ });
1116
+ return sorted.slice(offset, offset + limit);
1117
+ }
1118
+ const result = await this.client.query({
1119
+ query: RATE_MANAGER_LIST_QUERY,
1120
+ variables: {
1121
+ where: this.buildWhere(filter),
1122
+ order_by: this.buildOrderBy(pagination),
1123
+ limit,
1124
+ offset
1125
+ }
1126
+ });
1127
+ return this.toRateManagerListItems(result);
1128
+ }
1129
+ async fetchRateManagerDetail(rateManagerId, options) {
1130
+ if (!rateManagerId) return null;
1131
+ const normalizedId = normalizeRateManagerId(rateManagerId);
1132
+ const normalizedRegistry = normalizeRegistry(options?.registry);
1133
+ const result = await this.client.query({
1134
+ query: RATE_MANAGER_DETAIL_QUERY,
1135
+ variables: {
1136
+ managerWhere: {
1137
+ rateManagerId: { _eq: normalizedId },
1138
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1139
+ },
1140
+ rateWhere: {
1141
+ rateManagerId: { _eq: normalizedId },
1142
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1143
+ },
1144
+ aggregateWhere: {
1145
+ rateManagerId: { _eq: normalizedId },
1146
+ ...normalizedRegistry ? { id: { _ilike: buildRegistryScopedIdPattern(normalizedId, normalizedRegistry) } } : {}
1147
+ },
1148
+ statsWhere: {
1149
+ rateManagerId: { _eq: normalizedId }
1150
+ },
1151
+ delegationWhere: {
1152
+ rateManagerId: { _eq: normalizedId },
1153
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1154
+ },
1155
+ oracleWhere: {
1156
+ rateManagerId: { _eq: normalizedId },
1157
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1158
+ },
1159
+ hookWhere: {
1160
+ rateManagerId: { _eq: normalizedId },
1161
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1162
+ },
1163
+ statsLimit: options?.statsLimit ?? 20
1164
+ }
1165
+ });
1166
+ const manager = result.RateManager?.[0];
1167
+ if (!manager) return null;
1168
+ const scopedRegistry = normalizeRegistry(manager.registry);
1169
+ const scopedRates = (result.RateManagerRate ?? []).filter(
1170
+ (rate) => normalizeRegistry(rate.registry) === scopedRegistry
1171
+ );
1172
+ const scopedDelegations = (result.RateManagerDelegation ?? []).filter(
1173
+ (delegation) => normalizeRegistry(delegation.registry) === scopedRegistry
1174
+ );
1175
+ const scopedOracleConfigs = (result.RateManagerOracleConfig ?? []).filter(
1176
+ (config) => normalizeRegistry(config.registry) === scopedRegistry
1177
+ );
1178
+ const scopedRecentStats = (result.ManagerStats ?? []).filter(
1179
+ (stats) => normalizeRegistry(stats.manager) === normalizeRegistry(manager.manager)
1180
+ );
1181
+ const scopedHookMinLiquidity = (result.RateManagerHookMinLiquidity ?? []).find(
1182
+ (hook) => normalizeRegistry(hook.registry) === scopedRegistry
1183
+ ) ?? null;
1184
+ const aggregate = (result.ManagerAggregateStats ?? []).find(
1185
+ (stats) => extractRegistryFromScopedId(stats.id) === scopedRegistry
1186
+ ) ?? result.ManagerAggregateStats?.[0] ?? null;
1187
+ return {
1188
+ manager,
1189
+ rates: scopedRates,
1190
+ aggregate,
1191
+ recentStats: scopedRecentStats,
1192
+ delegations: scopedDelegations,
1193
+ oracleConfigs: scopedOracleConfigs,
1194
+ hookMinLiquidity: scopedHookMinLiquidity
1195
+ };
1196
+ }
1197
+ async fetchRateManagerDelegations(rateManagerId, pagination) {
1198
+ if (!rateManagerId) return [];
1199
+ const normalizedId = normalizeRateManagerId(rateManagerId);
1200
+ const normalizedRegistry = normalizeRegistry(pagination?.registry);
1201
+ const result = await this.client.query({
1202
+ query: RATE_MANAGER_DELEGATIONS_QUERY,
1203
+ variables: {
1204
+ where: {
1205
+ rateManagerId: { _eq: normalizedId },
1206
+ ...normalizedRegistry ? { registry: { _eq: normalizedRegistry } } : {}
1207
+ },
1208
+ order_by: this.buildDelegationOrderBy(pagination),
1209
+ limit: pagination?.limit ?? DEFAULT_LIMIT2,
1210
+ offset: pagination?.offset ?? 0
1211
+ }
1212
+ });
1213
+ return result.RateManagerDelegation ?? [];
1214
+ }
1215
+ async fetchManagerDailySnapshots(rateManagerId, options) {
1216
+ if (!rateManagerId) return [];
1217
+ const normalizedId = normalizeRateManagerId(rateManagerId);
1218
+ const normalizedRegistry = normalizeRegistry(options?.registry);
1219
+ try {
1220
+ const result = await this.client.query({
1221
+ query: MANAGER_DAILY_SNAPSHOTS_QUERY,
1222
+ variables: {
1223
+ where: {
1224
+ rateManagerId: { _eq: normalizedId },
1225
+ ...normalizedRegistry ? {
1226
+ id: {
1227
+ _ilike: buildDailySnapshotScopedIdPattern(normalizedId, normalizedRegistry)
1228
+ }
1229
+ } : {}
1230
+ },
1231
+ order_by: [{ dayTimestamp: "asc" }],
1232
+ limit: options?.limit ?? 365
1233
+ }
1234
+ });
1235
+ return result.ManagerDailySnapshot ?? [];
1236
+ } catch {
1237
+ return [];
1238
+ }
1239
+ }
1240
+ async fetchDelegationForDeposit(depositId) {
1241
+ if (!depositId) return null;
1242
+ const result = await this.client.query({
1243
+ query: DEPOSIT_DELEGATION_QUERY,
1244
+ variables: {
1245
+ depositId: depositId.toLowerCase()
1246
+ }
1247
+ });
1248
+ return result.RateManagerDelegation?.[0] ?? null;
1249
+ }
1250
+ async fetchManualRateUpdates(rateManagerId, options) {
1251
+ if (!rateManagerId) return [];
1252
+ const result = await this.client.query({
1253
+ query: MANUAL_RATE_UPDATES_QUERY,
1254
+ variables: {
1255
+ where: { rateManagerId: { _eq: rateManagerId.toLowerCase() } },
1256
+ order_by: [{ id: "desc" }],
1257
+ limit: options?.limit ?? 100
1258
+ }
1259
+ });
1260
+ return result.ManualRateManagerRegistry_RateManagerMinRateUpdated ?? [];
1261
+ }
1262
+ async fetchOracleConfigUpdates(rateManagerId, options) {
1263
+ if (!rateManagerId) return [];
1264
+ const result = await this.client.query({
1265
+ query: ORACLE_CONFIG_UPDATES_QUERY,
1266
+ variables: {
1267
+ where: { rateManagerId: { _eq: rateManagerId.toLowerCase() } },
1268
+ order_by: [{ id: "desc" }],
1269
+ limit: options?.limit ?? 100
1270
+ }
1271
+ });
1272
+ return result.OracleRateManagerRegistry_RateManagerOracleConfigUpdated ?? [];
1273
+ }
1274
+ };
1275
+
708
1276
  // src/indexer/intentVerification.ts
709
1277
  async function fetchFulfillmentAndPayment(client, intentHash) {
710
1278
  return client.query({
@@ -897,6 +1465,15 @@ function processApiResponse(data, transformDates = true) {
897
1465
  }
898
1466
  return data;
899
1467
  }
1468
+ function buildQuery(params) {
1469
+ const parts = [];
1470
+ for (const [key, value] of Object.entries(params)) {
1471
+ if (value === void 0) continue;
1472
+ const encoded = Array.isArray(value) ? value.join(",") : value;
1473
+ parts.push(`${key}=${encodeURIComponent(encoded)}`);
1474
+ }
1475
+ return parts.length > 0 ? `?${parts.join("&")}` : "";
1476
+ }
900
1477
  async function apiPostDepositDetails(req, baseApiUrl, timeoutMs) {
901
1478
  return apiFetch({
902
1479
  url: `${baseApiUrl.replace(/\/$/, "")}/v1/makers/create`,
@@ -980,9 +1557,9 @@ function transformDatesToObjects(obj) {
980
1557
  return transformed;
981
1558
  }
982
1559
  async function apiGetOwnerDeposits(req, apiKey, baseApiUrl, authToken, timeoutMs) {
983
- const statusQuery = req.status ? `?status=${encodeURIComponent(req.status)}` : "";
1560
+ const query = buildQuery({ escrowAddress: req.escrowAddress, status: req.status });
984
1561
  const data = await apiFetch({
985
- url: `${withApiBase(baseApiUrl)}/v1/deposits/maker/${req.ownerAddress}${statusQuery}`,
1562
+ url: `${withApiBase(baseApiUrl)}/v1/deposits/maker/${req.ownerAddress}${query}`,
986
1563
  method: "GET",
987
1564
  apiKey,
988
1565
  authToken,
@@ -1197,6 +1774,97 @@ var Zkp2pClient = class {
1197
1774
  * @returns Transaction hash
1198
1775
  */
1199
1776
  this.removeDelegate = this.buildEscrowMethod("removeDelegate", (params) => [params.depositId]);
1777
+ /**
1778
+ * Assign a deposit to a rate manager (vault) through the controller.
1779
+ */
1780
+ this.setDepositRateManager = this.buildContractMethod(
1781
+ () => ({
1782
+ address: this.rateManagerControllerAddress,
1783
+ abi: this.rateManagerControllerAbi,
1784
+ label: "Rate manager controller (staging only)"
1785
+ }),
1786
+ "setDepositRateManager",
1787
+ (params) => [params.escrow, params.depositId, params.registry, params.rateManagerId]
1788
+ );
1789
+ /**
1790
+ * Clear an existing rate manager delegation for a deposit.
1791
+ */
1792
+ this.clearDepositRateManager = this.buildContractMethod(
1793
+ () => ({
1794
+ address: this.rateManagerControllerAddress,
1795
+ abi: this.rateManagerControllerAbi,
1796
+ label: "Rate manager controller (staging only)"
1797
+ }),
1798
+ "clearDepositRateManager",
1799
+ (params) => [params.escrow, params.depositId]
1800
+ );
1801
+ /**
1802
+ * Create a new rate manager (vault).
1803
+ */
1804
+ this.createRateManager = this.buildContractMethod(
1805
+ () => ({
1806
+ address: this.rateManagerRegistryAddress,
1807
+ abi: this.rateManagerRegistryAbi,
1808
+ label: "Rate manager registry (staging only)"
1809
+ }),
1810
+ "createRateManager",
1811
+ (params) => [params.config]
1812
+ );
1813
+ /**
1814
+ * Set a manager floor for a single payment method/currency pair.
1815
+ */
1816
+ this.setVaultMinRate = this.buildContractMethod(
1817
+ () => ({
1818
+ address: this.rateManagerRegistryAddress,
1819
+ abi: this.rateManagerRegistryAbi,
1820
+ label: "Rate manager registry (staging only)"
1821
+ }),
1822
+ "setMinRate",
1823
+ (params) => [params.rateManagerId, params.paymentMethodHash, params.currencyHash, params.rate]
1824
+ );
1825
+ /**
1826
+ * Set manager floors in batch.
1827
+ */
1828
+ this.setVaultMinRatesBatch = this.buildContractMethod(
1829
+ () => ({
1830
+ address: this.rateManagerRegistryAddress,
1831
+ abi: this.rateManagerRegistryAbi,
1832
+ label: "Rate manager registry (staging only)"
1833
+ }),
1834
+ "setMinRatesBatch",
1835
+ (params) => [params.rateManagerId, params.paymentMethods, params.currencies, params.rates]
1836
+ );
1837
+ /**
1838
+ * Update vault manager fee.
1839
+ */
1840
+ this.setVaultFee = this.buildContractMethod(
1841
+ () => ({
1842
+ address: this.rateManagerRegistryAddress,
1843
+ abi: this.rateManagerRegistryAbi,
1844
+ label: "Rate manager registry (staging only)"
1845
+ }),
1846
+ "setFee",
1847
+ (params) => [params.rateManagerId, params.newFee]
1848
+ );
1849
+ /**
1850
+ * Update vault manager/config metadata.
1851
+ */
1852
+ this.setVaultConfig = this.buildContractMethod(
1853
+ () => ({
1854
+ address: this.rateManagerRegistryAddress,
1855
+ abi: this.rateManagerRegistryAbi,
1856
+ label: "Rate manager registry (staging only)"
1857
+ }),
1858
+ "setRateManagerConfig",
1859
+ (params) => [
1860
+ params.rateManagerId,
1861
+ params.newManager,
1862
+ params.newFeeRecipient,
1863
+ params.newHook,
1864
+ params.newName,
1865
+ params.newUri
1866
+ ]
1867
+ );
1200
1868
  /**
1201
1869
  * Adds new payment methods to an existing deposit.
1202
1870
  *
@@ -1517,6 +2185,18 @@ var Zkp2pClient = class {
1517
2185
  this.unifiedPaymentVerifier = addresses.unifiedPaymentVerifier;
1518
2186
  this.protocolViewerAddress = addresses.protocolViewer;
1519
2187
  this.protocolViewerAbi = abis.protocolViewer;
2188
+ try {
2189
+ const rateManagerContracts = getRateManagerContracts(this.chainId, this.runtimeEnv);
2190
+ this.rateManagerRegistryAddress = rateManagerContracts.addresses.registry;
2191
+ this.rateManagerControllerAddress = rateManagerContracts.addresses.controller;
2192
+ this.rateManagerRegistryAbi = rateManagerContracts.abis.registry;
2193
+ this.rateManagerControllerAbi = rateManagerContracts.abis.controller;
2194
+ } catch {
2195
+ this.rateManagerRegistryAddress = void 0;
2196
+ this.rateManagerControllerAddress = void 0;
2197
+ this.rateManagerRegistryAbi = void 0;
2198
+ this.rateManagerControllerAbi = void 0;
2199
+ }
1520
2200
  const maybeUsdc = addresses.usdc;
1521
2201
  if (maybeUsdc) this._usdcAddress = maybeUsdc;
1522
2202
  const indexerEndpoint = opts.indexerUrl ?? defaultIndexerEndpoint(this.runtimeEnv === "staging" ? "STAGING" : "PRODUCTION");
@@ -1526,6 +2206,7 @@ var Zkp2pClient = class {
1526
2206
  apiKey: opts.indexerApiKey
1527
2207
  });
1528
2208
  this._indexerService = new IndexerDepositService(this._indexerClient);
2209
+ this._indexerRateManagerService = new IndexerRateManagerService(this._indexerClient);
1529
2210
  this.baseApiUrl = opts.baseApiUrl;
1530
2211
  this.apiKey = opts.apiKey;
1531
2212
  this.authorizationToken = opts.authorizationToken;
@@ -1628,6 +2309,67 @@ var Zkp2pClient = class {
1628
2309
  args: opts.args ?? []
1629
2310
  };
1630
2311
  }
2312
+ prepareContractTransaction(opts) {
2313
+ const { referrer, value } = opts.txOverrides ?? {};
2314
+ const data = encodeWithAttribution(
2315
+ {
2316
+ abi: opts.abi,
2317
+ functionName: opts.functionName,
2318
+ args: opts.args ?? []
2319
+ },
2320
+ referrer
2321
+ );
2322
+ return {
2323
+ to: opts.address,
2324
+ data,
2325
+ value: opts.value ?? value ?? 0n,
2326
+ chainId: this.chainId,
2327
+ abi: opts.abi,
2328
+ functionName: opts.functionName,
2329
+ args: opts.args ?? []
2330
+ };
2331
+ }
2332
+ buildContractMethod(resolveContract, functionName, buildArgs, buildValue) {
2333
+ return Object.assign(
2334
+ async (params) => {
2335
+ const contract = resolveContract();
2336
+ if (!contract.address || !contract.abi) {
2337
+ throw new Error(`${contract.label} not available`);
2338
+ }
2339
+ const prepared = this.prepareContractTransaction({
2340
+ address: contract.address,
2341
+ abi: contract.abi,
2342
+ functionName,
2343
+ args: buildArgs(params),
2344
+ txOverrides: params.txOverrides,
2345
+ value: buildValue?.(params)
2346
+ });
2347
+ return this.executePreparedTransaction(prepared, params.txOverrides);
2348
+ },
2349
+ {
2350
+ prepare: async (params) => {
2351
+ const contract = resolveContract();
2352
+ if (!contract.address || !contract.abi) {
2353
+ throw new Error(`${contract.label} not available`);
2354
+ }
2355
+ const prepared = this.prepareContractTransaction({
2356
+ address: contract.address,
2357
+ abi: contract.abi,
2358
+ functionName,
2359
+ args: buildArgs(params),
2360
+ txOverrides: params.txOverrides,
2361
+ value: buildValue?.(params)
2362
+ });
2363
+ return {
2364
+ to: prepared.to,
2365
+ data: prepared.data,
2366
+ value: prepared.value,
2367
+ chainId: prepared.chainId
2368
+ };
2369
+ }
2370
+ }
2371
+ );
2372
+ }
1631
2373
  buildEscrowMethod(functionName, buildArgs, buildValue) {
1632
2374
  return Object.assign(
1633
2375
  async (params) => {
@@ -1836,6 +2578,7 @@ var Zkp2pClient = class {
1836
2578
  */
1837
2579
  get indexer() {
1838
2580
  const service = this._indexerService;
2581
+ const rateManagerService = this._indexerRateManagerService;
1839
2582
  const client = this._indexerClient;
1840
2583
  return {
1841
2584
  /** Raw GraphQL client for custom queries */
@@ -1910,6 +2653,42 @@ var Zkp2pClient = class {
1910
2653
  getDepositsByIdsWithRelations: (ids, options) => {
1911
2654
  return service.fetchDepositsByIdsWithRelations(ids, options);
1912
2655
  },
2656
+ /**
2657
+ * Fetches rate managers (vaults) with aggregate stats.
2658
+ */
2659
+ getRateManagers: (pagination, filter) => {
2660
+ return rateManagerService.fetchRateManagers(pagination, filter);
2661
+ },
2662
+ /**
2663
+ * Fetches detail for a single rate manager.
2664
+ */
2665
+ getRateManagerDetail: (rateManagerId, options) => {
2666
+ return rateManagerService.fetchRateManagerDetail(rateManagerId, options);
2667
+ },
2668
+ /**
2669
+ * Fetches delegated deposits for a rate manager.
2670
+ */
2671
+ getRateManagerDelegations: (rateManagerId, pagination) => {
2672
+ return rateManagerService.fetchRateManagerDelegations(rateManagerId, pagination);
2673
+ },
2674
+ /**
2675
+ * Fetches delegation record for a specific composite deposit ID.
2676
+ */
2677
+ getDelegationForDeposit: (depositId) => {
2678
+ return rateManagerService.fetchDelegationForDeposit(depositId);
2679
+ },
2680
+ /**
2681
+ * Fetches daily snapshots for a rate manager (vault).
2682
+ */
2683
+ getManagerDailySnapshots: (rateManagerId, options) => {
2684
+ return rateManagerService.fetchManagerDailySnapshots(rateManagerId, options);
2685
+ },
2686
+ getManualRateUpdates: (rateManagerId, options) => {
2687
+ return rateManagerService.fetchManualRateUpdates(rateManagerId, options);
2688
+ },
2689
+ getOracleConfigUpdates: (rateManagerId, options) => {
2690
+ return rateManagerService.fetchOracleConfigUpdates(rateManagerId, options);
2691
+ },
1913
2692
  /**
1914
2693
  * Performs a raw GraphQL query against the indexer.
1915
2694
  */
@@ -2113,7 +2892,7 @@ var Zkp2pClient = class {
2113
2892
  }
2114
2893
  }
2115
2894
  });
2116
- const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-P4HY7S34.mjs');
2895
+ const { mapConversionRatesToOnchainMinRate: mapConversionRatesToOnchainMinRate2 } = await import('./currency-5RZ6VCEA.mjs');
2117
2896
  const normalized = params.conversionRates.map(
2118
2897
  (group) => group.map((r) => ({ currency: r.currency, conversionRate: r.conversionRate }))
2119
2898
  );
@@ -2139,6 +2918,40 @@ var Zkp2pClient = class {
2139
2918
  });
2140
2919
  return { depositDetails, prepared };
2141
2920
  }
2921
+ /**
2922
+ * Read controller delegation state for a deposit.
2923
+ */
2924
+ async getDepositRateManager(escrow, depositId) {
2925
+ if (!this.rateManagerControllerAddress || !this.rateManagerControllerAbi) {
2926
+ throw new Error("Rate manager controller not available");
2927
+ }
2928
+ const id = typeof depositId === "bigint" ? depositId : BigInt(depositId);
2929
+ const result = await this.publicClient.readContract({
2930
+ address: this.rateManagerControllerAddress,
2931
+ abi: this.rateManagerControllerAbi,
2932
+ functionName: "getDepositRateManager",
2933
+ args: [escrow, id]
2934
+ });
2935
+ return {
2936
+ registry: result[0],
2937
+ rateManagerId: result[1]
2938
+ };
2939
+ }
2940
+ /**
2941
+ * Read effective manager fee for a deposit.
2942
+ */
2943
+ async getManagerFee(escrow, depositId) {
2944
+ if (!this.rateManagerControllerAddress || !this.rateManagerControllerAbi) {
2945
+ throw new Error("Rate manager controller not available");
2946
+ }
2947
+ const id = typeof depositId === "bigint" ? depositId : BigInt(depositId);
2948
+ return await this.publicClient.readContract({
2949
+ address: this.rateManagerControllerAddress,
2950
+ abi: this.rateManagerControllerAbi,
2951
+ functionName: "getManagerFee",
2952
+ args: [escrow, id]
2953
+ });
2954
+ }
2142
2955
  /**
2143
2956
  * Prepare signalIntent transaction (all logic except simulation/send).
2144
2957
  * Returns the prepared transaction with encoded calldata.
@@ -2195,6 +3008,7 @@ var Zkp2pClient = class {
2195
3008
  gatingServiceSignature,
2196
3009
  signatureExpiration: typeof signatureExpiration === "bigint" ? signatureExpiration : BigInt(signatureExpiration),
2197
3010
  postIntentHook: params.postIntentHook ?? "0x0000000000000000000000000000000000000000",
3011
+ preIntentHookData: params.preIntentHookData ?? "0x",
2198
3012
  data: params.data ?? "0x"
2199
3013
  }
2200
3014
  ];
@@ -2262,11 +3076,11 @@ var Zkp2pClient = class {
2262
3076
  const paymentMethodHash = inputs.paymentMethodHash || "0x";
2263
3077
  const timestampBufferMs = params.timestampBufferMs ?? "300000";
2264
3078
  const catalog = getPaymentMethodsCatalog(this.chainId, this.runtimeEnv);
2265
- const { resolvePaymentMethodNameFromHash: resolvePaymentMethodNameFromHash2 } = await import('./paymentResolution-F4I7TTEW.mjs');
3079
+ const { resolvePaymentMethodNameFromHash: resolvePaymentMethodNameFromHash2 } = await import('./paymentResolution-HBYLUETP.mjs');
2266
3080
  const platformName = resolvePaymentMethodNameFromHash2(paymentMethodHash, catalog);
2267
3081
  if (!platformName)
2268
3082
  throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
2269
- const { resolvePlatformAttestationConfig } = await import('./constants-F3MNDOGF.mjs');
3083
+ const { resolvePlatformAttestationConfig } = await import('./constants-MCRAVLDF.mjs');
2270
3084
  const cfg = resolvePlatformAttestationConfig(platformName);
2271
3085
  const platform = cfg.actionPlatform;
2272
3086
  const actionType = cfg.actionType;
@@ -2447,7 +3261,7 @@ var Zkp2pClient = class {
2447
3261
  functionName: "getDeposit",
2448
3262
  args: [id]
2449
3263
  });
2450
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3264
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2451
3265
  return parseDepositView2(raw);
2452
3266
  } catch (e) {
2453
3267
  const raw = await this.publicClient.readContract({
@@ -2456,7 +3270,7 @@ var Zkp2pClient = class {
2456
3270
  functionName: "getDeposit",
2457
3271
  args: [id]
2458
3272
  });
2459
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3273
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2460
3274
  return parseDepositView2(raw);
2461
3275
  }
2462
3276
  }
@@ -2468,7 +3282,7 @@ var Zkp2pClient = class {
2468
3282
  */
2469
3283
  async getPvDepositsFromIds(ids) {
2470
3284
  if (!this.protocolViewerAddress || !this.protocolViewerAbi) {
2471
- const { parseDepositView: parseDepositView3 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3285
+ const { parseDepositView: parseDepositView3 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2472
3286
  const results = [];
2473
3287
  for (const id of ids) {
2474
3288
  const raw2 = await this.publicClient.readContract({
@@ -2488,7 +3302,7 @@ var Zkp2pClient = class {
2488
3302
  functionName: "getDepositFromIds",
2489
3303
  args: [bn]
2490
3304
  });
2491
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3305
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2492
3306
  return raw.map(parseDepositView2);
2493
3307
  }
2494
3308
  /**
@@ -2506,7 +3320,7 @@ var Zkp2pClient = class {
2506
3320
  functionName: "getAccountDeposits",
2507
3321
  args: [owner]
2508
3322
  });
2509
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3323
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2510
3324
  return raw.map(parseDepositView2);
2511
3325
  } catch (e) {
2512
3326
  const raw = await this.publicClient.readContract({
@@ -2515,7 +3329,7 @@ var Zkp2pClient = class {
2515
3329
  functionName: "getAccountDeposits",
2516
3330
  args: [owner]
2517
3331
  });
2518
- const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3332
+ const { parseDepositView: parseDepositView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2519
3333
  return raw.map(parseDepositView2);
2520
3334
  }
2521
3335
  }
@@ -2534,7 +3348,7 @@ var Zkp2pClient = class {
2534
3348
  functionName: "getAccountIntents",
2535
3349
  args: [owner]
2536
3350
  });
2537
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3351
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2538
3352
  return raw.map(parseIntentView2);
2539
3353
  }
2540
3354
  /**
@@ -2551,7 +3365,7 @@ var Zkp2pClient = class {
2551
3365
  functionName: "getIntent",
2552
3366
  args: [intentHash]
2553
3367
  });
2554
- const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-5WBXCEHR.mjs');
3368
+ const { parseIntentView: parseIntentView2 } = await import('./protocolViewerParsers-DDQ4TKNB.mjs');
2555
3369
  return parseIntentView2(raw);
2556
3370
  }
2557
3371
  // ╔═══════════════════════════════════════════════════════════════════════════╗
@@ -2888,6 +3702,6 @@ var logger = {
2888
3702
  }
2889
3703
  };
2890
3704
 
2891
- export { BASE_BUILDER_CODE, IndexerClient, IndexerDepositService, Zkp2pClient as OfframpClient, PEER_EXTENSION_CHROME_URL, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, isPeerExtensionAvailable, logger, openPeerExtensionInstallPage, peerExtensionSdk, sendTransactionWithAttribution, setLogLevel };
3705
+ export { BASE_BUILDER_CODE, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PEER_EXTENSION_CHROME_URL, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, isPeerExtensionAvailable, logger, openPeerExtensionInstallPage, peerExtensionSdk, sendTransactionWithAttribution, setLogLevel };
2892
3706
  //# sourceMappingURL=index.mjs.map
2893
3707
  //# sourceMappingURL=index.mjs.map