anymal-protocol 1.0.90 → 1.0.91
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +496 -531
- package/dist/index.mjs +494 -529
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,26 +74,363 @@ 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
|
+
}
|
|
283
|
+
}
|
|
284
|
+
`;
|
|
285
|
+
const variables = {
|
|
286
|
+
docID: [docID],
|
|
287
|
+
input: {
|
|
288
|
+
isVerified: true
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
const response = await fetch(endpoint, {
|
|
292
|
+
method: "POST",
|
|
293
|
+
headers: {
|
|
294
|
+
"Content-Type": "application/json",
|
|
295
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
296
|
+
},
|
|
297
|
+
body: JSON.stringify({
|
|
298
|
+
query: mutation,
|
|
299
|
+
variables
|
|
300
|
+
})
|
|
301
|
+
});
|
|
302
|
+
const responseMessage = response.ok ? "Your account has been verified!" : "An error has occured, try again.";
|
|
303
|
+
return { success: response.ok, message: responseMessage };
|
|
304
|
+
} catch (error) {
|
|
305
|
+
return { success: false, message: error.message };
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
[]
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// src/utils/account/useUpdateUserName.ts
|
|
313
|
+
var import_react8 = require("react");
|
|
314
|
+
function useUpdateUserName() {
|
|
315
|
+
return (0, import_react8.useCallback)(
|
|
316
|
+
async (dbAuthToken, docID, name, endpoint) => {
|
|
317
|
+
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
318
|
+
return { success: false };
|
|
319
|
+
}
|
|
320
|
+
try {
|
|
321
|
+
const mutation = `
|
|
322
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
323
|
+
update_User(docID: $docID, input: $input) {
|
|
324
|
+
name
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
`;
|
|
328
|
+
const variables = {
|
|
329
|
+
docID: [docID],
|
|
330
|
+
input: {
|
|
331
|
+
name
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
const response = await fetch(endpoint, {
|
|
335
|
+
method: "POST",
|
|
336
|
+
headers: {
|
|
337
|
+
"Content-Type": "application/json",
|
|
338
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
339
|
+
},
|
|
340
|
+
body: JSON.stringify({
|
|
341
|
+
query: mutation,
|
|
342
|
+
variables
|
|
343
|
+
})
|
|
344
|
+
});
|
|
345
|
+
if (!response.ok) {
|
|
346
|
+
return { success: false };
|
|
347
|
+
}
|
|
348
|
+
return { success: true };
|
|
349
|
+
} catch (error) {
|
|
350
|
+
console.error("Error updating name:", error);
|
|
351
|
+
return { success: false };
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
[]
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/utils/account/useFetchNotifications.ts
|
|
359
|
+
var import_react9 = require("react");
|
|
360
|
+
function useFetchNotifications() {
|
|
361
|
+
return (0, import_react9.useCallback)(
|
|
362
|
+
async (pid, dbAuthToken, endpoint, additionalFilters) => {
|
|
363
|
+
if (!pid) {
|
|
364
|
+
throw new Error("The 'pid' field is required.");
|
|
365
|
+
}
|
|
366
|
+
try {
|
|
367
|
+
const query = `
|
|
368
|
+
query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg, $order: [AnymalNotificationOrderArg]) {
|
|
369
|
+
AnymalNotification(groupBy: $groupBy, filter: $filter, order: $order) {
|
|
370
|
+
anymalTxId
|
|
371
|
+
title
|
|
372
|
+
_group {
|
|
373
|
+
_docID
|
|
374
|
+
source
|
|
375
|
+
action
|
|
376
|
+
anymalTxId
|
|
377
|
+
id
|
|
378
|
+
pid
|
|
379
|
+
read
|
|
380
|
+
tags
|
|
381
|
+
text
|
|
382
|
+
title
|
|
383
|
+
timeAddedUtc
|
|
384
|
+
timeUpdatedUtc
|
|
385
|
+
type
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
`;
|
|
390
|
+
const filter = {
|
|
391
|
+
pid: {
|
|
392
|
+
_eq: pid
|
|
393
|
+
},
|
|
394
|
+
...additionalFilters || {}
|
|
395
|
+
};
|
|
396
|
+
const order = [
|
|
397
|
+
{
|
|
398
|
+
timeAddedUtc: "DESC"
|
|
399
|
+
}
|
|
400
|
+
];
|
|
401
|
+
const groupBy = ["anymalTxId", "title"];
|
|
402
|
+
const variables = { filter, groupBy, order };
|
|
403
|
+
const response = await fetch(endpoint, {
|
|
404
|
+
method: "POST",
|
|
405
|
+
headers: {
|
|
406
|
+
"Content-Type": "application/json",
|
|
407
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
408
|
+
},
|
|
409
|
+
body: JSON.stringify({ query, variables })
|
|
410
|
+
});
|
|
411
|
+
if (!response.ok) {
|
|
412
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
413
|
+
}
|
|
414
|
+
const data = await response.json();
|
|
415
|
+
if (data?.data?.AnymalNotification?.length > 0) {
|
|
416
|
+
return data.data.AnymalNotification;
|
|
417
|
+
} else {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
} catch (error) {
|
|
421
|
+
console.error("Error fetching notifications:", error);
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
[]
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
77
430
|
var import_viem = require("viem");
|
|
78
431
|
|
|
79
432
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
80
433
|
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
434
|
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
435
|
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
436
|
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" }];
|
|
@@ -763,119 +1100,43 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
763
1100
|
"type": "address"
|
|
764
1101
|
}
|
|
765
1102
|
],
|
|
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"
|
|
860
|
-
}
|
|
861
|
-
],
|
|
862
|
-
"stateMutability": "view",
|
|
1103
|
+
"name": "removeManager",
|
|
1104
|
+
"outputs": [],
|
|
1105
|
+
"stateMutability": "nonpayable",
|
|
863
1106
|
"type": "function"
|
|
864
1107
|
},
|
|
865
1108
|
{
|
|
866
1109
|
"inputs": [
|
|
1110
|
+
{
|
|
1111
|
+
"internalType": "bytes32",
|
|
1112
|
+
"name": "role",
|
|
1113
|
+
"type": "bytes32"
|
|
1114
|
+
},
|
|
867
1115
|
{
|
|
868
1116
|
"internalType": "address",
|
|
869
|
-
"name": "
|
|
1117
|
+
"name": "callerConfirmation",
|
|
870
1118
|
"type": "address"
|
|
1119
|
+
}
|
|
1120
|
+
],
|
|
1121
|
+
"name": "renounceRole",
|
|
1122
|
+
"outputs": [],
|
|
1123
|
+
"stateMutability": "nonpayable",
|
|
1124
|
+
"type": "function"
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
"inputs": [
|
|
1128
|
+
{
|
|
1129
|
+
"internalType": "bytes32",
|
|
1130
|
+
"name": "role",
|
|
1131
|
+
"type": "bytes32"
|
|
871
1132
|
},
|
|
872
1133
|
{
|
|
873
|
-
"internalType": "
|
|
874
|
-
"name": "
|
|
875
|
-
"type": "
|
|
1134
|
+
"internalType": "address",
|
|
1135
|
+
"name": "account",
|
|
1136
|
+
"type": "address"
|
|
876
1137
|
}
|
|
877
1138
|
],
|
|
878
|
-
"name": "
|
|
1139
|
+
"name": "revokeRole",
|
|
879
1140
|
"outputs": [],
|
|
880
1141
|
"stateMutability": "nonpayable",
|
|
881
1142
|
"type": "function"
|
|
@@ -883,12 +1144,12 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
883
1144
|
{
|
|
884
1145
|
"inputs": [
|
|
885
1146
|
{
|
|
886
|
-
"internalType": "
|
|
887
|
-
"name": "
|
|
888
|
-
"type": "
|
|
1147
|
+
"internalType": "address",
|
|
1148
|
+
"name": "_anymalNFTProxy",
|
|
1149
|
+
"type": "address"
|
|
889
1150
|
}
|
|
890
1151
|
],
|
|
891
|
-
"name": "
|
|
1152
|
+
"name": "setAnymalNFT",
|
|
892
1153
|
"outputs": [],
|
|
893
1154
|
"stateMutability": "nonpayable",
|
|
894
1155
|
"type": "function"
|
|
@@ -896,392 +1157,95 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
896
1157
|
{
|
|
897
1158
|
"inputs": [
|
|
898
1159
|
{
|
|
899
|
-
"internalType": "
|
|
900
|
-
"name": "
|
|
901
|
-
"type": "
|
|
1160
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1161
|
+
"name": "newStatus",
|
|
1162
|
+
"type": "uint8"
|
|
902
1163
|
}
|
|
903
1164
|
],
|
|
904
|
-
"name": "
|
|
1165
|
+
"name": "setStatus",
|
|
905
1166
|
"outputs": [],
|
|
906
1167
|
"stateMutability": "nonpayable",
|
|
907
1168
|
"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);
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
"inputs": [],
|
|
1172
|
+
"name": "status",
|
|
1173
|
+
"outputs": [
|
|
1174
|
+
{
|
|
1175
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1176
|
+
"name": "",
|
|
1177
|
+
"type": "uint8"
|
|
1119
1178
|
}
|
|
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 };
|
|
1179
|
+
],
|
|
1180
|
+
"stateMutability": "view",
|
|
1181
|
+
"type": "function"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
"inputs": [
|
|
1185
|
+
{
|
|
1186
|
+
"internalType": "bytes4",
|
|
1187
|
+
"name": "interfaceId",
|
|
1188
|
+
"type": "bytes4"
|
|
1160
1189
|
}
|
|
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 };
|
|
1190
|
+
],
|
|
1191
|
+
"name": "supportsInterface",
|
|
1192
|
+
"outputs": [
|
|
1193
|
+
{
|
|
1194
|
+
"internalType": "bool",
|
|
1195
|
+
"name": "",
|
|
1196
|
+
"type": "bool"
|
|
1173
1197
|
}
|
|
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 };
|
|
1198
|
+
],
|
|
1199
|
+
"stateMutability": "view",
|
|
1200
|
+
"type": "function"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"inputs": [
|
|
1204
|
+
{
|
|
1205
|
+
"internalType": "address",
|
|
1206
|
+
"name": "to",
|
|
1207
|
+
"type": "address"
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
"internalType": "uint256",
|
|
1211
|
+
"name": "tokenId",
|
|
1212
|
+
"type": "uint256"
|
|
1206
1213
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1214
|
+
],
|
|
1215
|
+
"name": "transferAnymal",
|
|
1216
|
+
"outputs": [],
|
|
1217
|
+
"stateMutability": "nonpayable",
|
|
1218
|
+
"type": "function"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
"inputs": [
|
|
1222
|
+
{
|
|
1223
|
+
"internalType": "string",
|
|
1224
|
+
"name": "newOrgName",
|
|
1225
|
+
"type": "string"
|
|
1219
1226
|
}
|
|
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;
|
|
1227
|
+
],
|
|
1228
|
+
"name": "updateMetadata",
|
|
1229
|
+
"outputs": [],
|
|
1230
|
+
"stateMutability": "nonpayable",
|
|
1231
|
+
"type": "function"
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
"inputs": [
|
|
1235
|
+
{
|
|
1236
|
+
"internalType": "string",
|
|
1237
|
+
"name": "pid",
|
|
1238
|
+
"type": "string"
|
|
1277
1239
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1240
|
+
],
|
|
1241
|
+
"name": "updatePid",
|
|
1242
|
+
"outputs": [],
|
|
1243
|
+
"stateMutability": "nonpayable",
|
|
1244
|
+
"type": "function"
|
|
1245
|
+
}
|
|
1246
|
+
];
|
|
1282
1247
|
|
|
1283
1248
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1284
|
-
var import_viem2 = require("viem");
|
|
1285
1249
|
var import_react10 = require("react");
|
|
1286
1250
|
function useMintAnymalNFT() {
|
|
1287
1251
|
return (0, import_react10.useCallback)(
|
|
@@ -1292,7 +1256,7 @@ function useMintAnymalNFT() {
|
|
|
1292
1256
|
message: "Missing authentication token OR NFT ID."
|
|
1293
1257
|
};
|
|
1294
1258
|
}
|
|
1295
|
-
const callData = (0,
|
|
1259
|
+
const callData = (0, import_viem.encodeFunctionData)({
|
|
1296
1260
|
abi: PET_NFT_ABI,
|
|
1297
1261
|
functionName: "submitMetadataByCampaignName",
|
|
1298
1262
|
args: [
|
|
@@ -1311,7 +1275,7 @@ function useMintAnymalNFT() {
|
|
|
1311
1275
|
data: callData
|
|
1312
1276
|
}
|
|
1313
1277
|
],
|
|
1314
|
-
maxPriorityFeePerGas: (0,
|
|
1278
|
+
maxPriorityFeePerGas: (0, import_viem.parseGwei)("0.001")
|
|
1315
1279
|
});
|
|
1316
1280
|
await bundlerClient.waitForUserOperationReceipt({
|
|
1317
1281
|
hash: userOpHash,
|
|
@@ -1689,7 +1653,7 @@ function useFetchAnymals() {
|
|
|
1689
1653
|
}
|
|
1690
1654
|
|
|
1691
1655
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
1692
|
-
var
|
|
1656
|
+
var import_viem2 = require("viem");
|
|
1693
1657
|
var import_react17 = require("react");
|
|
1694
1658
|
function useProcessPartialKibblePayment() {
|
|
1695
1659
|
return (0, import_react17.useCallback)(
|
|
@@ -1719,7 +1683,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1719
1683
|
// bytes
|
|
1720
1684
|
];
|
|
1721
1685
|
console.info({ args });
|
|
1722
|
-
const callData = (0,
|
|
1686
|
+
const callData = (0, import_viem2.encodeFunctionData)({
|
|
1723
1687
|
abi: MARKETPLACE_ABI,
|
|
1724
1688
|
functionName: "partialPay",
|
|
1725
1689
|
args
|
|
@@ -1732,7 +1696,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1732
1696
|
data: callData
|
|
1733
1697
|
}
|
|
1734
1698
|
],
|
|
1735
|
-
maxPriorityFeePerGas: (0,
|
|
1699
|
+
maxPriorityFeePerGas: (0, import_viem2.parseGwei)("0.001")
|
|
1736
1700
|
});
|
|
1737
1701
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
1738
1702
|
hash: userOpHash,
|
|
@@ -1753,14 +1717,14 @@ function useProcessPartialKibblePayment() {
|
|
|
1753
1717
|
}
|
|
1754
1718
|
|
|
1755
1719
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
1756
|
-
var
|
|
1720
|
+
var import_viem3 = require("viem");
|
|
1757
1721
|
var import_react18 = require("react");
|
|
1758
1722
|
function useApproveKibbleToken() {
|
|
1759
1723
|
return (0, import_react18.useCallback)(
|
|
1760
1724
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
1761
1725
|
try {
|
|
1762
|
-
const callData = (0,
|
|
1763
|
-
abi:
|
|
1726
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
1727
|
+
abi: import_viem3.erc20Abi,
|
|
1764
1728
|
functionName: "approve",
|
|
1765
1729
|
args: [
|
|
1766
1730
|
marketplaceContract,
|
|
@@ -1778,7 +1742,7 @@ function useApproveKibbleToken() {
|
|
|
1778
1742
|
data: callData
|
|
1779
1743
|
}
|
|
1780
1744
|
],
|
|
1781
|
-
maxPriorityFeePerGas: (0,
|
|
1745
|
+
maxPriorityFeePerGas: (0, import_viem3.parseGwei)("0.001")
|
|
1782
1746
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1783
1747
|
});
|
|
1784
1748
|
console.log("sendUserOperation has been called");
|
|
@@ -1807,7 +1771,7 @@ function useApproveKibbleToken() {
|
|
|
1807
1771
|
|
|
1808
1772
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
1809
1773
|
var import_react19 = require("react");
|
|
1810
|
-
var
|
|
1774
|
+
var import_viem4 = require("viem");
|
|
1811
1775
|
function useCreateOrganizationBase() {
|
|
1812
1776
|
return (0, import_react19.useCallback)(
|
|
1813
1777
|
/**
|
|
@@ -1829,7 +1793,7 @@ function useCreateOrganizationBase() {
|
|
|
1829
1793
|
};
|
|
1830
1794
|
}
|
|
1831
1795
|
try {
|
|
1832
|
-
const callData = (0,
|
|
1796
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
1833
1797
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1834
1798
|
functionName: "createOrganizationProxy",
|
|
1835
1799
|
args: [ownerAddress, orgName, orgPid]
|
|
@@ -1842,9 +1806,9 @@ function useCreateOrganizationBase() {
|
|
|
1842
1806
|
data: callData
|
|
1843
1807
|
}
|
|
1844
1808
|
],
|
|
1845
|
-
maxPriorityFeePerGas: (0,
|
|
1809
|
+
maxPriorityFeePerGas: (0, import_viem4.parseGwei)("0.001"),
|
|
1846
1810
|
// Low priority fee
|
|
1847
|
-
maxFeePerGas: (0,
|
|
1811
|
+
maxFeePerGas: (0, import_viem4.parseGwei)("0.025")
|
|
1848
1812
|
// Max fee cap
|
|
1849
1813
|
});
|
|
1850
1814
|
const txReceipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -1859,7 +1823,7 @@ function useCreateOrganizationBase() {
|
|
|
1859
1823
|
let proxyAddress;
|
|
1860
1824
|
for (const log of txReceipt.logs) {
|
|
1861
1825
|
try {
|
|
1862
|
-
const decoded = (0,
|
|
1826
|
+
const decoded = (0, import_viem4.decodeEventLog)({
|
|
1863
1827
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1864
1828
|
data: log.data,
|
|
1865
1829
|
topics: log.topics
|
|
@@ -1896,7 +1860,7 @@ function useCreateOrganizationBase() {
|
|
|
1896
1860
|
|
|
1897
1861
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
1898
1862
|
var import_react20 = require("react");
|
|
1899
|
-
var
|
|
1863
|
+
var import_viem5 = require("viem");
|
|
1900
1864
|
function useApproveOrgPartialPayment() {
|
|
1901
1865
|
return (0, import_react20.useCallback)(
|
|
1902
1866
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
@@ -1907,12 +1871,12 @@ function useApproveOrgPartialPayment() {
|
|
|
1907
1871
|
};
|
|
1908
1872
|
}
|
|
1909
1873
|
try {
|
|
1910
|
-
const approveCalldata = (0,
|
|
1911
|
-
abi:
|
|
1874
|
+
const approveCalldata = (0, import_viem5.encodeFunctionData)({
|
|
1875
|
+
abi: import_viem5.erc20Abi,
|
|
1912
1876
|
functionName: "approve",
|
|
1913
1877
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
1914
1878
|
});
|
|
1915
|
-
const executeApproveCalldata = (0,
|
|
1879
|
+
const executeApproveCalldata = (0, import_viem5.encodeFunctionData)({
|
|
1916
1880
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1917
1881
|
functionName: "executeCall",
|
|
1918
1882
|
args: [kibbleTokenAddress, approveCalldata]
|
|
@@ -1925,7 +1889,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1925
1889
|
data: executeApproveCalldata
|
|
1926
1890
|
}
|
|
1927
1891
|
],
|
|
1928
|
-
maxPriorityFeePerGas: (0,
|
|
1892
|
+
maxPriorityFeePerGas: (0, import_viem5.parseGwei)("0.001")
|
|
1929
1893
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1930
1894
|
});
|
|
1931
1895
|
await bundlerClient.waitForUserOperationReceipt({ hash: userOpApproveHash });
|
|
@@ -1941,7 +1905,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1941
1905
|
|
|
1942
1906
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
1943
1907
|
var import_react21 = require("react");
|
|
1944
|
-
var
|
|
1908
|
+
var import_viem6 = require("viem");
|
|
1945
1909
|
function useProcessOrgPartialKibblePayment() {
|
|
1946
1910
|
return (0, import_react21.useCallback)(
|
|
1947
1911
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
@@ -1952,7 +1916,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1952
1916
|
};
|
|
1953
1917
|
}
|
|
1954
1918
|
try {
|
|
1955
|
-
const partialPayCalldata = (0,
|
|
1919
|
+
const partialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
1956
1920
|
abi: MARKETPLACE_ABI,
|
|
1957
1921
|
functionName: "partialPay",
|
|
1958
1922
|
args: [
|
|
@@ -1966,7 +1930,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1966
1930
|
backendSignature
|
|
1967
1931
|
]
|
|
1968
1932
|
});
|
|
1969
|
-
const executePartialPayCalldata = (0,
|
|
1933
|
+
const executePartialPayCalldata = (0, import_viem6.encodeFunctionData)({
|
|
1970
1934
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1971
1935
|
functionName: "executeCall",
|
|
1972
1936
|
args: [partialPaymentModuleAddress, partialPayCalldata]
|
|
@@ -1979,7 +1943,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1979
1943
|
data: executePartialPayCalldata
|
|
1980
1944
|
}
|
|
1981
1945
|
],
|
|
1982
|
-
maxPriorityFeePerGas: (0,
|
|
1946
|
+
maxPriorityFeePerGas: (0, import_viem6.parseGwei)("0.001")
|
|
1983
1947
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1984
1948
|
});
|
|
1985
1949
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -2041,10 +2005,10 @@ function useUpdateOrgWalletAddress() {
|
|
|
2041
2005
|
|
|
2042
2006
|
// src/helpers/NonceHelper.tsx
|
|
2043
2007
|
var import_uuid = require("uuid");
|
|
2044
|
-
var
|
|
2008
|
+
var import_viem7 = require("viem");
|
|
2045
2009
|
var generateBytes32Nonce = () => {
|
|
2046
2010
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
2047
|
-
return (0,
|
|
2011
|
+
return (0, import_viem7.padHex)(`0x${uuid3}`, { size: 32 });
|
|
2048
2012
|
};
|
|
2049
2013
|
|
|
2050
2014
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -2394,16 +2358,16 @@ function useCreateOrganizationAppData() {
|
|
|
2394
2358
|
|
|
2395
2359
|
// src/utils/balance/useFetchBalance.ts
|
|
2396
2360
|
var import_react27 = require("react");
|
|
2397
|
-
var
|
|
2361
|
+
var import_viem8 = require("viem");
|
|
2398
2362
|
function useFetchBalance() {
|
|
2399
2363
|
return (0, import_react27.useCallback)(
|
|
2400
2364
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2401
2365
|
try {
|
|
2402
2366
|
const balance = await publicClient.readContract({
|
|
2403
|
-
address: (0,
|
|
2404
|
-
abi:
|
|
2367
|
+
address: (0, import_viem8.getAddress)(kibbleTokenAddress),
|
|
2368
|
+
abi: import_viem8.erc20Abi,
|
|
2405
2369
|
functionName: "balanceOf",
|
|
2406
|
-
args: [(0,
|
|
2370
|
+
args: [(0, import_viem8.getAddress)(walletAddress)]
|
|
2407
2371
|
});
|
|
2408
2372
|
return Number(balance);
|
|
2409
2373
|
} catch (error) {
|
|
@@ -2415,7 +2379,7 @@ function useFetchBalance() {
|
|
|
2415
2379
|
}
|
|
2416
2380
|
|
|
2417
2381
|
// src/utils/actions/useClaimActionReward.ts
|
|
2418
|
-
var
|
|
2382
|
+
var import_viem9 = require("viem");
|
|
2419
2383
|
var import_react28 = require("react");
|
|
2420
2384
|
function useClaimActionReward() {
|
|
2421
2385
|
return (0, import_react28.useCallback)(
|
|
@@ -2426,7 +2390,7 @@ function useClaimActionReward() {
|
|
|
2426
2390
|
message: "Missing web3auth account info or contract address."
|
|
2427
2391
|
};
|
|
2428
2392
|
}
|
|
2429
|
-
const callData = (0,
|
|
2393
|
+
const callData = (0, import_viem9.encodeFunctionData)({
|
|
2430
2394
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2431
2395
|
functionName: "claimByIndex",
|
|
2432
2396
|
args: [actionId, claimIndex]
|
|
@@ -2439,7 +2403,7 @@ function useClaimActionReward() {
|
|
|
2439
2403
|
data: callData
|
|
2440
2404
|
}
|
|
2441
2405
|
],
|
|
2442
|
-
maxPriorityFeePerGas: (0,
|
|
2406
|
+
maxPriorityFeePerGas: (0, import_viem9.parseGwei)("0.001")
|
|
2443
2407
|
});
|
|
2444
2408
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2445
2409
|
hash: userOpHash,
|
|
@@ -2453,7 +2417,7 @@ function useClaimActionReward() {
|
|
|
2453
2417
|
}
|
|
2454
2418
|
|
|
2455
2419
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2456
|
-
var
|
|
2420
|
+
var import_viem10 = require("viem");
|
|
2457
2421
|
var import_react29 = require("react");
|
|
2458
2422
|
function useClaimOrgActionReward() {
|
|
2459
2423
|
return (0, import_react29.useCallback)(
|
|
@@ -2464,12 +2428,12 @@ function useClaimOrgActionReward() {
|
|
|
2464
2428
|
message: "Missing web3auth account info or contract address."
|
|
2465
2429
|
};
|
|
2466
2430
|
}
|
|
2467
|
-
const claimCallData = (0,
|
|
2431
|
+
const claimCallData = (0, import_viem10.encodeFunctionData)({
|
|
2468
2432
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2469
2433
|
functionName: "claimByIndex",
|
|
2470
2434
|
args: [actionId, claimIndex]
|
|
2471
2435
|
});
|
|
2472
|
-
const executeClaimCalldata = (0,
|
|
2436
|
+
const executeClaimCalldata = (0, import_viem10.encodeFunctionData)({
|
|
2473
2437
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2474
2438
|
functionName: "executeCall",
|
|
2475
2439
|
args: [rewardableActionContractAddress, claimCallData]
|
|
@@ -2482,7 +2446,7 @@ function useClaimOrgActionReward() {
|
|
|
2482
2446
|
data: executeClaimCalldata
|
|
2483
2447
|
}
|
|
2484
2448
|
],
|
|
2485
|
-
maxPriorityFeePerGas: (0,
|
|
2449
|
+
maxPriorityFeePerGas: (0, import_viem10.parseGwei)("0.001")
|
|
2486
2450
|
});
|
|
2487
2451
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2488
2452
|
hash: userOpHash,
|
|
@@ -2503,6 +2467,7 @@ function useSubmitContractAction() {
|
|
|
2503
2467
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2504
2468
|
let sourceTypePayload = {};
|
|
2505
2469
|
const basisType = {
|
|
2470
|
+
campaignId: payload.campaignId,
|
|
2506
2471
|
actionId: payload.actionId,
|
|
2507
2472
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2508
2473
|
nonce: crypto.randomUUID(),
|