anymal-protocol 1.0.143 → 1.0.145

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
@@ -3035,39 +3035,59 @@ function useCoinbaseCreateOrganizationWallet() {
3035
3035
  * @returns A promise with success status, message, and optional proxyAddress.
3036
3036
  */
3037
3037
  async (orgPid, orgName, orgContractAddress, evmAddress) => {
3038
- if (!orgPid || !orgName || !evmAddress || !orgContractAddress) {
3038
+ if (!orgPid || !orgName || !orgContractAddress || !evmAddress) {
3039
3039
  return {
3040
3040
  success: false,
3041
3041
  message: "Missing required parameters for organization creation.",
3042
- status: "error",
3043
- data
3042
+ status: "error"
3044
3043
  };
3045
3044
  }
3045
+ const result = await sendOperationFn(
3046
+ evmAddress,
3047
+ orgContractAddress,
3048
+ ORGANIZATION_BEACON_ABI,
3049
+ "createOrganizationProxy",
3050
+ [evmAddress, orgName, orgPid]
3051
+ );
3052
+ if (!result.success) {
3053
+ return { ...result, status: "error" };
3054
+ }
3055
+ let proxyAddress;
3046
3056
  try {
3047
- const result = await sendOperationFn(
3048
- evmAddress,
3049
- orgContractAddress,
3050
- ORGANIZATION_BEACON_ABI,
3051
- "createOrganizationProxy",
3052
- [evmAddress, orgName, orgPid]
3053
- );
3054
- if (!result.success) {
3055
- 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
+ }
3056
3076
  }
3077
+ } catch (e) {
3078
+ console.error("Failed to get transaction receipt:", e);
3079
+ }
3080
+ if (!proxyAddress) {
3057
3081
  return {
3058
3082
  ...result,
3059
- status,
3060
- data
3061
- };
3062
- } catch (error) {
3063
- console.error("Org wallet creation error", error);
3064
- return {
3065
- success: false,
3066
- message: "Error",
3067
- status: "error",
3068
- data
3083
+ status
3069
3084
  };
3070
3085
  }
3086
+ return {
3087
+ ...result,
3088
+ proxyAddress,
3089
+ status
3090
+ };
3071
3091
  },
3072
3092
  [sendOperationFn, data, publicClient, status]
3073
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();
@@ -2956,39 +2956,59 @@ function useCoinbaseCreateOrganizationWallet() {
2956
2956
  * @returns A promise with success status, message, and optional proxyAddress.
2957
2957
  */
2958
2958
  async (orgPid, orgName, orgContractAddress, evmAddress) => {
2959
- if (!orgPid || !orgName || !evmAddress || !orgContractAddress) {
2959
+ if (!orgPid || !orgName || !orgContractAddress || !evmAddress) {
2960
2960
  return {
2961
2961
  success: false,
2962
2962
  message: "Missing required parameters for organization creation.",
2963
- status: "error",
2964
- data
2963
+ status: "error"
2965
2964
  };
2966
2965
  }
2966
+ const result = await sendOperationFn(
2967
+ evmAddress,
2968
+ orgContractAddress,
2969
+ ORGANIZATION_BEACON_ABI,
2970
+ "createOrganizationProxy",
2971
+ [evmAddress, orgName, orgPid]
2972
+ );
2973
+ if (!result.success) {
2974
+ return { ...result, status: "error" };
2975
+ }
2976
+ let proxyAddress;
2967
2977
  try {
2968
- const result = await sendOperationFn(
2969
- evmAddress,
2970
- orgContractAddress,
2971
- ORGANIZATION_BEACON_ABI,
2972
- "createOrganizationProxy",
2973
- [evmAddress, orgName, orgPid]
2974
- );
2975
- if (!result.success) {
2976
- 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
+ }
2977
2997
  }
2998
+ } catch (e) {
2999
+ console.error("Failed to get transaction receipt:", e);
3000
+ }
3001
+ if (!proxyAddress) {
2978
3002
  return {
2979
3003
  ...result,
2980
- status,
2981
- data
2982
- };
2983
- } catch (error) {
2984
- console.error("Org wallet creation error", error);
2985
- return {
2986
- success: false,
2987
- message: "Error",
2988
- status: "error",
2989
- data
3004
+ status
2990
3005
  };
2991
3006
  }
3007
+ return {
3008
+ ...result,
3009
+ proxyAddress,
3010
+ status
3011
+ };
2992
3012
  },
2993
3013
  [sendOperationFn, data, publicClient, status]
2994
3014
  );
@@ -3506,7 +3526,7 @@ function useApproveKibbleToken() {
3506
3526
 
3507
3527
  // src/utils/organization/useCreateOrganizationBase.ts
3508
3528
  import { useCallback as useCallback19 } from "react";
3509
- import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3529
+ import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
3510
3530
  function useCreateOrganizationBase() {
3511
3531
  return useCallback19(
3512
3532
  /**
@@ -3568,7 +3588,7 @@ function useCreateOrganizationBase() {
3568
3588
  let proxyAddress;
3569
3589
  for (const log of txReceipt.logs) {
3570
3590
  try {
3571
- const decoded = decodeEventLog({
3591
+ const decoded = decodeEventLog2({
3572
3592
  abi: ORGANIZATION_BEACON_ABI,
3573
3593
  data: log.data,
3574
3594
  topics: log.topics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.143",
3
+ "version": "1.0.145",
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": {