@chipi-stack/chipi-react 13.1.0 → 13.3.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.
package/dist/hooks.js CHANGED
@@ -806,90 +806,6 @@ function useGetSku(input) {
806
806
  fetchSku
807
807
  };
808
808
  }
809
- function useStakeVesuUsdc() {
810
- const { chipiSDK } = useChipiContext();
811
- const mutation = reactQuery.useMutation({
812
- mutationFn: async (params) => {
813
- let encryptKey = params.params.encryptKey;
814
- if (params.params.usePasskey) {
815
- try {
816
- const key = await chipiPasskey.getWalletEncryptKey();
817
- if (!key) {
818
- throw new Error("Passkey authentication was cancelled");
819
- }
820
- encryptKey = key;
821
- } catch (error) {
822
- if (error instanceof Error) {
823
- throw new Error(
824
- `Passkey authentication failed: ${error.message}`
825
- );
826
- }
827
- throw new Error("Failed to authenticate with passkey");
828
- }
829
- }
830
- return chipiSDK.stakeVesuUsdc({
831
- params: {
832
- ...params.params,
833
- amount: String(params.params.amount),
834
- encryptKey
835
- },
836
- bearerToken: params.bearerToken
837
- });
838
- }
839
- });
840
- return {
841
- stakeVesuUsdc: mutation.mutate,
842
- stakeVesuUsdcAsync: mutation.mutateAsync,
843
- data: mutation.data,
844
- isLoading: mutation.isPending,
845
- isError: mutation.isError,
846
- error: mutation.error,
847
- isSuccess: mutation.isSuccess,
848
- reset: mutation.reset
849
- };
850
- }
851
- function useWithdrawVesuUsdc() {
852
- const { chipiSDK } = useChipiContext();
853
- const mutation = reactQuery.useMutation({
854
- mutationFn: async (params) => {
855
- let encryptKey = params.params.encryptKey;
856
- if (params.params.usePasskey) {
857
- try {
858
- const key = await chipiPasskey.getWalletEncryptKey();
859
- if (!key) {
860
- throw new Error("Passkey authentication was cancelled");
861
- }
862
- encryptKey = key;
863
- } catch (error) {
864
- if (error instanceof Error) {
865
- throw new Error(
866
- `Passkey authentication failed: ${error.message}`
867
- );
868
- }
869
- throw new Error("Failed to authenticate with passkey");
870
- }
871
- }
872
- return chipiSDK.withdrawVesuUsdc({
873
- params: {
874
- ...params.params,
875
- amount: String(params.params.amount),
876
- encryptKey
877
- },
878
- bearerToken: params.bearerToken
879
- });
880
- }
881
- });
882
- return {
883
- withdrawVesuUsdc: mutation.mutate,
884
- withdrawVesuUsdcAsync: mutation.mutateAsync,
885
- data: mutation.data,
886
- isLoading: mutation.isPending,
887
- isError: mutation.isError,
888
- error: mutation.error,
889
- isSuccess: mutation.isSuccess,
890
- reset: mutation.reset
891
- };
892
- }
893
809
  function useCallAnyContract() {
894
810
  const { chipiSDK } = useChipiContext();
895
811
  const mutation = reactQuery.useMutation({
@@ -999,90 +915,6 @@ function useGetTokenBalance(input) {
999
915
  fetchTokenBalance
1000
916
  };
1001
917
  }
1002
- function useGetUser(input) {
1003
- const { chipiSDK } = useChipiContext();
1004
- const queryClient = reactQuery.useQueryClient();
1005
- const query = reactQuery.useQuery({
1006
- queryKey: [
1007
- "user",
1008
- input?.params?.id,
1009
- input?.params?.externalId,
1010
- input?.params?.username,
1011
- input?.params?.phone?.phoneCountryCode,
1012
- input?.params?.phone?.phoneNumber,
1013
- input?.params?.taxId,
1014
- input?.params?.includeStarknetWallet
1015
- ],
1016
- queryFn: async () => {
1017
- if (!input?.params || !input?.getBearerToken)
1018
- throw new Error("externalId and getBearerToken are required");
1019
- const bearerToken = await input.getBearerToken();
1020
- if (!bearerToken) throw new Error("Bearer token is required");
1021
- return chipiSDK.getUser(input.params, bearerToken);
1022
- },
1023
- enabled: Boolean(
1024
- input?.params && input?.getBearerToken && // Use truthy check instead of !== "" to handle undefined properly
1025
- (input.params.externalId?.trim() || input.params.username?.trim() || input.params.phone?.phoneCountryCode !== void 0 && input.params.phone?.phoneNumber !== void 0 || input.params.taxId?.trim())
1026
- ),
1027
- retry: (failureCount, error) => {
1028
- if (error instanceof shared.ChipiApiError || error?.status) {
1029
- return false;
1030
- }
1031
- return failureCount < 3;
1032
- },
1033
- ...input?.queryOptions
1034
- });
1035
- const fetchUser = async (input2) => {
1036
- return queryClient.fetchQuery({
1037
- queryKey: [
1038
- "user",
1039
- input2?.params?.externalId,
1040
- input2?.params?.id,
1041
- input2?.params?.username,
1042
- input2?.params?.phone?.phoneCountryCode,
1043
- input2?.params?.phone?.phoneNumber,
1044
- input2?.params?.taxId,
1045
- input2?.params?.includeStarknetWallet
1046
- ],
1047
- queryFn: async () => {
1048
- if (!input2?.getBearerToken)
1049
- throw new Error("getBearerToken is required");
1050
- const bearerToken = await input2.getBearerToken();
1051
- if (!bearerToken) throw new Error("Bearer token is required");
1052
- if (!input2?.params) throw new Error("params are required");
1053
- return chipiSDK.getUser(input2.params, bearerToken);
1054
- },
1055
- retry: (failureCount, error) => {
1056
- if (error instanceof shared.ChipiApiError || error?.code) {
1057
- return false;
1058
- }
1059
- return failureCount < 3;
1060
- }
1061
- });
1062
- };
1063
- return {
1064
- ...query,
1065
- fetchUser
1066
- };
1067
- }
1068
- function useCreateUser() {
1069
- const { chipiSDK } = useChipiContext();
1070
- const mutation = reactQuery.useMutation(
1071
- {
1072
- mutationFn: (input) => chipiSDK.createUser(input.params, input.bearerToken)
1073
- }
1074
- );
1075
- return {
1076
- createUser: mutation.mutate,
1077
- createUserAsync: mutation.mutateAsync,
1078
- data: mutation.data,
1079
- isLoading: mutation.isPending,
1080
- isError: mutation.isError,
1081
- error: mutation.error,
1082
- isSuccess: mutation.isSuccess,
1083
- reset: mutation.reset
1084
- };
1085
- }
1086
918
  function useCreateSessionKey() {
1087
919
  const { chipiSDK } = useChipiContext();
1088
920
  const mutation = reactQuery.useMutation({
@@ -1185,7 +1017,6 @@ exports.useCallAnyContract = useCallAnyContract;
1185
1017
  exports.useChipiSession = useChipiSession;
1186
1018
  exports.useChipiWallet = useChipiWallet;
1187
1019
  exports.useCreateSessionKey = useCreateSessionKey;
1188
- exports.useCreateUser = useCreateUser;
1189
1020
  exports.useCreateWallet = useCreateWallet;
1190
1021
  exports.useExecuteWithSession = useExecuteWithSession;
1191
1022
  exports.useGetSessionData = useGetSessionData;
@@ -1194,14 +1025,11 @@ exports.useGetSkuList = useGetSkuList;
1194
1025
  exports.useGetSkuPurchase = useGetSkuPurchase;
1195
1026
  exports.useGetTokenBalance = useGetTokenBalance;
1196
1027
  exports.useGetTransactionList = useGetTransactionList;
1197
- exports.useGetUser = useGetUser;
1198
1028
  exports.useGetWallet = useGetWallet;
1199
1029
  exports.useMigrateWalletToPasskey = useMigrateWalletToPasskey;
1200
1030
  exports.usePurchaseSku = usePurchaseSku;
1201
1031
  exports.useRecordSendTransaction = useRecordSendTransaction;
1202
1032
  exports.useRevokeSessionKey = useRevokeSessionKey;
1203
- exports.useStakeVesuUsdc = useStakeVesuUsdc;
1204
1033
  exports.useTransfer = useTransfer;
1205
- exports.useWithdrawVesuUsdc = useWithdrawVesuUsdc;
1206
1034
  //# sourceMappingURL=hooks.js.map
1207
1035
  //# sourceMappingURL=hooks.js.map