anymal-protocol 1.0.119 → 1.0.121
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +196 -71
- package/dist/index.mjs +174 -50
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -497,4 +497,9 @@ declare function useClaimOrgActionReward(): (orgContractAddress: string, rewarda
|
|
|
497
497
|
|
|
498
498
|
declare function useSubmitContractAction(): (idToken: string, pid: string, source: ActionSourceType, endpoint: string, payload: ActionPayload) => Promise<SubmitResponse> | undefined;
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
/**
|
|
501
|
+
* Turn a raw revert payload into a human string.
|
|
502
|
+
*/
|
|
503
|
+
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
504
|
+
|
|
505
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.d.ts
CHANGED
|
@@ -497,4 +497,9 @@ declare function useClaimOrgActionReward(): (orgContractAddress: string, rewarda
|
|
|
497
497
|
|
|
498
498
|
declare function useSubmitContractAction(): (idToken: string, pid: string, source: ActionSourceType, endpoint: string, payload: ActionPayload) => Promise<SubmitResponse> | undefined;
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
/**
|
|
501
|
+
* Turn a raw revert payload into a human string.
|
|
502
|
+
*/
|
|
503
|
+
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
504
|
+
|
|
505
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
generateBytes32Nonce: () => generateBytes32Nonce,
|
|
42
42
|
generateJWT: () => generateJWT,
|
|
43
43
|
getFirebaseTokenForApp: () => getFirebaseTokenForApp,
|
|
44
|
+
humanRevert: () => humanRevert,
|
|
44
45
|
loadExistingSecp256k1PrivateKey: () => loadExistingSecp256k1PrivateKey,
|
|
45
46
|
processDirectKibbleApproval: () => processDirectKibbleApproval,
|
|
46
47
|
processDirectPartialPayment: () => processDirectPartialPayment,
|
|
@@ -458,9 +459,10 @@ function useFetchNotifications() {
|
|
|
458
459
|
}
|
|
459
460
|
|
|
460
461
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
461
|
-
var
|
|
462
|
+
var import_viem3 = require("viem");
|
|
462
463
|
|
|
463
464
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
465
|
+
var import_viem = require("viem");
|
|
464
466
|
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" }];
|
|
465
467
|
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" }];
|
|
466
468
|
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" }];
|
|
@@ -1275,6 +1277,21 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
1275
1277
|
"type": "function"
|
|
1276
1278
|
}
|
|
1277
1279
|
];
|
|
1280
|
+
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" }];
|
|
1281
|
+
var LOCAL_ERRORS = [
|
|
1282
|
+
...KIBBLE_TOKEN_ABI.filter((item) => item.type === "error"),
|
|
1283
|
+
...ORGANIZATION_IMPL_ABI.filter((item) => item.type === "error"),
|
|
1284
|
+
...MARKETPLACE_ABI.filter((item) => item.type === "error"),
|
|
1285
|
+
...REWARDABLE_ACTIONS_ABI.filter((item) => item.type === "error"),
|
|
1286
|
+
...PET_NFT_ABI.filter((item) => item.type === "error"),
|
|
1287
|
+
...ORGANIZATION_BEACON_ABI.filter((item) => item.type === "error")
|
|
1288
|
+
];
|
|
1289
|
+
var OZ_ERROR_FRAGMENTS = [
|
|
1290
|
+
"error AddressLowLevelCallFailed(address target, bytes data)",
|
|
1291
|
+
"error AddressEmptyCode(address target)"
|
|
1292
|
+
];
|
|
1293
|
+
var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem.parseAbi)([...OZ_ERROR_FRAGMENTS])];
|
|
1294
|
+
var ORG_FUNCTION = "executeCall";
|
|
1278
1295
|
|
|
1279
1296
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1280
1297
|
var import_react10 = require("react");
|
|
@@ -1320,6 +1337,42 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
1320
1337
|
};
|
|
1321
1338
|
}
|
|
1322
1339
|
|
|
1340
|
+
// src/helpers/HumanRevert.tsx
|
|
1341
|
+
var import_viem2 = require("viem");
|
|
1342
|
+
function humanRevert(raw, shortMessage) {
|
|
1343
|
+
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
1344
|
+
try {
|
|
1345
|
+
const { errorName, args } = (0, import_viem2.decodeErrorResult)({
|
|
1346
|
+
abi: ERROR_ABI,
|
|
1347
|
+
data: raw
|
|
1348
|
+
});
|
|
1349
|
+
return `${errorName}(${args.map(String).join(", ")})`;
|
|
1350
|
+
} catch {
|
|
1351
|
+
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
1352
|
+
return (0, import_viem2.hexToString)(`0x${raw.slice(138)}`);
|
|
1353
|
+
}
|
|
1354
|
+
return `${raw.slice(0, 10)}\u2026`;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// src/helpers/SimulationHelper.tsx
|
|
1359
|
+
async function simulateCall(publicClient, target, abi, functionName, args, caller) {
|
|
1360
|
+
try {
|
|
1361
|
+
await publicClient.simulateContract({
|
|
1362
|
+
address: target,
|
|
1363
|
+
abi,
|
|
1364
|
+
functionName,
|
|
1365
|
+
args,
|
|
1366
|
+
account: caller
|
|
1367
|
+
});
|
|
1368
|
+
} catch (simErr) {
|
|
1369
|
+
const raw = simErr.raw ?? simErr.cause?.raw;
|
|
1370
|
+
const shortMsg = simErr.shortMessage;
|
|
1371
|
+
const reason = humanRevert(raw, shortMsg);
|
|
1372
|
+
throw new Error(`Simulation failed: ${reason}`);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1323
1376
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1324
1377
|
function useMintAnymalNFT() {
|
|
1325
1378
|
return (0, import_react10.useCallback)(
|
|
@@ -1330,17 +1383,27 @@ function useMintAnymalNFT() {
|
|
|
1330
1383
|
message: "Missing authentication token OR NFT ID."
|
|
1331
1384
|
};
|
|
1332
1385
|
}
|
|
1333
|
-
const
|
|
1386
|
+
const functionName = "submitMetadataByCampaignName";
|
|
1387
|
+
const args = [
|
|
1388
|
+
pid,
|
|
1389
|
+
nftId,
|
|
1390
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
1391
|
+
"petastic-signup-campaign-1",
|
|
1392
|
+
anymalTxId
|
|
1393
|
+
];
|
|
1394
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
1334
1395
|
abi: PET_NFT_ABI,
|
|
1335
|
-
functionName
|
|
1336
|
-
args
|
|
1337
|
-
pid,
|
|
1338
|
-
nftId,
|
|
1339
|
-
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
1340
|
-
"petastic-signup-campaign-1",
|
|
1341
|
-
anymalTxId
|
|
1342
|
-
]
|
|
1396
|
+
functionName,
|
|
1397
|
+
args
|
|
1343
1398
|
});
|
|
1399
|
+
await simulateCall(
|
|
1400
|
+
bundlerClient.client,
|
|
1401
|
+
validationContractAddress,
|
|
1402
|
+
PET_NFT_ABI,
|
|
1403
|
+
functionName,
|
|
1404
|
+
args,
|
|
1405
|
+
smartAccount.address
|
|
1406
|
+
);
|
|
1344
1407
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
1345
1408
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
1346
1409
|
account: smartAccount,
|
|
@@ -1738,7 +1801,7 @@ function useFetchAnymals() {
|
|
|
1738
1801
|
var import_react17 = require("react");
|
|
1739
1802
|
|
|
1740
1803
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
1741
|
-
var
|
|
1804
|
+
var import_viem4 = require("viem");
|
|
1742
1805
|
|
|
1743
1806
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
1744
1807
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -1787,30 +1850,30 @@ async function waitForReceiptWithRetries(bundlerClient, hash, retries = 3, delay
|
|
|
1787
1850
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
1788
1851
|
async function processDirectPartialPayment(marketplaceContract, smartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
1789
1852
|
try {
|
|
1790
|
-
const
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1853
|
+
const functionName = "partialPay";
|
|
1854
|
+
const args = [
|
|
1855
|
+
orderId,
|
|
1856
|
+
anymalNftId,
|
|
1857
|
+
pid,
|
|
1858
|
+
amountInTokens,
|
|
1859
|
+
maxTokenPayment,
|
|
1860
|
+
nonce,
|
|
1861
|
+
deadline,
|
|
1862
|
+
backendSignature
|
|
1863
|
+
];
|
|
1864
|
+
const partialPayCalldata = (0, import_viem4.encodeFunctionData)({
|
|
1801
1865
|
abi: MARKETPLACE_ABI,
|
|
1802
|
-
functionName
|
|
1803
|
-
args
|
|
1804
|
-
orderId,
|
|
1805
|
-
anymalNftId,
|
|
1806
|
-
pid,
|
|
1807
|
-
amountInTokens,
|
|
1808
|
-
maxTokenPayment,
|
|
1809
|
-
nonce,
|
|
1810
|
-
deadline,
|
|
1811
|
-
backendSignature
|
|
1812
|
-
]
|
|
1866
|
+
functionName,
|
|
1867
|
+
args
|
|
1813
1868
|
});
|
|
1869
|
+
await simulateCall(
|
|
1870
|
+
bundlerClient.client,
|
|
1871
|
+
marketplaceContract,
|
|
1872
|
+
MARKETPLACE_ABI,
|
|
1873
|
+
functionName,
|
|
1874
|
+
args,
|
|
1875
|
+
smartAccount.address
|
|
1876
|
+
);
|
|
1814
1877
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
1815
1878
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
1816
1879
|
account: smartAccount,
|
|
@@ -1825,6 +1888,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
1825
1888
|
};
|
|
1826
1889
|
} catch (error) {
|
|
1827
1890
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
1891
|
+
console.error(errorMessage);
|
|
1828
1892
|
return {
|
|
1829
1893
|
success: false,
|
|
1830
1894
|
message: `Error during direct payment processing: ${errorMessage}`
|
|
@@ -1893,14 +1957,24 @@ function useProcessPartialKibblePayment() {
|
|
|
1893
1957
|
var import_react18 = require("react");
|
|
1894
1958
|
|
|
1895
1959
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
1896
|
-
var
|
|
1960
|
+
var import_viem5 = require("viem");
|
|
1897
1961
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
1898
1962
|
try {
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1963
|
+
const functionName = "approve";
|
|
1964
|
+
const args = [spenderAddress, approveAmount];
|
|
1965
|
+
const approveCalldata = (0, import_viem5.encodeFunctionData)({
|
|
1966
|
+
abi: import_viem5.erc20Abi,
|
|
1967
|
+
functionName,
|
|
1968
|
+
args
|
|
1903
1969
|
});
|
|
1970
|
+
await simulateCall(
|
|
1971
|
+
bundlerClient.client,
|
|
1972
|
+
kibbleTokenAddress,
|
|
1973
|
+
import_viem5.erc20Abi,
|
|
1974
|
+
functionName,
|
|
1975
|
+
args,
|
|
1976
|
+
smartAccount.address
|
|
1977
|
+
);
|
|
1904
1978
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
1905
1979
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
1906
1980
|
account: smartAccount,
|
|
@@ -1915,6 +1989,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
1915
1989
|
};
|
|
1916
1990
|
} catch (error) {
|
|
1917
1991
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
1992
|
+
console.error(errorMessage);
|
|
1918
1993
|
return {
|
|
1919
1994
|
success: false,
|
|
1920
1995
|
message: `Error during direct approval processing: ${errorMessage}`
|
|
@@ -1952,7 +2027,7 @@ function useApproveKibbleToken() {
|
|
|
1952
2027
|
|
|
1953
2028
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
1954
2029
|
var import_react19 = require("react");
|
|
1955
|
-
var
|
|
2030
|
+
var import_viem6 = require("viem");
|
|
1956
2031
|
function useCreateOrganizationBase() {
|
|
1957
2032
|
return (0, import_react19.useCallback)(
|
|
1958
2033
|
/**
|
|
@@ -1974,11 +2049,21 @@ function useCreateOrganizationBase() {
|
|
|
1974
2049
|
};
|
|
1975
2050
|
}
|
|
1976
2051
|
try {
|
|
1977
|
-
const
|
|
2052
|
+
const functionName = "createOrganizationProxy";
|
|
2053
|
+
const args = [ownerAddress, orgName, orgPid];
|
|
2054
|
+
const callData = (0, import_viem6.encodeFunctionData)({
|
|
1978
2055
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1979
|
-
functionName
|
|
1980
|
-
args
|
|
2056
|
+
functionName,
|
|
2057
|
+
args
|
|
1981
2058
|
});
|
|
2059
|
+
await simulateCall(
|
|
2060
|
+
bundlerClient.client,
|
|
2061
|
+
orgContractAddress,
|
|
2062
|
+
ORGANIZATION_BEACON_ABI,
|
|
2063
|
+
functionName,
|
|
2064
|
+
args,
|
|
2065
|
+
adminSmartAccount.address
|
|
2066
|
+
);
|
|
1982
2067
|
await applyBundlerGasEstimator(adminSmartAccount, bundlerClient);
|
|
1983
2068
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
1984
2069
|
account: adminSmartAccount,
|
|
@@ -2004,7 +2089,7 @@ function useCreateOrganizationBase() {
|
|
|
2004
2089
|
let proxyAddress;
|
|
2005
2090
|
for (const log of txReceipt.logs) {
|
|
2006
2091
|
try {
|
|
2007
|
-
const decoded = (0,
|
|
2092
|
+
const decoded = (0, import_viem6.decodeEventLog)({
|
|
2008
2093
|
abi: ORGANIZATION_BEACON_ABI,
|
|
2009
2094
|
data: log.data,
|
|
2010
2095
|
topics: log.topics
|
|
@@ -2043,10 +2128,10 @@ function useCreateOrganizationBase() {
|
|
|
2043
2128
|
var import_react20 = require("react");
|
|
2044
2129
|
|
|
2045
2130
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
2046
|
-
var
|
|
2131
|
+
var import_viem8 = require("viem");
|
|
2047
2132
|
|
|
2048
2133
|
// src/helpers/WaitForAllowance.tsx
|
|
2049
|
-
var
|
|
2134
|
+
var import_viem7 = require("viem");
|
|
2050
2135
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
2051
2136
|
const MAX_RETRIES = 10;
|
|
2052
2137
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -2055,7 +2140,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
2055
2140
|
try {
|
|
2056
2141
|
const currentAllowance = await publicClient.readContract({
|
|
2057
2142
|
address: tokenAddress,
|
|
2058
|
-
abi:
|
|
2143
|
+
abi: import_viem7.erc20Abi,
|
|
2059
2144
|
functionName: "allowance",
|
|
2060
2145
|
args: [ownerAddress, spenderAddress]
|
|
2061
2146
|
});
|
|
@@ -2080,16 +2165,25 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
2080
2165
|
if (approveAmount <= 0n) {
|
|
2081
2166
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
2082
2167
|
}
|
|
2083
|
-
const approveCalldata = (0,
|
|
2084
|
-
abi:
|
|
2168
|
+
const approveCalldata = (0, import_viem8.encodeFunctionData)({
|
|
2169
|
+
abi: import_viem8.erc20Abi,
|
|
2085
2170
|
functionName: "approve",
|
|
2086
2171
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
2087
2172
|
});
|
|
2088
|
-
const
|
|
2173
|
+
const args = [kibbleTokenAddress, approveCalldata];
|
|
2174
|
+
const executeApproveCalldata = (0, import_viem8.encodeFunctionData)({
|
|
2089
2175
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2090
|
-
functionName:
|
|
2091
|
-
args
|
|
2176
|
+
functionName: ORG_FUNCTION,
|
|
2177
|
+
args
|
|
2092
2178
|
});
|
|
2179
|
+
await simulateCall(
|
|
2180
|
+
bundlerClient.client,
|
|
2181
|
+
orgContractAddress,
|
|
2182
|
+
ORGANIZATION_IMPL_ABI,
|
|
2183
|
+
ORG_FUNCTION,
|
|
2184
|
+
args,
|
|
2185
|
+
managerSmartAccount.address
|
|
2186
|
+
);
|
|
2093
2187
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2094
2188
|
const userOpApproveHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2095
2189
|
account: managerSmartAccount,
|
|
@@ -2119,6 +2213,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
2119
2213
|
};
|
|
2120
2214
|
} catch (error) {
|
|
2121
2215
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
2216
|
+
console.error(errorMessage);
|
|
2122
2217
|
return {
|
|
2123
2218
|
success: false,
|
|
2124
2219
|
message: `Error during approval processing: ${errorMessage}`
|
|
@@ -2163,10 +2258,10 @@ function useApproveOrgPartialPayment() {
|
|
|
2163
2258
|
var import_react21 = require("react");
|
|
2164
2259
|
|
|
2165
2260
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
2166
|
-
var
|
|
2261
|
+
var import_viem9 = require("viem");
|
|
2167
2262
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
2168
2263
|
try {
|
|
2169
|
-
const partialPayCalldata = (0,
|
|
2264
|
+
const partialPayCalldata = (0, import_viem9.encodeFunctionData)({
|
|
2170
2265
|
abi: MARKETPLACE_ABI,
|
|
2171
2266
|
functionName: "partialPay",
|
|
2172
2267
|
args: [
|
|
@@ -2180,11 +2275,20 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
2180
2275
|
backendSignature
|
|
2181
2276
|
]
|
|
2182
2277
|
});
|
|
2183
|
-
const
|
|
2278
|
+
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
2279
|
+
const executePartialPayCalldata = (0, import_viem9.encodeFunctionData)({
|
|
2184
2280
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2185
|
-
functionName:
|
|
2186
|
-
args
|
|
2281
|
+
functionName: ORG_FUNCTION,
|
|
2282
|
+
args
|
|
2187
2283
|
});
|
|
2284
|
+
await simulateCall(
|
|
2285
|
+
bundlerClient.client,
|
|
2286
|
+
orgContractAddress,
|
|
2287
|
+
ORGANIZATION_IMPL_ABI,
|
|
2288
|
+
ORG_FUNCTION,
|
|
2289
|
+
args,
|
|
2290
|
+
managerSmartAccount.address
|
|
2291
|
+
);
|
|
2188
2292
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2189
2293
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2190
2294
|
account: managerSmartAccount,
|
|
@@ -2199,6 +2303,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
2199
2303
|
};
|
|
2200
2304
|
} catch (error) {
|
|
2201
2305
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
2306
|
+
console.error(errorMessage);
|
|
2202
2307
|
return {
|
|
2203
2308
|
success: false,
|
|
2204
2309
|
message: `Error during payment processing: ${errorMessage}`
|
|
@@ -2288,10 +2393,10 @@ function useUpdateOrgWalletAddress() {
|
|
|
2288
2393
|
|
|
2289
2394
|
// src/helpers/NonceHelper.tsx
|
|
2290
2395
|
var import_uuid = require("uuid");
|
|
2291
|
-
var
|
|
2396
|
+
var import_viem10 = require("viem");
|
|
2292
2397
|
var generateBytes32Nonce = () => {
|
|
2293
2398
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
2294
|
-
return (0,
|
|
2399
|
+
return (0, import_viem10.padHex)(`0x${uuid3}`, { size: 32 });
|
|
2295
2400
|
};
|
|
2296
2401
|
|
|
2297
2402
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -2747,16 +2852,16 @@ function useCreateOrganizationAppData() {
|
|
|
2747
2852
|
|
|
2748
2853
|
// src/utils/balance/useFetchBalance.ts
|
|
2749
2854
|
var import_react27 = require("react");
|
|
2750
|
-
var
|
|
2855
|
+
var import_viem11 = require("viem");
|
|
2751
2856
|
function useFetchBalance() {
|
|
2752
2857
|
return (0, import_react27.useCallback)(
|
|
2753
2858
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2754
2859
|
try {
|
|
2755
2860
|
const balance = await publicClient.readContract({
|
|
2756
|
-
address: (0,
|
|
2757
|
-
abi:
|
|
2861
|
+
address: (0, import_viem11.getAddress)(kibbleTokenAddress),
|
|
2862
|
+
abi: import_viem11.erc20Abi,
|
|
2758
2863
|
functionName: "balanceOf",
|
|
2759
|
-
args: [(0,
|
|
2864
|
+
args: [(0, import_viem11.getAddress)(walletAddress)]
|
|
2760
2865
|
});
|
|
2761
2866
|
return Number(balance);
|
|
2762
2867
|
} catch (error) {
|
|
@@ -2768,7 +2873,7 @@ function useFetchBalance() {
|
|
|
2768
2873
|
}
|
|
2769
2874
|
|
|
2770
2875
|
// src/utils/actions/useClaimActionReward.ts
|
|
2771
|
-
var
|
|
2876
|
+
var import_viem12 = require("viem");
|
|
2772
2877
|
var import_react28 = require("react");
|
|
2773
2878
|
function useClaimActionReward() {
|
|
2774
2879
|
return (0, import_react28.useCallback)(
|
|
@@ -2779,11 +2884,21 @@ function useClaimActionReward() {
|
|
|
2779
2884
|
message: "Missing web3auth account info or contract address."
|
|
2780
2885
|
};
|
|
2781
2886
|
}
|
|
2782
|
-
const
|
|
2887
|
+
const args = [actionId, claimIndex];
|
|
2888
|
+
const functionName = "claimByIndex";
|
|
2889
|
+
const callData = (0, import_viem12.encodeFunctionData)({
|
|
2783
2890
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2784
|
-
functionName
|
|
2785
|
-
args
|
|
2891
|
+
functionName,
|
|
2892
|
+
args
|
|
2786
2893
|
});
|
|
2894
|
+
await simulateCall(
|
|
2895
|
+
bundlerClient.client,
|
|
2896
|
+
rewardableActionContractAddress,
|
|
2897
|
+
REWARDABLE_ACTIONS_ABI,
|
|
2898
|
+
functionName,
|
|
2899
|
+
args,
|
|
2900
|
+
smartAccount.address
|
|
2901
|
+
);
|
|
2787
2902
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
2788
2903
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
2789
2904
|
account: smartAccount,
|
|
@@ -2807,7 +2922,7 @@ function useClaimActionReward() {
|
|
|
2807
2922
|
}
|
|
2808
2923
|
|
|
2809
2924
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2810
|
-
var
|
|
2925
|
+
var import_viem13 = require("viem");
|
|
2811
2926
|
var import_react29 = require("react");
|
|
2812
2927
|
function useClaimOrgActionReward() {
|
|
2813
2928
|
return (0, import_react29.useCallback)(
|
|
@@ -2818,16 +2933,25 @@ function useClaimOrgActionReward() {
|
|
|
2818
2933
|
message: "Missing web3auth account info or contract address."
|
|
2819
2934
|
};
|
|
2820
2935
|
}
|
|
2821
|
-
const claimCallData = (0,
|
|
2936
|
+
const claimCallData = (0, import_viem13.encodeFunctionData)({
|
|
2822
2937
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2823
2938
|
functionName: "claimByIndex",
|
|
2824
2939
|
args: [actionId, claimIndex]
|
|
2825
2940
|
});
|
|
2826
|
-
const
|
|
2941
|
+
const args = [rewardableActionContractAddress, claimCallData];
|
|
2942
|
+
const executeClaimCalldata = (0, import_viem13.encodeFunctionData)({
|
|
2827
2943
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2828
|
-
functionName:
|
|
2829
|
-
args
|
|
2944
|
+
functionName: ORG_FUNCTION,
|
|
2945
|
+
args
|
|
2830
2946
|
});
|
|
2947
|
+
await simulateCall(
|
|
2948
|
+
bundlerClient.client,
|
|
2949
|
+
orgContractAddress,
|
|
2950
|
+
ORGANIZATION_IMPL_ABI,
|
|
2951
|
+
ORG_FUNCTION,
|
|
2952
|
+
args,
|
|
2953
|
+
smartAccount.address
|
|
2954
|
+
);
|
|
2831
2955
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
2832
2956
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
2833
2957
|
account: smartAccount,
|
|
@@ -2991,6 +3115,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
2991
3115
|
generateBytes32Nonce,
|
|
2992
3116
|
generateJWT,
|
|
2993
3117
|
getFirebaseTokenForApp,
|
|
3118
|
+
humanRevert,
|
|
2994
3119
|
loadExistingSecp256k1PrivateKey,
|
|
2995
3120
|
processDirectKibbleApproval,
|
|
2996
3121
|
processDirectPartialPayment,
|
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
|
|
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,
|
|
@@ -1668,7 +1730,7 @@ function useFetchAnymals() {
|
|
|
1668
1730
|
import { useCallback as useCallback17 } from "react";
|
|
1669
1731
|
|
|
1670
1732
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
1671
|
-
import { encodeFunctionData as encodeFunctionData2
|
|
1733
|
+
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
1672
1734
|
|
|
1673
1735
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
1674
1736
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -1717,30 +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 {
|
|
1720
|
-
const
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1782
|
+
const functionName = "partialPay";
|
|
1783
|
+
const args = [
|
|
1784
|
+
orderId,
|
|
1785
|
+
anymalNftId,
|
|
1786
|
+
pid,
|
|
1787
|
+
amountInTokens,
|
|
1788
|
+
maxTokenPayment,
|
|
1789
|
+
nonce,
|
|
1790
|
+
deadline,
|
|
1791
|
+
backendSignature
|
|
1792
|
+
];
|
|
1730
1793
|
const partialPayCalldata = encodeFunctionData2({
|
|
1731
1794
|
abi: MARKETPLACE_ABI,
|
|
1732
|
-
functionName
|
|
1733
|
-
args
|
|
1734
|
-
orderId,
|
|
1735
|
-
anymalNftId,
|
|
1736
|
-
pid,
|
|
1737
|
-
amountInTokens,
|
|
1738
|
-
maxTokenPayment,
|
|
1739
|
-
nonce,
|
|
1740
|
-
deadline,
|
|
1741
|
-
backendSignature
|
|
1742
|
-
]
|
|
1795
|
+
functionName,
|
|
1796
|
+
args
|
|
1743
1797
|
});
|
|
1798
|
+
await simulateCall(
|
|
1799
|
+
bundlerClient.client,
|
|
1800
|
+
marketplaceContract,
|
|
1801
|
+
MARKETPLACE_ABI,
|
|
1802
|
+
functionName,
|
|
1803
|
+
args,
|
|
1804
|
+
smartAccount.address
|
|
1805
|
+
);
|
|
1744
1806
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
1745
1807
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
1746
1808
|
account: smartAccount,
|
|
@@ -1755,6 +1817,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
1755
1817
|
};
|
|
1756
1818
|
} catch (error) {
|
|
1757
1819
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
1820
|
+
console.error(errorMessage);
|
|
1758
1821
|
return {
|
|
1759
1822
|
success: false,
|
|
1760
1823
|
message: `Error during direct payment processing: ${errorMessage}`
|
|
@@ -1823,14 +1886,24 @@ function useProcessPartialKibblePayment() {
|
|
|
1823
1886
|
import { useCallback as useCallback18 } from "react";
|
|
1824
1887
|
|
|
1825
1888
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
1826
|
-
import { encodeFunctionData as encodeFunctionData3, erc20Abi
|
|
1889
|
+
import { encodeFunctionData as encodeFunctionData3, erc20Abi } from "viem";
|
|
1827
1890
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
1828
1891
|
try {
|
|
1892
|
+
const functionName = "approve";
|
|
1893
|
+
const args = [spenderAddress, approveAmount];
|
|
1829
1894
|
const approveCalldata = encodeFunctionData3({
|
|
1830
|
-
abi:
|
|
1831
|
-
functionName
|
|
1832
|
-
args
|
|
1895
|
+
abi: erc20Abi,
|
|
1896
|
+
functionName,
|
|
1897
|
+
args
|
|
1833
1898
|
});
|
|
1899
|
+
await simulateCall(
|
|
1900
|
+
bundlerClient.client,
|
|
1901
|
+
kibbleTokenAddress,
|
|
1902
|
+
erc20Abi,
|
|
1903
|
+
functionName,
|
|
1904
|
+
args,
|
|
1905
|
+
smartAccount.address
|
|
1906
|
+
);
|
|
1834
1907
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
1835
1908
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
1836
1909
|
account: smartAccount,
|
|
@@ -1845,6 +1918,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
1845
1918
|
};
|
|
1846
1919
|
} catch (error) {
|
|
1847
1920
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
1921
|
+
console.error(errorMessage);
|
|
1848
1922
|
return {
|
|
1849
1923
|
success: false,
|
|
1850
1924
|
message: `Error during direct approval processing: ${errorMessage}`
|
|
@@ -1904,11 +1978,21 @@ function useCreateOrganizationBase() {
|
|
|
1904
1978
|
};
|
|
1905
1979
|
}
|
|
1906
1980
|
try {
|
|
1981
|
+
const functionName = "createOrganizationProxy";
|
|
1982
|
+
const args = [ownerAddress, orgName, orgPid];
|
|
1907
1983
|
const callData = encodeFunctionData4({
|
|
1908
1984
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1909
|
-
functionName
|
|
1910
|
-
args
|
|
1985
|
+
functionName,
|
|
1986
|
+
args
|
|
1911
1987
|
});
|
|
1988
|
+
await simulateCall(
|
|
1989
|
+
bundlerClient.client,
|
|
1990
|
+
orgContractAddress,
|
|
1991
|
+
ORGANIZATION_BEACON_ABI,
|
|
1992
|
+
functionName,
|
|
1993
|
+
args,
|
|
1994
|
+
adminSmartAccount.address
|
|
1995
|
+
);
|
|
1912
1996
|
await applyBundlerGasEstimator(adminSmartAccount, bundlerClient);
|
|
1913
1997
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
1914
1998
|
account: adminSmartAccount,
|
|
@@ -1973,10 +2057,10 @@ function useCreateOrganizationBase() {
|
|
|
1973
2057
|
import { useCallback as useCallback20 } from "react";
|
|
1974
2058
|
|
|
1975
2059
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
1976
|
-
import { encodeFunctionData as encodeFunctionData5, erc20Abi as
|
|
2060
|
+
import { encodeFunctionData as encodeFunctionData5, erc20Abi as erc20Abi3 } from "viem";
|
|
1977
2061
|
|
|
1978
2062
|
// src/helpers/WaitForAllowance.tsx
|
|
1979
|
-
import { erc20Abi as
|
|
2063
|
+
import { erc20Abi as erc20Abi2 } from "viem";
|
|
1980
2064
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
1981
2065
|
const MAX_RETRIES = 10;
|
|
1982
2066
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -1985,7 +2069,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
1985
2069
|
try {
|
|
1986
2070
|
const currentAllowance = await publicClient.readContract({
|
|
1987
2071
|
address: tokenAddress,
|
|
1988
|
-
abi:
|
|
2072
|
+
abi: erc20Abi2,
|
|
1989
2073
|
functionName: "allowance",
|
|
1990
2074
|
args: [ownerAddress, spenderAddress]
|
|
1991
2075
|
});
|
|
@@ -2011,15 +2095,24 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
2011
2095
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
2012
2096
|
}
|
|
2013
2097
|
const approveCalldata = encodeFunctionData5({
|
|
2014
|
-
abi:
|
|
2098
|
+
abi: erc20Abi3,
|
|
2015
2099
|
functionName: "approve",
|
|
2016
2100
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
2017
2101
|
});
|
|
2102
|
+
const args = [kibbleTokenAddress, approveCalldata];
|
|
2018
2103
|
const executeApproveCalldata = encodeFunctionData5({
|
|
2019
2104
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2020
|
-
functionName:
|
|
2021
|
-
args
|
|
2105
|
+
functionName: ORG_FUNCTION,
|
|
2106
|
+
args
|
|
2022
2107
|
});
|
|
2108
|
+
await simulateCall(
|
|
2109
|
+
bundlerClient.client,
|
|
2110
|
+
orgContractAddress,
|
|
2111
|
+
ORGANIZATION_IMPL_ABI,
|
|
2112
|
+
ORG_FUNCTION,
|
|
2113
|
+
args,
|
|
2114
|
+
managerSmartAccount.address
|
|
2115
|
+
);
|
|
2023
2116
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2024
2117
|
const userOpApproveHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2025
2118
|
account: managerSmartAccount,
|
|
@@ -2049,6 +2142,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
2049
2142
|
};
|
|
2050
2143
|
} catch (error) {
|
|
2051
2144
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
2145
|
+
console.error(errorMessage);
|
|
2052
2146
|
return {
|
|
2053
2147
|
success: false,
|
|
2054
2148
|
message: `Error during approval processing: ${errorMessage}`
|
|
@@ -2110,11 +2204,20 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
2110
2204
|
backendSignature
|
|
2111
2205
|
]
|
|
2112
2206
|
});
|
|
2207
|
+
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
2113
2208
|
const executePartialPayCalldata = encodeFunctionData6({
|
|
2114
2209
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2115
|
-
functionName:
|
|
2116
|
-
args
|
|
2210
|
+
functionName: ORG_FUNCTION,
|
|
2211
|
+
args
|
|
2117
2212
|
});
|
|
2213
|
+
await simulateCall(
|
|
2214
|
+
bundlerClient.client,
|
|
2215
|
+
orgContractAddress,
|
|
2216
|
+
ORGANIZATION_IMPL_ABI,
|
|
2217
|
+
ORG_FUNCTION,
|
|
2218
|
+
args,
|
|
2219
|
+
managerSmartAccount.address
|
|
2220
|
+
);
|
|
2118
2221
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2119
2222
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2120
2223
|
account: managerSmartAccount,
|
|
@@ -2129,6 +2232,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
2129
2232
|
};
|
|
2130
2233
|
} catch (error) {
|
|
2131
2234
|
const errorMessage = error instanceof Error ? error.cause?.message || error.message : "An unknown error occurred.";
|
|
2235
|
+
console.error(errorMessage);
|
|
2132
2236
|
return {
|
|
2133
2237
|
success: false,
|
|
2134
2238
|
message: `Error during payment processing: ${errorMessage}`
|
|
@@ -2494,14 +2598,14 @@ function useCreateOrganizationAppData() {
|
|
|
2494
2598
|
|
|
2495
2599
|
// src/utils/balance/useFetchBalance.ts
|
|
2496
2600
|
import { useCallback as useCallback27 } from "react";
|
|
2497
|
-
import { erc20Abi as
|
|
2601
|
+
import { erc20Abi as erc20Abi4, getAddress } from "viem";
|
|
2498
2602
|
function useFetchBalance() {
|
|
2499
2603
|
return useCallback27(
|
|
2500
2604
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2501
2605
|
try {
|
|
2502
2606
|
const balance = await publicClient.readContract({
|
|
2503
2607
|
address: getAddress(kibbleTokenAddress),
|
|
2504
|
-
abi:
|
|
2608
|
+
abi: erc20Abi4,
|
|
2505
2609
|
functionName: "balanceOf",
|
|
2506
2610
|
args: [getAddress(walletAddress)]
|
|
2507
2611
|
});
|
|
@@ -2526,11 +2630,21 @@ function useClaimActionReward() {
|
|
|
2526
2630
|
message: "Missing web3auth account info or contract address."
|
|
2527
2631
|
};
|
|
2528
2632
|
}
|
|
2633
|
+
const args = [actionId, claimIndex];
|
|
2634
|
+
const functionName = "claimByIndex";
|
|
2529
2635
|
const callData = encodeFunctionData7({
|
|
2530
2636
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2531
|
-
functionName
|
|
2532
|
-
args
|
|
2637
|
+
functionName,
|
|
2638
|
+
args
|
|
2533
2639
|
});
|
|
2640
|
+
await simulateCall(
|
|
2641
|
+
bundlerClient.client,
|
|
2642
|
+
rewardableActionContractAddress,
|
|
2643
|
+
REWARDABLE_ACTIONS_ABI,
|
|
2644
|
+
functionName,
|
|
2645
|
+
args,
|
|
2646
|
+
smartAccount.address
|
|
2647
|
+
);
|
|
2534
2648
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
2535
2649
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
2536
2650
|
account: smartAccount,
|
|
@@ -2570,11 +2684,20 @@ function useClaimOrgActionReward() {
|
|
|
2570
2684
|
functionName: "claimByIndex",
|
|
2571
2685
|
args: [actionId, claimIndex]
|
|
2572
2686
|
});
|
|
2687
|
+
const args = [rewardableActionContractAddress, claimCallData];
|
|
2573
2688
|
const executeClaimCalldata = encodeFunctionData8({
|
|
2574
2689
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2575
|
-
functionName:
|
|
2576
|
-
args
|
|
2690
|
+
functionName: ORG_FUNCTION,
|
|
2691
|
+
args
|
|
2577
2692
|
});
|
|
2693
|
+
await simulateCall(
|
|
2694
|
+
bundlerClient.client,
|
|
2695
|
+
orgContractAddress,
|
|
2696
|
+
ORGANIZATION_IMPL_ABI,
|
|
2697
|
+
ORG_FUNCTION,
|
|
2698
|
+
args,
|
|
2699
|
+
smartAccount.address
|
|
2700
|
+
);
|
|
2578
2701
|
await applyBundlerGasEstimator(smartAccount, bundlerClient);
|
|
2579
2702
|
const userOpHash = await bundlerClient.sendUserOperation({
|
|
2580
2703
|
account: smartAccount,
|
|
@@ -2737,6 +2860,7 @@ export {
|
|
|
2737
2860
|
generateBytes32Nonce,
|
|
2738
2861
|
generateJWT,
|
|
2739
2862
|
getFirebaseTokenForApp,
|
|
2863
|
+
humanRevert,
|
|
2740
2864
|
loadExistingSecp256k1PrivateKey,
|
|
2741
2865
|
processDirectKibbleApproval,
|
|
2742
2866
|
processDirectPartialPayment,
|
package/package.json
CHANGED