anymal-protocol 1.0.136 → 1.0.138

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
@@ -431,7 +431,6 @@ declare const ORG_FUNCTION = "executeCall";
431
431
  declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
432
432
  success: boolean;
433
433
  message: string;
434
- proxyAddress?: string;
435
434
  status: string;
436
435
  }>;
437
436
 
package/dist/index.d.ts CHANGED
@@ -431,7 +431,6 @@ declare const ORG_FUNCTION = "executeCall";
431
431
  declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
432
432
  success: boolean;
433
433
  message: string;
434
- proxyAddress?: string;
435
434
  status: string;
436
435
  }>;
437
436
 
package/dist/index.js CHANGED
@@ -3013,17 +3013,8 @@ function useCoinbaseMintAnymalNFT() {
3013
3013
 
3014
3014
  // src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
3015
3015
  var import_react13 = require("react");
3016
- var import_viem3 = require("viem");
3017
- var import_chains2 = require("viem/chains");
3018
3016
  function useCoinbaseCreateOrganizationWallet() {
3019
- const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
3020
- const publicClient = (0, import_react13.useMemo)(
3021
- () => (0, import_viem3.createPublicClient)({
3022
- chain: import_chains2.baseSepolia,
3023
- transport: (0, import_viem3.http)()
3024
- }),
3025
- []
3026
- );
3017
+ const { sendOperationFn, status } = useSendCoinbaseUserOperation();
3027
3018
  return (0, import_react13.useCallback)(
3028
3019
  /**
3029
3020
  * Creates a new organization on-chain.
@@ -3033,14 +3024,14 @@ function useCoinbaseCreateOrganizationWallet() {
3033
3024
  * @param ownerAddress - The wallet address of the user who will be the default manager.
3034
3025
  * @param orgContractAddress - The contract address of the organization beacon.
3035
3026
  * @param evmAddress - The Coinbase smart account address of the admin.
3036
- * @returns A promise with success status, message, and optional proxyAddress.
3027
+ * @returns A promise with success status, message, and status.
3037
3028
  */
3038
3029
  async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
3039
3030
  if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
3040
3031
  return {
3041
3032
  success: false,
3042
3033
  message: "Missing required parameters for organization creation.",
3043
- status: "error"
3034
+ status: "error."
3044
3035
  };
3045
3036
  }
3046
3037
  const result = await sendOperationFn(
@@ -3050,54 +3041,14 @@ function useCoinbaseCreateOrganizationWallet() {
3050
3041
  "createOrganizationProxy",
3051
3042
  [ownerAddress, orgName, orgPid]
3052
3043
  );
3053
- if (!result.success) {
3054
- return { ...result, status: "error" };
3055
- }
3056
- let proxyAddress;
3057
- try {
3058
- const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
3059
- if (txHash) {
3060
- const receipt = await publicClient.getTransactionReceipt({
3061
- hash: txHash
3062
- });
3063
- for (const log of receipt.logs) {
3064
- try {
3065
- const decoded = (0, import_viem3.decodeEventLog)({
3066
- abi: ORGANIZATION_BEACON_ABI,
3067
- data: log.data,
3068
- topics: log.topics
3069
- });
3070
- if (decoded.eventName === "NewOrganizationCreated") {
3071
- proxyAddress = decoded.args.proxyAddress;
3072
- break;
3073
- }
3074
- } catch {
3075
- }
3076
- }
3077
- }
3078
- } catch (e) {
3079
- console.error("Failed to get transaction receipt:", e);
3080
- }
3081
- if (!proxyAddress) {
3082
- return {
3083
- success: true,
3084
- message: "Organization registered successfully, but proxy address not found in logs.",
3085
- status
3086
- };
3087
- }
3088
- return {
3089
- success: true,
3090
- message: "Organization registered successfully.",
3091
- proxyAddress,
3092
- status
3093
- };
3044
+ return { ...result, status };
3094
3045
  },
3095
- [sendOperationFn, data, publicClient, status]
3046
+ [sendOperationFn, status]
3096
3047
  );
3097
3048
  }
3098
3049
 
3099
3050
  // src/utils/anymals/useMintAnymalNFT.ts
3100
- var import_viem5 = require("viem");
3051
+ var import_viem4 = require("viem");
3101
3052
  var import_react14 = require("react");
3102
3053
 
3103
3054
  // src/helpers/GasEstimateHelper.tsx
@@ -3142,18 +3093,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
3142
3093
  }
3143
3094
 
3144
3095
  // src/helpers/HumanRevert.tsx
3145
- var import_viem4 = require("viem");
3096
+ var import_viem3 = require("viem");
3146
3097
  function humanRevert(raw, shortMessage) {
3147
3098
  if (!raw) return shortMessage ?? "Simulation reverted";
3148
3099
  try {
3149
- const { errorName, args } = (0, import_viem4.decodeErrorResult)({
3100
+ const { errorName, args } = (0, import_viem3.decodeErrorResult)({
3150
3101
  abi: ERROR_ABI,
3151
3102
  data: raw
3152
3103
  });
3153
3104
  return `${errorName}(${args.map(String).join(", ")})`;
3154
3105
  } catch {
3155
3106
  if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
3156
- return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
3107
+ return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
3157
3108
  }
3158
3109
  return `${raw.slice(0, 10)}\u2026`;
3159
3110
  }
@@ -3195,7 +3146,7 @@ function useMintAnymalNFT() {
3195
3146
  "petastic-signup-campaign-1",
3196
3147
  anymalTxId
3197
3148
  ];
3198
- const callData = (0, import_viem5.encodeFunctionData)({
3149
+ const callData = (0, import_viem4.encodeFunctionData)({
3199
3150
  abi: PET_NFT_ABI,
3200
3151
  functionName,
3201
3152
  args
@@ -3382,7 +3333,7 @@ function useUploadAnymalImage() {
3382
3333
  var import_react17 = require("react");
3383
3334
 
3384
3335
  // src/helpers/ProcessDirectPartialPayment.tsx
3385
- var import_viem6 = require("viem");
3336
+ var import_viem5 = require("viem");
3386
3337
 
3387
3338
  // src/helpers/SendUserOpWithRetries.tsx
3388
3339
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3442,7 +3393,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3442
3393
  deadline,
3443
3394
  backendSignature
3444
3395
  ];
3445
- const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
3396
+ const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
3446
3397
  abi: MARKETPLACE_ABI,
3447
3398
  functionName,
3448
3399
  args
@@ -3538,20 +3489,20 @@ function useProcessPartialKibblePayment() {
3538
3489
  var import_react18 = require("react");
3539
3490
 
3540
3491
  // src/helpers/ProcessDirectKibbleApproval.tsx
3541
- var import_viem7 = require("viem");
3492
+ var import_viem6 = require("viem");
3542
3493
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3543
3494
  try {
3544
3495
  const functionName = "approve";
3545
3496
  const args = [spenderAddress, approveAmount];
3546
- const approveCalldata = (0, import_viem7.encodeFunctionData)({
3547
- abi: import_viem7.erc20Abi,
3497
+ const approveCalldata = (0, import_viem6.encodeFunctionData)({
3498
+ abi: import_viem6.erc20Abi,
3548
3499
  functionName,
3549
3500
  args
3550
3501
  });
3551
3502
  await simulateCall(
3552
3503
  bundlerClient.client,
3553
3504
  kibbleTokenAddress,
3554
- import_viem7.erc20Abi,
3505
+ import_viem6.erc20Abi,
3555
3506
  functionName,
3556
3507
  args,
3557
3508
  smartAccount.address
@@ -3608,7 +3559,7 @@ function useApproveKibbleToken() {
3608
3559
 
3609
3560
  // src/utils/organization/useCreateOrganizationBase.ts
3610
3561
  var import_react19 = require("react");
3611
- var import_viem8 = require("viem");
3562
+ var import_viem7 = require("viem");
3612
3563
  function useCreateOrganizationBase() {
3613
3564
  return (0, import_react19.useCallback)(
3614
3565
  /**
@@ -3632,7 +3583,7 @@ function useCreateOrganizationBase() {
3632
3583
  try {
3633
3584
  const functionName = "createOrganizationProxy";
3634
3585
  const args = [ownerAddress, orgName, orgPid];
3635
- const callData = (0, import_viem8.encodeFunctionData)({
3586
+ const callData = (0, import_viem7.encodeFunctionData)({
3636
3587
  abi: ORGANIZATION_BEACON_ABI,
3637
3588
  functionName,
3638
3589
  args
@@ -3670,7 +3621,7 @@ function useCreateOrganizationBase() {
3670
3621
  let proxyAddress;
3671
3622
  for (const log of txReceipt.logs) {
3672
3623
  try {
3673
- const decoded = (0, import_viem8.decodeEventLog)({
3624
+ const decoded = (0, import_viem7.decodeEventLog)({
3674
3625
  abi: ORGANIZATION_BEACON_ABI,
3675
3626
  data: log.data,
3676
3627
  topics: log.topics
@@ -3709,10 +3660,10 @@ function useCreateOrganizationBase() {
3709
3660
  var import_react20 = require("react");
3710
3661
 
3711
3662
  // src/helpers/ProcessOrgKibbleApproval.tsx
3712
- var import_viem10 = require("viem");
3663
+ var import_viem9 = require("viem");
3713
3664
 
3714
3665
  // src/helpers/WaitForAllowance.tsx
3715
- var import_viem9 = require("viem");
3666
+ var import_viem8 = require("viem");
3716
3667
  async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
3717
3668
  const MAX_RETRIES = 10;
3718
3669
  const RETRY_INTERVAL = 2e3;
@@ -3721,7 +3672,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
3721
3672
  try {
3722
3673
  const currentAllowance = await publicClient.readContract({
3723
3674
  address: tokenAddress,
3724
- abi: import_viem9.erc20Abi,
3675
+ abi: import_viem8.erc20Abi,
3725
3676
  functionName: "allowance",
3726
3677
  args: [ownerAddress, spenderAddress]
3727
3678
  });
@@ -3746,13 +3697,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3746
3697
  if (approveAmount <= 0n) {
3747
3698
  return { success: false, message: "Approval amount must be greater than zero." };
3748
3699
  }
3749
- const approveCalldata = (0, import_viem10.encodeFunctionData)({
3750
- abi: import_viem10.erc20Abi,
3700
+ const approveCalldata = (0, import_viem9.encodeFunctionData)({
3701
+ abi: import_viem9.erc20Abi,
3751
3702
  functionName: "approve",
3752
3703
  args: [partialPaymentModuleAddress, approveAmount]
3753
3704
  });
3754
3705
  const args = [kibbleTokenAddress, approveCalldata];
3755
- const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
3706
+ const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
3756
3707
  abi: ORGANIZATION_IMPL_ABI,
3757
3708
  functionName: ORG_FUNCTION,
3758
3709
  args
@@ -3839,10 +3790,10 @@ function useApproveOrgPartialPayment() {
3839
3790
  var import_react21 = require("react");
3840
3791
 
3841
3792
  // src/helpers/ProcessOrgPartialPayment.tsx
3842
- var import_viem11 = require("viem");
3793
+ var import_viem10 = require("viem");
3843
3794
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3844
3795
  try {
3845
- const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
3796
+ const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
3846
3797
  abi: MARKETPLACE_ABI,
3847
3798
  functionName: "partialPay",
3848
3799
  args: [
@@ -3857,7 +3808,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3857
3808
  ]
3858
3809
  });
3859
3810
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3860
- const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
3811
+ const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
3861
3812
  abi: ORGANIZATION_IMPL_ABI,
3862
3813
  functionName: ORG_FUNCTION,
3863
3814
  args
@@ -3973,7 +3924,7 @@ function useUpdateOrgWalletAddress() {
3973
3924
  }
3974
3925
 
3975
3926
  // src/utils/organization/useMintOrgAnymalNFT.ts
3976
- var import_viem12 = require("viem");
3927
+ var import_viem11 = require("viem");
3977
3928
  var import_react23 = require("react");
3978
3929
  function useMintOrgAnymalNFT() {
3979
3930
  return (0, import_react23.useCallback)(
@@ -3992,13 +3943,13 @@ function useMintOrgAnymalNFT() {
3992
3943
  "petastic-signup-campaign-1",
3993
3944
  anymalTxId
3994
3945
  ];
3995
- const callData = (0, import_viem12.encodeFunctionData)({
3946
+ const callData = (0, import_viem11.encodeFunctionData)({
3996
3947
  abi: PET_NFT_ABI,
3997
3948
  functionName,
3998
3949
  args
3999
3950
  });
4000
3951
  const executeArgs = [validationContractAddress, callData];
4001
- const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
3952
+ const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
4002
3953
  abi: ORGANIZATION_IMPL_ABI,
4003
3954
  functionName: ORG_FUNCTION,
4004
3955
  args: executeArgs
@@ -4031,10 +3982,10 @@ function useMintOrgAnymalNFT() {
4031
3982
 
4032
3983
  // src/helpers/NonceHelper.tsx
4033
3984
  var import_uuid = require("uuid");
4034
- var import_viem13 = require("viem");
3985
+ var import_viem12 = require("viem");
4035
3986
  var generateBytes32Nonce = () => {
4036
3987
  const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
4037
- return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
3988
+ return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
4038
3989
  };
4039
3990
 
4040
3991
  // src/helpers/CryptoUtils.tsx
@@ -4490,16 +4441,16 @@ function useCreateOrganizationAppData() {
4490
4441
 
4491
4442
  // src/utils/balance/useFetchBalance.ts
4492
4443
  var import_react28 = require("react");
4493
- var import_viem14 = require("viem");
4444
+ var import_viem13 = require("viem");
4494
4445
  function useFetchBalance() {
4495
4446
  return (0, import_react28.useCallback)(
4496
4447
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4497
4448
  try {
4498
4449
  const balance = await publicClient.readContract({
4499
- address: (0, import_viem14.getAddress)(kibbleTokenAddress),
4500
- abi: import_viem14.erc20Abi,
4450
+ address: (0, import_viem13.getAddress)(kibbleTokenAddress),
4451
+ abi: import_viem13.erc20Abi,
4501
4452
  functionName: "balanceOf",
4502
- args: [(0, import_viem14.getAddress)(walletAddress)]
4453
+ args: [(0, import_viem13.getAddress)(walletAddress)]
4503
4454
  });
4504
4455
  return Number(balance);
4505
4456
  } catch (error) {
@@ -4511,7 +4462,7 @@ function useFetchBalance() {
4511
4462
  }
4512
4463
 
4513
4464
  // src/utils/actions/useClaimActionReward.ts
4514
- var import_viem15 = require("viem");
4465
+ var import_viem14 = require("viem");
4515
4466
  var import_react29 = require("react");
4516
4467
  function useClaimActionReward() {
4517
4468
  return (0, import_react29.useCallback)(
@@ -4524,7 +4475,7 @@ function useClaimActionReward() {
4524
4475
  }
4525
4476
  const args = [actionId, claimIndex];
4526
4477
  const functionName = "claimByIndex";
4527
- const callData = (0, import_viem15.encodeFunctionData)({
4478
+ const callData = (0, import_viem14.encodeFunctionData)({
4528
4479
  abi: REWARDABLE_ACTIONS_ABI,
4529
4480
  functionName,
4530
4481
  args
@@ -4560,7 +4511,7 @@ function useClaimActionReward() {
4560
4511
  }
4561
4512
 
4562
4513
  // src/utils/actions/useClaimOrgActionReward.ts
4563
- var import_viem16 = require("viem");
4514
+ var import_viem15 = require("viem");
4564
4515
  var import_react30 = require("react");
4565
4516
  function useClaimOrgActionReward() {
4566
4517
  return (0, import_react30.useCallback)(
@@ -4571,13 +4522,13 @@ function useClaimOrgActionReward() {
4571
4522
  message: "Missing web3auth account info or contract address."
4572
4523
  };
4573
4524
  }
4574
- const claimCallData = (0, import_viem16.encodeFunctionData)({
4525
+ const claimCallData = (0, import_viem15.encodeFunctionData)({
4575
4526
  abi: REWARDABLE_ACTIONS_ABI,
4576
4527
  functionName: "claimByIndex",
4577
4528
  args: [actionId, claimIndex]
4578
4529
  });
4579
4530
  const args = [rewardableActionContractAddress, claimCallData];
4580
- const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
4531
+ const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
4581
4532
  abi: ORGANIZATION_IMPL_ABI,
4582
4533
  functionName: ORG_FUNCTION,
4583
4534
  args
package/dist/index.mjs CHANGED
@@ -2933,18 +2933,9 @@ function useCoinbaseMintAnymalNFT() {
2933
2933
  }
2934
2934
 
2935
2935
  // src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
2936
- import { useCallback as useCallback13, useMemo as useMemo2 } from "react";
2937
- import { createPublicClient as createPublicClient2, decodeEventLog, http as http2 } from "viem";
2938
- import { baseSepolia as baseSepolia2 } from "viem/chains";
2936
+ import { useCallback as useCallback13 } from "react";
2939
2937
  function useCoinbaseCreateOrganizationWallet() {
2940
- const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
2941
- const publicClient = useMemo2(
2942
- () => createPublicClient2({
2943
- chain: baseSepolia2,
2944
- transport: http2()
2945
- }),
2946
- []
2947
- );
2938
+ const { sendOperationFn, status } = useSendCoinbaseUserOperation();
2948
2939
  return useCallback13(
2949
2940
  /**
2950
2941
  * Creates a new organization on-chain.
@@ -2954,14 +2945,14 @@ function useCoinbaseCreateOrganizationWallet() {
2954
2945
  * @param ownerAddress - The wallet address of the user who will be the default manager.
2955
2946
  * @param orgContractAddress - The contract address of the organization beacon.
2956
2947
  * @param evmAddress - The Coinbase smart account address of the admin.
2957
- * @returns A promise with success status, message, and optional proxyAddress.
2948
+ * @returns A promise with success status, message, and status.
2958
2949
  */
2959
2950
  async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
2960
2951
  if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
2961
2952
  return {
2962
2953
  success: false,
2963
2954
  message: "Missing required parameters for organization creation.",
2964
- status: "error"
2955
+ status: "error."
2965
2956
  };
2966
2957
  }
2967
2958
  const result = await sendOperationFn(
@@ -2971,49 +2962,9 @@ function useCoinbaseCreateOrganizationWallet() {
2971
2962
  "createOrganizationProxy",
2972
2963
  [ownerAddress, orgName, orgPid]
2973
2964
  );
2974
- if (!result.success) {
2975
- return { ...result, status: "error" };
2976
- }
2977
- let proxyAddress;
2978
- try {
2979
- const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
2980
- if (txHash) {
2981
- const receipt = await publicClient.getTransactionReceipt({
2982
- hash: txHash
2983
- });
2984
- for (const log of receipt.logs) {
2985
- try {
2986
- const decoded = decodeEventLog({
2987
- abi: ORGANIZATION_BEACON_ABI,
2988
- data: log.data,
2989
- topics: log.topics
2990
- });
2991
- if (decoded.eventName === "NewOrganizationCreated") {
2992
- proxyAddress = decoded.args.proxyAddress;
2993
- break;
2994
- }
2995
- } catch {
2996
- }
2997
- }
2998
- }
2999
- } catch (e) {
3000
- console.error("Failed to get transaction receipt:", e);
3001
- }
3002
- if (!proxyAddress) {
3003
- return {
3004
- success: true,
3005
- message: "Organization registered successfully, but proxy address not found in logs.",
3006
- status
3007
- };
3008
- }
3009
- return {
3010
- success: true,
3011
- message: "Organization registered successfully.",
3012
- proxyAddress,
3013
- status
3014
- };
2965
+ return { ...result, status };
3015
2966
  },
3016
- [sendOperationFn, data, publicClient, status]
2967
+ [sendOperationFn, status]
3017
2968
  );
3018
2969
  }
3019
2970
 
@@ -3529,7 +3480,7 @@ function useApproveKibbleToken() {
3529
3480
 
3530
3481
  // src/utils/organization/useCreateOrganizationBase.ts
3531
3482
  import { useCallback as useCallback19 } from "react";
3532
- import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
3483
+ import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3533
3484
  function useCreateOrganizationBase() {
3534
3485
  return useCallback19(
3535
3486
  /**
@@ -3591,7 +3542,7 @@ function useCreateOrganizationBase() {
3591
3542
  let proxyAddress;
3592
3543
  for (const log of txReceipt.logs) {
3593
3544
  try {
3594
- const decoded = decodeEventLog2({
3545
+ const decoded = decodeEventLog({
3595
3546
  abi: ORGANIZATION_BEACON_ABI,
3596
3547
  data: log.data,
3597
3548
  topics: log.topics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.136",
3
+ "version": "1.0.138",
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": {