anymal-protocol 1.0.125 → 1.0.127
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 +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +116 -81
- package/dist/index.mjs +100 -66
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -63,6 +63,12 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
63
63
|
error: Error | undefined;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
message: string;
|
|
69
|
+
status: string;
|
|
70
|
+
}>;
|
|
71
|
+
|
|
66
72
|
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
73
|
success: boolean;
|
|
68
74
|
message: string;
|
|
@@ -850,4 +856,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
850
856
|
*/
|
|
851
857
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
852
858
|
|
|
853
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
859
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,12 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
63
63
|
error: Error | undefined;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
message: string;
|
|
69
|
+
status: string;
|
|
70
|
+
}>;
|
|
71
|
+
|
|
66
72
|
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
73
|
success: boolean;
|
|
68
74
|
message: string;
|
|
@@ -850,4 +856,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
850
856
|
*/
|
|
851
857
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
852
858
|
|
|
853
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
859
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseMintAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ __export(index_exports, {
|
|
|
61
61
|
useApproveOrgPartialPayment: () => useApproveOrgPartialPayment,
|
|
62
62
|
useClaimActionReward: () => useClaimActionReward,
|
|
63
63
|
useClaimOrgActionReward: () => useClaimOrgActionReward,
|
|
64
|
+
useCoinbaseClaimActionReward: () => useCoinbaseClaimActionReward,
|
|
64
65
|
useCoinbaseMintAnymalNFT: () => useCoinbaseMintAnymalNFT,
|
|
65
66
|
useCreateOrganizationAppData: () => useCreateOrganizationAppData,
|
|
66
67
|
useCreateOrganizationBase: () => useCreateOrganizationBase,
|
|
@@ -491,7 +492,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
491
492
|
return { sendOperationFn, data, status, error };
|
|
492
493
|
}
|
|
493
494
|
|
|
494
|
-
// src/utils/coinbase/
|
|
495
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
495
496
|
var import_viem2 = require("viem");
|
|
496
497
|
|
|
497
498
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
@@ -2925,16 +2926,44 @@ var OZ_ERROR_FRAGMENTS = [
|
|
|
2925
2926
|
var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem.parseAbi)([...OZ_ERROR_FRAGMENTS])];
|
|
2926
2927
|
var ORG_FUNCTION = "executeCall";
|
|
2927
2928
|
|
|
2928
|
-
// src/utils/coinbase/
|
|
2929
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
2929
2930
|
var import_react11 = require("react");
|
|
2930
|
-
function
|
|
2931
|
+
function useCoinbaseClaimActionReward() {
|
|
2931
2932
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2932
2933
|
return (0, import_react11.useCallback)(
|
|
2934
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2935
|
+
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2936
|
+
return {
|
|
2937
|
+
success: false,
|
|
2938
|
+
message: "Missing important data",
|
|
2939
|
+
status: "error"
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
const args = [actionId, claimIndex];
|
|
2943
|
+
const functionName = "claimByIndex";
|
|
2944
|
+
const callData = (0, import_viem2.encodeFunctionData)({
|
|
2945
|
+
abi: REWARDABLE_ACTIONS_ABI,
|
|
2946
|
+
functionName,
|
|
2947
|
+
args
|
|
2948
|
+
});
|
|
2949
|
+
await sendOperationFn(evmAddress, callData, validationContractAddress);
|
|
2950
|
+
return { success: true, message: "Reward claimed", status };
|
|
2951
|
+
},
|
|
2952
|
+
[]
|
|
2953
|
+
);
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2957
|
+
var import_viem3 = require("viem");
|
|
2958
|
+
var import_react12 = require("react");
|
|
2959
|
+
function useCoinbaseMintAnymalNFT() {
|
|
2960
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2961
|
+
return (0, import_react12.useCallback)(
|
|
2933
2962
|
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2934
2963
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2935
2964
|
return {
|
|
2936
2965
|
success: false,
|
|
2937
|
-
message: "Missing authentication token OR NFT ID.",
|
|
2966
|
+
message: "Coinbase Mint NFT: Missing authentication token OR NFT ID.",
|
|
2938
2967
|
status: "error"
|
|
2939
2968
|
};
|
|
2940
2969
|
}
|
|
@@ -2946,7 +2975,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2946
2975
|
"petastic-signup-campaign-1",
|
|
2947
2976
|
anymalTxId
|
|
2948
2977
|
];
|
|
2949
|
-
const callData = (0,
|
|
2978
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
2950
2979
|
abi: PET_NFT_ABI,
|
|
2951
2980
|
functionName,
|
|
2952
2981
|
args
|
|
@@ -2959,8 +2988,8 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2959
2988
|
}
|
|
2960
2989
|
|
|
2961
2990
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
2962
|
-
var
|
|
2963
|
-
var
|
|
2991
|
+
var import_viem5 = require("viem");
|
|
2992
|
+
var import_react13 = require("react");
|
|
2964
2993
|
|
|
2965
2994
|
// src/helpers/GasEstimateHelper.tsx
|
|
2966
2995
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3004,18 +3033,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3004
3033
|
}
|
|
3005
3034
|
|
|
3006
3035
|
// src/helpers/HumanRevert.tsx
|
|
3007
|
-
var
|
|
3036
|
+
var import_viem4 = require("viem");
|
|
3008
3037
|
function humanRevert(raw, shortMessage) {
|
|
3009
3038
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3010
3039
|
try {
|
|
3011
|
-
const { errorName, args } = (0,
|
|
3040
|
+
const { errorName, args } = (0, import_viem4.decodeErrorResult)({
|
|
3012
3041
|
abi: ERROR_ABI,
|
|
3013
3042
|
data: raw
|
|
3014
3043
|
});
|
|
3015
3044
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3016
3045
|
} catch {
|
|
3017
3046
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3018
|
-
return (0,
|
|
3047
|
+
return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
|
|
3019
3048
|
}
|
|
3020
3049
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3021
3050
|
}
|
|
@@ -3041,12 +3070,12 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3041
3070
|
|
|
3042
3071
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3043
3072
|
function useMintAnymalNFT() {
|
|
3044
|
-
return (0,
|
|
3073
|
+
return (0, import_react13.useCallback)(
|
|
3045
3074
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3046
3075
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3047
3076
|
return {
|
|
3048
3077
|
success: false,
|
|
3049
|
-
message: "Missing authentication token OR NFT ID."
|
|
3078
|
+
message: "Mint NFT: Missing authentication token OR NFT ID."
|
|
3050
3079
|
};
|
|
3051
3080
|
}
|
|
3052
3081
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -3057,7 +3086,7 @@ function useMintAnymalNFT() {
|
|
|
3057
3086
|
"petastic-signup-campaign-1",
|
|
3058
3087
|
anymalTxId
|
|
3059
3088
|
];
|
|
3060
|
-
const callData = (0,
|
|
3089
|
+
const callData = (0, import_viem5.encodeFunctionData)({
|
|
3061
3090
|
abi: PET_NFT_ABI,
|
|
3062
3091
|
functionName,
|
|
3063
3092
|
args
|
|
@@ -3093,9 +3122,9 @@ function useMintAnymalNFT() {
|
|
|
3093
3122
|
}
|
|
3094
3123
|
|
|
3095
3124
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3096
|
-
var
|
|
3125
|
+
var import_react14 = require("react");
|
|
3097
3126
|
function useSaveAnymalMetadata() {
|
|
3098
|
-
return (0,
|
|
3127
|
+
return (0, import_react14.useCallback)(
|
|
3099
3128
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3100
3129
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3101
3130
|
method: "POST",
|
|
@@ -3123,7 +3152,7 @@ function useSaveAnymalMetadata() {
|
|
|
3123
3152
|
}
|
|
3124
3153
|
|
|
3125
3154
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3126
|
-
var
|
|
3155
|
+
var import_react15 = require("react");
|
|
3127
3156
|
|
|
3128
3157
|
// src/helpers/UploadImageHelper.tsx
|
|
3129
3158
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3180,7 +3209,7 @@ function toBase64(file) {
|
|
|
3180
3209
|
|
|
3181
3210
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3182
3211
|
function useUploadAnymalImage() {
|
|
3183
|
-
return (0,
|
|
3212
|
+
return (0, import_react15.useCallback)(
|
|
3184
3213
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3185
3214
|
if (!imageFile || !idToken) {
|
|
3186
3215
|
return {
|
|
@@ -3241,10 +3270,10 @@ function useUploadAnymalImage() {
|
|
|
3241
3270
|
}
|
|
3242
3271
|
|
|
3243
3272
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3244
|
-
var
|
|
3273
|
+
var import_react16 = require("react");
|
|
3245
3274
|
|
|
3246
3275
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3247
|
-
var
|
|
3276
|
+
var import_viem6 = require("viem");
|
|
3248
3277
|
|
|
3249
3278
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3250
3279
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3304,7 +3333,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3304
3333
|
deadline,
|
|
3305
3334
|
backendSignature
|
|
3306
3335
|
];
|
|
3307
|
-
const partialPayCalldata = (0,
|
|
3336
|
+
const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
3308
3337
|
abi: MARKETPLACE_ABI,
|
|
3309
3338
|
functionName,
|
|
3310
3339
|
args
|
|
@@ -3341,7 +3370,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3341
3370
|
|
|
3342
3371
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3343
3372
|
function useProcessPartialKibblePayment() {
|
|
3344
|
-
return (0,
|
|
3373
|
+
return (0, import_react16.useCallback)(
|
|
3345
3374
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3346
3375
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3347
3376
|
return {
|
|
@@ -3397,23 +3426,23 @@ function useProcessPartialKibblePayment() {
|
|
|
3397
3426
|
}
|
|
3398
3427
|
|
|
3399
3428
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3400
|
-
var
|
|
3429
|
+
var import_react17 = require("react");
|
|
3401
3430
|
|
|
3402
3431
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3403
|
-
var
|
|
3432
|
+
var import_viem7 = require("viem");
|
|
3404
3433
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3405
3434
|
try {
|
|
3406
3435
|
const functionName = "approve";
|
|
3407
3436
|
const args = [spenderAddress, approveAmount];
|
|
3408
|
-
const approveCalldata = (0,
|
|
3409
|
-
abi:
|
|
3437
|
+
const approveCalldata = (0, import_viem7.encodeFunctionData)({
|
|
3438
|
+
abi: import_viem7.erc20Abi,
|
|
3410
3439
|
functionName,
|
|
3411
3440
|
args
|
|
3412
3441
|
});
|
|
3413
3442
|
await simulateCall(
|
|
3414
3443
|
bundlerClient.client,
|
|
3415
3444
|
kibbleTokenAddress,
|
|
3416
|
-
|
|
3445
|
+
import_viem7.erc20Abi,
|
|
3417
3446
|
functionName,
|
|
3418
3447
|
args,
|
|
3419
3448
|
smartAccount.address
|
|
@@ -3442,7 +3471,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3442
3471
|
|
|
3443
3472
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3444
3473
|
function useApproveKibbleToken() {
|
|
3445
|
-
return (0,
|
|
3474
|
+
return (0, import_react17.useCallback)(
|
|
3446
3475
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3447
3476
|
try {
|
|
3448
3477
|
const result = await processDirectKibbleApproval(
|
|
@@ -3469,10 +3498,10 @@ function useApproveKibbleToken() {
|
|
|
3469
3498
|
}
|
|
3470
3499
|
|
|
3471
3500
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3472
|
-
var
|
|
3473
|
-
var
|
|
3501
|
+
var import_react18 = require("react");
|
|
3502
|
+
var import_viem8 = require("viem");
|
|
3474
3503
|
function useCreateOrganizationBase() {
|
|
3475
|
-
return (0,
|
|
3504
|
+
return (0, import_react18.useCallback)(
|
|
3476
3505
|
/**
|
|
3477
3506
|
* Creates a new organization on-chain.
|
|
3478
3507
|
*
|
|
@@ -3494,7 +3523,7 @@ function useCreateOrganizationBase() {
|
|
|
3494
3523
|
try {
|
|
3495
3524
|
const functionName = "createOrganizationProxy";
|
|
3496
3525
|
const args = [ownerAddress, orgName, orgPid];
|
|
3497
|
-
const callData = (0,
|
|
3526
|
+
const callData = (0, import_viem8.encodeFunctionData)({
|
|
3498
3527
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3499
3528
|
functionName,
|
|
3500
3529
|
args
|
|
@@ -3532,7 +3561,7 @@ function useCreateOrganizationBase() {
|
|
|
3532
3561
|
let proxyAddress;
|
|
3533
3562
|
for (const log of txReceipt.logs) {
|
|
3534
3563
|
try {
|
|
3535
|
-
const decoded = (0,
|
|
3564
|
+
const decoded = (0, import_viem8.decodeEventLog)({
|
|
3536
3565
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3537
3566
|
data: log.data,
|
|
3538
3567
|
topics: log.topics
|
|
@@ -3568,13 +3597,13 @@ function useCreateOrganizationBase() {
|
|
|
3568
3597
|
}
|
|
3569
3598
|
|
|
3570
3599
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3571
|
-
var
|
|
3600
|
+
var import_react19 = require("react");
|
|
3572
3601
|
|
|
3573
3602
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3574
|
-
var
|
|
3603
|
+
var import_viem10 = require("viem");
|
|
3575
3604
|
|
|
3576
3605
|
// src/helpers/WaitForAllowance.tsx
|
|
3577
|
-
var
|
|
3606
|
+
var import_viem9 = require("viem");
|
|
3578
3607
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3579
3608
|
const MAX_RETRIES = 10;
|
|
3580
3609
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3583,7 +3612,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3583
3612
|
try {
|
|
3584
3613
|
const currentAllowance = await publicClient.readContract({
|
|
3585
3614
|
address: tokenAddress,
|
|
3586
|
-
abi:
|
|
3615
|
+
abi: import_viem9.erc20Abi,
|
|
3587
3616
|
functionName: "allowance",
|
|
3588
3617
|
args: [ownerAddress, spenderAddress]
|
|
3589
3618
|
});
|
|
@@ -3608,13 +3637,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3608
3637
|
if (approveAmount <= 0n) {
|
|
3609
3638
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3610
3639
|
}
|
|
3611
|
-
const approveCalldata = (0,
|
|
3612
|
-
abi:
|
|
3640
|
+
const approveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3641
|
+
abi: import_viem10.erc20Abi,
|
|
3613
3642
|
functionName: "approve",
|
|
3614
3643
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3615
3644
|
});
|
|
3616
3645
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3617
|
-
const executeApproveCalldata = (0,
|
|
3646
|
+
const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3618
3647
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3619
3648
|
functionName: ORG_FUNCTION,
|
|
3620
3649
|
args
|
|
@@ -3666,7 +3695,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3666
3695
|
|
|
3667
3696
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3668
3697
|
function useApproveOrgPartialPayment() {
|
|
3669
|
-
return (0,
|
|
3698
|
+
return (0, import_react19.useCallback)(
|
|
3670
3699
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3671
3700
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3672
3701
|
return {
|
|
@@ -3698,13 +3727,13 @@ function useApproveOrgPartialPayment() {
|
|
|
3698
3727
|
}
|
|
3699
3728
|
|
|
3700
3729
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3701
|
-
var
|
|
3730
|
+
var import_react20 = require("react");
|
|
3702
3731
|
|
|
3703
3732
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3704
|
-
var
|
|
3733
|
+
var import_viem11 = require("viem");
|
|
3705
3734
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3706
3735
|
try {
|
|
3707
|
-
const partialPayCalldata = (0,
|
|
3736
|
+
const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3708
3737
|
abi: MARKETPLACE_ABI,
|
|
3709
3738
|
functionName: "partialPay",
|
|
3710
3739
|
args: [
|
|
@@ -3719,7 +3748,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3719
3748
|
]
|
|
3720
3749
|
});
|
|
3721
3750
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3722
|
-
const executePartialPayCalldata = (0,
|
|
3751
|
+
const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3723
3752
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3724
3753
|
functionName: ORG_FUNCTION,
|
|
3725
3754
|
args
|
|
@@ -3756,7 +3785,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3756
3785
|
|
|
3757
3786
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3758
3787
|
function useProcessOrgPartialKibblePayment() {
|
|
3759
|
-
return (0,
|
|
3788
|
+
return (0, import_react20.useCallback)(
|
|
3760
3789
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3761
3790
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3762
3791
|
return {
|
|
@@ -3794,9 +3823,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3794
3823
|
}
|
|
3795
3824
|
|
|
3796
3825
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3797
|
-
var
|
|
3826
|
+
var import_react21 = require("react");
|
|
3798
3827
|
function useUpdateOrgWalletAddress() {
|
|
3799
|
-
return (0,
|
|
3828
|
+
return (0, import_react21.useCallback)(
|
|
3800
3829
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3801
3830
|
try {
|
|
3802
3831
|
const mutation = `
|
|
@@ -3835,15 +3864,15 @@ function useUpdateOrgWalletAddress() {
|
|
|
3835
3864
|
}
|
|
3836
3865
|
|
|
3837
3866
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3838
|
-
var
|
|
3839
|
-
var
|
|
3867
|
+
var import_viem12 = require("viem");
|
|
3868
|
+
var import_react22 = require("react");
|
|
3840
3869
|
function useMintOrgAnymalNFT() {
|
|
3841
|
-
return (0,
|
|
3870
|
+
return (0, import_react22.useCallback)(
|
|
3842
3871
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
3843
3872
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
3844
3873
|
return {
|
|
3845
3874
|
success: false,
|
|
3846
|
-
message: "Missing authentication token OR NFT ID."
|
|
3875
|
+
message: "Mint Org NFT: Missing authentication token OR NFT ID."
|
|
3847
3876
|
};
|
|
3848
3877
|
}
|
|
3849
3878
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -3854,13 +3883,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3854
3883
|
"petastic-signup-campaign-1",
|
|
3855
3884
|
anymalTxId
|
|
3856
3885
|
];
|
|
3857
|
-
const callData = (0,
|
|
3886
|
+
const callData = (0, import_viem12.encodeFunctionData)({
|
|
3858
3887
|
abi: PET_NFT_ABI,
|
|
3859
3888
|
functionName,
|
|
3860
3889
|
args
|
|
3861
3890
|
});
|
|
3862
3891
|
const executeArgs = [validationContractAddress, callData];
|
|
3863
|
-
const executeSubmitMetaCalldata = (0,
|
|
3892
|
+
const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3864
3893
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3865
3894
|
functionName: ORG_FUNCTION,
|
|
3866
3895
|
args: executeArgs
|
|
@@ -3876,7 +3905,12 @@ function useMintOrgAnymalNFT() {
|
|
|
3876
3905
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
3877
3906
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
3878
3907
|
account: managerSmartAccount,
|
|
3879
|
-
calls: [
|
|
3908
|
+
calls: [
|
|
3909
|
+
{
|
|
3910
|
+
to: orgContractAddress,
|
|
3911
|
+
data: executeSubmitMetaCalldata
|
|
3912
|
+
}
|
|
3913
|
+
],
|
|
3880
3914
|
paymaster: true
|
|
3881
3915
|
});
|
|
3882
3916
|
await waitForReceiptWithRetries(bundlerClient, userOpHash);
|
|
@@ -3888,10 +3922,10 @@ function useMintOrgAnymalNFT() {
|
|
|
3888
3922
|
|
|
3889
3923
|
// src/helpers/NonceHelper.tsx
|
|
3890
3924
|
var import_uuid = require("uuid");
|
|
3891
|
-
var
|
|
3925
|
+
var import_viem13 = require("viem");
|
|
3892
3926
|
var generateBytes32Nonce = () => {
|
|
3893
3927
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
3894
|
-
return (0,
|
|
3928
|
+
return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
|
|
3895
3929
|
};
|
|
3896
3930
|
|
|
3897
3931
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4101,9 +4135,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4101
4135
|
}
|
|
4102
4136
|
|
|
4103
4137
|
// src/utils/actions/useFetchActions.ts
|
|
4104
|
-
var
|
|
4138
|
+
var import_react23 = require("react");
|
|
4105
4139
|
function useFetchActions() {
|
|
4106
|
-
return (0,
|
|
4140
|
+
return (0, import_react23.useCallback)(
|
|
4107
4141
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4108
4142
|
const params = new URLSearchParams({ pid });
|
|
4109
4143
|
if (status) params.set("status", status);
|
|
@@ -4132,9 +4166,9 @@ function useFetchActions() {
|
|
|
4132
4166
|
}
|
|
4133
4167
|
|
|
4134
4168
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4135
|
-
var
|
|
4169
|
+
var import_react24 = require("react");
|
|
4136
4170
|
function useFetchActionDefinitions() {
|
|
4137
|
-
return (0,
|
|
4171
|
+
return (0, import_react24.useCallback)(
|
|
4138
4172
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4139
4173
|
try {
|
|
4140
4174
|
const response = await fetch(
|
|
@@ -4231,10 +4265,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4231
4265
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4232
4266
|
|
|
4233
4267
|
// src/utils/application/useCreateUserAppData.ts
|
|
4234
|
-
var
|
|
4268
|
+
var import_react25 = require("react");
|
|
4235
4269
|
var import_uuid2 = require("uuid");
|
|
4236
4270
|
function useCreateUserAppData() {
|
|
4237
|
-
return (0,
|
|
4271
|
+
return (0, import_react25.useCallback)(
|
|
4238
4272
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4239
4273
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4240
4274
|
const appValues = {
|
|
@@ -4289,10 +4323,10 @@ function useCreateUserAppData() {
|
|
|
4289
4323
|
}
|
|
4290
4324
|
|
|
4291
4325
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4292
|
-
var
|
|
4326
|
+
var import_react26 = require("react");
|
|
4293
4327
|
var import_uuid3 = require("uuid");
|
|
4294
4328
|
function useCreateOrganizationAppData() {
|
|
4295
|
-
return (0,
|
|
4329
|
+
return (0, import_react26.useCallback)(
|
|
4296
4330
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4297
4331
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4298
4332
|
const appValues = {
|
|
@@ -4346,17 +4380,17 @@ function useCreateOrganizationAppData() {
|
|
|
4346
4380
|
}
|
|
4347
4381
|
|
|
4348
4382
|
// src/utils/balance/useFetchBalance.ts
|
|
4349
|
-
var
|
|
4350
|
-
var
|
|
4383
|
+
var import_react27 = require("react");
|
|
4384
|
+
var import_viem14 = require("viem");
|
|
4351
4385
|
function useFetchBalance() {
|
|
4352
|
-
return (0,
|
|
4386
|
+
return (0, import_react27.useCallback)(
|
|
4353
4387
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4354
4388
|
try {
|
|
4355
4389
|
const balance = await publicClient.readContract({
|
|
4356
|
-
address: (0,
|
|
4357
|
-
abi:
|
|
4390
|
+
address: (0, import_viem14.getAddress)(kibbleTokenAddress),
|
|
4391
|
+
abi: import_viem14.erc20Abi,
|
|
4358
4392
|
functionName: "balanceOf",
|
|
4359
|
-
args: [(0,
|
|
4393
|
+
args: [(0, import_viem14.getAddress)(walletAddress)]
|
|
4360
4394
|
});
|
|
4361
4395
|
return Number(balance);
|
|
4362
4396
|
} catch (error) {
|
|
@@ -4368,10 +4402,10 @@ function useFetchBalance() {
|
|
|
4368
4402
|
}
|
|
4369
4403
|
|
|
4370
4404
|
// src/utils/actions/useClaimActionReward.ts
|
|
4371
|
-
var
|
|
4372
|
-
var
|
|
4405
|
+
var import_viem15 = require("viem");
|
|
4406
|
+
var import_react28 = require("react");
|
|
4373
4407
|
function useClaimActionReward() {
|
|
4374
|
-
return (0,
|
|
4408
|
+
return (0, import_react28.useCallback)(
|
|
4375
4409
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4376
4410
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4377
4411
|
return {
|
|
@@ -4381,7 +4415,7 @@ function useClaimActionReward() {
|
|
|
4381
4415
|
}
|
|
4382
4416
|
const args = [actionId, claimIndex];
|
|
4383
4417
|
const functionName = "claimByIndex";
|
|
4384
|
-
const callData = (0,
|
|
4418
|
+
const callData = (0, import_viem15.encodeFunctionData)({
|
|
4385
4419
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4386
4420
|
functionName,
|
|
4387
4421
|
args
|
|
@@ -4417,10 +4451,10 @@ function useClaimActionReward() {
|
|
|
4417
4451
|
}
|
|
4418
4452
|
|
|
4419
4453
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4420
|
-
var
|
|
4421
|
-
var
|
|
4454
|
+
var import_viem16 = require("viem");
|
|
4455
|
+
var import_react29 = require("react");
|
|
4422
4456
|
function useClaimOrgActionReward() {
|
|
4423
|
-
return (0,
|
|
4457
|
+
return (0, import_react29.useCallback)(
|
|
4424
4458
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4425
4459
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4426
4460
|
return {
|
|
@@ -4428,13 +4462,13 @@ function useClaimOrgActionReward() {
|
|
|
4428
4462
|
message: "Missing web3auth account info or contract address."
|
|
4429
4463
|
};
|
|
4430
4464
|
}
|
|
4431
|
-
const claimCallData = (0,
|
|
4465
|
+
const claimCallData = (0, import_viem16.encodeFunctionData)({
|
|
4432
4466
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4433
4467
|
functionName: "claimByIndex",
|
|
4434
4468
|
args: [actionId, claimIndex]
|
|
4435
4469
|
});
|
|
4436
4470
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4437
|
-
const executeClaimCalldata = (0,
|
|
4471
|
+
const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
|
|
4438
4472
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4439
4473
|
functionName: ORG_FUNCTION,
|
|
4440
4474
|
args
|
|
@@ -4470,9 +4504,9 @@ function useClaimOrgActionReward() {
|
|
|
4470
4504
|
}
|
|
4471
4505
|
|
|
4472
4506
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4473
|
-
var
|
|
4507
|
+
var import_react30 = require("react");
|
|
4474
4508
|
function useSubmitContractAction() {
|
|
4475
|
-
return (0,
|
|
4509
|
+
return (0, import_react30.useCallback)(
|
|
4476
4510
|
(idToken, pid, source, endpoint, payload) => {
|
|
4477
4511
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4478
4512
|
let sourceTypePayload = {};
|
|
@@ -4630,6 +4664,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4630
4664
|
useApproveOrgPartialPayment,
|
|
4631
4665
|
useClaimActionReward,
|
|
4632
4666
|
useClaimOrgActionReward,
|
|
4667
|
+
useCoinbaseClaimActionReward,
|
|
4633
4668
|
useCoinbaseMintAnymalNFT,
|
|
4634
4669
|
useCreateOrganizationAppData,
|
|
4635
4670
|
useCreateOrganizationBase,
|
package/dist/index.mjs
CHANGED
|
@@ -414,7 +414,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
414
414
|
return { sendOperationFn, data, status, error };
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
// src/utils/coinbase/
|
|
417
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
418
418
|
import { encodeFunctionData } from "viem";
|
|
419
419
|
|
|
420
420
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
@@ -2848,16 +2848,44 @@ var OZ_ERROR_FRAGMENTS = [
|
|
|
2848
2848
|
var ERROR_ABI = [...LOCAL_ERRORS, parseAbi([...OZ_ERROR_FRAGMENTS])];
|
|
2849
2849
|
var ORG_FUNCTION = "executeCall";
|
|
2850
2850
|
|
|
2851
|
-
// src/utils/coinbase/
|
|
2851
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
2852
2852
|
import { useCallback as useCallback11 } from "react";
|
|
2853
|
-
function
|
|
2853
|
+
function useCoinbaseClaimActionReward() {
|
|
2854
2854
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2855
2855
|
return useCallback11(
|
|
2856
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2857
|
+
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2858
|
+
return {
|
|
2859
|
+
success: false,
|
|
2860
|
+
message: "Missing important data",
|
|
2861
|
+
status: "error"
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
const args = [actionId, claimIndex];
|
|
2865
|
+
const functionName = "claimByIndex";
|
|
2866
|
+
const callData = encodeFunctionData({
|
|
2867
|
+
abi: REWARDABLE_ACTIONS_ABI,
|
|
2868
|
+
functionName,
|
|
2869
|
+
args
|
|
2870
|
+
});
|
|
2871
|
+
await sendOperationFn(evmAddress, callData, validationContractAddress);
|
|
2872
|
+
return { success: true, message: "Reward claimed", status };
|
|
2873
|
+
},
|
|
2874
|
+
[]
|
|
2875
|
+
);
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2878
|
+
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2879
|
+
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2880
|
+
import { useCallback as useCallback12 } from "react";
|
|
2881
|
+
function useCoinbaseMintAnymalNFT() {
|
|
2882
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2883
|
+
return useCallback12(
|
|
2856
2884
|
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2857
2885
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2858
2886
|
return {
|
|
2859
2887
|
success: false,
|
|
2860
|
-
message: "Missing authentication token OR NFT ID.",
|
|
2888
|
+
message: "Coinbase Mint NFT: Missing authentication token OR NFT ID.",
|
|
2861
2889
|
status: "error"
|
|
2862
2890
|
};
|
|
2863
2891
|
}
|
|
@@ -2869,7 +2897,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2869
2897
|
"petastic-signup-campaign-1",
|
|
2870
2898
|
anymalTxId
|
|
2871
2899
|
];
|
|
2872
|
-
const callData =
|
|
2900
|
+
const callData = encodeFunctionData2({
|
|
2873
2901
|
abi: PET_NFT_ABI,
|
|
2874
2902
|
functionName,
|
|
2875
2903
|
args
|
|
@@ -2882,8 +2910,8 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2882
2910
|
}
|
|
2883
2911
|
|
|
2884
2912
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
2885
|
-
import { encodeFunctionData as
|
|
2886
|
-
import { useCallback as
|
|
2913
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
2914
|
+
import { useCallback as useCallback13 } from "react";
|
|
2887
2915
|
|
|
2888
2916
|
// src/helpers/GasEstimateHelper.tsx
|
|
2889
2917
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -2964,12 +2992,12 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
2964
2992
|
|
|
2965
2993
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
2966
2994
|
function useMintAnymalNFT() {
|
|
2967
|
-
return
|
|
2995
|
+
return useCallback13(
|
|
2968
2996
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
2969
2997
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
2970
2998
|
return {
|
|
2971
2999
|
success: false,
|
|
2972
|
-
message: "Missing authentication token OR NFT ID."
|
|
3000
|
+
message: "Mint NFT: Missing authentication token OR NFT ID."
|
|
2973
3001
|
};
|
|
2974
3002
|
}
|
|
2975
3003
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -2980,7 +3008,7 @@ function useMintAnymalNFT() {
|
|
|
2980
3008
|
"petastic-signup-campaign-1",
|
|
2981
3009
|
anymalTxId
|
|
2982
3010
|
];
|
|
2983
|
-
const callData =
|
|
3011
|
+
const callData = encodeFunctionData3({
|
|
2984
3012
|
abi: PET_NFT_ABI,
|
|
2985
3013
|
functionName,
|
|
2986
3014
|
args
|
|
@@ -3016,9 +3044,9 @@ function useMintAnymalNFT() {
|
|
|
3016
3044
|
}
|
|
3017
3045
|
|
|
3018
3046
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3019
|
-
import { useCallback as
|
|
3047
|
+
import { useCallback as useCallback14 } from "react";
|
|
3020
3048
|
function useSaveAnymalMetadata() {
|
|
3021
|
-
return
|
|
3049
|
+
return useCallback14(
|
|
3022
3050
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3023
3051
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3024
3052
|
method: "POST",
|
|
@@ -3046,7 +3074,7 @@ function useSaveAnymalMetadata() {
|
|
|
3046
3074
|
}
|
|
3047
3075
|
|
|
3048
3076
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3049
|
-
import { useCallback as
|
|
3077
|
+
import { useCallback as useCallback15 } from "react";
|
|
3050
3078
|
|
|
3051
3079
|
// src/helpers/UploadImageHelper.tsx
|
|
3052
3080
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3103,7 +3131,7 @@ function toBase64(file) {
|
|
|
3103
3131
|
|
|
3104
3132
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3105
3133
|
function useUploadAnymalImage() {
|
|
3106
|
-
return
|
|
3134
|
+
return useCallback15(
|
|
3107
3135
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3108
3136
|
if (!imageFile || !idToken) {
|
|
3109
3137
|
return {
|
|
@@ -3164,10 +3192,10 @@ function useUploadAnymalImage() {
|
|
|
3164
3192
|
}
|
|
3165
3193
|
|
|
3166
3194
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3167
|
-
import { useCallback as
|
|
3195
|
+
import { useCallback as useCallback16 } from "react";
|
|
3168
3196
|
|
|
3169
3197
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3170
|
-
import { encodeFunctionData as
|
|
3198
|
+
import { encodeFunctionData as encodeFunctionData4 } from "viem";
|
|
3171
3199
|
|
|
3172
3200
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3173
3201
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3227,7 +3255,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3227
3255
|
deadline,
|
|
3228
3256
|
backendSignature
|
|
3229
3257
|
];
|
|
3230
|
-
const partialPayCalldata =
|
|
3258
|
+
const partialPayCalldata = encodeFunctionData4({
|
|
3231
3259
|
abi: MARKETPLACE_ABI,
|
|
3232
3260
|
functionName,
|
|
3233
3261
|
args
|
|
@@ -3264,7 +3292,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3264
3292
|
|
|
3265
3293
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3266
3294
|
function useProcessPartialKibblePayment() {
|
|
3267
|
-
return
|
|
3295
|
+
return useCallback16(
|
|
3268
3296
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3269
3297
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3270
3298
|
return {
|
|
@@ -3320,15 +3348,15 @@ function useProcessPartialKibblePayment() {
|
|
|
3320
3348
|
}
|
|
3321
3349
|
|
|
3322
3350
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3323
|
-
import { useCallback as
|
|
3351
|
+
import { useCallback as useCallback17 } from "react";
|
|
3324
3352
|
|
|
3325
3353
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3326
|
-
import { encodeFunctionData as
|
|
3354
|
+
import { encodeFunctionData as encodeFunctionData5, erc20Abi } from "viem";
|
|
3327
3355
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3328
3356
|
try {
|
|
3329
3357
|
const functionName = "approve";
|
|
3330
3358
|
const args = [spenderAddress, approveAmount];
|
|
3331
|
-
const approveCalldata =
|
|
3359
|
+
const approveCalldata = encodeFunctionData5({
|
|
3332
3360
|
abi: erc20Abi,
|
|
3333
3361
|
functionName,
|
|
3334
3362
|
args
|
|
@@ -3365,7 +3393,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3365
3393
|
|
|
3366
3394
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3367
3395
|
function useApproveKibbleToken() {
|
|
3368
|
-
return
|
|
3396
|
+
return useCallback17(
|
|
3369
3397
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3370
3398
|
try {
|
|
3371
3399
|
const result = await processDirectKibbleApproval(
|
|
@@ -3392,10 +3420,10 @@ function useApproveKibbleToken() {
|
|
|
3392
3420
|
}
|
|
3393
3421
|
|
|
3394
3422
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3395
|
-
import { useCallback as
|
|
3396
|
-
import { decodeEventLog, encodeFunctionData as
|
|
3423
|
+
import { useCallback as useCallback18 } from "react";
|
|
3424
|
+
import { decodeEventLog, encodeFunctionData as encodeFunctionData6 } from "viem";
|
|
3397
3425
|
function useCreateOrganizationBase() {
|
|
3398
|
-
return
|
|
3426
|
+
return useCallback18(
|
|
3399
3427
|
/**
|
|
3400
3428
|
* Creates a new organization on-chain.
|
|
3401
3429
|
*
|
|
@@ -3417,7 +3445,7 @@ function useCreateOrganizationBase() {
|
|
|
3417
3445
|
try {
|
|
3418
3446
|
const functionName = "createOrganizationProxy";
|
|
3419
3447
|
const args = [ownerAddress, orgName, orgPid];
|
|
3420
|
-
const callData =
|
|
3448
|
+
const callData = encodeFunctionData6({
|
|
3421
3449
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3422
3450
|
functionName,
|
|
3423
3451
|
args
|
|
@@ -3491,10 +3519,10 @@ function useCreateOrganizationBase() {
|
|
|
3491
3519
|
}
|
|
3492
3520
|
|
|
3493
3521
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3494
|
-
import { useCallback as
|
|
3522
|
+
import { useCallback as useCallback19 } from "react";
|
|
3495
3523
|
|
|
3496
3524
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3497
|
-
import { encodeFunctionData as
|
|
3525
|
+
import { encodeFunctionData as encodeFunctionData7, erc20Abi as erc20Abi3 } from "viem";
|
|
3498
3526
|
|
|
3499
3527
|
// src/helpers/WaitForAllowance.tsx
|
|
3500
3528
|
import { erc20Abi as erc20Abi2 } from "viem";
|
|
@@ -3531,13 +3559,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3531
3559
|
if (approveAmount <= 0n) {
|
|
3532
3560
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3533
3561
|
}
|
|
3534
|
-
const approveCalldata =
|
|
3562
|
+
const approveCalldata = encodeFunctionData7({
|
|
3535
3563
|
abi: erc20Abi3,
|
|
3536
3564
|
functionName: "approve",
|
|
3537
3565
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3538
3566
|
});
|
|
3539
3567
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3540
|
-
const executeApproveCalldata =
|
|
3568
|
+
const executeApproveCalldata = encodeFunctionData7({
|
|
3541
3569
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3542
3570
|
functionName: ORG_FUNCTION,
|
|
3543
3571
|
args
|
|
@@ -3589,7 +3617,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3589
3617
|
|
|
3590
3618
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3591
3619
|
function useApproveOrgPartialPayment() {
|
|
3592
|
-
return
|
|
3620
|
+
return useCallback19(
|
|
3593
3621
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3594
3622
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3595
3623
|
return {
|
|
@@ -3621,13 +3649,13 @@ function useApproveOrgPartialPayment() {
|
|
|
3621
3649
|
}
|
|
3622
3650
|
|
|
3623
3651
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3624
|
-
import { useCallback as
|
|
3652
|
+
import { useCallback as useCallback20 } from "react";
|
|
3625
3653
|
|
|
3626
3654
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3627
|
-
import { encodeFunctionData as
|
|
3655
|
+
import { encodeFunctionData as encodeFunctionData8 } from "viem";
|
|
3628
3656
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3629
3657
|
try {
|
|
3630
|
-
const partialPayCalldata =
|
|
3658
|
+
const partialPayCalldata = encodeFunctionData8({
|
|
3631
3659
|
abi: MARKETPLACE_ABI,
|
|
3632
3660
|
functionName: "partialPay",
|
|
3633
3661
|
args: [
|
|
@@ -3642,7 +3670,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3642
3670
|
]
|
|
3643
3671
|
});
|
|
3644
3672
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3645
|
-
const executePartialPayCalldata =
|
|
3673
|
+
const executePartialPayCalldata = encodeFunctionData8({
|
|
3646
3674
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3647
3675
|
functionName: ORG_FUNCTION,
|
|
3648
3676
|
args
|
|
@@ -3679,7 +3707,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3679
3707
|
|
|
3680
3708
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3681
3709
|
function useProcessOrgPartialKibblePayment() {
|
|
3682
|
-
return
|
|
3710
|
+
return useCallback20(
|
|
3683
3711
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3684
3712
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3685
3713
|
return {
|
|
@@ -3717,9 +3745,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3717
3745
|
}
|
|
3718
3746
|
|
|
3719
3747
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3720
|
-
import { useCallback as
|
|
3748
|
+
import { useCallback as useCallback21 } from "react";
|
|
3721
3749
|
function useUpdateOrgWalletAddress() {
|
|
3722
|
-
return
|
|
3750
|
+
return useCallback21(
|
|
3723
3751
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3724
3752
|
try {
|
|
3725
3753
|
const mutation = `
|
|
@@ -3758,15 +3786,15 @@ function useUpdateOrgWalletAddress() {
|
|
|
3758
3786
|
}
|
|
3759
3787
|
|
|
3760
3788
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3761
|
-
import { encodeFunctionData as
|
|
3762
|
-
import { useCallback as
|
|
3789
|
+
import { encodeFunctionData as encodeFunctionData9 } from "viem";
|
|
3790
|
+
import { useCallback as useCallback22 } from "react";
|
|
3763
3791
|
function useMintOrgAnymalNFT() {
|
|
3764
|
-
return
|
|
3792
|
+
return useCallback22(
|
|
3765
3793
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
3766
3794
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
3767
3795
|
return {
|
|
3768
3796
|
success: false,
|
|
3769
|
-
message: "Missing authentication token OR NFT ID."
|
|
3797
|
+
message: "Mint Org NFT: Missing authentication token OR NFT ID."
|
|
3770
3798
|
};
|
|
3771
3799
|
}
|
|
3772
3800
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -3777,13 +3805,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3777
3805
|
"petastic-signup-campaign-1",
|
|
3778
3806
|
anymalTxId
|
|
3779
3807
|
];
|
|
3780
|
-
const callData =
|
|
3808
|
+
const callData = encodeFunctionData9({
|
|
3781
3809
|
abi: PET_NFT_ABI,
|
|
3782
3810
|
functionName,
|
|
3783
3811
|
args
|
|
3784
3812
|
});
|
|
3785
3813
|
const executeArgs = [validationContractAddress, callData];
|
|
3786
|
-
const executeSubmitMetaCalldata =
|
|
3814
|
+
const executeSubmitMetaCalldata = encodeFunctionData9({
|
|
3787
3815
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3788
3816
|
functionName: ORG_FUNCTION,
|
|
3789
3817
|
args: executeArgs
|
|
@@ -3799,7 +3827,12 @@ function useMintOrgAnymalNFT() {
|
|
|
3799
3827
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
3800
3828
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
3801
3829
|
account: managerSmartAccount,
|
|
3802
|
-
calls: [
|
|
3830
|
+
calls: [
|
|
3831
|
+
{
|
|
3832
|
+
to: orgContractAddress,
|
|
3833
|
+
data: executeSubmitMetaCalldata
|
|
3834
|
+
}
|
|
3835
|
+
],
|
|
3803
3836
|
paymaster: true
|
|
3804
3837
|
});
|
|
3805
3838
|
await waitForReceiptWithRetries(bundlerClient, userOpHash);
|
|
@@ -3841,9 +3874,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
3841
3874
|
}
|
|
3842
3875
|
|
|
3843
3876
|
// src/utils/actions/useFetchActions.ts
|
|
3844
|
-
import { useCallback as
|
|
3877
|
+
import { useCallback as useCallback23 } from "react";
|
|
3845
3878
|
function useFetchActions() {
|
|
3846
|
-
return
|
|
3879
|
+
return useCallback23(
|
|
3847
3880
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
3848
3881
|
const params = new URLSearchParams({ pid });
|
|
3849
3882
|
if (status) params.set("status", status);
|
|
@@ -3872,9 +3905,9 @@ function useFetchActions() {
|
|
|
3872
3905
|
}
|
|
3873
3906
|
|
|
3874
3907
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
3875
|
-
import { useCallback as
|
|
3908
|
+
import { useCallback as useCallback24 } from "react";
|
|
3876
3909
|
function useFetchActionDefinitions() {
|
|
3877
|
-
return
|
|
3910
|
+
return useCallback24(
|
|
3878
3911
|
async (idToken, actionsServiceBaseUrl) => {
|
|
3879
3912
|
try {
|
|
3880
3913
|
const response = await fetch(
|
|
@@ -3971,10 +4004,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
3971
4004
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
3972
4005
|
|
|
3973
4006
|
// src/utils/application/useCreateUserAppData.ts
|
|
3974
|
-
import { useCallback as
|
|
4007
|
+
import { useCallback as useCallback25 } from "react";
|
|
3975
4008
|
import { v4 as uuid } from "uuid";
|
|
3976
4009
|
function useCreateUserAppData() {
|
|
3977
|
-
return
|
|
4010
|
+
return useCallback25(
|
|
3978
4011
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
3979
4012
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
3980
4013
|
const appValues = {
|
|
@@ -4029,10 +4062,10 @@ function useCreateUserAppData() {
|
|
|
4029
4062
|
}
|
|
4030
4063
|
|
|
4031
4064
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4032
|
-
import { useCallback as
|
|
4065
|
+
import { useCallback as useCallback26 } from "react";
|
|
4033
4066
|
import { v4 as uuid2 } from "uuid";
|
|
4034
4067
|
function useCreateOrganizationAppData() {
|
|
4035
|
-
return
|
|
4068
|
+
return useCallback26(
|
|
4036
4069
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4037
4070
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4038
4071
|
const appValues = {
|
|
@@ -4086,10 +4119,10 @@ function useCreateOrganizationAppData() {
|
|
|
4086
4119
|
}
|
|
4087
4120
|
|
|
4088
4121
|
// src/utils/balance/useFetchBalance.ts
|
|
4089
|
-
import { useCallback as
|
|
4122
|
+
import { useCallback as useCallback27 } from "react";
|
|
4090
4123
|
import { erc20Abi as erc20Abi4, getAddress } from "viem";
|
|
4091
4124
|
function useFetchBalance() {
|
|
4092
|
-
return
|
|
4125
|
+
return useCallback27(
|
|
4093
4126
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4094
4127
|
try {
|
|
4095
4128
|
const balance = await publicClient.readContract({
|
|
@@ -4108,10 +4141,10 @@ function useFetchBalance() {
|
|
|
4108
4141
|
}
|
|
4109
4142
|
|
|
4110
4143
|
// src/utils/actions/useClaimActionReward.ts
|
|
4111
|
-
import { encodeFunctionData as
|
|
4112
|
-
import { useCallback as
|
|
4144
|
+
import { encodeFunctionData as encodeFunctionData10 } from "viem";
|
|
4145
|
+
import { useCallback as useCallback28 } from "react";
|
|
4113
4146
|
function useClaimActionReward() {
|
|
4114
|
-
return
|
|
4147
|
+
return useCallback28(
|
|
4115
4148
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4116
4149
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4117
4150
|
return {
|
|
@@ -4121,7 +4154,7 @@ function useClaimActionReward() {
|
|
|
4121
4154
|
}
|
|
4122
4155
|
const args = [actionId, claimIndex];
|
|
4123
4156
|
const functionName = "claimByIndex";
|
|
4124
|
-
const callData =
|
|
4157
|
+
const callData = encodeFunctionData10({
|
|
4125
4158
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4126
4159
|
functionName,
|
|
4127
4160
|
args
|
|
@@ -4157,10 +4190,10 @@ function useClaimActionReward() {
|
|
|
4157
4190
|
}
|
|
4158
4191
|
|
|
4159
4192
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4160
|
-
import { encodeFunctionData as
|
|
4161
|
-
import { useCallback as
|
|
4193
|
+
import { encodeFunctionData as encodeFunctionData11 } from "viem";
|
|
4194
|
+
import { useCallback as useCallback29 } from "react";
|
|
4162
4195
|
function useClaimOrgActionReward() {
|
|
4163
|
-
return
|
|
4196
|
+
return useCallback29(
|
|
4164
4197
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4165
4198
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4166
4199
|
return {
|
|
@@ -4168,13 +4201,13 @@ function useClaimOrgActionReward() {
|
|
|
4168
4201
|
message: "Missing web3auth account info or contract address."
|
|
4169
4202
|
};
|
|
4170
4203
|
}
|
|
4171
|
-
const claimCallData =
|
|
4204
|
+
const claimCallData = encodeFunctionData11({
|
|
4172
4205
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4173
4206
|
functionName: "claimByIndex",
|
|
4174
4207
|
args: [actionId, claimIndex]
|
|
4175
4208
|
});
|
|
4176
4209
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4177
|
-
const executeClaimCalldata =
|
|
4210
|
+
const executeClaimCalldata = encodeFunctionData11({
|
|
4178
4211
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4179
4212
|
functionName: ORG_FUNCTION,
|
|
4180
4213
|
args
|
|
@@ -4210,9 +4243,9 @@ function useClaimOrgActionReward() {
|
|
|
4210
4243
|
}
|
|
4211
4244
|
|
|
4212
4245
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4213
|
-
import { useCallback as
|
|
4246
|
+
import { useCallback as useCallback30 } from "react";
|
|
4214
4247
|
function useSubmitContractAction() {
|
|
4215
|
-
return
|
|
4248
|
+
return useCallback30(
|
|
4216
4249
|
(idToken, pid, source, endpoint, payload) => {
|
|
4217
4250
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4218
4251
|
let sourceTypePayload = {};
|
|
@@ -4369,6 +4402,7 @@ export {
|
|
|
4369
4402
|
useApproveOrgPartialPayment,
|
|
4370
4403
|
useClaimActionReward,
|
|
4371
4404
|
useClaimOrgActionReward,
|
|
4405
|
+
useCoinbaseClaimActionReward,
|
|
4372
4406
|
useCoinbaseMintAnymalNFT,
|
|
4373
4407
|
useCreateOrganizationAppData,
|
|
4374
4408
|
useCreateOrganizationBase,
|
package/package.json
CHANGED