anymal-protocol 1.0.90 → 1.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +505 -533
- package/dist/index.mjs +508 -536
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,26 +74,370 @@ module.exports = __toCommonJS(index_exports);
|
|
|
74
74
|
|
|
75
75
|
// src/utils/account/useVerifyAccount.ts
|
|
76
76
|
var import_react = require("react");
|
|
77
|
+
function useVerifyAccount() {
|
|
78
|
+
return (0, import_react.useCallback)(
|
|
79
|
+
async (pid, campaignId, dbAuthToken, bundlerClient, smartAccount, accountRewardsContractAddress) => {
|
|
80
|
+
if (!dbAuthToken || !bundlerClient || !smartAccount || !accountRewardsContractAddress || !pid) {
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
message: "Missing crucial information"
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
console.log(campaignId);
|
|
88
|
+
return { success: true, message: "Registration kibble awarded" };
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error(error);
|
|
91
|
+
return { success: false, message: error.message };
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[]
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/utils/account/useVerifyWeb3AuthSession.ts
|
|
99
|
+
var import_react2 = require("react");
|
|
100
|
+
function useVerifyWeb3AuthSession() {
|
|
101
|
+
return (0, import_react2.useCallback)(
|
|
102
|
+
async (idToken, publicKey, authServiceBaseUrl) => {
|
|
103
|
+
const response = await fetch(
|
|
104
|
+
`${authServiceBaseUrl}/verify-web3-session`,
|
|
105
|
+
{
|
|
106
|
+
method: "POST",
|
|
107
|
+
headers: {
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Authorization: "Bearer " + idToken
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify({ appPubKey: publicKey })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const { jwt } = await response.json();
|
|
115
|
+
return jwt;
|
|
116
|
+
},
|
|
117
|
+
[]
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// src/utils/account/useCreateWeb3Account.ts
|
|
122
|
+
var import_react3 = require("react");
|
|
123
|
+
function useCreateWeb3Account() {
|
|
124
|
+
return (0, import_react3.useCallback)(
|
|
125
|
+
async (idToken, publicKey, userPid, authServiceBaseUrl) => {
|
|
126
|
+
try {
|
|
127
|
+
const response = await fetch(`${authServiceBaseUrl}/create-account`, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: {
|
|
130
|
+
"Content-Type": "application/json",
|
|
131
|
+
Authorization: "Bearer " + idToken
|
|
132
|
+
},
|
|
133
|
+
body: JSON.stringify({ appPubKey: publicKey, pid: userPid })
|
|
134
|
+
});
|
|
135
|
+
return await response.json();
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error(error);
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
[]
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/utils/account/useFetchUserData.ts
|
|
146
|
+
var import_react4 = require("react");
|
|
147
|
+
function useFetchUserData() {
|
|
148
|
+
return (0, import_react4.useCallback)(async (dbAuthToken, endpoint) => {
|
|
149
|
+
try {
|
|
150
|
+
const query = `
|
|
151
|
+
query User {
|
|
152
|
+
User {
|
|
153
|
+
_docID
|
|
154
|
+
pid
|
|
155
|
+
email
|
|
156
|
+
name
|
|
157
|
+
isVerified
|
|
158
|
+
showTooltips
|
|
159
|
+
accountType
|
|
160
|
+
baseWalletAddress
|
|
161
|
+
stripeCustomerId
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
const response = await fetch(endpoint, {
|
|
166
|
+
method: "POST",
|
|
167
|
+
headers: {
|
|
168
|
+
"Content-Type": "application/json",
|
|
169
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
170
|
+
},
|
|
171
|
+
body: JSON.stringify({ query })
|
|
172
|
+
});
|
|
173
|
+
if (!response.ok) {
|
|
174
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
175
|
+
}
|
|
176
|
+
const data = await response.json();
|
|
177
|
+
if (data && data.data && data.data.User && data.data.User.length > 0) {
|
|
178
|
+
return data.data.User[0];
|
|
179
|
+
} else {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error("Error fetching user data:", error);
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}, []);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/utils/account/useUpdateUserEmail.ts
|
|
190
|
+
var import_react5 = require("react");
|
|
191
|
+
function useUpdateUserEmail() {
|
|
192
|
+
return (0, import_react5.useCallback)(
|
|
193
|
+
async (dbAuthToken, docID, email, endpoint) => {
|
|
194
|
+
try {
|
|
195
|
+
const mutation = `
|
|
196
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
197
|
+
update_User(docID: $docID, input: $input) {
|
|
198
|
+
email
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
const variables = {
|
|
203
|
+
docID: [docID],
|
|
204
|
+
input: {
|
|
205
|
+
email
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const response = await fetch(endpoint, {
|
|
209
|
+
method: "POST",
|
|
210
|
+
headers: {
|
|
211
|
+
"Content-Type": "application/json",
|
|
212
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
213
|
+
},
|
|
214
|
+
body: JSON.stringify({
|
|
215
|
+
query: mutation,
|
|
216
|
+
variables
|
|
217
|
+
})
|
|
218
|
+
});
|
|
219
|
+
if (!response.ok) {
|
|
220
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
221
|
+
}
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.error("Error updating email:", error);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
[]
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/utils/account/useUpdateUserPid.ts
|
|
231
|
+
var import_react6 = require("react");
|
|
232
|
+
function useUpdateUserPid() {
|
|
233
|
+
return (0, import_react6.useCallback)(
|
|
234
|
+
async (dbAuthToken, docID, pid, endpoint) => {
|
|
235
|
+
try {
|
|
236
|
+
const mutation = `
|
|
237
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
238
|
+
update_User(docID: $docID, input: $input) {
|
|
239
|
+
pid
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
`;
|
|
243
|
+
const variables = {
|
|
244
|
+
docID: [docID],
|
|
245
|
+
input: {
|
|
246
|
+
pid
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const response = await fetch(endpoint, {
|
|
250
|
+
method: "POST",
|
|
251
|
+
headers: {
|
|
252
|
+
"Content-Type": "application/json",
|
|
253
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
254
|
+
},
|
|
255
|
+
body: JSON.stringify({
|
|
256
|
+
query: mutation,
|
|
257
|
+
variables
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
if (!response.ok) {
|
|
261
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
262
|
+
}
|
|
263
|
+
} catch (error) {
|
|
264
|
+
console.error("Error updating email:", error);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
[]
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// src/utils/account/useUpdateUserAsVerified.ts
|
|
272
|
+
var import_react7 = require("react");
|
|
273
|
+
function useUpdateUserAsVerified() {
|
|
274
|
+
return (0, import_react7.useCallback)(
|
|
275
|
+
async (recaptchaToken, docID, dbAuthToken, endpoint) => {
|
|
276
|
+
if (!docID || !dbAuthToken || recaptchaToken === null) return;
|
|
277
|
+
try {
|
|
278
|
+
const mutation = `
|
|
279
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
280
|
+
update_User(docID: $docID, input: $input) {
|
|
281
|
+
isVerified
|
|
282
|
+
_version {
|
|
283
|
+
cid
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
`;
|
|
288
|
+
const variables = {
|
|
289
|
+
docID: [docID],
|
|
290
|
+
input: {
|
|
291
|
+
isVerified: true
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const response = await fetch(endpoint, {
|
|
295
|
+
method: "POST",
|
|
296
|
+
headers: {
|
|
297
|
+
"Content-Type": "application/json",
|
|
298
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
299
|
+
},
|
|
300
|
+
body: JSON.stringify({
|
|
301
|
+
query: mutation,
|
|
302
|
+
variables
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
|
+
const { data, errors } = await response.json();
|
|
306
|
+
if (errors) {
|
|
307
|
+
return { success: false, message: "Error occurred", dbCid: null };
|
|
308
|
+
}
|
|
309
|
+
const dbCid = data.update_User[0]._version[0].cid;
|
|
310
|
+
return { success: true, message: "Account verified", dbCid };
|
|
311
|
+
} catch (error) {
|
|
312
|
+
return { success: false, message: error.message };
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
[]
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/utils/account/useUpdateUserName.ts
|
|
320
|
+
var import_react8 = require("react");
|
|
321
|
+
function useUpdateUserName() {
|
|
322
|
+
return (0, import_react8.useCallback)(
|
|
323
|
+
async (dbAuthToken, docID, name, endpoint) => {
|
|
324
|
+
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
325
|
+
return { success: false };
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
const mutation = `
|
|
329
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
330
|
+
update_User(docID: $docID, input: $input) {
|
|
331
|
+
name
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
`;
|
|
335
|
+
const variables = {
|
|
336
|
+
docID: [docID],
|
|
337
|
+
input: {
|
|
338
|
+
name
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const response = await fetch(endpoint, {
|
|
342
|
+
method: "POST",
|
|
343
|
+
headers: {
|
|
344
|
+
"Content-Type": "application/json",
|
|
345
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
346
|
+
},
|
|
347
|
+
body: JSON.stringify({
|
|
348
|
+
query: mutation,
|
|
349
|
+
variables
|
|
350
|
+
})
|
|
351
|
+
});
|
|
352
|
+
if (!response.ok) {
|
|
353
|
+
return { success: false };
|
|
354
|
+
}
|
|
355
|
+
return { success: true };
|
|
356
|
+
} catch (error) {
|
|
357
|
+
console.error("Error updating name:", error);
|
|
358
|
+
return { success: false };
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
[]
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// src/utils/account/useFetchNotifications.ts
|
|
366
|
+
var import_react9 = require("react");
|
|
367
|
+
function useFetchNotifications() {
|
|
368
|
+
return (0, import_react9.useCallback)(
|
|
369
|
+
async (pid, dbAuthToken, endpoint, additionalFilters) => {
|
|
370
|
+
if (!pid) {
|
|
371
|
+
throw new Error("The 'pid' field is required.");
|
|
372
|
+
}
|
|
373
|
+
try {
|
|
374
|
+
const query = `
|
|
375
|
+
query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg, $order: [AnymalNotificationOrderArg]) {
|
|
376
|
+
AnymalNotification(groupBy: $groupBy, filter: $filter, order: $order) {
|
|
377
|
+
anymalTxId
|
|
378
|
+
title
|
|
379
|
+
_group {
|
|
380
|
+
_docID
|
|
381
|
+
source
|
|
382
|
+
action
|
|
383
|
+
anymalTxId
|
|
384
|
+
id
|
|
385
|
+
pid
|
|
386
|
+
read
|
|
387
|
+
tags
|
|
388
|
+
text
|
|
389
|
+
title
|
|
390
|
+
timeAddedUtc
|
|
391
|
+
timeUpdatedUtc
|
|
392
|
+
type
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
`;
|
|
397
|
+
const filter = {
|
|
398
|
+
pid: {
|
|
399
|
+
_eq: pid
|
|
400
|
+
},
|
|
401
|
+
...additionalFilters || {}
|
|
402
|
+
};
|
|
403
|
+
const order = [
|
|
404
|
+
{
|
|
405
|
+
timeAddedUtc: "DESC"
|
|
406
|
+
}
|
|
407
|
+
];
|
|
408
|
+
const groupBy = ["anymalTxId", "title"];
|
|
409
|
+
const variables = { filter, groupBy, order };
|
|
410
|
+
const response = await fetch(endpoint, {
|
|
411
|
+
method: "POST",
|
|
412
|
+
headers: {
|
|
413
|
+
"Content-Type": "application/json",
|
|
414
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
415
|
+
},
|
|
416
|
+
body: JSON.stringify({ query, variables })
|
|
417
|
+
});
|
|
418
|
+
if (!response.ok) {
|
|
419
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
420
|
+
}
|
|
421
|
+
const data = await response.json();
|
|
422
|
+
if (data?.data?.AnymalNotification?.length > 0) {
|
|
423
|
+
return data.data.AnymalNotification;
|
|
424
|
+
} else {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
} catch (error) {
|
|
428
|
+
console.error("Error fetching notifications:", error);
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
[]
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
77
437
|
var import_viem = require("viem");
|
|
78
438
|
|
|
79
439
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
80
440
|
var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "AccessControlBadConfirmation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "bytes32", "name": "neededRole", "type": "bytes32" }], "name": "AccessControlUnauthorizedAccount", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "EnforcedPause", "type": "error" }, { "inputs": [], "name": "ExpectedPause", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataApproved", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "anymalTxId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataRejected", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "string", "name": "metadataURL", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "MetadataSubmitted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Paused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "nftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "campaignId", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "RewardDistributed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" }], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleRevoked", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], "name": "Unpaused", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "APPROVER_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }, { "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "approveMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "campaignCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "campaigns", "outputs": [{ "internalType": "string", "name": "name", "type": "string" }, { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "isActive", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_name", "type": "string" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "createCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "defaultRewardAmount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], "name": "getRoleAdmin", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "hasRole", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "contract IERC20", "name": "_rewardToken", "type": "address" }, { "internalType": "contract IPetToken", "name": "_petToken", "type": "address" }, { "internalType": "uint256", "name": "_defaultRewardAmount", "type": "uint256" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "paused", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "petToken", "outputs": [{ "internalType": "contract IPetToken", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "callerConfirmation", "type": "address" }], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "rewardToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadata", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "_pid", "type": "string" }, { "internalType": "string", "name": "_nftId", "type": "string" }, { "internalType": "string", "name": "_metadataURL", "type": "string" }, { "internalType": "string", "name": "_campaignName", "type": "string" }, { "internalType": "string", "name": "_anymalTxId", "type": "string" }], "name": "submitMetadataByCampaignName", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], "name": "supportsInterface", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_campaignId", "type": "uint256" }, { "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }, { "internalType": "bool", "name": "_isActive", "type": "bool" }], "name": "updateCampaign", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_rewardAmount", "type": "uint256" }], "name": "updateDefaultReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
|
|
81
|
-
var VERIFY_ACCOUNT_ABI = [
|
|
82
|
-
{
|
|
83
|
-
inputs: [
|
|
84
|
-
{
|
|
85
|
-
internalType: "string",
|
|
86
|
-
name: "_campaignName",
|
|
87
|
-
type: "string"
|
|
88
|
-
},
|
|
89
|
-
{ internalType: "string", name: "_pid", type: "string" }
|
|
90
|
-
],
|
|
91
|
-
name: "claimRewardByName",
|
|
92
|
-
outputs: [],
|
|
93
|
-
stateMutability: "nonpayable",
|
|
94
|
-
type: "function"
|
|
95
|
-
}
|
|
96
|
-
];
|
|
97
441
|
var MARKETPLACE_ABI = [{ "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "anymalNftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PartialPaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "refundedAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "RefundProcessed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "SignatureCheckToggled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "authorizer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_authorizer", "type": "address" }, { "internalType": "address", "name": "_kibbleToken", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "kibbleToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" }], "name": "paidAmounts", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "string", "name": "anymalNftId", "type": "string" }, { "internalType": "string", "name": "pid", "type": "string" }, { "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "internalType": "uint256", "name": "maxTokenPayment", "type": "uint256" }, { "internalType": "bytes32", "name": "nonce", "type": "bytes32" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bytes", "name": "backendSignature", "type": "bytes" }], "name": "partialPay", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "address", "name": "payer", "type": "address" }, { "internalType": "string", "name": "pid", "type": "string" }], "name": "refund", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_authorizer", "type": "address" }], "name": "setAuthorizer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "setSignatureCheckEnabled", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "signatureCheckEnabled", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "usedNonces", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawKibble", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
|
|
98
442
|
var ORGANIZATION_BEACON_ABI = [{ "inputs": [{ "internalType": "address", "name": "_initialImplementation", "type": "address" }, { "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_anymalNFTProxy", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "BeaconInvalidImplementation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "string", "name": "pid", "type": "string" }, { "indexed": false, "internalType": "string", "name": "name", "type": "string" }, { "indexed": false, "internalType": "address", "name": "proxyAddress", "type": "address" }, { "indexed": false, "internalType": "address", "name": "networkAdmin", "type": "address" }, { "indexed": false, "internalType": "address", "name": "userAdmin", "type": "address" }], "name": "NewOrganizationCreated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "anymalNFTProxy", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_userAdmin", "type": "address" }, { "internalType": "string", "name": "_orgName", "type": "string" }, { "internalType": "string", "name": "_orgPid", "type": "string" }], "name": "createOrganizationProxy", "outputs": [{ "internalType": "address", "name": "proxyAddress", "type": "address" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "implementation", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }], "name": "upgradeBeaconTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }], "name": "upgradeTo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
|
|
99
443
|
var REWARDABLE_ACTIONS_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "AccessControlBadConfirmation", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "bytes32", "name": "neededRole", "type": "bytes32" }], "name": "AccessControlUnauthorizedAccount", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "indexed": false, "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "maxClaims", "type": "uint256" }], "name": "ActionTypeAdded", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "indexed": false, "internalType": "uint256", "name": "newRewardAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "newMaxClaims", "type": "uint256" }], "name": "ActionTypeUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "index", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "quantity", "type": "uint256" }, { "indexed": false, "internalType": "uint16", "name": "multiplier", "type": "uint16" }], "name": "ActionValidated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, { "indexed": true, "internalType": "uint256", "name": "index", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "RewardClaimedByIndex", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" }, { "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" }], "name": "RoleAdminChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleGranted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "account", "type": "address" }, { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }], "name": "RoleRevoked", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "ADMIN_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "APPROVER_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DEFAULT_ADMIN_ROLE", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "actionConfigs", "outputs": [{ "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "internalType": "uint256", "name": "maxClaims", "type": "uint256" }, { "internalType": "bool", "name": "exists", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, { "internalType": "uint256", "name": "maxClaims", "type": "uint256" }], "name": "addActionType", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "internalType": "uint256", "name": "index", "type": "uint256" }], "name": "claimByIndex", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "depositRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }], "name": "getRoleAdmin", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "grantRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "hasRole", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "contract IERC20", "name": "_rewardToken", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "callerConfirmation", "type": "address" }], "name": "renounceRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }, { "internalType": "address", "name": "account", "type": "address" }], "name": "revokeRole", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "rewardToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }], "name": "supportsInterface", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "bytes32", "name": "actionId", "type": "bytes32" }], "name": "totalValidatedSlots", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "bytes32", "name": "actionId", "type": "bytes32" }], "name": "unclaimedSlots", "outputs": [{ "internalType": "uint256", "name": "count", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "internalType": "uint256", "name": "newRewardAmount", "type": "uint256" }, { "internalType": "uint256", "name": "newMaxClaims", "type": "uint256" }], "name": "updateActionType", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "user", "type": "address" }, { "internalType": "bytes32", "name": "actionId", "type": "bytes32" }, { "internalType": "uint256", "name": "quantity", "type": "uint256" }, { "internalType": "uint16", "name": "multiplier", "type": "uint16" }], "name": "validateAction", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "name": "validations", "outputs": [{ "internalType": "uint256", "name": "quantity", "type": "uint256" }, { "internalType": "uint16", "name": "multiplier", "type": "uint16" }, { "internalType": "bool", "name": "claimed", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
|
|
@@ -759,123 +1103,47 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
759
1103
|
"inputs": [
|
|
760
1104
|
{
|
|
761
1105
|
"internalType": "address",
|
|
762
|
-
"name": "manager",
|
|
763
|
-
"type": "address"
|
|
764
|
-
}
|
|
765
|
-
],
|
|
766
|
-
"name": "removeManager",
|
|
767
|
-
"outputs": [],
|
|
768
|
-
"stateMutability": "nonpayable",
|
|
769
|
-
"type": "function"
|
|
770
|
-
},
|
|
771
|
-
{
|
|
772
|
-
"inputs": [
|
|
773
|
-
{
|
|
774
|
-
"internalType": "bytes32",
|
|
775
|
-
"name": "role",
|
|
776
|
-
"type": "bytes32"
|
|
777
|
-
},
|
|
778
|
-
{
|
|
779
|
-
"internalType": "address",
|
|
780
|
-
"name": "callerConfirmation",
|
|
781
|
-
"type": "address"
|
|
782
|
-
}
|
|
783
|
-
],
|
|
784
|
-
"name": "renounceRole",
|
|
785
|
-
"outputs": [],
|
|
786
|
-
"stateMutability": "nonpayable",
|
|
787
|
-
"type": "function"
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
"inputs": [
|
|
791
|
-
{
|
|
792
|
-
"internalType": "bytes32",
|
|
793
|
-
"name": "role",
|
|
794
|
-
"type": "bytes32"
|
|
795
|
-
},
|
|
796
|
-
{
|
|
797
|
-
"internalType": "address",
|
|
798
|
-
"name": "account",
|
|
799
|
-
"type": "address"
|
|
800
|
-
}
|
|
801
|
-
],
|
|
802
|
-
"name": "revokeRole",
|
|
803
|
-
"outputs": [],
|
|
804
|
-
"stateMutability": "nonpayable",
|
|
805
|
-
"type": "function"
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
"inputs": [
|
|
809
|
-
{
|
|
810
|
-
"internalType": "address",
|
|
811
|
-
"name": "_anymalNFTProxy",
|
|
812
|
-
"type": "address"
|
|
813
|
-
}
|
|
814
|
-
],
|
|
815
|
-
"name": "setAnymalNFT",
|
|
816
|
-
"outputs": [],
|
|
817
|
-
"stateMutability": "nonpayable",
|
|
818
|
-
"type": "function"
|
|
819
|
-
},
|
|
820
|
-
{
|
|
821
|
-
"inputs": [
|
|
822
|
-
{
|
|
823
|
-
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
824
|
-
"name": "newStatus",
|
|
825
|
-
"type": "uint8"
|
|
826
|
-
}
|
|
827
|
-
],
|
|
828
|
-
"name": "setStatus",
|
|
829
|
-
"outputs": [],
|
|
830
|
-
"stateMutability": "nonpayable",
|
|
831
|
-
"type": "function"
|
|
832
|
-
},
|
|
833
|
-
{
|
|
834
|
-
"inputs": [],
|
|
835
|
-
"name": "status",
|
|
836
|
-
"outputs": [
|
|
837
|
-
{
|
|
838
|
-
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
839
|
-
"name": "",
|
|
840
|
-
"type": "uint8"
|
|
841
|
-
}
|
|
842
|
-
],
|
|
843
|
-
"stateMutability": "view",
|
|
844
|
-
"type": "function"
|
|
845
|
-
},
|
|
846
|
-
{
|
|
847
|
-
"inputs": [
|
|
848
|
-
{
|
|
849
|
-
"internalType": "bytes4",
|
|
850
|
-
"name": "interfaceId",
|
|
851
|
-
"type": "bytes4"
|
|
852
|
-
}
|
|
853
|
-
],
|
|
854
|
-
"name": "supportsInterface",
|
|
855
|
-
"outputs": [
|
|
856
|
-
{
|
|
857
|
-
"internalType": "bool",
|
|
858
|
-
"name": "",
|
|
859
|
-
"type": "bool"
|
|
1106
|
+
"name": "manager",
|
|
1107
|
+
"type": "address"
|
|
860
1108
|
}
|
|
861
1109
|
],
|
|
862
|
-
"
|
|
1110
|
+
"name": "removeManager",
|
|
1111
|
+
"outputs": [],
|
|
1112
|
+
"stateMutability": "nonpayable",
|
|
863
1113
|
"type": "function"
|
|
864
1114
|
},
|
|
865
1115
|
{
|
|
866
1116
|
"inputs": [
|
|
1117
|
+
{
|
|
1118
|
+
"internalType": "bytes32",
|
|
1119
|
+
"name": "role",
|
|
1120
|
+
"type": "bytes32"
|
|
1121
|
+
},
|
|
867
1122
|
{
|
|
868
1123
|
"internalType": "address",
|
|
869
|
-
"name": "
|
|
1124
|
+
"name": "callerConfirmation",
|
|
870
1125
|
"type": "address"
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"name": "renounceRole",
|
|
1129
|
+
"outputs": [],
|
|
1130
|
+
"stateMutability": "nonpayable",
|
|
1131
|
+
"type": "function"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
"inputs": [
|
|
1135
|
+
{
|
|
1136
|
+
"internalType": "bytes32",
|
|
1137
|
+
"name": "role",
|
|
1138
|
+
"type": "bytes32"
|
|
871
1139
|
},
|
|
872
1140
|
{
|
|
873
|
-
"internalType": "
|
|
874
|
-
"name": "
|
|
875
|
-
"type": "
|
|
1141
|
+
"internalType": "address",
|
|
1142
|
+
"name": "account",
|
|
1143
|
+
"type": "address"
|
|
876
1144
|
}
|
|
877
1145
|
],
|
|
878
|
-
"name": "
|
|
1146
|
+
"name": "revokeRole",
|
|
879
1147
|
"outputs": [],
|
|
880
1148
|
"stateMutability": "nonpayable",
|
|
881
1149
|
"type": "function"
|
|
@@ -883,12 +1151,12 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
883
1151
|
{
|
|
884
1152
|
"inputs": [
|
|
885
1153
|
{
|
|
886
|
-
"internalType": "
|
|
887
|
-
"name": "
|
|
888
|
-
"type": "
|
|
1154
|
+
"internalType": "address",
|
|
1155
|
+
"name": "_anymalNFTProxy",
|
|
1156
|
+
"type": "address"
|
|
889
1157
|
}
|
|
890
1158
|
],
|
|
891
|
-
"name": "
|
|
1159
|
+
"name": "setAnymalNFT",
|
|
892
1160
|
"outputs": [],
|
|
893
1161
|
"stateMutability": "nonpayable",
|
|
894
1162
|
"type": "function"
|
|
@@ -896,392 +1164,95 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
896
1164
|
{
|
|
897
1165
|
"inputs": [
|
|
898
1166
|
{
|
|
899
|
-
"internalType": "
|
|
900
|
-
"name": "
|
|
901
|
-
"type": "
|
|
1167
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1168
|
+
"name": "newStatus",
|
|
1169
|
+
"type": "uint8"
|
|
902
1170
|
}
|
|
903
1171
|
],
|
|
904
|
-
"name": "
|
|
1172
|
+
"name": "setStatus",
|
|
905
1173
|
"outputs": [],
|
|
906
1174
|
"stateMutability": "nonpayable",
|
|
907
1175
|
"type": "function"
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
success: false,
|
|
918
|
-
message: "Missing crucial information"
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
const callData = (0, import_viem.encodeFunctionData)({
|
|
922
|
-
abi: VERIFY_ACCOUNT_ABI,
|
|
923
|
-
functionName: "claimRewardByName",
|
|
924
|
-
args: [campaignId, pid]
|
|
925
|
-
});
|
|
926
|
-
try {
|
|
927
|
-
const userOpHash = await bundlerClient.sendUserOperation({
|
|
928
|
-
account: smartAccount,
|
|
929
|
-
calls: [
|
|
930
|
-
{
|
|
931
|
-
to: accountRewardsContractAddress,
|
|
932
|
-
data: callData
|
|
933
|
-
}
|
|
934
|
-
],
|
|
935
|
-
maxPriorityFeePerGas: (0, import_viem.parseGwei)("0.001")
|
|
936
|
-
});
|
|
937
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
938
|
-
hash: userOpHash,
|
|
939
|
-
timeout: 3e4,
|
|
940
|
-
retryCount: 10
|
|
941
|
-
});
|
|
942
|
-
return { success: true, message: "Registration kibble awarded" };
|
|
943
|
-
} catch (error) {
|
|
944
|
-
console.error(error);
|
|
945
|
-
return { success: false, message: error.message };
|
|
946
|
-
}
|
|
947
|
-
},
|
|
948
|
-
[]
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
// src/utils/account/useVerifyWeb3AuthSession.ts
|
|
953
|
-
var import_react2 = require("react");
|
|
954
|
-
function useVerifyWeb3AuthSession() {
|
|
955
|
-
return (0, import_react2.useCallback)(
|
|
956
|
-
async (idToken, publicKey, authServiceBaseUrl) => {
|
|
957
|
-
const response = await fetch(
|
|
958
|
-
`${authServiceBaseUrl}/verify-web3-session`,
|
|
959
|
-
{
|
|
960
|
-
method: "POST",
|
|
961
|
-
headers: {
|
|
962
|
-
"Content-Type": "application/json",
|
|
963
|
-
Authorization: "Bearer " + idToken
|
|
964
|
-
},
|
|
965
|
-
body: JSON.stringify({ appPubKey: publicKey })
|
|
966
|
-
}
|
|
967
|
-
);
|
|
968
|
-
const { jwt } = await response.json();
|
|
969
|
-
return jwt;
|
|
970
|
-
},
|
|
971
|
-
[]
|
|
972
|
-
);
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
// src/utils/account/useCreateWeb3Account.ts
|
|
976
|
-
var import_react3 = require("react");
|
|
977
|
-
function useCreateWeb3Account() {
|
|
978
|
-
return (0, import_react3.useCallback)(
|
|
979
|
-
async (idToken, publicKey, userPid, authServiceBaseUrl) => {
|
|
980
|
-
try {
|
|
981
|
-
const response = await fetch(`${authServiceBaseUrl}/create-account`, {
|
|
982
|
-
method: "POST",
|
|
983
|
-
headers: {
|
|
984
|
-
"Content-Type": "application/json",
|
|
985
|
-
Authorization: "Bearer " + idToken
|
|
986
|
-
},
|
|
987
|
-
body: JSON.stringify({ appPubKey: publicKey, pid: userPid })
|
|
988
|
-
});
|
|
989
|
-
return await response.json();
|
|
990
|
-
} catch (error) {
|
|
991
|
-
console.error(error);
|
|
992
|
-
return null;
|
|
993
|
-
}
|
|
994
|
-
},
|
|
995
|
-
[]
|
|
996
|
-
);
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
// src/utils/account/useFetchUserData.ts
|
|
1000
|
-
var import_react4 = require("react");
|
|
1001
|
-
function useFetchUserData() {
|
|
1002
|
-
return (0, import_react4.useCallback)(async (dbAuthToken, endpoint) => {
|
|
1003
|
-
try {
|
|
1004
|
-
const query = `
|
|
1005
|
-
query User {
|
|
1006
|
-
User {
|
|
1007
|
-
_docID
|
|
1008
|
-
pid
|
|
1009
|
-
email
|
|
1010
|
-
name
|
|
1011
|
-
isVerified
|
|
1012
|
-
showTooltips
|
|
1013
|
-
accountType
|
|
1014
|
-
baseWalletAddress
|
|
1015
|
-
stripeCustomerId
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
`;
|
|
1019
|
-
const response = await fetch(endpoint, {
|
|
1020
|
-
method: "POST",
|
|
1021
|
-
headers: {
|
|
1022
|
-
"Content-Type": "application/json",
|
|
1023
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1024
|
-
},
|
|
1025
|
-
body: JSON.stringify({ query })
|
|
1026
|
-
});
|
|
1027
|
-
if (!response.ok) {
|
|
1028
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1029
|
-
}
|
|
1030
|
-
const data = await response.json();
|
|
1031
|
-
if (data && data.data && data.data.User && data.data.User.length > 0) {
|
|
1032
|
-
return data.data.User[0];
|
|
1033
|
-
} else {
|
|
1034
|
-
return null;
|
|
1035
|
-
}
|
|
1036
|
-
} catch (error) {
|
|
1037
|
-
console.error("Error fetching user data:", error);
|
|
1038
|
-
return null;
|
|
1039
|
-
}
|
|
1040
|
-
}, []);
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
// src/utils/account/useUpdateUserEmail.ts
|
|
1044
|
-
var import_react5 = require("react");
|
|
1045
|
-
function useUpdateUserEmail() {
|
|
1046
|
-
return (0, import_react5.useCallback)(
|
|
1047
|
-
async (dbAuthToken, docID, email, endpoint) => {
|
|
1048
|
-
try {
|
|
1049
|
-
const mutation = `
|
|
1050
|
-
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
1051
|
-
update_User(docID: $docID, input: $input) {
|
|
1052
|
-
email
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
`;
|
|
1056
|
-
const variables = {
|
|
1057
|
-
docID: [docID],
|
|
1058
|
-
input: {
|
|
1059
|
-
email
|
|
1060
|
-
}
|
|
1061
|
-
};
|
|
1062
|
-
const response = await fetch(endpoint, {
|
|
1063
|
-
method: "POST",
|
|
1064
|
-
headers: {
|
|
1065
|
-
"Content-Type": "application/json",
|
|
1066
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1067
|
-
},
|
|
1068
|
-
body: JSON.stringify({
|
|
1069
|
-
query: mutation,
|
|
1070
|
-
variables
|
|
1071
|
-
})
|
|
1072
|
-
});
|
|
1073
|
-
if (!response.ok) {
|
|
1074
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1075
|
-
}
|
|
1076
|
-
} catch (error) {
|
|
1077
|
-
console.error("Error updating email:", error);
|
|
1078
|
-
}
|
|
1079
|
-
},
|
|
1080
|
-
[]
|
|
1081
|
-
);
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
// src/utils/account/useUpdateUserPid.ts
|
|
1085
|
-
var import_react6 = require("react");
|
|
1086
|
-
function useUpdateUserPid() {
|
|
1087
|
-
return (0, import_react6.useCallback)(
|
|
1088
|
-
async (dbAuthToken, docID, pid, endpoint) => {
|
|
1089
|
-
try {
|
|
1090
|
-
const mutation = `
|
|
1091
|
-
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
1092
|
-
update_User(docID: $docID, input: $input) {
|
|
1093
|
-
pid
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
`;
|
|
1097
|
-
const variables = {
|
|
1098
|
-
docID: [docID],
|
|
1099
|
-
input: {
|
|
1100
|
-
pid
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
const response = await fetch(endpoint, {
|
|
1104
|
-
method: "POST",
|
|
1105
|
-
headers: {
|
|
1106
|
-
"Content-Type": "application/json",
|
|
1107
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1108
|
-
},
|
|
1109
|
-
body: JSON.stringify({
|
|
1110
|
-
query: mutation,
|
|
1111
|
-
variables
|
|
1112
|
-
})
|
|
1113
|
-
});
|
|
1114
|
-
if (!response.ok) {
|
|
1115
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1116
|
-
}
|
|
1117
|
-
} catch (error) {
|
|
1118
|
-
console.error("Error updating email:", error);
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
"inputs": [],
|
|
1179
|
+
"name": "status",
|
|
1180
|
+
"outputs": [
|
|
1181
|
+
{
|
|
1182
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1183
|
+
"name": "",
|
|
1184
|
+
"type": "uint8"
|
|
1119
1185
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
if (!docID || !dbAuthToken || recaptchaToken === null) return;
|
|
1131
|
-
try {
|
|
1132
|
-
const mutation = `
|
|
1133
|
-
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
1134
|
-
update_User(docID: $docID, input: $input) {
|
|
1135
|
-
isVerified
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
`;
|
|
1139
|
-
const variables = {
|
|
1140
|
-
docID: [docID],
|
|
1141
|
-
input: {
|
|
1142
|
-
isVerified: true
|
|
1143
|
-
}
|
|
1144
|
-
};
|
|
1145
|
-
const response = await fetch(endpoint, {
|
|
1146
|
-
method: "POST",
|
|
1147
|
-
headers: {
|
|
1148
|
-
"Content-Type": "application/json",
|
|
1149
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1150
|
-
},
|
|
1151
|
-
body: JSON.stringify({
|
|
1152
|
-
query: mutation,
|
|
1153
|
-
variables
|
|
1154
|
-
})
|
|
1155
|
-
});
|
|
1156
|
-
const responseMessage = response.ok ? "Your account has been verified!" : "An error has occured, try again.";
|
|
1157
|
-
return { success: response.ok, message: responseMessage };
|
|
1158
|
-
} catch (error) {
|
|
1159
|
-
return { success: false, message: error.message };
|
|
1186
|
+
],
|
|
1187
|
+
"stateMutability": "view",
|
|
1188
|
+
"type": "function"
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
"inputs": [
|
|
1192
|
+
{
|
|
1193
|
+
"internalType": "bytes4",
|
|
1194
|
+
"name": "interfaceId",
|
|
1195
|
+
"type": "bytes4"
|
|
1160
1196
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
function useUpdateUserName() {
|
|
1169
|
-
return (0, import_react8.useCallback)(
|
|
1170
|
-
async (dbAuthToken, docID, name, endpoint) => {
|
|
1171
|
-
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
1172
|
-
return { success: false };
|
|
1197
|
+
],
|
|
1198
|
+
"name": "supportsInterface",
|
|
1199
|
+
"outputs": [
|
|
1200
|
+
{
|
|
1201
|
+
"internalType": "bool",
|
|
1202
|
+
"name": "",
|
|
1203
|
+
"type": "bool"
|
|
1173
1204
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
method: "POST",
|
|
1190
|
-
headers: {
|
|
1191
|
-
"Content-Type": "application/json",
|
|
1192
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1193
|
-
},
|
|
1194
|
-
body: JSON.stringify({
|
|
1195
|
-
query: mutation,
|
|
1196
|
-
variables
|
|
1197
|
-
})
|
|
1198
|
-
});
|
|
1199
|
-
if (!response.ok) {
|
|
1200
|
-
return { success: false };
|
|
1201
|
-
}
|
|
1202
|
-
return { success: true };
|
|
1203
|
-
} catch (error) {
|
|
1204
|
-
console.error("Error updating name:", error);
|
|
1205
|
-
return { success: false };
|
|
1205
|
+
],
|
|
1206
|
+
"stateMutability": "view",
|
|
1207
|
+
"type": "function"
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
"inputs": [
|
|
1211
|
+
{
|
|
1212
|
+
"internalType": "address",
|
|
1213
|
+
"name": "to",
|
|
1214
|
+
"type": "address"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"internalType": "uint256",
|
|
1218
|
+
"name": "tokenId",
|
|
1219
|
+
"type": "uint256"
|
|
1206
1220
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1221
|
+
],
|
|
1222
|
+
"name": "transferAnymal",
|
|
1223
|
+
"outputs": [],
|
|
1224
|
+
"stateMutability": "nonpayable",
|
|
1225
|
+
"type": "function"
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
"inputs": [
|
|
1229
|
+
{
|
|
1230
|
+
"internalType": "string",
|
|
1231
|
+
"name": "newOrgName",
|
|
1232
|
+
"type": "string"
|
|
1219
1233
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
pid
|
|
1233
|
-
read
|
|
1234
|
-
tags
|
|
1235
|
-
text
|
|
1236
|
-
title
|
|
1237
|
-
timeAddedUtc
|
|
1238
|
-
timeUpdatedUtc
|
|
1239
|
-
type
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
`;
|
|
1244
|
-
const filter = {
|
|
1245
|
-
pid: {
|
|
1246
|
-
_eq: pid
|
|
1247
|
-
},
|
|
1248
|
-
...additionalFilters || {}
|
|
1249
|
-
};
|
|
1250
|
-
const order = [
|
|
1251
|
-
{
|
|
1252
|
-
timeAddedUtc: "DESC"
|
|
1253
|
-
}
|
|
1254
|
-
];
|
|
1255
|
-
const groupBy = ["anymalTxId", "title"];
|
|
1256
|
-
const variables = { filter, groupBy, order };
|
|
1257
|
-
const response = await fetch(endpoint, {
|
|
1258
|
-
method: "POST",
|
|
1259
|
-
headers: {
|
|
1260
|
-
"Content-Type": "application/json",
|
|
1261
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1262
|
-
},
|
|
1263
|
-
body: JSON.stringify({ query, variables })
|
|
1264
|
-
});
|
|
1265
|
-
if (!response.ok) {
|
|
1266
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1267
|
-
}
|
|
1268
|
-
const data = await response.json();
|
|
1269
|
-
if (data?.data?.AnymalNotification?.length > 0) {
|
|
1270
|
-
return data.data.AnymalNotification;
|
|
1271
|
-
} else {
|
|
1272
|
-
return null;
|
|
1273
|
-
}
|
|
1274
|
-
} catch (error) {
|
|
1275
|
-
console.error("Error fetching notifications:", error);
|
|
1276
|
-
return null;
|
|
1234
|
+
],
|
|
1235
|
+
"name": "updateMetadata",
|
|
1236
|
+
"outputs": [],
|
|
1237
|
+
"stateMutability": "nonpayable",
|
|
1238
|
+
"type": "function"
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"inputs": [
|
|
1242
|
+
{
|
|
1243
|
+
"internalType": "string",
|
|
1244
|
+
"name": "pid",
|
|
1245
|
+
"type": "string"
|
|
1277
1246
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1247
|
+
],
|
|
1248
|
+
"name": "updatePid",
|
|
1249
|
+
"outputs": [],
|
|
1250
|
+
"stateMutability": "nonpayable",
|
|
1251
|
+
"type": "function"
|
|
1252
|
+
}
|
|
1253
|
+
];
|
|
1282
1254
|
|
|
1283
1255
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1284
|
-
var import_viem2 = require("viem");
|
|
1285
1256
|
var import_react10 = require("react");
|
|
1286
1257
|
function useMintAnymalNFT() {
|
|
1287
1258
|
return (0, import_react10.useCallback)(
|
|
@@ -1292,7 +1263,7 @@ function useMintAnymalNFT() {
|
|
|
1292
1263
|
message: "Missing authentication token OR NFT ID."
|
|
1293
1264
|
};
|
|
1294
1265
|
}
|
|
1295
|
-
const callData = (0,
|
|
1266
|
+
const callData = (0, import_viem.encodeFunctionData)({
|
|
1296
1267
|
abi: PET_NFT_ABI,
|
|
1297
1268
|
functionName: "submitMetadataByCampaignName",
|
|
1298
1269
|
args: [
|
|
@@ -1311,7 +1282,7 @@ function useMintAnymalNFT() {
|
|
|
1311
1282
|
data: callData
|
|
1312
1283
|
}
|
|
1313
1284
|
],
|
|
1314
|
-
maxPriorityFeePerGas: (0,
|
|
1285
|
+
maxPriorityFeePerGas: (0, import_viem.parseGwei)("0.001")
|
|
1315
1286
|
});
|
|
1316
1287
|
await bundlerClient.waitForUserOperationReceipt({
|
|
1317
1288
|
hash: userOpHash,
|
|
@@ -1689,7 +1660,7 @@ function useFetchAnymals() {
|
|
|
1689
1660
|
}
|
|
1690
1661
|
|
|
1691
1662
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
1692
|
-
var
|
|
1663
|
+
var import_viem2 = require("viem");
|
|
1693
1664
|
var import_react17 = require("react");
|
|
1694
1665
|
function useProcessPartialKibblePayment() {
|
|
1695
1666
|
return (0, import_react17.useCallback)(
|
|
@@ -1719,7 +1690,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1719
1690
|
// bytes
|
|
1720
1691
|
];
|
|
1721
1692
|
console.info({ args });
|
|
1722
|
-
const callData = (0,
|
|
1693
|
+
const callData = (0, import_viem2.encodeFunctionData)({
|
|
1723
1694
|
abi: MARKETPLACE_ABI,
|
|
1724
1695
|
functionName: "partialPay",
|
|
1725
1696
|
args
|
|
@@ -1732,7 +1703,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1732
1703
|
data: callData
|
|
1733
1704
|
}
|
|
1734
1705
|
],
|
|
1735
|
-
maxPriorityFeePerGas: (0,
|
|
1706
|
+
maxPriorityFeePerGas: (0, import_viem2.parseGwei)("0.001")
|
|
1736
1707
|
});
|
|
1737
1708
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
1738
1709
|
hash: userOpHash,
|
|
@@ -1753,14 +1724,14 @@ function useProcessPartialKibblePayment() {
|
|
|
1753
1724
|
}
|
|
1754
1725
|
|
|
1755
1726
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
1756
|
-
var
|
|
1727
|
+
var import_viem3 = require("viem");
|
|
1757
1728
|
var import_react18 = require("react");
|
|
1758
1729
|
function useApproveKibbleToken() {
|
|
1759
1730
|
return (0, import_react18.useCallback)(
|
|
1760
1731
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
1761
1732
|
try {
|
|
1762
|
-
const callData = (0,
|
|
1763
|
-
abi:
|
|
1733
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
1734
|
+
abi: import_viem3.erc20Abi,
|
|
1764
1735
|
functionName: "approve",
|
|
1765
1736
|
args: [
|
|
1766
1737
|
marketplaceContract,
|
|
@@ -1778,7 +1749,7 @@ function useApproveKibbleToken() {
|
|
|
1778
1749
|
data: callData
|
|
1779
1750
|
}
|
|
1780
1751
|
],
|
|
1781
|
-
maxPriorityFeePerGas: (0,
|
|
1752
|
+
maxPriorityFeePerGas: (0, import_viem3.parseGwei)("0.001")
|
|
1782
1753
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1783
1754
|
});
|
|
1784
1755
|
console.log("sendUserOperation has been called");
|
|
@@ -1807,7 +1778,7 @@ function useApproveKibbleToken() {
|
|
|
1807
1778
|
|
|
1808
1779
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
1809
1780
|
var import_react19 = require("react");
|
|
1810
|
-
var
|
|
1781
|
+
var import_viem4 = require("viem");
|
|
1811
1782
|
function useCreateOrganizationBase() {
|
|
1812
1783
|
return (0, import_react19.useCallback)(
|
|
1813
1784
|
/**
|
|
@@ -1829,7 +1800,7 @@ function useCreateOrganizationBase() {
|
|
|
1829
1800
|
};
|
|
1830
1801
|
}
|
|
1831
1802
|
try {
|
|
1832
|
-
const callData = (0,
|
|
1803
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
1833
1804
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1834
1805
|
functionName: "createOrganizationProxy",
|
|
1835
1806
|
args: [ownerAddress, orgName, orgPid]
|
|
@@ -1842,9 +1813,9 @@ function useCreateOrganizationBase() {
|
|
|
1842
1813
|
data: callData
|
|
1843
1814
|
}
|
|
1844
1815
|
],
|
|
1845
|
-
maxPriorityFeePerGas: (0,
|
|
1816
|
+
maxPriorityFeePerGas: (0, import_viem4.parseGwei)("0.001"),
|
|
1846
1817
|
// Low priority fee
|
|
1847
|
-
maxFeePerGas: (0,
|
|
1818
|
+
maxFeePerGas: (0, import_viem4.parseGwei)("0.025")
|
|
1848
1819
|
// Max fee cap
|
|
1849
1820
|
});
|
|
1850
1821
|
const txReceipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -1859,7 +1830,7 @@ function useCreateOrganizationBase() {
|
|
|
1859
1830
|
let proxyAddress;
|
|
1860
1831
|
for (const log of txReceipt.logs) {
|
|
1861
1832
|
try {
|
|
1862
|
-
const decoded = (0,
|
|
1833
|
+
const decoded = (0, import_viem4.decodeEventLog)({
|
|
1863
1834
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1864
1835
|
data: log.data,
|
|
1865
1836
|
topics: log.topics
|
|
@@ -1896,7 +1867,7 @@ function useCreateOrganizationBase() {
|
|
|
1896
1867
|
|
|
1897
1868
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
1898
1869
|
var import_react20 = require("react");
|
|
1899
|
-
var
|
|
1870
|
+
var import_viem5 = require("viem");
|
|
1900
1871
|
function useApproveOrgPartialPayment() {
|
|
1901
1872
|
return (0, import_react20.useCallback)(
|
|
1902
1873
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
@@ -1907,12 +1878,12 @@ function useApproveOrgPartialPayment() {
|
|
|
1907
1878
|
};
|
|
1908
1879
|
}
|
|
1909
1880
|
try {
|
|
1910
|
-
const approveCalldata = (0,
|
|
1911
|
-
abi:
|
|
1881
|
+
const approveCalldata = (0, import_viem5.encodeFunctionData)({
|
|
1882
|
+
abi: import_viem5.erc20Abi,
|
|
1912
1883
|
functionName: "approve",
|
|
1913
1884
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
1914
1885
|
});
|
|
1915
|
-
const executeApproveCalldata = (0,
|
|
1886
|
+
const executeApproveCalldata = (0, import_viem5.encodeFunctionData)({
|
|
1916
1887
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1917
1888
|
functionName: "executeCall",
|
|
1918
1889
|
args: [kibbleTokenAddress, approveCalldata]
|
|
@@ -1925,7 +1896,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1925
1896
|
data: executeApproveCalldata
|
|
1926
1897
|
}
|
|
1927
1898
|
],
|
|
1928
|
-
maxPriorityFeePerGas: (0,
|
|
1899
|
+
maxPriorityFeePerGas: (0, import_viem5.parseGwei)("0.001")
|
|
1929
1900
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1930
1901
|
});
|
|
1931
1902
|
await bundlerClient.waitForUserOperationReceipt({ hash: userOpApproveHash });
|
|
@@ -1941,7 +1912,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1941
1912
|
|
|
1942
1913
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
1943
1914
|
var import_react21 = require("react");
|
|
1944
|
-
var
|
|
1915
|
+
var import_viem6 = require("viem");
|
|
1945
1916
|
function useProcessOrgPartialKibblePayment() {
|
|
1946
1917
|
return (0, import_react21.useCallback)(
|
|
1947
1918
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
@@ -1952,7 +1923,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1952
1923
|
};
|
|
1953
1924
|
}
|
|
1954
1925
|
try {
|
|
1955
|
-
const partialPayCalldata = (0,
|
|
1926
|
+
const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
1956
1927
|
abi: MARKETPLACE_ABI,
|
|
1957
1928
|
functionName: "partialPay",
|
|
1958
1929
|
args: [
|
|
@@ -1966,7 +1937,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1966
1937
|
backendSignature
|
|
1967
1938
|
]
|
|
1968
1939
|
});
|
|
1969
|
-
const executePartialPayCalldata = (0,
|
|
1940
|
+
const executePartialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
1970
1941
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1971
1942
|
functionName: "executeCall",
|
|
1972
1943
|
args: [partialPaymentModuleAddress, partialPayCalldata]
|
|
@@ -1979,7 +1950,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1979
1950
|
data: executePartialPayCalldata
|
|
1980
1951
|
}
|
|
1981
1952
|
],
|
|
1982
|
-
maxPriorityFeePerGas: (0,
|
|
1953
|
+
maxPriorityFeePerGas: (0, import_viem6.parseGwei)("0.001")
|
|
1983
1954
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1984
1955
|
});
|
|
1985
1956
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -2041,10 +2012,10 @@ function useUpdateOrgWalletAddress() {
|
|
|
2041
2012
|
|
|
2042
2013
|
// src/helpers/NonceHelper.tsx
|
|
2043
2014
|
var import_uuid = require("uuid");
|
|
2044
|
-
var
|
|
2015
|
+
var import_viem7 = require("viem");
|
|
2045
2016
|
var generateBytes32Nonce = () => {
|
|
2046
2017
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
2047
|
-
return (0,
|
|
2018
|
+
return (0, import_viem7.padHex)(`0x${uuid3}`, { size: 32 });
|
|
2048
2019
|
};
|
|
2049
2020
|
|
|
2050
2021
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -2394,16 +2365,16 @@ function useCreateOrganizationAppData() {
|
|
|
2394
2365
|
|
|
2395
2366
|
// src/utils/balance/useFetchBalance.ts
|
|
2396
2367
|
var import_react27 = require("react");
|
|
2397
|
-
var
|
|
2368
|
+
var import_viem8 = require("viem");
|
|
2398
2369
|
function useFetchBalance() {
|
|
2399
2370
|
return (0, import_react27.useCallback)(
|
|
2400
2371
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2401
2372
|
try {
|
|
2402
2373
|
const balance = await publicClient.readContract({
|
|
2403
|
-
address: (0,
|
|
2404
|
-
abi:
|
|
2374
|
+
address: (0, import_viem8.getAddress)(kibbleTokenAddress),
|
|
2375
|
+
abi: import_viem8.erc20Abi,
|
|
2405
2376
|
functionName: "balanceOf",
|
|
2406
|
-
args: [(0,
|
|
2377
|
+
args: [(0, import_viem8.getAddress)(walletAddress)]
|
|
2407
2378
|
});
|
|
2408
2379
|
return Number(balance);
|
|
2409
2380
|
} catch (error) {
|
|
@@ -2415,7 +2386,7 @@ function useFetchBalance() {
|
|
|
2415
2386
|
}
|
|
2416
2387
|
|
|
2417
2388
|
// src/utils/actions/useClaimActionReward.ts
|
|
2418
|
-
var
|
|
2389
|
+
var import_viem9 = require("viem");
|
|
2419
2390
|
var import_react28 = require("react");
|
|
2420
2391
|
function useClaimActionReward() {
|
|
2421
2392
|
return (0, import_react28.useCallback)(
|
|
@@ -2426,7 +2397,7 @@ function useClaimActionReward() {
|
|
|
2426
2397
|
message: "Missing web3auth account info or contract address."
|
|
2427
2398
|
};
|
|
2428
2399
|
}
|
|
2429
|
-
const callData = (0,
|
|
2400
|
+
const callData = (0, import_viem9.encodeFunctionData)({
|
|
2430
2401
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2431
2402
|
functionName: "claimByIndex",
|
|
2432
2403
|
args: [actionId, claimIndex]
|
|
@@ -2439,7 +2410,7 @@ function useClaimActionReward() {
|
|
|
2439
2410
|
data: callData
|
|
2440
2411
|
}
|
|
2441
2412
|
],
|
|
2442
|
-
maxPriorityFeePerGas: (0,
|
|
2413
|
+
maxPriorityFeePerGas: (0, import_viem9.parseGwei)("0.001")
|
|
2443
2414
|
});
|
|
2444
2415
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2445
2416
|
hash: userOpHash,
|
|
@@ -2453,7 +2424,7 @@ function useClaimActionReward() {
|
|
|
2453
2424
|
}
|
|
2454
2425
|
|
|
2455
2426
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2456
|
-
var
|
|
2427
|
+
var import_viem10 = require("viem");
|
|
2457
2428
|
var import_react29 = require("react");
|
|
2458
2429
|
function useClaimOrgActionReward() {
|
|
2459
2430
|
return (0, import_react29.useCallback)(
|
|
@@ -2464,12 +2435,12 @@ function useClaimOrgActionReward() {
|
|
|
2464
2435
|
message: "Missing web3auth account info or contract address."
|
|
2465
2436
|
};
|
|
2466
2437
|
}
|
|
2467
|
-
const claimCallData = (0,
|
|
2438
|
+
const claimCallData = (0, import_viem10.encodeFunctionData)({
|
|
2468
2439
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2469
2440
|
functionName: "claimByIndex",
|
|
2470
2441
|
args: [actionId, claimIndex]
|
|
2471
2442
|
});
|
|
2472
|
-
const executeClaimCalldata = (0,
|
|
2443
|
+
const executeClaimCalldata = (0, import_viem10.encodeFunctionData)({
|
|
2473
2444
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2474
2445
|
functionName: "executeCall",
|
|
2475
2446
|
args: [rewardableActionContractAddress, claimCallData]
|
|
@@ -2482,7 +2453,7 @@ function useClaimOrgActionReward() {
|
|
|
2482
2453
|
data: executeClaimCalldata
|
|
2483
2454
|
}
|
|
2484
2455
|
],
|
|
2485
|
-
maxPriorityFeePerGas: (0,
|
|
2456
|
+
maxPriorityFeePerGas: (0, import_viem10.parseGwei)("0.001")
|
|
2486
2457
|
});
|
|
2487
2458
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2488
2459
|
hash: userOpHash,
|
|
@@ -2503,6 +2474,7 @@ function useSubmitContractAction() {
|
|
|
2503
2474
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2504
2475
|
let sourceTypePayload = {};
|
|
2505
2476
|
const basisType = {
|
|
2477
|
+
campaignId: payload.campaignId,
|
|
2506
2478
|
actionId: payload.actionId,
|
|
2507
2479
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2508
2480
|
nonce: crypto.randomUUID(),
|