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