@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
@@ -1,4 +1,4 @@
1
- export { resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-2CLQDBR3.mjs';
1
+ export { resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-RLCHSX5F.mjs';
2
2
  import './chunk-37HJPVJE.mjs';
3
- //# sourceMappingURL=paymentResolution-F4I7TTEW.mjs.map
4
- //# sourceMappingURL=paymentResolution-F4I7TTEW.mjs.map
3
+ //# sourceMappingURL=paymentResolution-HBYLUETP.mjs.map
4
+ //# sourceMappingURL=paymentResolution-HBYLUETP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"paymentResolution-F4I7TTEW.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"paymentResolution-HBYLUETP.mjs"}
@@ -0,0 +1,6 @@
1
+ export { enrichPvDepositView, enrichPvIntentView, parseDepositView, parseIntentView } from './chunk-DJ7FJLYA.mjs';
2
+ import './chunk-RLCHSX5F.mjs';
3
+ import './chunk-PQQWQF3C.mjs';
4
+ import './chunk-37HJPVJE.mjs';
5
+ //# sourceMappingURL=protocolViewerParsers-DDQ4TKNB.mjs.map
6
+ //# sourceMappingURL=protocolViewerParsers-DDQ4TKNB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-5WBXCEHR.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-DDQ4TKNB.mjs"}
package/dist/react.cjs CHANGED
@@ -599,6 +599,434 @@ function useRemoveDelegate({ client, onSuccess, onError }) {
599
599
  );
600
600
  return react.useMemo(() => ({ removeDelegate, isLoading, error, txHash }), [removeDelegate, isLoading, error, txHash]);
601
601
  }
602
+ function useSetDepositRateManager({
603
+ client,
604
+ onSuccess,
605
+ onError
606
+ }) {
607
+ const [isLoading, setIsLoading] = react.useState(false);
608
+ const [error, setError] = react.useState(null);
609
+ const [txHash, setTxHash] = react.useState(null);
610
+ const [prepared, setPrepared] = react.useState(null);
611
+ const setDepositRateManager = react.useCallback(
612
+ async (params) => {
613
+ if (!client) {
614
+ const err = new Error("Zkp2pClient is not initialized");
615
+ setError(err);
616
+ onError?.(err);
617
+ return null;
618
+ }
619
+ setIsLoading(true);
620
+ setError(null);
621
+ setTxHash(null);
622
+ try {
623
+ const hash = await client.setDepositRateManager(params);
624
+ setTxHash(hash);
625
+ onSuccess?.(hash);
626
+ return hash;
627
+ } catch (err) {
628
+ const e = err instanceof Error ? err : new Error(String(err));
629
+ setError(e);
630
+ onError?.(e);
631
+ return null;
632
+ } finally {
633
+ setIsLoading(false);
634
+ }
635
+ },
636
+ [client, onError, onSuccess]
637
+ );
638
+ const prepareSetDepositRateManager = react.useCallback(
639
+ async (params) => {
640
+ if (!client) {
641
+ const err = new Error("Zkp2pClient is not initialized");
642
+ setError(err);
643
+ onError?.(err);
644
+ return null;
645
+ }
646
+ setIsLoading(true);
647
+ setError(null);
648
+ setPrepared(null);
649
+ try {
650
+ const tx = await client.setDepositRateManager.prepare(params);
651
+ setPrepared(tx);
652
+ return tx;
653
+ } catch (err) {
654
+ const e = err instanceof Error ? err : new Error(String(err));
655
+ setError(e);
656
+ onError?.(e);
657
+ return null;
658
+ } finally {
659
+ setIsLoading(false);
660
+ }
661
+ },
662
+ [client, onError]
663
+ );
664
+ return react.useMemo(
665
+ () => ({
666
+ setDepositRateManager,
667
+ prepareSetDepositRateManager,
668
+ isLoading,
669
+ error,
670
+ txHash,
671
+ prepared
672
+ }),
673
+ [setDepositRateManager, prepareSetDepositRateManager, isLoading, error, txHash, prepared]
674
+ );
675
+ }
676
+ function useClearDepositRateManager({
677
+ client,
678
+ onSuccess,
679
+ onError
680
+ }) {
681
+ const [isLoading, setIsLoading] = react.useState(false);
682
+ const [error, setError] = react.useState(null);
683
+ const [txHash, setTxHash] = react.useState(null);
684
+ const [prepared, setPrepared] = react.useState(null);
685
+ const clearDepositRateManager = react.useCallback(
686
+ async (params) => {
687
+ if (!client) {
688
+ const err = new Error("Zkp2pClient is not initialized");
689
+ setError(err);
690
+ onError?.(err);
691
+ return null;
692
+ }
693
+ setIsLoading(true);
694
+ setError(null);
695
+ setTxHash(null);
696
+ try {
697
+ const hash = await client.clearDepositRateManager(params);
698
+ setTxHash(hash);
699
+ onSuccess?.(hash);
700
+ return hash;
701
+ } catch (err) {
702
+ const e = err instanceof Error ? err : new Error(String(err));
703
+ setError(e);
704
+ onError?.(e);
705
+ return null;
706
+ } finally {
707
+ setIsLoading(false);
708
+ }
709
+ },
710
+ [client, onError, onSuccess]
711
+ );
712
+ const prepareClearDepositRateManager = react.useCallback(
713
+ async (params) => {
714
+ if (!client) {
715
+ const err = new Error("Zkp2pClient is not initialized");
716
+ setError(err);
717
+ onError?.(err);
718
+ return null;
719
+ }
720
+ setIsLoading(true);
721
+ setError(null);
722
+ setPrepared(null);
723
+ try {
724
+ const tx = await client.clearDepositRateManager.prepare(params);
725
+ setPrepared(tx);
726
+ return tx;
727
+ } catch (err) {
728
+ const e = err instanceof Error ? err : new Error(String(err));
729
+ setError(e);
730
+ onError?.(e);
731
+ return null;
732
+ } finally {
733
+ setIsLoading(false);
734
+ }
735
+ },
736
+ [client, onError]
737
+ );
738
+ return react.useMemo(
739
+ () => ({
740
+ clearDepositRateManager,
741
+ prepareClearDepositRateManager,
742
+ isLoading,
743
+ error,
744
+ txHash,
745
+ prepared
746
+ }),
747
+ [clearDepositRateManager, prepareClearDepositRateManager, isLoading, error, txHash, prepared]
748
+ );
749
+ }
750
+ function useCreateRateManager({ client, onSuccess, onError }) {
751
+ const [isLoading, setIsLoading] = react.useState(false);
752
+ const [error, setError] = react.useState(null);
753
+ const [txHash, setTxHash] = react.useState(null);
754
+ const [prepared, setPrepared] = react.useState(null);
755
+ const createRateManager = react.useCallback(
756
+ async (params) => {
757
+ if (!client) {
758
+ const err = new Error("Zkp2pClient is not initialized");
759
+ setError(err);
760
+ onError?.(err);
761
+ return null;
762
+ }
763
+ setIsLoading(true);
764
+ setError(null);
765
+ setTxHash(null);
766
+ try {
767
+ const hash = await client.createRateManager(params);
768
+ setTxHash(hash);
769
+ onSuccess?.(hash);
770
+ return hash;
771
+ } catch (err) {
772
+ const e = err instanceof Error ? err : new Error(String(err));
773
+ setError(e);
774
+ onError?.(e);
775
+ return null;
776
+ } finally {
777
+ setIsLoading(false);
778
+ }
779
+ },
780
+ [client, onError, onSuccess]
781
+ );
782
+ const prepareCreateRateManager = react.useCallback(
783
+ async (params) => {
784
+ if (!client) {
785
+ const err = new Error("Zkp2pClient is not initialized");
786
+ setError(err);
787
+ onError?.(err);
788
+ return null;
789
+ }
790
+ setIsLoading(true);
791
+ setError(null);
792
+ setPrepared(null);
793
+ try {
794
+ const tx = await client.createRateManager.prepare(params);
795
+ setPrepared(tx);
796
+ return tx;
797
+ } catch (err) {
798
+ const e = err instanceof Error ? err : new Error(String(err));
799
+ setError(e);
800
+ onError?.(e);
801
+ return null;
802
+ } finally {
803
+ setIsLoading(false);
804
+ }
805
+ },
806
+ [client, onError]
807
+ );
808
+ return react.useMemo(
809
+ () => ({
810
+ createRateManager,
811
+ prepareCreateRateManager,
812
+ isLoading,
813
+ error,
814
+ txHash,
815
+ prepared
816
+ }),
817
+ [createRateManager, prepareCreateRateManager, isLoading, error, txHash, prepared]
818
+ );
819
+ }
820
+ function useSetVaultFee({ client, onSuccess, onError }) {
821
+ const [isLoading, setIsLoading] = react.useState(false);
822
+ const [error, setError] = react.useState(null);
823
+ const [txHash, setTxHash] = react.useState(null);
824
+ const [prepared, setPrepared] = react.useState(null);
825
+ const setVaultFee = react.useCallback(
826
+ async (params) => {
827
+ if (!client) {
828
+ const err = new Error("Zkp2pClient is not initialized");
829
+ setError(err);
830
+ onError?.(err);
831
+ return null;
832
+ }
833
+ setIsLoading(true);
834
+ setError(null);
835
+ setTxHash(null);
836
+ try {
837
+ const hash = await client.setVaultFee(params);
838
+ setTxHash(hash);
839
+ onSuccess?.(hash);
840
+ return hash;
841
+ } catch (err) {
842
+ const e = err instanceof Error ? err : new Error(String(err));
843
+ setError(e);
844
+ onError?.(e);
845
+ return null;
846
+ } finally {
847
+ setIsLoading(false);
848
+ }
849
+ },
850
+ [client, onError, onSuccess]
851
+ );
852
+ const prepareSetVaultFee = react.useCallback(
853
+ async (params) => {
854
+ if (!client) {
855
+ const err = new Error("Zkp2pClient is not initialized");
856
+ setError(err);
857
+ onError?.(err);
858
+ return null;
859
+ }
860
+ setIsLoading(true);
861
+ setError(null);
862
+ setPrepared(null);
863
+ try {
864
+ const tx = await client.setVaultFee.prepare(params);
865
+ setPrepared(tx);
866
+ return tx;
867
+ } catch (err) {
868
+ const e = err instanceof Error ? err : new Error(String(err));
869
+ setError(e);
870
+ onError?.(e);
871
+ return null;
872
+ } finally {
873
+ setIsLoading(false);
874
+ }
875
+ },
876
+ [client, onError]
877
+ );
878
+ return react.useMemo(
879
+ () => ({
880
+ setVaultFee,
881
+ prepareSetVaultFee,
882
+ isLoading,
883
+ error,
884
+ txHash,
885
+ prepared
886
+ }),
887
+ [setVaultFee, prepareSetVaultFee, isLoading, error, txHash, prepared]
888
+ );
889
+ }
890
+ function useSetVaultMinRate({ client, onSuccess, onError }) {
891
+ const [isLoading, setIsLoading] = react.useState(false);
892
+ const [error, setError] = react.useState(null);
893
+ const [txHash, setTxHash] = react.useState(null);
894
+ const [prepared, setPrepared] = react.useState(null);
895
+ const setVaultMinRate = react.useCallback(
896
+ async (params) => {
897
+ if (!client) {
898
+ const err = new Error("Zkp2pClient is not initialized");
899
+ setError(err);
900
+ onError?.(err);
901
+ return null;
902
+ }
903
+ setIsLoading(true);
904
+ setError(null);
905
+ setTxHash(null);
906
+ try {
907
+ const hash = await client.setVaultMinRate(params);
908
+ setTxHash(hash);
909
+ onSuccess?.(hash);
910
+ return hash;
911
+ } catch (err) {
912
+ const e = err instanceof Error ? err : new Error(String(err));
913
+ setError(e);
914
+ onError?.(e);
915
+ return null;
916
+ } finally {
917
+ setIsLoading(false);
918
+ }
919
+ },
920
+ [client, onError, onSuccess]
921
+ );
922
+ const prepareSetVaultMinRate = react.useCallback(
923
+ async (params) => {
924
+ if (!client) {
925
+ const err = new Error("Zkp2pClient is not initialized");
926
+ setError(err);
927
+ onError?.(err);
928
+ return null;
929
+ }
930
+ setIsLoading(true);
931
+ setError(null);
932
+ setPrepared(null);
933
+ try {
934
+ const tx = await client.setVaultMinRate.prepare(params);
935
+ setPrepared(tx);
936
+ return tx;
937
+ } catch (err) {
938
+ const e = err instanceof Error ? err : new Error(String(err));
939
+ setError(e);
940
+ onError?.(e);
941
+ return null;
942
+ } finally {
943
+ setIsLoading(false);
944
+ }
945
+ },
946
+ [client, onError]
947
+ );
948
+ return react.useMemo(
949
+ () => ({
950
+ setVaultMinRate,
951
+ prepareSetVaultMinRate,
952
+ isLoading,
953
+ error,
954
+ txHash,
955
+ prepared
956
+ }),
957
+ [setVaultMinRate, prepareSetVaultMinRate, isLoading, error, txHash, prepared]
958
+ );
959
+ }
960
+ function useSetVaultConfig({ client, onSuccess, onError }) {
961
+ const [isLoading, setIsLoading] = react.useState(false);
962
+ const [error, setError] = react.useState(null);
963
+ const [txHash, setTxHash] = react.useState(null);
964
+ const [prepared, setPrepared] = react.useState(null);
965
+ const setVaultConfig = react.useCallback(
966
+ async (params) => {
967
+ if (!client) {
968
+ const err = new Error("Zkp2pClient is not initialized");
969
+ setError(err);
970
+ onError?.(err);
971
+ return null;
972
+ }
973
+ setIsLoading(true);
974
+ setError(null);
975
+ setTxHash(null);
976
+ try {
977
+ const hash = await client.setVaultConfig(params);
978
+ setTxHash(hash);
979
+ onSuccess?.(hash);
980
+ return hash;
981
+ } catch (err) {
982
+ const e = err instanceof Error ? err : new Error(String(err));
983
+ setError(e);
984
+ onError?.(e);
985
+ return null;
986
+ } finally {
987
+ setIsLoading(false);
988
+ }
989
+ },
990
+ [client, onError, onSuccess]
991
+ );
992
+ const prepareSetVaultConfig = react.useCallback(
993
+ async (params) => {
994
+ if (!client) {
995
+ const err = new Error("Zkp2pClient is not initialized");
996
+ setError(err);
997
+ onError?.(err);
998
+ return null;
999
+ }
1000
+ setIsLoading(true);
1001
+ setError(null);
1002
+ setPrepared(null);
1003
+ try {
1004
+ const tx = await client.setVaultConfig.prepare(params);
1005
+ setPrepared(tx);
1006
+ return tx;
1007
+ } catch (err) {
1008
+ const e = err instanceof Error ? err : new Error(String(err));
1009
+ setError(e);
1010
+ onError?.(e);
1011
+ return null;
1012
+ } finally {
1013
+ setIsLoading(false);
1014
+ }
1015
+ },
1016
+ [client, onError]
1017
+ );
1018
+ return react.useMemo(
1019
+ () => ({
1020
+ setVaultConfig,
1021
+ prepareSetVaultConfig,
1022
+ isLoading,
1023
+ error,
1024
+ txHash,
1025
+ prepared
1026
+ }),
1027
+ [setVaultConfig, prepareSetVaultConfig, isLoading, error, txHash, prepared]
1028
+ );
1029
+ }
602
1030
  function useAddPaymentMethods({ client, onSuccess, onError }) {
603
1031
  const [isLoading, setIsLoading] = react.useState(false);
604
1032
  const [error, setError] = react.useState(null);
@@ -836,7 +1264,9 @@ exports.getTierDisplayInfo = getTierDisplayInfo;
836
1264
  exports.useAddCurrencies = useAddCurrencies;
837
1265
  exports.useAddFunds = useAddFunds;
838
1266
  exports.useAddPaymentMethods = useAddPaymentMethods;
1267
+ exports.useClearDepositRateManager = useClearDepositRateManager;
839
1268
  exports.useCreateDeposit = useCreateDeposit;
1269
+ exports.useCreateRateManager = useCreateRateManager;
840
1270
  exports.useDeactivateCurrency = useDeactivateCurrency;
841
1271
  exports.useFulfillIntent = useFulfillIntent;
842
1272
  exports.useGetTakerTier = useGetTakerTier;
@@ -849,9 +1279,13 @@ exports.useRemovePaymentMethod = useRemovePaymentMethod;
849
1279
  exports.useSetAcceptingIntents = useSetAcceptingIntents;
850
1280
  exports.useSetCurrencyMinRate = useSetCurrencyMinRate;
851
1281
  exports.useSetDelegate = useSetDelegate;
1282
+ exports.useSetDepositRateManager = useSetDepositRateManager;
852
1283
  exports.useSetIntentRange = useSetIntentRange;
853
1284
  exports.useSetPaymentMethodActive = useSetPaymentMethodActive;
854
1285
  exports.useSetRetainOnEmpty = useSetRetainOnEmpty;
1286
+ exports.useSetVaultConfig = useSetVaultConfig;
1287
+ exports.useSetVaultFee = useSetVaultFee;
1288
+ exports.useSetVaultMinRate = useSetVaultMinRate;
855
1289
  exports.useSignalIntent = useSignalIntent;
856
1290
  exports.useWithdrawDeposit = useWithdrawDeposit;
857
1291
  //# sourceMappingURL=react.cjs.map