@chipi-stack/chipi-react 11.11.0 → 11.13.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 +195 -2
- package/dist/hooks.d.ts +195 -2
- package/dist/hooks.js +68 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +67 -2
- 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 +68 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/hooks.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, TransferHookInput, ApproveHookInput, CreateSkuTransactionParams, SkuTransaction, GetSkuListQuery, PaginatedResponse, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, Transaction, GetTokenBalanceParams, GetTokenBalanceResponse } from '@chipi-stack/types';
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, TransferHookInput, ApproveHookInput, CreateSkuTransactionParams, SkuTransaction, GetSkuListQuery, PaginatedResponse, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, Transaction, GetTokenBalanceParams, GetTokenBalanceResponse, User, CreateUserParams } from '@chipi-stack/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -1062,4 +1062,197 @@ declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
|
|
|
1062
1062
|
promise: Promise<GetTokenBalanceResponse>;
|
|
1063
1063
|
};
|
|
1064
1064
|
|
|
1065
|
-
|
|
1065
|
+
type GetUserInput = {
|
|
1066
|
+
externalId: string;
|
|
1067
|
+
getBearerToken?: () => Promise<string | null | undefined>;
|
|
1068
|
+
queryOptions?: Omit<UseQueryOptions<User, Error>, "queryKey" | "queryFn">;
|
|
1069
|
+
};
|
|
1070
|
+
declare function useGetUser(input?: GetUserInput): {
|
|
1071
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1072
|
+
data: User;
|
|
1073
|
+
error: Error;
|
|
1074
|
+
isError: true;
|
|
1075
|
+
isPending: false;
|
|
1076
|
+
isLoading: false;
|
|
1077
|
+
isLoadingError: false;
|
|
1078
|
+
isRefetchError: true;
|
|
1079
|
+
isSuccess: false;
|
|
1080
|
+
isPlaceholderData: false;
|
|
1081
|
+
status: "error";
|
|
1082
|
+
dataUpdatedAt: number;
|
|
1083
|
+
errorUpdatedAt: number;
|
|
1084
|
+
failureCount: number;
|
|
1085
|
+
failureReason: Error | null;
|
|
1086
|
+
errorUpdateCount: number;
|
|
1087
|
+
isFetched: boolean;
|
|
1088
|
+
isFetchedAfterMount: boolean;
|
|
1089
|
+
isFetching: boolean;
|
|
1090
|
+
isInitialLoading: boolean;
|
|
1091
|
+
isPaused: boolean;
|
|
1092
|
+
isRefetching: boolean;
|
|
1093
|
+
isStale: boolean;
|
|
1094
|
+
isEnabled: boolean;
|
|
1095
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1096
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1097
|
+
promise: Promise<User>;
|
|
1098
|
+
} | {
|
|
1099
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1100
|
+
data: User;
|
|
1101
|
+
error: null;
|
|
1102
|
+
isError: false;
|
|
1103
|
+
isPending: false;
|
|
1104
|
+
isLoading: false;
|
|
1105
|
+
isLoadingError: false;
|
|
1106
|
+
isRefetchError: false;
|
|
1107
|
+
isSuccess: true;
|
|
1108
|
+
isPlaceholderData: false;
|
|
1109
|
+
status: "success";
|
|
1110
|
+
dataUpdatedAt: number;
|
|
1111
|
+
errorUpdatedAt: number;
|
|
1112
|
+
failureCount: number;
|
|
1113
|
+
failureReason: Error | null;
|
|
1114
|
+
errorUpdateCount: number;
|
|
1115
|
+
isFetched: boolean;
|
|
1116
|
+
isFetchedAfterMount: boolean;
|
|
1117
|
+
isFetching: boolean;
|
|
1118
|
+
isInitialLoading: boolean;
|
|
1119
|
+
isPaused: boolean;
|
|
1120
|
+
isRefetching: boolean;
|
|
1121
|
+
isStale: boolean;
|
|
1122
|
+
isEnabled: boolean;
|
|
1123
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1124
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1125
|
+
promise: Promise<User>;
|
|
1126
|
+
} | {
|
|
1127
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1128
|
+
data: undefined;
|
|
1129
|
+
error: Error;
|
|
1130
|
+
isError: true;
|
|
1131
|
+
isPending: false;
|
|
1132
|
+
isLoading: false;
|
|
1133
|
+
isLoadingError: true;
|
|
1134
|
+
isRefetchError: false;
|
|
1135
|
+
isSuccess: false;
|
|
1136
|
+
isPlaceholderData: false;
|
|
1137
|
+
status: "error";
|
|
1138
|
+
dataUpdatedAt: number;
|
|
1139
|
+
errorUpdatedAt: number;
|
|
1140
|
+
failureCount: number;
|
|
1141
|
+
failureReason: Error | null;
|
|
1142
|
+
errorUpdateCount: number;
|
|
1143
|
+
isFetched: boolean;
|
|
1144
|
+
isFetchedAfterMount: boolean;
|
|
1145
|
+
isFetching: boolean;
|
|
1146
|
+
isInitialLoading: boolean;
|
|
1147
|
+
isPaused: boolean;
|
|
1148
|
+
isRefetching: boolean;
|
|
1149
|
+
isStale: boolean;
|
|
1150
|
+
isEnabled: boolean;
|
|
1151
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1152
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1153
|
+
promise: Promise<User>;
|
|
1154
|
+
} | {
|
|
1155
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1156
|
+
data: undefined;
|
|
1157
|
+
error: null;
|
|
1158
|
+
isError: false;
|
|
1159
|
+
isPending: true;
|
|
1160
|
+
isLoading: true;
|
|
1161
|
+
isLoadingError: false;
|
|
1162
|
+
isRefetchError: false;
|
|
1163
|
+
isSuccess: false;
|
|
1164
|
+
isPlaceholderData: false;
|
|
1165
|
+
status: "pending";
|
|
1166
|
+
dataUpdatedAt: number;
|
|
1167
|
+
errorUpdatedAt: number;
|
|
1168
|
+
failureCount: number;
|
|
1169
|
+
failureReason: Error | null;
|
|
1170
|
+
errorUpdateCount: number;
|
|
1171
|
+
isFetched: boolean;
|
|
1172
|
+
isFetchedAfterMount: boolean;
|
|
1173
|
+
isFetching: boolean;
|
|
1174
|
+
isInitialLoading: boolean;
|
|
1175
|
+
isPaused: boolean;
|
|
1176
|
+
isRefetching: boolean;
|
|
1177
|
+
isStale: boolean;
|
|
1178
|
+
isEnabled: boolean;
|
|
1179
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1180
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1181
|
+
promise: Promise<User>;
|
|
1182
|
+
} | {
|
|
1183
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1184
|
+
data: undefined;
|
|
1185
|
+
error: null;
|
|
1186
|
+
isError: false;
|
|
1187
|
+
isPending: true;
|
|
1188
|
+
isLoadingError: false;
|
|
1189
|
+
isRefetchError: false;
|
|
1190
|
+
isSuccess: false;
|
|
1191
|
+
isPlaceholderData: false;
|
|
1192
|
+
status: "pending";
|
|
1193
|
+
dataUpdatedAt: number;
|
|
1194
|
+
errorUpdatedAt: number;
|
|
1195
|
+
failureCount: number;
|
|
1196
|
+
failureReason: Error | null;
|
|
1197
|
+
errorUpdateCount: number;
|
|
1198
|
+
isFetched: boolean;
|
|
1199
|
+
isFetchedAfterMount: boolean;
|
|
1200
|
+
isFetching: boolean;
|
|
1201
|
+
isLoading: boolean;
|
|
1202
|
+
isInitialLoading: boolean;
|
|
1203
|
+
isPaused: boolean;
|
|
1204
|
+
isRefetching: boolean;
|
|
1205
|
+
isStale: boolean;
|
|
1206
|
+
isEnabled: boolean;
|
|
1207
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1208
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1209
|
+
promise: Promise<User>;
|
|
1210
|
+
} | {
|
|
1211
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1212
|
+
data: User;
|
|
1213
|
+
isError: false;
|
|
1214
|
+
error: null;
|
|
1215
|
+
isPending: false;
|
|
1216
|
+
isLoading: false;
|
|
1217
|
+
isLoadingError: false;
|
|
1218
|
+
isRefetchError: false;
|
|
1219
|
+
isSuccess: true;
|
|
1220
|
+
isPlaceholderData: true;
|
|
1221
|
+
status: "success";
|
|
1222
|
+
dataUpdatedAt: number;
|
|
1223
|
+
errorUpdatedAt: number;
|
|
1224
|
+
failureCount: number;
|
|
1225
|
+
failureReason: Error | null;
|
|
1226
|
+
errorUpdateCount: number;
|
|
1227
|
+
isFetched: boolean;
|
|
1228
|
+
isFetchedAfterMount: boolean;
|
|
1229
|
+
isFetching: boolean;
|
|
1230
|
+
isInitialLoading: boolean;
|
|
1231
|
+
isPaused: boolean;
|
|
1232
|
+
isRefetching: boolean;
|
|
1233
|
+
isStale: boolean;
|
|
1234
|
+
isEnabled: boolean;
|
|
1235
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1236
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1237
|
+
promise: Promise<User>;
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
type CreateUserInput = {
|
|
1241
|
+
params: CreateUserParams;
|
|
1242
|
+
bearerToken: string;
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* Hook for creating a new user
|
|
1246
|
+
*/
|
|
1247
|
+
declare function useCreateUser(): {
|
|
1248
|
+
createUser: (input: CreateUserInput) => void;
|
|
1249
|
+
createUserAsync: (input: CreateUserInput) => Promise<User>;
|
|
1250
|
+
data: User | undefined;
|
|
1251
|
+
isLoading: boolean;
|
|
1252
|
+
isError: boolean;
|
|
1253
|
+
error: Error | null;
|
|
1254
|
+
isSuccess: boolean;
|
|
1255
|
+
reset: () => void;
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
export { useApprove, useCallAnyContract, useCreateSkuTransaction, useCreateUser, useCreateWallet, useGetSku, useGetSkuList, useGetSkuTransaction, useGetTokenBalance, useGetUser, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, TransferHookInput, ApproveHookInput, CreateSkuTransactionParams, SkuTransaction, GetSkuListQuery, PaginatedResponse, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, Transaction, GetTokenBalanceParams, GetTokenBalanceResponse } from '@chipi-stack/types';
|
|
1
|
+
import { CreateWalletParams, CreateWalletResponse, GetWalletParams, GetWalletResponse, TransferHookInput, ApproveHookInput, CreateSkuTransactionParams, SkuTransaction, GetSkuListQuery, PaginatedResponse, Sku, StakeVesuUsdcHookInputParams, WithdrawVesuUsdcHookInputParams, CallAnyContractParams, RecordSendTransactionParams, Transaction, GetTokenBalanceParams, GetTokenBalanceResponse, User, CreateUserParams } from '@chipi-stack/types';
|
|
2
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
3
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
@@ -1062,4 +1062,197 @@ declare function useGetTokenBalance(input?: GetTokenBalanceInput): {
|
|
|
1062
1062
|
promise: Promise<GetTokenBalanceResponse>;
|
|
1063
1063
|
};
|
|
1064
1064
|
|
|
1065
|
-
|
|
1065
|
+
type GetUserInput = {
|
|
1066
|
+
externalId: string;
|
|
1067
|
+
getBearerToken?: () => Promise<string | null | undefined>;
|
|
1068
|
+
queryOptions?: Omit<UseQueryOptions<User, Error>, "queryKey" | "queryFn">;
|
|
1069
|
+
};
|
|
1070
|
+
declare function useGetUser(input?: GetUserInput): {
|
|
1071
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1072
|
+
data: User;
|
|
1073
|
+
error: Error;
|
|
1074
|
+
isError: true;
|
|
1075
|
+
isPending: false;
|
|
1076
|
+
isLoading: false;
|
|
1077
|
+
isLoadingError: false;
|
|
1078
|
+
isRefetchError: true;
|
|
1079
|
+
isSuccess: false;
|
|
1080
|
+
isPlaceholderData: false;
|
|
1081
|
+
status: "error";
|
|
1082
|
+
dataUpdatedAt: number;
|
|
1083
|
+
errorUpdatedAt: number;
|
|
1084
|
+
failureCount: number;
|
|
1085
|
+
failureReason: Error | null;
|
|
1086
|
+
errorUpdateCount: number;
|
|
1087
|
+
isFetched: boolean;
|
|
1088
|
+
isFetchedAfterMount: boolean;
|
|
1089
|
+
isFetching: boolean;
|
|
1090
|
+
isInitialLoading: boolean;
|
|
1091
|
+
isPaused: boolean;
|
|
1092
|
+
isRefetching: boolean;
|
|
1093
|
+
isStale: boolean;
|
|
1094
|
+
isEnabled: boolean;
|
|
1095
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1096
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1097
|
+
promise: Promise<User>;
|
|
1098
|
+
} | {
|
|
1099
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1100
|
+
data: User;
|
|
1101
|
+
error: null;
|
|
1102
|
+
isError: false;
|
|
1103
|
+
isPending: false;
|
|
1104
|
+
isLoading: false;
|
|
1105
|
+
isLoadingError: false;
|
|
1106
|
+
isRefetchError: false;
|
|
1107
|
+
isSuccess: true;
|
|
1108
|
+
isPlaceholderData: false;
|
|
1109
|
+
status: "success";
|
|
1110
|
+
dataUpdatedAt: number;
|
|
1111
|
+
errorUpdatedAt: number;
|
|
1112
|
+
failureCount: number;
|
|
1113
|
+
failureReason: Error | null;
|
|
1114
|
+
errorUpdateCount: number;
|
|
1115
|
+
isFetched: boolean;
|
|
1116
|
+
isFetchedAfterMount: boolean;
|
|
1117
|
+
isFetching: boolean;
|
|
1118
|
+
isInitialLoading: boolean;
|
|
1119
|
+
isPaused: boolean;
|
|
1120
|
+
isRefetching: boolean;
|
|
1121
|
+
isStale: boolean;
|
|
1122
|
+
isEnabled: boolean;
|
|
1123
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1124
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1125
|
+
promise: Promise<User>;
|
|
1126
|
+
} | {
|
|
1127
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1128
|
+
data: undefined;
|
|
1129
|
+
error: Error;
|
|
1130
|
+
isError: true;
|
|
1131
|
+
isPending: false;
|
|
1132
|
+
isLoading: false;
|
|
1133
|
+
isLoadingError: true;
|
|
1134
|
+
isRefetchError: false;
|
|
1135
|
+
isSuccess: false;
|
|
1136
|
+
isPlaceholderData: false;
|
|
1137
|
+
status: "error";
|
|
1138
|
+
dataUpdatedAt: number;
|
|
1139
|
+
errorUpdatedAt: number;
|
|
1140
|
+
failureCount: number;
|
|
1141
|
+
failureReason: Error | null;
|
|
1142
|
+
errorUpdateCount: number;
|
|
1143
|
+
isFetched: boolean;
|
|
1144
|
+
isFetchedAfterMount: boolean;
|
|
1145
|
+
isFetching: boolean;
|
|
1146
|
+
isInitialLoading: boolean;
|
|
1147
|
+
isPaused: boolean;
|
|
1148
|
+
isRefetching: boolean;
|
|
1149
|
+
isStale: boolean;
|
|
1150
|
+
isEnabled: boolean;
|
|
1151
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1152
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1153
|
+
promise: Promise<User>;
|
|
1154
|
+
} | {
|
|
1155
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1156
|
+
data: undefined;
|
|
1157
|
+
error: null;
|
|
1158
|
+
isError: false;
|
|
1159
|
+
isPending: true;
|
|
1160
|
+
isLoading: true;
|
|
1161
|
+
isLoadingError: false;
|
|
1162
|
+
isRefetchError: false;
|
|
1163
|
+
isSuccess: false;
|
|
1164
|
+
isPlaceholderData: false;
|
|
1165
|
+
status: "pending";
|
|
1166
|
+
dataUpdatedAt: number;
|
|
1167
|
+
errorUpdatedAt: number;
|
|
1168
|
+
failureCount: number;
|
|
1169
|
+
failureReason: Error | null;
|
|
1170
|
+
errorUpdateCount: number;
|
|
1171
|
+
isFetched: boolean;
|
|
1172
|
+
isFetchedAfterMount: boolean;
|
|
1173
|
+
isFetching: boolean;
|
|
1174
|
+
isInitialLoading: boolean;
|
|
1175
|
+
isPaused: boolean;
|
|
1176
|
+
isRefetching: boolean;
|
|
1177
|
+
isStale: boolean;
|
|
1178
|
+
isEnabled: boolean;
|
|
1179
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1180
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1181
|
+
promise: Promise<User>;
|
|
1182
|
+
} | {
|
|
1183
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1184
|
+
data: undefined;
|
|
1185
|
+
error: null;
|
|
1186
|
+
isError: false;
|
|
1187
|
+
isPending: true;
|
|
1188
|
+
isLoadingError: false;
|
|
1189
|
+
isRefetchError: false;
|
|
1190
|
+
isSuccess: false;
|
|
1191
|
+
isPlaceholderData: false;
|
|
1192
|
+
status: "pending";
|
|
1193
|
+
dataUpdatedAt: number;
|
|
1194
|
+
errorUpdatedAt: number;
|
|
1195
|
+
failureCount: number;
|
|
1196
|
+
failureReason: Error | null;
|
|
1197
|
+
errorUpdateCount: number;
|
|
1198
|
+
isFetched: boolean;
|
|
1199
|
+
isFetchedAfterMount: boolean;
|
|
1200
|
+
isFetching: boolean;
|
|
1201
|
+
isLoading: boolean;
|
|
1202
|
+
isInitialLoading: boolean;
|
|
1203
|
+
isPaused: boolean;
|
|
1204
|
+
isRefetching: boolean;
|
|
1205
|
+
isStale: boolean;
|
|
1206
|
+
isEnabled: boolean;
|
|
1207
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1208
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1209
|
+
promise: Promise<User>;
|
|
1210
|
+
} | {
|
|
1211
|
+
fetchUser: (input: GetUserInput) => Promise<User>;
|
|
1212
|
+
data: User;
|
|
1213
|
+
isError: false;
|
|
1214
|
+
error: null;
|
|
1215
|
+
isPending: false;
|
|
1216
|
+
isLoading: false;
|
|
1217
|
+
isLoadingError: false;
|
|
1218
|
+
isRefetchError: false;
|
|
1219
|
+
isSuccess: true;
|
|
1220
|
+
isPlaceholderData: true;
|
|
1221
|
+
status: "success";
|
|
1222
|
+
dataUpdatedAt: number;
|
|
1223
|
+
errorUpdatedAt: number;
|
|
1224
|
+
failureCount: number;
|
|
1225
|
+
failureReason: Error | null;
|
|
1226
|
+
errorUpdateCount: number;
|
|
1227
|
+
isFetched: boolean;
|
|
1228
|
+
isFetchedAfterMount: boolean;
|
|
1229
|
+
isFetching: boolean;
|
|
1230
|
+
isInitialLoading: boolean;
|
|
1231
|
+
isPaused: boolean;
|
|
1232
|
+
isRefetching: boolean;
|
|
1233
|
+
isStale: boolean;
|
|
1234
|
+
isEnabled: boolean;
|
|
1235
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<User, Error>>;
|
|
1236
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
1237
|
+
promise: Promise<User>;
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
type CreateUserInput = {
|
|
1241
|
+
params: CreateUserParams;
|
|
1242
|
+
bearerToken: string;
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* Hook for creating a new user
|
|
1246
|
+
*/
|
|
1247
|
+
declare function useCreateUser(): {
|
|
1248
|
+
createUser: (input: CreateUserInput) => void;
|
|
1249
|
+
createUserAsync: (input: CreateUserInput) => Promise<User>;
|
|
1250
|
+
data: User | undefined;
|
|
1251
|
+
isLoading: boolean;
|
|
1252
|
+
isError: boolean;
|
|
1253
|
+
error: Error | null;
|
|
1254
|
+
isSuccess: boolean;
|
|
1255
|
+
reset: () => void;
|
|
1256
|
+
};
|
|
1257
|
+
|
|
1258
|
+
export { useApprove, useCallAnyContract, useCreateSkuTransaction, useCreateUser, useCreateWallet, useGetSku, useGetSkuList, useGetSkuTransaction, useGetTokenBalance, useGetUser, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc };
|
package/dist/hooks.js
CHANGED
|
@@ -256,7 +256,8 @@ function useGetSku(input) {
|
|
|
256
256
|
return queryClient.fetchQuery({
|
|
257
257
|
queryKey: ["sku", input2?.id],
|
|
258
258
|
queryFn: async () => {
|
|
259
|
-
if (!input2?.getBearerToken)
|
|
259
|
+
if (!input2?.getBearerToken)
|
|
260
|
+
throw new Error("getBearerToken is required");
|
|
260
261
|
const bearerToken = await input2.getBearerToken();
|
|
261
262
|
if (!bearerToken) throw new Error("Bearer token is required");
|
|
262
263
|
return chipiSDK.getSku(input2.id, bearerToken);
|
|
@@ -395,15 +396,81 @@ function useGetTokenBalance(input) {
|
|
|
395
396
|
fetchTokenBalance
|
|
396
397
|
};
|
|
397
398
|
}
|
|
399
|
+
function useGetUser(input) {
|
|
400
|
+
const { chipiSDK } = useChipiContext();
|
|
401
|
+
const queryClient = reactQuery.useQueryClient();
|
|
402
|
+
const query = reactQuery.useQuery({
|
|
403
|
+
queryKey: ["user", input?.externalId],
|
|
404
|
+
queryFn: async () => {
|
|
405
|
+
if (!input?.externalId || !input?.getBearerToken)
|
|
406
|
+
throw new Error("externalId and getBearerToken are required");
|
|
407
|
+
const bearerToken = await input.getBearerToken();
|
|
408
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
409
|
+
return chipiSDK.getUserByExternalId(input.externalId, bearerToken);
|
|
410
|
+
},
|
|
411
|
+
enabled: Boolean(
|
|
412
|
+
input?.externalId && input?.getBearerToken && input.externalId.trim() !== ""
|
|
413
|
+
),
|
|
414
|
+
retry: (failureCount, error) => {
|
|
415
|
+
if (error instanceof shared.ChipiApiError || error?.status) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
return failureCount < 3;
|
|
419
|
+
},
|
|
420
|
+
...input?.queryOptions
|
|
421
|
+
});
|
|
422
|
+
const fetchUser = async (input2) => {
|
|
423
|
+
return queryClient.fetchQuery({
|
|
424
|
+
queryKey: ["user", input2?.externalId],
|
|
425
|
+
queryFn: async () => {
|
|
426
|
+
if (!input2?.getBearerToken)
|
|
427
|
+
throw new Error("getBearerToken is required");
|
|
428
|
+
const bearerToken = await input2.getBearerToken();
|
|
429
|
+
if (!bearerToken) throw new Error("Bearer token is required");
|
|
430
|
+
return chipiSDK.getUserByExternalId(input2.externalId, bearerToken);
|
|
431
|
+
},
|
|
432
|
+
retry: (failureCount, error) => {
|
|
433
|
+
if (error instanceof shared.ChipiApiError || error?.code) {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
return failureCount < 3;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
return {
|
|
441
|
+
...query,
|
|
442
|
+
fetchUser
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function useCreateUser() {
|
|
446
|
+
const { chipiSDK } = useChipiContext();
|
|
447
|
+
const mutation = reactQuery.useMutation(
|
|
448
|
+
{
|
|
449
|
+
mutationFn: (input) => chipiSDK.createUser(input.params, input.bearerToken)
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
return {
|
|
453
|
+
createUser: mutation.mutate,
|
|
454
|
+
createUserAsync: mutation.mutateAsync,
|
|
455
|
+
data: mutation.data,
|
|
456
|
+
isLoading: mutation.isPending,
|
|
457
|
+
isError: mutation.isError,
|
|
458
|
+
error: mutation.error,
|
|
459
|
+
isSuccess: mutation.isSuccess,
|
|
460
|
+
reset: mutation.reset
|
|
461
|
+
};
|
|
462
|
+
}
|
|
398
463
|
|
|
399
464
|
exports.useApprove = useApprove;
|
|
400
465
|
exports.useCallAnyContract = useCallAnyContract;
|
|
401
466
|
exports.useCreateSkuTransaction = useCreateSkuTransaction;
|
|
467
|
+
exports.useCreateUser = useCreateUser;
|
|
402
468
|
exports.useCreateWallet = useCreateWallet;
|
|
403
469
|
exports.useGetSku = useGetSku;
|
|
404
470
|
exports.useGetSkuList = useGetSkuList;
|
|
405
471
|
exports.useGetSkuTransaction = useGetSkuTransaction;
|
|
406
472
|
exports.useGetTokenBalance = useGetTokenBalance;
|
|
473
|
+
exports.useGetUser = useGetUser;
|
|
407
474
|
exports.useGetWallet = useGetWallet;
|
|
408
475
|
exports.useRecordSendTransaction = useRecordSendTransaction;
|
|
409
476
|
exports.useStakeVesuUsdc = useStakeVesuUsdc;
|