@zkp2p/sdk 0.1.0 → 0.2.0

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.
@@ -0,0 +1,4 @@
1
+ export { enrichPvDepositView, enrichPvIntentView, parseDepositView, parseIntentView } from './chunk-J33LUXNA.mjs';
2
+ import './chunk-ZFBH4HD7.mjs';
3
+ //# sourceMappingURL=protocolViewerParsers-VVASNOXW.mjs.map
4
+ //# sourceMappingURL=protocolViewerParsers-VVASNOXW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-QVG4JP23.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-VVASNOXW.mjs"}
package/dist/react.cjs CHANGED
@@ -645,45 +645,17 @@ var assertAtomicDelegationSwitchSupport = (requiresSwitch, canBatch) => {
645
645
  "Switching delegation targets requires smart-account batching. Clear the existing delegation first."
646
646
  );
647
647
  };
648
- var getDelegationRoute = (client, escrow) => {
649
- const escrowLower = escrow.toLowerCase();
650
- const legacyLower = client.legacyEscrowAddress?.toLowerCase();
651
- if (legacyLower && escrowLower === legacyLower) return "legacy";
652
- if (client.escrowAddresses && client.escrowAddresses.length > 0) {
653
- const v2Candidates = client.escrowAddresses.filter(
654
- (addr) => !legacyLower || addr.toLowerCase() !== legacyLower
655
- );
656
- if (v2Candidates.some((addr) => addr.toLowerCase() === escrowLower)) {
657
- return "v2";
658
- }
659
- }
660
- if (client.escrowV2Address && escrowLower === client.escrowV2Address.toLowerCase()) {
661
- return "v2";
662
- }
663
- return "legacy";
664
- };
665
- var assertDelegationMethodSupport = (client, route, action) => {
666
- if (route === "v2") {
667
- const method2 = action === "set" ? "setRateManager" : "clearRateManager";
668
- if (client?.[method2]?.prepare) return;
669
- throw new Error(`EscrowV2 delegation requires SDK ${method2} support`);
670
- }
671
- const method = action === "set" ? "setDepositRateManager" : "clearDepositRateManager";
648
+ var getDelegationRoute = (_client, _escrow) => "v2";
649
+ var assertDelegationMethodSupport = (client, _route, action) => {
650
+ const method = action === "set" ? "setRateManager" : "clearRateManager";
672
651
  if (client?.[method]?.prepare) return;
673
- throw new Error(`Legacy delegation requires SDK ${method} support`);
652
+ throw new Error(`Delegation requires SDK ${method} support`);
674
653
  };
675
654
  var prepareClearDelegationTx = async (client, params, referrer) => {
676
655
  const route = getDelegationRoute(client, params.escrow);
677
656
  assertDelegationMethodSupport(client, route, "clear");
678
- if (route === "v2") {
679
- return client.clearRateManager.prepare({
680
- escrowAddress: params.escrow,
681
- depositId: params.depositId,
682
- ...referrer ? { txOverrides: { referrer } } : {}
683
- });
684
- }
685
- return client.clearDepositRateManager.prepare({
686
- escrow: params.escrow,
657
+ return client.clearRateManager.prepare({
658
+ escrowAddress: params.escrow,
687
659
  depositId: params.depositId,
688
660
  ...referrer ? { txOverrides: { referrer } } : {}
689
661
  });
@@ -691,19 +663,10 @@ var prepareClearDelegationTx = async (client, params, referrer) => {
691
663
  var prepareSetDelegationTx = async (client, params, referrer) => {
692
664
  const route = getDelegationRoute(client, params.escrow);
693
665
  assertDelegationMethodSupport(client, route, "set");
694
- if (route === "v2") {
695
- return client.setRateManager.prepare({
696
- escrowAddress: params.escrow,
697
- depositId: params.depositId,
698
- rateManagerAddress: params.registry,
699
- rateManagerId: params.rateManagerId,
700
- ...referrer ? { txOverrides: { referrer } } : {}
701
- });
702
- }
703
- return client.setDepositRateManager.prepare({
704
- escrow: params.escrow,
666
+ return client.setRateManager.prepare({
667
+ escrowAddress: params.escrow,
705
668
  depositId: params.depositId,
706
- registry: params.registry,
669
+ rateManagerAddress: params.registry,
707
670
  rateManagerId: params.rateManagerId,
708
671
  ...referrer ? { txOverrides: { referrer } } : {}
709
672
  });
@@ -820,14 +783,6 @@ function useVaultDelegation({
820
783
  args: [depositId, registry, rateManagerId],
821
784
  account: client.walletClient.account?.address
822
785
  });
823
- } else if (client.rateManagerControllerAddress && client.rateManagerControllerAbi) {
824
- await client.publicClient.simulateContract({
825
- address: client.rateManagerControllerAddress,
826
- abi: client.rateManagerControllerAbi,
827
- functionName: "setDepositRateManager",
828
- args: [escrow, depositId, registry, rateManagerId],
829
- account: client.walletClient.account?.address
830
- });
831
786
  }
832
787
  } catch (simulateError) {
833
788
  const reason = asErrorMessage(simulateError);