anymal-protocol 1.0.67 → 1.0.69

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/index.d.mts CHANGED
@@ -231,6 +231,11 @@ declare enum ActionSourceType {
231
231
  ORGANIZATION = "ORGANIZATION",
232
232
  APP = "APP"
233
233
  }
234
+ declare enum ActionStatus {
235
+ PENDING = "PENDING",
236
+ VALIDATED = "VALIDATED",
237
+ CLAIMED = "CLAIMED"
238
+ }
234
239
  /**
235
240
  * Represents a single action record returned by the backend.
236
241
  */
@@ -243,7 +248,7 @@ interface ActionRecord {
243
248
  version_cid?: string;
244
249
  quantity: number;
245
250
  reward_amount?: number;
246
- status: "PENDING" | "VALIDATED" | "CLAIMED";
251
+ status: ActionStatus;
247
252
  createdAt: string;
248
253
  validatedAt?: string | null;
249
254
  claimIndex?: number | null;
@@ -268,6 +273,9 @@ interface ActionDefinition {
268
273
  interface FetchActionsResponse {
269
274
  data: ActionRecord[];
270
275
  }
276
+ interface FetchActionDefinitionsResponse {
277
+ data: ActionDefinition[];
278
+ }
271
279
 
272
280
  /**
273
281
  * Base fields sent with every action
@@ -331,6 +339,8 @@ declare function submitAction(idToken: string, pid: string, sourceType: ActionSo
331
339
 
332
340
  declare function useFetchActions(): (idToken: string, actionsServiceBaseUrl: string, pid: string, status?: string, limit?: number, offset?: number) => Promise<FetchActionsResponse | null>;
333
341
 
342
+ declare function useFetchActionDefinitions(): (idToken: string, actionsServiceBaseUrl: string) => Promise<FetchActionDefinitionsResponse | null>;
343
+
334
344
  declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
335
345
  success: boolean;
336
346
  data: any;
@@ -343,4 +353,4 @@ declare function useCreateOrganizationAppData(): (appId: string, pid: string, db
343
353
 
344
354
  declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
345
355
 
346
- export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, ActionSourceType, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, type GraphQLActionPayload, type JWTOptions, NETWORK_HOSTS, Network, type SubmitResponse, createAuthEnvelope, fetchAnymals, generateAppSignature, generateBytes32Nonce, generateJWT, loadExistingSecp256k1PrivateKey, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
356
+ export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, type GraphQLActionPayload, type JWTOptions, NETWORK_HOSTS, Network, type SubmitResponse, createAuthEnvelope, fetchAnymals, generateAppSignature, generateBytes32Nonce, generateJWT, loadExistingSecp256k1PrivateKey, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
package/dist/index.d.ts CHANGED
@@ -231,6 +231,11 @@ declare enum ActionSourceType {
231
231
  ORGANIZATION = "ORGANIZATION",
232
232
  APP = "APP"
233
233
  }
234
+ declare enum ActionStatus {
235
+ PENDING = "PENDING",
236
+ VALIDATED = "VALIDATED",
237
+ CLAIMED = "CLAIMED"
238
+ }
234
239
  /**
235
240
  * Represents a single action record returned by the backend.
236
241
  */
@@ -243,7 +248,7 @@ interface ActionRecord {
243
248
  version_cid?: string;
244
249
  quantity: number;
245
250
  reward_amount?: number;
246
- status: "PENDING" | "VALIDATED" | "CLAIMED";
251
+ status: ActionStatus;
247
252
  createdAt: string;
248
253
  validatedAt?: string | null;
249
254
  claimIndex?: number | null;
@@ -268,6 +273,9 @@ interface ActionDefinition {
268
273
  interface FetchActionsResponse {
269
274
  data: ActionRecord[];
270
275
  }
276
+ interface FetchActionDefinitionsResponse {
277
+ data: ActionDefinition[];
278
+ }
271
279
 
272
280
  /**
273
281
  * Base fields sent with every action
@@ -331,6 +339,8 @@ declare function submitAction(idToken: string, pid: string, sourceType: ActionSo
331
339
 
332
340
  declare function useFetchActions(): (idToken: string, actionsServiceBaseUrl: string, pid: string, status?: string, limit?: number, offset?: number) => Promise<FetchActionsResponse | null>;
333
341
 
342
+ declare function useFetchActionDefinitions(): (idToken: string, actionsServiceBaseUrl: string) => Promise<FetchActionDefinitionsResponse | null>;
343
+
334
344
  declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
335
345
  success: boolean;
336
346
  data: any;
@@ -343,4 +353,4 @@ declare function useCreateOrganizationAppData(): (appId: string, pid: string, db
343
353
 
344
354
  declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
345
355
 
346
- export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, ActionSourceType, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, type GraphQLActionPayload, type JWTOptions, NETWORK_HOSTS, Network, type SubmitResponse, createAuthEnvelope, fetchAnymals, generateAppSignature, generateBytes32Nonce, generateJWT, loadExistingSecp256k1PrivateKey, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
356
+ export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, type GraphQLActionPayload, type JWTOptions, NETWORK_HOSTS, Network, type SubmitResponse, createAuthEnvelope, fetchAnymals, generateAppSignature, generateBytes32Nonce, generateJWT, loadExistingSecp256k1PrivateKey, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AUTH_API_ENDPOINTS: () => AUTH_API_ENDPOINTS,
24
24
  ActionSourceType: () => ActionSourceType,
25
+ ActionStatus: () => ActionStatus,
25
26
  ActionType: () => ActionType,
26
27
  NETWORK_HOSTS: () => NETWORK_HOSTS,
27
28
  Network: () => Network,
@@ -41,6 +42,7 @@ __export(index_exports, {
41
42
  useCreateUserAppData: () => useCreateUserAppData,
42
43
  useCreateWeb3Account: () => useCreateWeb3Account,
43
44
  useDeleteAnymalFromDatabase: () => useDeleteAnymalFromDatabase,
45
+ useFetchActionDefinitions: () => useFetchActionDefinitions,
44
46
  useFetchActions: () => useFetchActions,
45
47
  useFetchAnymals: () => useFetchAnymals,
46
48
  useFetchBalance: () => useFetchBalance,
@@ -2158,6 +2160,33 @@ function useFetchActions() {
2158
2160
  );
2159
2161
  }
2160
2162
 
2163
+ // src/utils/actions/useFetchActionDefinitions.ts
2164
+ var import_react24 = require("react");
2165
+ function useFetchActionDefinitions() {
2166
+ return (0, import_react24.useCallback)(
2167
+ async (idToken, actionsServiceBaseUrl) => {
2168
+ try {
2169
+ const response = await fetch(
2170
+ `${actionsServiceBaseUrl}/action-definitions`,
2171
+ {
2172
+ method: "GET",
2173
+ headers: {
2174
+ "Content-Type": "application/json",
2175
+ Authorization: "Bearer " + idToken
2176
+ }
2177
+ }
2178
+ );
2179
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
2180
+ return await response.json();
2181
+ } catch (error) {
2182
+ console.error("useFetchActionDefinitions error:", error);
2183
+ return null;
2184
+ }
2185
+ },
2186
+ []
2187
+ );
2188
+ }
2189
+
2161
2190
  // src/types/Actions.ts
2162
2191
  var ActionType = /* @__PURE__ */ ((ActionType2) => {
2163
2192
  ActionType2["GRAPHQL"] = "GRAPHQL";
@@ -2171,12 +2200,18 @@ var ActionSourceType = /* @__PURE__ */ ((ActionSourceType2) => {
2171
2200
  ActionSourceType2["APP"] = "APP";
2172
2201
  return ActionSourceType2;
2173
2202
  })(ActionSourceType || {});
2203
+ var ActionStatus = /* @__PURE__ */ ((ActionStatus2) => {
2204
+ ActionStatus2["PENDING"] = "PENDING";
2205
+ ActionStatus2["VALIDATED"] = "VALIDATED";
2206
+ ActionStatus2["CLAIMED"] = "CLAIMED";
2207
+ return ActionStatus2;
2208
+ })(ActionStatus || {});
2174
2209
 
2175
2210
  // src/utils/application/useCreateUserAppData.ts
2176
- var import_react24 = require("react");
2211
+ var import_react25 = require("react");
2177
2212
  var import_uuid2 = require("uuid");
2178
2213
  function useCreateUserAppData() {
2179
- return (0, import_react24.useCallback)(
2214
+ return (0, import_react25.useCallback)(
2180
2215
  async (appId, pid, dbAuthToken, endpoint) => {
2181
2216
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2182
2217
  const appValues = {
@@ -2231,10 +2266,10 @@ function useCreateUserAppData() {
2231
2266
  }
2232
2267
 
2233
2268
  // src/utils/application/useCreateOrganizationAppData.ts
2234
- var import_react25 = require("react");
2269
+ var import_react26 = require("react");
2235
2270
  var import_uuid3 = require("uuid");
2236
2271
  function useCreateOrganizationAppData() {
2237
- return (0, import_react25.useCallback)(
2272
+ return (0, import_react26.useCallback)(
2238
2273
  async (appId, pid, dbAuthToken, endpoint) => {
2239
2274
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2240
2275
  const appValues = {
@@ -2288,10 +2323,10 @@ function useCreateOrganizationAppData() {
2288
2323
  }
2289
2324
 
2290
2325
  // src/utils/balance/useFetchBalance.ts
2291
- var import_react26 = require("react");
2326
+ var import_react27 = require("react");
2292
2327
  var import_viem9 = require("viem");
2293
2328
  function useFetchBalance() {
2294
- return (0, import_react26.useCallback)(
2329
+ return (0, import_react27.useCallback)(
2295
2330
  async (publicClient, walletAddress, kibbleTokenAddress) => {
2296
2331
  try {
2297
2332
  const balance = await publicClient.readContract({
@@ -2312,6 +2347,7 @@ function useFetchBalance() {
2312
2347
  0 && (module.exports = {
2313
2348
  AUTH_API_ENDPOINTS,
2314
2349
  ActionSourceType,
2350
+ ActionStatus,
2315
2351
  ActionType,
2316
2352
  NETWORK_HOSTS,
2317
2353
  Network,
@@ -2331,6 +2367,7 @@ function useFetchBalance() {
2331
2367
  useCreateUserAppData,
2332
2368
  useCreateWeb3Account,
2333
2369
  useDeleteAnymalFromDatabase,
2370
+ useFetchActionDefinitions,
2334
2371
  useFetchActions,
2335
2372
  useFetchAnymals,
2336
2373
  useFetchBalance,
package/dist/index.mjs CHANGED
@@ -2025,6 +2025,33 @@ function useFetchActions() {
2025
2025
  );
2026
2026
  }
2027
2027
 
2028
+ // src/utils/actions/useFetchActionDefinitions.ts
2029
+ import { useCallback as useCallback24 } from "react";
2030
+ function useFetchActionDefinitions() {
2031
+ return useCallback24(
2032
+ async (idToken, actionsServiceBaseUrl) => {
2033
+ try {
2034
+ const response = await fetch(
2035
+ `${actionsServiceBaseUrl}/action-definitions`,
2036
+ {
2037
+ method: "GET",
2038
+ headers: {
2039
+ "Content-Type": "application/json",
2040
+ Authorization: "Bearer " + idToken
2041
+ }
2042
+ }
2043
+ );
2044
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
2045
+ return await response.json();
2046
+ } catch (error) {
2047
+ console.error("useFetchActionDefinitions error:", error);
2048
+ return null;
2049
+ }
2050
+ },
2051
+ []
2052
+ );
2053
+ }
2054
+
2028
2055
  // src/types/Actions.ts
2029
2056
  var ActionType = /* @__PURE__ */ ((ActionType2) => {
2030
2057
  ActionType2["GRAPHQL"] = "GRAPHQL";
@@ -2038,12 +2065,18 @@ var ActionSourceType = /* @__PURE__ */ ((ActionSourceType2) => {
2038
2065
  ActionSourceType2["APP"] = "APP";
2039
2066
  return ActionSourceType2;
2040
2067
  })(ActionSourceType || {});
2068
+ var ActionStatus = /* @__PURE__ */ ((ActionStatus2) => {
2069
+ ActionStatus2["PENDING"] = "PENDING";
2070
+ ActionStatus2["VALIDATED"] = "VALIDATED";
2071
+ ActionStatus2["CLAIMED"] = "CLAIMED";
2072
+ return ActionStatus2;
2073
+ })(ActionStatus || {});
2041
2074
 
2042
2075
  // src/utils/application/useCreateUserAppData.ts
2043
- import { useCallback as useCallback24 } from "react";
2076
+ import { useCallback as useCallback25 } from "react";
2044
2077
  import { v4 as uuid } from "uuid";
2045
2078
  function useCreateUserAppData() {
2046
- return useCallback24(
2079
+ return useCallback25(
2047
2080
  async (appId, pid, dbAuthToken, endpoint) => {
2048
2081
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2049
2082
  const appValues = {
@@ -2098,10 +2131,10 @@ function useCreateUserAppData() {
2098
2131
  }
2099
2132
 
2100
2133
  // src/utils/application/useCreateOrganizationAppData.ts
2101
- import { useCallback as useCallback25 } from "react";
2134
+ import { useCallback as useCallback26 } from "react";
2102
2135
  import { v4 as uuid2 } from "uuid";
2103
2136
  function useCreateOrganizationAppData() {
2104
- return useCallback25(
2137
+ return useCallback26(
2105
2138
  async (appId, pid, dbAuthToken, endpoint) => {
2106
2139
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2107
2140
  const appValues = {
@@ -2155,10 +2188,10 @@ function useCreateOrganizationAppData() {
2155
2188
  }
2156
2189
 
2157
2190
  // src/utils/balance/useFetchBalance.ts
2158
- import { useCallback as useCallback26 } from "react";
2191
+ import { useCallback as useCallback27 } from "react";
2159
2192
  import { erc20Abi as erc20Abi3, getAddress } from "viem";
2160
2193
  function useFetchBalance() {
2161
- return useCallback26(
2194
+ return useCallback27(
2162
2195
  async (publicClient, walletAddress, kibbleTokenAddress) => {
2163
2196
  try {
2164
2197
  const balance = await publicClient.readContract({
@@ -2178,6 +2211,7 @@ function useFetchBalance() {
2178
2211
  export {
2179
2212
  AUTH_API_ENDPOINTS,
2180
2213
  ActionSourceType,
2214
+ ActionStatus,
2181
2215
  ActionType,
2182
2216
  NETWORK_HOSTS,
2183
2217
  Network,
@@ -2197,6 +2231,7 @@ export {
2197
2231
  useCreateUserAppData,
2198
2232
  useCreateWeb3Account,
2199
2233
  useDeleteAnymalFromDatabase,
2234
+ useFetchActionDefinitions,
2200
2235
  useFetchActions,
2201
2236
  useFetchAnymals,
2202
2237
  useFetchBalance,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "description": "A React/TypeScript-based utility library for reusable functions and hooks inside of the Anymal Ecosystem.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {