anymal-protocol 1.0.1 → 1.0.3

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.js CHANGED
@@ -20,6 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ useAddAnymalToDatabase: () => useAddAnymalToDatabase,
24
+ useDeleteAnymalFromDatabase: () => useDeleteAnymalFromDatabase,
25
+ useMintAnymalNFT: () => useMintAnymalNFT,
26
+ useSaveAnymalMetadata: () => useSaveAnymalMetadata,
27
+ useUpdateAnymalWithNFT: () => useUpdateAnymalWithNFT,
23
28
  useVerifyAccount: () => useVerifyAccount
24
29
  });
25
30
  module.exports = __toCommonJS(index_exports);
@@ -29,6 +34,545 @@ var import_react = require("react");
29
34
  var import_viem = require("viem");
30
35
 
31
36
  // src/helpers/BlockchainAbiHelper.tsx
37
+ var PET_NFT_ABI = [
38
+ { inputs: [], stateMutability: "nonpayable", type: "constructor" },
39
+ {
40
+ inputs: [],
41
+ name: "AccessControlBadConfirmation",
42
+ type: "error"
43
+ },
44
+ {
45
+ inputs: [
46
+ { internalType: "address", name: "account", type: "address" },
47
+ {
48
+ internalType: "bytes32",
49
+ name: "neededRole",
50
+ type: "bytes32"
51
+ }
52
+ ],
53
+ name: "AccessControlUnauthorizedAccount",
54
+ type: "error"
55
+ },
56
+ {
57
+ inputs: [{ internalType: "address", name: "target", type: "address" }],
58
+ name: "AddressEmptyCode",
59
+ type: "error"
60
+ },
61
+ {
62
+ inputs: [{ internalType: "address", name: "implementation", type: "address" }],
63
+ name: "ERC1967InvalidImplementation",
64
+ type: "error"
65
+ },
66
+ { inputs: [], name: "ERC1967NonPayable", type: "error" },
67
+ {
68
+ inputs: [],
69
+ name: "EnforcedPause",
70
+ type: "error"
71
+ },
72
+ { inputs: [], name: "ExpectedPause", type: "error" },
73
+ {
74
+ inputs: [],
75
+ name: "FailedCall",
76
+ type: "error"
77
+ },
78
+ { inputs: [], name: "InvalidInitialization", type: "error" },
79
+ {
80
+ inputs: [],
81
+ name: "NotInitializing",
82
+ type: "error"
83
+ },
84
+ {
85
+ inputs: [],
86
+ name: "UUPSUnauthorizedCallContext",
87
+ type: "error"
88
+ },
89
+ {
90
+ inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
91
+ name: "UUPSUnsupportedProxiableUUID",
92
+ type: "error"
93
+ },
94
+ {
95
+ anonymous: false,
96
+ inputs: [{ indexed: false, internalType: "uint64", name: "version", type: "uint64" }],
97
+ name: "Initialized",
98
+ type: "event"
99
+ },
100
+ {
101
+ anonymous: false,
102
+ inputs: [
103
+ {
104
+ indexed: true,
105
+ internalType: "address",
106
+ name: "user",
107
+ type: "address"
108
+ },
109
+ { indexed: false, internalType: "string", name: "pid", type: "string" },
110
+ {
111
+ indexed: false,
112
+ internalType: "string",
113
+ name: "nftId",
114
+ type: "string"
115
+ },
116
+ { indexed: false, internalType: "string", name: "metadataURL", type: "string" },
117
+ {
118
+ indexed: false,
119
+ internalType: "uint256",
120
+ name: "campaignId",
121
+ type: "uint256"
122
+ },
123
+ { indexed: false, internalType: "uint256", name: "rewardAmount", type: "uint256" }
124
+ ],
125
+ name: "MetadataApproved",
126
+ type: "event"
127
+ },
128
+ {
129
+ anonymous: false,
130
+ inputs: [
131
+ {
132
+ indexed: true,
133
+ internalType: "address",
134
+ name: "user",
135
+ type: "address"
136
+ },
137
+ { indexed: false, internalType: "string", name: "pid", type: "string" },
138
+ {
139
+ indexed: false,
140
+ internalType: "string",
141
+ name: "nftId",
142
+ type: "string"
143
+ },
144
+ { indexed: false, internalType: "string", name: "metadataURL", type: "string" },
145
+ {
146
+ indexed: false,
147
+ internalType: "uint256",
148
+ name: "campaignId",
149
+ type: "uint256"
150
+ },
151
+ { indexed: false, internalType: "uint256", name: "rewardAmount", type: "uint256" }
152
+ ],
153
+ name: "MetadataRejected",
154
+ type: "event"
155
+ },
156
+ {
157
+ anonymous: false,
158
+ inputs: [
159
+ {
160
+ indexed: true,
161
+ internalType: "address",
162
+ name: "user",
163
+ type: "address"
164
+ },
165
+ { indexed: false, internalType: "string", name: "pid", type: "string" },
166
+ {
167
+ indexed: false,
168
+ internalType: "string",
169
+ name: "nftId",
170
+ type: "string"
171
+ },
172
+ { indexed: false, internalType: "string", name: "metadataURL", type: "string" },
173
+ {
174
+ indexed: false,
175
+ internalType: "uint256",
176
+ name: "campaignId",
177
+ type: "uint256"
178
+ },
179
+ { indexed: false, internalType: "uint256", name: "rewardAmount", type: "uint256" }
180
+ ],
181
+ name: "MetadataSubmitted",
182
+ type: "event"
183
+ },
184
+ {
185
+ anonymous: false,
186
+ inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
187
+ name: "Paused",
188
+ type: "event"
189
+ },
190
+ {
191
+ anonymous: false,
192
+ inputs: [
193
+ {
194
+ indexed: true,
195
+ internalType: "address",
196
+ name: "user",
197
+ type: "address"
198
+ },
199
+ { indexed: false, internalType: "string", name: "pid", type: "string" },
200
+ {
201
+ indexed: false,
202
+ internalType: "string",
203
+ name: "nftId",
204
+ type: "string"
205
+ },
206
+ {
207
+ indexed: false,
208
+ internalType: "uint256",
209
+ name: "rewardAmount",
210
+ type: "uint256"
211
+ },
212
+ { indexed: false, internalType: "uint256", name: "campaignId", type: "uint256" }
213
+ ],
214
+ name: "RewardDistributed",
215
+ type: "event"
216
+ },
217
+ {
218
+ anonymous: false,
219
+ inputs: [
220
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
221
+ {
222
+ indexed: true,
223
+ internalType: "bytes32",
224
+ name: "previousAdminRole",
225
+ type: "bytes32"
226
+ },
227
+ { indexed: true, internalType: "bytes32", name: "newAdminRole", type: "bytes32" }
228
+ ],
229
+ name: "RoleAdminChanged",
230
+ type: "event"
231
+ },
232
+ {
233
+ anonymous: false,
234
+ inputs: [
235
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
236
+ {
237
+ indexed: true,
238
+ internalType: "address",
239
+ name: "account",
240
+ type: "address"
241
+ },
242
+ { indexed: true, internalType: "address", name: "sender", type: "address" }
243
+ ],
244
+ name: "RoleGranted",
245
+ type: "event"
246
+ },
247
+ {
248
+ anonymous: false,
249
+ inputs: [
250
+ { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
251
+ {
252
+ indexed: true,
253
+ internalType: "address",
254
+ name: "account",
255
+ type: "address"
256
+ },
257
+ { indexed: true, internalType: "address", name: "sender", type: "address" }
258
+ ],
259
+ name: "RoleRevoked",
260
+ type: "event"
261
+ },
262
+ {
263
+ anonymous: false,
264
+ inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }],
265
+ name: "Unpaused",
266
+ type: "event"
267
+ },
268
+ {
269
+ anonymous: false,
270
+ inputs: [{ indexed: true, internalType: "address", name: "implementation", type: "address" }],
271
+ name: "Upgraded",
272
+ type: "event"
273
+ },
274
+ {
275
+ inputs: [],
276
+ name: "APPROVER_ROLE",
277
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
278
+ stateMutability: "view",
279
+ type: "function"
280
+ },
281
+ {
282
+ inputs: [],
283
+ name: "DEFAULT_ADMIN_ROLE",
284
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
285
+ stateMutability: "view",
286
+ type: "function"
287
+ },
288
+ {
289
+ inputs: [],
290
+ name: "UPGRADE_INTERFACE_VERSION",
291
+ outputs: [{ internalType: "string", name: "", type: "string" }],
292
+ stateMutability: "view",
293
+ type: "function"
294
+ },
295
+ {
296
+ inputs: [
297
+ { internalType: "address", name: "_user", type: "address" },
298
+ {
299
+ internalType: "string",
300
+ name: "_pid",
301
+ type: "string"
302
+ },
303
+ { internalType: "string", name: "_nftId", type: "string" },
304
+ {
305
+ internalType: "string",
306
+ name: "_metadataURL",
307
+ type: "string"
308
+ },
309
+ { internalType: "uint256", name: "_campaignId", type: "uint256" }
310
+ ],
311
+ name: "approveMetadata",
312
+ outputs: [],
313
+ stateMutability: "nonpayable",
314
+ type: "function"
315
+ },
316
+ {
317
+ inputs: [],
318
+ name: "campaignCount",
319
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
320
+ stateMutability: "view",
321
+ type: "function"
322
+ },
323
+ {
324
+ inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
325
+ name: "campaigns",
326
+ outputs: [
327
+ { internalType: "string", name: "name", type: "string" },
328
+ {
329
+ internalType: "uint256",
330
+ name: "rewardAmount",
331
+ type: "uint256"
332
+ },
333
+ { internalType: "bool", name: "isActive", type: "bool" }
334
+ ],
335
+ stateMutability: "view",
336
+ type: "function"
337
+ },
338
+ {
339
+ inputs: [
340
+ { internalType: "string", name: "_name", type: "string" },
341
+ {
342
+ internalType: "uint256",
343
+ name: "_rewardAmount",
344
+ type: "uint256"
345
+ }
346
+ ],
347
+ name: "createCampaign",
348
+ outputs: [],
349
+ stateMutability: "nonpayable",
350
+ type: "function"
351
+ },
352
+ {
353
+ inputs: [],
354
+ name: "defaultRewardAmount",
355
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
356
+ stateMutability: "view",
357
+ type: "function"
358
+ },
359
+ {
360
+ inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
361
+ name: "getRoleAdmin",
362
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
363
+ stateMutability: "view",
364
+ type: "function"
365
+ },
366
+ {
367
+ inputs: [
368
+ { internalType: "bytes32", name: "role", type: "bytes32" },
369
+ {
370
+ internalType: "address",
371
+ name: "account",
372
+ type: "address"
373
+ }
374
+ ],
375
+ name: "grantRole",
376
+ outputs: [],
377
+ stateMutability: "nonpayable",
378
+ type: "function"
379
+ },
380
+ {
381
+ inputs: [
382
+ { internalType: "bytes32", name: "role", type: "bytes32" },
383
+ {
384
+ internalType: "address",
385
+ name: "account",
386
+ type: "address"
387
+ }
388
+ ],
389
+ name: "hasRole",
390
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
391
+ stateMutability: "view",
392
+ type: "function"
393
+ },
394
+ {
395
+ inputs: [
396
+ {
397
+ internalType: "address",
398
+ name: "initialOwner",
399
+ type: "address"
400
+ },
401
+ {
402
+ internalType: "contract IERC20",
403
+ name: "_rewardToken",
404
+ type: "address"
405
+ },
406
+ {
407
+ internalType: "contract IPetToken",
408
+ name: "_petToken",
409
+ type: "address"
410
+ },
411
+ { internalType: "uint256", name: "_defaultRewardAmount", type: "uint256" }
412
+ ],
413
+ name: "initialize",
414
+ outputs: [],
415
+ stateMutability: "nonpayable",
416
+ type: "function"
417
+ },
418
+ {
419
+ inputs: [],
420
+ name: "pause",
421
+ outputs: [],
422
+ stateMutability: "nonpayable",
423
+ type: "function"
424
+ },
425
+ {
426
+ inputs: [],
427
+ name: "paused",
428
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
429
+ stateMutability: "view",
430
+ type: "function"
431
+ },
432
+ {
433
+ inputs: [],
434
+ name: "petToken",
435
+ outputs: [{ internalType: "contract IPetToken", name: "", type: "address" }],
436
+ stateMutability: "view",
437
+ type: "function"
438
+ },
439
+ {
440
+ inputs: [],
441
+ name: "proxiableUUID",
442
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
443
+ stateMutability: "view",
444
+ type: "function"
445
+ },
446
+ {
447
+ inputs: [
448
+ { internalType: "bytes32", name: "role", type: "bytes32" },
449
+ {
450
+ internalType: "address",
451
+ name: "callerConfirmation",
452
+ type: "address"
453
+ }
454
+ ],
455
+ name: "renounceRole",
456
+ outputs: [],
457
+ stateMutability: "nonpayable",
458
+ type: "function"
459
+ },
460
+ {
461
+ inputs: [
462
+ { internalType: "bytes32", name: "role", type: "bytes32" },
463
+ {
464
+ internalType: "address",
465
+ name: "account",
466
+ type: "address"
467
+ }
468
+ ],
469
+ name: "revokeRole",
470
+ outputs: [],
471
+ stateMutability: "nonpayable",
472
+ type: "function"
473
+ },
474
+ {
475
+ inputs: [],
476
+ name: "rewardToken",
477
+ outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
478
+ stateMutability: "view",
479
+ type: "function"
480
+ },
481
+ {
482
+ inputs: [
483
+ { internalType: "string", name: "_pid", type: "string" },
484
+ {
485
+ internalType: "string",
486
+ name: "_nftId",
487
+ type: "string"
488
+ },
489
+ { internalType: "string", name: "_metadataURL", type: "string" },
490
+ {
491
+ internalType: "uint256",
492
+ name: "_campaignId",
493
+ type: "uint256"
494
+ }
495
+ ],
496
+ name: "submitMetadata",
497
+ outputs: [],
498
+ stateMutability: "nonpayable",
499
+ type: "function"
500
+ },
501
+ {
502
+ inputs: [
503
+ { internalType: "string", name: "_pid", type: "string" },
504
+ {
505
+ internalType: "string",
506
+ name: "_nftId",
507
+ type: "string"
508
+ },
509
+ { internalType: "string", name: "_metadataURL", type: "string" },
510
+ {
511
+ internalType: "string",
512
+ name: "_campaignName",
513
+ type: "string"
514
+ }
515
+ ],
516
+ name: "submitMetadataByCampaignName",
517
+ outputs: [],
518
+ stateMutability: "nonpayable",
519
+ type: "function"
520
+ },
521
+ {
522
+ inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
523
+ name: "supportsInterface",
524
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
525
+ stateMutability: "view",
526
+ type: "function"
527
+ },
528
+ {
529
+ inputs: [],
530
+ name: "unpause",
531
+ outputs: [],
532
+ stateMutability: "nonpayable",
533
+ type: "function"
534
+ },
535
+ {
536
+ inputs: [
537
+ {
538
+ internalType: "uint256",
539
+ name: "_campaignId",
540
+ type: "uint256"
541
+ },
542
+ { internalType: "uint256", name: "_rewardAmount", type: "uint256" },
543
+ {
544
+ internalType: "bool",
545
+ name: "_isActive",
546
+ type: "bool"
547
+ }
548
+ ],
549
+ name: "updateCampaign",
550
+ outputs: [],
551
+ stateMutability: "nonpayable",
552
+ type: "function"
553
+ },
554
+ {
555
+ inputs: [{ internalType: "uint256", name: "_rewardAmount", type: "uint256" }],
556
+ name: "updateDefaultReward",
557
+ outputs: [],
558
+ stateMutability: "nonpayable",
559
+ type: "function"
560
+ },
561
+ {
562
+ inputs: [
563
+ {
564
+ internalType: "address",
565
+ name: "newImplementation",
566
+ type: "address"
567
+ },
568
+ { internalType: "bytes", name: "data", type: "bytes" }
569
+ ],
570
+ name: "upgradeToAndCall",
571
+ outputs: [],
572
+ stateMutability: "payable",
573
+ type: "function"
574
+ }
575
+ ];
32
576
  var VERIFY_ACCOUNT_ABI = [
33
577
  {
34
578
  inputs: [
@@ -85,7 +629,239 @@ function useVerifyAccount() {
85
629
  []
86
630
  );
87
631
  }
632
+
633
+ // src/utils/anymals/useMintAnymalNFT.ts
634
+ var import_viem2 = require("viem");
635
+ var import_react2 = require("react");
636
+ function useMintAnymalNFT() {
637
+ return (0, import_react2.useCallback)(
638
+ async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
639
+ if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
640
+ return {
641
+ success: false,
642
+ message: "Missing authentication token OR NFT ID."
643
+ };
644
+ }
645
+ const callData = (0, import_viem2.encodeFunctionData)({
646
+ abi: PET_NFT_ABI,
647
+ functionName: "submitMetadataByCampaignName",
648
+ args: [
649
+ pid,
650
+ nftId,
651
+ `https://dev-nft.petastic.com/metadata/${nftId}`,
652
+ "petastic-signup-campaign-1"
653
+ ]
654
+ });
655
+ const userOpHash = await bundlerClient.sendUserOperation({
656
+ account: smartAccount,
657
+ calls: [
658
+ {
659
+ to: validationContractAddress,
660
+ data: callData
661
+ }
662
+ ],
663
+ maxPriorityFeePerGas: (0, import_viem2.parseGwei)("0.001"),
664
+ maxFeePerGas: (0, import_viem2.parseGwei)("0.001")
665
+ });
666
+ await bundlerClient.waitForUserOperationReceipt({
667
+ hash: userOpHash
668
+ });
669
+ return { success: true, message: "Pet Passport Created!" };
670
+ },
671
+ []
672
+ );
673
+ }
674
+
675
+ // src/utils/anymals/useAddAnymalToDatabase.ts
676
+ var import_react3 = require("react");
677
+ function useAddAnymalToDatabase() {
678
+ return (0, import_react3.useCallback)(
679
+ async (dbAuthToken, endpoint, anymalData) => {
680
+ if (!dbAuthToken) {
681
+ return {
682
+ success: false,
683
+ message: "Authentication token is missing.",
684
+ _docID: null
685
+ };
686
+ }
687
+ let anymalDocID = null;
688
+ try {
689
+ const mutation = `
690
+ mutation Create_Anymal($input: [AnymalMutationInputArg!]) {
691
+ create_Anymal(input: $input) {
692
+ _docID
693
+ name
694
+ passportID
695
+ }
696
+ }
697
+ `;
698
+ const response = await fetch(endpoint, {
699
+ method: "POST",
700
+ headers: {
701
+ "Content-Type": "application/json",
702
+ Authorization: `Bearer ${dbAuthToken}`
703
+ },
704
+ body: JSON.stringify({
705
+ query: mutation,
706
+ variables: { input: [anymalData] }
707
+ })
708
+ });
709
+ if (!response.ok) {
710
+ throw new Error(
711
+ `Failed to create pet. HTTP status ${response.status}`
712
+ );
713
+ }
714
+ const { data, errors } = await response.json();
715
+ if (errors) {
716
+ const errorMessage = JSON.stringify(errors);
717
+ if (errorMessage.includes("given ID already exists")) {
718
+ console.warn("Duplicate document ID detected.");
719
+ anymalDocID = data?.create_Anymal[0]?._docID || null;
720
+ throw new Error("Document with the given ID already exists.");
721
+ }
722
+ throw new Error(`GraphQL error: ${errorMessage}`);
723
+ }
724
+ anymalDocID = data.create_Anymal[0]._docID;
725
+ return {
726
+ success: true,
727
+ _docID: anymalDocID,
728
+ message: "Anymal added to account"
729
+ };
730
+ } catch (error) {
731
+ return {
732
+ success: false,
733
+ _docID: null,
734
+ message: "Error adding anymal to account"
735
+ };
736
+ }
737
+ },
738
+ []
739
+ );
740
+ }
741
+
742
+ // src/utils/anymals/useDeleteAnymalFromDatabase.ts
743
+ var import_react4 = require("react");
744
+ function useDeleteAnymalFromDatabase() {
745
+ return (0, import_react4.useCallback)(
746
+ async (dbAuthToken, endpoint, anymalDocID) => {
747
+ if (!dbAuthToken || !endpoint || !anymalDocID) return;
748
+ try {
749
+ const mutation = `
750
+ mutation Delete_Anymal($docId: [ID]) {
751
+ delete_Anymal(docID: $docId) {
752
+ _docID
753
+ }
754
+ }
755
+ `;
756
+ const response = await fetch(endpoint, {
757
+ method: "POST",
758
+ headers: {
759
+ "Content-Type": "application/json",
760
+ Authorization: `Bearer ${dbAuthToken}`
761
+ },
762
+ body: JSON.stringify({
763
+ query: mutation,
764
+ variables: { docId: [anymalDocID] }
765
+ })
766
+ });
767
+ if (!response.ok)
768
+ throw new Error(
769
+ `Failed to delete anymal. HTTP status ${response.status}`
770
+ );
771
+ const { errors } = await response.json();
772
+ if (errors) throw new Error(`GraphQL error: ${JSON.stringify(errors)}`);
773
+ } catch (error) {
774
+ console.error("Error deleting anymal from database:", error);
775
+ throw error;
776
+ }
777
+ },
778
+ []
779
+ );
780
+ }
781
+
782
+ // src/utils/anymals/useSaveAnymalMetadata.ts
783
+ var import_react5 = require("react");
784
+ function useSaveAnymalMetadata() {
785
+ return (0, import_react5.useCallback)(
786
+ async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
787
+ const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
788
+ method: "POST",
789
+ headers: {
790
+ "Content-Type": "application/json",
791
+ Authorization: "Bearer " + idToken
792
+ },
793
+ body: JSON.stringify({
794
+ appPubKey: publicKey,
795
+ nftMetadataInput
796
+ })
797
+ });
798
+ const data = await response.json();
799
+ if (data.errors) {
800
+ throw new Error(`GraphQL error: ${JSON.stringify(data.errors)}`);
801
+ }
802
+ return {
803
+ success: true,
804
+ message: data[0]
805
+ };
806
+ },
807
+ []
808
+ );
809
+ }
810
+
811
+ // src/utils/anymals/useUpdateAnymalWithNFT.ts
812
+ var import_react6 = require("react");
813
+ function useUpdateAnymalWithNFT() {
814
+ return (0, import_react6.useCallback)(
815
+ async (anymalPassportId, anymalDocId, dbAuthToken, endpoint) => {
816
+ if (!dbAuthToken || !anymalPassportId || !anymalDocId || !endpoint) {
817
+ return {
818
+ success: false
819
+ };
820
+ }
821
+ try {
822
+ const mutation = `
823
+ mutation {
824
+ update_Anymal(
825
+ docID: [${JSON.stringify(anymalDocId)}],
826
+ input: {
827
+ passportID: "${anymalPassportId}"
828
+ }
829
+ ) {
830
+ passportID
831
+ }
832
+ }
833
+ `;
834
+ const response = await fetch(endpoint, {
835
+ method: "POST",
836
+ headers: {
837
+ "Content-Type": "application/json",
838
+ Authorization: `Bearer ${dbAuthToken}`
839
+ },
840
+ body: JSON.stringify({ query: mutation })
841
+ });
842
+ if (!response.ok) {
843
+ return { success: false };
844
+ }
845
+ const { errors } = await response.json();
846
+ if (errors) {
847
+ console.log(`GQL error: ${JSON.stringify(errors)}`);
848
+ return { success: false };
849
+ }
850
+ return { success: true };
851
+ } catch (error) {
852
+ console.error("Error updating Anymal with NFT ID:", error);
853
+ return { success: false };
854
+ }
855
+ },
856
+ []
857
+ );
858
+ }
88
859
  // Annotate the CommonJS export names for ESM import in node:
89
860
  0 && (module.exports = {
861
+ useAddAnymalToDatabase,
862
+ useDeleteAnymalFromDatabase,
863
+ useMintAnymalNFT,
864
+ useSaveAnymalMetadata,
865
+ useUpdateAnymalWithNFT,
90
866
  useVerifyAccount
91
867
  });