anymal-protocol 1.0.155 → 1.0.157
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 +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +107 -84
- package/dist/index.mjs +40 -19
- 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;
|
|
@@ -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;
|
|
@@ -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.");
|
|
@@ -468,28 +490,22 @@ function useFetchNotifications() {
|
|
|
468
490
|
}
|
|
469
491
|
|
|
470
492
|
// src/utils/coinbase/useSendCoinbaseUserOperation.ts
|
|
471
|
-
var import_react10 = require("react");
|
|
472
493
|
var import_cdp_hooks = require("@coinbase/cdp-hooks");
|
|
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
|
-
console.log("sendOperationFn called with:", {
|
|
487
|
-
evmAddress,
|
|
488
|
-
contractAddress,
|
|
489
|
-
functionName,
|
|
490
|
-
args,
|
|
491
|
-
argsLength: args.length
|
|
492
|
-
});
|
|
493
509
|
if (!evmAddress || !contractAddress || !abi || !functionName) {
|
|
494
510
|
return { success: false, message: "Missing required information" };
|
|
495
511
|
}
|
|
@@ -516,7 +532,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
516
532
|
});
|
|
517
533
|
await sendUserOperation({
|
|
518
534
|
evmSmartAccount: evmAddress,
|
|
519
|
-
network: "base-sepolia",
|
|
535
|
+
network: isProduction ? "base" : "base-sepolia",
|
|
520
536
|
useCdpPaymaster: true,
|
|
521
537
|
calls: [{ data: callData, to: contractAddress }]
|
|
522
538
|
});
|
|
@@ -2963,10 +2979,10 @@ var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem2.parseAbi)([...OZ_ERROR_FRAGME
|
|
|
2963
2979
|
var ORG_FUNCTION = "executeCall";
|
|
2964
2980
|
|
|
2965
2981
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
2966
|
-
var
|
|
2982
|
+
var import_react12 = require("react");
|
|
2967
2983
|
function useCoinbaseClaimActionReward() {
|
|
2968
2984
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2969
|
-
return (0,
|
|
2985
|
+
return (0, import_react12.useCallback)(
|
|
2970
2986
|
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2971
2987
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2972
2988
|
return {
|
|
@@ -2989,10 +3005,11 @@ function useCoinbaseClaimActionReward() {
|
|
|
2989
3005
|
}
|
|
2990
3006
|
|
|
2991
3007
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2992
|
-
var
|
|
3008
|
+
var import_react13 = require("react");
|
|
2993
3009
|
function useCoinbaseMintAnymalNFT() {
|
|
3010
|
+
const { isProduction } = useAnymalConfig();
|
|
2994
3011
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2995
|
-
return (0,
|
|
3012
|
+
return (0, import_react13.useCallback)(
|
|
2996
3013
|
async (evmAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
2997
3014
|
if (!passportID || !pid || !validationContractAddress) {
|
|
2998
3015
|
return {
|
|
@@ -3001,6 +3018,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3001
3018
|
status: "error"
|
|
3002
3019
|
};
|
|
3003
3020
|
}
|
|
3021
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
3004
3022
|
const result = await sendOperationFn(
|
|
3005
3023
|
evmAddress,
|
|
3006
3024
|
validationContractAddress,
|
|
@@ -3009,31 +3027,32 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3009
3027
|
[
|
|
3010
3028
|
pid,
|
|
3011
3029
|
passportID,
|
|
3012
|
-
|
|
3030
|
+
metadataUrl,
|
|
3013
3031
|
"petastic-signup-campaign-1",
|
|
3014
3032
|
anymalTxId
|
|
3015
3033
|
]
|
|
3016
3034
|
);
|
|
3017
3035
|
return { ...result, status };
|
|
3018
3036
|
},
|
|
3019
|
-
[sendOperationFn, status]
|
|
3037
|
+
[sendOperationFn, status, isProduction]
|
|
3020
3038
|
);
|
|
3021
3039
|
}
|
|
3022
3040
|
|
|
3023
3041
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
3024
|
-
var
|
|
3042
|
+
var import_react14 = require("react");
|
|
3025
3043
|
var import_viem3 = require("viem");
|
|
3026
3044
|
var import_chains2 = require("viem/chains");
|
|
3027
3045
|
function useCoinbaseCreateOrganizationWallet() {
|
|
3046
|
+
const { isProduction } = useAnymalConfig();
|
|
3028
3047
|
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
3029
|
-
const publicClient = (0,
|
|
3048
|
+
const publicClient = (0, import_react14.useMemo)(
|
|
3030
3049
|
() => (0, import_viem3.createPublicClient)({
|
|
3031
|
-
chain: import_chains2.baseSepolia,
|
|
3050
|
+
chain: isProduction ? import_chains2.base : import_chains2.baseSepolia,
|
|
3032
3051
|
transport: (0, import_viem3.http)()
|
|
3033
3052
|
}),
|
|
3034
|
-
[]
|
|
3053
|
+
[isProduction]
|
|
3035
3054
|
);
|
|
3036
|
-
return (0,
|
|
3055
|
+
return (0, import_react14.useCallback)(
|
|
3037
3056
|
/**
|
|
3038
3057
|
* Creates a new organization on-chain.
|
|
3039
3058
|
*
|
|
@@ -3073,11 +3092,12 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3073
3092
|
}
|
|
3074
3093
|
|
|
3075
3094
|
// src/utils/coinbase/useCoinbaseMintOrgAnymalNFT.ts
|
|
3076
|
-
var
|
|
3095
|
+
var import_react15 = require("react");
|
|
3077
3096
|
var import_viem4 = require("viem");
|
|
3078
3097
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
3098
|
+
const { isProduction } = useAnymalConfig();
|
|
3079
3099
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3080
|
-
return (0,
|
|
3100
|
+
return (0, import_react15.useCallback)(
|
|
3081
3101
|
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
3082
3102
|
if (!passportID || !orgContractAddress || !pid || !validationContractAddress) {
|
|
3083
3103
|
return {
|
|
@@ -3086,10 +3106,11 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3086
3106
|
status: "error"
|
|
3087
3107
|
};
|
|
3088
3108
|
}
|
|
3109
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
3089
3110
|
const args = [
|
|
3090
3111
|
pid,
|
|
3091
3112
|
passportID,
|
|
3092
|
-
|
|
3113
|
+
metadataUrl,
|
|
3093
3114
|
"petastic-signup-campaign-1",
|
|
3094
3115
|
anymalTxId
|
|
3095
3116
|
];
|
|
@@ -3108,16 +3129,16 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3108
3129
|
);
|
|
3109
3130
|
return { ...result, status };
|
|
3110
3131
|
},
|
|
3111
|
-
[sendOperationFn, status]
|
|
3132
|
+
[sendOperationFn, status, isProduction]
|
|
3112
3133
|
);
|
|
3113
3134
|
}
|
|
3114
3135
|
|
|
3115
3136
|
// src/utils/coinbase/useCoinbaseClaimOrgActionReward.ts
|
|
3116
|
-
var
|
|
3137
|
+
var import_react16 = require("react");
|
|
3117
3138
|
var import_viem5 = require("viem");
|
|
3118
3139
|
function useCoinbaseClaimOrgActionReward() {
|
|
3119
3140
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3120
|
-
return (0,
|
|
3141
|
+
return (0, import_react16.useCallback)(
|
|
3121
3142
|
async (evmSmartAddress, orgContractAddress, rewardableActionContractAddress, actionId, claimIndex) => {
|
|
3122
3143
|
if (!evmSmartAddress || !orgContractAddress || !actionId || claimIndex === void 0) {
|
|
3123
3144
|
return {
|
|
@@ -3147,7 +3168,7 @@ function useCoinbaseClaimOrgActionReward() {
|
|
|
3147
3168
|
|
|
3148
3169
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3149
3170
|
var import_viem7 = require("viem");
|
|
3150
|
-
var
|
|
3171
|
+
var import_react17 = require("react");
|
|
3151
3172
|
|
|
3152
3173
|
// src/helpers/GasEstimateHelper.tsx
|
|
3153
3174
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3228,7 +3249,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3228
3249
|
|
|
3229
3250
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3230
3251
|
function useMintAnymalNFT() {
|
|
3231
|
-
return (0,
|
|
3252
|
+
return (0, import_react17.useCallback)(
|
|
3232
3253
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3233
3254
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3234
3255
|
return {
|
|
@@ -3280,9 +3301,9 @@ function useMintAnymalNFT() {
|
|
|
3280
3301
|
}
|
|
3281
3302
|
|
|
3282
3303
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3283
|
-
var
|
|
3304
|
+
var import_react18 = require("react");
|
|
3284
3305
|
function useSaveAnymalMetadata() {
|
|
3285
|
-
return (0,
|
|
3306
|
+
return (0, import_react18.useCallback)(
|
|
3286
3307
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3287
3308
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3288
3309
|
method: "POST",
|
|
@@ -3310,7 +3331,7 @@ function useSaveAnymalMetadata() {
|
|
|
3310
3331
|
}
|
|
3311
3332
|
|
|
3312
3333
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3313
|
-
var
|
|
3334
|
+
var import_react19 = require("react");
|
|
3314
3335
|
|
|
3315
3336
|
// src/helpers/UploadImageHelper.tsx
|
|
3316
3337
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3367,7 +3388,7 @@ function toBase64(file) {
|
|
|
3367
3388
|
|
|
3368
3389
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3369
3390
|
function useUploadAnymalImage() {
|
|
3370
|
-
return (0,
|
|
3391
|
+
return (0, import_react19.useCallback)(
|
|
3371
3392
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3372
3393
|
if (!imageFile || !idToken) {
|
|
3373
3394
|
return {
|
|
@@ -3428,7 +3449,7 @@ function useUploadAnymalImage() {
|
|
|
3428
3449
|
}
|
|
3429
3450
|
|
|
3430
3451
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3431
|
-
var
|
|
3452
|
+
var import_react20 = require("react");
|
|
3432
3453
|
|
|
3433
3454
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3434
3455
|
var import_viem8 = require("viem");
|
|
@@ -3528,7 +3549,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3528
3549
|
|
|
3529
3550
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3530
3551
|
function useProcessPartialKibblePayment() {
|
|
3531
|
-
return (0,
|
|
3552
|
+
return (0, import_react20.useCallback)(
|
|
3532
3553
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3533
3554
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3534
3555
|
return {
|
|
@@ -3584,7 +3605,7 @@ function useProcessPartialKibblePayment() {
|
|
|
3584
3605
|
}
|
|
3585
3606
|
|
|
3586
3607
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3587
|
-
var
|
|
3608
|
+
var import_react21 = require("react");
|
|
3588
3609
|
|
|
3589
3610
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3590
3611
|
var import_viem9 = require("viem");
|
|
@@ -3629,7 +3650,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3629
3650
|
|
|
3630
3651
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3631
3652
|
function useApproveKibbleToken() {
|
|
3632
|
-
return (0,
|
|
3653
|
+
return (0, import_react21.useCallback)(
|
|
3633
3654
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3634
3655
|
try {
|
|
3635
3656
|
const result = await processDirectKibbleApproval(
|
|
@@ -3656,10 +3677,10 @@ function useApproveKibbleToken() {
|
|
|
3656
3677
|
}
|
|
3657
3678
|
|
|
3658
3679
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3659
|
-
var
|
|
3680
|
+
var import_react22 = require("react");
|
|
3660
3681
|
var import_viem10 = require("viem");
|
|
3661
3682
|
function useCreateOrganizationBase() {
|
|
3662
|
-
return (0,
|
|
3683
|
+
return (0, import_react22.useCallback)(
|
|
3663
3684
|
/**
|
|
3664
3685
|
* Creates a new organization on-chain.
|
|
3665
3686
|
*
|
|
@@ -3755,7 +3776,7 @@ function useCreateOrganizationBase() {
|
|
|
3755
3776
|
}
|
|
3756
3777
|
|
|
3757
3778
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3758
|
-
var
|
|
3779
|
+
var import_react23 = require("react");
|
|
3759
3780
|
|
|
3760
3781
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3761
3782
|
var import_viem12 = require("viem");
|
|
@@ -3853,7 +3874,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3853
3874
|
|
|
3854
3875
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3855
3876
|
function useApproveOrgPartialPayment() {
|
|
3856
|
-
return (0,
|
|
3877
|
+
return (0, import_react23.useCallback)(
|
|
3857
3878
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3858
3879
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3859
3880
|
return {
|
|
@@ -3885,7 +3906,7 @@ function useApproveOrgPartialPayment() {
|
|
|
3885
3906
|
}
|
|
3886
3907
|
|
|
3887
3908
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3888
|
-
var
|
|
3909
|
+
var import_react24 = require("react");
|
|
3889
3910
|
|
|
3890
3911
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3891
3912
|
var import_viem13 = require("viem");
|
|
@@ -3943,7 +3964,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3943
3964
|
|
|
3944
3965
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3945
3966
|
function useProcessOrgPartialKibblePayment() {
|
|
3946
|
-
return (0,
|
|
3967
|
+
return (0, import_react24.useCallback)(
|
|
3947
3968
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3948
3969
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3949
3970
|
return {
|
|
@@ -3981,9 +4002,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3981
4002
|
}
|
|
3982
4003
|
|
|
3983
4004
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3984
|
-
var
|
|
4005
|
+
var import_react25 = require("react");
|
|
3985
4006
|
function useUpdateOrgWalletAddress() {
|
|
3986
|
-
return (0,
|
|
4007
|
+
return (0, import_react25.useCallback)(
|
|
3987
4008
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3988
4009
|
try {
|
|
3989
4010
|
const mutation = `
|
|
@@ -4023,9 +4044,9 @@ function useUpdateOrgWalletAddress() {
|
|
|
4023
4044
|
|
|
4024
4045
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
4025
4046
|
var import_viem14 = require("viem");
|
|
4026
|
-
var
|
|
4047
|
+
var import_react26 = require("react");
|
|
4027
4048
|
function useMintOrgAnymalNFT() {
|
|
4028
|
-
return (0,
|
|
4049
|
+
return (0, import_react26.useCallback)(
|
|
4029
4050
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
4030
4051
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
4031
4052
|
return {
|
|
@@ -4293,9 +4314,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4293
4314
|
}
|
|
4294
4315
|
|
|
4295
4316
|
// src/utils/actions/useFetchActions.ts
|
|
4296
|
-
var
|
|
4317
|
+
var import_react27 = require("react");
|
|
4297
4318
|
function useFetchActions() {
|
|
4298
|
-
return (0,
|
|
4319
|
+
return (0, import_react27.useCallback)(
|
|
4299
4320
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4300
4321
|
const params = new URLSearchParams({ pid });
|
|
4301
4322
|
if (status) params.set("status", status);
|
|
@@ -4324,9 +4345,9 @@ function useFetchActions() {
|
|
|
4324
4345
|
}
|
|
4325
4346
|
|
|
4326
4347
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4327
|
-
var
|
|
4348
|
+
var import_react28 = require("react");
|
|
4328
4349
|
function useFetchActionDefinitions() {
|
|
4329
|
-
return (0,
|
|
4350
|
+
return (0, import_react28.useCallback)(
|
|
4330
4351
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4331
4352
|
try {
|
|
4332
4353
|
const response = await fetch(
|
|
@@ -4423,10 +4444,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4423
4444
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4424
4445
|
|
|
4425
4446
|
// src/utils/application/useCreateUserAppData.ts
|
|
4426
|
-
var
|
|
4447
|
+
var import_react29 = require("react");
|
|
4427
4448
|
var import_uuid2 = require("uuid");
|
|
4428
4449
|
function useCreateUserAppData() {
|
|
4429
|
-
return (0,
|
|
4450
|
+
return (0, import_react29.useCallback)(
|
|
4430
4451
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4431
4452
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4432
4453
|
const appValues = {
|
|
@@ -4481,10 +4502,10 @@ function useCreateUserAppData() {
|
|
|
4481
4502
|
}
|
|
4482
4503
|
|
|
4483
4504
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4484
|
-
var
|
|
4505
|
+
var import_react30 = require("react");
|
|
4485
4506
|
var import_uuid3 = require("uuid");
|
|
4486
4507
|
function useCreateOrganizationAppData() {
|
|
4487
|
-
return (0,
|
|
4508
|
+
return (0, import_react30.useCallback)(
|
|
4488
4509
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4489
4510
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4490
4511
|
const appValues = {
|
|
@@ -4538,10 +4559,10 @@ function useCreateOrganizationAppData() {
|
|
|
4538
4559
|
}
|
|
4539
4560
|
|
|
4540
4561
|
// src/utils/balance/useFetchBalance.ts
|
|
4541
|
-
var
|
|
4562
|
+
var import_react31 = require("react");
|
|
4542
4563
|
var import_viem16 = require("viem");
|
|
4543
4564
|
function useFetchBalance() {
|
|
4544
|
-
return (0,
|
|
4565
|
+
return (0, import_react31.useCallback)(
|
|
4545
4566
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4546
4567
|
try {
|
|
4547
4568
|
const balance = await publicClient.readContract({
|
|
@@ -4561,9 +4582,9 @@ function useFetchBalance() {
|
|
|
4561
4582
|
|
|
4562
4583
|
// src/utils/actions/useClaimActionReward.ts
|
|
4563
4584
|
var import_viem17 = require("viem");
|
|
4564
|
-
var
|
|
4585
|
+
var import_react32 = require("react");
|
|
4565
4586
|
function useClaimActionReward() {
|
|
4566
|
-
return (0,
|
|
4587
|
+
return (0, import_react32.useCallback)(
|
|
4567
4588
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4568
4589
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4569
4590
|
return {
|
|
@@ -4610,9 +4631,9 @@ function useClaimActionReward() {
|
|
|
4610
4631
|
|
|
4611
4632
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4612
4633
|
var import_viem18 = require("viem");
|
|
4613
|
-
var
|
|
4634
|
+
var import_react33 = require("react");
|
|
4614
4635
|
function useClaimOrgActionReward() {
|
|
4615
|
-
return (0,
|
|
4636
|
+
return (0, import_react33.useCallback)(
|
|
4616
4637
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4617
4638
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4618
4639
|
return {
|
|
@@ -4662,9 +4683,9 @@ function useClaimOrgActionReward() {
|
|
|
4662
4683
|
}
|
|
4663
4684
|
|
|
4664
4685
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4665
|
-
var
|
|
4686
|
+
var import_react34 = require("react");
|
|
4666
4687
|
function useSubmitContractAction() {
|
|
4667
|
-
return (0,
|
|
4688
|
+
return (0, import_react34.useCallback)(
|
|
4668
4689
|
(idToken, pid, source, endpoint, payload) => {
|
|
4669
4690
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4670
4691
|
let sourceTypePayload = {};
|
|
@@ -4785,6 +4806,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4785
4806
|
ActionSourceType,
|
|
4786
4807
|
ActionStatus,
|
|
4787
4808
|
ActionType,
|
|
4809
|
+
AnymalConfigProvider,
|
|
4788
4810
|
ERROR_ABI,
|
|
4789
4811
|
FIREBASE_WEB_API_KEYS,
|
|
4790
4812
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4818,6 +4840,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4818
4840
|
sendUserOpWithRetries,
|
|
4819
4841
|
serializePublicKeyCompressed,
|
|
4820
4842
|
submitAction,
|
|
4843
|
+
useAnymalConfig,
|
|
4821
4844
|
useApproveKibbleToken,
|
|
4822
4845
|
useApproveOrgPartialPayment,
|
|
4823
4846
|
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() {
|
|
@@ -387,28 +407,22 @@ function useFetchNotifications() {
|
|
|
387
407
|
}
|
|
388
408
|
|
|
389
409
|
// src/utils/coinbase/useSendCoinbaseUserOperation.ts
|
|
390
|
-
import { useCallback as useCallback10, useMemo } from "react";
|
|
391
410
|
import { useSendUserOperation } from "@coinbase/cdp-hooks";
|
|
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) => {
|
|
405
|
-
console.log("sendOperationFn called with:", {
|
|
406
|
-
evmAddress,
|
|
407
|
-
contractAddress,
|
|
408
|
-
functionName,
|
|
409
|
-
args,
|
|
410
|
-
argsLength: args.length
|
|
411
|
-
});
|
|
412
426
|
if (!evmAddress || !contractAddress || !abi || !functionName) {
|
|
413
427
|
return { success: false, message: "Missing required information" };
|
|
414
428
|
}
|
|
@@ -435,7 +449,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
435
449
|
});
|
|
436
450
|
await sendUserOperation({
|
|
437
451
|
evmSmartAccount: evmAddress,
|
|
438
|
-
network: "base-sepolia",
|
|
452
|
+
network: isProduction ? "base" : "base-sepolia",
|
|
439
453
|
useCdpPaymaster: true,
|
|
440
454
|
calls: [{ data: callData, to: contractAddress }]
|
|
441
455
|
});
|
|
@@ -2910,6 +2924,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2910
2924
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2911
2925
|
import { useCallback as useCallback12 } from "react";
|
|
2912
2926
|
function useCoinbaseMintAnymalNFT() {
|
|
2927
|
+
const { isProduction } = useAnymalConfig();
|
|
2913
2928
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2914
2929
|
return useCallback12(
|
|
2915
2930
|
async (evmAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
@@ -2920,6 +2935,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2920
2935
|
status: "error"
|
|
2921
2936
|
};
|
|
2922
2937
|
}
|
|
2938
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
2923
2939
|
const result = await sendOperationFn(
|
|
2924
2940
|
evmAddress,
|
|
2925
2941
|
validationContractAddress,
|
|
@@ -2928,29 +2944,30 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2928
2944
|
[
|
|
2929
2945
|
pid,
|
|
2930
2946
|
passportID,
|
|
2931
|
-
|
|
2947
|
+
metadataUrl,
|
|
2932
2948
|
"petastic-signup-campaign-1",
|
|
2933
2949
|
anymalTxId
|
|
2934
2950
|
]
|
|
2935
2951
|
);
|
|
2936
2952
|
return { ...result, status };
|
|
2937
2953
|
},
|
|
2938
|
-
[sendOperationFn, status]
|
|
2954
|
+
[sendOperationFn, status, isProduction]
|
|
2939
2955
|
);
|
|
2940
2956
|
}
|
|
2941
2957
|
|
|
2942
2958
|
// src/utils/coinbase/useCoinbaseCreateOrganizationWallet.ts
|
|
2943
2959
|
import { useCallback as useCallback13, useMemo as useMemo2 } from "react";
|
|
2944
2960
|
import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
2945
|
-
import { baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2961
|
+
import { base as base2, baseSepolia as baseSepolia2 } from "viem/chains";
|
|
2946
2962
|
function useCoinbaseCreateOrganizationWallet() {
|
|
2963
|
+
const { isProduction } = useAnymalConfig();
|
|
2947
2964
|
const { sendOperationFn, data, status } = useSendCoinbaseUserOperation();
|
|
2948
2965
|
const publicClient = useMemo2(
|
|
2949
2966
|
() => createPublicClient2({
|
|
2950
|
-
chain: baseSepolia2,
|
|
2967
|
+
chain: isProduction ? base2 : baseSepolia2,
|
|
2951
2968
|
transport: http2()
|
|
2952
2969
|
}),
|
|
2953
|
-
[]
|
|
2970
|
+
[isProduction]
|
|
2954
2971
|
);
|
|
2955
2972
|
return useCallback13(
|
|
2956
2973
|
/**
|
|
@@ -2995,6 +3012,7 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2995
3012
|
import { useCallback as useCallback14 } from "react";
|
|
2996
3013
|
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2997
3014
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
3015
|
+
const { isProduction } = useAnymalConfig();
|
|
2998
3016
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2999
3017
|
return useCallback14(
|
|
3000
3018
|
async (evmAddress, orgContractAddress, pid, passportID, anymalTxId, validationContractAddress) => {
|
|
@@ -3005,10 +3023,11 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3005
3023
|
status: "error"
|
|
3006
3024
|
};
|
|
3007
3025
|
}
|
|
3026
|
+
const metadataUrl = isProduction ? `https://nft.petastic.com/metadata/${passportID}` : `https://dev-nft.petastic.com/metadata/${passportID}`;
|
|
3008
3027
|
const args = [
|
|
3009
3028
|
pid,
|
|
3010
3029
|
passportID,
|
|
3011
|
-
|
|
3030
|
+
metadataUrl,
|
|
3012
3031
|
"petastic-signup-campaign-1",
|
|
3013
3032
|
anymalTxId
|
|
3014
3033
|
];
|
|
@@ -3027,7 +3046,7 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3027
3046
|
);
|
|
3028
3047
|
return { ...result, status };
|
|
3029
3048
|
},
|
|
3030
|
-
[sendOperationFn, status]
|
|
3049
|
+
[sendOperationFn, status, isProduction]
|
|
3031
3050
|
);
|
|
3032
3051
|
}
|
|
3033
3052
|
|
|
@@ -4520,6 +4539,7 @@ export {
|
|
|
4520
4539
|
ActionSourceType,
|
|
4521
4540
|
ActionStatus,
|
|
4522
4541
|
ActionType,
|
|
4542
|
+
AnymalConfigProvider,
|
|
4523
4543
|
ERROR_ABI,
|
|
4524
4544
|
FIREBASE_WEB_API_KEYS,
|
|
4525
4545
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4553,6 +4573,7 @@ export {
|
|
|
4553
4573
|
sendUserOpWithRetries,
|
|
4554
4574
|
serializePublicKeyCompressed,
|
|
4555
4575
|
submitAction,
|
|
4576
|
+
useAnymalConfig,
|
|
4556
4577
|
useApproveKibbleToken,
|
|
4557
4578
|
useApproveOrgPartialPayment,
|
|
4558
4579
|
useClaimActionReward,
|
package/package.json
CHANGED