anymal-protocol 1.0.124 → 1.0.126
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 +15 -24
- package/dist/index.d.ts +15 -24
- package/dist/index.js +149 -309
- package/dist/index.mjs +132 -289
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,7 +43,6 @@ __export(index_exports, {
|
|
|
43
43
|
convertToMultipleActionRecords: () => convertToMultipleActionRecords,
|
|
44
44
|
createApp: () => createApp,
|
|
45
45
|
createAuthEnvelope: () => createAuthEnvelope,
|
|
46
|
-
fetchAnymals: () => fetchAnymals,
|
|
47
46
|
flattenFirestoreData: () => flattenFirestoreData,
|
|
48
47
|
generateAppSignature: () => generateAppSignature,
|
|
49
48
|
generateBytes32Nonce: () => generateBytes32Nonce,
|
|
@@ -58,19 +57,18 @@ __export(index_exports, {
|
|
|
58
57
|
sendUserOpWithRetries: () => sendUserOpWithRetries,
|
|
59
58
|
serializePublicKeyCompressed: () => serializePublicKeyCompressed,
|
|
60
59
|
submitAction: () => submitAction,
|
|
61
|
-
useAddAnymalToDatabase: () => useAddAnymalToDatabase,
|
|
62
60
|
useApproveKibbleToken: () => useApproveKibbleToken,
|
|
63
61
|
useApproveOrgPartialPayment: () => useApproveOrgPartialPayment,
|
|
64
62
|
useClaimActionReward: () => useClaimActionReward,
|
|
65
63
|
useClaimOrgActionReward: () => useClaimOrgActionReward,
|
|
64
|
+
useCoinbaseClaimActionReward: () => useCoinbaseClaimActionReward,
|
|
65
|
+
useCoinbaseMintAnymalNFT: () => useCoinbaseMintAnymalNFT,
|
|
66
66
|
useCreateOrganizationAppData: () => useCreateOrganizationAppData,
|
|
67
67
|
useCreateOrganizationBase: () => useCreateOrganizationBase,
|
|
68
68
|
useCreateUserAppData: () => useCreateUserAppData,
|
|
69
69
|
useCreateWeb3Account: () => useCreateWeb3Account,
|
|
70
|
-
useDeleteAnymalFromDatabase: () => useDeleteAnymalFromDatabase,
|
|
71
70
|
useFetchActionDefinitions: () => useFetchActionDefinitions,
|
|
72
71
|
useFetchActions: () => useFetchActions,
|
|
73
|
-
useFetchAnymals: () => useFetchAnymals,
|
|
74
72
|
useFetchBalance: () => useFetchBalance,
|
|
75
73
|
useFetchNotifications: () => useFetchNotifications,
|
|
76
74
|
useFetchUserData: () => useFetchUserData,
|
|
@@ -81,7 +79,6 @@ __export(index_exports, {
|
|
|
81
79
|
useSaveAnymalMetadata: () => useSaveAnymalMetadata,
|
|
82
80
|
useSendCoinbaseUserOperation: () => useSendCoinbaseUserOperation,
|
|
83
81
|
useSubmitContractAction: () => useSubmitContractAction,
|
|
84
|
-
useUpdateAnymalWithNFT: () => useUpdateAnymalWithNFT,
|
|
85
82
|
useUpdateOrgWalletAddress: () => useUpdateOrgWalletAddress,
|
|
86
83
|
useUpdateUserAsVerified: () => useUpdateUserAsVerified,
|
|
87
84
|
useUpdateUserEmail: () => useUpdateUserEmail,
|
|
@@ -495,6 +492,9 @@ function useSendCoinbaseUserOperation() {
|
|
|
495
492
|
return { sendOperationFn, data, status, error };
|
|
496
493
|
}
|
|
497
494
|
|
|
495
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
496
|
+
var import_viem2 = require("viem");
|
|
497
|
+
|
|
498
498
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
499
499
|
var import_viem = require("viem");
|
|
500
500
|
var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
|
|
@@ -2926,9 +2926,70 @@ var OZ_ERROR_FRAGMENTS = [
|
|
|
2926
2926
|
var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem.parseAbi)([...OZ_ERROR_FRAGMENTS])];
|
|
2927
2927
|
var ORG_FUNCTION = "executeCall";
|
|
2928
2928
|
|
|
2929
|
-
// src/utils/
|
|
2930
|
-
var import_viem3 = require("viem");
|
|
2929
|
+
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
2931
2930
|
var import_react11 = require("react");
|
|
2931
|
+
function useCoinbaseClaimActionReward() {
|
|
2932
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
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 information",
|
|
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)(
|
|
2962
|
+
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2963
|
+
if (!nftId || !pid || !validationContractAddress) {
|
|
2964
|
+
return {
|
|
2965
|
+
success: false,
|
|
2966
|
+
message: "Coinbase Mint NFT: Missing authentication token OR NFT ID.",
|
|
2967
|
+
status: "error"
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
const functionName = "submitMetadataByCampaignName";
|
|
2971
|
+
const args = [
|
|
2972
|
+
pid,
|
|
2973
|
+
nftId,
|
|
2974
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
2975
|
+
"petastic-signup-campaign-1",
|
|
2976
|
+
anymalTxId
|
|
2977
|
+
];
|
|
2978
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
2979
|
+
abi: PET_NFT_ABI,
|
|
2980
|
+
functionName,
|
|
2981
|
+
args
|
|
2982
|
+
});
|
|
2983
|
+
await sendOperationFn(evmAddress, callData, validationContractAddress);
|
|
2984
|
+
return { success: true, message: "Pet Passport Created", status };
|
|
2985
|
+
},
|
|
2986
|
+
[]
|
|
2987
|
+
);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
2991
|
+
var import_viem5 = require("viem");
|
|
2992
|
+
var import_react13 = require("react");
|
|
2932
2993
|
|
|
2933
2994
|
// src/helpers/GasEstimateHelper.tsx
|
|
2934
2995
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -2972,18 +3033,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
2972
3033
|
}
|
|
2973
3034
|
|
|
2974
3035
|
// src/helpers/HumanRevert.tsx
|
|
2975
|
-
var
|
|
3036
|
+
var import_viem4 = require("viem");
|
|
2976
3037
|
function humanRevert(raw, shortMessage) {
|
|
2977
3038
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
2978
3039
|
try {
|
|
2979
|
-
const { errorName, args } = (0,
|
|
3040
|
+
const { errorName, args } = (0, import_viem4.decodeErrorResult)({
|
|
2980
3041
|
abi: ERROR_ABI,
|
|
2981
3042
|
data: raw
|
|
2982
3043
|
});
|
|
2983
3044
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
2984
3045
|
} catch {
|
|
2985
3046
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
2986
|
-
return (0,
|
|
3047
|
+
return (0, import_viem4.hexToString)(`0x${raw.slice(138)}`);
|
|
2987
3048
|
}
|
|
2988
3049
|
return `${raw.slice(0, 10)}\u2026`;
|
|
2989
3050
|
}
|
|
@@ -3009,12 +3070,12 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3009
3070
|
|
|
3010
3071
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3011
3072
|
function useMintAnymalNFT() {
|
|
3012
|
-
return (0,
|
|
3073
|
+
return (0, import_react13.useCallback)(
|
|
3013
3074
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3014
3075
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3015
3076
|
return {
|
|
3016
3077
|
success: false,
|
|
3017
|
-
message: "Missing authentication token OR NFT ID."
|
|
3078
|
+
message: "Mint NFT: Missing authentication token OR NFT ID."
|
|
3018
3079
|
};
|
|
3019
3080
|
}
|
|
3020
3081
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -3025,7 +3086,7 @@ function useMintAnymalNFT() {
|
|
|
3025
3086
|
"petastic-signup-campaign-1",
|
|
3026
3087
|
anymalTxId
|
|
3027
3088
|
];
|
|
3028
|
-
const callData = (0,
|
|
3089
|
+
const callData = (0, import_viem5.encodeFunctionData)({
|
|
3029
3090
|
abi: PET_NFT_ABI,
|
|
3030
3091
|
functionName,
|
|
3031
3092
|
args
|
|
@@ -3060,126 +3121,11 @@ function useMintAnymalNFT() {
|
|
|
3060
3121
|
);
|
|
3061
3122
|
}
|
|
3062
3123
|
|
|
3063
|
-
// src/utils/anymals/useAddAnymalToDatabase.ts
|
|
3064
|
-
var import_react12 = require("react");
|
|
3065
|
-
function useAddAnymalToDatabase() {
|
|
3066
|
-
return (0, import_react12.useCallback)(
|
|
3067
|
-
async (dbAuthToken, endpoint, anymalData) => {
|
|
3068
|
-
if (!dbAuthToken) {
|
|
3069
|
-
return {
|
|
3070
|
-
success: false,
|
|
3071
|
-
message: "Authentication token is missing.",
|
|
3072
|
-
_docID: null,
|
|
3073
|
-
dbCid: null
|
|
3074
|
-
};
|
|
3075
|
-
}
|
|
3076
|
-
let anymalDocID = null;
|
|
3077
|
-
let dbCid = null;
|
|
3078
|
-
try {
|
|
3079
|
-
const mutation = `
|
|
3080
|
-
mutation Create_Anymal($input: [AnymalMutationInputArg!]) {
|
|
3081
|
-
create_Anymal(input: $input) {
|
|
3082
|
-
_docID
|
|
3083
|
-
name
|
|
3084
|
-
passportID
|
|
3085
|
-
_version {
|
|
3086
|
-
cid
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
`;
|
|
3091
|
-
const response = await fetch(endpoint, {
|
|
3092
|
-
method: "POST",
|
|
3093
|
-
headers: {
|
|
3094
|
-
"Content-Type": "application/json",
|
|
3095
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
3096
|
-
},
|
|
3097
|
-
body: JSON.stringify({
|
|
3098
|
-
query: mutation,
|
|
3099
|
-
variables: { input: [anymalData] }
|
|
3100
|
-
})
|
|
3101
|
-
});
|
|
3102
|
-
if (!response.ok) {
|
|
3103
|
-
throw new Error(
|
|
3104
|
-
`Failed to create pet. HTTP status ${response.status}`
|
|
3105
|
-
);
|
|
3106
|
-
}
|
|
3107
|
-
const { data, errors } = await response.json();
|
|
3108
|
-
if (errors) {
|
|
3109
|
-
const errorMessage = JSON.stringify(errors);
|
|
3110
|
-
if (errorMessage.includes("given ID already exists")) {
|
|
3111
|
-
console.warn("Duplicate document ID detected.");
|
|
3112
|
-
anymalDocID = data?.create_Anymal[0]?._docID || null;
|
|
3113
|
-
throw new Error("Document with the given ID already exists.");
|
|
3114
|
-
}
|
|
3115
|
-
throw new Error(`GraphQL error: ${errorMessage}`);
|
|
3116
|
-
}
|
|
3117
|
-
anymalDocID = data.create_Anymal[0]._docID;
|
|
3118
|
-
dbCid = data.create_Anymal[0]._version[0].cid;
|
|
3119
|
-
return {
|
|
3120
|
-
success: true,
|
|
3121
|
-
_docID: anymalDocID,
|
|
3122
|
-
dbCid,
|
|
3123
|
-
message: "Anymal added to account"
|
|
3124
|
-
};
|
|
3125
|
-
} catch (error) {
|
|
3126
|
-
return {
|
|
3127
|
-
success: false,
|
|
3128
|
-
_docID: null,
|
|
3129
|
-
dbCid: null,
|
|
3130
|
-
message: "Error adding anymal to account"
|
|
3131
|
-
};
|
|
3132
|
-
}
|
|
3133
|
-
},
|
|
3134
|
-
[]
|
|
3135
|
-
);
|
|
3136
|
-
}
|
|
3137
|
-
|
|
3138
|
-
// src/utils/anymals/useDeleteAnymalFromDatabase.ts
|
|
3139
|
-
var import_react13 = require("react");
|
|
3140
|
-
function useDeleteAnymalFromDatabase() {
|
|
3141
|
-
return (0, import_react13.useCallback)(
|
|
3142
|
-
async (dbAuthToken, endpoint, anymalDocID) => {
|
|
3143
|
-
if (!dbAuthToken || !endpoint || !anymalDocID) return;
|
|
3144
|
-
try {
|
|
3145
|
-
const mutation = `
|
|
3146
|
-
mutation Delete_Anymal($docId: [ID]) {
|
|
3147
|
-
delete_Anymal(docID: $docId) {
|
|
3148
|
-
_docID
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
`;
|
|
3152
|
-
const response = await fetch(endpoint, {
|
|
3153
|
-
method: "POST",
|
|
3154
|
-
headers: {
|
|
3155
|
-
"Content-Type": "application/json",
|
|
3156
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
3157
|
-
},
|
|
3158
|
-
body: JSON.stringify({
|
|
3159
|
-
query: mutation,
|
|
3160
|
-
variables: { docID: [anymalDocID] }
|
|
3161
|
-
})
|
|
3162
|
-
});
|
|
3163
|
-
if (!response.ok)
|
|
3164
|
-
throw new Error(
|
|
3165
|
-
`Failed to delete anymal. HTTP status ${response.status}`
|
|
3166
|
-
);
|
|
3167
|
-
const { errors } = await response.json();
|
|
3168
|
-
if (errors) throw new Error(`GraphQL error: ${JSON.stringify(errors)}`);
|
|
3169
|
-
} catch (error) {
|
|
3170
|
-
console.error("Error deleting anymal from database:", error);
|
|
3171
|
-
throw error;
|
|
3172
|
-
}
|
|
3173
|
-
},
|
|
3174
|
-
[]
|
|
3175
|
-
);
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
3124
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3179
3125
|
var import_react14 = require("react");
|
|
3180
3126
|
function useSaveAnymalMetadata() {
|
|
3181
3127
|
return (0, import_react14.useCallback)(
|
|
3182
|
-
async (userPid, anymalTxId, idToken,
|
|
3128
|
+
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3183
3129
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3184
3130
|
method: "POST",
|
|
3185
3131
|
headers: {
|
|
@@ -3187,7 +3133,6 @@ function useSaveAnymalMetadata() {
|
|
|
3187
3133
|
Authorization: "Bearer " + idToken
|
|
3188
3134
|
},
|
|
3189
3135
|
body: JSON.stringify({
|
|
3190
|
-
appPubKey: publicKey,
|
|
3191
3136
|
nftMetadataInput,
|
|
3192
3137
|
pid: userPid,
|
|
3193
3138
|
anymalTxId
|
|
@@ -3206,57 +3151,8 @@ function useSaveAnymalMetadata() {
|
|
|
3206
3151
|
);
|
|
3207
3152
|
}
|
|
3208
3153
|
|
|
3209
|
-
// src/utils/anymals/useUpdateAnymalWithNFT.ts
|
|
3210
|
-
var import_react15 = require("react");
|
|
3211
|
-
function useUpdateAnymalWithNFT() {
|
|
3212
|
-
return (0, import_react15.useCallback)(
|
|
3213
|
-
async (anymalPassportId, anymalDocId, dbAuthToken, endpoint) => {
|
|
3214
|
-
if (!dbAuthToken || !anymalPassportId || !anymalDocId || !endpoint) {
|
|
3215
|
-
return {
|
|
3216
|
-
success: false
|
|
3217
|
-
};
|
|
3218
|
-
}
|
|
3219
|
-
try {
|
|
3220
|
-
const mutation = `
|
|
3221
|
-
mutation {
|
|
3222
|
-
update_Anymal(
|
|
3223
|
-
docID: [${JSON.stringify(anymalDocId)}],
|
|
3224
|
-
input: {
|
|
3225
|
-
passportID: "${anymalPassportId}"
|
|
3226
|
-
}
|
|
3227
|
-
) {
|
|
3228
|
-
passportID
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
`;
|
|
3232
|
-
const response = await fetch(endpoint, {
|
|
3233
|
-
method: "POST",
|
|
3234
|
-
headers: {
|
|
3235
|
-
"Content-Type": "application/json",
|
|
3236
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
3237
|
-
},
|
|
3238
|
-
body: JSON.stringify({ query: mutation })
|
|
3239
|
-
});
|
|
3240
|
-
if (!response.ok) {
|
|
3241
|
-
return { success: false };
|
|
3242
|
-
}
|
|
3243
|
-
const { errors } = await response.json();
|
|
3244
|
-
if (errors) {
|
|
3245
|
-
console.log(`GQL error: ${JSON.stringify(errors)}`);
|
|
3246
|
-
return { success: false };
|
|
3247
|
-
}
|
|
3248
|
-
return { success: true };
|
|
3249
|
-
} catch (error) {
|
|
3250
|
-
console.error("Error updating Anymal with NFT ID:", error);
|
|
3251
|
-
return { success: false };
|
|
3252
|
-
}
|
|
3253
|
-
},
|
|
3254
|
-
[]
|
|
3255
|
-
);
|
|
3256
|
-
}
|
|
3257
|
-
|
|
3258
3154
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3259
|
-
var
|
|
3155
|
+
var import_react15 = require("react");
|
|
3260
3156
|
|
|
3261
3157
|
// src/helpers/UploadImageHelper.tsx
|
|
3262
3158
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3313,8 +3209,8 @@ function toBase64(file) {
|
|
|
3313
3209
|
|
|
3314
3210
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3315
3211
|
function useUploadAnymalImage() {
|
|
3316
|
-
return (0,
|
|
3317
|
-
async (imageFile, type, idToken,
|
|
3212
|
+
return (0, import_react15.useCallback)(
|
|
3213
|
+
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3318
3214
|
if (!imageFile || !idToken) {
|
|
3319
3215
|
return {
|
|
3320
3216
|
success: false,
|
|
@@ -3326,7 +3222,6 @@ function useUploadAnymalImage() {
|
|
|
3326
3222
|
try {
|
|
3327
3223
|
const base64Image = await prepareImage(imageFile);
|
|
3328
3224
|
const payload = {
|
|
3329
|
-
appPubKey: publicKey,
|
|
3330
3225
|
imageData: base64Image,
|
|
3331
3226
|
imageName: imageFile.name.split(".")[0],
|
|
3332
3227
|
petType,
|
|
@@ -3374,68 +3269,11 @@ function useUploadAnymalImage() {
|
|
|
3374
3269
|
);
|
|
3375
3270
|
}
|
|
3376
3271
|
|
|
3377
|
-
// src/utils/anymals/useFetchAnymals.ts
|
|
3378
|
-
var import_react17 = require("react");
|
|
3379
|
-
|
|
3380
|
-
// src/utils/anymals/fetchAnymals.ts
|
|
3381
|
-
async function fetchAnymals({
|
|
3382
|
-
dbAuthToken,
|
|
3383
|
-
endpoint,
|
|
3384
|
-
userPid
|
|
3385
|
-
}) {
|
|
3386
|
-
const query = `
|
|
3387
|
-
query Anymal($filter: AnymalFilterArg, $order: [AnymalOrderArg]) {
|
|
3388
|
-
Anymal(filter: $filter, order: $order) {
|
|
3389
|
-
_docID
|
|
3390
|
-
name
|
|
3391
|
-
breed
|
|
3392
|
-
passportID
|
|
3393
|
-
profileImageUrl
|
|
3394
|
-
caregiverNearId
|
|
3395
|
-
caregiverId
|
|
3396
|
-
lifestage
|
|
3397
|
-
gender
|
|
3398
|
-
petType
|
|
3399
|
-
products
|
|
3400
|
-
timeAddedUtc
|
|
3401
|
-
}
|
|
3402
|
-
}
|
|
3403
|
-
`;
|
|
3404
|
-
const variables = {
|
|
3405
|
-
filter: {
|
|
3406
|
-
caregiverId: { _eq: userPid }
|
|
3407
|
-
},
|
|
3408
|
-
order: [
|
|
3409
|
-
{
|
|
3410
|
-
timeAddedUtc: "ASC"
|
|
3411
|
-
}
|
|
3412
|
-
]
|
|
3413
|
-
};
|
|
3414
|
-
const response = await fetch(endpoint, {
|
|
3415
|
-
method: "POST",
|
|
3416
|
-
headers: {
|
|
3417
|
-
"Content-Type": "application/json",
|
|
3418
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
3419
|
-
},
|
|
3420
|
-
body: JSON.stringify({ query, variables })
|
|
3421
|
-
});
|
|
3422
|
-
if (!response.ok) {
|
|
3423
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
3424
|
-
}
|
|
3425
|
-
const data = await response.json();
|
|
3426
|
-
return data?.data?.Anymal ?? [];
|
|
3427
|
-
}
|
|
3428
|
-
|
|
3429
|
-
// src/utils/anymals/useFetchAnymals.ts
|
|
3430
|
-
function useFetchAnymals() {
|
|
3431
|
-
return (0, import_react17.useCallback)(fetchAnymals, []);
|
|
3432
|
-
}
|
|
3433
|
-
|
|
3434
3272
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3435
|
-
var
|
|
3273
|
+
var import_react16 = require("react");
|
|
3436
3274
|
|
|
3437
3275
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3438
|
-
var
|
|
3276
|
+
var import_viem6 = require("viem");
|
|
3439
3277
|
|
|
3440
3278
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3441
3279
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3495,7 +3333,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3495
3333
|
deadline,
|
|
3496
3334
|
backendSignature
|
|
3497
3335
|
];
|
|
3498
|
-
const partialPayCalldata = (0,
|
|
3336
|
+
const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
3499
3337
|
abi: MARKETPLACE_ABI,
|
|
3500
3338
|
functionName,
|
|
3501
3339
|
args
|
|
@@ -3532,7 +3370,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3532
3370
|
|
|
3533
3371
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3534
3372
|
function useProcessPartialKibblePayment() {
|
|
3535
|
-
return (0,
|
|
3373
|
+
return (0, import_react16.useCallback)(
|
|
3536
3374
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3537
3375
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3538
3376
|
return {
|
|
@@ -3588,23 +3426,23 @@ function useProcessPartialKibblePayment() {
|
|
|
3588
3426
|
}
|
|
3589
3427
|
|
|
3590
3428
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3591
|
-
var
|
|
3429
|
+
var import_react17 = require("react");
|
|
3592
3430
|
|
|
3593
3431
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3594
|
-
var
|
|
3432
|
+
var import_viem7 = require("viem");
|
|
3595
3433
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3596
3434
|
try {
|
|
3597
3435
|
const functionName = "approve";
|
|
3598
3436
|
const args = [spenderAddress, approveAmount];
|
|
3599
|
-
const approveCalldata = (0,
|
|
3600
|
-
abi:
|
|
3437
|
+
const approveCalldata = (0, import_viem7.encodeFunctionData)({
|
|
3438
|
+
abi: import_viem7.erc20Abi,
|
|
3601
3439
|
functionName,
|
|
3602
3440
|
args
|
|
3603
3441
|
});
|
|
3604
3442
|
await simulateCall(
|
|
3605
3443
|
bundlerClient.client,
|
|
3606
3444
|
kibbleTokenAddress,
|
|
3607
|
-
|
|
3445
|
+
import_viem7.erc20Abi,
|
|
3608
3446
|
functionName,
|
|
3609
3447
|
args,
|
|
3610
3448
|
smartAccount.address
|
|
@@ -3633,7 +3471,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3633
3471
|
|
|
3634
3472
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3635
3473
|
function useApproveKibbleToken() {
|
|
3636
|
-
return (0,
|
|
3474
|
+
return (0, import_react17.useCallback)(
|
|
3637
3475
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3638
3476
|
try {
|
|
3639
3477
|
const result = await processDirectKibbleApproval(
|
|
@@ -3660,10 +3498,10 @@ function useApproveKibbleToken() {
|
|
|
3660
3498
|
}
|
|
3661
3499
|
|
|
3662
3500
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3663
|
-
var
|
|
3664
|
-
var
|
|
3501
|
+
var import_react18 = require("react");
|
|
3502
|
+
var import_viem8 = require("viem");
|
|
3665
3503
|
function useCreateOrganizationBase() {
|
|
3666
|
-
return (0,
|
|
3504
|
+
return (0, import_react18.useCallback)(
|
|
3667
3505
|
/**
|
|
3668
3506
|
* Creates a new organization on-chain.
|
|
3669
3507
|
*
|
|
@@ -3685,7 +3523,7 @@ function useCreateOrganizationBase() {
|
|
|
3685
3523
|
try {
|
|
3686
3524
|
const functionName = "createOrganizationProxy";
|
|
3687
3525
|
const args = [ownerAddress, orgName, orgPid];
|
|
3688
|
-
const callData = (0,
|
|
3526
|
+
const callData = (0, import_viem8.encodeFunctionData)({
|
|
3689
3527
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3690
3528
|
functionName,
|
|
3691
3529
|
args
|
|
@@ -3723,7 +3561,7 @@ function useCreateOrganizationBase() {
|
|
|
3723
3561
|
let proxyAddress;
|
|
3724
3562
|
for (const log of txReceipt.logs) {
|
|
3725
3563
|
try {
|
|
3726
|
-
const decoded = (0,
|
|
3564
|
+
const decoded = (0, import_viem8.decodeEventLog)({
|
|
3727
3565
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3728
3566
|
data: log.data,
|
|
3729
3567
|
topics: log.topics
|
|
@@ -3759,13 +3597,13 @@ function useCreateOrganizationBase() {
|
|
|
3759
3597
|
}
|
|
3760
3598
|
|
|
3761
3599
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3762
|
-
var
|
|
3600
|
+
var import_react19 = require("react");
|
|
3763
3601
|
|
|
3764
3602
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3765
|
-
var
|
|
3603
|
+
var import_viem10 = require("viem");
|
|
3766
3604
|
|
|
3767
3605
|
// src/helpers/WaitForAllowance.tsx
|
|
3768
|
-
var
|
|
3606
|
+
var import_viem9 = require("viem");
|
|
3769
3607
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3770
3608
|
const MAX_RETRIES = 10;
|
|
3771
3609
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3774,7 +3612,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3774
3612
|
try {
|
|
3775
3613
|
const currentAllowance = await publicClient.readContract({
|
|
3776
3614
|
address: tokenAddress,
|
|
3777
|
-
abi:
|
|
3615
|
+
abi: import_viem9.erc20Abi,
|
|
3778
3616
|
functionName: "allowance",
|
|
3779
3617
|
args: [ownerAddress, spenderAddress]
|
|
3780
3618
|
});
|
|
@@ -3799,13 +3637,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3799
3637
|
if (approveAmount <= 0n) {
|
|
3800
3638
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3801
3639
|
}
|
|
3802
|
-
const approveCalldata = (0,
|
|
3803
|
-
abi:
|
|
3640
|
+
const approveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3641
|
+
abi: import_viem10.erc20Abi,
|
|
3804
3642
|
functionName: "approve",
|
|
3805
3643
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3806
3644
|
});
|
|
3807
3645
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3808
|
-
const executeApproveCalldata = (0,
|
|
3646
|
+
const executeApproveCalldata = (0, import_viem10.encodeFunctionData)({
|
|
3809
3647
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3810
3648
|
functionName: ORG_FUNCTION,
|
|
3811
3649
|
args
|
|
@@ -3857,7 +3695,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3857
3695
|
|
|
3858
3696
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3859
3697
|
function useApproveOrgPartialPayment() {
|
|
3860
|
-
return (0,
|
|
3698
|
+
return (0, import_react19.useCallback)(
|
|
3861
3699
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3862
3700
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3863
3701
|
return {
|
|
@@ -3889,13 +3727,13 @@ function useApproveOrgPartialPayment() {
|
|
|
3889
3727
|
}
|
|
3890
3728
|
|
|
3891
3729
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3892
|
-
var
|
|
3730
|
+
var import_react20 = require("react");
|
|
3893
3731
|
|
|
3894
3732
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3895
|
-
var
|
|
3733
|
+
var import_viem11 = require("viem");
|
|
3896
3734
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3897
3735
|
try {
|
|
3898
|
-
const partialPayCalldata = (0,
|
|
3736
|
+
const partialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3899
3737
|
abi: MARKETPLACE_ABI,
|
|
3900
3738
|
functionName: "partialPay",
|
|
3901
3739
|
args: [
|
|
@@ -3910,7 +3748,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3910
3748
|
]
|
|
3911
3749
|
});
|
|
3912
3750
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3913
|
-
const executePartialPayCalldata = (0,
|
|
3751
|
+
const executePartialPayCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3914
3752
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3915
3753
|
functionName: ORG_FUNCTION,
|
|
3916
3754
|
args
|
|
@@ -3947,7 +3785,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3947
3785
|
|
|
3948
3786
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3949
3787
|
function useProcessOrgPartialKibblePayment() {
|
|
3950
|
-
return (0,
|
|
3788
|
+
return (0, import_react20.useCallback)(
|
|
3951
3789
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3952
3790
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3953
3791
|
return {
|
|
@@ -3985,9 +3823,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3985
3823
|
}
|
|
3986
3824
|
|
|
3987
3825
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3988
|
-
var
|
|
3826
|
+
var import_react21 = require("react");
|
|
3989
3827
|
function useUpdateOrgWalletAddress() {
|
|
3990
|
-
return (0,
|
|
3828
|
+
return (0, import_react21.useCallback)(
|
|
3991
3829
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3992
3830
|
try {
|
|
3993
3831
|
const mutation = `
|
|
@@ -4026,15 +3864,15 @@ function useUpdateOrgWalletAddress() {
|
|
|
4026
3864
|
}
|
|
4027
3865
|
|
|
4028
3866
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
4029
|
-
var
|
|
4030
|
-
var
|
|
3867
|
+
var import_viem12 = require("viem");
|
|
3868
|
+
var import_react22 = require("react");
|
|
4031
3869
|
function useMintOrgAnymalNFT() {
|
|
4032
|
-
return (0,
|
|
3870
|
+
return (0, import_react22.useCallback)(
|
|
4033
3871
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
4034
3872
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
4035
3873
|
return {
|
|
4036
3874
|
success: false,
|
|
4037
|
-
message: "Missing authentication token OR NFT ID."
|
|
3875
|
+
message: "Mint Org NFT: Missing authentication token OR NFT ID."
|
|
4038
3876
|
};
|
|
4039
3877
|
}
|
|
4040
3878
|
const functionName = "submitMetadataByCampaignName";
|
|
@@ -4045,13 +3883,13 @@ function useMintOrgAnymalNFT() {
|
|
|
4045
3883
|
"petastic-signup-campaign-1",
|
|
4046
3884
|
anymalTxId
|
|
4047
3885
|
];
|
|
4048
|
-
const callData = (0,
|
|
3886
|
+
const callData = (0, import_viem12.encodeFunctionData)({
|
|
4049
3887
|
abi: PET_NFT_ABI,
|
|
4050
3888
|
functionName,
|
|
4051
3889
|
args
|
|
4052
3890
|
});
|
|
4053
3891
|
const executeArgs = [validationContractAddress, callData];
|
|
4054
|
-
const executeSubmitMetaCalldata = (0,
|
|
3892
|
+
const executeSubmitMetaCalldata = (0, import_viem12.encodeFunctionData)({
|
|
4055
3893
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4056
3894
|
functionName: ORG_FUNCTION,
|
|
4057
3895
|
args: executeArgs
|
|
@@ -4067,7 +3905,12 @@ function useMintOrgAnymalNFT() {
|
|
|
4067
3905
|
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
4068
3906
|
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
4069
3907
|
account: managerSmartAccount,
|
|
4070
|
-
calls: [
|
|
3908
|
+
calls: [
|
|
3909
|
+
{
|
|
3910
|
+
to: orgContractAddress,
|
|
3911
|
+
data: executeSubmitMetaCalldata
|
|
3912
|
+
}
|
|
3913
|
+
],
|
|
4071
3914
|
paymaster: true
|
|
4072
3915
|
});
|
|
4073
3916
|
await waitForReceiptWithRetries(bundlerClient, userOpHash);
|
|
@@ -4079,10 +3922,10 @@ function useMintOrgAnymalNFT() {
|
|
|
4079
3922
|
|
|
4080
3923
|
// src/helpers/NonceHelper.tsx
|
|
4081
3924
|
var import_uuid = require("uuid");
|
|
4082
|
-
var
|
|
3925
|
+
var import_viem13 = require("viem");
|
|
4083
3926
|
var generateBytes32Nonce = () => {
|
|
4084
3927
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
4085
|
-
return (0,
|
|
3928
|
+
return (0, import_viem13.padHex)(`0x${uuid3}`, { size: 32 });
|
|
4086
3929
|
};
|
|
4087
3930
|
|
|
4088
3931
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4292,9 +4135,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4292
4135
|
}
|
|
4293
4136
|
|
|
4294
4137
|
// src/utils/actions/useFetchActions.ts
|
|
4295
|
-
var
|
|
4138
|
+
var import_react23 = require("react");
|
|
4296
4139
|
function useFetchActions() {
|
|
4297
|
-
return (0,
|
|
4140
|
+
return (0, import_react23.useCallback)(
|
|
4298
4141
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4299
4142
|
const params = new URLSearchParams({ pid });
|
|
4300
4143
|
if (status) params.set("status", status);
|
|
@@ -4323,9 +4166,9 @@ function useFetchActions() {
|
|
|
4323
4166
|
}
|
|
4324
4167
|
|
|
4325
4168
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4326
|
-
var
|
|
4169
|
+
var import_react24 = require("react");
|
|
4327
4170
|
function useFetchActionDefinitions() {
|
|
4328
|
-
return (0,
|
|
4171
|
+
return (0, import_react24.useCallback)(
|
|
4329
4172
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4330
4173
|
try {
|
|
4331
4174
|
const response = await fetch(
|
|
@@ -4422,10 +4265,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4422
4265
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4423
4266
|
|
|
4424
4267
|
// src/utils/application/useCreateUserAppData.ts
|
|
4425
|
-
var
|
|
4268
|
+
var import_react25 = require("react");
|
|
4426
4269
|
var import_uuid2 = require("uuid");
|
|
4427
4270
|
function useCreateUserAppData() {
|
|
4428
|
-
return (0,
|
|
4271
|
+
return (0, import_react25.useCallback)(
|
|
4429
4272
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4430
4273
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4431
4274
|
const appValues = {
|
|
@@ -4480,10 +4323,10 @@ function useCreateUserAppData() {
|
|
|
4480
4323
|
}
|
|
4481
4324
|
|
|
4482
4325
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4483
|
-
var
|
|
4326
|
+
var import_react26 = require("react");
|
|
4484
4327
|
var import_uuid3 = require("uuid");
|
|
4485
4328
|
function useCreateOrganizationAppData() {
|
|
4486
|
-
return (0,
|
|
4329
|
+
return (0, import_react26.useCallback)(
|
|
4487
4330
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4488
4331
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4489
4332
|
const appValues = {
|
|
@@ -4537,17 +4380,17 @@ function useCreateOrganizationAppData() {
|
|
|
4537
4380
|
}
|
|
4538
4381
|
|
|
4539
4382
|
// src/utils/balance/useFetchBalance.ts
|
|
4540
|
-
var
|
|
4541
|
-
var
|
|
4383
|
+
var import_react27 = require("react");
|
|
4384
|
+
var import_viem14 = require("viem");
|
|
4542
4385
|
function useFetchBalance() {
|
|
4543
|
-
return (0,
|
|
4386
|
+
return (0, import_react27.useCallback)(
|
|
4544
4387
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4545
4388
|
try {
|
|
4546
4389
|
const balance = await publicClient.readContract({
|
|
4547
|
-
address: (0,
|
|
4548
|
-
abi:
|
|
4390
|
+
address: (0, import_viem14.getAddress)(kibbleTokenAddress),
|
|
4391
|
+
abi: import_viem14.erc20Abi,
|
|
4549
4392
|
functionName: "balanceOf",
|
|
4550
|
-
args: [(0,
|
|
4393
|
+
args: [(0, import_viem14.getAddress)(walletAddress)]
|
|
4551
4394
|
});
|
|
4552
4395
|
return Number(balance);
|
|
4553
4396
|
} catch (error) {
|
|
@@ -4559,10 +4402,10 @@ function useFetchBalance() {
|
|
|
4559
4402
|
}
|
|
4560
4403
|
|
|
4561
4404
|
// src/utils/actions/useClaimActionReward.ts
|
|
4562
|
-
var
|
|
4563
|
-
var
|
|
4405
|
+
var import_viem15 = require("viem");
|
|
4406
|
+
var import_react28 = require("react");
|
|
4564
4407
|
function useClaimActionReward() {
|
|
4565
|
-
return (0,
|
|
4408
|
+
return (0, import_react28.useCallback)(
|
|
4566
4409
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4567
4410
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4568
4411
|
return {
|
|
@@ -4572,7 +4415,7 @@ function useClaimActionReward() {
|
|
|
4572
4415
|
}
|
|
4573
4416
|
const args = [actionId, claimIndex];
|
|
4574
4417
|
const functionName = "claimByIndex";
|
|
4575
|
-
const callData = (0,
|
|
4418
|
+
const callData = (0, import_viem15.encodeFunctionData)({
|
|
4576
4419
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4577
4420
|
functionName,
|
|
4578
4421
|
args
|
|
@@ -4608,10 +4451,10 @@ function useClaimActionReward() {
|
|
|
4608
4451
|
}
|
|
4609
4452
|
|
|
4610
4453
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4611
|
-
var
|
|
4612
|
-
var
|
|
4454
|
+
var import_viem16 = require("viem");
|
|
4455
|
+
var import_react29 = require("react");
|
|
4613
4456
|
function useClaimOrgActionReward() {
|
|
4614
|
-
return (0,
|
|
4457
|
+
return (0, import_react29.useCallback)(
|
|
4615
4458
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4616
4459
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4617
4460
|
return {
|
|
@@ -4619,13 +4462,13 @@ function useClaimOrgActionReward() {
|
|
|
4619
4462
|
message: "Missing web3auth account info or contract address."
|
|
4620
4463
|
};
|
|
4621
4464
|
}
|
|
4622
|
-
const claimCallData = (0,
|
|
4465
|
+
const claimCallData = (0, import_viem16.encodeFunctionData)({
|
|
4623
4466
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4624
4467
|
functionName: "claimByIndex",
|
|
4625
4468
|
args: [actionId, claimIndex]
|
|
4626
4469
|
});
|
|
4627
4470
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4628
|
-
const executeClaimCalldata = (0,
|
|
4471
|
+
const executeClaimCalldata = (0, import_viem16.encodeFunctionData)({
|
|
4629
4472
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4630
4473
|
functionName: ORG_FUNCTION,
|
|
4631
4474
|
args
|
|
@@ -4661,9 +4504,9 @@ function useClaimOrgActionReward() {
|
|
|
4661
4504
|
}
|
|
4662
4505
|
|
|
4663
4506
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4664
|
-
var
|
|
4507
|
+
var import_react30 = require("react");
|
|
4665
4508
|
function useSubmitContractAction() {
|
|
4666
|
-
return (0,
|
|
4509
|
+
return (0, import_react30.useCallback)(
|
|
4667
4510
|
(idToken, pid, source, endpoint, payload) => {
|
|
4668
4511
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4669
4512
|
let sourceTypePayload = {};
|
|
@@ -4803,7 +4646,6 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4803
4646
|
convertToMultipleActionRecords,
|
|
4804
4647
|
createApp,
|
|
4805
4648
|
createAuthEnvelope,
|
|
4806
|
-
fetchAnymals,
|
|
4807
4649
|
flattenFirestoreData,
|
|
4808
4650
|
generateAppSignature,
|
|
4809
4651
|
generateBytes32Nonce,
|
|
@@ -4818,19 +4660,18 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4818
4660
|
sendUserOpWithRetries,
|
|
4819
4661
|
serializePublicKeyCompressed,
|
|
4820
4662
|
submitAction,
|
|
4821
|
-
useAddAnymalToDatabase,
|
|
4822
4663
|
useApproveKibbleToken,
|
|
4823
4664
|
useApproveOrgPartialPayment,
|
|
4824
4665
|
useClaimActionReward,
|
|
4825
4666
|
useClaimOrgActionReward,
|
|
4667
|
+
useCoinbaseClaimActionReward,
|
|
4668
|
+
useCoinbaseMintAnymalNFT,
|
|
4826
4669
|
useCreateOrganizationAppData,
|
|
4827
4670
|
useCreateOrganizationBase,
|
|
4828
4671
|
useCreateUserAppData,
|
|
4829
4672
|
useCreateWeb3Account,
|
|
4830
|
-
useDeleteAnymalFromDatabase,
|
|
4831
4673
|
useFetchActionDefinitions,
|
|
4832
4674
|
useFetchActions,
|
|
4833
|
-
useFetchAnymals,
|
|
4834
4675
|
useFetchBalance,
|
|
4835
4676
|
useFetchNotifications,
|
|
4836
4677
|
useFetchUserData,
|
|
@@ -4841,7 +4682,6 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4841
4682
|
useSaveAnymalMetadata,
|
|
4842
4683
|
useSendCoinbaseUserOperation,
|
|
4843
4684
|
useSubmitContractAction,
|
|
4844
|
-
useUpdateAnymalWithNFT,
|
|
4845
4685
|
useUpdateOrgWalletAddress,
|
|
4846
4686
|
useUpdateUserAsVerified,
|
|
4847
4687
|
useUpdateUserEmail,
|