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.mjs
CHANGED
|
@@ -11,26 +11,370 @@ import {
|
|
|
11
11
|
|
|
12
12
|
// src/utils/account/useVerifyAccount.ts
|
|
13
13
|
import { useCallback } from "react";
|
|
14
|
+
function useVerifyAccount() {
|
|
15
|
+
return useCallback(
|
|
16
|
+
async (pid, campaignId, dbAuthToken, bundlerClient, smartAccount, accountRewardsContractAddress) => {
|
|
17
|
+
if (!dbAuthToken || !bundlerClient || !smartAccount || !accountRewardsContractAddress || !pid) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
message: "Missing crucial information"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
console.log(campaignId);
|
|
25
|
+
return { success: true, message: "Registration kibble awarded" };
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
return { success: false, message: error.message };
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[]
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/utils/account/useVerifyWeb3AuthSession.ts
|
|
36
|
+
import { useCallback as useCallback2 } from "react";
|
|
37
|
+
function useVerifyWeb3AuthSession() {
|
|
38
|
+
return useCallback2(
|
|
39
|
+
async (idToken, publicKey, authServiceBaseUrl) => {
|
|
40
|
+
const response = await fetch(
|
|
41
|
+
`${authServiceBaseUrl}/verify-web3-session`,
|
|
42
|
+
{
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
Authorization: "Bearer " + idToken
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({ appPubKey: publicKey })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
const { jwt } = await response.json();
|
|
52
|
+
return jwt;
|
|
53
|
+
},
|
|
54
|
+
[]
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/utils/account/useCreateWeb3Account.ts
|
|
59
|
+
import { useCallback as useCallback3 } from "react";
|
|
60
|
+
function useCreateWeb3Account() {
|
|
61
|
+
return useCallback3(
|
|
62
|
+
async (idToken, publicKey, userPid, authServiceBaseUrl) => {
|
|
63
|
+
try {
|
|
64
|
+
const response = await fetch(`${authServiceBaseUrl}/create-account`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
"Content-Type": "application/json",
|
|
68
|
+
Authorization: "Bearer " + idToken
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify({ appPubKey: publicKey, pid: userPid })
|
|
71
|
+
});
|
|
72
|
+
return await response.json();
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error(error);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[]
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/utils/account/useFetchUserData.ts
|
|
83
|
+
import { useCallback as useCallback4 } from "react";
|
|
84
|
+
function useFetchUserData() {
|
|
85
|
+
return useCallback4(async (dbAuthToken, endpoint) => {
|
|
86
|
+
try {
|
|
87
|
+
const query = `
|
|
88
|
+
query User {
|
|
89
|
+
User {
|
|
90
|
+
_docID
|
|
91
|
+
pid
|
|
92
|
+
email
|
|
93
|
+
name
|
|
94
|
+
isVerified
|
|
95
|
+
showTooltips
|
|
96
|
+
accountType
|
|
97
|
+
baseWalletAddress
|
|
98
|
+
stripeCustomerId
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
const response = await fetch(endpoint, {
|
|
103
|
+
method: "POST",
|
|
104
|
+
headers: {
|
|
105
|
+
"Content-Type": "application/json",
|
|
106
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
107
|
+
},
|
|
108
|
+
body: JSON.stringify({ query })
|
|
109
|
+
});
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
112
|
+
}
|
|
113
|
+
const data = await response.json();
|
|
114
|
+
if (data && data.data && data.data.User && data.data.User.length > 0) {
|
|
115
|
+
return data.data.User[0];
|
|
116
|
+
} else {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error("Error fetching user data:", error);
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}, []);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/utils/account/useUpdateUserEmail.ts
|
|
127
|
+
import { useCallback as useCallback5 } from "react";
|
|
128
|
+
function useUpdateUserEmail() {
|
|
129
|
+
return useCallback5(
|
|
130
|
+
async (dbAuthToken, docID, email, endpoint) => {
|
|
131
|
+
try {
|
|
132
|
+
const mutation = `
|
|
133
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
134
|
+
update_User(docID: $docID, input: $input) {
|
|
135
|
+
email
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
const variables = {
|
|
140
|
+
docID: [docID],
|
|
141
|
+
input: {
|
|
142
|
+
email
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const response = await fetch(endpoint, {
|
|
146
|
+
method: "POST",
|
|
147
|
+
headers: {
|
|
148
|
+
"Content-Type": "application/json",
|
|
149
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
150
|
+
},
|
|
151
|
+
body: JSON.stringify({
|
|
152
|
+
query: mutation,
|
|
153
|
+
variables
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
158
|
+
}
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.error("Error updating email:", error);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
[]
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// src/utils/account/useUpdateUserPid.ts
|
|
168
|
+
import { useCallback as useCallback6 } from "react";
|
|
169
|
+
function useUpdateUserPid() {
|
|
170
|
+
return useCallback6(
|
|
171
|
+
async (dbAuthToken, docID, pid, endpoint) => {
|
|
172
|
+
try {
|
|
173
|
+
const mutation = `
|
|
174
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
175
|
+
update_User(docID: $docID, input: $input) {
|
|
176
|
+
pid
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
const variables = {
|
|
181
|
+
docID: [docID],
|
|
182
|
+
input: {
|
|
183
|
+
pid
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const response = await fetch(endpoint, {
|
|
187
|
+
method: "POST",
|
|
188
|
+
headers: {
|
|
189
|
+
"Content-Type": "application/json",
|
|
190
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
191
|
+
},
|
|
192
|
+
body: JSON.stringify({
|
|
193
|
+
query: mutation,
|
|
194
|
+
variables
|
|
195
|
+
})
|
|
196
|
+
});
|
|
197
|
+
if (!response.ok) {
|
|
198
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
199
|
+
}
|
|
200
|
+
} catch (error) {
|
|
201
|
+
console.error("Error updating email:", error);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
[]
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/utils/account/useUpdateUserAsVerified.ts
|
|
209
|
+
import { useCallback as useCallback7 } from "react";
|
|
210
|
+
function useUpdateUserAsVerified() {
|
|
211
|
+
return useCallback7(
|
|
212
|
+
async (recaptchaToken, docID, dbAuthToken, endpoint) => {
|
|
213
|
+
if (!docID || !dbAuthToken || recaptchaToken === null) return;
|
|
214
|
+
try {
|
|
215
|
+
const mutation = `
|
|
216
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
217
|
+
update_User(docID: $docID, input: $input) {
|
|
218
|
+
isVerified
|
|
219
|
+
_version {
|
|
220
|
+
cid
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
const variables = {
|
|
226
|
+
docID: [docID],
|
|
227
|
+
input: {
|
|
228
|
+
isVerified: true
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const response = await fetch(endpoint, {
|
|
232
|
+
method: "POST",
|
|
233
|
+
headers: {
|
|
234
|
+
"Content-Type": "application/json",
|
|
235
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
236
|
+
},
|
|
237
|
+
body: JSON.stringify({
|
|
238
|
+
query: mutation,
|
|
239
|
+
variables
|
|
240
|
+
})
|
|
241
|
+
});
|
|
242
|
+
const { data, errors } = await response.json();
|
|
243
|
+
if (errors) {
|
|
244
|
+
return { success: false, message: "Error occurred", dbCid: null };
|
|
245
|
+
}
|
|
246
|
+
const dbCid = data.update_User[0]._version[0].cid;
|
|
247
|
+
return { success: true, message: "Account verified", dbCid };
|
|
248
|
+
} catch (error) {
|
|
249
|
+
return { success: false, message: error.message };
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
[]
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// src/utils/account/useUpdateUserName.ts
|
|
257
|
+
import { useCallback as useCallback8 } from "react";
|
|
258
|
+
function useUpdateUserName() {
|
|
259
|
+
return useCallback8(
|
|
260
|
+
async (dbAuthToken, docID, name, endpoint) => {
|
|
261
|
+
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
262
|
+
return { success: false };
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
const mutation = `
|
|
266
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
267
|
+
update_User(docID: $docID, input: $input) {
|
|
268
|
+
name
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
`;
|
|
272
|
+
const variables = {
|
|
273
|
+
docID: [docID],
|
|
274
|
+
input: {
|
|
275
|
+
name
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const response = await fetch(endpoint, {
|
|
279
|
+
method: "POST",
|
|
280
|
+
headers: {
|
|
281
|
+
"Content-Type": "application/json",
|
|
282
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
283
|
+
},
|
|
284
|
+
body: JSON.stringify({
|
|
285
|
+
query: mutation,
|
|
286
|
+
variables
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
if (!response.ok) {
|
|
290
|
+
return { success: false };
|
|
291
|
+
}
|
|
292
|
+
return { success: true };
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.error("Error updating name:", error);
|
|
295
|
+
return { success: false };
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
[]
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/utils/account/useFetchNotifications.ts
|
|
303
|
+
import { useCallback as useCallback9 } from "react";
|
|
304
|
+
function useFetchNotifications() {
|
|
305
|
+
return useCallback9(
|
|
306
|
+
async (pid, dbAuthToken, endpoint, additionalFilters) => {
|
|
307
|
+
if (!pid) {
|
|
308
|
+
throw new Error("The 'pid' field is required.");
|
|
309
|
+
}
|
|
310
|
+
try {
|
|
311
|
+
const query = `
|
|
312
|
+
query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg, $order: [AnymalNotificationOrderArg]) {
|
|
313
|
+
AnymalNotification(groupBy: $groupBy, filter: $filter, order: $order) {
|
|
314
|
+
anymalTxId
|
|
315
|
+
title
|
|
316
|
+
_group {
|
|
317
|
+
_docID
|
|
318
|
+
source
|
|
319
|
+
action
|
|
320
|
+
anymalTxId
|
|
321
|
+
id
|
|
322
|
+
pid
|
|
323
|
+
read
|
|
324
|
+
tags
|
|
325
|
+
text
|
|
326
|
+
title
|
|
327
|
+
timeAddedUtc
|
|
328
|
+
timeUpdatedUtc
|
|
329
|
+
type
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
334
|
+
const filter = {
|
|
335
|
+
pid: {
|
|
336
|
+
_eq: pid
|
|
337
|
+
},
|
|
338
|
+
...additionalFilters || {}
|
|
339
|
+
};
|
|
340
|
+
const order = [
|
|
341
|
+
{
|
|
342
|
+
timeAddedUtc: "DESC"
|
|
343
|
+
}
|
|
344
|
+
];
|
|
345
|
+
const groupBy = ["anymalTxId", "title"];
|
|
346
|
+
const variables = { filter, groupBy, order };
|
|
347
|
+
const response = await fetch(endpoint, {
|
|
348
|
+
method: "POST",
|
|
349
|
+
headers: {
|
|
350
|
+
"Content-Type": "application/json",
|
|
351
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
352
|
+
},
|
|
353
|
+
body: JSON.stringify({ query, variables })
|
|
354
|
+
});
|
|
355
|
+
if (!response.ok) {
|
|
356
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
357
|
+
}
|
|
358
|
+
const data = await response.json();
|
|
359
|
+
if (data?.data?.AnymalNotification?.length > 0) {
|
|
360
|
+
return data.data.AnymalNotification;
|
|
361
|
+
} else {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
} catch (error) {
|
|
365
|
+
console.error("Error fetching notifications:", error);
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
[]
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
14
374
|
import { encodeFunctionData, parseGwei } from "viem";
|
|
15
375
|
|
|
16
376
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
17
377
|
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" }];
|
|
18
|
-
var VERIFY_ACCOUNT_ABI = [
|
|
19
|
-
{
|
|
20
|
-
inputs: [
|
|
21
|
-
{
|
|
22
|
-
internalType: "string",
|
|
23
|
-
name: "_campaignName",
|
|
24
|
-
type: "string"
|
|
25
|
-
},
|
|
26
|
-
{ internalType: "string", name: "_pid", type: "string" }
|
|
27
|
-
],
|
|
28
|
-
name: "claimRewardByName",
|
|
29
|
-
outputs: [],
|
|
30
|
-
stateMutability: "nonpayable",
|
|
31
|
-
type: "function"
|
|
32
|
-
}
|
|
33
|
-
];
|
|
34
378
|
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" }];
|
|
35
379
|
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" }];
|
|
36
380
|
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" }];
|
|
@@ -684,135 +1028,41 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
684
1028
|
{
|
|
685
1029
|
"internalType": "address",
|
|
686
1030
|
"name": "admin",
|
|
687
|
-
"type": "address"
|
|
688
|
-
}
|
|
689
|
-
],
|
|
690
|
-
"name": "removeAdmin",
|
|
691
|
-
"outputs": [],
|
|
692
|
-
"stateMutability": "nonpayable",
|
|
693
|
-
"type": "function"
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
"inputs": [
|
|
697
|
-
{
|
|
698
|
-
"internalType": "address",
|
|
699
|
-
"name": "manager",
|
|
700
|
-
"type": "address"
|
|
701
|
-
}
|
|
702
|
-
],
|
|
703
|
-
"name": "removeManager",
|
|
704
|
-
"outputs": [],
|
|
705
|
-
"stateMutability": "nonpayable",
|
|
706
|
-
"type": "function"
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
"inputs": [
|
|
710
|
-
{
|
|
711
|
-
"internalType": "bytes32",
|
|
712
|
-
"name": "role",
|
|
713
|
-
"type": "bytes32"
|
|
714
|
-
},
|
|
715
|
-
{
|
|
716
|
-
"internalType": "address",
|
|
717
|
-
"name": "callerConfirmation",
|
|
718
|
-
"type": "address"
|
|
719
|
-
}
|
|
720
|
-
],
|
|
721
|
-
"name": "renounceRole",
|
|
722
|
-
"outputs": [],
|
|
723
|
-
"stateMutability": "nonpayable",
|
|
724
|
-
"type": "function"
|
|
725
|
-
},
|
|
726
|
-
{
|
|
727
|
-
"inputs": [
|
|
728
|
-
{
|
|
729
|
-
"internalType": "bytes32",
|
|
730
|
-
"name": "role",
|
|
731
|
-
"type": "bytes32"
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
"internalType": "address",
|
|
735
|
-
"name": "account",
|
|
736
|
-
"type": "address"
|
|
737
|
-
}
|
|
738
|
-
],
|
|
739
|
-
"name": "revokeRole",
|
|
740
|
-
"outputs": [],
|
|
741
|
-
"stateMutability": "nonpayable",
|
|
742
|
-
"type": "function"
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
"inputs": [
|
|
746
|
-
{
|
|
747
|
-
"internalType": "address",
|
|
748
|
-
"name": "_anymalNFTProxy",
|
|
749
|
-
"type": "address"
|
|
750
|
-
}
|
|
751
|
-
],
|
|
752
|
-
"name": "setAnymalNFT",
|
|
753
|
-
"outputs": [],
|
|
754
|
-
"stateMutability": "nonpayable",
|
|
755
|
-
"type": "function"
|
|
756
|
-
},
|
|
757
|
-
{
|
|
758
|
-
"inputs": [
|
|
759
|
-
{
|
|
760
|
-
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
761
|
-
"name": "newStatus",
|
|
762
|
-
"type": "uint8"
|
|
763
|
-
}
|
|
764
|
-
],
|
|
765
|
-
"name": "setStatus",
|
|
766
|
-
"outputs": [],
|
|
767
|
-
"stateMutability": "nonpayable",
|
|
768
|
-
"type": "function"
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
"inputs": [],
|
|
772
|
-
"name": "status",
|
|
773
|
-
"outputs": [
|
|
774
|
-
{
|
|
775
|
-
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
776
|
-
"name": "",
|
|
777
|
-
"type": "uint8"
|
|
778
|
-
}
|
|
779
|
-
],
|
|
780
|
-
"stateMutability": "view",
|
|
781
|
-
"type": "function"
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
"inputs": [
|
|
785
|
-
{
|
|
786
|
-
"internalType": "bytes4",
|
|
787
|
-
"name": "interfaceId",
|
|
788
|
-
"type": "bytes4"
|
|
789
|
-
}
|
|
790
|
-
],
|
|
791
|
-
"name": "supportsInterface",
|
|
792
|
-
"outputs": [
|
|
793
|
-
{
|
|
794
|
-
"internalType": "bool",
|
|
795
|
-
"name": "",
|
|
796
|
-
"type": "bool"
|
|
1031
|
+
"type": "address"
|
|
797
1032
|
}
|
|
798
1033
|
],
|
|
799
|
-
"
|
|
1034
|
+
"name": "removeAdmin",
|
|
1035
|
+
"outputs": [],
|
|
1036
|
+
"stateMutability": "nonpayable",
|
|
800
1037
|
"type": "function"
|
|
801
1038
|
},
|
|
802
1039
|
{
|
|
803
1040
|
"inputs": [
|
|
804
1041
|
{
|
|
805
1042
|
"internalType": "address",
|
|
806
|
-
"name": "
|
|
1043
|
+
"name": "manager",
|
|
807
1044
|
"type": "address"
|
|
1045
|
+
}
|
|
1046
|
+
],
|
|
1047
|
+
"name": "removeManager",
|
|
1048
|
+
"outputs": [],
|
|
1049
|
+
"stateMutability": "nonpayable",
|
|
1050
|
+
"type": "function"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"inputs": [
|
|
1054
|
+
{
|
|
1055
|
+
"internalType": "bytes32",
|
|
1056
|
+
"name": "role",
|
|
1057
|
+
"type": "bytes32"
|
|
808
1058
|
},
|
|
809
1059
|
{
|
|
810
|
-
"internalType": "
|
|
811
|
-
"name": "
|
|
812
|
-
"type": "
|
|
1060
|
+
"internalType": "address",
|
|
1061
|
+
"name": "callerConfirmation",
|
|
1062
|
+
"type": "address"
|
|
813
1063
|
}
|
|
814
1064
|
],
|
|
815
|
-
"name": "
|
|
1065
|
+
"name": "renounceRole",
|
|
816
1066
|
"outputs": [],
|
|
817
1067
|
"stateMutability": "nonpayable",
|
|
818
1068
|
"type": "function"
|
|
@@ -820,12 +1070,17 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
820
1070
|
{
|
|
821
1071
|
"inputs": [
|
|
822
1072
|
{
|
|
823
|
-
"internalType": "
|
|
824
|
-
"name": "
|
|
825
|
-
"type": "
|
|
1073
|
+
"internalType": "bytes32",
|
|
1074
|
+
"name": "role",
|
|
1075
|
+
"type": "bytes32"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"internalType": "address",
|
|
1079
|
+
"name": "account",
|
|
1080
|
+
"type": "address"
|
|
826
1081
|
}
|
|
827
1082
|
],
|
|
828
|
-
"name": "
|
|
1083
|
+
"name": "revokeRole",
|
|
829
1084
|
"outputs": [],
|
|
830
1085
|
"stateMutability": "nonpayable",
|
|
831
1086
|
"type": "function"
|
|
@@ -833,392 +1088,108 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
833
1088
|
{
|
|
834
1089
|
"inputs": [
|
|
835
1090
|
{
|
|
836
|
-
"internalType": "
|
|
837
|
-
"name": "
|
|
838
|
-
"type": "
|
|
1091
|
+
"internalType": "address",
|
|
1092
|
+
"name": "_anymalNFTProxy",
|
|
1093
|
+
"type": "address"
|
|
839
1094
|
}
|
|
840
1095
|
],
|
|
841
|
-
"name": "
|
|
1096
|
+
"name": "setAnymalNFT",
|
|
842
1097
|
"outputs": [],
|
|
843
1098
|
"stateMutability": "nonpayable",
|
|
844
1099
|
"type": "function"
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
if (!dbAuthToken || !bundlerClient || !smartAccount || !accountRewardsContractAddress || !pid) {
|
|
853
|
-
return {
|
|
854
|
-
success: false,
|
|
855
|
-
message: "Missing crucial information"
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
const callData = encodeFunctionData({
|
|
859
|
-
abi: VERIFY_ACCOUNT_ABI,
|
|
860
|
-
functionName: "claimRewardByName",
|
|
861
|
-
args: [campaignId, pid]
|
|
862
|
-
});
|
|
863
|
-
try {
|
|
864
|
-
const userOpHash = await bundlerClient.sendUserOperation({
|
|
865
|
-
account: smartAccount,
|
|
866
|
-
calls: [
|
|
867
|
-
{
|
|
868
|
-
to: accountRewardsContractAddress,
|
|
869
|
-
data: callData
|
|
870
|
-
}
|
|
871
|
-
],
|
|
872
|
-
maxPriorityFeePerGas: parseGwei("0.001")
|
|
873
|
-
});
|
|
874
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
875
|
-
hash: userOpHash,
|
|
876
|
-
timeout: 3e4,
|
|
877
|
-
retryCount: 10
|
|
878
|
-
});
|
|
879
|
-
return { success: true, message: "Registration kibble awarded" };
|
|
880
|
-
} catch (error) {
|
|
881
|
-
console.error(error);
|
|
882
|
-
return { success: false, message: error.message };
|
|
883
|
-
}
|
|
884
|
-
},
|
|
885
|
-
[]
|
|
886
|
-
);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
// src/utils/account/useVerifyWeb3AuthSession.ts
|
|
890
|
-
import { useCallback as useCallback2 } from "react";
|
|
891
|
-
function useVerifyWeb3AuthSession() {
|
|
892
|
-
return useCallback2(
|
|
893
|
-
async (idToken, publicKey, authServiceBaseUrl) => {
|
|
894
|
-
const response = await fetch(
|
|
895
|
-
`${authServiceBaseUrl}/verify-web3-session`,
|
|
896
|
-
{
|
|
897
|
-
method: "POST",
|
|
898
|
-
headers: {
|
|
899
|
-
"Content-Type": "application/json",
|
|
900
|
-
Authorization: "Bearer " + idToken
|
|
901
|
-
},
|
|
902
|
-
body: JSON.stringify({ appPubKey: publicKey })
|
|
903
|
-
}
|
|
904
|
-
);
|
|
905
|
-
const { jwt } = await response.json();
|
|
906
|
-
return jwt;
|
|
907
|
-
},
|
|
908
|
-
[]
|
|
909
|
-
);
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
// src/utils/account/useCreateWeb3Account.ts
|
|
913
|
-
import { useCallback as useCallback3 } from "react";
|
|
914
|
-
function useCreateWeb3Account() {
|
|
915
|
-
return useCallback3(
|
|
916
|
-
async (idToken, publicKey, userPid, authServiceBaseUrl) => {
|
|
917
|
-
try {
|
|
918
|
-
const response = await fetch(`${authServiceBaseUrl}/create-account`, {
|
|
919
|
-
method: "POST",
|
|
920
|
-
headers: {
|
|
921
|
-
"Content-Type": "application/json",
|
|
922
|
-
Authorization: "Bearer " + idToken
|
|
923
|
-
},
|
|
924
|
-
body: JSON.stringify({ appPubKey: publicKey, pid: userPid })
|
|
925
|
-
});
|
|
926
|
-
return await response.json();
|
|
927
|
-
} catch (error) {
|
|
928
|
-
console.error(error);
|
|
929
|
-
return null;
|
|
930
|
-
}
|
|
931
|
-
},
|
|
932
|
-
[]
|
|
933
|
-
);
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
// src/utils/account/useFetchUserData.ts
|
|
937
|
-
import { useCallback as useCallback4 } from "react";
|
|
938
|
-
function useFetchUserData() {
|
|
939
|
-
return useCallback4(async (dbAuthToken, endpoint) => {
|
|
940
|
-
try {
|
|
941
|
-
const query = `
|
|
942
|
-
query User {
|
|
943
|
-
User {
|
|
944
|
-
_docID
|
|
945
|
-
pid
|
|
946
|
-
email
|
|
947
|
-
name
|
|
948
|
-
isVerified
|
|
949
|
-
showTooltips
|
|
950
|
-
accountType
|
|
951
|
-
baseWalletAddress
|
|
952
|
-
stripeCustomerId
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
`;
|
|
956
|
-
const response = await fetch(endpoint, {
|
|
957
|
-
method: "POST",
|
|
958
|
-
headers: {
|
|
959
|
-
"Content-Type": "application/json",
|
|
960
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
961
|
-
},
|
|
962
|
-
body: JSON.stringify({ query })
|
|
963
|
-
});
|
|
964
|
-
if (!response.ok) {
|
|
965
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
966
|
-
}
|
|
967
|
-
const data = await response.json();
|
|
968
|
-
if (data && data.data && data.data.User && data.data.User.length > 0) {
|
|
969
|
-
return data.data.User[0];
|
|
970
|
-
} else {
|
|
971
|
-
return null;
|
|
972
|
-
}
|
|
973
|
-
} catch (error) {
|
|
974
|
-
console.error("Error fetching user data:", error);
|
|
975
|
-
return null;
|
|
976
|
-
}
|
|
977
|
-
}, []);
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
// src/utils/account/useUpdateUserEmail.ts
|
|
981
|
-
import { useCallback as useCallback5 } from "react";
|
|
982
|
-
function useUpdateUserEmail() {
|
|
983
|
-
return useCallback5(
|
|
984
|
-
async (dbAuthToken, docID, email, endpoint) => {
|
|
985
|
-
try {
|
|
986
|
-
const mutation = `
|
|
987
|
-
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
988
|
-
update_User(docID: $docID, input: $input) {
|
|
989
|
-
email
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
`;
|
|
993
|
-
const variables = {
|
|
994
|
-
docID: [docID],
|
|
995
|
-
input: {
|
|
996
|
-
email
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
const response = await fetch(endpoint, {
|
|
1000
|
-
method: "POST",
|
|
1001
|
-
headers: {
|
|
1002
|
-
"Content-Type": "application/json",
|
|
1003
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1004
|
-
},
|
|
1005
|
-
body: JSON.stringify({
|
|
1006
|
-
query: mutation,
|
|
1007
|
-
variables
|
|
1008
|
-
})
|
|
1009
|
-
});
|
|
1010
|
-
if (!response.ok) {
|
|
1011
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1012
|
-
}
|
|
1013
|
-
} catch (error) {
|
|
1014
|
-
console.error("Error updating email:", error);
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
[]
|
|
1018
|
-
);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
// src/utils/account/useUpdateUserPid.ts
|
|
1022
|
-
import { useCallback as useCallback6 } from "react";
|
|
1023
|
-
function useUpdateUserPid() {
|
|
1024
|
-
return useCallback6(
|
|
1025
|
-
async (dbAuthToken, docID, pid, endpoint) => {
|
|
1026
|
-
try {
|
|
1027
|
-
const mutation = `
|
|
1028
|
-
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
1029
|
-
update_User(docID: $docID, input: $input) {
|
|
1030
|
-
pid
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
`;
|
|
1034
|
-
const variables = {
|
|
1035
|
-
docID: [docID],
|
|
1036
|
-
input: {
|
|
1037
|
-
pid
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
const response = await fetch(endpoint, {
|
|
1041
|
-
method: "POST",
|
|
1042
|
-
headers: {
|
|
1043
|
-
"Content-Type": "application/json",
|
|
1044
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1045
|
-
},
|
|
1046
|
-
body: JSON.stringify({
|
|
1047
|
-
query: mutation,
|
|
1048
|
-
variables
|
|
1049
|
-
})
|
|
1050
|
-
});
|
|
1051
|
-
if (!response.ok) {
|
|
1052
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1053
|
-
}
|
|
1054
|
-
} catch (error) {
|
|
1055
|
-
console.error("Error updating email:", error);
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
"inputs": [
|
|
1103
|
+
{
|
|
1104
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1105
|
+
"name": "newStatus",
|
|
1106
|
+
"type": "uint8"
|
|
1056
1107
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
update_User(docID: $docID, input: $input) {
|
|
1072
|
-
isVerified
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
`;
|
|
1076
|
-
const variables = {
|
|
1077
|
-
docID: [docID],
|
|
1078
|
-
input: {
|
|
1079
|
-
isVerified: true
|
|
1080
|
-
}
|
|
1081
|
-
};
|
|
1082
|
-
const response = await fetch(endpoint, {
|
|
1083
|
-
method: "POST",
|
|
1084
|
-
headers: {
|
|
1085
|
-
"Content-Type": "application/json",
|
|
1086
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1087
|
-
},
|
|
1088
|
-
body: JSON.stringify({
|
|
1089
|
-
query: mutation,
|
|
1090
|
-
variables
|
|
1091
|
-
})
|
|
1092
|
-
});
|
|
1093
|
-
const responseMessage = response.ok ? "Your account has been verified!" : "An error has occured, try again.";
|
|
1094
|
-
return { success: response.ok, message: responseMessage };
|
|
1095
|
-
} catch (error) {
|
|
1096
|
-
return { success: false, message: error.message };
|
|
1108
|
+
],
|
|
1109
|
+
"name": "setStatus",
|
|
1110
|
+
"outputs": [],
|
|
1111
|
+
"stateMutability": "nonpayable",
|
|
1112
|
+
"type": "function"
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
"inputs": [],
|
|
1116
|
+
"name": "status",
|
|
1117
|
+
"outputs": [
|
|
1118
|
+
{
|
|
1119
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1120
|
+
"name": "",
|
|
1121
|
+
"type": "uint8"
|
|
1097
1122
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
1109
|
-
return { success: false };
|
|
1123
|
+
],
|
|
1124
|
+
"stateMutability": "view",
|
|
1125
|
+
"type": "function"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
"inputs": [
|
|
1129
|
+
{
|
|
1130
|
+
"internalType": "bytes4",
|
|
1131
|
+
"name": "interfaceId",
|
|
1132
|
+
"type": "bytes4"
|
|
1110
1133
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
`;
|
|
1119
|
-
const variables = {
|
|
1120
|
-
docID: [docID],
|
|
1121
|
-
input: {
|
|
1122
|
-
name
|
|
1123
|
-
}
|
|
1124
|
-
};
|
|
1125
|
-
const response = await fetch(endpoint, {
|
|
1126
|
-
method: "POST",
|
|
1127
|
-
headers: {
|
|
1128
|
-
"Content-Type": "application/json",
|
|
1129
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1130
|
-
},
|
|
1131
|
-
body: JSON.stringify({
|
|
1132
|
-
query: mutation,
|
|
1133
|
-
variables
|
|
1134
|
-
})
|
|
1135
|
-
});
|
|
1136
|
-
if (!response.ok) {
|
|
1137
|
-
return { success: false };
|
|
1138
|
-
}
|
|
1139
|
-
return { success: true };
|
|
1140
|
-
} catch (error) {
|
|
1141
|
-
console.error("Error updating name:", error);
|
|
1142
|
-
return { success: false };
|
|
1134
|
+
],
|
|
1135
|
+
"name": "supportsInterface",
|
|
1136
|
+
"outputs": [
|
|
1137
|
+
{
|
|
1138
|
+
"internalType": "bool",
|
|
1139
|
+
"name": "",
|
|
1140
|
+
"type": "bool"
|
|
1143
1141
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1142
|
+
],
|
|
1143
|
+
"stateMutability": "view",
|
|
1144
|
+
"type": "function"
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"inputs": [
|
|
1148
|
+
{
|
|
1149
|
+
"internalType": "address",
|
|
1150
|
+
"name": "to",
|
|
1151
|
+
"type": "address"
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
"internalType": "uint256",
|
|
1155
|
+
"name": "tokenId",
|
|
1156
|
+
"type": "uint256"
|
|
1156
1157
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
pid
|
|
1170
|
-
read
|
|
1171
|
-
tags
|
|
1172
|
-
text
|
|
1173
|
-
title
|
|
1174
|
-
timeAddedUtc
|
|
1175
|
-
timeUpdatedUtc
|
|
1176
|
-
type
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
`;
|
|
1181
|
-
const filter = {
|
|
1182
|
-
pid: {
|
|
1183
|
-
_eq: pid
|
|
1184
|
-
},
|
|
1185
|
-
...additionalFilters || {}
|
|
1186
|
-
};
|
|
1187
|
-
const order = [
|
|
1188
|
-
{
|
|
1189
|
-
timeAddedUtc: "DESC"
|
|
1190
|
-
}
|
|
1191
|
-
];
|
|
1192
|
-
const groupBy = ["anymalTxId", "title"];
|
|
1193
|
-
const variables = { filter, groupBy, order };
|
|
1194
|
-
const response = await fetch(endpoint, {
|
|
1195
|
-
method: "POST",
|
|
1196
|
-
headers: {
|
|
1197
|
-
"Content-Type": "application/json",
|
|
1198
|
-
Authorization: `Bearer ${dbAuthToken}`
|
|
1199
|
-
},
|
|
1200
|
-
body: JSON.stringify({ query, variables })
|
|
1201
|
-
});
|
|
1202
|
-
if (!response.ok) {
|
|
1203
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
1204
|
-
}
|
|
1205
|
-
const data = await response.json();
|
|
1206
|
-
if (data?.data?.AnymalNotification?.length > 0) {
|
|
1207
|
-
return data.data.AnymalNotification;
|
|
1208
|
-
} else {
|
|
1209
|
-
return null;
|
|
1210
|
-
}
|
|
1211
|
-
} catch (error) {
|
|
1212
|
-
console.error("Error fetching notifications:", error);
|
|
1213
|
-
return null;
|
|
1158
|
+
],
|
|
1159
|
+
"name": "transferAnymal",
|
|
1160
|
+
"outputs": [],
|
|
1161
|
+
"stateMutability": "nonpayable",
|
|
1162
|
+
"type": "function"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"inputs": [
|
|
1166
|
+
{
|
|
1167
|
+
"internalType": "string",
|
|
1168
|
+
"name": "newOrgName",
|
|
1169
|
+
"type": "string"
|
|
1214
1170
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1171
|
+
],
|
|
1172
|
+
"name": "updateMetadata",
|
|
1173
|
+
"outputs": [],
|
|
1174
|
+
"stateMutability": "nonpayable",
|
|
1175
|
+
"type": "function"
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
"inputs": [
|
|
1179
|
+
{
|
|
1180
|
+
"internalType": "string",
|
|
1181
|
+
"name": "pid",
|
|
1182
|
+
"type": "string"
|
|
1183
|
+
}
|
|
1184
|
+
],
|
|
1185
|
+
"name": "updatePid",
|
|
1186
|
+
"outputs": [],
|
|
1187
|
+
"stateMutability": "nonpayable",
|
|
1188
|
+
"type": "function"
|
|
1189
|
+
}
|
|
1190
|
+
];
|
|
1219
1191
|
|
|
1220
1192
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1221
|
-
import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
|
|
1222
1193
|
import { useCallback as useCallback10 } from "react";
|
|
1223
1194
|
function useMintAnymalNFT() {
|
|
1224
1195
|
return useCallback10(
|
|
@@ -1229,7 +1200,7 @@ function useMintAnymalNFT() {
|
|
|
1229
1200
|
message: "Missing authentication token OR NFT ID."
|
|
1230
1201
|
};
|
|
1231
1202
|
}
|
|
1232
|
-
const callData =
|
|
1203
|
+
const callData = encodeFunctionData({
|
|
1233
1204
|
abi: PET_NFT_ABI,
|
|
1234
1205
|
functionName: "submitMetadataByCampaignName",
|
|
1235
1206
|
args: [
|
|
@@ -1248,7 +1219,7 @@ function useMintAnymalNFT() {
|
|
|
1248
1219
|
data: callData
|
|
1249
1220
|
}
|
|
1250
1221
|
],
|
|
1251
|
-
maxPriorityFeePerGas:
|
|
1222
|
+
maxPriorityFeePerGas: parseGwei("0.001")
|
|
1252
1223
|
});
|
|
1253
1224
|
await bundlerClient.waitForUserOperationReceipt({
|
|
1254
1225
|
hash: userOpHash,
|
|
@@ -1626,7 +1597,7 @@ function useFetchAnymals() {
|
|
|
1626
1597
|
}
|
|
1627
1598
|
|
|
1628
1599
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
1629
|
-
import { encodeFunctionData as
|
|
1600
|
+
import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
|
|
1630
1601
|
import { useCallback as useCallback17 } from "react";
|
|
1631
1602
|
function useProcessPartialKibblePayment() {
|
|
1632
1603
|
return useCallback17(
|
|
@@ -1656,7 +1627,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1656
1627
|
// bytes
|
|
1657
1628
|
];
|
|
1658
1629
|
console.info({ args });
|
|
1659
|
-
const callData =
|
|
1630
|
+
const callData = encodeFunctionData2({
|
|
1660
1631
|
abi: MARKETPLACE_ABI,
|
|
1661
1632
|
functionName: "partialPay",
|
|
1662
1633
|
args
|
|
@@ -1669,7 +1640,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1669
1640
|
data: callData
|
|
1670
1641
|
}
|
|
1671
1642
|
],
|
|
1672
|
-
maxPriorityFeePerGas:
|
|
1643
|
+
maxPriorityFeePerGas: parseGwei2("0.001")
|
|
1673
1644
|
});
|
|
1674
1645
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
1675
1646
|
hash: userOpHash,
|
|
@@ -1690,13 +1661,13 @@ function useProcessPartialKibblePayment() {
|
|
|
1690
1661
|
}
|
|
1691
1662
|
|
|
1692
1663
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
1693
|
-
import { encodeFunctionData as
|
|
1664
|
+
import { encodeFunctionData as encodeFunctionData3, erc20Abi, parseGwei as parseGwei3 } from "viem";
|
|
1694
1665
|
import { useCallback as useCallback18 } from "react";
|
|
1695
1666
|
function useApproveKibbleToken() {
|
|
1696
1667
|
return useCallback18(
|
|
1697
1668
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
1698
1669
|
try {
|
|
1699
|
-
const callData =
|
|
1670
|
+
const callData = encodeFunctionData3({
|
|
1700
1671
|
abi: erc20Abi,
|
|
1701
1672
|
functionName: "approve",
|
|
1702
1673
|
args: [
|
|
@@ -1715,7 +1686,7 @@ function useApproveKibbleToken() {
|
|
|
1715
1686
|
data: callData
|
|
1716
1687
|
}
|
|
1717
1688
|
],
|
|
1718
|
-
maxPriorityFeePerGas:
|
|
1689
|
+
maxPriorityFeePerGas: parseGwei3("0.001")
|
|
1719
1690
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1720
1691
|
});
|
|
1721
1692
|
console.log("sendUserOperation has been called");
|
|
@@ -1744,7 +1715,7 @@ function useApproveKibbleToken() {
|
|
|
1744
1715
|
|
|
1745
1716
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
1746
1717
|
import { useCallback as useCallback19 } from "react";
|
|
1747
|
-
import { decodeEventLog, encodeFunctionData as
|
|
1718
|
+
import { decodeEventLog, encodeFunctionData as encodeFunctionData4, parseGwei as parseGwei4 } from "viem";
|
|
1748
1719
|
function useCreateOrganizationBase() {
|
|
1749
1720
|
return useCallback19(
|
|
1750
1721
|
/**
|
|
@@ -1766,7 +1737,7 @@ function useCreateOrganizationBase() {
|
|
|
1766
1737
|
};
|
|
1767
1738
|
}
|
|
1768
1739
|
try {
|
|
1769
|
-
const callData =
|
|
1740
|
+
const callData = encodeFunctionData4({
|
|
1770
1741
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1771
1742
|
functionName: "createOrganizationProxy",
|
|
1772
1743
|
args: [ownerAddress, orgName, orgPid]
|
|
@@ -1779,9 +1750,9 @@ function useCreateOrganizationBase() {
|
|
|
1779
1750
|
data: callData
|
|
1780
1751
|
}
|
|
1781
1752
|
],
|
|
1782
|
-
maxPriorityFeePerGas:
|
|
1753
|
+
maxPriorityFeePerGas: parseGwei4("0.001"),
|
|
1783
1754
|
// Low priority fee
|
|
1784
|
-
maxFeePerGas:
|
|
1755
|
+
maxFeePerGas: parseGwei4("0.025")
|
|
1785
1756
|
// Max fee cap
|
|
1786
1757
|
});
|
|
1787
1758
|
const txReceipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -1833,7 +1804,7 @@ function useCreateOrganizationBase() {
|
|
|
1833
1804
|
|
|
1834
1805
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
1835
1806
|
import { useCallback as useCallback20 } from "react";
|
|
1836
|
-
import { encodeFunctionData as
|
|
1807
|
+
import { encodeFunctionData as encodeFunctionData5, erc20Abi as erc20Abi2, parseGwei as parseGwei5 } from "viem";
|
|
1837
1808
|
function useApproveOrgPartialPayment() {
|
|
1838
1809
|
return useCallback20(
|
|
1839
1810
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
@@ -1844,12 +1815,12 @@ function useApproveOrgPartialPayment() {
|
|
|
1844
1815
|
};
|
|
1845
1816
|
}
|
|
1846
1817
|
try {
|
|
1847
|
-
const approveCalldata =
|
|
1818
|
+
const approveCalldata = encodeFunctionData5({
|
|
1848
1819
|
abi: erc20Abi2,
|
|
1849
1820
|
functionName: "approve",
|
|
1850
1821
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
1851
1822
|
});
|
|
1852
|
-
const executeApproveCalldata =
|
|
1823
|
+
const executeApproveCalldata = encodeFunctionData5({
|
|
1853
1824
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1854
1825
|
functionName: "executeCall",
|
|
1855
1826
|
args: [kibbleTokenAddress, approveCalldata]
|
|
@@ -1862,7 +1833,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1862
1833
|
data: executeApproveCalldata
|
|
1863
1834
|
}
|
|
1864
1835
|
],
|
|
1865
|
-
maxPriorityFeePerGas:
|
|
1836
|
+
maxPriorityFeePerGas: parseGwei5("0.001")
|
|
1866
1837
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1867
1838
|
});
|
|
1868
1839
|
await bundlerClient.waitForUserOperationReceipt({ hash: userOpApproveHash });
|
|
@@ -1878,7 +1849,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1878
1849
|
|
|
1879
1850
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
1880
1851
|
import { useCallback as useCallback21 } from "react";
|
|
1881
|
-
import { encodeFunctionData as
|
|
1852
|
+
import { encodeFunctionData as encodeFunctionData6, parseGwei as parseGwei6 } from "viem";
|
|
1882
1853
|
function useProcessOrgPartialKibblePayment() {
|
|
1883
1854
|
return useCallback21(
|
|
1884
1855
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
@@ -1889,7 +1860,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1889
1860
|
};
|
|
1890
1861
|
}
|
|
1891
1862
|
try {
|
|
1892
|
-
const partialPayCalldata =
|
|
1863
|
+
const partialPayCalldata = encodeFunctionData6({
|
|
1893
1864
|
abi: MARKETPLACE_ABI,
|
|
1894
1865
|
functionName: "partialPay",
|
|
1895
1866
|
args: [
|
|
@@ -1903,7 +1874,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1903
1874
|
backendSignature
|
|
1904
1875
|
]
|
|
1905
1876
|
});
|
|
1906
|
-
const executePartialPayCalldata =
|
|
1877
|
+
const executePartialPayCalldata = encodeFunctionData6({
|
|
1907
1878
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1908
1879
|
functionName: "executeCall",
|
|
1909
1880
|
args: [partialPaymentModuleAddress, partialPayCalldata]
|
|
@@ -1916,7 +1887,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1916
1887
|
data: executePartialPayCalldata
|
|
1917
1888
|
}
|
|
1918
1889
|
],
|
|
1919
|
-
maxPriorityFeePerGas:
|
|
1890
|
+
maxPriorityFeePerGas: parseGwei6("0.001")
|
|
1920
1891
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1921
1892
|
});
|
|
1922
1893
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -2272,7 +2243,7 @@ function useFetchBalance() {
|
|
|
2272
2243
|
}
|
|
2273
2244
|
|
|
2274
2245
|
// src/utils/actions/useClaimActionReward.ts
|
|
2275
|
-
import { encodeFunctionData as
|
|
2246
|
+
import { encodeFunctionData as encodeFunctionData7, parseGwei as parseGwei7 } from "viem";
|
|
2276
2247
|
import { useCallback as useCallback28 } from "react";
|
|
2277
2248
|
function useClaimActionReward() {
|
|
2278
2249
|
return useCallback28(
|
|
@@ -2283,7 +2254,7 @@ function useClaimActionReward() {
|
|
|
2283
2254
|
message: "Missing web3auth account info or contract address."
|
|
2284
2255
|
};
|
|
2285
2256
|
}
|
|
2286
|
-
const callData =
|
|
2257
|
+
const callData = encodeFunctionData7({
|
|
2287
2258
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2288
2259
|
functionName: "claimByIndex",
|
|
2289
2260
|
args: [actionId, claimIndex]
|
|
@@ -2296,7 +2267,7 @@ function useClaimActionReward() {
|
|
|
2296
2267
|
data: callData
|
|
2297
2268
|
}
|
|
2298
2269
|
],
|
|
2299
|
-
maxPriorityFeePerGas:
|
|
2270
|
+
maxPriorityFeePerGas: parseGwei7("0.001")
|
|
2300
2271
|
});
|
|
2301
2272
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2302
2273
|
hash: userOpHash,
|
|
@@ -2310,7 +2281,7 @@ function useClaimActionReward() {
|
|
|
2310
2281
|
}
|
|
2311
2282
|
|
|
2312
2283
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2313
|
-
import { encodeFunctionData as
|
|
2284
|
+
import { encodeFunctionData as encodeFunctionData8, parseGwei as parseGwei8 } from "viem";
|
|
2314
2285
|
import { useCallback as useCallback29 } from "react";
|
|
2315
2286
|
function useClaimOrgActionReward() {
|
|
2316
2287
|
return useCallback29(
|
|
@@ -2321,12 +2292,12 @@ function useClaimOrgActionReward() {
|
|
|
2321
2292
|
message: "Missing web3auth account info or contract address."
|
|
2322
2293
|
};
|
|
2323
2294
|
}
|
|
2324
|
-
const claimCallData =
|
|
2295
|
+
const claimCallData = encodeFunctionData8({
|
|
2325
2296
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2326
2297
|
functionName: "claimByIndex",
|
|
2327
2298
|
args: [actionId, claimIndex]
|
|
2328
2299
|
});
|
|
2329
|
-
const executeClaimCalldata =
|
|
2300
|
+
const executeClaimCalldata = encodeFunctionData8({
|
|
2330
2301
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2331
2302
|
functionName: "executeCall",
|
|
2332
2303
|
args: [rewardableActionContractAddress, claimCallData]
|
|
@@ -2339,7 +2310,7 @@ function useClaimOrgActionReward() {
|
|
|
2339
2310
|
data: executeClaimCalldata
|
|
2340
2311
|
}
|
|
2341
2312
|
],
|
|
2342
|
-
maxPriorityFeePerGas:
|
|
2313
|
+
maxPriorityFeePerGas: parseGwei8("0.001")
|
|
2343
2314
|
});
|
|
2344
2315
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2345
2316
|
hash: userOpHash,
|
|
@@ -2360,6 +2331,7 @@ function useSubmitContractAction() {
|
|
|
2360
2331
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2361
2332
|
let sourceTypePayload = {};
|
|
2362
2333
|
const basisType = {
|
|
2334
|
+
campaignId: payload.campaignId,
|
|
2363
2335
|
actionId: payload.actionId,
|
|
2364
2336
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2365
2337
|
nonce: crypto.randomUUID(),
|