anymal-protocol 1.0.156 → 1.0.158
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 +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +107 -77
- package/dist/index.mjs +39 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
1
3
|
import * as _coinbase_cdp_hooks from '@coinbase/cdp-hooks';
|
|
2
4
|
import * as _coinbase_cdp_api_client from '@coinbase/cdp-api-client';
|
|
3
5
|
import * as abitype from 'abitype';
|
|
@@ -5,6 +7,16 @@ import { GetUserOperationResult } from '@coinbase/cdp-core';
|
|
|
5
7
|
import { BundlerClient } from 'viem/account-abstraction';
|
|
6
8
|
import { ec } from 'elliptic';
|
|
7
9
|
|
|
10
|
+
interface AnymalConfig {
|
|
11
|
+
isProduction: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface AnymalConfigProviderProps {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
isProduction: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function AnymalConfigProvider({ children, isProduction, }: AnymalConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function useAnymalConfig(): AnymalConfig;
|
|
19
|
+
|
|
8
20
|
declare function useVerifyAccount(): (pid: string, campaignId: string, dbAuthToken: string, bundlerClient: any, smartAccount: any, accountRewardsContractAddress: `0x${string}`) => Promise<{
|
|
9
21
|
success: boolean;
|
|
10
22
|
message: string;
|
|
@@ -437,7 +449,7 @@ declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName
|
|
|
437
449
|
data: GetUserOperationResult | undefined;
|
|
438
450
|
}>;
|
|
439
451
|
|
|
440
|
-
declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, orgContractAddress: string, pid: string, passportID: string, anymalTxId: string, validationContractAddress: `0x${string}
|
|
452
|
+
declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, orgContractAddress: string, pid: string, passportID: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
441
453
|
success: boolean;
|
|
442
454
|
message: string;
|
|
443
455
|
status: string;
|
|
@@ -885,4 +897,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
885
897
|
*/
|
|
886
898
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
887
899
|
|
|
888
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseClaimOrgActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCoinbaseMintOrgAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
900
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalConfig, AnymalConfigProvider, type AnymalConfigProviderProps, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAnymalConfig, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseClaimOrgActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCoinbaseMintOrgAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
1
3
|
import * as _coinbase_cdp_hooks from '@coinbase/cdp-hooks';
|
|
2
4
|
import * as _coinbase_cdp_api_client from '@coinbase/cdp-api-client';
|
|
3
5
|
import * as abitype from 'abitype';
|
|
@@ -5,6 +7,16 @@ import { GetUserOperationResult } from '@coinbase/cdp-core';
|
|
|
5
7
|
import { BundlerClient } from 'viem/account-abstraction';
|
|
6
8
|
import { ec } from 'elliptic';
|
|
7
9
|
|
|
10
|
+
interface AnymalConfig {
|
|
11
|
+
isProduction: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface AnymalConfigProviderProps {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
isProduction: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function AnymalConfigProvider({ children, isProduction, }: AnymalConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare function useAnymalConfig(): AnymalConfig;
|
|
19
|
+
|
|
8
20
|
declare function useVerifyAccount(): (pid: string, campaignId: string, dbAuthToken: string, bundlerClient: any, smartAccount: any, accountRewardsContractAddress: `0x${string}`) => Promise<{
|
|
9
21
|
success: boolean;
|
|
10
22
|
message: string;
|
|
@@ -437,7 +449,7 @@ declare function useCoinbaseCreateOrganizationWallet(): (orgPid: string, orgName
|
|
|
437
449
|
data: GetUserOperationResult | undefined;
|
|
438
450
|
}>;
|
|
439
451
|
|
|
440
|
-
declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, orgContractAddress: string, pid: string, passportID: string, anymalTxId: string, validationContractAddress: `0x${string}
|
|
452
|
+
declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, orgContractAddress: string, pid: string, passportID: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
441
453
|
success: boolean;
|
|
442
454
|
message: string;
|
|
443
455
|
status: string;
|
|
@@ -885,4 +897,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
885
897
|
*/
|
|
886
898
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
887
899
|
|
|
888
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseClaimOrgActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCoinbaseMintOrgAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
900
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalConfig, AnymalConfigProvider, type AnymalConfigProviderProps, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, ERROR_ABI, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, KIBBLE_TOKEN_ABI, MARKETPLACE_ABI, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, ORGANIZATION_BEACON_ABI, ORGANIZATION_IMPL_ABI, ORG_FUNCTION, PET_NFT_ABI, REWARDABLE_ACTIONS_ABI, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAnymalConfig, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCoinbaseClaimActionReward, useCoinbaseClaimOrgActionReward, useCoinbaseCreateOrganizationWallet, useCoinbaseMintAnymalNFT, useCoinbaseMintOrgAnymalNFT, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useFetchActionDefinitions, useFetchActions, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSendCoinbaseUserOperation, useSubmitContractAction, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
ActionSourceType: () => ActionSourceType,
|
|
25
25
|
ActionStatus: () => ActionStatus,
|
|
26
26
|
ActionType: () => ActionType,
|
|
27
|
+
AnymalConfigProvider: () => AnymalConfigProvider,
|
|
27
28
|
ERROR_ABI: () => ERROR_ABI,
|
|
28
29
|
FIREBASE_WEB_API_KEYS: () => FIREBASE_WEB_API_KEYS,
|
|
29
30
|
FIREBASE_WEB_AUTH_API_ENDPOINTS: () => FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -57,6 +58,7 @@ __export(index_exports, {
|
|
|
57
58
|
sendUserOpWithRetries: () => sendUserOpWithRetries,
|
|
58
59
|
serializePublicKeyCompressed: () => serializePublicKeyCompressed,
|
|
59
60
|
submitAction: () => submitAction,
|
|
61
|
+
useAnymalConfig: () => useAnymalConfig,
|
|
60
62
|
useApproveKibbleToken: () => useApproveKibbleToken,
|
|
61
63
|
useApproveOrgPartialPayment: () => useApproveOrgPartialPayment,
|
|
62
64
|
useClaimActionReward: () => useClaimActionReward,
|
|
@@ -95,10 +97,30 @@ __export(index_exports, {
|
|
|
95
97
|
});
|
|
96
98
|
module.exports = __toCommonJS(index_exports);
|
|
97
99
|
|
|
98
|
-
// src/
|
|
100
|
+
// src/context/AnymalConfigContext.tsx
|
|
99
101
|
var import_react = require("react");
|
|
102
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
103
|
+
var AnymalConfigContext = (0, import_react.createContext)(null);
|
|
104
|
+
function AnymalConfigProvider({
|
|
105
|
+
children,
|
|
106
|
+
isProduction
|
|
107
|
+
}) {
|
|
108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnymalConfigContext.Provider, { value: { isProduction }, children });
|
|
109
|
+
}
|
|
110
|
+
function useAnymalConfig() {
|
|
111
|
+
const context = (0, import_react.useContext)(AnymalConfigContext);
|
|
112
|
+
if (!context) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
"useAnymalConfig must be used within an AnymalConfigProvider"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return context;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/utils/account/useVerifyAccount.ts
|
|
121
|
+
var import_react2 = require("react");
|
|
100
122
|
function useVerifyAccount() {
|
|
101
|
-
return (0,
|
|
123
|
+
return (0, import_react2.useCallback)(
|
|
102
124
|
async (pid, campaignId, dbAuthToken, bundlerClient, smartAccount, accountRewardsContractAddress) => {
|
|
103
125
|
if (!dbAuthToken || !bundlerClient || !smartAccount || !accountRewardsContractAddress || !pid) {
|
|
104
126
|
return {
|
|
@@ -119,9 +141,9 @@ function useVerifyAccount() {
|
|
|
119
141
|
}
|
|
120
142
|
|
|
121
143
|
// src/utils/account/useVerifyWeb3AuthSession.ts
|
|
122
|
-
var
|
|
144
|
+
var import_react3 = require("react");
|
|
123
145
|
function useVerifyWeb3AuthSession() {
|
|
124
|
-
return (0,
|
|
146
|
+
return (0, import_react3.useCallback)(
|
|
125
147
|
async (idToken, publicKey, authServiceBaseUrl) => {
|
|
126
148
|
const response = await fetch(
|
|
127
149
|
`${authServiceBaseUrl}/verify-web3-session`,
|
|
@@ -142,9 +164,9 @@ function useVerifyWeb3AuthSession() {
|
|
|
142
164
|
}
|
|
143
165
|
|
|
144
166
|
// src/utils/account/useCreateWeb3Account.ts
|
|
145
|
-
var
|
|
167
|
+
var import_react4 = require("react");
|
|
146
168
|
function useCreateWeb3Account() {
|
|
147
|
-
return (0,
|
|
169
|
+
return (0, import_react4.useCallback)(
|
|
148
170
|
async (authToken, userPid, authServiceBaseUrl, baseWalletAddress, requestedContext) => {
|
|
149
171
|
try {
|
|
150
172
|
const response = await fetch(`${authServiceBaseUrl}/create-account`, {
|
|
@@ -170,9 +192,9 @@ function useCreateWeb3Account() {
|
|
|
170
192
|
}
|
|
171
193
|
|
|
172
194
|
// src/utils/account/useFetchUserData.ts
|
|
173
|
-
var
|
|
195
|
+
var import_react5 = require("react");
|
|
174
196
|
function useFetchUserData() {
|
|
175
|
-
return (0,
|
|
197
|
+
return (0, import_react5.useCallback)(
|
|
176
198
|
async (dbAuthToken, endpoint, pid) => {
|
|
177
199
|
try {
|
|
178
200
|
const query = `
|
|
@@ -221,9 +243,9 @@ function useFetchUserData() {
|
|
|
221
243
|
}
|
|
222
244
|
|
|
223
245
|
// src/utils/account/useUpdateUserEmail.ts
|
|
224
|
-
var
|
|
246
|
+
var import_react6 = require("react");
|
|
225
247
|
function useUpdateUserEmail() {
|
|
226
|
-
return (0,
|
|
248
|
+
return (0, import_react6.useCallback)(
|
|
227
249
|
async (dbAuthToken, docID, email, endpoint) => {
|
|
228
250
|
try {
|
|
229
251
|
const mutation = `
|
|
@@ -262,9 +284,9 @@ function useUpdateUserEmail() {
|
|
|
262
284
|
}
|
|
263
285
|
|
|
264
286
|
// src/utils/account/useUpdateUserPid.ts
|
|
265
|
-
var
|
|
287
|
+
var import_react7 = require("react");
|
|
266
288
|
function useUpdateUserPid() {
|
|
267
|
-
return (0,
|
|
289
|
+
return (0, import_react7.useCallback)(
|
|
268
290
|
async (dbAuthToken, docID, pid, endpoint) => {
|
|
269
291
|
try {
|
|
270
292
|
const mutation = `
|
|
@@ -303,9 +325,9 @@ function useUpdateUserPid() {
|
|
|
303
325
|
}
|
|
304
326
|
|
|
305
327
|
// src/utils/account/useUpdateUserAsVerified.ts
|
|
306
|
-
var
|
|
328
|
+
var import_react8 = require("react");
|
|
307
329
|
function useUpdateUserAsVerified() {
|
|
308
|
-
return (0,
|
|
330
|
+
return (0, import_react8.useCallback)(
|
|
309
331
|
async (recaptchaToken, docID, dbAuthToken, endpoint) => {
|
|
310
332
|
if (!docID || !dbAuthToken || recaptchaToken === null) return;
|
|
311
333
|
try {
|
|
@@ -351,9 +373,9 @@ function useUpdateUserAsVerified() {
|
|
|
351
373
|
}
|
|
352
374
|
|
|
353
375
|
// src/utils/account/useUpdateUserName.ts
|
|
354
|
-
var
|
|
376
|
+
var import_react9 = require("react");
|
|
355
377
|
function useUpdateUserName() {
|
|
356
|
-
return (0,
|
|
378
|
+
return (0, import_react9.useCallback)(
|
|
357
379
|
async (dbAuthToken, docID, name, endpoint) => {
|
|
358
380
|
if (!name || !dbAuthToken || !docID || !endpoint) {
|
|
359
381
|
return { success: false };
|
|
@@ -397,9 +419,9 @@ function useUpdateUserName() {
|
|
|
397
419
|
}
|
|
398
420
|
|
|
399
421
|
// src/utils/account/useFetchNotifications.ts
|
|
400
|
-
var
|
|
422
|
+
var import_react10 = require("react");
|
|
401
423
|
function useFetchNotifications() {
|
|
402
|
-
return (0,
|
|
424
|
+
return (0, import_react10.useCallback)(
|
|
403
425
|
async (pid, dbAuthToken, endpoint, additionalFilters) => {
|
|
404
426
|
if (!pid) {
|
|
405
427
|
throw new Error("The 'pid' field is required.");
|
|
@@ -469,19 +491,20 @@ function useFetchNotifications() {
|
|
|
469
491
|
|
|
470
492
|
// src/utils/coinbase/useSendCoinbaseUserOperation.ts
|
|
471
493
|
var import_cdp_hooks = require("@coinbase/cdp-hooks");
|
|
472
|
-
var
|
|
494
|
+
var import_react11 = require("react");
|
|
473
495
|
var import_viem = require("viem");
|
|
474
496
|
var import_chains = require("viem/chains");
|
|
475
497
|
function useSendCoinbaseUserOperation() {
|
|
498
|
+
const { isProduction } = useAnymalConfig();
|
|
476
499
|
const { sendUserOperation, data, error, status } = (0, import_cdp_hooks.useSendUserOperation)();
|
|
477
|
-
const publicClient = (0,
|
|
500
|
+
const publicClient = (0, import_react11.useMemo)(
|
|
478
501
|
() => (0, import_viem.createPublicClient)({
|
|
479
|
-
chain: import_chains.baseSepolia,
|
|
502
|
+
chain: isProduction ? import_chains.base : import_chains.baseSepolia,
|
|
480
503
|
transport: (0, import_viem.http)()
|
|
481
504
|
}),
|
|
482
|
-
[]
|
|
505
|
+
[isProduction]
|
|
483
506
|
);
|
|
484
|
-
const sendOperationFn = (0,
|
|
507
|
+
const sendOperationFn = (0, import_react11.useCallback)(
|
|
485
508
|
async (evmAddress, contractAddress, abi, functionName, args) => {
|
|
486
509
|
if (!evmAddress || !contractAddress || !abi || !functionName) {
|
|
487
510
|
return { success: false, message: "Missing required information" };
|
|
@@ -509,7 +532,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
509
532
|
});
|
|
510
533
|
await sendUserOperation({
|
|
511
534
|
evmSmartAccount: evmAddress,
|
|
512
|
-
network: "base-sepolia",
|
|
535
|
+
network: isProduction ? "base" : "base-sepolia",
|
|
513
536
|
useCdpPaymaster: true,
|
|
514
537
|
calls: [{ data: callData, to: contractAddress }]
|
|
515
538
|
});
|
|
@@ -2956,10 +2979,10 @@ var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem2.parseAbi)([...OZ_ERROR_FRAGME
|
|
|
2956
2979
|
var ORG_FUNCTION = "executeCall";
|
|
2957
2980
|
|
|
2958
2981
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
2959
|
-
var
|
|
2982
|
+
var import_react12 = require("react");
|
|
2960
2983
|
function useCoinbaseClaimActionReward() {
|
|
2961
2984
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2962
|
-
return (0,
|
|
2985
|
+
return (0, import_react12.useCallback)(
|
|
2963
2986
|
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2964
2987
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2965
2988
|
return {
|
|
@@ -2982,10 +3005,11 @@ function useCoinbaseClaimActionReward() {
|
|
|
2982
3005
|
}
|
|
2983
3006
|
|
|
2984
3007
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2985
|
-
var
|
|
3008
|
+
var import_react13 = require("react");
|
|
2986
3009
|
function useCoinbaseMintAnymalNFT() {
|
|
3010
|
+
const { isProduction } = useAnymalConfig();
|
|
2987
3011
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2988
|
-
return (0,
|
|
3012
|
+
return (0, import_react13.useCallback)(
|
|
2989
3013
|
async (evmAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
2990
3014
|
if (!passportID || !pid || !validationContractAddress) {
|
|
2991
3015
|
return {
|
|
@@ -2994,6 +3018,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2994
3018
|
status: "error"
|
|
2995
3019
|
};
|
|
2996
3020
|
}
|
|
3021
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
2997
3022
|
const result = await sendOperationFn(
|
|
2998
3023
|
evmAddress,
|
|
2999
3024
|
validationContractAddress,
|
|
@@ -3002,31 +3027,32 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3002
3027
|
[
|
|
3003
3028
|
pid,
|
|
3004
3029
|
passportID,
|
|
3005
|
-
|
|
3030
|
+
metadataUrl,
|
|
3006
3031
|
"petastic-signup-campaign-1",
|
|
3007
3032
|
anymalTxId
|
|
3008
3033
|
]
|
|
3009
3034
|
);
|
|
3010
3035
|
return { ...result, status };
|
|
3011
3036
|
},
|
|
3012
|
-
[sendOperationFn, status]
|
|
3037
|
+
[sendOperationFn, status, isProduction]
|
|
3013
3038
|
);
|
|
3014
3039
|
}
|
|
3015
3040
|
|
|
3016
3041
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
3017
|
-
var
|
|
3042
|
+
var import_react14 = require("react");
|
|
3018
3043
|
var import_viem3 = require("viem");
|
|
3019
3044
|
var import_chains2 = require("viem/chains");
|
|
3020
3045
|
function useCoinbaseCreateOrganizationWallet() {
|
|
3046
|
+
const { isProduction } = useAnymalConfig();
|
|
3021
3047
|
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
3022
|
-
const publicClient = (0,
|
|
3048
|
+
const publicClient = (0, import_react14.useMemo)(
|
|
3023
3049
|
() => (0, import_viem3.createPublicClient)({
|
|
3024
|
-
chain: import_chains2.baseSepolia,
|
|
3050
|
+
chain: isProduction ? import_chains2.base : import_chains2.baseSepolia,
|
|
3025
3051
|
transport: (0, import_viem3.http)()
|
|
3026
3052
|
}),
|
|
3027
|
-
[]
|
|
3053
|
+
[isProduction]
|
|
3028
3054
|
);
|
|
3029
|
-
return (0,
|
|
3055
|
+
return (0, import_react14.useCallback)(
|
|
3030
3056
|
/**
|
|
3031
3057
|
* Creates a new organization on-chain.
|
|
3032
3058
|
*
|
|
@@ -3066,12 +3092,13 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3066
3092
|
}
|
|
3067
3093
|
|
|
3068
3094
|
// src/utils/coinbase/useCoinbaseMintOrgAnymalNFT.ts
|
|
3069
|
-
var
|
|
3095
|
+
var import_react15 = require("react");
|
|
3070
3096
|
var import_viem4 = require("viem");
|
|
3071
3097
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
3098
|
+
const { isProduction } = useAnymalConfig();
|
|
3072
3099
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3073
|
-
return (0,
|
|
3074
|
-
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress
|
|
3100
|
+
return (0, import_react15.useCallback)(
|
|
3101
|
+
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
3075
3102
|
if (!passportID || !orgContractAddress || !pid || !validationContractAddress) {
|
|
3076
3103
|
return {
|
|
3077
3104
|
success: false,
|
|
@@ -3092,6 +3119,7 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3092
3119
|
functionName: "submitMetadataByCampaignName",
|
|
3093
3120
|
args
|
|
3094
3121
|
});
|
|
3122
|
+
console.log({ args });
|
|
3095
3123
|
const executeArgs = [validationContractAddress, callData];
|
|
3096
3124
|
const result = await sendOperationFn(
|
|
3097
3125
|
evmAddress,
|
|
@@ -3102,16 +3130,16 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3102
3130
|
);
|
|
3103
3131
|
return { ...result, status };
|
|
3104
3132
|
},
|
|
3105
|
-
[sendOperationFn, status]
|
|
3133
|
+
[sendOperationFn, status, isProduction]
|
|
3106
3134
|
);
|
|
3107
3135
|
}
|
|
3108
3136
|
|
|
3109
3137
|
// src/utils/coinbase/useCoinbaseClaimOrgActionReward.ts
|
|
3110
|
-
var
|
|
3138
|
+
var import_react16 = require("react");
|
|
3111
3139
|
var import_viem5 = require("viem");
|
|
3112
3140
|
function useCoinbaseClaimOrgActionReward() {
|
|
3113
3141
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3114
|
-
return (0,
|
|
3142
|
+
return (0, import_react16.useCallback)(
|
|
3115
3143
|
async (evmSmartAddress, orgContractAddress, rewardableActionContractAddress, actionId, claimIndex) => {
|
|
3116
3144
|
if (!evmSmartAddress || !orgContractAddress || !actionId || claimIndex === void 0) {
|
|
3117
3145
|
return {
|
|
@@ -3141,7 +3169,7 @@ function useCoinbaseClaimOrgActionReward() {
|
|
|
3141
3169
|
|
|
3142
3170
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3143
3171
|
var import_viem7 = require("viem");
|
|
3144
|
-
var
|
|
3172
|
+
var import_react17 = require("react");
|
|
3145
3173
|
|
|
3146
3174
|
// src/helpers/GasEstimateHelper.tsx
|
|
3147
3175
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3222,7 +3250,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3222
3250
|
|
|
3223
3251
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3224
3252
|
function useMintAnymalNFT() {
|
|
3225
|
-
return (0,
|
|
3253
|
+
return (0, import_react17.useCallback)(
|
|
3226
3254
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3227
3255
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3228
3256
|
return {
|
|
@@ -3274,9 +3302,9 @@ function useMintAnymalNFT() {
|
|
|
3274
3302
|
}
|
|
3275
3303
|
|
|
3276
3304
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3277
|
-
var
|
|
3305
|
+
var import_react18 = require("react");
|
|
3278
3306
|
function useSaveAnymalMetadata() {
|
|
3279
|
-
return (0,
|
|
3307
|
+
return (0, import_react18.useCallback)(
|
|
3280
3308
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3281
3309
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3282
3310
|
method: "POST",
|
|
@@ -3304,7 +3332,7 @@ function useSaveAnymalMetadata() {
|
|
|
3304
3332
|
}
|
|
3305
3333
|
|
|
3306
3334
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3307
|
-
var
|
|
3335
|
+
var import_react19 = require("react");
|
|
3308
3336
|
|
|
3309
3337
|
// src/helpers/UploadImageHelper.tsx
|
|
3310
3338
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3361,7 +3389,7 @@ function toBase64(file) {
|
|
|
3361
3389
|
|
|
3362
3390
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3363
3391
|
function useUploadAnymalImage() {
|
|
3364
|
-
return (0,
|
|
3392
|
+
return (0, import_react19.useCallback)(
|
|
3365
3393
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3366
3394
|
if (!imageFile || !idToken) {
|
|
3367
3395
|
return {
|
|
@@ -3422,7 +3450,7 @@ function useUploadAnymalImage() {
|
|
|
3422
3450
|
}
|
|
3423
3451
|
|
|
3424
3452
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3425
|
-
var
|
|
3453
|
+
var import_react20 = require("react");
|
|
3426
3454
|
|
|
3427
3455
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3428
3456
|
var import_viem8 = require("viem");
|
|
@@ -3522,7 +3550,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3522
3550
|
|
|
3523
3551
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3524
3552
|
function useProcessPartialKibblePayment() {
|
|
3525
|
-
return (0,
|
|
3553
|
+
return (0, import_react20.useCallback)(
|
|
3526
3554
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3527
3555
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3528
3556
|
return {
|
|
@@ -3578,7 +3606,7 @@ function useProcessPartialKibblePayment() {
|
|
|
3578
3606
|
}
|
|
3579
3607
|
|
|
3580
3608
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3581
|
-
var
|
|
3609
|
+
var import_react21 = require("react");
|
|
3582
3610
|
|
|
3583
3611
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3584
3612
|
var import_viem9 = require("viem");
|
|
@@ -3623,7 +3651,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3623
3651
|
|
|
3624
3652
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3625
3653
|
function useApproveKibbleToken() {
|
|
3626
|
-
return (0,
|
|
3654
|
+
return (0, import_react21.useCallback)(
|
|
3627
3655
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3628
3656
|
try {
|
|
3629
3657
|
const result = await processDirectKibbleApproval(
|
|
@@ -3650,10 +3678,10 @@ function useApproveKibbleToken() {
|
|
|
3650
3678
|
}
|
|
3651
3679
|
|
|
3652
3680
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3653
|
-
var
|
|
3681
|
+
var import_react22 = require("react");
|
|
3654
3682
|
var import_viem10 = require("viem");
|
|
3655
3683
|
function useCreateOrganizationBase() {
|
|
3656
|
-
return (0,
|
|
3684
|
+
return (0, import_react22.useCallback)(
|
|
3657
3685
|
/**
|
|
3658
3686
|
* Creates a new organization on-chain.
|
|
3659
3687
|
*
|
|
@@ -3749,7 +3777,7 @@ function useCreateOrganizationBase() {
|
|
|
3749
3777
|
}
|
|
3750
3778
|
|
|
3751
3779
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3752
|
-
var
|
|
3780
|
+
var import_react23 = require("react");
|
|
3753
3781
|
|
|
3754
3782
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3755
3783
|
var import_viem12 = require("viem");
|
|
@@ -3847,7 +3875,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3847
3875
|
|
|
3848
3876
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3849
3877
|
function useApproveOrgPartialPayment() {
|
|
3850
|
-
return (0,
|
|
3878
|
+
return (0, import_react23.useCallback)(
|
|
3851
3879
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3852
3880
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3853
3881
|
return {
|
|
@@ -3879,7 +3907,7 @@ function useApproveOrgPartialPayment() {
|
|
|
3879
3907
|
}
|
|
3880
3908
|
|
|
3881
3909
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3882
|
-
var
|
|
3910
|
+
var import_react24 = require("react");
|
|
3883
3911
|
|
|
3884
3912
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3885
3913
|
var import_viem13 = require("viem");
|
|
@@ -3937,7 +3965,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3937
3965
|
|
|
3938
3966
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3939
3967
|
function useProcessOrgPartialKibblePayment() {
|
|
3940
|
-
return (0,
|
|
3968
|
+
return (0, import_react24.useCallback)(
|
|
3941
3969
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3942
3970
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3943
3971
|
return {
|
|
@@ -3975,9 +4003,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3975
4003
|
}
|
|
3976
4004
|
|
|
3977
4005
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3978
|
-
var
|
|
4006
|
+
var import_react25 = require("react");
|
|
3979
4007
|
function useUpdateOrgWalletAddress() {
|
|
3980
|
-
return (0,
|
|
4008
|
+
return (0, import_react25.useCallback)(
|
|
3981
4009
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3982
4010
|
try {
|
|
3983
4011
|
const mutation = `
|
|
@@ -4017,9 +4045,9 @@ function useUpdateOrgWalletAddress() {
|
|
|
4017
4045
|
|
|
4018
4046
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
4019
4047
|
var import_viem14 = require("viem");
|
|
4020
|
-
var
|
|
4048
|
+
var import_react26 = require("react");
|
|
4021
4049
|
function useMintOrgAnymalNFT() {
|
|
4022
|
-
return (0,
|
|
4050
|
+
return (0, import_react26.useCallback)(
|
|
4023
4051
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
4024
4052
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
4025
4053
|
return {
|
|
@@ -4287,9 +4315,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4287
4315
|
}
|
|
4288
4316
|
|
|
4289
4317
|
// src/utils/actions/useFetchActions.ts
|
|
4290
|
-
var
|
|
4318
|
+
var import_react27 = require("react");
|
|
4291
4319
|
function useFetchActions() {
|
|
4292
|
-
return (0,
|
|
4320
|
+
return (0, import_react27.useCallback)(
|
|
4293
4321
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4294
4322
|
const params = new URLSearchParams({ pid });
|
|
4295
4323
|
if (status) params.set("status", status);
|
|
@@ -4318,9 +4346,9 @@ function useFetchActions() {
|
|
|
4318
4346
|
}
|
|
4319
4347
|
|
|
4320
4348
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4321
|
-
var
|
|
4349
|
+
var import_react28 = require("react");
|
|
4322
4350
|
function useFetchActionDefinitions() {
|
|
4323
|
-
return (0,
|
|
4351
|
+
return (0, import_react28.useCallback)(
|
|
4324
4352
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4325
4353
|
try {
|
|
4326
4354
|
const response = await fetch(
|
|
@@ -4417,10 +4445,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4417
4445
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4418
4446
|
|
|
4419
4447
|
// src/utils/application/useCreateUserAppData.ts
|
|
4420
|
-
var
|
|
4448
|
+
var import_react29 = require("react");
|
|
4421
4449
|
var import_uuid2 = require("uuid");
|
|
4422
4450
|
function useCreateUserAppData() {
|
|
4423
|
-
return (0,
|
|
4451
|
+
return (0, import_react29.useCallback)(
|
|
4424
4452
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4425
4453
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4426
4454
|
const appValues = {
|
|
@@ -4475,10 +4503,10 @@ function useCreateUserAppData() {
|
|
|
4475
4503
|
}
|
|
4476
4504
|
|
|
4477
4505
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4478
|
-
var
|
|
4506
|
+
var import_react30 = require("react");
|
|
4479
4507
|
var import_uuid3 = require("uuid");
|
|
4480
4508
|
function useCreateOrganizationAppData() {
|
|
4481
|
-
return (0,
|
|
4509
|
+
return (0, import_react30.useCallback)(
|
|
4482
4510
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4483
4511
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4484
4512
|
const appValues = {
|
|
@@ -4532,10 +4560,10 @@ function useCreateOrganizationAppData() {
|
|
|
4532
4560
|
}
|
|
4533
4561
|
|
|
4534
4562
|
// src/utils/balance/useFetchBalance.ts
|
|
4535
|
-
var
|
|
4563
|
+
var import_react31 = require("react");
|
|
4536
4564
|
var import_viem16 = require("viem");
|
|
4537
4565
|
function useFetchBalance() {
|
|
4538
|
-
return (0,
|
|
4566
|
+
return (0, import_react31.useCallback)(
|
|
4539
4567
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4540
4568
|
try {
|
|
4541
4569
|
const balance = await publicClient.readContract({
|
|
@@ -4555,9 +4583,9 @@ function useFetchBalance() {
|
|
|
4555
4583
|
|
|
4556
4584
|
// src/utils/actions/useClaimActionReward.ts
|
|
4557
4585
|
var import_viem17 = require("viem");
|
|
4558
|
-
var
|
|
4586
|
+
var import_react32 = require("react");
|
|
4559
4587
|
function useClaimActionReward() {
|
|
4560
|
-
return (0,
|
|
4588
|
+
return (0, import_react32.useCallback)(
|
|
4561
4589
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4562
4590
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4563
4591
|
return {
|
|
@@ -4604,9 +4632,9 @@ function useClaimActionReward() {
|
|
|
4604
4632
|
|
|
4605
4633
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4606
4634
|
var import_viem18 = require("viem");
|
|
4607
|
-
var
|
|
4635
|
+
var import_react33 = require("react");
|
|
4608
4636
|
function useClaimOrgActionReward() {
|
|
4609
|
-
return (0,
|
|
4637
|
+
return (0, import_react33.useCallback)(
|
|
4610
4638
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4611
4639
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4612
4640
|
return {
|
|
@@ -4656,9 +4684,9 @@ function useClaimOrgActionReward() {
|
|
|
4656
4684
|
}
|
|
4657
4685
|
|
|
4658
4686
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4659
|
-
var
|
|
4687
|
+
var import_react34 = require("react");
|
|
4660
4688
|
function useSubmitContractAction() {
|
|
4661
|
-
return (0,
|
|
4689
|
+
return (0, import_react34.useCallback)(
|
|
4662
4690
|
(idToken, pid, source, endpoint, payload) => {
|
|
4663
4691
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4664
4692
|
let sourceTypePayload = {};
|
|
@@ -4779,6 +4807,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4779
4807
|
ActionSourceType,
|
|
4780
4808
|
ActionStatus,
|
|
4781
4809
|
ActionType,
|
|
4810
|
+
AnymalConfigProvider,
|
|
4782
4811
|
ERROR_ABI,
|
|
4783
4812
|
FIREBASE_WEB_API_KEYS,
|
|
4784
4813
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4812,6 +4841,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4812
4841
|
sendUserOpWithRetries,
|
|
4813
4842
|
serializePublicKeyCompressed,
|
|
4814
4843
|
submitAction,
|
|
4844
|
+
useAnymalConfig,
|
|
4815
4845
|
useApproveKibbleToken,
|
|
4816
4846
|
useApproveOrgPartialPayment,
|
|
4817
4847
|
useClaimActionReward,
|
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,26 @@ import {
|
|
|
14
14
|
serializePublicKeyCompressed
|
|
15
15
|
} from "./chunk-OBXCSRGF.mjs";
|
|
16
16
|
|
|
17
|
+
// src/context/AnymalConfigContext.tsx
|
|
18
|
+
import { createContext, useContext } from "react";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var AnymalConfigContext = createContext(null);
|
|
21
|
+
function AnymalConfigProvider({
|
|
22
|
+
children,
|
|
23
|
+
isProduction
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsx(AnymalConfigContext.Provider, { value: { isProduction }, children });
|
|
26
|
+
}
|
|
27
|
+
function useAnymalConfig() {
|
|
28
|
+
const context = useContext(AnymalConfigContext);
|
|
29
|
+
if (!context) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"useAnymalConfig must be used within an AnymalConfigProvider"
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
}
|
|
36
|
+
|
|
17
37
|
// src/utils/account/useVerifyAccount.ts
|
|
18
38
|
import { useCallback } from "react";
|
|
19
39
|
function useVerifyAccount() {
|
|
@@ -390,15 +410,16 @@ function useFetchNotifications() {
|
|
|
390
410
|
import { useSendUserOperation } from "@coinbase/cdp-hooks";
|
|
391
411
|
import { useCallback as useCallback10, useMemo } from "react";
|
|
392
412
|
import { createPublicClient, encodeFunctionData, http } from "viem";
|
|
393
|
-
import { baseSepolia } from "viem/chains";
|
|
413
|
+
import { base, baseSepolia } from "viem/chains";
|
|
394
414
|
function useSendCoinbaseUserOperation() {
|
|
415
|
+
const { isProduction } = useAnymalConfig();
|
|
395
416
|
const { sendUserOperation, data, error, status } = useSendUserOperation();
|
|
396
417
|
const publicClient = useMemo(
|
|
397
418
|
() => createPublicClient({
|
|
398
|
-
chain: baseSepolia,
|
|
419
|
+
chain: isProduction ? base : baseSepolia,
|
|
399
420
|
transport: http()
|
|
400
421
|
}),
|
|
401
|
-
[]
|
|
422
|
+
[isProduction]
|
|
402
423
|
);
|
|
403
424
|
const sendOperationFn = useCallback10(
|
|
404
425
|
async (evmAddress, contractAddress, abi, functionName, args) => {
|
|
@@ -428,7 +449,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
428
449
|
});
|
|
429
450
|
await sendUserOperation({
|
|
430
451
|
evmSmartAccount: evmAddress,
|
|
431
|
-
network: "base-sepolia",
|
|
452
|
+
network: isProduction ? "base" : "base-sepolia",
|
|
432
453
|
useCdpPaymaster: true,
|
|
433
454
|
calls: [{ data: callData, to: contractAddress }]
|
|
434
455
|
});
|
|
@@ -2903,6 +2924,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2903
2924
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2904
2925
|
import { useCallback as useCallback12 } from "react";
|
|
2905
2926
|
function useCoinbaseMintAnymalNFT() {
|
|
2927
|
+
const { isProduction } = useAnymalConfig();
|
|
2906
2928
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2907
2929
|
return useCallback12(
|
|
2908
2930
|
async (evmAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
@@ -2913,6 +2935,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2913
2935
|
status: "error"
|
|
2914
2936
|
};
|
|
2915
2937
|
}
|
|
2938
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
2916
2939
|
const result = await sendOperationFn(
|
|
2917
2940
|
evmAddress,
|
|
2918
2941
|
validationContractAddress,
|
|
@@ -2921,29 +2944,30 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2921
2944
|
[
|
|
2922
2945
|
pid,
|
|
2923
2946
|
passportID,
|
|
2924
|
-
|
|
2947
|
+
metadataUrl,
|
|
2925
2948
|
"petastic-signup-campaign-1",
|
|
2926
2949
|
anymalTxId
|
|
2927
2950
|
]
|
|
2928
2951
|
);
|
|
2929
2952
|
return { ...result, status };
|
|
2930
2953
|
},
|
|
2931
|
-
[sendOperationFn, status]
|
|
2954
|
+
[sendOperationFn, status, isProduction]
|
|
2932
2955
|
);
|
|
2933
2956
|
}
|
|
2934
2957
|
|
|
2935
2958
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
2936
2959
|
import { useCallback as useCallback13, useMemo as useMemo2 } from "react";
|
|
2937
2960
|
import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
2938
|
-
import { baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2961
|
+
import { base as base2, baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2939
2962
|
function useCoinbaseCreateOrganizationWallet() {
|
|
2963
|
+
const { isProduction } = useAnymalConfig();
|
|
2940
2964
|
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
2941
2965
|
const publicClient = useMemo2(
|
|
2942
2966
|
() => createPublicClient2({
|
|
2943
|
-
chain: baseSepolia2,
|
|
2967
|
+
chain: isProduction ? base2 : baseSepolia2,
|
|
2944
2968
|
transport: http2()
|
|
2945
2969
|
}),
|
|
2946
|
-
[]
|
|
2970
|
+
[isProduction]
|
|
2947
2971
|
);
|
|
2948
2972
|
return useCallback13(
|
|
2949
2973
|
/**
|
|
@@ -2988,9 +3012,10 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2988
3012
|
import { useCallback as useCallback14 } from "react";
|
|
2989
3013
|
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2990
3014
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
3015
|
+
const { isProduction } = useAnymalConfig();
|
|
2991
3016
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2992
3017
|
return useCallback14(
|
|
2993
|
-
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress
|
|
3018
|
+
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
2994
3019
|
if (!passportID || !orgContractAddress || !pid || !validationContractAddress) {
|
|
2995
3020
|
return {
|
|
2996
3021
|
success: false,
|
|
@@ -3011,6 +3036,7 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3011
3036
|
functionName: "submitMetadataByCampaignName",
|
|
3012
3037
|
args
|
|
3013
3038
|
});
|
|
3039
|
+
console.log({ args });
|
|
3014
3040
|
const executeArgs = [validationContractAddress, callData];
|
|
3015
3041
|
const result = await sendOperationFn(
|
|
3016
3042
|
evmAddress,
|
|
@@ -3021,7 +3047,7 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3021
3047
|
);
|
|
3022
3048
|
return { ...result, status };
|
|
3023
3049
|
},
|
|
3024
|
-
[sendOperationFn, status]
|
|
3050
|
+
[sendOperationFn, status, isProduction]
|
|
3025
3051
|
);
|
|
3026
3052
|
}
|
|
3027
3053
|
|
|
@@ -4514,6 +4540,7 @@ export {
|
|
|
4514
4540
|
ActionSourceType,
|
|
4515
4541
|
ActionStatus,
|
|
4516
4542
|
ActionType,
|
|
4543
|
+
AnymalConfigProvider,
|
|
4517
4544
|
ERROR_ABI,
|
|
4518
4545
|
FIREBASE_WEB_API_KEYS,
|
|
4519
4546
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4547,6 +4574,7 @@ export {
|
|
|
4547
4574
|
sendUserOpWithRetries,
|
|
4548
4575
|
serializePublicKeyCompressed,
|
|
4549
4576
|
submitAction,
|
|
4577
|
+
useAnymalConfig,
|
|
4550
4578
|
useApproveKibbleToken,
|
|
4551
4579
|
useApproveOrgPartialPayment,
|
|
4552
4580
|
useClaimActionReward,
|
package/package.json
CHANGED