anymal-protocol 1.0.156 → 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 +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +106 -77
- package/dist/index.mjs +38 -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,
|
|
@@ -3102,16 +3129,16 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3102
3129
|
);
|
|
3103
3130
|
return { ...result, status };
|
|
3104
3131
|
},
|
|
3105
|
-
[sendOperationFn, status]
|
|
3132
|
+
[sendOperationFn, status, isProduction]
|
|
3106
3133
|
);
|
|
3107
3134
|
}
|
|
3108
3135
|
|
|
3109
3136
|
// src/utils/coinbase/useCoinbaseClaimOrgActionReward.ts
|
|
3110
|
-
var
|
|
3137
|
+
var import_react16 = require("react");
|
|
3111
3138
|
var import_viem5 = require("viem");
|
|
3112
3139
|
function useCoinbaseClaimOrgActionReward() {
|
|
3113
3140
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3114
|
-
return (0,
|
|
3141
|
+
return (0, import_react16.useCallback)(
|
|
3115
3142
|
async (evmSmartAddress, orgContractAddress, rewardableActionContractAddress, actionId, claimIndex) => {
|
|
3116
3143
|
if (!evmSmartAddress || !orgContractAddress || !actionId || claimIndex === void 0) {
|
|
3117
3144
|
return {
|
|
@@ -3141,7 +3168,7 @@ function useCoinbaseClaimOrgActionReward() {
|
|
|
3141
3168
|
|
|
3142
3169
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3143
3170
|
var import_viem7 = require("viem");
|
|
3144
|
-
var
|
|
3171
|
+
var import_react17 = require("react");
|
|
3145
3172
|
|
|
3146
3173
|
// src/helpers/GasEstimateHelper.tsx
|
|
3147
3174
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3222,7 +3249,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3222
3249
|
|
|
3223
3250
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3224
3251
|
function useMintAnymalNFT() {
|
|
3225
|
-
return (0,
|
|
3252
|
+
return (0, import_react17.useCallback)(
|
|
3226
3253
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3227
3254
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3228
3255
|
return {
|
|
@@ -3274,9 +3301,9 @@ function useMintAnymalNFT() {
|
|
|
3274
3301
|
}
|
|
3275
3302
|
|
|
3276
3303
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3277
|
-
var
|
|
3304
|
+
var import_react18 = require("react");
|
|
3278
3305
|
function useSaveAnymalMetadata() {
|
|
3279
|
-
return (0,
|
|
3306
|
+
return (0, import_react18.useCallback)(
|
|
3280
3307
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3281
3308
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3282
3309
|
method: "POST",
|
|
@@ -3304,7 +3331,7 @@ function useSaveAnymalMetadata() {
|
|
|
3304
3331
|
}
|
|
3305
3332
|
|
|
3306
3333
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3307
|
-
var
|
|
3334
|
+
var import_react19 = require("react");
|
|
3308
3335
|
|
|
3309
3336
|
// src/helpers/UploadImageHelper.tsx
|
|
3310
3337
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3361,7 +3388,7 @@ function toBase64(file) {
|
|
|
3361
3388
|
|
|
3362
3389
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3363
3390
|
function useUploadAnymalImage() {
|
|
3364
|
-
return (0,
|
|
3391
|
+
return (0, import_react19.useCallback)(
|
|
3365
3392
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3366
3393
|
if (!imageFile || !idToken) {
|
|
3367
3394
|
return {
|
|
@@ -3422,7 +3449,7 @@ function useUploadAnymalImage() {
|
|
|
3422
3449
|
}
|
|
3423
3450
|
|
|
3424
3451
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3425
|
-
var
|
|
3452
|
+
var import_react20 = require("react");
|
|
3426
3453
|
|
|
3427
3454
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3428
3455
|
var import_viem8 = require("viem");
|
|
@@ -3522,7 +3549,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3522
3549
|
|
|
3523
3550
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3524
3551
|
function useProcessPartialKibblePayment() {
|
|
3525
|
-
return (0,
|
|
3552
|
+
return (0, import_react20.useCallback)(
|
|
3526
3553
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3527
3554
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3528
3555
|
return {
|
|
@@ -3578,7 +3605,7 @@ function useProcessPartialKibblePayment() {
|
|
|
3578
3605
|
}
|
|
3579
3606
|
|
|
3580
3607
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3581
|
-
var
|
|
3608
|
+
var import_react21 = require("react");
|
|
3582
3609
|
|
|
3583
3610
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3584
3611
|
var import_viem9 = require("viem");
|
|
@@ -3623,7 +3650,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3623
3650
|
|
|
3624
3651
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3625
3652
|
function useApproveKibbleToken() {
|
|
3626
|
-
return (0,
|
|
3653
|
+
return (0, import_react21.useCallback)(
|
|
3627
3654
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3628
3655
|
try {
|
|
3629
3656
|
const result = await processDirectKibbleApproval(
|
|
@@ -3650,10 +3677,10 @@ function useApproveKibbleToken() {
|
|
|
3650
3677
|
}
|
|
3651
3678
|
|
|
3652
3679
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3653
|
-
var
|
|
3680
|
+
var import_react22 = require("react");
|
|
3654
3681
|
var import_viem10 = require("viem");
|
|
3655
3682
|
function useCreateOrganizationBase() {
|
|
3656
|
-
return (0,
|
|
3683
|
+
return (0, import_react22.useCallback)(
|
|
3657
3684
|
/**
|
|
3658
3685
|
* Creates a new organization on-chain.
|
|
3659
3686
|
*
|
|
@@ -3749,7 +3776,7 @@ function useCreateOrganizationBase() {
|
|
|
3749
3776
|
}
|
|
3750
3777
|
|
|
3751
3778
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3752
|
-
var
|
|
3779
|
+
var import_react23 = require("react");
|
|
3753
3780
|
|
|
3754
3781
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3755
3782
|
var import_viem12 = require("viem");
|
|
@@ -3847,7 +3874,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3847
3874
|
|
|
3848
3875
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3849
3876
|
function useApproveOrgPartialPayment() {
|
|
3850
|
-
return (0,
|
|
3877
|
+
return (0, import_react23.useCallback)(
|
|
3851
3878
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3852
3879
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3853
3880
|
return {
|
|
@@ -3879,7 +3906,7 @@ function useApproveOrgPartialPayment() {
|
|
|
3879
3906
|
}
|
|
3880
3907
|
|
|
3881
3908
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3882
|
-
var
|
|
3909
|
+
var import_react24 = require("react");
|
|
3883
3910
|
|
|
3884
3911
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3885
3912
|
var import_viem13 = require("viem");
|
|
@@ -3937,7 +3964,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3937
3964
|
|
|
3938
3965
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3939
3966
|
function useProcessOrgPartialKibblePayment() {
|
|
3940
|
-
return (0,
|
|
3967
|
+
return (0, import_react24.useCallback)(
|
|
3941
3968
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3942
3969
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3943
3970
|
return {
|
|
@@ -3975,9 +4002,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3975
4002
|
}
|
|
3976
4003
|
|
|
3977
4004
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3978
|
-
var
|
|
4005
|
+
var import_react25 = require("react");
|
|
3979
4006
|
function useUpdateOrgWalletAddress() {
|
|
3980
|
-
return (0,
|
|
4007
|
+
return (0, import_react25.useCallback)(
|
|
3981
4008
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3982
4009
|
try {
|
|
3983
4010
|
const mutation = `
|
|
@@ -4017,9 +4044,9 @@ function useUpdateOrgWalletAddress() {
|
|
|
4017
4044
|
|
|
4018
4045
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
4019
4046
|
var import_viem14 = require("viem");
|
|
4020
|
-
var
|
|
4047
|
+
var import_react26 = require("react");
|
|
4021
4048
|
function useMintOrgAnymalNFT() {
|
|
4022
|
-
return (0,
|
|
4049
|
+
return (0, import_react26.useCallback)(
|
|
4023
4050
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
4024
4051
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
4025
4052
|
return {
|
|
@@ -4287,9 +4314,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4287
4314
|
}
|
|
4288
4315
|
|
|
4289
4316
|
// src/utils/actions/useFetchActions.ts
|
|
4290
|
-
var
|
|
4317
|
+
var import_react27 = require("react");
|
|
4291
4318
|
function useFetchActions() {
|
|
4292
|
-
return (0,
|
|
4319
|
+
return (0, import_react27.useCallback)(
|
|
4293
4320
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4294
4321
|
const params = new URLSearchParams({ pid });
|
|
4295
4322
|
if (status) params.set("status", status);
|
|
@@ -4318,9 +4345,9 @@ function useFetchActions() {
|
|
|
4318
4345
|
}
|
|
4319
4346
|
|
|
4320
4347
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4321
|
-
var
|
|
4348
|
+
var import_react28 = require("react");
|
|
4322
4349
|
function useFetchActionDefinitions() {
|
|
4323
|
-
return (0,
|
|
4350
|
+
return (0, import_react28.useCallback)(
|
|
4324
4351
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4325
4352
|
try {
|
|
4326
4353
|
const response = await fetch(
|
|
@@ -4417,10 +4444,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4417
4444
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4418
4445
|
|
|
4419
4446
|
// src/utils/application/useCreateUserAppData.ts
|
|
4420
|
-
var
|
|
4447
|
+
var import_react29 = require("react");
|
|
4421
4448
|
var import_uuid2 = require("uuid");
|
|
4422
4449
|
function useCreateUserAppData() {
|
|
4423
|
-
return (0,
|
|
4450
|
+
return (0, import_react29.useCallback)(
|
|
4424
4451
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4425
4452
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4426
4453
|
const appValues = {
|
|
@@ -4475,10 +4502,10 @@ function useCreateUserAppData() {
|
|
|
4475
4502
|
}
|
|
4476
4503
|
|
|
4477
4504
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4478
|
-
var
|
|
4505
|
+
var import_react30 = require("react");
|
|
4479
4506
|
var import_uuid3 = require("uuid");
|
|
4480
4507
|
function useCreateOrganizationAppData() {
|
|
4481
|
-
return (0,
|
|
4508
|
+
return (0, import_react30.useCallback)(
|
|
4482
4509
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4483
4510
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4484
4511
|
const appValues = {
|
|
@@ -4532,10 +4559,10 @@ function useCreateOrganizationAppData() {
|
|
|
4532
4559
|
}
|
|
4533
4560
|
|
|
4534
4561
|
// src/utils/balance/useFetchBalance.ts
|
|
4535
|
-
var
|
|
4562
|
+
var import_react31 = require("react");
|
|
4536
4563
|
var import_viem16 = require("viem");
|
|
4537
4564
|
function useFetchBalance() {
|
|
4538
|
-
return (0,
|
|
4565
|
+
return (0, import_react31.useCallback)(
|
|
4539
4566
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4540
4567
|
try {
|
|
4541
4568
|
const balance = await publicClient.readContract({
|
|
@@ -4555,9 +4582,9 @@ function useFetchBalance() {
|
|
|
4555
4582
|
|
|
4556
4583
|
// src/utils/actions/useClaimActionReward.ts
|
|
4557
4584
|
var import_viem17 = require("viem");
|
|
4558
|
-
var
|
|
4585
|
+
var import_react32 = require("react");
|
|
4559
4586
|
function useClaimActionReward() {
|
|
4560
|
-
return (0,
|
|
4587
|
+
return (0, import_react32.useCallback)(
|
|
4561
4588
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4562
4589
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4563
4590
|
return {
|
|
@@ -4604,9 +4631,9 @@ function useClaimActionReward() {
|
|
|
4604
4631
|
|
|
4605
4632
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4606
4633
|
var import_viem18 = require("viem");
|
|
4607
|
-
var
|
|
4634
|
+
var import_react33 = require("react");
|
|
4608
4635
|
function useClaimOrgActionReward() {
|
|
4609
|
-
return (0,
|
|
4636
|
+
return (0, import_react33.useCallback)(
|
|
4610
4637
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4611
4638
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4612
4639
|
return {
|
|
@@ -4656,9 +4683,9 @@ function useClaimOrgActionReward() {
|
|
|
4656
4683
|
}
|
|
4657
4684
|
|
|
4658
4685
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4659
|
-
var
|
|
4686
|
+
var import_react34 = require("react");
|
|
4660
4687
|
function useSubmitContractAction() {
|
|
4661
|
-
return (0,
|
|
4688
|
+
return (0, import_react34.useCallback)(
|
|
4662
4689
|
(idToken, pid, source, endpoint, payload) => {
|
|
4663
4690
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4664
4691
|
let sourceTypePayload = {};
|
|
@@ -4779,6 +4806,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4779
4806
|
ActionSourceType,
|
|
4780
4807
|
ActionStatus,
|
|
4781
4808
|
ActionType,
|
|
4809
|
+
AnymalConfigProvider,
|
|
4782
4810
|
ERROR_ABI,
|
|
4783
4811
|
FIREBASE_WEB_API_KEYS,
|
|
4784
4812
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4812,6 +4840,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4812
4840
|
sendUserOpWithRetries,
|
|
4813
4841
|
serializePublicKeyCompressed,
|
|
4814
4842
|
submitAction,
|
|
4843
|
+
useAnymalConfig,
|
|
4815
4844
|
useApproveKibbleToken,
|
|
4816
4845
|
useApproveOrgPartialPayment,
|
|
4817
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() {
|
|
@@ -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,
|
|
@@ -3021,7 +3046,7 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3021
3046
|
);
|
|
3022
3047
|
return { ...result, status };
|
|
3023
3048
|
},
|
|
3024
|
-
[sendOperationFn, status]
|
|
3049
|
+
[sendOperationFn, status, isProduction]
|
|
3025
3050
|
);
|
|
3026
3051
|
}
|
|
3027
3052
|
|
|
@@ -4514,6 +4539,7 @@ export {
|
|
|
4514
4539
|
ActionSourceType,
|
|
4515
4540
|
ActionStatus,
|
|
4516
4541
|
ActionType,
|
|
4542
|
+
AnymalConfigProvider,
|
|
4517
4543
|
ERROR_ABI,
|
|
4518
4544
|
FIREBASE_WEB_API_KEYS,
|
|
4519
4545
|
FIREBASE_WEB_AUTH_API_ENDPOINTS,
|
|
@@ -4547,6 +4573,7 @@ export {
|
|
|
4547
4573
|
sendUserOpWithRetries,
|
|
4548
4574
|
serializePublicKeyCompressed,
|
|
4549
4575
|
submitAction,
|
|
4576
|
+
useAnymalConfig,
|
|
4550
4577
|
useApproveKibbleToken,
|
|
4551
4578
|
useApproveOrgPartialPayment,
|
|
4552
4579
|
useClaimActionReward,
|
package/package.json
CHANGED