anymal-protocol 1.0.120 → 1.0.122

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.mjs CHANGED
@@ -391,6 +391,7 @@ function useFetchNotifications() {
391
391
  import { encodeFunctionData } from "viem";
392
392
 
393
393
  // src/helpers/BlockchainAbiHelper.tsx
394
+ import { parseAbi } from "viem";
394
395
  var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "AccessControlBadConfirmation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "bytes32", "name": "neededRole", "type": "bytes32" }], "name": "AccessControlUnauthorizedAccount", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "EnforcedPause", "type": "error" }, { "inputs": [], "name": "ExpectedPause", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataApproved", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "anymalTxId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataRejected", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataSubmitted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "RewardDistributed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" }], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleRevoked", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Unpaused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "APPROVER_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "approveMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "campaignCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "campaigns", "outputs": [{ "internalType": "string", "name": "name", "type": "string" }, { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "isActive", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_name", "type": "string" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "createCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "defaultRewardAmount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], "name": "getRoleAdmin", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "hasRole", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "contract IERC20", "name": "_rewardToken", "type": "address" }, { "internalType": "contract IPetToken", "name": "_petToken", "type": "address" }, { "internalType": "uint256", "name": "_defaultRewardAmount", "type": "uint256" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "petToken", "outputs": [{ "internalType": "contract IPetToken", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "callerConfirmation", "type": "address" }], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "rewardToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "string", "name": "_campaignName", "type": "string" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadataByCampaignName", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], "name": "supportsInterface", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "_isActive", "type": "bool" }], "name": "updateCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "updateDefaultReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
395
396
  var MARKETPLACE_ABI = [{ "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "anymalNftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PartialPaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "refundedAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "RefundProcessed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "SignatureCheckToggled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "authorizer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_authorizer", "type": "address" }, { "internalType": "address", "name": "_kibbleToken", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "kibbleToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" }], "name": "paidAmounts", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "string", "name": "anymalNftId", "type": "string" }, { "internalType": "string", "name": "pid", "type": "string" }, { "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "internalType": "uint256", "name": "maxTokenPayment", "type": "uint256" }, { "internalType": "bytes32", "name": "nonce", "type": "bytes32" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bytes", "name": "backendSignature", "type": "bytes" }], "name": "partialPay", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "address", "name": "payer", "type": "address" }, { "internalType": "string", "name": "pid", "type": "string" }], "name": "refund", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_authorizer", "type": "address" }], "name": "setAuthorizer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "setSignatureCheckEnabled", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "signatureCheckEnabled", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "usedNonces", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawKibble", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
396
397
  var ORGANIZATION_BEACON_ABI = [{ "inputs": [{ "internalType": "address", "name": "_initialImplementation", "type": "address" }, { "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_anymalNFTProxy", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "BeaconInvalidImplementation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "address", "name": "proxyAddress", "type": "address" }, { "indexed": false, "internalType": "address", "name": "networkAdmin", "type": "address" }, { "indexed": false, "internalType": "address", "name": "userAdmin", "type": "address" }], "name": "NewOrganizationCreated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "anymalNFTProxy", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_userAdmin", "type": "address" }, { "internalType": "string", "name": "_orgName", "type": "string" }, { "internalType": "string", "name": "_orgPid", "type": "string" }], "name": "createOrganizationProxy", "outputs": [{ "internalType": "address", "name": "proxyAddress", "type": "address" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "implementation", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }], "name": "upgradeBeaconTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }], "name": "upgradeTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
@@ -1205,6 +1206,21 @@ var ORGANIZATION_IMPL_ABI = [
1205
1206
  "type": "function"
1206
1207
  }
1207
1208
  ];
1209
+ var KIBBLE_TOKEN_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "CheckpointUnorderedInsertion", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "increasedSupply", "type": "uint256" }, { "internalType": "uint256", "name": "cap", "type": "uint256" }], "name": "ERC20ExceededSafeSupply", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "allowance", "type": "uint256" }, { "internalType": "uint256", "name": "needed", "type": "uint256" }], "name": "ERC20InsufficientAllowance", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "sender", "type": "address" }, { "internalType": "uint256", "name": "balance", "type": "uint256" }, { "internalType": "uint256", "name": "needed", "type": "uint256" }], "name": "ERC20InsufficientBalance", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "approver", "type": "address" }], "name": "ERC20InvalidApprover", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "receiver", "type": "address" }], "name": "ERC20InvalidReceiver", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "sender", "type": "address" }], "name": "ERC20InvalidSender", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }], "name": "ERC20InvalidSpender", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "deadline", "type": "uint256" }], "name": "ERC2612ExpiredSignature", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "signer", "type": "address" }, { "internalType": "address", "name": "owner", "type": "address" }], "name": "ERC2612InvalidSigner", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "timepoint", "type": "uint256" }, { "internalType": "uint48", "name": "clock", "type": "uint48" }], "name": "ERC5805FutureLookup", "type": "error" }, { "inputs": [], "name": "ERC6372InconsistentClock", "type": "error" }, { "inputs": [], "name": "EnforcedPause", "type": "error" }, { "inputs": [], "name": "ExpectedPause", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint256", "name": "currentNonce", "type": "uint256" }], "name": "InvalidAccountNonce", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [{ "internalType": "uint8", "name": "bits", "type": "uint8" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "SafeCastOverflowedUintDowncast", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "expiry", "type": "uint256" }], "name": "VotesExpiredSignature", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "delegator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "fromDelegate", "type": "address" }, { "indexed": true, "internalType": "address", "name": "toDelegate", "type": "address" }], "name": "DelegateChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "delegate", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "previousVotes", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "newVotes", "type": "uint256" }], "name": "DelegateVotesChanged", "type": "event" }, { "anonymous": false, "inputs": [], "name": "EIP712DomainChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "Transfer", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Unpaused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "CLOCK_MODE", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DOMAIN_SEPARATOR", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" }], "name": "allowance", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "approve", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "burn", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "burnFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint32", "name": "pos", "type": "uint32" }], "name": "checkpoints", "outputs": [{ "components": [{ "internalType": "uint48", "name": "_key", "type": "uint48" }, { "internalType": "uint208", "name": "_value", "type": "uint208" }], "internalType": "struct Checkpoints.Checkpoint208", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "clock", "outputs": [{ "internalType": "uint48", "name": "", "type": "uint48" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "delegatee", "type": "address" }], "name": "delegate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "delegatee", "type": "address" }, { "internalType": "uint256", "name": "nonce", "type": "uint256" }, { "internalType": "uint256", "name": "expiry", "type": "uint256" }, { "internalType": "uint8", "name": "v", "type": "uint8" }, { "internalType": "bytes32", "name": "r", "type": "bytes32" }, { "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "delegateBySig", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "delegates", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "eip712Domain", "outputs": [{ "internalType": "bytes1", "name": "fields", "type": "bytes1" }, { "internalType": "string", "name": "name", "type": "string" }, { "internalType": "string", "name": "version", "type": "string" }, { "internalType": "uint256", "name": "chainId", "type": "uint256" }, { "internalType": "address", "name": "verifyingContract", "type": "address" }, { "internalType": "bytes32", "name": "salt", "type": "bytes32" }, { "internalType": "uint256[]", "name": "extensions", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "timepoint", "type": "uint256" }], "name": "getPastTotalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint256", "name": "timepoint", "type": "uint256" }], "name": "getPastVotes", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "getVotes", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "name", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "nonces", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "numCheckpoints", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "uint8", "name": "v", "type": "uint8" }, { "internalType": "bytes32", "name": "r", "type": "bytes32" }, { "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "permit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "symbol", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "transfer", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "from", "type": "address" }, { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "value", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
1210
+ var LOCAL_ERRORS = [
1211
+ ...KIBBLE_TOKEN_ABI.filter((item) => item.type === "error"),
1212
+ ...ORGANIZATION_IMPL_ABI.filter((item) => item.type === "error"),
1213
+ ...MARKETPLACE_ABI.filter((item) => item.type === "error"),
1214
+ ...REWARDABLE_ACTIONS_ABI.filter((item) => item.type === "error"),
1215
+ ...PET_NFT_ABI.filter((item) => item.type === "error"),
1216
+ ...ORGANIZATION_BEACON_ABI.filter((item) => item.type === "error")
1217
+ ];
1218
+ var OZ_ERROR_FRAGMENTS = [
1219
+ "error AddressLowLevelCallFailed(address target, bytes data)",
1220
+ "error AddressEmptyCode(address target)"
1221
+ ];
1222
+ var ERROR_ABI = [...LOCAL_ERRORS, parseAbi([...OZ_ERROR_FRAGMENTS])];
1223
+ var ORG_FUNCTION = "executeCall";
1208
1224
 
1209
1225
  // src/utils/anymals/useMintAnymalNFT.ts
1210
1226
  import { useCallback as useCallback10 } from "react";
@@ -1250,6 +1266,42 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
1250
1266
  };
1251
1267
  }
1252
1268
 
1269
+ // src/helpers/HumanRevert.tsx
1270
+ import { decodeErrorResult, hexToString } from "viem";
1271
+ function humanRevert(raw, shortMessage) {
1272
+ if (!raw) return shortMessage ?? "Simulation reverted";
1273
+ try {
1274
+ const { errorName, args } = decodeErrorResult({
1275
+ abi: ERROR_ABI,
1276
+ data: raw
1277
+ });
1278
+ return `${errorName}(${args.map(String).join(", ")})`;
1279
+ } catch {
1280
+ if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
1281
+ return hexToString(`0x${raw.slice(138)}`);
1282
+ }
1283
+ return `${raw.slice(0, 10)}\u2026`;
1284
+ }
1285
+ }
1286
+
1287
+ // src/helpers/SimulationHelper.tsx
1288
+ async function simulateCall(publicClient, target, abi, functionName, args, caller) {
1289
+ try {
1290
+ await publicClient.simulateContract({
1291
+ address: target,
1292
+ abi,
1293
+ functionName,
1294
+ args,
1295
+ account: caller
1296
+ });
1297
+ } catch (simErr) {
1298
+ const raw = simErr.raw ?? simErr.cause?.raw;
1299
+ const shortMsg = simErr.shortMessage;
1300
+ const reason = humanRevert(raw, shortMsg);
1301
+ throw new Error(`Simulation failed: ${reason}`);
1302
+ }
1303
+ }
1304
+
1253
1305
  // src/utils/anymals/useMintAnymalNFT.ts
1254
1306
  function useMintAnymalNFT() {
1255
1307
  return useCallback10(
@@ -1260,17 +1312,27 @@ function useMintAnymalNFT() {
1260
1312
  message: "Missing authentication token OR NFT ID."
1261
1313
  };
1262
1314
  }
1315
+ const functionName = "submitMetadataByCampaignName";
1316
+ const args = [
1317
+ pid,
1318
+ nftId,
1319
+ `https://dev-nft.petastic.com/metadata/${nftId}`,
1320
+ "petastic-signup-campaign-1",
1321
+ anymalTxId
1322
+ ];
1263
1323
  const callData = encodeFunctionData({
1264
1324
  abi: PET_NFT_ABI,
1265
- functionName: "submitMetadataByCampaignName",
1266
- args: [
1267
- pid,
1268
- nftId,
1269
- `https://dev-nft.petastic.com/metadata/${nftId}`,
1270
- "petastic-signup-campaign-1",
1271
- anymalTxId
1272
- ]
1325
+ functionName,
1326
+ args
1273
1327
  });
1328
+ await simulateCall(
1329
+ bundlerClient.client,
1330
+ validationContractAddress,
1331
+ PET_NFT_ABI,
1332
+ functionName,
1333
+ args,
1334
+ smartAccount.address
1335
+ );
1274
1336
  await applyBundlerGasEstimator(smartAccount, bundlerClient);
1275
1337
  const userOpHash = await bundlerClient.sendUserOperation({
1276
1338
  account: smartAccount,
@@ -1717,20 +1779,30 @@ async function waitForReceiptWithRetries(bundlerClient, hash, retries = 3, delay
1717
1779
  // src/helpers/ProcessDirectPartialPayment.tsx
1718
1780
  async function processDirectPartialPayment(marketplaceContract, smartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
1719
1781
  try {
1782
+ const functionName = "partialPay";
1783
+ const args = [
1784
+ orderId,
1785
+ anymalNftId,
1786
+ pid,
1787
+ amountInTokens,
1788
+ maxTokenPayment,
1789
+ nonce,
1790
+ deadline,
1791
+ backendSignature
1792
+ ];
1720
1793
  const partialPayCalldata = encodeFunctionData2({
1721
1794
  abi: MARKETPLACE_ABI,
1722
- functionName: "partialPay",
1723
- args: [
1724
- orderId,
1725
- anymalNftId,
1726
- pid,
1727
- amountInTokens,
1728
- maxTokenPayment,
1729
- nonce,
1730
- deadline,
1731
- backendSignature
1732
- ]
1795
+ functionName,
1796
+ args
1733
1797
  });
1798
+ await simulateCall(
1799
+ bundlerClient.client,
1800
+ marketplaceContract,
1801
+ MARKETPLACE_ABI,
1802
+ functionName,
1803
+ args,
1804
+ smartAccount.address
1805
+ );
1734
1806
  await applyBundlerGasEstimator(smartAccount, bundlerClient);
1735
1807
  const userOpHash = await sendUserOpWithRetries(bundlerClient, {
1736
1808
  account: smartAccount,
@@ -1745,6 +1817,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
1745
1817
  };
1746
1818
  } catch (error) {
1747
1819
  const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
1820
+ console.error(errorMessage);
1748
1821
  return {
1749
1822
  success: false,
1750
1823
  message: `Error during direct payment processing: ${errorMessage}`
@@ -1816,11 +1889,21 @@ import { useCallback as useCallback18 } from "react";
1816
1889
  import { encodeFunctionData as encodeFunctionData3, erc20Abi } from "viem";
1817
1890
  async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
1818
1891
  try {
1892
+ const functionName = "approve";
1893
+ const args = [spenderAddress, approveAmount];
1819
1894
  const approveCalldata = encodeFunctionData3({
1820
1895
  abi: erc20Abi,
1821
- functionName: "approve",
1822
- args: [spenderAddress, approveAmount]
1896
+ functionName,
1897
+ args
1823
1898
  });
1899
+ await simulateCall(
1900
+ bundlerClient.client,
1901
+ kibbleTokenAddress,
1902
+ erc20Abi,
1903
+ functionName,
1904
+ args,
1905
+ smartAccount.address
1906
+ );
1824
1907
  await applyBundlerGasEstimator(smartAccount, bundlerClient);
1825
1908
  const userOpHash = await sendUserOpWithRetries(bundlerClient, {
1826
1909
  account: smartAccount,
@@ -1835,6 +1918,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
1835
1918
  };
1836
1919
  } catch (error) {
1837
1920
  const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
1921
+ console.error(errorMessage);
1838
1922
  return {
1839
1923
  success: false,
1840
1924
  message: `Error during direct approval processing: ${errorMessage}`
@@ -1894,11 +1978,21 @@ function useCreateOrganizationBase() {
1894
1978
  };
1895
1979
  }
1896
1980
  try {
1981
+ const functionName = "createOrganizationProxy";
1982
+ const args = [ownerAddress, orgName, orgPid];
1897
1983
  const callData = encodeFunctionData4({
1898
1984
  abi: ORGANIZATION_BEACON_ABI,
1899
- functionName: "createOrganizationProxy",
1900
- args: [ownerAddress, orgName, orgPid]
1985
+ functionName,
1986
+ args
1901
1987
  });
1988
+ await simulateCall(
1989
+ bundlerClient.client,
1990
+ orgContractAddress,
1991
+ ORGANIZATION_BEACON_ABI,
1992
+ functionName,
1993
+ args,
1994
+ adminSmartAccount.address
1995
+ );
1902
1996
  await applyBundlerGasEstimator(adminSmartAccount, bundlerClient);
1903
1997
  const userOpHash = await bundlerClient.sendUserOperation({
1904
1998
  account: adminSmartAccount,
@@ -2005,11 +2099,20 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
2005
2099
  functionName: "approve",
2006
2100
  args: [partialPaymentModuleAddress, approveAmount]
2007
2101
  });
2102
+ const args = [kibbleTokenAddress, approveCalldata];
2008
2103
  const executeApproveCalldata = encodeFunctionData5({
2009
2104
  abi: ORGANIZATION_IMPL_ABI,
2010
- functionName: "executeCall",
2011
- args: [kibbleTokenAddress, approveCalldata]
2105
+ functionName: ORG_FUNCTION,
2106
+ args
2012
2107
  });
2108
+ await simulateCall(
2109
+ bundlerClient.client,
2110
+ orgContractAddress,
2111
+ ORGANIZATION_IMPL_ABI,
2112
+ ORG_FUNCTION,
2113
+ args,
2114
+ managerSmartAccount.address
2115
+ );
2013
2116
  await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
2014
2117
  const userOpApproveHash = await sendUserOpWithRetries(bundlerClient, {
2015
2118
  account: managerSmartAccount,
@@ -2039,6 +2142,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
2039
2142
  };
2040
2143
  } catch (error) {
2041
2144
  const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
2145
+ console.error(errorMessage);
2042
2146
  return {
2043
2147
  success: false,
2044
2148
  message: `Error during approval processing: ${errorMessage}`
@@ -2100,11 +2204,20 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
2100
2204
  backendSignature
2101
2205
  ]
2102
2206
  });
2207
+ const args = [partialPaymentModuleAddress, partialPayCalldata];
2103
2208
  const executePartialPayCalldata = encodeFunctionData6({
2104
2209
  abi: ORGANIZATION_IMPL_ABI,
2105
- functionName: "executeCall",
2106
- args: [partialPaymentModuleAddress, partialPayCalldata]
2210
+ functionName: ORG_FUNCTION,
2211
+ args
2107
2212
  });
2213
+ await simulateCall(
2214
+ bundlerClient.client,
2215
+ orgContractAddress,
2216
+ ORGANIZATION_IMPL_ABI,
2217
+ ORG_FUNCTION,
2218
+ args,
2219
+ managerSmartAccount.address
2220
+ );
2108
2221
  await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
2109
2222
  const userOpHash = await sendUserOpWithRetries(bundlerClient, {
2110
2223
  account: managerSmartAccount,
@@ -2119,6 +2232,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
2119
2232
  };
2120
2233
  } catch (error) {
2121
2234
  const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
2235
+ console.error(errorMessage);
2122
2236
  return {
2123
2237
  success: false,
2124
2238
  message: `Error during payment processing: ${errorMessage}`
@@ -2206,6 +2320,58 @@ function useUpdateOrgWalletAddress() {
2206
2320
  );
2207
2321
  }
2208
2322
 
2323
+ // src/utils/organization/useMintOrgAnymalNFT.ts
2324
+ import { encodeFunctionData as encodeFunctionData7 } from "viem";
2325
+ import { useCallback as useCallback23 } from "react";
2326
+ function useMintOrgAnymalNFT() {
2327
+ return useCallback23(
2328
+ async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
2329
+ if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
2330
+ return {
2331
+ success: false,
2332
+ message: "Missing authentication token OR NFT ID."
2333
+ };
2334
+ }
2335
+ const functionName = "submitMetadataByCampaignName";
2336
+ const args = [
2337
+ pid,
2338
+ nftId,
2339
+ `https://dev-nft.petastic.com/metadata/${nftId}`,
2340
+ "petastic-signup-campaign-1",
2341
+ anymalTxId
2342
+ ];
2343
+ const callData = encodeFunctionData7({
2344
+ abi: PET_NFT_ABI,
2345
+ functionName,
2346
+ args
2347
+ });
2348
+ const executeArgs = [validationContractAddress, callData];
2349
+ const executeSubmitMetaCalldata = encodeFunctionData7({
2350
+ abi: ORGANIZATION_IMPL_ABI,
2351
+ functionName: ORG_FUNCTION,
2352
+ args: executeArgs
2353
+ });
2354
+ await simulateCall(
2355
+ bundlerClient.client,
2356
+ orgContractAddress,
2357
+ ORGANIZATION_IMPL_ABI,
2358
+ ORG_FUNCTION,
2359
+ executeArgs,
2360
+ managerSmartAccount.address
2361
+ );
2362
+ await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
2363
+ const userOpHash = await sendUserOpWithRetries(bundlerClient, {
2364
+ account: managerSmartAccount,
2365
+ calls: [{ to: orgContractAddress, data: executeSubmitMetaCalldata }],
2366
+ paymaster: true
2367
+ });
2368
+ await waitForReceiptWithRetries(bundlerClient, userOpHash);
2369
+ return { success: true, message: "Pet Passport Created!" };
2370
+ },
2371
+ []
2372
+ );
2373
+ }
2374
+
2209
2375
  // src/helpers/NonceHelper.tsx
2210
2376
  import { v4 as uuidv4 } from "uuid";
2211
2377
  import { padHex } from "viem";
@@ -2238,9 +2404,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
2238
2404
  }
2239
2405
 
2240
2406
  // src/utils/actions/useFetchActions.ts
2241
- import { useCallback as useCallback23 } from "react";
2407
+ import { useCallback as useCallback24 } from "react";
2242
2408
  function useFetchActions() {
2243
- return useCallback23(
2409
+ return useCallback24(
2244
2410
  async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
2245
2411
  const params = new URLSearchParams({ pid });
2246
2412
  if (status) params.set("status", status);
@@ -2269,9 +2435,9 @@ function useFetchActions() {
2269
2435
  }
2270
2436
 
2271
2437
  // src/utils/actions/useFetchActionDefinitions.ts
2272
- import { useCallback as useCallback24 } from "react";
2438
+ import { useCallback as useCallback25 } from "react";
2273
2439
  function useFetchActionDefinitions() {
2274
- return useCallback24(
2440
+ return useCallback25(
2275
2441
  async (idToken, actionsServiceBaseUrl) => {
2276
2442
  try {
2277
2443
  const response = await fetch(
@@ -2368,10 +2534,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
2368
2534
  var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
2369
2535
 
2370
2536
  // src/utils/application/useCreateUserAppData.ts
2371
- import { useCallback as useCallback25 } from "react";
2537
+ import { useCallback as useCallback26 } from "react";
2372
2538
  import { v4 as uuid } from "uuid";
2373
2539
  function useCreateUserAppData() {
2374
- return useCallback25(
2540
+ return useCallback26(
2375
2541
  async (appId, pid, dbAuthToken, endpoint) => {
2376
2542
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2377
2543
  const appValues = {
@@ -2426,10 +2592,10 @@ function useCreateUserAppData() {
2426
2592
  }
2427
2593
 
2428
2594
  // src/utils/application/useCreateOrganizationAppData.ts
2429
- import { useCallback as useCallback26 } from "react";
2595
+ import { useCallback as useCallback27 } from "react";
2430
2596
  import { v4 as uuid2 } from "uuid";
2431
2597
  function useCreateOrganizationAppData() {
2432
- return useCallback26(
2598
+ return useCallback27(
2433
2599
  async (appId, pid, dbAuthToken, endpoint) => {
2434
2600
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
2435
2601
  const appValues = {
@@ -2483,10 +2649,10 @@ function useCreateOrganizationAppData() {
2483
2649
  }
2484
2650
 
2485
2651
  // src/utils/balance/useFetchBalance.ts
2486
- import { useCallback as useCallback27 } from "react";
2652
+ import { useCallback as useCallback28 } from "react";
2487
2653
  import { erc20Abi as erc20Abi4, getAddress } from "viem";
2488
2654
  function useFetchBalance() {
2489
- return useCallback27(
2655
+ return useCallback28(
2490
2656
  async (publicClient, walletAddress, kibbleTokenAddress) => {
2491
2657
  try {
2492
2658
  const balance = await publicClient.readContract({
@@ -2505,10 +2671,10 @@ function useFetchBalance() {
2505
2671
  }
2506
2672
 
2507
2673
  // src/utils/actions/useClaimActionReward.ts
2508
- import { encodeFunctionData as encodeFunctionData7 } from "viem";
2509
- import { useCallback as useCallback28 } from "react";
2674
+ import { encodeFunctionData as encodeFunctionData8 } from "viem";
2675
+ import { useCallback as useCallback29 } from "react";
2510
2676
  function useClaimActionReward() {
2511
- return useCallback28(
2677
+ return useCallback29(
2512
2678
  async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
2513
2679
  if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
2514
2680
  return {
@@ -2516,11 +2682,21 @@ function useClaimActionReward() {
2516
2682
  message: "Missing web3auth account info or contract address."
2517
2683
  };
2518
2684
  }
2519
- const callData = encodeFunctionData7({
2685
+ const args = [actionId, claimIndex];
2686
+ const functionName = "claimByIndex";
2687
+ const callData = encodeFunctionData8({
2520
2688
  abi: REWARDABLE_ACTIONS_ABI,
2521
- functionName: "claimByIndex",
2522
- args: [actionId, claimIndex]
2689
+ functionName,
2690
+ args
2523
2691
  });
2692
+ await simulateCall(
2693
+ bundlerClient.client,
2694
+ rewardableActionContractAddress,
2695
+ REWARDABLE_ACTIONS_ABI,
2696
+ functionName,
2697
+ args,
2698
+ smartAccount.address
2699
+ );
2524
2700
  await applyBundlerGasEstimator(smartAccount, bundlerClient);
2525
2701
  const userOpHash = await bundlerClient.sendUserOperation({
2526
2702
  account: smartAccount,
@@ -2544,10 +2720,10 @@ function useClaimActionReward() {
2544
2720
  }
2545
2721
 
2546
2722
  // src/utils/actions/useClaimOrgActionReward.ts
2547
- import { encodeFunctionData as encodeFunctionData8 } from "viem";
2548
- import { useCallback as useCallback29 } from "react";
2723
+ import { encodeFunctionData as encodeFunctionData9 } from "viem";
2724
+ import { useCallback as useCallback30 } from "react";
2549
2725
  function useClaimOrgActionReward() {
2550
- return useCallback29(
2726
+ return useCallback30(
2551
2727
  async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
2552
2728
  if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
2553
2729
  return {
@@ -2555,16 +2731,25 @@ function useClaimOrgActionReward() {
2555
2731
  message: "Missing web3auth account info or contract address."
2556
2732
  };
2557
2733
  }
2558
- const claimCallData = encodeFunctionData8({
2734
+ const claimCallData = encodeFunctionData9({
2559
2735
  abi: REWARDABLE_ACTIONS_ABI,
2560
2736
  functionName: "claimByIndex",
2561
2737
  args: [actionId, claimIndex]
2562
2738
  });
2563
- const executeClaimCalldata = encodeFunctionData8({
2739
+ const args = [rewardableActionContractAddress, claimCallData];
2740
+ const executeClaimCalldata = encodeFunctionData9({
2564
2741
  abi: ORGANIZATION_IMPL_ABI,
2565
- functionName: "executeCall",
2566
- args: [rewardableActionContractAddress, claimCallData]
2742
+ functionName: ORG_FUNCTION,
2743
+ args
2567
2744
  });
2745
+ await simulateCall(
2746
+ bundlerClient.client,
2747
+ orgContractAddress,
2748
+ ORGANIZATION_IMPL_ABI,
2749
+ ORG_FUNCTION,
2750
+ args,
2751
+ smartAccount.address
2752
+ );
2568
2753
  await applyBundlerGasEstimator(smartAccount, bundlerClient);
2569
2754
  const userOpHash = await bundlerClient.sendUserOperation({
2570
2755
  account: smartAccount,
@@ -2588,9 +2773,9 @@ function useClaimOrgActionReward() {
2588
2773
  }
2589
2774
 
2590
2775
  // src/utils/actions/useSubmitContractAction.ts
2591
- import { useCallback as useCallback30 } from "react";
2776
+ import { useCallback as useCallback31 } from "react";
2592
2777
  function useSubmitContractAction() {
2593
- return useCallback30(
2778
+ return useCallback31(
2594
2779
  (idToken, pid, source, endpoint, payload) => {
2595
2780
  if (!idToken || !pid || !source || !endpoint || !payload) return;
2596
2781
  let sourceTypePayload = {};
@@ -2727,6 +2912,7 @@ export {
2727
2912
  generateBytes32Nonce,
2728
2913
  generateJWT,
2729
2914
  getFirebaseTokenForApp,
2915
+ humanRevert,
2730
2916
  loadExistingSecp256k1PrivateKey,
2731
2917
  processDirectKibbleApproval,
2732
2918
  processDirectPartialPayment,
@@ -2752,6 +2938,7 @@ export {
2752
2938
  useFetchNotifications,
2753
2939
  useFetchUserData,
2754
2940
  useMintAnymalNFT,
2941
+ useMintOrgAnymalNFT,
2755
2942
  useProcessOrgPartialKibblePayment,
2756
2943
  useProcessPartialKibblePayment,
2757
2944
  useSaveAnymalMetadata,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.120",
3
+ "version": "1.0.122",
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": {