anymal-protocol 1.0.89 → 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 +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +496 -531
- package/dist/index.mjs +494 -529
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,26 +11,363 @@ 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
|
+
}
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
const variables = {
|
|
223
|
+
docID: [docID],
|
|
224
|
+
input: {
|
|
225
|
+
isVerified: true
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const response = await fetch(endpoint, {
|
|
229
|
+
method: "POST",
|
|
230
|
+
headers: {
|
|
231
|
+
"Content-Type": "application/json",
|
|
232
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
233
|
+
},
|
|
234
|
+
body: JSON.stringify({
|
|
235
|
+
query: mutation,
|
|
236
|
+
variables
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
const responseMessage = response.ok ? "Your account has been verified!" : "An error has occured, try again.";
|
|
240
|
+
return { success: response.ok, message: responseMessage };
|
|
241
|
+
} catch (error) {
|
|
242
|
+
return { success: false, message: error.message };
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
[]
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/utils/account/useUpdateUserName.ts
|
|
250
|
+
import { useCallback as useCallback8 } from "react";
|
|
251
|
+
function useUpdateUserName() {
|
|
252
|
+
return useCallback8(
|
|
253
|
+
async (dbAuthToken, docID, name, endpoint) => {
|
|
254
|
+
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
255
|
+
return { success: false };
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
const mutation = `
|
|
259
|
+
mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
|
|
260
|
+
update_User(docID: $docID, input: $input) {
|
|
261
|
+
name
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
`;
|
|
265
|
+
const variables = {
|
|
266
|
+
docID: [docID],
|
|
267
|
+
input: {
|
|
268
|
+
name
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const response = await fetch(endpoint, {
|
|
272
|
+
method: "POST",
|
|
273
|
+
headers: {
|
|
274
|
+
"Content-Type": "application/json",
|
|
275
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
276
|
+
},
|
|
277
|
+
body: JSON.stringify({
|
|
278
|
+
query: mutation,
|
|
279
|
+
variables
|
|
280
|
+
})
|
|
281
|
+
});
|
|
282
|
+
if (!response.ok) {
|
|
283
|
+
return { success: false };
|
|
284
|
+
}
|
|
285
|
+
return { success: true };
|
|
286
|
+
} catch (error) {
|
|
287
|
+
console.error("Error updating name:", error);
|
|
288
|
+
return { success: false };
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
[]
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/utils/account/useFetchNotifications.ts
|
|
296
|
+
import { useCallback as useCallback9 } from "react";
|
|
297
|
+
function useFetchNotifications() {
|
|
298
|
+
return useCallback9(
|
|
299
|
+
async (pid, dbAuthToken, endpoint, additionalFilters) => {
|
|
300
|
+
if (!pid) {
|
|
301
|
+
throw new Error("The 'pid' field is required.");
|
|
302
|
+
}
|
|
303
|
+
try {
|
|
304
|
+
const query = `
|
|
305
|
+
query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg, $order: [AnymalNotificationOrderArg]) {
|
|
306
|
+
AnymalNotification(groupBy: $groupBy, filter: $filter, order: $order) {
|
|
307
|
+
anymalTxId
|
|
308
|
+
title
|
|
309
|
+
_group {
|
|
310
|
+
_docID
|
|
311
|
+
source
|
|
312
|
+
action
|
|
313
|
+
anymalTxId
|
|
314
|
+
id
|
|
315
|
+
pid
|
|
316
|
+
read
|
|
317
|
+
tags
|
|
318
|
+
text
|
|
319
|
+
title
|
|
320
|
+
timeAddedUtc
|
|
321
|
+
timeUpdatedUtc
|
|
322
|
+
type
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
`;
|
|
327
|
+
const filter = {
|
|
328
|
+
pid: {
|
|
329
|
+
_eq: pid
|
|
330
|
+
},
|
|
331
|
+
...additionalFilters || {}
|
|
332
|
+
};
|
|
333
|
+
const order = [
|
|
334
|
+
{
|
|
335
|
+
timeAddedUtc: "DESC"
|
|
336
|
+
}
|
|
337
|
+
];
|
|
338
|
+
const groupBy = ["anymalTxId", "title"];
|
|
339
|
+
const variables = { filter, groupBy, order };
|
|
340
|
+
const response = await fetch(endpoint, {
|
|
341
|
+
method: "POST",
|
|
342
|
+
headers: {
|
|
343
|
+
"Content-Type": "application/json",
|
|
344
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
345
|
+
},
|
|
346
|
+
body: JSON.stringify({ query, variables })
|
|
347
|
+
});
|
|
348
|
+
if (!response.ok) {
|
|
349
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
350
|
+
}
|
|
351
|
+
const data = await response.json();
|
|
352
|
+
if (data?.data?.AnymalNotification?.length > 0) {
|
|
353
|
+
return data.data.AnymalNotification;
|
|
354
|
+
} else {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
} catch (error) {
|
|
358
|
+
console.error("Error fetching notifications:", error);
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
[]
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
14
367
|
import { encodeFunctionData, parseGwei } from "viem";
|
|
15
368
|
|
|
16
369
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
17
370
|
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
371
|
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
372
|
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
373
|
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" }];
|
|
@@ -692,127 +1029,33 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
692
1029
|
"stateMutability": "nonpayable",
|
|
693
1030
|
"type": "function"
|
|
694
1031
|
},
|
|
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": [
|
|
1032
|
+
{
|
|
1033
|
+
"inputs": [
|
|
793
1034
|
{
|
|
794
|
-
"internalType": "
|
|
795
|
-
"name": "",
|
|
796
|
-
"type": "
|
|
1035
|
+
"internalType": "address",
|
|
1036
|
+
"name": "manager",
|
|
1037
|
+
"type": "address"
|
|
797
1038
|
}
|
|
798
1039
|
],
|
|
799
|
-
"
|
|
1040
|
+
"name": "removeManager",
|
|
1041
|
+
"outputs": [],
|
|
1042
|
+
"stateMutability": "nonpayable",
|
|
800
1043
|
"type": "function"
|
|
801
1044
|
},
|
|
802
1045
|
{
|
|
803
1046
|
"inputs": [
|
|
804
1047
|
{
|
|
805
|
-
"internalType": "
|
|
806
|
-
"name": "
|
|
807
|
-
"type": "
|
|
1048
|
+
"internalType": "bytes32",
|
|
1049
|
+
"name": "role",
|
|
1050
|
+
"type": "bytes32"
|
|
808
1051
|
},
|
|
809
1052
|
{
|
|
810
|
-
"internalType": "
|
|
811
|
-
"name": "
|
|
812
|
-
"type": "
|
|
1053
|
+
"internalType": "address",
|
|
1054
|
+
"name": "callerConfirmation",
|
|
1055
|
+
"type": "address"
|
|
813
1056
|
}
|
|
814
1057
|
],
|
|
815
|
-
"name": "
|
|
1058
|
+
"name": "renounceRole",
|
|
816
1059
|
"outputs": [],
|
|
817
1060
|
"stateMutability": "nonpayable",
|
|
818
1061
|
"type": "function"
|
|
@@ -820,12 +1063,17 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
820
1063
|
{
|
|
821
1064
|
"inputs": [
|
|
822
1065
|
{
|
|
823
|
-
"internalType": "
|
|
824
|
-
"name": "
|
|
825
|
-
"type": "
|
|
1066
|
+
"internalType": "bytes32",
|
|
1067
|
+
"name": "role",
|
|
1068
|
+
"type": "bytes32"
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
"internalType": "address",
|
|
1072
|
+
"name": "account",
|
|
1073
|
+
"type": "address"
|
|
826
1074
|
}
|
|
827
1075
|
],
|
|
828
|
-
"name": "
|
|
1076
|
+
"name": "revokeRole",
|
|
829
1077
|
"outputs": [],
|
|
830
1078
|
"stateMutability": "nonpayable",
|
|
831
1079
|
"type": "function"
|
|
@@ -833,392 +1081,108 @@ var ORGANIZATION_IMPL_ABI = [
|
|
|
833
1081
|
{
|
|
834
1082
|
"inputs": [
|
|
835
1083
|
{
|
|
836
|
-
"internalType": "
|
|
837
|
-
"name": "
|
|
838
|
-
"type": "
|
|
1084
|
+
"internalType": "address",
|
|
1085
|
+
"name": "_anymalNFTProxy",
|
|
1086
|
+
"type": "address"
|
|
839
1087
|
}
|
|
840
1088
|
],
|
|
841
|
-
"name": "
|
|
1089
|
+
"name": "setAnymalNFT",
|
|
842
1090
|
"outputs": [],
|
|
843
1091
|
"stateMutability": "nonpayable",
|
|
844
1092
|
"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);
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"inputs": [
|
|
1096
|
+
{
|
|
1097
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1098
|
+
"name": "newStatus",
|
|
1099
|
+
"type": "uint8"
|
|
1056
1100
|
}
|
|
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 };
|
|
1101
|
+
],
|
|
1102
|
+
"name": "setStatus",
|
|
1103
|
+
"outputs": [],
|
|
1104
|
+
"stateMutability": "nonpayable",
|
|
1105
|
+
"type": "function"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
"inputs": [],
|
|
1109
|
+
"name": "status",
|
|
1110
|
+
"outputs": [
|
|
1111
|
+
{
|
|
1112
|
+
"internalType": "enum OrganizationImplementation.OrgStatus",
|
|
1113
|
+
"name": "",
|
|
1114
|
+
"type": "uint8"
|
|
1097
1115
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
1109
|
-
return { success: false };
|
|
1116
|
+
],
|
|
1117
|
+
"stateMutability": "view",
|
|
1118
|
+
"type": "function"
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
"inputs": [
|
|
1122
|
+
{
|
|
1123
|
+
"internalType": "bytes4",
|
|
1124
|
+
"name": "interfaceId",
|
|
1125
|
+
"type": "bytes4"
|
|
1110
1126
|
}
|
|
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 };
|
|
1127
|
+
],
|
|
1128
|
+
"name": "supportsInterface",
|
|
1129
|
+
"outputs": [
|
|
1130
|
+
{
|
|
1131
|
+
"internalType": "bool",
|
|
1132
|
+
"name": "",
|
|
1133
|
+
"type": "bool"
|
|
1143
1134
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1135
|
+
],
|
|
1136
|
+
"stateMutability": "view",
|
|
1137
|
+
"type": "function"
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
"inputs": [
|
|
1141
|
+
{
|
|
1142
|
+
"internalType": "address",
|
|
1143
|
+
"name": "to",
|
|
1144
|
+
"type": "address"
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"internalType": "uint256",
|
|
1148
|
+
"name": "tokenId",
|
|
1149
|
+
"type": "uint256"
|
|
1156
1150
|
}
|
|
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;
|
|
1151
|
+
],
|
|
1152
|
+
"name": "transferAnymal",
|
|
1153
|
+
"outputs": [],
|
|
1154
|
+
"stateMutability": "nonpayable",
|
|
1155
|
+
"type": "function"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
"inputs": [
|
|
1159
|
+
{
|
|
1160
|
+
"internalType": "string",
|
|
1161
|
+
"name": "newOrgName",
|
|
1162
|
+
"type": "string"
|
|
1214
1163
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1164
|
+
],
|
|
1165
|
+
"name": "updateMetadata",
|
|
1166
|
+
"outputs": [],
|
|
1167
|
+
"stateMutability": "nonpayable",
|
|
1168
|
+
"type": "function"
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
"inputs": [
|
|
1172
|
+
{
|
|
1173
|
+
"internalType": "string",
|
|
1174
|
+
"name": "pid",
|
|
1175
|
+
"type": "string"
|
|
1176
|
+
}
|
|
1177
|
+
],
|
|
1178
|
+
"name": "updatePid",
|
|
1179
|
+
"outputs": [],
|
|
1180
|
+
"stateMutability": "nonpayable",
|
|
1181
|
+
"type": "function"
|
|
1182
|
+
}
|
|
1183
|
+
];
|
|
1219
1184
|
|
|
1220
1185
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
1221
|
-
import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
|
|
1222
1186
|
import { useCallback as useCallback10 } from "react";
|
|
1223
1187
|
function useMintAnymalNFT() {
|
|
1224
1188
|
return useCallback10(
|
|
@@ -1229,7 +1193,7 @@ function useMintAnymalNFT() {
|
|
|
1229
1193
|
message: "Missing authentication token OR NFT ID."
|
|
1230
1194
|
};
|
|
1231
1195
|
}
|
|
1232
|
-
const callData =
|
|
1196
|
+
const callData = encodeFunctionData({
|
|
1233
1197
|
abi: PET_NFT_ABI,
|
|
1234
1198
|
functionName: "submitMetadataByCampaignName",
|
|
1235
1199
|
args: [
|
|
@@ -1248,7 +1212,7 @@ function useMintAnymalNFT() {
|
|
|
1248
1212
|
data: callData
|
|
1249
1213
|
}
|
|
1250
1214
|
],
|
|
1251
|
-
maxPriorityFeePerGas:
|
|
1215
|
+
maxPriorityFeePerGas: parseGwei("0.001")
|
|
1252
1216
|
});
|
|
1253
1217
|
await bundlerClient.waitForUserOperationReceipt({
|
|
1254
1218
|
hash: userOpHash,
|
|
@@ -1626,7 +1590,7 @@ function useFetchAnymals() {
|
|
|
1626
1590
|
}
|
|
1627
1591
|
|
|
1628
1592
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
1629
|
-
import { encodeFunctionData as
|
|
1593
|
+
import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
|
|
1630
1594
|
import { useCallback as useCallback17 } from "react";
|
|
1631
1595
|
function useProcessPartialKibblePayment() {
|
|
1632
1596
|
return useCallback17(
|
|
@@ -1656,7 +1620,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1656
1620
|
// bytes
|
|
1657
1621
|
];
|
|
1658
1622
|
console.info({ args });
|
|
1659
|
-
const callData =
|
|
1623
|
+
const callData = encodeFunctionData2({
|
|
1660
1624
|
abi: MARKETPLACE_ABI,
|
|
1661
1625
|
functionName: "partialPay",
|
|
1662
1626
|
args
|
|
@@ -1669,7 +1633,7 @@ function useProcessPartialKibblePayment() {
|
|
|
1669
1633
|
data: callData
|
|
1670
1634
|
}
|
|
1671
1635
|
],
|
|
1672
|
-
maxPriorityFeePerGas:
|
|
1636
|
+
maxPriorityFeePerGas: parseGwei2("0.001")
|
|
1673
1637
|
});
|
|
1674
1638
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
1675
1639
|
hash: userOpHash,
|
|
@@ -1690,13 +1654,13 @@ function useProcessPartialKibblePayment() {
|
|
|
1690
1654
|
}
|
|
1691
1655
|
|
|
1692
1656
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
1693
|
-
import { encodeFunctionData as
|
|
1657
|
+
import { encodeFunctionData as encodeFunctionData3, erc20Abi, parseGwei as parseGwei3 } from "viem";
|
|
1694
1658
|
import { useCallback as useCallback18 } from "react";
|
|
1695
1659
|
function useApproveKibbleToken() {
|
|
1696
1660
|
return useCallback18(
|
|
1697
1661
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
1698
1662
|
try {
|
|
1699
|
-
const callData =
|
|
1663
|
+
const callData = encodeFunctionData3({
|
|
1700
1664
|
abi: erc20Abi,
|
|
1701
1665
|
functionName: "approve",
|
|
1702
1666
|
args: [
|
|
@@ -1715,7 +1679,7 @@ function useApproveKibbleToken() {
|
|
|
1715
1679
|
data: callData
|
|
1716
1680
|
}
|
|
1717
1681
|
],
|
|
1718
|
-
maxPriorityFeePerGas:
|
|
1682
|
+
maxPriorityFeePerGas: parseGwei3("0.001")
|
|
1719
1683
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1720
1684
|
});
|
|
1721
1685
|
console.log("sendUserOperation has been called");
|
|
@@ -1744,7 +1708,7 @@ function useApproveKibbleToken() {
|
|
|
1744
1708
|
|
|
1745
1709
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
1746
1710
|
import { useCallback as useCallback19 } from "react";
|
|
1747
|
-
import { decodeEventLog, encodeFunctionData as
|
|
1711
|
+
import { decodeEventLog, encodeFunctionData as encodeFunctionData4, parseGwei as parseGwei4 } from "viem";
|
|
1748
1712
|
function useCreateOrganizationBase() {
|
|
1749
1713
|
return useCallback19(
|
|
1750
1714
|
/**
|
|
@@ -1766,7 +1730,7 @@ function useCreateOrganizationBase() {
|
|
|
1766
1730
|
};
|
|
1767
1731
|
}
|
|
1768
1732
|
try {
|
|
1769
|
-
const callData =
|
|
1733
|
+
const callData = encodeFunctionData4({
|
|
1770
1734
|
abi: ORGANIZATION_BEACON_ABI,
|
|
1771
1735
|
functionName: "createOrganizationProxy",
|
|
1772
1736
|
args: [ownerAddress, orgName, orgPid]
|
|
@@ -1779,9 +1743,9 @@ function useCreateOrganizationBase() {
|
|
|
1779
1743
|
data: callData
|
|
1780
1744
|
}
|
|
1781
1745
|
],
|
|
1782
|
-
maxPriorityFeePerGas:
|
|
1746
|
+
maxPriorityFeePerGas: parseGwei4("0.001"),
|
|
1783
1747
|
// Low priority fee
|
|
1784
|
-
maxFeePerGas:
|
|
1748
|
+
maxFeePerGas: parseGwei4("0.025")
|
|
1785
1749
|
// Max fee cap
|
|
1786
1750
|
});
|
|
1787
1751
|
const txReceipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -1833,7 +1797,7 @@ function useCreateOrganizationBase() {
|
|
|
1833
1797
|
|
|
1834
1798
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
1835
1799
|
import { useCallback as useCallback20 } from "react";
|
|
1836
|
-
import { encodeFunctionData as
|
|
1800
|
+
import { encodeFunctionData as encodeFunctionData5, erc20Abi as erc20Abi2, parseGwei as parseGwei5 } from "viem";
|
|
1837
1801
|
function useApproveOrgPartialPayment() {
|
|
1838
1802
|
return useCallback20(
|
|
1839
1803
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
@@ -1844,12 +1808,12 @@ function useApproveOrgPartialPayment() {
|
|
|
1844
1808
|
};
|
|
1845
1809
|
}
|
|
1846
1810
|
try {
|
|
1847
|
-
const approveCalldata =
|
|
1811
|
+
const approveCalldata = encodeFunctionData5({
|
|
1848
1812
|
abi: erc20Abi2,
|
|
1849
1813
|
functionName: "approve",
|
|
1850
1814
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
1851
1815
|
});
|
|
1852
|
-
const executeApproveCalldata =
|
|
1816
|
+
const executeApproveCalldata = encodeFunctionData5({
|
|
1853
1817
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1854
1818
|
functionName: "executeCall",
|
|
1855
1819
|
args: [kibbleTokenAddress, approveCalldata]
|
|
@@ -1862,7 +1826,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1862
1826
|
data: executeApproveCalldata
|
|
1863
1827
|
}
|
|
1864
1828
|
],
|
|
1865
|
-
maxPriorityFeePerGas:
|
|
1829
|
+
maxPriorityFeePerGas: parseGwei5("0.001")
|
|
1866
1830
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1867
1831
|
});
|
|
1868
1832
|
await bundlerClient.waitForUserOperationReceipt({ hash: userOpApproveHash });
|
|
@@ -1878,7 +1842,7 @@ function useApproveOrgPartialPayment() {
|
|
|
1878
1842
|
|
|
1879
1843
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
1880
1844
|
import { useCallback as useCallback21 } from "react";
|
|
1881
|
-
import { encodeFunctionData as
|
|
1845
|
+
import { encodeFunctionData as encodeFunctionData6, parseGwei as parseGwei6 } from "viem";
|
|
1882
1846
|
function useProcessOrgPartialKibblePayment() {
|
|
1883
1847
|
return useCallback21(
|
|
1884
1848
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
@@ -1889,7 +1853,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1889
1853
|
};
|
|
1890
1854
|
}
|
|
1891
1855
|
try {
|
|
1892
|
-
const partialPayCalldata =
|
|
1856
|
+
const partialPayCalldata = encodeFunctionData6({
|
|
1893
1857
|
abi: MARKETPLACE_ABI,
|
|
1894
1858
|
functionName: "partialPay",
|
|
1895
1859
|
args: [
|
|
@@ -1903,7 +1867,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1903
1867
|
backendSignature
|
|
1904
1868
|
]
|
|
1905
1869
|
});
|
|
1906
|
-
const executePartialPayCalldata =
|
|
1870
|
+
const executePartialPayCalldata = encodeFunctionData6({
|
|
1907
1871
|
abi: ORGANIZATION_IMPL_ABI,
|
|
1908
1872
|
functionName: "executeCall",
|
|
1909
1873
|
args: [partialPaymentModuleAddress, partialPayCalldata]
|
|
@@ -1916,7 +1880,7 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
1916
1880
|
data: executePartialPayCalldata
|
|
1917
1881
|
}
|
|
1918
1882
|
],
|
|
1919
|
-
maxPriorityFeePerGas:
|
|
1883
|
+
maxPriorityFeePerGas: parseGwei6("0.001")
|
|
1920
1884
|
// maxFeePerGas: parseGwei("0.01"),
|
|
1921
1885
|
});
|
|
1922
1886
|
const receipt = await bundlerClient.waitForUserOperationReceipt({
|
|
@@ -2272,7 +2236,7 @@ function useFetchBalance() {
|
|
|
2272
2236
|
}
|
|
2273
2237
|
|
|
2274
2238
|
// src/utils/actions/useClaimActionReward.ts
|
|
2275
|
-
import { encodeFunctionData as
|
|
2239
|
+
import { encodeFunctionData as encodeFunctionData7, parseGwei as parseGwei7 } from "viem";
|
|
2276
2240
|
import { useCallback as useCallback28 } from "react";
|
|
2277
2241
|
function useClaimActionReward() {
|
|
2278
2242
|
return useCallback28(
|
|
@@ -2283,7 +2247,7 @@ function useClaimActionReward() {
|
|
|
2283
2247
|
message: "Missing web3auth account info or contract address."
|
|
2284
2248
|
};
|
|
2285
2249
|
}
|
|
2286
|
-
const callData =
|
|
2250
|
+
const callData = encodeFunctionData7({
|
|
2287
2251
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2288
2252
|
functionName: "claimByIndex",
|
|
2289
2253
|
args: [actionId, claimIndex]
|
|
@@ -2296,7 +2260,7 @@ function useClaimActionReward() {
|
|
|
2296
2260
|
data: callData
|
|
2297
2261
|
}
|
|
2298
2262
|
],
|
|
2299
|
-
maxPriorityFeePerGas:
|
|
2263
|
+
maxPriorityFeePerGas: parseGwei7("0.001")
|
|
2300
2264
|
});
|
|
2301
2265
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2302
2266
|
hash: userOpHash,
|
|
@@ -2310,7 +2274,7 @@ function useClaimActionReward() {
|
|
|
2310
2274
|
}
|
|
2311
2275
|
|
|
2312
2276
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2313
|
-
import { encodeFunctionData as
|
|
2277
|
+
import { encodeFunctionData as encodeFunctionData8, parseGwei as parseGwei8 } from "viem";
|
|
2314
2278
|
import { useCallback as useCallback29 } from "react";
|
|
2315
2279
|
function useClaimOrgActionReward() {
|
|
2316
2280
|
return useCallback29(
|
|
@@ -2321,12 +2285,12 @@ function useClaimOrgActionReward() {
|
|
|
2321
2285
|
message: "Missing web3auth account info or contract address."
|
|
2322
2286
|
};
|
|
2323
2287
|
}
|
|
2324
|
-
const claimCallData =
|
|
2288
|
+
const claimCallData = encodeFunctionData8({
|
|
2325
2289
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2326
2290
|
functionName: "claimByIndex",
|
|
2327
2291
|
args: [actionId, claimIndex]
|
|
2328
2292
|
});
|
|
2329
|
-
const executeClaimCalldata =
|
|
2293
|
+
const executeClaimCalldata = encodeFunctionData8({
|
|
2330
2294
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2331
2295
|
functionName: "executeCall",
|
|
2332
2296
|
args: [rewardableActionContractAddress, claimCallData]
|
|
@@ -2339,7 +2303,7 @@ function useClaimOrgActionReward() {
|
|
|
2339
2303
|
data: executeClaimCalldata
|
|
2340
2304
|
}
|
|
2341
2305
|
],
|
|
2342
|
-
maxPriorityFeePerGas:
|
|
2306
|
+
maxPriorityFeePerGas: parseGwei8("0.001")
|
|
2343
2307
|
});
|
|
2344
2308
|
await bundlerClient.waitForUserOperationReceipt({
|
|
2345
2309
|
hash: userOpHash,
|
|
@@ -2360,6 +2324,7 @@ function useSubmitContractAction() {
|
|
|
2360
2324
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2361
2325
|
let sourceTypePayload = {};
|
|
2362
2326
|
const basisType = {
|
|
2327
|
+
campaignId: payload.campaignId,
|
|
2363
2328
|
actionId: payload.actionId,
|
|
2364
2329
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2365
2330
|
nonce: crypto.randomUUID(),
|