@chipi-stack/chipi-react 13.2.0 → 13.4.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/index.js
CHANGED
|
@@ -841,90 +841,6 @@ function useGetSku(input) {
|
|
|
841
841
|
fetchSku
|
|
842
842
|
};
|
|
843
843
|
}
|
|
844
|
-
function useStakeVesuUsdc() {
|
|
845
|
-
const { chipiSDK } = useChipiContext();
|
|
846
|
-
const mutation = reactQuery.useMutation({
|
|
847
|
-
mutationFn: async (params) => {
|
|
848
|
-
let encryptKey = params.params.encryptKey;
|
|
849
|
-
if (params.params.usePasskey) {
|
|
850
|
-
try {
|
|
851
|
-
const key = await chipiPasskey.getWalletEncryptKey();
|
|
852
|
-
if (!key) {
|
|
853
|
-
throw new Error("Passkey authentication was cancelled");
|
|
854
|
-
}
|
|
855
|
-
encryptKey = key;
|
|
856
|
-
} catch (error) {
|
|
857
|
-
if (error instanceof Error) {
|
|
858
|
-
throw new Error(
|
|
859
|
-
`Passkey authentication failed: ${error.message}`
|
|
860
|
-
);
|
|
861
|
-
}
|
|
862
|
-
throw new Error("Failed to authenticate with passkey");
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
return chipiSDK.stakeVesuUsdc({
|
|
866
|
-
params: {
|
|
867
|
-
...params.params,
|
|
868
|
-
amount: String(params.params.amount),
|
|
869
|
-
encryptKey
|
|
870
|
-
},
|
|
871
|
-
bearerToken: params.bearerToken
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
return {
|
|
876
|
-
stakeVesuUsdc: mutation.mutate,
|
|
877
|
-
stakeVesuUsdcAsync: mutation.mutateAsync,
|
|
878
|
-
data: mutation.data,
|
|
879
|
-
isLoading: mutation.isPending,
|
|
880
|
-
isError: mutation.isError,
|
|
881
|
-
error: mutation.error,
|
|
882
|
-
isSuccess: mutation.isSuccess,
|
|
883
|
-
reset: mutation.reset
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
function useWithdrawVesuUsdc() {
|
|
887
|
-
const { chipiSDK } = useChipiContext();
|
|
888
|
-
const mutation = reactQuery.useMutation({
|
|
889
|
-
mutationFn: async (params) => {
|
|
890
|
-
let encryptKey = params.params.encryptKey;
|
|
891
|
-
if (params.params.usePasskey) {
|
|
892
|
-
try {
|
|
893
|
-
const key = await chipiPasskey.getWalletEncryptKey();
|
|
894
|
-
if (!key) {
|
|
895
|
-
throw new Error("Passkey authentication was cancelled");
|
|
896
|
-
}
|
|
897
|
-
encryptKey = key;
|
|
898
|
-
} catch (error) {
|
|
899
|
-
if (error instanceof Error) {
|
|
900
|
-
throw new Error(
|
|
901
|
-
`Passkey authentication failed: ${error.message}`
|
|
902
|
-
);
|
|
903
|
-
}
|
|
904
|
-
throw new Error("Failed to authenticate with passkey");
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
return chipiSDK.withdrawVesuUsdc({
|
|
908
|
-
params: {
|
|
909
|
-
...params.params,
|
|
910
|
-
amount: String(params.params.amount),
|
|
911
|
-
encryptKey
|
|
912
|
-
},
|
|
913
|
-
bearerToken: params.bearerToken
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
});
|
|
917
|
-
return {
|
|
918
|
-
withdrawVesuUsdc: mutation.mutate,
|
|
919
|
-
withdrawVesuUsdcAsync: mutation.mutateAsync,
|
|
920
|
-
data: mutation.data,
|
|
921
|
-
isLoading: mutation.isPending,
|
|
922
|
-
isError: mutation.isError,
|
|
923
|
-
error: mutation.error,
|
|
924
|
-
isSuccess: mutation.isSuccess,
|
|
925
|
-
reset: mutation.reset
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
844
|
function useCallAnyContract() {
|
|
929
845
|
const { chipiSDK } = useChipiContext();
|
|
930
846
|
const mutation = reactQuery.useMutation({
|
|
@@ -1034,90 +950,6 @@ function useGetTokenBalance(input) {
|
|
|
1034
950
|
fetchTokenBalance
|
|
1035
951
|
};
|
|
1036
952
|
}
|
|
1037
|
-
function useGetUser(input) {
|
|
1038
|
-
const { chipiSDK } = useChipiContext();
|
|
1039
|
-
const queryClient = reactQuery.useQueryClient();
|
|
1040
|
-
const query = reactQuery.useQuery({
|
|
1041
|
-
queryKey: [
|
|
1042
|
-
"user",
|
|
1043
|
-
input?.params?.id,
|
|
1044
|
-
input?.params?.externalId,
|
|
1045
|
-
input?.params?.username,
|
|
1046
|
-
input?.params?.phone?.phoneCountryCode,
|
|
1047
|
-
input?.params?.phone?.phoneNumber,
|
|
1048
|
-
input?.params?.taxId,
|
|
1049
|
-
input?.params?.includeStarknetWallet
|
|
1050
|
-
],
|
|
1051
|
-
queryFn: async () => {
|
|
1052
|
-
if (!input?.params || !input?.getBearerToken)
|
|
1053
|
-
throw new Error("externalId and getBearerToken are required");
|
|
1054
|
-
const bearerToken = await input.getBearerToken();
|
|
1055
|
-
if (!bearerToken) throw new Error("Bearer token is required");
|
|
1056
|
-
return chipiSDK.getUser(input.params, bearerToken);
|
|
1057
|
-
},
|
|
1058
|
-
enabled: Boolean(
|
|
1059
|
-
input?.params && input?.getBearerToken && // Use truthy check instead of !== "" to handle undefined properly
|
|
1060
|
-
(input.params.externalId?.trim() || input.params.username?.trim() || input.params.phone?.phoneCountryCode !== void 0 && input.params.phone?.phoneNumber !== void 0 || input.params.taxId?.trim())
|
|
1061
|
-
),
|
|
1062
|
-
retry: (failureCount, error) => {
|
|
1063
|
-
if (error instanceof shared.ChipiApiError || error?.status) {
|
|
1064
|
-
return false;
|
|
1065
|
-
}
|
|
1066
|
-
return failureCount < 3;
|
|
1067
|
-
},
|
|
1068
|
-
...input?.queryOptions
|
|
1069
|
-
});
|
|
1070
|
-
const fetchUser = async (input2) => {
|
|
1071
|
-
return queryClient.fetchQuery({
|
|
1072
|
-
queryKey: [
|
|
1073
|
-
"user",
|
|
1074
|
-
input2?.params?.externalId,
|
|
1075
|
-
input2?.params?.id,
|
|
1076
|
-
input2?.params?.username,
|
|
1077
|
-
input2?.params?.phone?.phoneCountryCode,
|
|
1078
|
-
input2?.params?.phone?.phoneNumber,
|
|
1079
|
-
input2?.params?.taxId,
|
|
1080
|
-
input2?.params?.includeStarknetWallet
|
|
1081
|
-
],
|
|
1082
|
-
queryFn: async () => {
|
|
1083
|
-
if (!input2?.getBearerToken)
|
|
1084
|
-
throw new Error("getBearerToken is required");
|
|
1085
|
-
const bearerToken = await input2.getBearerToken();
|
|
1086
|
-
if (!bearerToken) throw new Error("Bearer token is required");
|
|
1087
|
-
if (!input2?.params) throw new Error("params are required");
|
|
1088
|
-
return chipiSDK.getUser(input2.params, bearerToken);
|
|
1089
|
-
},
|
|
1090
|
-
retry: (failureCount, error) => {
|
|
1091
|
-
if (error instanceof shared.ChipiApiError || error?.code) {
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
return failureCount < 3;
|
|
1095
|
-
}
|
|
1096
|
-
});
|
|
1097
|
-
};
|
|
1098
|
-
return {
|
|
1099
|
-
...query,
|
|
1100
|
-
fetchUser
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
function useCreateUser() {
|
|
1104
|
-
const { chipiSDK } = useChipiContext();
|
|
1105
|
-
const mutation = reactQuery.useMutation(
|
|
1106
|
-
{
|
|
1107
|
-
mutationFn: (input) => chipiSDK.createUser(input.params, input.bearerToken)
|
|
1108
|
-
}
|
|
1109
|
-
);
|
|
1110
|
-
return {
|
|
1111
|
-
createUser: mutation.mutate,
|
|
1112
|
-
createUserAsync: mutation.mutateAsync,
|
|
1113
|
-
data: mutation.data,
|
|
1114
|
-
isLoading: mutation.isPending,
|
|
1115
|
-
isError: mutation.isError,
|
|
1116
|
-
error: mutation.error,
|
|
1117
|
-
isSuccess: mutation.isSuccess,
|
|
1118
|
-
reset: mutation.reset
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
953
|
function useCreateSessionKey() {
|
|
1122
954
|
const { chipiSDK } = useChipiContext();
|
|
1123
955
|
const mutation = reactQuery.useMutation({
|
|
@@ -1222,7 +1054,6 @@ exports.useChipiContext = useChipiContext;
|
|
|
1222
1054
|
exports.useChipiSession = useChipiSession;
|
|
1223
1055
|
exports.useChipiWallet = useChipiWallet;
|
|
1224
1056
|
exports.useCreateSessionKey = useCreateSessionKey;
|
|
1225
|
-
exports.useCreateUser = useCreateUser;
|
|
1226
1057
|
exports.useCreateWallet = useCreateWallet;
|
|
1227
1058
|
exports.useExecuteWithSession = useExecuteWithSession;
|
|
1228
1059
|
exports.useGetSessionData = useGetSessionData;
|
|
@@ -1231,14 +1062,11 @@ exports.useGetSkuList = useGetSkuList;
|
|
|
1231
1062
|
exports.useGetSkuPurchase = useGetSkuPurchase;
|
|
1232
1063
|
exports.useGetTokenBalance = useGetTokenBalance;
|
|
1233
1064
|
exports.useGetTransactionList = useGetTransactionList;
|
|
1234
|
-
exports.useGetUser = useGetUser;
|
|
1235
1065
|
exports.useGetWallet = useGetWallet;
|
|
1236
1066
|
exports.useMigrateWalletToPasskey = useMigrateWalletToPasskey;
|
|
1237
1067
|
exports.usePurchaseSku = usePurchaseSku;
|
|
1238
1068
|
exports.useRecordSendTransaction = useRecordSendTransaction;
|
|
1239
1069
|
exports.useRevokeSessionKey = useRevokeSessionKey;
|
|
1240
|
-
exports.useStakeVesuUsdc = useStakeVesuUsdc;
|
|
1241
1070
|
exports.useTransfer = useTransfer;
|
|
1242
|
-
exports.useWithdrawVesuUsdc = useWithdrawVesuUsdc;
|
|
1243
1071
|
//# sourceMappingURL=index.js.map
|
|
1244
1072
|
//# sourceMappingURL=index.js.map
|