anymal-protocol 1.0.131 → 1.0.132

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
@@ -54,7 +54,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
54
54
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
55
55
 
56
56
  declare function useSendCoinbaseUserOperation(): {
57
- sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}`) => Promise<{
57
+ sendOperationFn: (evmAddress: `0x${string}`, contractAddress: `0x${string}`, abi: any, functionName: string, args: any[]) => Promise<{
58
58
  success: boolean;
59
59
  message: string;
60
60
  }>;
package/dist/index.d.ts CHANGED
@@ -54,7 +54,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
54
54
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
55
55
 
56
56
  declare function useSendCoinbaseUserOperation(): {
57
- sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}`) => Promise<{
57
+ sendOperationFn: (evmAddress: `0x${string}`, contractAddress: `0x${string}`, abi: any, functionName: string, args: any[]) => Promise<{
58
58
  success: boolean;
59
59
  message: string;
60
60
  }>;
package/dist/index.js CHANGED
@@ -471,30 +471,40 @@ var import_viem = require("viem");
471
471
  var import_chains = require("viem/chains");
472
472
  function useSendCoinbaseUserOperation() {
473
473
  const { sendUserOperation, data, error, status } = (0, import_cdp_hooks.useSendUserOperation)();
474
+ const publicClient = (0, import_react10.useMemo)(
475
+ () => (0, import_viem.createPublicClient)({
476
+ chain: import_chains.baseSepolia,
477
+ transport: (0, import_viem.http)()
478
+ }),
479
+ []
480
+ );
474
481
  const sendOperationFn = (0, import_react10.useCallback)(
475
- async (evmAddress, callData, contractAddress) => {
476
- if (!evmAddress || !callData || !contractAddress) {
482
+ async (evmAddress, contractAddress, abi, functionName, args) => {
483
+ if (!evmAddress || !contractAddress || !abi || !functionName) {
477
484
  return { success: false, message: "Missing required information" };
478
485
  }
479
- const publicClient = (0, import_viem.createPublicClient)({
480
- chain: import_chains.baseSepolia,
481
- transport: (0, import_viem.http)()
482
- });
483
486
  try {
484
- const result = await publicClient.call({
485
- account: evmAddress,
486
- to: contractAddress,
487
- data: callData
487
+ await publicClient.simulateContract({
488
+ address: contractAddress,
489
+ abi,
490
+ functionName,
491
+ args,
492
+ account: evmAddress
488
493
  });
489
- console.log("Simulation successful:", result);
494
+ console.log("\u2705 Simulation successful");
490
495
  } catch (simError) {
491
- console.error("Simulation failed:", simError);
496
+ console.error("\u274C Simulation failed:", simError);
492
497
  return {
493
498
  success: false,
494
- message: `Simulation failed: ${simError.message}`
499
+ message: `Simulation failed: ${simError.shortMessage || simError.message}`
495
500
  };
496
501
  }
497
502
  try {
503
+ const callData = (0, import_viem.encodeFunctionData)({
504
+ abi,
505
+ functionName,
506
+ args
507
+ });
498
508
  await sendUserOperation({
499
509
  evmSmartAccount: evmAddress,
500
510
  network: "base-sepolia",
@@ -503,18 +513,15 @@ function useSendCoinbaseUserOperation() {
503
513
  });
504
514
  return { success: true, message: "Operation submitted." };
505
515
  } catch (e) {
506
- console.error("Full error:", e);
516
+ console.error("\u274C Operation failed:", e);
507
517
  return { success: false, message: e.message };
508
518
  }
509
519
  },
510
- [sendUserOperation]
520
+ [sendUserOperation, publicClient]
511
521
  );
512
522
  return { sendOperationFn, data, status, error };
513
523
  }
514
524
 
515
- // src/utils/coinbase/useCoinbaseClaimActionReward.ts
516
- var import_viem3 = require("viem");
517
-
518
525
  // src/helpers/BlockchainAbiHelper.tsx
519
526
  var import_viem2 = require("viem");
520
527
  var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
@@ -2959,35 +2966,20 @@ function useCoinbaseClaimActionReward() {
2959
2966
  status: "error"
2960
2967
  };
2961
2968
  }
2962
- try {
2963
- const args = [actionId, claimIndex];
2964
- const functionName = "claimByIndex";
2965
- const callData = (0, import_viem3.encodeFunctionData)({
2966
- abi: REWARDABLE_ACTIONS_ABI,
2967
- functionName,
2968
- args
2969
- });
2970
- const opsRes = await sendOperationFn(
2971
- evmAddress,
2972
- callData,
2973
- validationContractAddress
2974
- );
2975
- return { success: opsRes.success, message: opsRes.message, status };
2976
- } catch (error) {
2977
- console.error(error);
2978
- return {
2979
- success: false,
2980
- message: "Reward not claimed",
2981
- status: "error"
2982
- };
2983
- }
2969
+ const result = await sendOperationFn(
2970
+ evmAddress,
2971
+ validationContractAddress,
2972
+ REWARDABLE_ACTIONS_ABI,
2973
+ "claimByIndex",
2974
+ [actionId, claimIndex]
2975
+ );
2976
+ return { ...result, status };
2984
2977
  },
2985
- []
2978
+ [sendOperationFn, status]
2986
2979
  );
2987
2980
  }
2988
2981
 
2989
2982
  // src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
2990
- var import_viem4 = require("viem");
2991
2983
  var import_react12 = require("react");
2992
2984
  function useCoinbaseMintAnymalNFT() {
2993
2985
  const { sendOperationFn, status } = useSendCoinbaseUserOperation();
@@ -3000,37 +2992,27 @@ function useCoinbaseMintAnymalNFT() {
3000
2992
  status: "error"
3001
2993
  };
3002
2994
  }
3003
- try {
3004
- const functionName = "submitMetadataByCampaignName";
3005
- const args = [
2995
+ const result = await sendOperationFn(
2996
+ evmAddress,
2997
+ validationContractAddress,
2998
+ PET_NFT_ABI,
2999
+ "submitMetadataByCampaignName",
3000
+ [
3006
3001
  pid,
3007
3002
  nftId,
3008
3003
  `https://dev-nft.petastic.com/metadata/${nftId}`,
3009
3004
  "petastic-signup-campaign-1",
3010
3005
  anymalTxId
3011
- ];
3012
- const callData = (0, import_viem4.encodeFunctionData)({
3013
- abi: PET_NFT_ABI,
3014
- functionName,
3015
- args
3016
- });
3017
- const opsRes = await sendOperationFn(
3018
- evmAddress,
3019
- callData,
3020
- validationContractAddress
3021
- );
3022
- return { success: opsRes.success, message: opsRes.message, status };
3023
- } catch (error) {
3024
- console.error(error);
3025
- return { success: false, message: "Error", status: "error" };
3026
- }
3006
+ ]
3007
+ );
3008
+ return { ...result, status };
3027
3009
  },
3028
- []
3010
+ [sendOperationFn, status]
3029
3011
  );
3030
3012
  }
3031
3013
 
3032
3014
  // src/utils/anymals/useMintAnymalNFT.ts
3033
- var import_viem6 = require("viem");
3015
+ var import_viem4 = require("viem");
3034
3016
  var import_react13 = require("react");
3035
3017
 
3036
3018
  // src/helpers/GasEstimateHelper.tsx
@@ -3075,18 +3057,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
3075
3057
  }
3076
3058
 
3077
3059
  // src/helpers/HumanRevert.tsx
3078
- var import_viem5 = require("viem");
3060
+ var import_viem3 = require("viem");
3079
3061
  function humanRevert(raw, shortMessage) {
3080
3062
  if (!raw) return shortMessage ?? "Simulation reverted";
3081
3063
  try {
3082
- const { errorName, args } = (0, import_viem5.decodeErrorResult)({
3064
+ const { errorName, args } = (0, import_viem3.decodeErrorResult)({
3083
3065
  abi: ERROR_ABI,
3084
3066
  data: raw
3085
3067
  });
3086
3068
  return `${errorName}(${args.map(String).join(", ")})`;
3087
3069
  } catch {
3088
3070
  if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
3089
- return (0, import_viem5.hexToString)(`0x${raw.slice(138)}`);
3071
+ return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
3090
3072
  }
3091
3073
  return `${raw.slice(0, 10)}\u2026`;
3092
3074
  }
@@ -3128,7 +3110,7 @@ function useMintAnymalNFT() {
3128
3110
  "petastic-signup-campaign-1",
3129
3111
  anymalTxId
3130
3112
  ];
3131
- const callData = (0, import_viem6.encodeFunctionData)({
3113
+ const callData = (0, import_viem4.encodeFunctionData)({
3132
3114
  abi: PET_NFT_ABI,
3133
3115
  functionName,
3134
3116
  args
@@ -3315,7 +3297,7 @@ function useUploadAnymalImage() {
3315
3297
  var import_react16 = require("react");
3316
3298
 
3317
3299
  // src/helpers/ProcessDirectPartialPayment.tsx
3318
- var import_viem7 = require("viem");
3300
+ var import_viem5 = require("viem");
3319
3301
 
3320
3302
  // src/helpers/SendUserOpWithRetries.tsx
3321
3303
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3375,7 +3357,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3375
3357
  deadline,
3376
3358
  backendSignature
3377
3359
  ];
3378
- const partialPayCalldata = (0, import_viem7.encodeFunctionData)({
3360
+ const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
3379
3361
  abi: MARKETPLACE_ABI,
3380
3362
  functionName,
3381
3363
  args
@@ -3471,20 +3453,20 @@ function useProcessPartialKibblePayment() {
3471
3453
  var import_react17 = require("react");
3472
3454
 
3473
3455
  // src/helpers/ProcessDirectKibbleApproval.tsx
3474
- var import_viem8 = require("viem");
3456
+ var import_viem6 = require("viem");
3475
3457
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3476
3458
  try {
3477
3459
  const functionName = "approve";
3478
3460
  const args = [spenderAddress, approveAmount];
3479
- const approveCalldata = (0, import_viem8.encodeFunctionData)({
3480
- abi: import_viem8.erc20Abi,
3461
+ const approveCalldata = (0, import_viem6.encodeFunctionData)({
3462
+ abi: import_viem6.erc20Abi,
3481
3463
  functionName,
3482
3464
  args
3483
3465
  });
3484
3466
  await simulateCall(
3485
3467
  bundlerClient.client,
3486
3468
  kibbleTokenAddress,
3487
- import_viem8.erc20Abi,
3469
+ import_viem6.erc20Abi,
3488
3470
  functionName,
3489
3471
  args,
3490
3472
  smartAccount.address
@@ -3541,7 +3523,7 @@ function useApproveKibbleToken() {
3541
3523
 
3542
3524
  // src/utils/organization/useCreateOrganizationBase.ts
3543
3525
  var import_react18 = require("react");
3544
- var import_viem9 = require("viem");
3526
+ var import_viem7 = require("viem");
3545
3527
  function useCreateOrganizationBase() {
3546
3528
  return (0, import_react18.useCallback)(
3547
3529
  /**
@@ -3565,7 +3547,7 @@ function useCreateOrganizationBase() {
3565
3547
  try {
3566
3548
  const functionName = "createOrganizationProxy";
3567
3549
  const args = [ownerAddress, orgName, orgPid];
3568
- const callData = (0, import_viem9.encodeFunctionData)({
3550
+ const callData = (0, import_viem7.encodeFunctionData)({
3569
3551
  abi: ORGANIZATION_BEACON_ABI,
3570
3552
  functionName,
3571
3553
  args
@@ -3603,7 +3585,7 @@ function useCreateOrganizationBase() {
3603
3585
  let proxyAddress;
3604
3586
  for (const log of txReceipt.logs) {
3605
3587
  try {
3606
- const decoded = (0, import_viem9.decodeEventLog)({
3588
+ const decoded = (0, import_viem7.decodeEventLog)({
3607
3589
  abi: ORGANIZATION_BEACON_ABI,
3608
3590
  data: log.data,
3609
3591
  topics: log.topics
@@ -3642,10 +3624,10 @@ function useCreateOrganizationBase() {
3642
3624
  var import_react19 = require("react");
3643
3625
 
3644
3626
  // src/helpers/ProcessOrgKibbleApproval.tsx
3645
- var import_viem11 = require("viem");
3627
+ var import_viem9 = require("viem");
3646
3628
 
3647
3629
  // src/helpers/WaitForAllowance.tsx
3648
- var import_viem10 = require("viem");
3630
+ var import_viem8 = require("viem");
3649
3631
  async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
3650
3632
  const MAX_RETRIES = 10;
3651
3633
  const RETRY_INTERVAL = 2e3;
@@ -3654,7 +3636,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
3654
3636
  try {
3655
3637
  const currentAllowance = await publicClient.readContract({
3656
3638
  address: tokenAddress,
3657
- abi: import_viem10.erc20Abi,
3639
+ abi: import_viem8.erc20Abi,
3658
3640
  functionName: "allowance",
3659
3641
  args: [ownerAddress, spenderAddress]
3660
3642
  });
@@ -3679,13 +3661,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3679
3661
  if (approveAmount <= 0n) {
3680
3662
  return { success: false, message: "Approval amount must be greater than zero." };
3681
3663
  }
3682
- const approveCalldata = (0, import_viem11.encodeFunctionData)({
3683
- abi: import_viem11.erc20Abi,
3664
+ const approveCalldata = (0, import_viem9.encodeFunctionData)({
3665
+ abi: import_viem9.erc20Abi,
3684
3666
  functionName: "approve",
3685
3667
  args: [partialPaymentModuleAddress, approveAmount]
3686
3668
  });
3687
3669
  const args = [kibbleTokenAddress, approveCalldata];
3688
- const executeApproveCalldata = (0, import_viem11.encodeFunctionData)({
3670
+ const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
3689
3671
  abi: ORGANIZATION_IMPL_ABI,
3690
3672
  functionName: ORG_FUNCTION,
3691
3673
  args
@@ -3772,10 +3754,10 @@ function useApproveOrgPartialPayment() {
3772
3754
  var import_react20 = require("react");
3773
3755
 
3774
3756
  // src/helpers/ProcessOrgPartialPayment.tsx
3775
- var import_viem12 = require("viem");
3757
+ var import_viem10 = require("viem");
3776
3758
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3777
3759
  try {
3778
- const partialPayCalldata = (0, import_viem12.encodeFunctionData)({
3760
+ const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
3779
3761
  abi: MARKETPLACE_ABI,
3780
3762
  functionName: "partialPay",
3781
3763
  args: [
@@ -3790,7 +3772,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3790
3772
  ]
3791
3773
  });
3792
3774
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3793
- const executePartialPayCalldata = (0, import_viem12.encodeFunctionData)({
3775
+ const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
3794
3776
  abi: ORGANIZATION_IMPL_ABI,
3795
3777
  functionName: ORG_FUNCTION,
3796
3778
  args
@@ -3906,7 +3888,7 @@ function useUpdateOrgWalletAddress() {
3906
3888
  }
3907
3889
 
3908
3890
  // src/utils/organization/useMintOrgAnymalNFT.ts
3909
- var import_viem13 = require("viem");
3891
+ var import_viem11 = require("viem");
3910
3892
  var import_react22 = require("react");
3911
3893
  function useMintOrgAnymalNFT() {
3912
3894
  return (0, import_react22.useCallback)(
@@ -3925,13 +3907,13 @@ function useMintOrgAnymalNFT() {
3925
3907
  "petastic-signup-campaign-1",
3926
3908
  anymalTxId
3927
3909
  ];
3928
- const callData = (0, import_viem13.encodeFunctionData)({
3910
+ const callData = (0, import_viem11.encodeFunctionData)({
3929
3911
  abi: PET_NFT_ABI,
3930
3912
  functionName,
3931
3913
  args
3932
3914
  });
3933
3915
  const executeArgs = [validationContractAddress, callData];
3934
- const executeSubmitMetaCalldata = (0, import_viem13.encodeFunctionData)({
3916
+ const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
3935
3917
  abi: ORGANIZATION_IMPL_ABI,
3936
3918
  functionName: ORG_FUNCTION,
3937
3919
  args: executeArgs
@@ -3964,10 +3946,10 @@ function useMintOrgAnymalNFT() {
3964
3946
 
3965
3947
  // src/helpers/NonceHelper.tsx
3966
3948
  var import_uuid = require("uuid");
3967
- var import_viem14 = require("viem");
3949
+ var import_viem12 = require("viem");
3968
3950
  var generateBytes32Nonce = () => {
3969
3951
  const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
3970
- return (0, import_viem14.padHex)(`0x${uuid3}`, { size: 32 });
3952
+ return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
3971
3953
  };
3972
3954
 
3973
3955
  // src/helpers/CryptoUtils.tsx
@@ -4423,16 +4405,16 @@ function useCreateOrganizationAppData() {
4423
4405
 
4424
4406
  // src/utils/balance/useFetchBalance.ts
4425
4407
  var import_react27 = require("react");
4426
- var import_viem15 = require("viem");
4408
+ var import_viem13 = require("viem");
4427
4409
  function useFetchBalance() {
4428
4410
  return (0, import_react27.useCallback)(
4429
4411
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4430
4412
  try {
4431
4413
  const balance = await publicClient.readContract({
4432
- address: (0, import_viem15.getAddress)(kibbleTokenAddress),
4433
- abi: import_viem15.erc20Abi,
4414
+ address: (0, import_viem13.getAddress)(kibbleTokenAddress),
4415
+ abi: import_viem13.erc20Abi,
4434
4416
  functionName: "balanceOf",
4435
- args: [(0, import_viem15.getAddress)(walletAddress)]
4417
+ args: [(0, import_viem13.getAddress)(walletAddress)]
4436
4418
  });
4437
4419
  return Number(balance);
4438
4420
  } catch (error) {
@@ -4444,7 +4426,7 @@ function useFetchBalance() {
4444
4426
  }
4445
4427
 
4446
4428
  // src/utils/actions/useClaimActionReward.ts
4447
- var import_viem16 = require("viem");
4429
+ var import_viem14 = require("viem");
4448
4430
  var import_react28 = require("react");
4449
4431
  function useClaimActionReward() {
4450
4432
  return (0, import_react28.useCallback)(
@@ -4457,7 +4439,7 @@ function useClaimActionReward() {
4457
4439
  }
4458
4440
  const args = [actionId, claimIndex];
4459
4441
  const functionName = "claimByIndex";
4460
- const callData = (0, import_viem16.encodeFunctionData)({
4442
+ const callData = (0, import_viem14.encodeFunctionData)({
4461
4443
  abi: REWARDABLE_ACTIONS_ABI,
4462
4444
  functionName,
4463
4445
  args
@@ -4493,7 +4475,7 @@ function useClaimActionReward() {
4493
4475
  }
4494
4476
 
4495
4477
  // src/utils/actions/useClaimOrgActionReward.ts
4496
- var import_viem17 = require("viem");
4478
+ var import_viem15 = require("viem");
4497
4479
  var import_react29 = require("react");
4498
4480
  function useClaimOrgActionReward() {
4499
4481
  return (0, import_react29.useCallback)(
@@ -4504,13 +4486,13 @@ function useClaimOrgActionReward() {
4504
4486
  message: "Missing web3auth account info or contract address."
4505
4487
  };
4506
4488
  }
4507
- const claimCallData = (0, import_viem17.encodeFunctionData)({
4489
+ const claimCallData = (0, import_viem15.encodeFunctionData)({
4508
4490
  abi: REWARDABLE_ACTIONS_ABI,
4509
4491
  functionName: "claimByIndex",
4510
4492
  args: [actionId, claimIndex]
4511
4493
  });
4512
4494
  const args = [rewardableActionContractAddress, claimCallData];
4513
- const executeClaimCalldata = (0, import_viem17.encodeFunctionData)({
4495
+ const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
4514
4496
  abi: ORGANIZATION_IMPL_ABI,
4515
4497
  functionName: ORG_FUNCTION,
4516
4498
  args
package/dist/index.mjs CHANGED
@@ -387,36 +387,46 @@ function useFetchNotifications() {
387
387
  }
388
388
 
389
389
  // src/utils/coinbase/useSendCoinbaseUserOperation.ts
390
- import { useCallback as useCallback10 } from "react";
390
+ import { useCallback as useCallback10, useMemo } from "react";
391
391
  import { useSendUserOperation } from "@coinbase/cdp-hooks";
392
- import { createPublicClient, http } from "viem";
392
+ import { createPublicClient, encodeFunctionData, http } from "viem";
393
393
  import { baseSepolia } from "viem/chains";
394
394
  function useSendCoinbaseUserOperation() {
395
395
  const { sendUserOperation, data, error, status } = useSendUserOperation();
396
+ const publicClient = useMemo(
397
+ () => createPublicClient({
398
+ chain: baseSepolia,
399
+ transport: http()
400
+ }),
401
+ []
402
+ );
396
403
  const sendOperationFn = useCallback10(
397
- async (evmAddress, callData, contractAddress) => {
398
- if (!evmAddress || !callData || !contractAddress) {
404
+ async (evmAddress, contractAddress, abi, functionName, args) => {
405
+ if (!evmAddress || !contractAddress || !abi || !functionName) {
399
406
  return { success: false, message: "Missing required information" };
400
407
  }
401
- const publicClient = createPublicClient({
402
- chain: baseSepolia,
403
- transport: http()
404
- });
405
408
  try {
406
- const result = await publicClient.call({
407
- account: evmAddress,
408
- to: contractAddress,
409
- data: callData
409
+ await publicClient.simulateContract({
410
+ address: contractAddress,
411
+ abi,
412
+ functionName,
413
+ args,
414
+ account: evmAddress
410
415
  });
411
- console.log("Simulation successful:", result);
416
+ console.log("\u2705 Simulation successful");
412
417
  } catch (simError) {
413
- console.error("Simulation failed:", simError);
418
+ console.error("\u274C Simulation failed:", simError);
414
419
  return {
415
420
  success: false,
416
- message: `Simulation failed: ${simError.message}`
421
+ message: `Simulation failed: ${simError.shortMessage || simError.message}`
417
422
  };
418
423
  }
419
424
  try {
425
+ const callData = encodeFunctionData({
426
+ abi,
427
+ functionName,
428
+ args
429
+ });
420
430
  await sendUserOperation({
421
431
  evmSmartAccount: evmAddress,
422
432
  network: "base-sepolia",
@@ -425,18 +435,15 @@ function useSendCoinbaseUserOperation() {
425
435
  });
426
436
  return { success: true, message: "Operation submitted." };
427
437
  } catch (e) {
428
- console.error("Full error:", e);
438
+ console.error("\u274C Operation failed:", e);
429
439
  return { success: false, message: e.message };
430
440
  }
431
441
  },
432
- [sendUserOperation]
442
+ [sendUserOperation, publicClient]
433
443
  );
434
444
  return { sendOperationFn, data, status, error };
435
445
  }
436
446
 
437
- // src/utils/coinbase/useCoinbaseClaimActionReward.ts
438
- import { encodeFunctionData } from "viem";
439
-
440
447
  // src/helpers/BlockchainAbiHelper.tsx
441
448
  import { parseAbi } from "viem";
442
449
  var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
@@ -2881,35 +2888,20 @@ function useCoinbaseClaimActionReward() {
2881
2888
  status: "error"
2882
2889
  };
2883
2890
  }
2884
- try {
2885
- const args = [actionId, claimIndex];
2886
- const functionName = "claimByIndex";
2887
- const callData = encodeFunctionData({
2888
- abi: REWARDABLE_ACTIONS_ABI,
2889
- functionName,
2890
- args
2891
- });
2892
- const opsRes = await sendOperationFn(
2893
- evmAddress,
2894
- callData,
2895
- validationContractAddress
2896
- );
2897
- return { success: opsRes.success, message: opsRes.message, status };
2898
- } catch (error) {
2899
- console.error(error);
2900
- return {
2901
- success: false,
2902
- message: "Reward not claimed",
2903
- status: "error"
2904
- };
2905
- }
2891
+ const result = await sendOperationFn(
2892
+ evmAddress,
2893
+ validationContractAddress,
2894
+ REWARDABLE_ACTIONS_ABI,
2895
+ "claimByIndex",
2896
+ [actionId, claimIndex]
2897
+ );
2898
+ return { ...result, status };
2906
2899
  },
2907
- []
2900
+ [sendOperationFn, status]
2908
2901
  );
2909
2902
  }
2910
2903
 
2911
2904
  // src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
2912
- import { encodeFunctionData as encodeFunctionData2 } from "viem";
2913
2905
  import { useCallback as useCallback12 } from "react";
2914
2906
  function useCoinbaseMintAnymalNFT() {
2915
2907
  const { sendOperationFn, status } = useSendCoinbaseUserOperation();
@@ -2922,37 +2914,27 @@ function useCoinbaseMintAnymalNFT() {
2922
2914
  status: "error"
2923
2915
  };
2924
2916
  }
2925
- try {
2926
- const functionName = "submitMetadataByCampaignName";
2927
- const args = [
2917
+ const result = await sendOperationFn(
2918
+ evmAddress,
2919
+ validationContractAddress,
2920
+ PET_NFT_ABI,
2921
+ "submitMetadataByCampaignName",
2922
+ [
2928
2923
  pid,
2929
2924
  nftId,
2930
2925
  `https://dev-nft.petastic.com/metadata/${nftId}`,
2931
2926
  "petastic-signup-campaign-1",
2932
2927
  anymalTxId
2933
- ];
2934
- const callData = encodeFunctionData2({
2935
- abi: PET_NFT_ABI,
2936
- functionName,
2937
- args
2938
- });
2939
- const opsRes = await sendOperationFn(
2940
- evmAddress,
2941
- callData,
2942
- validationContractAddress
2943
- );
2944
- return { success: opsRes.success, message: opsRes.message, status };
2945
- } catch (error) {
2946
- console.error(error);
2947
- return { success: false, message: "Error", status: "error" };
2948
- }
2928
+ ]
2929
+ );
2930
+ return { ...result, status };
2949
2931
  },
2950
- []
2932
+ [sendOperationFn, status]
2951
2933
  );
2952
2934
  }
2953
2935
 
2954
2936
  // src/utils/anymals/useMintAnymalNFT.ts
2955
- import { encodeFunctionData as encodeFunctionData3 } from "viem";
2937
+ import { encodeFunctionData as encodeFunctionData2 } from "viem";
2956
2938
  import { useCallback as useCallback13 } from "react";
2957
2939
 
2958
2940
  // src/helpers/GasEstimateHelper.tsx
@@ -3050,7 +3032,7 @@ function useMintAnymalNFT() {
3050
3032
  "petastic-signup-campaign-1",
3051
3033
  anymalTxId
3052
3034
  ];
3053
- const callData = encodeFunctionData3({
3035
+ const callData = encodeFunctionData2({
3054
3036
  abi: PET_NFT_ABI,
3055
3037
  functionName,
3056
3038
  args
@@ -3237,7 +3219,7 @@ function useUploadAnymalImage() {
3237
3219
  import { useCallback as useCallback16 } from "react";
3238
3220
 
3239
3221
  // src/helpers/ProcessDirectPartialPayment.tsx
3240
- import { encodeFunctionData as encodeFunctionData4 } from "viem";
3222
+ import { encodeFunctionData as encodeFunctionData3 } from "viem";
3241
3223
 
3242
3224
  // src/helpers/SendUserOpWithRetries.tsx
3243
3225
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3297,7 +3279,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3297
3279
  deadline,
3298
3280
  backendSignature
3299
3281
  ];
3300
- const partialPayCalldata = encodeFunctionData4({
3282
+ const partialPayCalldata = encodeFunctionData3({
3301
3283
  abi: MARKETPLACE_ABI,
3302
3284
  functionName,
3303
3285
  args
@@ -3393,12 +3375,12 @@ function useProcessPartialKibblePayment() {
3393
3375
  import { useCallback as useCallback17 } from "react";
3394
3376
 
3395
3377
  // src/helpers/ProcessDirectKibbleApproval.tsx
3396
- import { encodeFunctionData as encodeFunctionData5, erc20Abi } from "viem";
3378
+ import { encodeFunctionData as encodeFunctionData4, erc20Abi } from "viem";
3397
3379
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3398
3380
  try {
3399
3381
  const functionName = "approve";
3400
3382
  const args = [spenderAddress, approveAmount];
3401
- const approveCalldata = encodeFunctionData5({
3383
+ const approveCalldata = encodeFunctionData4({
3402
3384
  abi: erc20Abi,
3403
3385
  functionName,
3404
3386
  args
@@ -3463,7 +3445,7 @@ function useApproveKibbleToken() {
3463
3445
 
3464
3446
  // src/utils/organization/useCreateOrganizationBase.ts
3465
3447
  import { useCallback as useCallback18 } from "react";
3466
- import { decodeEventLog, encodeFunctionData as encodeFunctionData6 } from "viem";
3448
+ import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3467
3449
  function useCreateOrganizationBase() {
3468
3450
  return useCallback18(
3469
3451
  /**
@@ -3487,7 +3469,7 @@ function useCreateOrganizationBase() {
3487
3469
  try {
3488
3470
  const functionName = "createOrganizationProxy";
3489
3471
  const args = [ownerAddress, orgName, orgPid];
3490
- const callData = encodeFunctionData6({
3472
+ const callData = encodeFunctionData5({
3491
3473
  abi: ORGANIZATION_BEACON_ABI,
3492
3474
  functionName,
3493
3475
  args
@@ -3564,7 +3546,7 @@ function useCreateOrganizationBase() {
3564
3546
  import { useCallback as useCallback19 } from "react";
3565
3547
 
3566
3548
  // src/helpers/ProcessOrgKibbleApproval.tsx
3567
- import { encodeFunctionData as encodeFunctionData7, erc20Abi as erc20Abi3 } from "viem";
3549
+ import { encodeFunctionData as encodeFunctionData6, erc20Abi as erc20Abi3 } from "viem";
3568
3550
 
3569
3551
  // src/helpers/WaitForAllowance.tsx
3570
3552
  import { erc20Abi as erc20Abi2 } from "viem";
@@ -3601,13 +3583,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3601
3583
  if (approveAmount <= 0n) {
3602
3584
  return { success: false, message: "Approval amount must be greater than zero." };
3603
3585
  }
3604
- const approveCalldata = encodeFunctionData7({
3586
+ const approveCalldata = encodeFunctionData6({
3605
3587
  abi: erc20Abi3,
3606
3588
  functionName: "approve",
3607
3589
  args: [partialPaymentModuleAddress, approveAmount]
3608
3590
  });
3609
3591
  const args = [kibbleTokenAddress, approveCalldata];
3610
- const executeApproveCalldata = encodeFunctionData7({
3592
+ const executeApproveCalldata = encodeFunctionData6({
3611
3593
  abi: ORGANIZATION_IMPL_ABI,
3612
3594
  functionName: ORG_FUNCTION,
3613
3595
  args
@@ -3694,10 +3676,10 @@ function useApproveOrgPartialPayment() {
3694
3676
  import { useCallback as useCallback20 } from "react";
3695
3677
 
3696
3678
  // src/helpers/ProcessOrgPartialPayment.tsx
3697
- import { encodeFunctionData as encodeFunctionData8 } from "viem";
3679
+ import { encodeFunctionData as encodeFunctionData7 } from "viem";
3698
3680
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3699
3681
  try {
3700
- const partialPayCalldata = encodeFunctionData8({
3682
+ const partialPayCalldata = encodeFunctionData7({
3701
3683
  abi: MARKETPLACE_ABI,
3702
3684
  functionName: "partialPay",
3703
3685
  args: [
@@ -3712,7 +3694,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3712
3694
  ]
3713
3695
  });
3714
3696
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3715
- const executePartialPayCalldata = encodeFunctionData8({
3697
+ const executePartialPayCalldata = encodeFunctionData7({
3716
3698
  abi: ORGANIZATION_IMPL_ABI,
3717
3699
  functionName: ORG_FUNCTION,
3718
3700
  args
@@ -3828,7 +3810,7 @@ function useUpdateOrgWalletAddress() {
3828
3810
  }
3829
3811
 
3830
3812
  // src/utils/organization/useMintOrgAnymalNFT.ts
3831
- import { encodeFunctionData as encodeFunctionData9 } from "viem";
3813
+ import { encodeFunctionData as encodeFunctionData8 } from "viem";
3832
3814
  import { useCallback as useCallback22 } from "react";
3833
3815
  function useMintOrgAnymalNFT() {
3834
3816
  return useCallback22(
@@ -3847,13 +3829,13 @@ function useMintOrgAnymalNFT() {
3847
3829
  "petastic-signup-campaign-1",
3848
3830
  anymalTxId
3849
3831
  ];
3850
- const callData = encodeFunctionData9({
3832
+ const callData = encodeFunctionData8({
3851
3833
  abi: PET_NFT_ABI,
3852
3834
  functionName,
3853
3835
  args
3854
3836
  });
3855
3837
  const executeArgs = [validationContractAddress, callData];
3856
- const executeSubmitMetaCalldata = encodeFunctionData9({
3838
+ const executeSubmitMetaCalldata = encodeFunctionData8({
3857
3839
  abi: ORGANIZATION_IMPL_ABI,
3858
3840
  functionName: ORG_FUNCTION,
3859
3841
  args: executeArgs
@@ -4183,7 +4165,7 @@ function useFetchBalance() {
4183
4165
  }
4184
4166
 
4185
4167
  // src/utils/actions/useClaimActionReward.ts
4186
- import { encodeFunctionData as encodeFunctionData10 } from "viem";
4168
+ import { encodeFunctionData as encodeFunctionData9 } from "viem";
4187
4169
  import { useCallback as useCallback28 } from "react";
4188
4170
  function useClaimActionReward() {
4189
4171
  return useCallback28(
@@ -4196,7 +4178,7 @@ function useClaimActionReward() {
4196
4178
  }
4197
4179
  const args = [actionId, claimIndex];
4198
4180
  const functionName = "claimByIndex";
4199
- const callData = encodeFunctionData10({
4181
+ const callData = encodeFunctionData9({
4200
4182
  abi: REWARDABLE_ACTIONS_ABI,
4201
4183
  functionName,
4202
4184
  args
@@ -4232,7 +4214,7 @@ function useClaimActionReward() {
4232
4214
  }
4233
4215
 
4234
4216
  // src/utils/actions/useClaimOrgActionReward.ts
4235
- import { encodeFunctionData as encodeFunctionData11 } from "viem";
4217
+ import { encodeFunctionData as encodeFunctionData10 } from "viem";
4236
4218
  import { useCallback as useCallback29 } from "react";
4237
4219
  function useClaimOrgActionReward() {
4238
4220
  return useCallback29(
@@ -4243,13 +4225,13 @@ function useClaimOrgActionReward() {
4243
4225
  message: "Missing web3auth account info or contract address."
4244
4226
  };
4245
4227
  }
4246
- const claimCallData = encodeFunctionData11({
4228
+ const claimCallData = encodeFunctionData10({
4247
4229
  abi: REWARDABLE_ACTIONS_ABI,
4248
4230
  functionName: "claimByIndex",
4249
4231
  args: [actionId, claimIndex]
4250
4232
  });
4251
4233
  const args = [rewardableActionContractAddress, claimCallData];
4252
- const executeClaimCalldata = encodeFunctionData11({
4234
+ const executeClaimCalldata = encodeFunctionData10({
4253
4235
  abi: ORGANIZATION_IMPL_ABI,
4254
4236
  functionName: ORG_FUNCTION,
4255
4237
  args
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.131",
3
+ "version": "1.0.132",
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": {