anymal-protocol 1.0.132 → 1.0.134

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
@@ -420,6 +420,24 @@ declare const ERROR_ABI: (abitype.Abi | {
420
420
  })[];
421
421
  declare const ORG_FUNCTION = "executeCall";
422
422
 
423
+ /**
424
+ * React hook to create a new organization on-chain via the Organization beacon contract
425
+ * using Coinbase smart wallet.
426
+ *
427
+ * This method can only be called by an admin of the Anymal Organization Beacon contract.
428
+ *
429
+ * @returns {Function} - Async function to create the organization.
430
+ */
431
+ declare function useCoinbaseCreateOrganizationWallet(): {
432
+ createOrganization: (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
433
+ success: boolean;
434
+ message: string;
435
+ proxyAddress?: string;
436
+ status: string;
437
+ }>;
438
+ status: _coinbase_cdp_hooks.Status;
439
+ };
440
+
423
441
  declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
424
442
  success: boolean;
425
443
  message: string;
@@ -856,4 +874,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
856
874
  */
857
875
  declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
858
876
 
859
- export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
877
+ export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
package/dist/index.d.ts CHANGED
@@ -420,6 +420,24 @@ declare const ERROR_ABI: (abitype.Abi | {
420
420
  })[];
421
421
  declare const ORG_FUNCTION = "executeCall";
422
422
 
423
+ /**
424
+ * React hook to create a new organization on-chain via the Organization beacon contract
425
+ * using Coinbase smart wallet.
426
+ *
427
+ * This method can only be called by an admin of the Anymal Organization Beacon contract.
428
+ *
429
+ * @returns {Function} - Async function to create the organization.
430
+ */
431
+ declare function useCoinbaseCreateOrganizationWallet(): {
432
+ createOrganization: (orgPid: string, orgName: string, ownerAddress: string, orgContractAddress: `0x${string}`, evmAddress: `0x${string}`) => Promise<{
433
+ success: boolean;
434
+ message: string;
435
+ proxyAddress?: string;
436
+ status: string;
437
+ }>;
438
+ status: _coinbase_cdp_hooks.Status;
439
+ };
440
+
423
441
  declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
424
442
  success: boolean;
425
443
  message: string;
@@ -856,4 +874,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
856
874
  */
857
875
  declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
858
876
 
859
- export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
877
+ export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
package/dist/index.js CHANGED
@@ -62,6 +62,7 @@ __export(index_exports, {
62
62
  useClaimActionReward: () => useClaimActionReward,
63
63
  useClaimOrgActionReward: () => useClaimOrgActionReward,
64
64
  useCoinbaseClaimActionReward: () => useCoinbaseClaimActionReward,
65
+ useCoinbaseCreateOrganizationWallet: () => useCoinbaseCreateOrganizationWallet,
65
66
  useCoinbaseMintAnymalNFT: () => useCoinbaseMintAnymalNFT,
66
67
  useCreateOrganizationAppData: () => useCreateOrganizationAppData,
67
68
  useCreateOrganizationBase: () => useCreateOrganizationBase,
@@ -491,7 +492,6 @@ function useSendCoinbaseUserOperation() {
491
492
  args,
492
493
  account: evmAddress
493
494
  });
494
- console.log("\u2705 Simulation successful");
495
495
  } catch (simError) {
496
496
  console.error("\u274C Simulation failed:", simError);
497
497
  return {
@@ -3011,9 +3011,95 @@ function useCoinbaseMintAnymalNFT() {
3011
3011
  );
3012
3012
  }
3013
3013
 
3014
- // src/utils/anymals/useMintAnymalNFT.ts
3015
- var import_viem4 = require("viem");
3014
+ // src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
3016
3015
  var import_react13 = require("react");
3016
+ var import_viem3 = require("viem");
3017
+ var import_chains2 = require("viem/chains");
3018
+ 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
+ );
3027
+ const createOrganization = (0, import_react13.useCallback)(
3028
+ /**
3029
+ * Creates a new organization on-chain.
3030
+ *
3031
+ * @param orgPid - The PID of the organization as registered in DefraDB.
3032
+ * @param orgName - The name of the organization as registered in DefraDB.
3033
+ * @param ownerAddress - The wallet address of the user who will be the default manager.
3034
+ * @param orgContractAddress - The contract address of the organization beacon.
3035
+ * @param evmAddress - The Coinbase smart account address of the admin.
3036
+ * @returns A promise with success status, message, and optional proxyAddress.
3037
+ */
3038
+ async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
3039
+ if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
3040
+ return {
3041
+ success: false,
3042
+ message: "Missing required parameters for organization creation.",
3043
+ status: "error"
3044
+ };
3045
+ }
3046
+ const result = await sendOperationFn(
3047
+ evmAddress,
3048
+ orgContractAddress,
3049
+ ORGANIZATION_BEACON_ABI,
3050
+ "createOrganizationProxy",
3051
+ [ownerAddress, orgName, orgPid]
3052
+ );
3053
+ if (!result.success) {
3054
+ return { ...result, status: "error" };
3055
+ }
3056
+ let proxyAddress;
3057
+ try {
3058
+ if (data?.transactionHash) {
3059
+ const receipt = await publicClient.waitForTransactionReceipt({
3060
+ hash: data.transactionHash,
3061
+ timeout: 3e4
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
+ };
3094
+ },
3095
+ [sendOperationFn, data, publicClient, status]
3096
+ );
3097
+ return { createOrganization, status };
3098
+ }
3099
+
3100
+ // src/utils/anymals/useMintAnymalNFT.ts
3101
+ var import_viem5 = require("viem");
3102
+ var import_react14 = require("react");
3017
3103
 
3018
3104
  // src/helpers/GasEstimateHelper.tsx
3019
3105
  async function applyBundlerGasEstimator(account, bundlerClient, options) {
@@ -3057,18 +3143,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
3057
3143
  }
3058
3144
 
3059
3145
  // src/helpers/HumanRevert.tsx
3060
- var import_viem3 = require("viem");
3146
+ var import_viem4 = require("viem");
3061
3147
  function humanRevert(raw, shortMessage) {
3062
3148
  if (!raw) return shortMessage ?? "Simulation reverted";
3063
3149
  try {
3064
- const { errorName, args } = (0, import_viem3.decodeErrorResult)({
3150
+ const { errorName, args } = (0, import_viem4.decodeErrorResult)({
3065
3151
  abi: ERROR_ABI,
3066
3152
  data: raw
3067
3153
  });
3068
3154
  return `${errorName}(${args.map(String).join(", ")})`;
3069
3155
  } catch {
3070
3156
  if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
3071
- return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
3157
+ return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
3072
3158
  }
3073
3159
  return `${raw.slice(0, 10)}\u2026`;
3074
3160
  }
@@ -3094,7 +3180,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
3094
3180
 
3095
3181
  // src/utils/anymals/useMintAnymalNFT.ts
3096
3182
  function useMintAnymalNFT() {
3097
- return (0, import_react13.useCallback)(
3183
+ return (0, import_react14.useCallback)(
3098
3184
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
3099
3185
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
3100
3186
  return {
@@ -3110,7 +3196,7 @@ function useMintAnymalNFT() {
3110
3196
  "petastic-signup-campaign-1",
3111
3197
  anymalTxId
3112
3198
  ];
3113
- const callData = (0, import_viem4.encodeFunctionData)({
3199
+ const callData = (0, import_viem5.encodeFunctionData)({
3114
3200
  abi: PET_NFT_ABI,
3115
3201
  functionName,
3116
3202
  args
@@ -3146,9 +3232,9 @@ function useMintAnymalNFT() {
3146
3232
  }
3147
3233
 
3148
3234
  // src/utils/anymals/useSaveAnymalMetadata.ts
3149
- var import_react14 = require("react");
3235
+ var import_react15 = require("react");
3150
3236
  function useSaveAnymalMetadata() {
3151
- return (0, import_react14.useCallback)(
3237
+ return (0, import_react15.useCallback)(
3152
3238
  async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
3153
3239
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
3154
3240
  method: "POST",
@@ -3176,7 +3262,7 @@ function useSaveAnymalMetadata() {
3176
3262
  }
3177
3263
 
3178
3264
  // src/utils/anymals/useUploadAnymalImage.ts
3179
- var import_react15 = require("react");
3265
+ var import_react16 = require("react");
3180
3266
 
3181
3267
  // src/helpers/UploadImageHelper.tsx
3182
3268
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -3233,7 +3319,7 @@ function toBase64(file) {
3233
3319
 
3234
3320
  // src/utils/anymals/useUploadAnymalImage.ts
3235
3321
  function useUploadAnymalImage() {
3236
- return (0, import_react15.useCallback)(
3322
+ return (0, import_react16.useCallback)(
3237
3323
  async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3238
3324
  if (!imageFile || !idToken) {
3239
3325
  return {
@@ -3294,10 +3380,10 @@ function useUploadAnymalImage() {
3294
3380
  }
3295
3381
 
3296
3382
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3297
- var import_react16 = require("react");
3383
+ var import_react17 = require("react");
3298
3384
 
3299
3385
  // src/helpers/ProcessDirectPartialPayment.tsx
3300
- var import_viem5 = require("viem");
3386
+ var import_viem6 = require("viem");
3301
3387
 
3302
3388
  // src/helpers/SendUserOpWithRetries.tsx
3303
3389
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3357,7 +3443,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3357
3443
  deadline,
3358
3444
  backendSignature
3359
3445
  ];
3360
- const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
3446
+ const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
3361
3447
  abi: MARKETPLACE_ABI,
3362
3448
  functionName,
3363
3449
  args
@@ -3394,7 +3480,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3394
3480
 
3395
3481
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3396
3482
  function useProcessPartialKibblePayment() {
3397
- return (0, import_react16.useCallback)(
3483
+ return (0, import_react17.useCallback)(
3398
3484
  async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3399
3485
  if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
3400
3486
  return {
@@ -3450,23 +3536,23 @@ function useProcessPartialKibblePayment() {
3450
3536
  }
3451
3537
 
3452
3538
  // src/utils/marketplace/useApproveKibbleToken.ts
3453
- var import_react17 = require("react");
3539
+ var import_react18 = require("react");
3454
3540
 
3455
3541
  // src/helpers/ProcessDirectKibbleApproval.tsx
3456
- var import_viem6 = require("viem");
3542
+ var import_viem7 = require("viem");
3457
3543
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3458
3544
  try {
3459
3545
  const functionName = "approve";
3460
3546
  const args = [spenderAddress, approveAmount];
3461
- const approveCalldata = (0, import_viem6.encodeFunctionData)({
3462
- abi: import_viem6.erc20Abi,
3547
+ const approveCalldata = (0, import_viem7.encodeFunctionData)({
3548
+ abi: import_viem7.erc20Abi,
3463
3549
  functionName,
3464
3550
  args
3465
3551
  });
3466
3552
  await simulateCall(
3467
3553
  bundlerClient.client,
3468
3554
  kibbleTokenAddress,
3469
- import_viem6.erc20Abi,
3555
+ import_viem7.erc20Abi,
3470
3556
  functionName,
3471
3557
  args,
3472
3558
  smartAccount.address
@@ -3495,7 +3581,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
3495
3581
 
3496
3582
  // src/utils/marketplace/useApproveKibbleToken.ts
3497
3583
  function useApproveKibbleToken() {
3498
- return (0, import_react17.useCallback)(
3584
+ return (0, import_react18.useCallback)(
3499
3585
  async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
3500
3586
  try {
3501
3587
  const result = await processDirectKibbleApproval(
@@ -3522,10 +3608,10 @@ function useApproveKibbleToken() {
3522
3608
  }
3523
3609
 
3524
3610
  // src/utils/organization/useCreateOrganizationBase.ts
3525
- var import_react18 = require("react");
3526
- var import_viem7 = require("viem");
3611
+ var import_react19 = require("react");
3612
+ var import_viem8 = require("viem");
3527
3613
  function useCreateOrganizationBase() {
3528
- return (0, import_react18.useCallback)(
3614
+ return (0, import_react19.useCallback)(
3529
3615
  /**
3530
3616
  * Creates a new organization on-chain.
3531
3617
  *
@@ -3547,7 +3633,7 @@ function useCreateOrganizationBase() {
3547
3633
  try {
3548
3634
  const functionName = "createOrganizationProxy";
3549
3635
  const args = [ownerAddress, orgName, orgPid];
3550
- const callData = (0, import_viem7.encodeFunctionData)({
3636
+ const callData = (0, import_viem8.encodeFunctionData)({
3551
3637
  abi: ORGANIZATION_BEACON_ABI,
3552
3638
  functionName,
3553
3639
  args
@@ -3585,7 +3671,7 @@ function useCreateOrganizationBase() {
3585
3671
  let proxyAddress;
3586
3672
  for (const log of txReceipt.logs) {
3587
3673
  try {
3588
- const decoded = (0, import_viem7.decodeEventLog)({
3674
+ const decoded = (0, import_viem8.decodeEventLog)({
3589
3675
  abi: ORGANIZATION_BEACON_ABI,
3590
3676
  data: log.data,
3591
3677
  topics: log.topics
@@ -3621,13 +3707,13 @@ function useCreateOrganizationBase() {
3621
3707
  }
3622
3708
 
3623
3709
  // src/utils/organization/useApproveOrgKibbleToken.ts
3624
- var import_react19 = require("react");
3710
+ var import_react20 = require("react");
3625
3711
 
3626
3712
  // src/helpers/ProcessOrgKibbleApproval.tsx
3627
- var import_viem9 = require("viem");
3713
+ var import_viem10 = require("viem");
3628
3714
 
3629
3715
  // src/helpers/WaitForAllowance.tsx
3630
- var import_viem8 = require("viem");
3716
+ var import_viem9 = require("viem");
3631
3717
  async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
3632
3718
  const MAX_RETRIES = 10;
3633
3719
  const RETRY_INTERVAL = 2e3;
@@ -3636,7 +3722,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
3636
3722
  try {
3637
3723
  const currentAllowance = await publicClient.readContract({
3638
3724
  address: tokenAddress,
3639
- abi: import_viem8.erc20Abi,
3725
+ abi: import_viem9.erc20Abi,
3640
3726
  functionName: "allowance",
3641
3727
  args: [ownerAddress, spenderAddress]
3642
3728
  });
@@ -3661,13 +3747,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3661
3747
  if (approveAmount <= 0n) {
3662
3748
  return { success: false, message: "Approval amount must be greater than zero." };
3663
3749
  }
3664
- const approveCalldata = (0, import_viem9.encodeFunctionData)({
3665
- abi: import_viem9.erc20Abi,
3750
+ const approveCalldata = (0, import_viem10.encodeFunctionData)({
3751
+ abi: import_viem10.erc20Abi,
3666
3752
  functionName: "approve",
3667
3753
  args: [partialPaymentModuleAddress, approveAmount]
3668
3754
  });
3669
3755
  const args = [kibbleTokenAddress, approveCalldata];
3670
- const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
3756
+ const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
3671
3757
  abi: ORGANIZATION_IMPL_ABI,
3672
3758
  functionName: ORG_FUNCTION,
3673
3759
  args
@@ -3719,7 +3805,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3719
3805
 
3720
3806
  // src/utils/organization/useApproveOrgKibbleToken.ts
3721
3807
  function useApproveOrgPartialPayment() {
3722
- return (0, import_react19.useCallback)(
3808
+ return (0, import_react20.useCallback)(
3723
3809
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
3724
3810
  if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
3725
3811
  return {
@@ -3751,13 +3837,13 @@ function useApproveOrgPartialPayment() {
3751
3837
  }
3752
3838
 
3753
3839
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3754
- var import_react20 = require("react");
3840
+ var import_react21 = require("react");
3755
3841
 
3756
3842
  // src/helpers/ProcessOrgPartialPayment.tsx
3757
- var import_viem10 = require("viem");
3843
+ var import_viem11 = require("viem");
3758
3844
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3759
3845
  try {
3760
- const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
3846
+ const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
3761
3847
  abi: MARKETPLACE_ABI,
3762
3848
  functionName: "partialPay",
3763
3849
  args: [
@@ -3772,7 +3858,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3772
3858
  ]
3773
3859
  });
3774
3860
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3775
- const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
3861
+ const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
3776
3862
  abi: ORGANIZATION_IMPL_ABI,
3777
3863
  functionName: ORG_FUNCTION,
3778
3864
  args
@@ -3809,7 +3895,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3809
3895
 
3810
3896
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3811
3897
  function useProcessOrgPartialKibblePayment() {
3812
- return (0, import_react20.useCallback)(
3898
+ return (0, import_react21.useCallback)(
3813
3899
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3814
3900
  if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
3815
3901
  return {
@@ -3847,9 +3933,9 @@ function useProcessOrgPartialKibblePayment() {
3847
3933
  }
3848
3934
 
3849
3935
  // src/utils/organization/useUpdateOrgWalletAddress.ts
3850
- var import_react21 = require("react");
3936
+ var import_react22 = require("react");
3851
3937
  function useUpdateOrgWalletAddress() {
3852
- return (0, import_react21.useCallback)(
3938
+ return (0, import_react22.useCallback)(
3853
3939
  async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
3854
3940
  try {
3855
3941
  const mutation = `
@@ -3888,10 +3974,10 @@ function useUpdateOrgWalletAddress() {
3888
3974
  }
3889
3975
 
3890
3976
  // src/utils/organization/useMintOrgAnymalNFT.ts
3891
- var import_viem11 = require("viem");
3892
- var import_react22 = require("react");
3977
+ var import_viem12 = require("viem");
3978
+ var import_react23 = require("react");
3893
3979
  function useMintOrgAnymalNFT() {
3894
- return (0, import_react22.useCallback)(
3980
+ return (0, import_react23.useCallback)(
3895
3981
  async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
3896
3982
  if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
3897
3983
  return {
@@ -3907,13 +3993,13 @@ function useMintOrgAnymalNFT() {
3907
3993
  "petastic-signup-campaign-1",
3908
3994
  anymalTxId
3909
3995
  ];
3910
- const callData = (0, import_viem11.encodeFunctionData)({
3996
+ const callData = (0, import_viem12.encodeFunctionData)({
3911
3997
  abi: PET_NFT_ABI,
3912
3998
  functionName,
3913
3999
  args
3914
4000
  });
3915
4001
  const executeArgs = [validationContractAddress, callData];
3916
- const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
4002
+ const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
3917
4003
  abi: ORGANIZATION_IMPL_ABI,
3918
4004
  functionName: ORG_FUNCTION,
3919
4005
  args: executeArgs
@@ -3946,10 +4032,10 @@ function useMintOrgAnymalNFT() {
3946
4032
 
3947
4033
  // src/helpers/NonceHelper.tsx
3948
4034
  var import_uuid = require("uuid");
3949
- var import_viem12 = require("viem");
4035
+ var import_viem13 = require("viem");
3950
4036
  var generateBytes32Nonce = () => {
3951
4037
  const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
3952
- return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
4038
+ return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
3953
4039
  };
3954
4040
 
3955
4041
  // src/helpers/CryptoUtils.tsx
@@ -4159,9 +4245,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
4159
4245
  }
4160
4246
 
4161
4247
  // src/utils/actions/useFetchActions.ts
4162
- var import_react23 = require("react");
4248
+ var import_react24 = require("react");
4163
4249
  function useFetchActions() {
4164
- return (0, import_react23.useCallback)(
4250
+ return (0, import_react24.useCallback)(
4165
4251
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
4166
4252
  const params = new URLSearchParams({ pid });
4167
4253
  if (status) params.set("status", status);
@@ -4190,9 +4276,9 @@ function useFetchActions() {
4190
4276
  }
4191
4277
 
4192
4278
  // src/utils/actions/useFetchActionDefinitions.ts
4193
- var import_react24 = require("react");
4279
+ var import_react25 = require("react");
4194
4280
  function useFetchActionDefinitions() {
4195
- return (0, import_react24.useCallback)(
4281
+ return (0, import_react25.useCallback)(
4196
4282
  async (idToken, actionsServiceBaseUrl) => {
4197
4283
  try {
4198
4284
  const response = await fetch(
@@ -4289,10 +4375,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
4289
4375
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
4290
4376
 
4291
4377
  // src/utils/application/useCreateUserAppData.ts
4292
- var import_react25 = require("react");
4378
+ var import_react26 = require("react");
4293
4379
  var import_uuid2 = require("uuid");
4294
4380
  function useCreateUserAppData() {
4295
- return (0, import_react25.useCallback)(
4381
+ return (0, import_react26.useCallback)(
4296
4382
  async (appId, pid, dbAuthToken, endpoint) => {
4297
4383
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4298
4384
  const appValues = {
@@ -4347,10 +4433,10 @@ function useCreateUserAppData() {
4347
4433
  }
4348
4434
 
4349
4435
  // src/utils/application/useCreateOrganizationAppData.ts
4350
- var import_react26 = require("react");
4436
+ var import_react27 = require("react");
4351
4437
  var import_uuid3 = require("uuid");
4352
4438
  function useCreateOrganizationAppData() {
4353
- return (0, import_react26.useCallback)(
4439
+ return (0, import_react27.useCallback)(
4354
4440
  async (appId, pid, dbAuthToken, endpoint) => {
4355
4441
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4356
4442
  const appValues = {
@@ -4404,17 +4490,17 @@ function useCreateOrganizationAppData() {
4404
4490
  }
4405
4491
 
4406
4492
  // src/utils/balance/useFetchBalance.ts
4407
- var import_react27 = require("react");
4408
- var import_viem13 = require("viem");
4493
+ var import_react28 = require("react");
4494
+ var import_viem14 = require("viem");
4409
4495
  function useFetchBalance() {
4410
- return (0, import_react27.useCallback)(
4496
+ return (0, import_react28.useCallback)(
4411
4497
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4412
4498
  try {
4413
4499
  const balance = await publicClient.readContract({
4414
- address: (0, import_viem13.getAddress)(kibbleTokenAddress),
4415
- abi: import_viem13.erc20Abi,
4500
+ address: (0, import_viem14.getAddress)(kibbleTokenAddress),
4501
+ abi: import_viem14.erc20Abi,
4416
4502
  functionName: "balanceOf",
4417
- args: [(0, import_viem13.getAddress)(walletAddress)]
4503
+ args: [(0, import_viem14.getAddress)(walletAddress)]
4418
4504
  });
4419
4505
  return Number(balance);
4420
4506
  } catch (error) {
@@ -4426,10 +4512,10 @@ function useFetchBalance() {
4426
4512
  }
4427
4513
 
4428
4514
  // src/utils/actions/useClaimActionReward.ts
4429
- var import_viem14 = require("viem");
4430
- var import_react28 = require("react");
4515
+ var import_viem15 = require("viem");
4516
+ var import_react29 = require("react");
4431
4517
  function useClaimActionReward() {
4432
- return (0, import_react28.useCallback)(
4518
+ return (0, import_react29.useCallback)(
4433
4519
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
4434
4520
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
4435
4521
  return {
@@ -4439,7 +4525,7 @@ function useClaimActionReward() {
4439
4525
  }
4440
4526
  const args = [actionId, claimIndex];
4441
4527
  const functionName = "claimByIndex";
4442
- const callData = (0, import_viem14.encodeFunctionData)({
4528
+ const callData = (0, import_viem15.encodeFunctionData)({
4443
4529
  abi: REWARDABLE_ACTIONS_ABI,
4444
4530
  functionName,
4445
4531
  args
@@ -4475,10 +4561,10 @@ function useClaimActionReward() {
4475
4561
  }
4476
4562
 
4477
4563
  // src/utils/actions/useClaimOrgActionReward.ts
4478
- var import_viem15 = require("viem");
4479
- var import_react29 = require("react");
4564
+ var import_viem16 = require("viem");
4565
+ var import_react30 = require("react");
4480
4566
  function useClaimOrgActionReward() {
4481
- return (0, import_react29.useCallback)(
4567
+ return (0, import_react30.useCallback)(
4482
4568
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
4483
4569
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
4484
4570
  return {
@@ -4486,13 +4572,13 @@ function useClaimOrgActionReward() {
4486
4572
  message: "Missing web3auth account info or contract address."
4487
4573
  };
4488
4574
  }
4489
- const claimCallData = (0, import_viem15.encodeFunctionData)({
4575
+ const claimCallData = (0, import_viem16.encodeFunctionData)({
4490
4576
  abi: REWARDABLE_ACTIONS_ABI,
4491
4577
  functionName: "claimByIndex",
4492
4578
  args: [actionId, claimIndex]
4493
4579
  });
4494
4580
  const args = [rewardableActionContractAddress, claimCallData];
4495
- const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
4581
+ const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
4496
4582
  abi: ORGANIZATION_IMPL_ABI,
4497
4583
  functionName: ORG_FUNCTION,
4498
4584
  args
@@ -4528,9 +4614,9 @@ function useClaimOrgActionReward() {
4528
4614
  }
4529
4615
 
4530
4616
  // src/utils/actions/useSubmitContractAction.ts
4531
- var import_react30 = require("react");
4617
+ var import_react31 = require("react");
4532
4618
  function useSubmitContractAction() {
4533
- return (0, import_react30.useCallback)(
4619
+ return (0, import_react31.useCallback)(
4534
4620
  (idToken, pid, source, endpoint, payload) => {
4535
4621
  if (!idToken || !pid || !source || !endpoint || !payload) return;
4536
4622
  let sourceTypePayload = {};
@@ -4689,6 +4775,7 @@ function isMarketplacePurchaseAction(payload) {
4689
4775
  useClaimActionReward,
4690
4776
  useClaimOrgActionReward,
4691
4777
  useCoinbaseClaimActionReward,
4778
+ useCoinbaseCreateOrganizationWallet,
4692
4779
  useCoinbaseMintAnymalNFT,
4693
4780
  useCreateOrganizationAppData,
4694
4781
  useCreateOrganizationBase,
package/dist/index.mjs CHANGED
@@ -413,7 +413,6 @@ function useSendCoinbaseUserOperation() {
413
413
  args,
414
414
  account: evmAddress
415
415
  });
416
- console.log("\u2705 Simulation successful");
417
416
  } catch (simError) {
418
417
  console.error("\u274C Simulation failed:", simError);
419
418
  return {
@@ -2933,9 +2932,95 @@ function useCoinbaseMintAnymalNFT() {
2933
2932
  );
2934
2933
  }
2935
2934
 
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";
2939
+ function useCoinbaseCreateOrganizationWallet() {
2940
+ const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
2941
+ const publicClient = useMemo2(
2942
+ () => createPublicClient2({
2943
+ chain: baseSepolia2,
2944
+ transport: http2()
2945
+ }),
2946
+ []
2947
+ );
2948
+ const createOrganization = useCallback13(
2949
+ /**
2950
+ * Creates a new organization on-chain.
2951
+ *
2952
+ * @param orgPid - The PID of the organization as registered in DefraDB.
2953
+ * @param orgName - The name of the organization as registered in DefraDB.
2954
+ * @param ownerAddress - The wallet address of the user who will be the default manager.
2955
+ * @param orgContractAddress - The contract address of the organization beacon.
2956
+ * @param evmAddress - The Coinbase smart account address of the admin.
2957
+ * @returns A promise with success status, message, and optional proxyAddress.
2958
+ */
2959
+ async (orgPid, orgName, ownerAddress, orgContractAddress, evmAddress) => {
2960
+ if (!orgPid || !orgName || !ownerAddress || !orgContractAddress || !evmAddress) {
2961
+ return {
2962
+ success: false,
2963
+ message: "Missing required parameters for organization creation.",
2964
+ status: "error"
2965
+ };
2966
+ }
2967
+ const result = await sendOperationFn(
2968
+ evmAddress,
2969
+ orgContractAddress,
2970
+ ORGANIZATION_BEACON_ABI,
2971
+ "createOrganizationProxy",
2972
+ [ownerAddress, orgName, orgPid]
2973
+ );
2974
+ if (!result.success) {
2975
+ return { ...result, status: "error" };
2976
+ }
2977
+ let proxyAddress;
2978
+ try {
2979
+ if (data?.transactionHash) {
2980
+ const receipt = await publicClient.waitForTransactionReceipt({
2981
+ hash: data.transactionHash,
2982
+ timeout: 3e4
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
+ };
3015
+ },
3016
+ [sendOperationFn, data, publicClient, status]
3017
+ );
3018
+ return { createOrganization, status };
3019
+ }
3020
+
2936
3021
  // src/utils/anymals/useMintAnymalNFT.ts
2937
3022
  import { encodeFunctionData as encodeFunctionData2 } from "viem";
2938
- import { useCallback as useCallback13 } from "react";
3023
+ import { useCallback as useCallback14 } from "react";
2939
3024
 
2940
3025
  // src/helpers/GasEstimateHelper.tsx
2941
3026
  async function applyBundlerGasEstimator(account, bundlerClient, options) {
@@ -3016,7 +3101,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
3016
3101
 
3017
3102
  // src/utils/anymals/useMintAnymalNFT.ts
3018
3103
  function useMintAnymalNFT() {
3019
- return useCallback13(
3104
+ return useCallback14(
3020
3105
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
3021
3106
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
3022
3107
  return {
@@ -3068,9 +3153,9 @@ function useMintAnymalNFT() {
3068
3153
  }
3069
3154
 
3070
3155
  // src/utils/anymals/useSaveAnymalMetadata.ts
3071
- import { useCallback as useCallback14 } from "react";
3156
+ import { useCallback as useCallback15 } from "react";
3072
3157
  function useSaveAnymalMetadata() {
3073
- return useCallback14(
3158
+ return useCallback15(
3074
3159
  async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
3075
3160
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
3076
3161
  method: "POST",
@@ -3098,7 +3183,7 @@ function useSaveAnymalMetadata() {
3098
3183
  }
3099
3184
 
3100
3185
  // src/utils/anymals/useUploadAnymalImage.ts
3101
- import { useCallback as useCallback15 } from "react";
3186
+ import { useCallback as useCallback16 } from "react";
3102
3187
 
3103
3188
  // src/helpers/UploadImageHelper.tsx
3104
3189
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -3155,7 +3240,7 @@ function toBase64(file) {
3155
3240
 
3156
3241
  // src/utils/anymals/useUploadAnymalImage.ts
3157
3242
  function useUploadAnymalImage() {
3158
- return useCallback15(
3243
+ return useCallback16(
3159
3244
  async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3160
3245
  if (!imageFile || !idToken) {
3161
3246
  return {
@@ -3216,7 +3301,7 @@ function useUploadAnymalImage() {
3216
3301
  }
3217
3302
 
3218
3303
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3219
- import { useCallback as useCallback16 } from "react";
3304
+ import { useCallback as useCallback17 } from "react";
3220
3305
 
3221
3306
  // src/helpers/ProcessDirectPartialPayment.tsx
3222
3307
  import { encodeFunctionData as encodeFunctionData3 } from "viem";
@@ -3316,7 +3401,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3316
3401
 
3317
3402
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3318
3403
  function useProcessPartialKibblePayment() {
3319
- return useCallback16(
3404
+ return useCallback17(
3320
3405
  async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3321
3406
  if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
3322
3407
  return {
@@ -3372,7 +3457,7 @@ function useProcessPartialKibblePayment() {
3372
3457
  }
3373
3458
 
3374
3459
  // src/utils/marketplace/useApproveKibbleToken.ts
3375
- import { useCallback as useCallback17 } from "react";
3460
+ import { useCallback as useCallback18 } from "react";
3376
3461
 
3377
3462
  // src/helpers/ProcessDirectKibbleApproval.tsx
3378
3463
  import { encodeFunctionData as encodeFunctionData4, erc20Abi } from "viem";
@@ -3417,7 +3502,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
3417
3502
 
3418
3503
  // src/utils/marketplace/useApproveKibbleToken.ts
3419
3504
  function useApproveKibbleToken() {
3420
- return useCallback17(
3505
+ return useCallback18(
3421
3506
  async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
3422
3507
  try {
3423
3508
  const result = await processDirectKibbleApproval(
@@ -3444,10 +3529,10 @@ function useApproveKibbleToken() {
3444
3529
  }
3445
3530
 
3446
3531
  // src/utils/organization/useCreateOrganizationBase.ts
3447
- import { useCallback as useCallback18 } from "react";
3448
- import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3532
+ import { useCallback as useCallback19 } from "react";
3533
+ import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
3449
3534
  function useCreateOrganizationBase() {
3450
- return useCallback18(
3535
+ return useCallback19(
3451
3536
  /**
3452
3537
  * Creates a new organization on-chain.
3453
3538
  *
@@ -3507,7 +3592,7 @@ function useCreateOrganizationBase() {
3507
3592
  let proxyAddress;
3508
3593
  for (const log of txReceipt.logs) {
3509
3594
  try {
3510
- const decoded = decodeEventLog({
3595
+ const decoded = decodeEventLog2({
3511
3596
  abi: ORGANIZATION_BEACON_ABI,
3512
3597
  data: log.data,
3513
3598
  topics: log.topics
@@ -3543,7 +3628,7 @@ function useCreateOrganizationBase() {
3543
3628
  }
3544
3629
 
3545
3630
  // src/utils/organization/useApproveOrgKibbleToken.ts
3546
- import { useCallback as useCallback19 } from "react";
3631
+ import { useCallback as useCallback20 } from "react";
3547
3632
 
3548
3633
  // src/helpers/ProcessOrgKibbleApproval.tsx
3549
3634
  import { encodeFunctionData as encodeFunctionData6, erc20Abi as erc20Abi3 } from "viem";
@@ -3641,7 +3726,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3641
3726
 
3642
3727
  // src/utils/organization/useApproveOrgKibbleToken.ts
3643
3728
  function useApproveOrgPartialPayment() {
3644
- return useCallback19(
3729
+ return useCallback20(
3645
3730
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
3646
3731
  if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
3647
3732
  return {
@@ -3673,7 +3758,7 @@ function useApproveOrgPartialPayment() {
3673
3758
  }
3674
3759
 
3675
3760
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3676
- import { useCallback as useCallback20 } from "react";
3761
+ import { useCallback as useCallback21 } from "react";
3677
3762
 
3678
3763
  // src/helpers/ProcessOrgPartialPayment.tsx
3679
3764
  import { encodeFunctionData as encodeFunctionData7 } from "viem";
@@ -3731,7 +3816,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3731
3816
 
3732
3817
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3733
3818
  function useProcessOrgPartialKibblePayment() {
3734
- return useCallback20(
3819
+ return useCallback21(
3735
3820
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3736
3821
  if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
3737
3822
  return {
@@ -3769,9 +3854,9 @@ function useProcessOrgPartialKibblePayment() {
3769
3854
  }
3770
3855
 
3771
3856
  // src/utils/organization/useUpdateOrgWalletAddress.ts
3772
- import { useCallback as useCallback21 } from "react";
3857
+ import { useCallback as useCallback22 } from "react";
3773
3858
  function useUpdateOrgWalletAddress() {
3774
- return useCallback21(
3859
+ return useCallback22(
3775
3860
  async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
3776
3861
  try {
3777
3862
  const mutation = `
@@ -3811,9 +3896,9 @@ function useUpdateOrgWalletAddress() {
3811
3896
 
3812
3897
  // src/utils/organization/useMintOrgAnymalNFT.ts
3813
3898
  import { encodeFunctionData as encodeFunctionData8 } from "viem";
3814
- import { useCallback as useCallback22 } from "react";
3899
+ import { useCallback as useCallback23 } from "react";
3815
3900
  function useMintOrgAnymalNFT() {
3816
- return useCallback22(
3901
+ return useCallback23(
3817
3902
  async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
3818
3903
  if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
3819
3904
  return {
@@ -3898,9 +3983,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
3898
3983
  }
3899
3984
 
3900
3985
  // src/utils/actions/useFetchActions.ts
3901
- import { useCallback as useCallback23 } from "react";
3986
+ import { useCallback as useCallback24 } from "react";
3902
3987
  function useFetchActions() {
3903
- return useCallback23(
3988
+ return useCallback24(
3904
3989
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
3905
3990
  const params = new URLSearchParams({ pid });
3906
3991
  if (status) params.set("status", status);
@@ -3929,9 +4014,9 @@ function useFetchActions() {
3929
4014
  }
3930
4015
 
3931
4016
  // src/utils/actions/useFetchActionDefinitions.ts
3932
- import { useCallback as useCallback24 } from "react";
4017
+ import { useCallback as useCallback25 } from "react";
3933
4018
  function useFetchActionDefinitions() {
3934
- return useCallback24(
4019
+ return useCallback25(
3935
4020
  async (idToken, actionsServiceBaseUrl) => {
3936
4021
  try {
3937
4022
  const response = await fetch(
@@ -4028,10 +4113,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
4028
4113
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
4029
4114
 
4030
4115
  // src/utils/application/useCreateUserAppData.ts
4031
- import { useCallback as useCallback25 } from "react";
4116
+ import { useCallback as useCallback26 } from "react";
4032
4117
  import { v4 as uuid } from "uuid";
4033
4118
  function useCreateUserAppData() {
4034
- return useCallback25(
4119
+ return useCallback26(
4035
4120
  async (appId, pid, dbAuthToken, endpoint) => {
4036
4121
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4037
4122
  const appValues = {
@@ -4086,10 +4171,10 @@ function useCreateUserAppData() {
4086
4171
  }
4087
4172
 
4088
4173
  // src/utils/application/useCreateOrganizationAppData.ts
4089
- import { useCallback as useCallback26 } from "react";
4174
+ import { useCallback as useCallback27 } from "react";
4090
4175
  import { v4 as uuid2 } from "uuid";
4091
4176
  function useCreateOrganizationAppData() {
4092
- return useCallback26(
4177
+ return useCallback27(
4093
4178
  async (appId, pid, dbAuthToken, endpoint) => {
4094
4179
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4095
4180
  const appValues = {
@@ -4143,10 +4228,10 @@ function useCreateOrganizationAppData() {
4143
4228
  }
4144
4229
 
4145
4230
  // src/utils/balance/useFetchBalance.ts
4146
- import { useCallback as useCallback27 } from "react";
4231
+ import { useCallback as useCallback28 } from "react";
4147
4232
  import { erc20Abi as erc20Abi4, getAddress } from "viem";
4148
4233
  function useFetchBalance() {
4149
- return useCallback27(
4234
+ return useCallback28(
4150
4235
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4151
4236
  try {
4152
4237
  const balance = await publicClient.readContract({
@@ -4166,9 +4251,9 @@ function useFetchBalance() {
4166
4251
 
4167
4252
  // src/utils/actions/useClaimActionReward.ts
4168
4253
  import { encodeFunctionData as encodeFunctionData9 } from "viem";
4169
- import { useCallback as useCallback28 } from "react";
4254
+ import { useCallback as useCallback29 } from "react";
4170
4255
  function useClaimActionReward() {
4171
- return useCallback28(
4256
+ return useCallback29(
4172
4257
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
4173
4258
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
4174
4259
  return {
@@ -4215,9 +4300,9 @@ function useClaimActionReward() {
4215
4300
 
4216
4301
  // src/utils/actions/useClaimOrgActionReward.ts
4217
4302
  import { encodeFunctionData as encodeFunctionData10 } from "viem";
4218
- import { useCallback as useCallback29 } from "react";
4303
+ import { useCallback as useCallback30 } from "react";
4219
4304
  function useClaimOrgActionReward() {
4220
- return useCallback29(
4305
+ return useCallback30(
4221
4306
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
4222
4307
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
4223
4308
  return {
@@ -4267,9 +4352,9 @@ function useClaimOrgActionReward() {
4267
4352
  }
4268
4353
 
4269
4354
  // src/utils/actions/useSubmitContractAction.ts
4270
- import { useCallback as useCallback30 } from "react";
4355
+ import { useCallback as useCallback31 } from "react";
4271
4356
  function useSubmitContractAction() {
4272
- return useCallback30(
4357
+ return useCallback31(
4273
4358
  (idToken, pid, source, endpoint, payload) => {
4274
4359
  if (!idToken || !pid || !source || !endpoint || !payload) return;
4275
4360
  let sourceTypePayload = {};
@@ -4427,6 +4512,7 @@ export {
4427
4512
  useClaimActionReward,
4428
4513
  useClaimOrgActionReward,
4429
4514
  useCoinbaseClaimActionReward,
4515
+ useCoinbaseCreateOrganizationWallet,
4430
4516
  useCoinbaseMintAnymalNFT,
4431
4517
  useCreateOrganizationAppData,
4432
4518
  useCreateOrganizationBase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
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": {