anymal-protocol 1.0.133 → 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,
@@ -483,12 +484,6 @@ function useSendCoinbaseUserOperation() {
483
484
  if (!evmAddress || !contractAddress || !abi || !functionName) {
484
485
  return { success: false, message: "Missing required information" };
485
486
  }
486
- console.log("=== Contract Call Details ===");
487
- console.log("Function:", functionName);
488
- console.log("Args:", args);
489
- console.log("Contract:", contractAddress);
490
- console.log("Account:", evmAddress);
491
- console.log("============================");
492
487
  try {
493
488
  await publicClient.simulateContract({
494
489
  address: contractAddress,
@@ -497,10 +492,8 @@ function useSendCoinbaseUserOperation() {
497
492
  args,
498
493
  account: evmAddress
499
494
  });
500
- console.log("\u2705 Simulation successful");
501
495
  } catch (simError) {
502
496
  console.error("\u274C Simulation failed:", simError);
503
- console.log("Failed with args:", JSON.stringify(args, null, 2));
504
497
  return {
505
498
  success: false,
506
499
  message: `Simulation failed: ${simError.shortMessage || simError.message}`
@@ -3018,9 +3011,95 @@ function useCoinbaseMintAnymalNFT() {
3018
3011
  );
3019
3012
  }
3020
3013
 
3021
- // src/utils/anymals/useMintAnymalNFT.ts
3022
- var import_viem4 = require("viem");
3014
+ // src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
3023
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");
3024
3103
 
3025
3104
  // src/helpers/GasEstimateHelper.tsx
3026
3105
  async function applyBundlerGasEstimator(account, bundlerClient, options) {
@@ -3064,18 +3143,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
3064
3143
  }
3065
3144
 
3066
3145
  // src/helpers/HumanRevert.tsx
3067
- var import_viem3 = require("viem");
3146
+ var import_viem4 = require("viem");
3068
3147
  function humanRevert(raw, shortMessage) {
3069
3148
  if (!raw) return shortMessage ?? "Simulation reverted";
3070
3149
  try {
3071
- const { errorName, args } = (0, import_viem3.decodeErrorResult)({
3150
+ const { errorName, args } = (0, import_viem4.decodeErrorResult)({
3072
3151
  abi: ERROR_ABI,
3073
3152
  data: raw
3074
3153
  });
3075
3154
  return `${errorName}(${args.map(String).join(", ")})`;
3076
3155
  } catch {
3077
3156
  if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
3078
- return (0, import_viem3.hexToString)(`0x${raw.slice(138)}`);
3157
+ return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
3079
3158
  }
3080
3159
  return `${raw.slice(0, 10)}\u2026`;
3081
3160
  }
@@ -3101,7 +3180,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
3101
3180
 
3102
3181
  // src/utils/anymals/useMintAnymalNFT.ts
3103
3182
  function useMintAnymalNFT() {
3104
- return (0, import_react13.useCallback)(
3183
+ return (0, import_react14.useCallback)(
3105
3184
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
3106
3185
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
3107
3186
  return {
@@ -3117,7 +3196,7 @@ function useMintAnymalNFT() {
3117
3196
  "petastic-signup-campaign-1",
3118
3197
  anymalTxId
3119
3198
  ];
3120
- const callData = (0, import_viem4.encodeFunctionData)({
3199
+ const callData = (0, import_viem5.encodeFunctionData)({
3121
3200
  abi: PET_NFT_ABI,
3122
3201
  functionName,
3123
3202
  args
@@ -3153,9 +3232,9 @@ function useMintAnymalNFT() {
3153
3232
  }
3154
3233
 
3155
3234
  // src/utils/anymals/useSaveAnymalMetadata.ts
3156
- var import_react14 = require("react");
3235
+ var import_react15 = require("react");
3157
3236
  function useSaveAnymalMetadata() {
3158
- return (0, import_react14.useCallback)(
3237
+ return (0, import_react15.useCallback)(
3159
3238
  async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
3160
3239
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
3161
3240
  method: "POST",
@@ -3183,7 +3262,7 @@ function useSaveAnymalMetadata() {
3183
3262
  }
3184
3263
 
3185
3264
  // src/utils/anymals/useUploadAnymalImage.ts
3186
- var import_react15 = require("react");
3265
+ var import_react16 = require("react");
3187
3266
 
3188
3267
  // src/helpers/UploadImageHelper.tsx
3189
3268
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -3240,7 +3319,7 @@ function toBase64(file) {
3240
3319
 
3241
3320
  // src/utils/anymals/useUploadAnymalImage.ts
3242
3321
  function useUploadAnymalImage() {
3243
- return (0, import_react15.useCallback)(
3322
+ return (0, import_react16.useCallback)(
3244
3323
  async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3245
3324
  if (!imageFile || !idToken) {
3246
3325
  return {
@@ -3301,10 +3380,10 @@ function useUploadAnymalImage() {
3301
3380
  }
3302
3381
 
3303
3382
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3304
- var import_react16 = require("react");
3383
+ var import_react17 = require("react");
3305
3384
 
3306
3385
  // src/helpers/ProcessDirectPartialPayment.tsx
3307
- var import_viem5 = require("viem");
3386
+ var import_viem6 = require("viem");
3308
3387
 
3309
3388
  // src/helpers/SendUserOpWithRetries.tsx
3310
3389
  async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
@@ -3364,7 +3443,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3364
3443
  deadline,
3365
3444
  backendSignature
3366
3445
  ];
3367
- const partialPayCalldata = (0, import_viem5.encodeFunctionData)({
3446
+ const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
3368
3447
  abi: MARKETPLACE_ABI,
3369
3448
  functionName,
3370
3449
  args
@@ -3401,7 +3480,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3401
3480
 
3402
3481
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3403
3482
  function useProcessPartialKibblePayment() {
3404
- return (0, import_react16.useCallback)(
3483
+ return (0, import_react17.useCallback)(
3405
3484
  async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3406
3485
  if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
3407
3486
  return {
@@ -3457,23 +3536,23 @@ function useProcessPartialKibblePayment() {
3457
3536
  }
3458
3537
 
3459
3538
  // src/utils/marketplace/useApproveKibbleToken.ts
3460
- var import_react17 = require("react");
3539
+ var import_react18 = require("react");
3461
3540
 
3462
3541
  // src/helpers/ProcessDirectKibbleApproval.tsx
3463
- var import_viem6 = require("viem");
3542
+ var import_viem7 = require("viem");
3464
3543
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
3465
3544
  try {
3466
3545
  const functionName = "approve";
3467
3546
  const args = [spenderAddress, approveAmount];
3468
- const approveCalldata = (0, import_viem6.encodeFunctionData)({
3469
- abi: import_viem6.erc20Abi,
3547
+ const approveCalldata = (0, import_viem7.encodeFunctionData)({
3548
+ abi: import_viem7.erc20Abi,
3470
3549
  functionName,
3471
3550
  args
3472
3551
  });
3473
3552
  await simulateCall(
3474
3553
  bundlerClient.client,
3475
3554
  kibbleTokenAddress,
3476
- import_viem6.erc20Abi,
3555
+ import_viem7.erc20Abi,
3477
3556
  functionName,
3478
3557
  args,
3479
3558
  smartAccount.address
@@ -3502,7 +3581,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
3502
3581
 
3503
3582
  // src/utils/marketplace/useApproveKibbleToken.ts
3504
3583
  function useApproveKibbleToken() {
3505
- return (0, import_react17.useCallback)(
3584
+ return (0, import_react18.useCallback)(
3506
3585
  async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
3507
3586
  try {
3508
3587
  const result = await processDirectKibbleApproval(
@@ -3529,10 +3608,10 @@ function useApproveKibbleToken() {
3529
3608
  }
3530
3609
 
3531
3610
  // src/utils/organization/useCreateOrganizationBase.ts
3532
- var import_react18 = require("react");
3533
- var import_viem7 = require("viem");
3611
+ var import_react19 = require("react");
3612
+ var import_viem8 = require("viem");
3534
3613
  function useCreateOrganizationBase() {
3535
- return (0, import_react18.useCallback)(
3614
+ return (0, import_react19.useCallback)(
3536
3615
  /**
3537
3616
  * Creates a new organization on-chain.
3538
3617
  *
@@ -3554,7 +3633,7 @@ function useCreateOrganizationBase() {
3554
3633
  try {
3555
3634
  const functionName = "createOrganizationProxy";
3556
3635
  const args = [ownerAddress, orgName, orgPid];
3557
- const callData = (0, import_viem7.encodeFunctionData)({
3636
+ const callData = (0, import_viem8.encodeFunctionData)({
3558
3637
  abi: ORGANIZATION_BEACON_ABI,
3559
3638
  functionName,
3560
3639
  args
@@ -3592,7 +3671,7 @@ function useCreateOrganizationBase() {
3592
3671
  let proxyAddress;
3593
3672
  for (const log of txReceipt.logs) {
3594
3673
  try {
3595
- const decoded = (0, import_viem7.decodeEventLog)({
3674
+ const decoded = (0, import_viem8.decodeEventLog)({
3596
3675
  abi: ORGANIZATION_BEACON_ABI,
3597
3676
  data: log.data,
3598
3677
  topics: log.topics
@@ -3628,13 +3707,13 @@ function useCreateOrganizationBase() {
3628
3707
  }
3629
3708
 
3630
3709
  // src/utils/organization/useApproveOrgKibbleToken.ts
3631
- var import_react19 = require("react");
3710
+ var import_react20 = require("react");
3632
3711
 
3633
3712
  // src/helpers/ProcessOrgKibbleApproval.tsx
3634
- var import_viem9 = require("viem");
3713
+ var import_viem10 = require("viem");
3635
3714
 
3636
3715
  // src/helpers/WaitForAllowance.tsx
3637
- var import_viem8 = require("viem");
3716
+ var import_viem9 = require("viem");
3638
3717
  async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
3639
3718
  const MAX_RETRIES = 10;
3640
3719
  const RETRY_INTERVAL = 2e3;
@@ -3643,7 +3722,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
3643
3722
  try {
3644
3723
  const currentAllowance = await publicClient.readContract({
3645
3724
  address: tokenAddress,
3646
- abi: import_viem8.erc20Abi,
3725
+ abi: import_viem9.erc20Abi,
3647
3726
  functionName: "allowance",
3648
3727
  args: [ownerAddress, spenderAddress]
3649
3728
  });
@@ -3668,13 +3747,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3668
3747
  if (approveAmount <= 0n) {
3669
3748
  return { success: false, message: "Approval amount must be greater than zero." };
3670
3749
  }
3671
- const approveCalldata = (0, import_viem9.encodeFunctionData)({
3672
- abi: import_viem9.erc20Abi,
3750
+ const approveCalldata = (0, import_viem10.encodeFunctionData)({
3751
+ abi: import_viem10.erc20Abi,
3673
3752
  functionName: "approve",
3674
3753
  args: [partialPaymentModuleAddress, approveAmount]
3675
3754
  });
3676
3755
  const args = [kibbleTokenAddress, approveCalldata];
3677
- const executeApproveCalldata = (0, import_viem9.encodeFunctionData)({
3756
+ const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
3678
3757
  abi: ORGANIZATION_IMPL_ABI,
3679
3758
  functionName: ORG_FUNCTION,
3680
3759
  args
@@ -3726,7 +3805,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3726
3805
 
3727
3806
  // src/utils/organization/useApproveOrgKibbleToken.ts
3728
3807
  function useApproveOrgPartialPayment() {
3729
- return (0, import_react19.useCallback)(
3808
+ return (0, import_react20.useCallback)(
3730
3809
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
3731
3810
  if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
3732
3811
  return {
@@ -3758,13 +3837,13 @@ function useApproveOrgPartialPayment() {
3758
3837
  }
3759
3838
 
3760
3839
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3761
- var import_react20 = require("react");
3840
+ var import_react21 = require("react");
3762
3841
 
3763
3842
  // src/helpers/ProcessOrgPartialPayment.tsx
3764
- var import_viem10 = require("viem");
3843
+ var import_viem11 = require("viem");
3765
3844
  async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
3766
3845
  try {
3767
- const partialPayCalldata = (0, import_viem10.encodeFunctionData)({
3846
+ const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
3768
3847
  abi: MARKETPLACE_ABI,
3769
3848
  functionName: "partialPay",
3770
3849
  args: [
@@ -3779,7 +3858,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3779
3858
  ]
3780
3859
  });
3781
3860
  const args = [partialPaymentModuleAddress, partialPayCalldata];
3782
- const executePartialPayCalldata = (0, import_viem10.encodeFunctionData)({
3861
+ const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
3783
3862
  abi: ORGANIZATION_IMPL_ABI,
3784
3863
  functionName: ORG_FUNCTION,
3785
3864
  args
@@ -3816,7 +3895,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3816
3895
 
3817
3896
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3818
3897
  function useProcessOrgPartialKibblePayment() {
3819
- return (0, import_react20.useCallback)(
3898
+ return (0, import_react21.useCallback)(
3820
3899
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3821
3900
  if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
3822
3901
  return {
@@ -3854,9 +3933,9 @@ function useProcessOrgPartialKibblePayment() {
3854
3933
  }
3855
3934
 
3856
3935
  // src/utils/organization/useUpdateOrgWalletAddress.ts
3857
- var import_react21 = require("react");
3936
+ var import_react22 = require("react");
3858
3937
  function useUpdateOrgWalletAddress() {
3859
- return (0, import_react21.useCallback)(
3938
+ return (0, import_react22.useCallback)(
3860
3939
  async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
3861
3940
  try {
3862
3941
  const mutation = `
@@ -3895,10 +3974,10 @@ function useUpdateOrgWalletAddress() {
3895
3974
  }
3896
3975
 
3897
3976
  // src/utils/organization/useMintOrgAnymalNFT.ts
3898
- var import_viem11 = require("viem");
3899
- var import_react22 = require("react");
3977
+ var import_viem12 = require("viem");
3978
+ var import_react23 = require("react");
3900
3979
  function useMintOrgAnymalNFT() {
3901
- return (0, import_react22.useCallback)(
3980
+ return (0, import_react23.useCallback)(
3902
3981
  async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
3903
3982
  if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
3904
3983
  return {
@@ -3914,13 +3993,13 @@ function useMintOrgAnymalNFT() {
3914
3993
  "petastic-signup-campaign-1",
3915
3994
  anymalTxId
3916
3995
  ];
3917
- const callData = (0, import_viem11.encodeFunctionData)({
3996
+ const callData = (0, import_viem12.encodeFunctionData)({
3918
3997
  abi: PET_NFT_ABI,
3919
3998
  functionName,
3920
3999
  args
3921
4000
  });
3922
4001
  const executeArgs = [validationContractAddress, callData];
3923
- const executeSubmitMetaCalldata = (0, import_viem11.encodeFunctionData)({
4002
+ const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
3924
4003
  abi: ORGANIZATION_IMPL_ABI,
3925
4004
  functionName: ORG_FUNCTION,
3926
4005
  args: executeArgs
@@ -3953,10 +4032,10 @@ function useMintOrgAnymalNFT() {
3953
4032
 
3954
4033
  // src/helpers/NonceHelper.tsx
3955
4034
  var import_uuid = require("uuid");
3956
- var import_viem12 = require("viem");
4035
+ var import_viem13 = require("viem");
3957
4036
  var generateBytes32Nonce = () => {
3958
4037
  const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
3959
- return (0, import_viem12.padHex)(`0x${uuid3}`, { size: 32 });
4038
+ return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
3960
4039
  };
3961
4040
 
3962
4041
  // src/helpers/CryptoUtils.tsx
@@ -4166,9 +4245,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
4166
4245
  }
4167
4246
 
4168
4247
  // src/utils/actions/useFetchActions.ts
4169
- var import_react23 = require("react");
4248
+ var import_react24 = require("react");
4170
4249
  function useFetchActions() {
4171
- return (0, import_react23.useCallback)(
4250
+ return (0, import_react24.useCallback)(
4172
4251
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
4173
4252
  const params = new URLSearchParams({ pid });
4174
4253
  if (status) params.set("status", status);
@@ -4197,9 +4276,9 @@ function useFetchActions() {
4197
4276
  }
4198
4277
 
4199
4278
  // src/utils/actions/useFetchActionDefinitions.ts
4200
- var import_react24 = require("react");
4279
+ var import_react25 = require("react");
4201
4280
  function useFetchActionDefinitions() {
4202
- return (0, import_react24.useCallback)(
4281
+ return (0, import_react25.useCallback)(
4203
4282
  async (idToken, actionsServiceBaseUrl) => {
4204
4283
  try {
4205
4284
  const response = await fetch(
@@ -4296,10 +4375,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
4296
4375
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
4297
4376
 
4298
4377
  // src/utils/application/useCreateUserAppData.ts
4299
- var import_react25 = require("react");
4378
+ var import_react26 = require("react");
4300
4379
  var import_uuid2 = require("uuid");
4301
4380
  function useCreateUserAppData() {
4302
- return (0, import_react25.useCallback)(
4381
+ return (0, import_react26.useCallback)(
4303
4382
  async (appId, pid, dbAuthToken, endpoint) => {
4304
4383
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4305
4384
  const appValues = {
@@ -4354,10 +4433,10 @@ function useCreateUserAppData() {
4354
4433
  }
4355
4434
 
4356
4435
  // src/utils/application/useCreateOrganizationAppData.ts
4357
- var import_react26 = require("react");
4436
+ var import_react27 = require("react");
4358
4437
  var import_uuid3 = require("uuid");
4359
4438
  function useCreateOrganizationAppData() {
4360
- return (0, import_react26.useCallback)(
4439
+ return (0, import_react27.useCallback)(
4361
4440
  async (appId, pid, dbAuthToken, endpoint) => {
4362
4441
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4363
4442
  const appValues = {
@@ -4411,17 +4490,17 @@ function useCreateOrganizationAppData() {
4411
4490
  }
4412
4491
 
4413
4492
  // src/utils/balance/useFetchBalance.ts
4414
- var import_react27 = require("react");
4415
- var import_viem13 = require("viem");
4493
+ var import_react28 = require("react");
4494
+ var import_viem14 = require("viem");
4416
4495
  function useFetchBalance() {
4417
- return (0, import_react27.useCallback)(
4496
+ return (0, import_react28.useCallback)(
4418
4497
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4419
4498
  try {
4420
4499
  const balance = await publicClient.readContract({
4421
- address: (0, import_viem13.getAddress)(kibbleTokenAddress),
4422
- abi: import_viem13.erc20Abi,
4500
+ address: (0, import_viem14.getAddress)(kibbleTokenAddress),
4501
+ abi: import_viem14.erc20Abi,
4423
4502
  functionName: "balanceOf",
4424
- args: [(0, import_viem13.getAddress)(walletAddress)]
4503
+ args: [(0, import_viem14.getAddress)(walletAddress)]
4425
4504
  });
4426
4505
  return Number(balance);
4427
4506
  } catch (error) {
@@ -4433,10 +4512,10 @@ function useFetchBalance() {
4433
4512
  }
4434
4513
 
4435
4514
  // src/utils/actions/useClaimActionReward.ts
4436
- var import_viem14 = require("viem");
4437
- var import_react28 = require("react");
4515
+ var import_viem15 = require("viem");
4516
+ var import_react29 = require("react");
4438
4517
  function useClaimActionReward() {
4439
- return (0, import_react28.useCallback)(
4518
+ return (0, import_react29.useCallback)(
4440
4519
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
4441
4520
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
4442
4521
  return {
@@ -4446,7 +4525,7 @@ function useClaimActionReward() {
4446
4525
  }
4447
4526
  const args = [actionId, claimIndex];
4448
4527
  const functionName = "claimByIndex";
4449
- const callData = (0, import_viem14.encodeFunctionData)({
4528
+ const callData = (0, import_viem15.encodeFunctionData)({
4450
4529
  abi: REWARDABLE_ACTIONS_ABI,
4451
4530
  functionName,
4452
4531
  args
@@ -4482,10 +4561,10 @@ function useClaimActionReward() {
4482
4561
  }
4483
4562
 
4484
4563
  // src/utils/actions/useClaimOrgActionReward.ts
4485
- var import_viem15 = require("viem");
4486
- var import_react29 = require("react");
4564
+ var import_viem16 = require("viem");
4565
+ var import_react30 = require("react");
4487
4566
  function useClaimOrgActionReward() {
4488
- return (0, import_react29.useCallback)(
4567
+ return (0, import_react30.useCallback)(
4489
4568
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
4490
4569
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
4491
4570
  return {
@@ -4493,13 +4572,13 @@ function useClaimOrgActionReward() {
4493
4572
  message: "Missing web3auth account info or contract address."
4494
4573
  };
4495
4574
  }
4496
- const claimCallData = (0, import_viem15.encodeFunctionData)({
4575
+ const claimCallData = (0, import_viem16.encodeFunctionData)({
4497
4576
  abi: REWARDABLE_ACTIONS_ABI,
4498
4577
  functionName: "claimByIndex",
4499
4578
  args: [actionId, claimIndex]
4500
4579
  });
4501
4580
  const args = [rewardableActionContractAddress, claimCallData];
4502
- const executeClaimCalldata = (0, import_viem15.encodeFunctionData)({
4581
+ const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
4503
4582
  abi: ORGANIZATION_IMPL_ABI,
4504
4583
  functionName: ORG_FUNCTION,
4505
4584
  args
@@ -4535,9 +4614,9 @@ function useClaimOrgActionReward() {
4535
4614
  }
4536
4615
 
4537
4616
  // src/utils/actions/useSubmitContractAction.ts
4538
- var import_react30 = require("react");
4617
+ var import_react31 = require("react");
4539
4618
  function useSubmitContractAction() {
4540
- return (0, import_react30.useCallback)(
4619
+ return (0, import_react31.useCallback)(
4541
4620
  (idToken, pid, source, endpoint, payload) => {
4542
4621
  if (!idToken || !pid || !source || !endpoint || !payload) return;
4543
4622
  let sourceTypePayload = {};
@@ -4696,6 +4775,7 @@ function isMarketplacePurchaseAction(payload) {
4696
4775
  useClaimActionReward,
4697
4776
  useClaimOrgActionReward,
4698
4777
  useCoinbaseClaimActionReward,
4778
+ useCoinbaseCreateOrganizationWallet,
4699
4779
  useCoinbaseMintAnymalNFT,
4700
4780
  useCreateOrganizationAppData,
4701
4781
  useCreateOrganizationBase,
package/dist/index.mjs CHANGED
@@ -405,12 +405,6 @@ function useSendCoinbaseUserOperation() {
405
405
  if (!evmAddress || !contractAddress || !abi || !functionName) {
406
406
  return { success: false, message: "Missing required information" };
407
407
  }
408
- console.log("=== Contract Call Details ===");
409
- console.log("Function:", functionName);
410
- console.log("Args:", args);
411
- console.log("Contract:", contractAddress);
412
- console.log("Account:", evmAddress);
413
- console.log("============================");
414
408
  try {
415
409
  await publicClient.simulateContract({
416
410
  address: contractAddress,
@@ -419,10 +413,8 @@ function useSendCoinbaseUserOperation() {
419
413
  args,
420
414
  account: evmAddress
421
415
  });
422
- console.log("\u2705 Simulation successful");
423
416
  } catch (simError) {
424
417
  console.error("\u274C Simulation failed:", simError);
425
- console.log("Failed with args:", JSON.stringify(args, null, 2));
426
418
  return {
427
419
  success: false,
428
420
  message: `Simulation failed: ${simError.shortMessage || simError.message}`
@@ -2940,9 +2932,95 @@ function useCoinbaseMintAnymalNFT() {
2940
2932
  );
2941
2933
  }
2942
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
+
2943
3021
  // src/utils/anymals/useMintAnymalNFT.ts
2944
3022
  import { encodeFunctionData as encodeFunctionData2 } from "viem";
2945
- import { useCallback as useCallback13 } from "react";
3023
+ import { useCallback as useCallback14 } from "react";
2946
3024
 
2947
3025
  // src/helpers/GasEstimateHelper.tsx
2948
3026
  async function applyBundlerGasEstimator(account, bundlerClient, options) {
@@ -3023,7 +3101,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
3023
3101
 
3024
3102
  // src/utils/anymals/useMintAnymalNFT.ts
3025
3103
  function useMintAnymalNFT() {
3026
- return useCallback13(
3104
+ return useCallback14(
3027
3105
  async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
3028
3106
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
3029
3107
  return {
@@ -3075,9 +3153,9 @@ function useMintAnymalNFT() {
3075
3153
  }
3076
3154
 
3077
3155
  // src/utils/anymals/useSaveAnymalMetadata.ts
3078
- import { useCallback as useCallback14 } from "react";
3156
+ import { useCallback as useCallback15 } from "react";
3079
3157
  function useSaveAnymalMetadata() {
3080
- return useCallback14(
3158
+ return useCallback15(
3081
3159
  async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
3082
3160
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
3083
3161
  method: "POST",
@@ -3105,7 +3183,7 @@ function useSaveAnymalMetadata() {
3105
3183
  }
3106
3184
 
3107
3185
  // src/utils/anymals/useUploadAnymalImage.ts
3108
- import { useCallback as useCallback15 } from "react";
3186
+ import { useCallback as useCallback16 } from "react";
3109
3187
 
3110
3188
  // src/helpers/UploadImageHelper.tsx
3111
3189
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -3162,7 +3240,7 @@ function toBase64(file) {
3162
3240
 
3163
3241
  // src/utils/anymals/useUploadAnymalImage.ts
3164
3242
  function useUploadAnymalImage() {
3165
- return useCallback15(
3243
+ return useCallback16(
3166
3244
  async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
3167
3245
  if (!imageFile || !idToken) {
3168
3246
  return {
@@ -3223,7 +3301,7 @@ function useUploadAnymalImage() {
3223
3301
  }
3224
3302
 
3225
3303
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3226
- import { useCallback as useCallback16 } from "react";
3304
+ import { useCallback as useCallback17 } from "react";
3227
3305
 
3228
3306
  // src/helpers/ProcessDirectPartialPayment.tsx
3229
3307
  import { encodeFunctionData as encodeFunctionData3 } from "viem";
@@ -3323,7 +3401,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
3323
3401
 
3324
3402
  // src/utils/marketplace/useProcessPartialKibblePayment.ts
3325
3403
  function useProcessPartialKibblePayment() {
3326
- return useCallback16(
3404
+ return useCallback17(
3327
3405
  async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3328
3406
  if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
3329
3407
  return {
@@ -3379,7 +3457,7 @@ function useProcessPartialKibblePayment() {
3379
3457
  }
3380
3458
 
3381
3459
  // src/utils/marketplace/useApproveKibbleToken.ts
3382
- import { useCallback as useCallback17 } from "react";
3460
+ import { useCallback as useCallback18 } from "react";
3383
3461
 
3384
3462
  // src/helpers/ProcessDirectKibbleApproval.tsx
3385
3463
  import { encodeFunctionData as encodeFunctionData4, erc20Abi } from "viem";
@@ -3424,7 +3502,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
3424
3502
 
3425
3503
  // src/utils/marketplace/useApproveKibbleToken.ts
3426
3504
  function useApproveKibbleToken() {
3427
- return useCallback17(
3505
+ return useCallback18(
3428
3506
  async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
3429
3507
  try {
3430
3508
  const result = await processDirectKibbleApproval(
@@ -3451,10 +3529,10 @@ function useApproveKibbleToken() {
3451
3529
  }
3452
3530
 
3453
3531
  // src/utils/organization/useCreateOrganizationBase.ts
3454
- import { useCallback as useCallback18 } from "react";
3455
- import { decodeEventLog, encodeFunctionData as encodeFunctionData5 } from "viem";
3532
+ import { useCallback as useCallback19 } from "react";
3533
+ import { decodeEventLog as decodeEventLog2, encodeFunctionData as encodeFunctionData5 } from "viem";
3456
3534
  function useCreateOrganizationBase() {
3457
- return useCallback18(
3535
+ return useCallback19(
3458
3536
  /**
3459
3537
  * Creates a new organization on-chain.
3460
3538
  *
@@ -3514,7 +3592,7 @@ function useCreateOrganizationBase() {
3514
3592
  let proxyAddress;
3515
3593
  for (const log of txReceipt.logs) {
3516
3594
  try {
3517
- const decoded = decodeEventLog({
3595
+ const decoded = decodeEventLog2({
3518
3596
  abi: ORGANIZATION_BEACON_ABI,
3519
3597
  data: log.data,
3520
3598
  topics: log.topics
@@ -3550,7 +3628,7 @@ function useCreateOrganizationBase() {
3550
3628
  }
3551
3629
 
3552
3630
  // src/utils/organization/useApproveOrgKibbleToken.ts
3553
- import { useCallback as useCallback19 } from "react";
3631
+ import { useCallback as useCallback20 } from "react";
3554
3632
 
3555
3633
  // src/helpers/ProcessOrgKibbleApproval.tsx
3556
3634
  import { encodeFunctionData as encodeFunctionData6, erc20Abi as erc20Abi3 } from "viem";
@@ -3648,7 +3726,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
3648
3726
 
3649
3727
  // src/utils/organization/useApproveOrgKibbleToken.ts
3650
3728
  function useApproveOrgPartialPayment() {
3651
- return useCallback19(
3729
+ return useCallback20(
3652
3730
  async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
3653
3731
  if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
3654
3732
  return {
@@ -3680,7 +3758,7 @@ function useApproveOrgPartialPayment() {
3680
3758
  }
3681
3759
 
3682
3760
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3683
- import { useCallback as useCallback20 } from "react";
3761
+ import { useCallback as useCallback21 } from "react";
3684
3762
 
3685
3763
  // src/helpers/ProcessOrgPartialPayment.tsx
3686
3764
  import { encodeFunctionData as encodeFunctionData7 } from "viem";
@@ -3738,7 +3816,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
3738
3816
 
3739
3817
  // src/utils/organization/useProcessOrgPartialKibblePayment.ts
3740
3818
  function useProcessOrgPartialKibblePayment() {
3741
- return useCallback20(
3819
+ return useCallback21(
3742
3820
  async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
3743
3821
  if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
3744
3822
  return {
@@ -3776,9 +3854,9 @@ function useProcessOrgPartialKibblePayment() {
3776
3854
  }
3777
3855
 
3778
3856
  // src/utils/organization/useUpdateOrgWalletAddress.ts
3779
- import { useCallback as useCallback21 } from "react";
3857
+ import { useCallback as useCallback22 } from "react";
3780
3858
  function useUpdateOrgWalletAddress() {
3781
- return useCallback21(
3859
+ return useCallback22(
3782
3860
  async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
3783
3861
  try {
3784
3862
  const mutation = `
@@ -3818,9 +3896,9 @@ function useUpdateOrgWalletAddress() {
3818
3896
 
3819
3897
  // src/utils/organization/useMintOrgAnymalNFT.ts
3820
3898
  import { encodeFunctionData as encodeFunctionData8 } from "viem";
3821
- import { useCallback as useCallback22 } from "react";
3899
+ import { useCallback as useCallback23 } from "react";
3822
3900
  function useMintOrgAnymalNFT() {
3823
- return useCallback22(
3901
+ return useCallback23(
3824
3902
  async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
3825
3903
  if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
3826
3904
  return {
@@ -3905,9 +3983,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
3905
3983
  }
3906
3984
 
3907
3985
  // src/utils/actions/useFetchActions.ts
3908
- import { useCallback as useCallback23 } from "react";
3986
+ import { useCallback as useCallback24 } from "react";
3909
3987
  function useFetchActions() {
3910
- return useCallback23(
3988
+ return useCallback24(
3911
3989
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
3912
3990
  const params = new URLSearchParams({ pid });
3913
3991
  if (status) params.set("status", status);
@@ -3936,9 +4014,9 @@ function useFetchActions() {
3936
4014
  }
3937
4015
 
3938
4016
  // src/utils/actions/useFetchActionDefinitions.ts
3939
- import { useCallback as useCallback24 } from "react";
4017
+ import { useCallback as useCallback25 } from "react";
3940
4018
  function useFetchActionDefinitions() {
3941
- return useCallback24(
4019
+ return useCallback25(
3942
4020
  async (idToken, actionsServiceBaseUrl) => {
3943
4021
  try {
3944
4022
  const response = await fetch(
@@ -4035,10 +4113,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
4035
4113
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
4036
4114
 
4037
4115
  // src/utils/application/useCreateUserAppData.ts
4038
- import { useCallback as useCallback25 } from "react";
4116
+ import { useCallback as useCallback26 } from "react";
4039
4117
  import { v4 as uuid } from "uuid";
4040
4118
  function useCreateUserAppData() {
4041
- return useCallback25(
4119
+ return useCallback26(
4042
4120
  async (appId, pid, dbAuthToken, endpoint) => {
4043
4121
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4044
4122
  const appValues = {
@@ -4093,10 +4171,10 @@ function useCreateUserAppData() {
4093
4171
  }
4094
4172
 
4095
4173
  // src/utils/application/useCreateOrganizationAppData.ts
4096
- import { useCallback as useCallback26 } from "react";
4174
+ import { useCallback as useCallback27 } from "react";
4097
4175
  import { v4 as uuid2 } from "uuid";
4098
4176
  function useCreateOrganizationAppData() {
4099
- return useCallback26(
4177
+ return useCallback27(
4100
4178
  async (appId, pid, dbAuthToken, endpoint) => {
4101
4179
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
4102
4180
  const appValues = {
@@ -4150,10 +4228,10 @@ function useCreateOrganizationAppData() {
4150
4228
  }
4151
4229
 
4152
4230
  // src/utils/balance/useFetchBalance.ts
4153
- import { useCallback as useCallback27 } from "react";
4231
+ import { useCallback as useCallback28 } from "react";
4154
4232
  import { erc20Abi as erc20Abi4, getAddress } from "viem";
4155
4233
  function useFetchBalance() {
4156
- return useCallback27(
4234
+ return useCallback28(
4157
4235
  async (publicClient, walletAddress, kibbleTokenAddress) => {
4158
4236
  try {
4159
4237
  const balance = await publicClient.readContract({
@@ -4173,9 +4251,9 @@ function useFetchBalance() {
4173
4251
 
4174
4252
  // src/utils/actions/useClaimActionReward.ts
4175
4253
  import { encodeFunctionData as encodeFunctionData9 } from "viem";
4176
- import { useCallback as useCallback28 } from "react";
4254
+ import { useCallback as useCallback29 } from "react";
4177
4255
  function useClaimActionReward() {
4178
- return useCallback28(
4256
+ return useCallback29(
4179
4257
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
4180
4258
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
4181
4259
  return {
@@ -4222,9 +4300,9 @@ function useClaimActionReward() {
4222
4300
 
4223
4301
  // src/utils/actions/useClaimOrgActionReward.ts
4224
4302
  import { encodeFunctionData as encodeFunctionData10 } from "viem";
4225
- import { useCallback as useCallback29 } from "react";
4303
+ import { useCallback as useCallback30 } from "react";
4226
4304
  function useClaimOrgActionReward() {
4227
- return useCallback29(
4305
+ return useCallback30(
4228
4306
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
4229
4307
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
4230
4308
  return {
@@ -4274,9 +4352,9 @@ function useClaimOrgActionReward() {
4274
4352
  }
4275
4353
 
4276
4354
  // src/utils/actions/useSubmitContractAction.ts
4277
- import { useCallback as useCallback30 } from "react";
4355
+ import { useCallback as useCallback31 } from "react";
4278
4356
  function useSubmitContractAction() {
4279
- return useCallback30(
4357
+ return useCallback31(
4280
4358
  (idToken, pid, source, endpoint, payload) => {
4281
4359
  if (!idToken || !pid || !source || !endpoint || !payload) return;
4282
4360
  let sourceTypePayload = {};
@@ -4434,6 +4512,7 @@ export {
4434
4512
  useClaimActionReward,
4435
4513
  useClaimOrgActionReward,
4436
4514
  useCoinbaseClaimActionReward,
4515
+ useCoinbaseCreateOrganizationWallet,
4437
4516
  useCoinbaseMintAnymalNFT,
4438
4517
  useCreateOrganizationAppData,
4439
4518
  useCreateOrganizationBase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.133",
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": {