anymal-protocol 1.0.142 → 1.0.144

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
@@ -1,7 +1,6 @@
1
1
  import * as _coinbase_cdp_hooks from '@coinbase/cdp-hooks';
2
2
  import * as _coinbase_cdp_api_client from '@coinbase/cdp-api-client';
3
3
  import * as abitype from 'abitype';
4
- import { GetUserOperationResult } from '@coinbase/cdp-core';
5
4
  import { BundlerClient } from 'viem/account-abstraction';
6
5
  import { ec } from 'elliptic';
7
6
 
@@ -434,7 +433,6 @@ declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName
434
433
  message: string;
435
434
  proxyAddress?: string;
436
435
  status: string;
437
- data: GetUserOperationResult | undefined;
438
436
  }>;
439
437
 
440
438
  declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as _coinbase_cdp_hooks from '@coinbase/cdp-hooks';
2
2
  import * as _coinbase_cdp_api_client from '@coinbase/cdp-api-client';
3
3
  import * as abitype from 'abitype';
4
- import { GetUserOperationResult } from '@coinbase/cdp-core';
5
4
  import { BundlerClient } from 'viem/account-abstraction';
6
5
  import { ec } from 'elliptic';
7
6
 
@@ -434,7 +433,6 @@ declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName
434
433
  message: string;
435
434
  proxyAddress?: string;
436
435
  status: string;
437
- data: GetUserOperationResult | undefined;
438
436
  }>;
439
437
 
440
438
  declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
package/dist/index.js CHANGED
@@ -3030,7 +3030,6 @@ function useCoinbaseCreateOrganizationWallet() {
3030
3030
  *
3031
3031
  * @param orgPid - The PID of the organization as registered in Firestore.
3032
3032
  * @param orgName - The name of the organization as registered in Firestore.
3033
- * @param ownerAddress - The wallet address of the user who will be the default manager.
3034
3033
  * @param orgContractAddress - The contract address of the organization beacon.
3035
3034
  * @param evmAddress - The Coinbase smart account address of the admin.
3036
3035
  * @returns A promise with success status, message, and optional proxyAddress.
@@ -3040,35 +3039,55 @@ function useCoinbaseCreateOrganizationWallet() {
3040
3039
  return {
3041
3040
  success: false,
3042
3041
  message: "Missing required parameters for organization creation.",
3043
- status: "error",
3044
- data
3042
+ status: "error"
3045
3043
  };
3046
3044
  }
3045
+ const result = await sendOperationFn(
3046
+ evmAddress,
3047
+ orgContractAddress,
3048
+ ORGANIZATION_BEACON_ABI,
3049
+ "createOrganizationProxy",
3050
+ [ownerAddress, orgName, orgPid]
3051
+ );
3052
+ if (!result.success) {
3053
+ return { ...result, status: "error" };
3054
+ }
3055
+ let proxyAddress;
3047
3056
  try {
3048
- const result = await sendOperationFn(
3049
- evmAddress,
3050
- orgContractAddress,
3051
- ORGANIZATION_BEACON_ABI,
3052
- "createOrganizationProxy",
3053
- [ownerAddress, orgName, orgPid]
3054
- );
3055
- if (!result.success) {
3056
- return { ...result, status: "error", data };
3057
+ const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
3058
+ if (txHash) {
3059
+ const receipt = await publicClient.getTransactionReceipt({
3060
+ hash: txHash
3061
+ });
3062
+ for (const log of receipt.logs) {
3063
+ try {
3064
+ const decoded = (0, import_viem3.decodeEventLog)({
3065
+ abi: ORGANIZATION_BEACON_ABI,
3066
+ data: log.data,
3067
+ topics: log.topics
3068
+ });
3069
+ if (decoded.eventName === "NewOrganizationCreated") {
3070
+ proxyAddress = decoded.args.proxyAddress;
3071
+ break;
3072
+ }
3073
+ } catch {
3074
+ }
3075
+ }
3057
3076
  }
3077
+ } catch (e) {
3078
+ console.error("Failed to get transaction receipt:", e);
3079
+ }
3080
+ if (!proxyAddress) {
3058
3081
  return {
3059
3082
  ...result,
3060
- status,
3061
- data
3062
- };
3063
- } catch (error) {
3064
- console.error("Org wallet creation error", error);
3065
- return {
3066
- success: false,
3067
- message: "Error",
3068
- status: "error",
3069
- data
3083
+ status
3070
3084
  };
3071
3085
  }
3086
+ return {
3087
+ ...result,
3088
+ proxyAddress,
3089
+ status
3090
+ };
3072
3091
  },
3073
3092
  [sendOperationFn, data, publicClient, status]
3074
3093
  );
package/dist/index.mjs CHANGED
@@ -2934,7 +2934,7 @@ function useCoinbaseMintAnymalNFT() {
2934
2934
 
2935
2935
  // src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
2936
2936
  import { useCallback as useCallback13, useMemo as useMemo2 } from "react";
2937
- import { createPublicClient as createPublicClient2, http as http2 } from "viem";
2937
+ import { createPublicClient as createPublicClient2, decodeEventLog, http as http2 } from "viem";
2938
2938
  import { baseSepolia as baseSepolia2 } from "viem/chains";
2939
2939
  function useCoinbaseCreateOrganizationWallet() {
2940
2940
  const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
@@ -2951,7 +2951,6 @@ function useCoinbaseCreateOrganizationWallet() {
2951
2951
  *
2952
2952
  * @param orgPid - The PID of the organization as registered in Firestore.
2953
2953
  * @param orgName - The name of the organization as registered in Firestore.
2954
- * @param ownerAddress - The wallet address of the user who will be the default manager.
2955
2954
  * @param orgContractAddress - The contract address of the organization beacon.
2956
2955
  * @param evmAddress - The Coinbase smart account address of the admin.
2957
2956
  * @returns A promise with success status, message, and optional proxyAddress.
@@ -2961,35 +2960,55 @@ function useCoinbaseCreateOrganizationWallet() {
2961
2960
  return {
2962
2961
  success: false,
2963
2962
  message: "Missing required parameters for organization creation.",
2964
- status: "error",
2965
- data
2963
+ status: "error"
2966
2964
  };
2967
2965
  }
2966
+ const result = await sendOperationFn(
2967
+ evmAddress,
2968
+ orgContractAddress,
2969
+ ORGANIZATION_BEACON_ABI,
2970
+ "createOrganizationProxy",
2971
+ [ownerAddress, orgName, orgPid]
2972
+ );
2973
+ if (!result.success) {
2974
+ return { ...result, status: "error" };
2975
+ }
2976
+ let proxyAddress;
2968
2977
  try {
2969
- const result = await sendOperationFn(
2970
- evmAddress,
2971
- orgContractAddress,
2972
- ORGANIZATION_BEACON_ABI,
2973
- "createOrganizationProxy",
2974
- [ownerAddress, orgName, orgPid]
2975
- );
2976
- if (!result.success) {
2977
- return { ...result, status: "error", data };
2978
+ const txHash = data?.receipts?.[0]?.transactionHash || data?.transactionHash;
2979
+ if (txHash) {
2980
+ const receipt = await publicClient.getTransactionReceipt({
2981
+ hash: txHash
2982
+ });
2983
+ for (const log of receipt.logs) {
2984
+ try {
2985
+ const decoded = decodeEventLog({
2986
+ abi: ORGANIZATION_BEACON_ABI,
2987
+ data: log.data,
2988
+ topics: log.topics
2989
+ });
2990
+ if (decoded.eventName === "NewOrganizationCreated") {
2991
+ proxyAddress = decoded.args.proxyAddress;
2992
+ break;
2993
+ }
2994
+ } catch {
2995
+ }
2996
+ }
2978
2997
  }
2998
+ } catch (e) {
2999
+ console.error("Failed to get transaction receipt:", e);
3000
+ }
3001
+ if (!proxyAddress) {
2979
3002
  return {
2980
3003
  ...result,
2981
- status,
2982
- data
2983
- };
2984
- } catch (error) {
2985
- console.error("Org wallet creation error", error);
2986
- return {
2987
- success: false,
2988
- message: "Error",
2989
- status: "error",
2990
- data
3004
+ status
2991
3005
  };
2992
3006
  }
3007
+ return {
3008
+ ...result,
3009
+ proxyAddress,
3010
+ status
3011
+ };
2993
3012
  },
2994
3013
  [sendOperationFn, data, publicClient, status]
2995
3014
  );
@@ -3507,7 +3526,7 @@ function useApproveKibbleToken() {
3507
3526
 
3508
3527
  // src/utils/organization/useCreateOrganizationBase.ts
3509
3528
  import { useCallback as useCallback19 } from "react";
3510
- import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3529
+ import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
3511
3530
  function useCreateOrganizationBase() {
3512
3531
  return useCallback19(
3513
3532
  /**
@@ -3569,7 +3588,7 @@ function useCreateOrganizationBase() {
3569
3588
  let proxyAddress;
3570
3589
  for (const log of txReceipt.logs) {
3571
3590
  try {
3572
- const decoded = decodeEventLog({
3591
+ const decoded = decodeEventLog2({
3573
3592
  abi: ORGANIZATION_BEACON_ABI,
3574
3593
  data: log.data,
3575
3594
  topics: log.topics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
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": {