anymal-protocol 1.0.124 → 1.0.125

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
@@ -43,7 +43,6 @@ __export(index_exports, {
43
43
  convertToMultipleActionRecords: () => convertToMultipleActionRecords,
44
44
  createApp: () => createApp,
45
45
  createAuthEnvelope: () => createAuthEnvelope,
46
- fetchAnymals: () => fetchAnymals,
47
46
  flattenFirestoreData: () => flattenFirestoreData,
48
47
  generateAppSignature: () => generateAppSignature,
49
48
  generateBytes32Nonce: () => generateBytes32Nonce,
@@ -58,19 +57,17 @@ __export(index_exports, {
58
57
  sendUserOpWithRetries: () => sendUserOpWithRetries,
59
58
  serializePublicKeyCompressed: () => serializePublicKeyCompressed,
60
59
  submitAction: () => submitAction,
61
- useAddAnymalToDatabase: () => useAddAnymalToDatabase,
62
60
  useApproveKibbleToken: () => useApproveKibbleToken,
63
61
  useApproveOrgPartialPayment: () => useApproveOrgPartialPayment,
64
62
  useClaimActionReward: () => useClaimActionReward,
65
63
  useClaimOrgActionReward: () => useClaimOrgActionReward,
64
+ useCoinbaseMintAnymalNFT: () => useCoinbaseMintAnymalNFT,
66
65
  useCreateOrganizationAppData: () => useCreateOrganizationAppData,
67
66
  useCreateOrganizationBase: () => useCreateOrganizationBase,
68
67
  useCreateUserAppData: () => useCreateUserAppData,
69
68
  useCreateWeb3Account: () => useCreateWeb3Account,
70
- useDeleteAnymalFromDatabase: () => useDeleteAnymalFromDatabase,
71
69
  useFetchActionDefinitions: () => useFetchActionDefinitions,
72
70
  useFetchActions: () => useFetchActions,
73
- useFetchAnymals: () => useFetchAnymals,
74
71
  useFetchBalance: () => useFetchBalance,
75
72
  useFetchNotifications: () => useFetchNotifications,
76
73
  useFetchUserData: () => useFetchUserData,
@@ -81,7 +78,6 @@ __export(index_exports, {
81
78
  useSaveAnymalMetadata: () => useSaveAnymalMetadata,
82
79
  useSendCoinbaseUserOperation: () => useSendCoinbaseUserOperation,
83
80
  useSubmitContractAction: () => useSubmitContractAction,
84
- useUpdateAnymalWithNFT: () => useUpdateAnymalWithNFT,
85
81
  useUpdateOrgWalletAddress: () => useUpdateOrgWalletAddress,
86
82
  useUpdateUserAsVerified: () => useUpdateUserAsVerified,
87
83
  useUpdateUserEmail: () => useUpdateUserEmail,
@@ -495,6 +491,9 @@ function useSendCoinbaseUserOperation() {
495
491
  return { sendOperationFn, data, status, error };
496
492
  }
497
493
 
494
+ // src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
495
+ var import_viem2 = require("viem");
496
+
498
497
  // src/helpers/BlockchainAbiHelper.tsx
499
498
  var import_viem = require("viem");
500
499
  var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
@@ -2926,9 +2925,42 @@ var OZ_ERROR_FRAGMENTS = [
2926
2925
  var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem.parseAbi)([...OZ_ERROR_FRAGMENTS])];
2927
2926
  var ORG_FUNCTION = "executeCall";
2928
2927
 
2929
- // src/utils/anymals/useMintAnymalNFT.ts
2930
- var import_viem3 = require("viem");
2928
+ // src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
2931
2929
  var import_react11 = require("react");
2930
+ function useCoinbaseMintAnymalNFT() {
2931
+ const { sendOperationFn, status } = useSendCoinbaseUserOperation();
2932
+ return (0, import_react11.useCallback)(
2933
+ async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
2934
+ if (!nftId || !pid || !validationContractAddress) {
2935
+ return {
2936
+ success: false,
2937
+ message: "Missing authentication token OR NFT ID.",
2938
+ status: "error"
2939
+ };
2940
+ }
2941
+ const functionName = "submitMetadataByCampaignName";
2942
+ const args = [
2943
+ pid,
2944
+ nftId,
2945
+ `https://dev-nft.petastic.com/metadata/${nftId}`,
2946
+ "petastic-signup-campaign-1",
2947
+ anymalTxId
2948
+ ];
2949
+ const callData = (0, import_viem2.encodeFunctionData)({
2950
+ abi: PET_NFT_ABI,
2951
+ functionName,
2952
+ args
2953
+ });
2954
+ await sendOperationFn(evmAddress, callData, validationContractAddress);
2955
+ return { success: true, message: "Pet Passport Created", status };
2956
+ },
2957
+ []
2958
+ );
2959
+ }
2960
+
2961
+ // src/utils/anymals/useMintAnymalNFT.ts
2962
+ var import_viem4 = require("viem");
2963
+ var import_react12 = require("react");
2932
2964
 
2933
2965
  // src/helpers/GasEstimateHelper.tsx
2934
2966
  async function applyBundlerGasEstimator(account, bundlerClient, options) {
@@ -2972,18 +3004,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
2972
3004
  }
2973
3005
 
2974
3006
  // src/helpers/HumanRevert.tsx
2975
- var import_viem2 = require("viem");
3007
+ var import_viem3 = require("viem");
2976
3008
  function humanRevert(raw, shortMessage) {
2977
3009
  if (!raw) return shortMessage ?? "Simulation reverted";
2978
3010
  try {
2979
- const { errorName, args } = (0, import_viem2.decodeErrorResult)({
3011
+ const { errorName, args } = (0, import_viem3.decodeErrorResult)({
2980
3012
  abi: ERROR_ABI,
2981
3013
  data: raw
2982
3014
  });
2983
3015
  return `${errorName}(${args.map(String).join(", ")})`;
2984
3016
  } catch {
2985
3017
  if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
2986
- return (0, import_viem2.hexToString)(`0x${raw.slice(138)}`);
3018
+ return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
2987
3019
  }
2988
3020
  return `${raw.slice(0, 10)}\u2026`;
2989
3021
  }
@@ -3009,7 +3041,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
3009
3041
 
3010
3042
  // src/utils/anymals/useMintAnymalNFT.ts
3011
3043
  function useMintAnymalNFT() {
3012
- return (0, import_react11.useCallback)(
3044
+ return (0, import_react12.useCallback)(
3013
3045
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
3014
3046
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
3015
3047
  return {
@@ -3025,7 +3057,7 @@ function useMintAnymalNFT() {
3025
3057
  "petastic-signup-campaign-1",
3026
3058
  anymalTxId
3027
3059
  ];
3028
- const callData = (0, import_viem3.encodeFunctionData)({
3060
+ const callData = (0, import_viem4.encodeFunctionData)({
3029
3061
  abi: PET_NFT_ABI,
3030
3062
  functionName,
3031
3063
  args
@@ -3060,126 +3092,11 @@ function useMintAnymalNFT() {
3060
3092
  );
3061
3093
  }
3062
3094
 
3063
- // src/utils/anymals/useAddAnymalToDatabase.ts
3064
- var import_react12 = require("react");
3065
- function useAddAnymalToDatabase() {
3066
- return (0, import_react12.useCallback)(
3067
- async (dbAuthToken, endpoint, anymalData) => {
3068
- if (!dbAuthToken) {
3069
- return {
3070
- success: false,
3071
- message: "Authentication token is missing.",
3072
- _docID: null,
3073
- dbCid: null
3074
- };
3075
- }
3076
- let anymalDocID = null;
3077
- let dbCid = null;
3078
- try {
3079
- const mutation = `
3080
- mutation Create_Anymal($input: [AnymalMutationInputArg!]) {
3081
- create_Anymal(input: $input) {
3082
- _docID
3083
- name
3084
- passportID
3085
- _version {
3086
- cid
3087
- }
3088
- }
3089
- }
3090
- `;
3091
- const response = await fetch(endpoint, {
3092
- method: "POST",
3093
- headers: {
3094
- "Content-Type": "application/json",
3095
- Authorization: `Bearer ${dbAuthToken}`
3096
- },
3097
- body: JSON.stringify({
3098
- query: mutation,
3099
- variables: { input: [anymalData] }
3100
- })
3101
- });
3102
- if (!response.ok) {
3103
- throw new Error(
3104
- `Failed to create pet. HTTP status ${response.status}`
3105
- );
3106
- }
3107
- const { data, errors } = await response.json();
3108
- if (errors) {
3109
- const errorMessage = JSON.stringify(errors);
3110
- if (errorMessage.includes("given ID already exists")) {
3111
- console.warn("Duplicate document ID detected.");
3112
- anymalDocID = data?.create_Anymal[0]?._docID || null;
3113
- throw new Error("Document with the given ID already exists.");
3114
- }
3115
- throw new Error(`GraphQL error: ${errorMessage}`);
3116
- }
3117
- anymalDocID = data.create_Anymal[0]._docID;
3118
- dbCid = data.create_Anymal[0]._version[0].cid;
3119
- return {
3120
- success: true,
3121
- _docID: anymalDocID,
3122
- dbCid,
3123
- message: "Anymal added to account"
3124
- };
3125
- } catch (error) {
3126
- return {
3127
- success: false,
3128
- _docID: null,
3129
- dbCid: null,
3130
- message: "Error adding anymal to account"
3131
- };
3132
- }
3133
- },
3134
- []
3135
- );
3136
- }
3137
-
3138
- // src/utils/anymals/useDeleteAnymalFromDatabase.ts
3139
- var import_react13 = require("react");
3140
- function useDeleteAnymalFromDatabase() {
3141
- return (0, import_react13.useCallback)(
3142
- async (dbAuthToken, endpoint, anymalDocID) => {
3143
- if (!dbAuthToken || !endpoint || !anymalDocID) return;
3144
- try {
3145
- const mutation = `
3146
- mutation Delete_Anymal($docId: [ID]) {
3147
- delete_Anymal(docID: $docId) {
3148
- _docID
3149
- }
3150
- }
3151
- `;
3152
- const response = await fetch(endpoint, {
3153
- method: "POST",
3154
- headers: {
3155
- "Content-Type": "application/json",
3156
- Authorization: `Bearer ${dbAuthToken}`
3157
- },
3158
- body: JSON.stringify({
3159
- query: mutation,
3160
- variables: { docID: [anymalDocID] }
3161
- })
3162
- });
3163
- if (!response.ok)
3164
- throw new Error(
3165
- `Failed to delete anymal. HTTP status ${response.status}`
3166
- );
3167
- const { errors } = await response.json();
3168
- if (errors) throw new Error(`GraphQL error: ${JSON.stringify(errors)}`);
3169
- } catch (error) {
3170
- console.error("Error deleting anymal from database:", error);
3171
- throw error;
3172
- }
3173
- },
3174
- []
3175
- );
3176
- }
3177
-
3178
3095
  // src/utils/anymals/useSaveAnymalMetadata.ts
3179
- var import_react14 = require("react");
3096
+ var import_react13 = require("react");
3180
3097
  function useSaveAnymalMetadata() {
3181
- return (0, import_react14.useCallback)(
3182
- async (userPid, anymalTxId, idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
3098
+ return (0, import_react13.useCallback)(
3099
+ async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
3183
3100
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
3184
3101
  method: "POST",
3185
3102
  headers: {
@@ -3187,7 +3104,6 @@ function useSaveAnymalMetadata() {
3187
3104
  Authorization: "Bearer " + idToken
3188
3105
  },
3189
3106
  body: JSON.stringify({
3190
- appPubKey: publicKey,
3191
3107
  nftMetadataInput,
3192
3108
  pid: userPid,
3193
3109
  anymalTxId
@@ -3206,57 +3122,8 @@ function useSaveAnymalMetadata() {
3206
3122
  );
3207
3123
  }
3208
3124
 
3209
- // src/utils/anymals/useUpdateAnymalWithNFT.ts
3210
- var import_react15 = require("react");
3211
- function useUpdateAnymalWithNFT() {
3212
- return (0, import_react15.useCallback)(
3213
- async (anymalPassportId, anymalDocId, dbAuthToken, endpoint) => {
3214
- if (!dbAuthToken || !anymalPassportId || !anymalDocId || !endpoint) {
3215
- return {
3216
- success: false
3217
- };
3218
- }
3219
- try {
3220
- const mutation = `
3221
- mutation {
3222
- update_Anymal(
3223
- docID: [${JSON.stringify(anymalDocId)}],
3224
- input: {
3225
- passportID: "${anymalPassportId}"
3226
- }
3227
- ) {
3228
- passportID
3229
- }
3230
- }
3231
- `;
3232
- const response = await fetch(endpoint, {
3233
- method: "POST",
3234
- headers: {
3235
- "Content-Type": "application/json",
3236
- Authorization: `Bearer ${dbAuthToken}`
3237
- },
3238
- body: JSON.stringify({ query: mutation })
3239
- });
3240
- if (!response.ok) {
3241
- return { success: false };
3242
- }
3243
- const { errors } = await response.json();
3244
- if (errors) {
3245
- console.log(`GQL error: ${JSON.stringify(errors)}`);
3246
- return { success: false };
3247
- }
3248
- return { success: true };
3249
- } catch (error) {
3250
- console.error("Error updating Anymal with NFT ID:", error);
3251
- return { success: false };
3252
- }
3253
- },
3254
- []
3255
- );
3256
- }
3257
-
3258
3125
  // src/utils/anymals/useUploadAnymalImage.ts
3259
- var import_react16 = require("react");
3126
+ var import_react14 = require("react");
3260
3127
 
3261
3128
  // src/helpers/UploadImageHelper.tsx
3262
3129
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -3313,8 +3180,8 @@ function toBase64(file) {
3313
3180
 
3314
3181
  // src/utils/anymals/useUploadAnymalImage.ts
3315
3182
  function useUploadAnymalImage() {
3316
- return (0, import_react16.useCallback)(
3317
- async (imageFile, type, idToken, publicKey, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3183
+ return (0, import_react14.useCallback)(
3184
+ async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3318
3185
  if (!imageFile || !idToken) {
3319
3186
  return {
3320
3187
  success: false,
@@ -3326,7 +3193,6 @@ function useUploadAnymalImage() {
3326
3193
  try {
3327
3194
  const base64Image = await prepareImage(imageFile);
3328
3195
  const payload = {
3329
- appPubKey: publicKey,
3330
3196
  imageData: base64Image,
3331
3197
  imageName: imageFile.name.split(".")[0],
3332
3198
  petType,
@@ -3374,68 +3240,11 @@ function useUploadAnymalImage() {
3374
3240
  );
3375
3241
  }
3376
3242
 
3377
- // src/utils/anymals/useFetchAnymals.ts
3378
- var import_react17 = require("react");
3379
-
3380
- // src/utils/anymals/fetchAnymals.ts
3381
- async function fetchAnymals({
3382
- dbAuthToken,
3383
- endpoint,
3384
- userPid
3385
- }) {
3386
- const query = `
3387
- query Anymal($filter: AnymalFilterArg, $order: [AnymalOrderArg]) {
3388
- Anymal(filter: $filter, order: $order) {
3389
- _docID
3390
- name
3391
- breed
3392
- passportID
3393
- profileImageUrl
3394
- caregiverNearId
3395
- caregiverId
3396
- lifestage
3397
- gender
3398
- petType
3399
- products
3400
- timeAddedUtc
3401
- }
3402
- }
3403
- `;
3404
- const variables = {
3405
- filter: {
3406
- caregiverId: { _eq: userPid }
3407
- },
3408
- order: [
3409
- {
3410
- timeAddedUtc: "ASC"
3411
- }
3412
- ]
3413
- };
3414
- const response = await fetch(endpoint, {
3415
- method: "POST",
3416
- headers: {
3417
- "Content-Type": "application/json",
3418
- Authorization: `Bearer ${dbAuthToken}`
3419
- },
3420
- body: JSON.stringify({ query, variables })
3421
- });
3422
- if (!response.ok) {
3423
- throw new Error(`HTTP error! Status: ${response.status}`);
3424
- }
3425
- const data = await response.json();
3426
- return data?.data?.Anymal ?? [];
3427
- }
3428
-
3429
- // src/utils/anymals/useFetchAnymals.ts
3430
- function useFetchAnymals() {
3431
- return (0, import_react17.useCallback)(fetchAnymals, []);
3432
- }
3433
-
3434
3243
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3435
- var import_react18 = require("react");
3244
+ var import_react15 = require("react");
3436
3245
 
3437
3246
  // src/helpers/ProcessDirectPartialPayment.tsx
3438
- var import_viem4 = require("viem");
3247
+ var import_viem5 = require("viem");
3439
3248
 
3440
3249
  // src/helpers/SendUserOpWithRetries.tsx
3441
3250
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3495,7 +3304,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3495
3304
  deadline,
3496
3305
  backendSignature
3497
3306
  ];
3498
- const partialPayCalldata = (0, import_viem4.encodeFunctionData)({
3307
+ const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
3499
3308
  abi: MARKETPLACE_ABI,
3500
3309
  functionName,
3501
3310
  args
@@ -3532,7 +3341,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3532
3341
 
3533
3342
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3534
3343
  function useProcessPartialKibblePayment() {
3535
- return (0, import_react18.useCallback)(
3344
+ return (0, import_react15.useCallback)(
3536
3345
  async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3537
3346
  if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
3538
3347
  return {
@@ -3588,23 +3397,23 @@ function useProcessPartialKibblePayment() {
3588
3397
  }
3589
3398
 
3590
3399
  // src/utils/marketplace/useApproveKibbleToken.ts
3591
- var import_react19 = require("react");
3400
+ var import_react16 = require("react");
3592
3401
 
3593
3402
  // src/helpers/ProcessDirectKibbleApproval.tsx
3594
- var import_viem5 = require("viem");
3403
+ var import_viem6 = require("viem");
3595
3404
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3596
3405
  try {
3597
3406
  const functionName = "approve";
3598
3407
  const args = [spenderAddress, approveAmount];
3599
- const approveCalldata = (0, import_viem5.encodeFunctionData)({
3600
- abi: import_viem5.erc20Abi,
3408
+ const approveCalldata = (0, import_viem6.encodeFunctionData)({
3409
+ abi: import_viem6.erc20Abi,
3601
3410
  functionName,
3602
3411
  args
3603
3412
  });
3604
3413
  await simulateCall(
3605
3414
  bundlerClient.client,
3606
3415
  kibbleTokenAddress,
3607
- import_viem5.erc20Abi,
3416
+ import_viem6.erc20Abi,
3608
3417
  functionName,
3609
3418
  args,
3610
3419
  smartAccount.address
@@ -3633,7 +3442,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
3633
3442
 
3634
3443
  // src/utils/marketplace/useApproveKibbleToken.ts
3635
3444
  function useApproveKibbleToken() {
3636
- return (0, import_react19.useCallback)(
3445
+ return (0, import_react16.useCallback)(
3637
3446
  async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
3638
3447
  try {
3639
3448
  const result = await processDirectKibbleApproval(
@@ -3660,10 +3469,10 @@ function useApproveKibbleToken() {
3660
3469
  }
3661
3470
 
3662
3471
  // src/utils/organization/useCreateOrganizationBase.ts
3663
- var import_react20 = require("react");
3664
- var import_viem6 = require("viem");
3472
+ var import_react17 = require("react");
3473
+ var import_viem7 = require("viem");
3665
3474
  function useCreateOrganizationBase() {
3666
- return (0, import_react20.useCallback)(
3475
+ return (0, import_react17.useCallback)(
3667
3476
  /**
3668
3477
  * Creates a new organization on-chain.
3669
3478
  *
@@ -3685,7 +3494,7 @@ function useCreateOrganizationBase() {
3685
3494
  try {
3686
3495
  const functionName = "createOrganizationProxy";
3687
3496
  const args = [ownerAddress, orgName, orgPid];
3688
- const callData = (0, import_viem6.encodeFunctionData)({
3497
+ const callData = (0, import_viem7.encodeFunctionData)({
3689
3498
  abi: ORGANIZATION_BEACON_ABI,
3690
3499
  functionName,
3691
3500
  args
@@ -3723,7 +3532,7 @@ function useCreateOrganizationBase() {
3723
3532
  let proxyAddress;
3724
3533
  for (const log of txReceipt.logs) {
3725
3534
  try {
3726
- const decoded = (0, import_viem6.decodeEventLog)({
3535
+ const decoded = (0, import_viem7.decodeEventLog)({
3727
3536
  abi: ORGANIZATION_BEACON_ABI,
3728
3537
  data: log.data,
3729
3538
  topics: log.topics
@@ -3759,13 +3568,13 @@ function useCreateOrganizationBase() {
3759
3568
  }
3760
3569
 
3761
3570
  // src/utils/organization/useApproveOrgKibbleToken.ts
3762
- var import_react21 = require("react");
3571
+ var import_react18 = require("react");
3763
3572
 
3764
3573
  // src/helpers/ProcessOrgKibbleApproval.tsx
3765
- var import_viem8 = require("viem");
3574
+ var import_viem9 = require("viem");
3766
3575
 
3767
3576
  // src/helpers/WaitForAllowance.tsx
3768
- var import_viem7 = require("viem");
3577
+ var import_viem8 = require("viem");
3769
3578
  async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
3770
3579
  const MAX_RETRIES = 10;
3771
3580
  const RETRY_INTERVAL = 2e3;
@@ -3774,7 +3583,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
3774
3583
  try {
3775
3584
  const currentAllowance = await publicClient.readContract({
3776
3585
  address: tokenAddress,
3777
- abi: import_viem7.erc20Abi,
3586
+ abi: import_viem8.erc20Abi,
3778
3587
  functionName: "allowance",
3779
3588
  args: [ownerAddress, spenderAddress]
3780
3589
  });
@@ -3799,13 +3608,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3799
3608
  if (approveAmount <= 0n) {
3800
3609
  return { success: false, message: "Approval amount must be greater than zero." };
3801
3610
  }
3802
- const approveCalldata = (0, import_viem8.encodeFunctionData)({
3803
- abi: import_viem8.erc20Abi,
3611
+ const approveCalldata = (0, import_viem9.encodeFunctionData)({
3612
+ abi: import_viem9.erc20Abi,
3804
3613
  functionName: "approve",
3805
3614
  args: [partialPaymentModuleAddress, approveAmount]
3806
3615
  });
3807
3616
  const args = [kibbleTokenAddress, approveCalldata];
3808
- const executeApproveCalldata = (0, import_viem8.encodeFunctionData)({
3617
+ const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
3809
3618
  abi: ORGANIZATION_IMPL_ABI,
3810
3619
  functionName: ORG_FUNCTION,
3811
3620
  args
@@ -3857,7 +3666,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3857
3666
 
3858
3667
  // src/utils/organization/useApproveOrgKibbleToken.ts
3859
3668
  function useApproveOrgPartialPayment() {
3860
- return (0, import_react21.useCallback)(
3669
+ return (0, import_react18.useCallback)(
3861
3670
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
3862
3671
  if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
3863
3672
  return {
@@ -3889,13 +3698,13 @@ function useApproveOrgPartialPayment() {
3889
3698
  }
3890
3699
 
3891
3700
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3892
- var import_react22 = require("react");
3701
+ var import_react19 = require("react");
3893
3702
 
3894
3703
  // src/helpers/ProcessOrgPartialPayment.tsx
3895
- var import_viem9 = require("viem");
3704
+ var import_viem10 = require("viem");
3896
3705
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3897
3706
  try {
3898
- const partialPayCalldata = (0, import_viem9.encodeFunctionData)({
3707
+ const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
3899
3708
  abi: MARKETPLACE_ABI,
3900
3709
  functionName: "partialPay",
3901
3710
  args: [
@@ -3910,7 +3719,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3910
3719
  ]
3911
3720
  });
3912
3721
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3913
- const executePartialPayCalldata = (0, import_viem9.encodeFunctionData)({
3722
+ const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
3914
3723
  abi: ORGANIZATION_IMPL_ABI,
3915
3724
  functionName: ORG_FUNCTION,
3916
3725
  args
@@ -3947,7 +3756,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3947
3756
 
3948
3757
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3949
3758
  function useProcessOrgPartialKibblePayment() {
3950
- return (0, import_react22.useCallback)(
3759
+ return (0, import_react19.useCallback)(
3951
3760
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3952
3761
  if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
3953
3762
  return {
@@ -3985,9 +3794,9 @@ function useProcessOrgPartialKibblePayment() {
3985
3794
  }
3986
3795
 
3987
3796
  // src/utils/organization/useUpdateOrgWalletAddress.ts
3988
- var import_react23 = require("react");
3797
+ var import_react20 = require("react");
3989
3798
  function useUpdateOrgWalletAddress() {
3990
- return (0, import_react23.useCallback)(
3799
+ return (0, import_react20.useCallback)(
3991
3800
  async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
3992
3801
  try {
3993
3802
  const mutation = `
@@ -4026,10 +3835,10 @@ function useUpdateOrgWalletAddress() {
4026
3835
  }
4027
3836
 
4028
3837
  // src/utils/organization/useMintOrgAnymalNFT.ts
4029
- var import_viem10 = require("viem");
4030
- var import_react24 = require("react");
3838
+ var import_viem11 = require("viem");
3839
+ var import_react21 = require("react");
4031
3840
  function useMintOrgAnymalNFT() {
4032
- return (0, import_react24.useCallback)(
3841
+ return (0, import_react21.useCallback)(
4033
3842
  async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
4034
3843
  if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
4035
3844
  return {
@@ -4045,13 +3854,13 @@ function useMintOrgAnymalNFT() {
4045
3854
  "petastic-signup-campaign-1",
4046
3855
  anymalTxId
4047
3856
  ];
4048
- const callData = (0, import_viem10.encodeFunctionData)({
3857
+ const callData = (0, import_viem11.encodeFunctionData)({
4049
3858
  abi: PET_NFT_ABI,
4050
3859
  functionName,
4051
3860
  args
4052
3861
  });
4053
3862
  const executeArgs = [validationContractAddress, callData];
4054
- const executeSubmitMetaCalldata = (0, import_viem10.encodeFunctionData)({
3863
+ const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
4055
3864
  abi: ORGANIZATION_IMPL_ABI,
4056
3865
  functionName: ORG_FUNCTION,
4057
3866
  args: executeArgs
@@ -4079,10 +3888,10 @@ function useMintOrgAnymalNFT() {
4079
3888
 
4080
3889
  // src/helpers/NonceHelper.tsx
4081
3890
  var import_uuid = require("uuid");
4082
- var import_viem11 = require("viem");
3891
+ var import_viem12 = require("viem");
4083
3892
  var generateBytes32Nonce = () => {
4084
3893
  const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
4085
- return (0, import_viem11.padHex)(`0x${uuid3}`, { size: 32 });
3894
+ return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
4086
3895
  };
4087
3896
 
4088
3897
  // src/helpers/CryptoUtils.tsx
@@ -4292,9 +4101,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
4292
4101
  }
4293
4102
 
4294
4103
  // src/utils/actions/useFetchActions.ts
4295
- var import_react25 = require("react");
4104
+ var import_react22 = require("react");
4296
4105
  function useFetchActions() {
4297
- return (0, import_react25.useCallback)(
4106
+ return (0, import_react22.useCallback)(
4298
4107
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
4299
4108
  const params = new URLSearchParams({ pid });
4300
4109
  if (status) params.set("status", status);
@@ -4323,9 +4132,9 @@ function useFetchActions() {
4323
4132
  }
4324
4133
 
4325
4134
  // src/utils/actions/useFetchActionDefinitions.ts
4326
- var import_react26 = require("react");
4135
+ var import_react23 = require("react");
4327
4136
  function useFetchActionDefinitions() {
4328
- return (0, import_react26.useCallback)(
4137
+ return (0, import_react23.useCallback)(
4329
4138
  async (idToken, actionsServiceBaseUrl) => {
4330
4139
  try {
4331
4140
  const response = await fetch(
@@ -4422,10 +4231,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
4422
4231
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
4423
4232
 
4424
4233
  // src/utils/application/useCreateUserAppData.ts
4425
- var import_react27 = require("react");
4234
+ var import_react24 = require("react");
4426
4235
  var import_uuid2 = require("uuid");
4427
4236
  function useCreateUserAppData() {
4428
- return (0, import_react27.useCallback)(
4237
+ return (0, import_react24.useCallback)(
4429
4238
  async (appId, pid, dbAuthToken, endpoint) => {
4430
4239
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4431
4240
  const appValues = {
@@ -4480,10 +4289,10 @@ function useCreateUserAppData() {
4480
4289
  }
4481
4290
 
4482
4291
  // src/utils/application/useCreateOrganizationAppData.ts
4483
- var import_react28 = require("react");
4292
+ var import_react25 = require("react");
4484
4293
  var import_uuid3 = require("uuid");
4485
4294
  function useCreateOrganizationAppData() {
4486
- return (0, import_react28.useCallback)(
4295
+ return (0, import_react25.useCallback)(
4487
4296
  async (appId, pid, dbAuthToken, endpoint) => {
4488
4297
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4489
4298
  const appValues = {
@@ -4537,17 +4346,17 @@ function useCreateOrganizationAppData() {
4537
4346
  }
4538
4347
 
4539
4348
  // src/utils/balance/useFetchBalance.ts
4540
- var import_react29 = require("react");
4541
- var import_viem12 = require("viem");
4349
+ var import_react26 = require("react");
4350
+ var import_viem13 = require("viem");
4542
4351
  function useFetchBalance() {
4543
- return (0, import_react29.useCallback)(
4352
+ return (0, import_react26.useCallback)(
4544
4353
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4545
4354
  try {
4546
4355
  const balance = await publicClient.readContract({
4547
- address: (0, import_viem12.getAddress)(kibbleTokenAddress),
4548
- abi: import_viem12.erc20Abi,
4356
+ address: (0, import_viem13.getAddress)(kibbleTokenAddress),
4357
+ abi: import_viem13.erc20Abi,
4549
4358
  functionName: "balanceOf",
4550
- args: [(0, import_viem12.getAddress)(walletAddress)]
4359
+ args: [(0, import_viem13.getAddress)(walletAddress)]
4551
4360
  });
4552
4361
  return Number(balance);
4553
4362
  } catch (error) {
@@ -4559,10 +4368,10 @@ function useFetchBalance() {
4559
4368
  }
4560
4369
 
4561
4370
  // src/utils/actions/useClaimActionReward.ts
4562
- var import_viem13 = require("viem");
4563
- var import_react30 = require("react");
4371
+ var import_viem14 = require("viem");
4372
+ var import_react27 = require("react");
4564
4373
  function useClaimActionReward() {
4565
- return (0, import_react30.useCallback)(
4374
+ return (0, import_react27.useCallback)(
4566
4375
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
4567
4376
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
4568
4377
  return {
@@ -4572,7 +4381,7 @@ function useClaimActionReward() {
4572
4381
  }
4573
4382
  const args = [actionId, claimIndex];
4574
4383
  const functionName = "claimByIndex";
4575
- const callData = (0, import_viem13.encodeFunctionData)({
4384
+ const callData = (0, import_viem14.encodeFunctionData)({
4576
4385
  abi: REWARDABLE_ACTIONS_ABI,
4577
4386
  functionName,
4578
4387
  args
@@ -4608,10 +4417,10 @@ function useClaimActionReward() {
4608
4417
  }
4609
4418
 
4610
4419
  // src/utils/actions/useClaimOrgActionReward.ts
4611
- var import_viem14 = require("viem");
4612
- var import_react31 = require("react");
4420
+ var import_viem15 = require("viem");
4421
+ var import_react28 = require("react");
4613
4422
  function useClaimOrgActionReward() {
4614
- return (0, import_react31.useCallback)(
4423
+ return (0, import_react28.useCallback)(
4615
4424
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
4616
4425
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
4617
4426
  return {
@@ -4619,13 +4428,13 @@ function useClaimOrgActionReward() {
4619
4428
  message: "Missing web3auth account info or contract address."
4620
4429
  };
4621
4430
  }
4622
- const claimCallData = (0, import_viem14.encodeFunctionData)({
4431
+ const claimCallData = (0, import_viem15.encodeFunctionData)({
4623
4432
  abi: REWARDABLE_ACTIONS_ABI,
4624
4433
  functionName: "claimByIndex",
4625
4434
  args: [actionId, claimIndex]
4626
4435
  });
4627
4436
  const args = [rewardableActionContractAddress, claimCallData];
4628
- const executeClaimCalldata = (0, import_viem14.encodeFunctionData)({
4437
+ const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
4629
4438
  abi: ORGANIZATION_IMPL_ABI,
4630
4439
  functionName: ORG_FUNCTION,
4631
4440
  args
@@ -4661,9 +4470,9 @@ function useClaimOrgActionReward() {
4661
4470
  }
4662
4471
 
4663
4472
  // src/utils/actions/useSubmitContractAction.ts
4664
- var import_react32 = require("react");
4473
+ var import_react29 = require("react");
4665
4474
  function useSubmitContractAction() {
4666
- return (0, import_react32.useCallback)(
4475
+ return (0, import_react29.useCallback)(
4667
4476
  (idToken, pid, source, endpoint, payload) => {
4668
4477
  if (!idToken || !pid || !source || !endpoint || !payload) return;
4669
4478
  let sourceTypePayload = {};
@@ -4803,7 +4612,6 @@ function isMarketplacePurchaseAction(payload) {
4803
4612
  convertToMultipleActionRecords,
4804
4613
  createApp,
4805
4614
  createAuthEnvelope,
4806
- fetchAnymals,
4807
4615
  flattenFirestoreData,
4808
4616
  generateAppSignature,
4809
4617
  generateBytes32Nonce,
@@ -4818,19 +4626,17 @@ function isMarketplacePurchaseAction(payload) {
4818
4626
  sendUserOpWithRetries,
4819
4627
  serializePublicKeyCompressed,
4820
4628
  submitAction,
4821
- useAddAnymalToDatabase,
4822
4629
  useApproveKibbleToken,
4823
4630
  useApproveOrgPartialPayment,
4824
4631
  useClaimActionReward,
4825
4632
  useClaimOrgActionReward,
4633
+ useCoinbaseMintAnymalNFT,
4826
4634
  useCreateOrganizationAppData,
4827
4635
  useCreateOrganizationBase,
4828
4636
  useCreateUserAppData,
4829
4637
  useCreateWeb3Account,
4830
- useDeleteAnymalFromDatabase,
4831
4638
  useFetchActionDefinitions,
4832
4639
  useFetchActions,
4833
- useFetchAnymals,
4834
4640
  useFetchBalance,
4835
4641
  useFetchNotifications,
4836
4642
  useFetchUserData,
@@ -4841,7 +4647,6 @@ function isMarketplacePurchaseAction(payload) {
4841
4647
  useSaveAnymalMetadata,
4842
4648
  useSendCoinbaseUserOperation,
4843
4649
  useSubmitContractAction,
4844
- useUpdateAnymalWithNFT,
4845
4650
  useUpdateOrgWalletAddress,
4846
4651
  useUpdateUserAsVerified,
4847
4652
  useUpdateUserEmail,