anymal-protocol 1.0.25 → 1.0.27

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
@@ -42,7 +42,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
42
42
  */
43
43
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
44
 
45
- declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
45
+ declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
46
46
  success: boolean;
47
47
  message: string;
48
48
  }>;
@@ -64,7 +64,7 @@ declare function useAddAnymalToDatabase(): (dbAuthToken: string, endpoint: strin
64
64
 
65
65
  declare function useDeleteAnymalFromDatabase(): (dbAuthToken: string, endpoint: string, anymalDocID: string) => Promise<void>;
66
66
 
67
- declare function useSaveAnymalMetadata(): (idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
67
+ declare function useSaveAnymalMetadata(): (userPid: string, anymalTxId: string, idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
68
68
  success: boolean;
69
69
  message: any;
70
70
  }>;
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
42
42
  */
43
43
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
44
 
45
- declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
45
+ declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
46
46
  success: boolean;
47
47
  message: string;
48
48
  }>;
@@ -64,7 +64,7 @@ declare function useAddAnymalToDatabase(): (dbAuthToken: string, endpoint: strin
64
64
 
65
65
  declare function useDeleteAnymalFromDatabase(): (dbAuthToken: string, endpoint: string, anymalDocID: string) => Promise<void>;
66
66
 
67
- declare function useSaveAnymalMetadata(): (idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
67
+ declare function useSaveAnymalMetadata(): (userPid: string, anymalTxId: string, idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
68
68
  success: boolean;
69
69
  message: any;
70
70
  }>;
package/dist/index.js CHANGED
@@ -374,21 +374,28 @@ function useFetchNotifications() {
374
374
  }
375
375
  try {
376
376
  const query = `
377
- query Notification($filter: NotificationFilterArg) {
378
- Notification(filter: $filter) {
379
- _docID
380
- action
381
- id
382
- pid
383
- read
384
- source
385
- tags
386
- text
387
- timeAddedUtc
388
- timeUpdatedUtc
389
- type
377
+ query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg) {
378
+ AnymalNotification(groupBy: $groupBy, filter: $filter) {
379
+ anymalTxId
380
+ title
381
+ timeAddedUtc
382
+ _group {
383
+ source
384
+ action
385
+ anymalTxId
386
+ id
387
+ pid
388
+ read
389
+ source
390
+ tags
391
+ text
392
+ title
393
+ timeAddedUtc
394
+ timeUpdatedUtc
395
+ type
390
396
  }
391
397
  }
398
+ }
392
399
  `;
393
400
  const filter = {
394
401
  pid: {
@@ -396,7 +403,8 @@ function useFetchNotifications() {
396
403
  },
397
404
  ...additionalFilters || {}
398
405
  };
399
- const variables = { filter };
406
+ const groupBy = ["anymalTxId", "title"];
407
+ const variables = { filter, groupBy };
400
408
  const response = await fetch(endpoint, {
401
409
  method: "POST",
402
410
  headers: {
@@ -409,8 +417,8 @@ function useFetchNotifications() {
409
417
  throw new Error(`HTTP error! Status: ${response.status}`);
410
418
  }
411
419
  const data = await response.json();
412
- if (data?.data?.Notification?.length > 0) {
413
- return data.data.Notification;
420
+ if (data?.data?.AnymalNotification?.length > 0) {
421
+ return data.data.AnymalNotification;
414
422
  } else {
415
423
  return null;
416
424
  }
@@ -426,17 +434,15 @@ function useFetchNotifications() {
426
434
  // src/utils/anymals/useMintAnymalNFT.ts
427
435
  var import_viem2 = require("viem");
428
436
  var import_react10 = require("react");
429
- var import_uuid = require("uuid");
430
437
  function useMintAnymalNFT() {
431
438
  return (0, import_react10.useCallback)(
432
- async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
439
+ async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
433
440
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
434
441
  return {
435
442
  success: false,
436
443
  message: "Missing authentication token OR NFT ID."
437
444
  };
438
445
  }
439
- const anymalTxId = (0, import_uuid.v4)();
440
446
  const callData = (0, import_viem2.encodeFunctionData)({
441
447
  abi: PET_NFT_ABI,
442
448
  functionName: "submitMetadataByCampaignName",
@@ -579,7 +585,7 @@ function useDeleteAnymalFromDatabase() {
579
585
  var import_react13 = require("react");
580
586
  function useSaveAnymalMetadata() {
581
587
  return (0, import_react13.useCallback)(
582
- async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
588
+ async (userPid, anymalTxId, idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
583
589
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
584
590
  method: "POST",
585
591
  headers: {
@@ -588,7 +594,9 @@ function useSaveAnymalMetadata() {
588
594
  },
589
595
  body: JSON.stringify({
590
596
  appPubKey: publicKey,
591
- nftMetadataInput
597
+ nftMetadataInput,
598
+ pid: userPid,
599
+ anymalTxId
592
600
  })
593
601
  });
594
602
  const data = await response.json();
@@ -869,22 +877,22 @@ function useApproveKibbleToken() {
869
877
  }
870
878
 
871
879
  // src/helpers/NonceHelper.tsx
872
- var import_uuid2 = require("uuid");
880
+ var import_uuid = require("uuid");
873
881
  var import_viem5 = require("viem");
874
882
  var generateBytes32Nonce = () => {
875
- const uuid2 = (0, import_uuid2.v4)().replace(/-/g, "");
883
+ const uuid2 = (0, import_uuid.v4)().replace(/-/g, "");
876
884
  return (0, import_viem5.padHex)(`0x${uuid2}`, { size: 32 });
877
885
  };
878
886
 
879
887
  // src/utils/application/useCreateUserAppData.ts
880
888
  var import_react18 = require("react");
881
- var import_uuid3 = require("uuid");
889
+ var import_uuid2 = require("uuid");
882
890
  function useCreateUserAppData() {
883
891
  return (0, import_react18.useCallback)(
884
892
  async (appId, pid, dbAuthToken, endpoint) => {
885
893
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
886
894
  const appValues = {
887
- id: (0, import_uuid3.v4)(),
895
+ id: (0, import_uuid2.v4)(),
888
896
  userPid: pid,
889
897
  appId,
890
898
  settings: {
package/dist/index.mjs CHANGED
@@ -329,21 +329,28 @@ function useFetchNotifications() {
329
329
  }
330
330
  try {
331
331
  const query = `
332
- query Notification($filter: NotificationFilterArg) {
333
- Notification(filter: $filter) {
334
- _docID
335
- action
336
- id
337
- pid
338
- read
339
- source
340
- tags
341
- text
342
- timeAddedUtc
343
- timeUpdatedUtc
344
- type
332
+ query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg) {
333
+ AnymalNotification(groupBy: $groupBy, filter: $filter) {
334
+ anymalTxId
335
+ title
336
+ timeAddedUtc
337
+ _group {
338
+ source
339
+ action
340
+ anymalTxId
341
+ id
342
+ pid
343
+ read
344
+ source
345
+ tags
346
+ text
347
+ title
348
+ timeAddedUtc
349
+ timeUpdatedUtc
350
+ type
345
351
  }
346
352
  }
353
+ }
347
354
  `;
348
355
  const filter = {
349
356
  pid: {
@@ -351,7 +358,8 @@ function useFetchNotifications() {
351
358
  },
352
359
  ...additionalFilters || {}
353
360
  };
354
- const variables = { filter };
361
+ const groupBy = ["anymalTxId", "title"];
362
+ const variables = { filter, groupBy };
355
363
  const response = await fetch(endpoint, {
356
364
  method: "POST",
357
365
  headers: {
@@ -364,8 +372,8 @@ function useFetchNotifications() {
364
372
  throw new Error(`HTTP error! Status: ${response.status}`);
365
373
  }
366
374
  const data = await response.json();
367
- if (data?.data?.Notification?.length > 0) {
368
- return data.data.Notification;
375
+ if (data?.data?.AnymalNotification?.length > 0) {
376
+ return data.data.AnymalNotification;
369
377
  } else {
370
378
  return null;
371
379
  }
@@ -381,17 +389,15 @@ function useFetchNotifications() {
381
389
  // src/utils/anymals/useMintAnymalNFT.ts
382
390
  import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
383
391
  import { useCallback as useCallback10 } from "react";
384
- import { v4 as uuidv4 } from "uuid";
385
392
  function useMintAnymalNFT() {
386
393
  return useCallback10(
387
- async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
394
+ async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
388
395
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
389
396
  return {
390
397
  success: false,
391
398
  message: "Missing authentication token OR NFT ID."
392
399
  };
393
400
  }
394
- const anymalTxId = uuidv4();
395
401
  const callData = encodeFunctionData2({
396
402
  abi: PET_NFT_ABI,
397
403
  functionName: "submitMetadataByCampaignName",
@@ -534,7 +540,7 @@ function useDeleteAnymalFromDatabase() {
534
540
  import { useCallback as useCallback13 } from "react";
535
541
  function useSaveAnymalMetadata() {
536
542
  return useCallback13(
537
- async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
543
+ async (userPid, anymalTxId, idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
538
544
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
539
545
  method: "POST",
540
546
  headers: {
@@ -543,7 +549,9 @@ function useSaveAnymalMetadata() {
543
549
  },
544
550
  body: JSON.stringify({
545
551
  appPubKey: publicKey,
546
- nftMetadataInput
552
+ nftMetadataInput,
553
+ pid: userPid,
554
+ anymalTxId
547
555
  })
548
556
  });
549
557
  const data = await response.json();
@@ -824,10 +832,10 @@ function useApproveKibbleToken() {
824
832
  }
825
833
 
826
834
  // src/helpers/NonceHelper.tsx
827
- import { v4 as uuidv42 } from "uuid";
835
+ import { v4 as uuidv4 } from "uuid";
828
836
  import { padHex } from "viem";
829
837
  var generateBytes32Nonce = () => {
830
- const uuid2 = uuidv42().replace(/-/g, "");
838
+ const uuid2 = uuidv4().replace(/-/g, "");
831
839
  return padHex(`0x${uuid2}`, { size: 32 });
832
840
  };
833
841
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
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
  "module": "dist/index.js",