anymal-protocol 1.0.121 → 1.0.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +81 -27
- package/dist/index.mjs +74 -21
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -152,6 +152,11 @@ declare function useProcessOrgPartialKibblePayment(): (orgContractAddress: strin
|
|
|
152
152
|
|
|
153
153
|
declare function useUpdateOrgWalletAddress(): (dbAuthToken: string, docID: string, baseWalletAddress: string, endpoint: string) => Promise<void>;
|
|
154
154
|
|
|
155
|
+
declare function useMintOrgAnymalNFT(): (orgContractAddress: string, pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, managerSmartAccount: any, bundlerClient: any) => Promise<{
|
|
156
|
+
success: boolean;
|
|
157
|
+
message: string;
|
|
158
|
+
}>;
|
|
159
|
+
|
|
155
160
|
declare const generateBytes32Nonce: () => `0x${string}`;
|
|
156
161
|
|
|
157
162
|
/**
|
|
@@ -502,4 +507,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
502
507
|
*/
|
|
503
508
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
504
509
|
|
|
505
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
510
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.d.ts
CHANGED
|
@@ -152,6 +152,11 @@ declare function useProcessOrgPartialKibblePayment(): (orgContractAddress: strin
|
|
|
152
152
|
|
|
153
153
|
declare function useUpdateOrgWalletAddress(): (dbAuthToken: string, docID: string, baseWalletAddress: string, endpoint: string) => Promise<void>;
|
|
154
154
|
|
|
155
|
+
declare function useMintOrgAnymalNFT(): (orgContractAddress: string, pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, managerSmartAccount: any, bundlerClient: any) => Promise<{
|
|
156
|
+
success: boolean;
|
|
157
|
+
message: string;
|
|
158
|
+
}>;
|
|
159
|
+
|
|
155
160
|
declare const generateBytes32Nonce: () => `0x${string}`;
|
|
156
161
|
|
|
157
162
|
/**
|
|
@@ -502,4 +507,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
502
507
|
*/
|
|
503
508
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
504
509
|
|
|
505
|
-
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
|
510
|
+
export { AUTH_API_ENDPOINTS, type ActionDefinition, type ActionPayload, type ActionRecord, type ActionReferral, ActionSourceType, ActionStatus, ActionType, type AnymalNftMetadataInputData, type AuthEnvelope, type ContractActionPayload, type CreateAnymalInputData, type ExternalActionPayload, FIREBASE_WEB_API_KEYS, FIREBASE_WEB_AUTH_API_ENDPOINTS, type GraphQLActionPayload, type JWTOptions, type MarketplaceActionPayload, MarketplacePaymentType, NETWORK_HOSTS, Network, type NotificationData, type NotificationEventData, type SubmitResponse, type WishlistPurchaseActionPayload, convertToActionDefinition, convertToActionRecord, convertToMultipleActionDefinitions, convertToMultipleActionRecords, createApp, createAuthEnvelope, fetchAnymals, flattenFirestoreData, generateAppSignature, generateBytes32Nonce, generateJWT, getFirebaseTokenForApp, humanRevert, loadExistingSecp256k1PrivateKey, processDirectKibbleApproval, processDirectPartialPayment, processOrgKibbleApproval, processOrgPartialPayment, sendUserOpWithRetries, serializePublicKeyCompressed, submitAction, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useClaimActionReward, useClaimOrgActionReward, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchActionDefinitions, useFetchActions, useFetchAnymals, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useMintOrgAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useSubmitContractAction, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession, waitForAllowance, waitForReceiptWithRetries };
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ __export(index_exports, {
|
|
|
67
67
|
useFetchNotifications: () => useFetchNotifications,
|
|
68
68
|
useFetchUserData: () => useFetchUserData,
|
|
69
69
|
useMintAnymalNFT: () => useMintAnymalNFT,
|
|
70
|
+
useMintOrgAnymalNFT: () => useMintOrgAnymalNFT,
|
|
70
71
|
useProcessOrgPartialKibblePayment: () => useProcessOrgPartialKibblePayment,
|
|
71
72
|
useProcessPartialKibblePayment: () => useProcessPartialKibblePayment,
|
|
72
73
|
useSaveAnymalMetadata: () => useSaveAnymalMetadata,
|
|
@@ -2391,12 +2392,64 @@ function useUpdateOrgWalletAddress() {
|
|
|
2391
2392
|
);
|
|
2392
2393
|
}
|
|
2393
2394
|
|
|
2395
|
+
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
2396
|
+
var import_viem10 = require("viem");
|
|
2397
|
+
var import_react23 = require("react");
|
|
2398
|
+
function useMintOrgAnymalNFT() {
|
|
2399
|
+
return (0, import_react23.useCallback)(
|
|
2400
|
+
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
2401
|
+
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
2402
|
+
return {
|
|
2403
|
+
success: false,
|
|
2404
|
+
message: "Missing authentication token OR NFT ID."
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
const functionName = "submitMetadataByCampaignName";
|
|
2408
|
+
const args = [
|
|
2409
|
+
pid,
|
|
2410
|
+
nftId,
|
|
2411
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
2412
|
+
"petastic-signup-campaign-1",
|
|
2413
|
+
anymalTxId
|
|
2414
|
+
];
|
|
2415
|
+
const callData = (0, import_viem10.encodeFunctionData)({
|
|
2416
|
+
abi: PET_NFT_ABI,
|
|
2417
|
+
functionName,
|
|
2418
|
+
args
|
|
2419
|
+
});
|
|
2420
|
+
const executeArgs = [validationContractAddress, callData];
|
|
2421
|
+
const executeSubmitMetaCalldata = (0, import_viem10.encodeFunctionData)({
|
|
2422
|
+
abi: ORGANIZATION_IMPL_ABI,
|
|
2423
|
+
functionName: ORG_FUNCTION,
|
|
2424
|
+
args: executeArgs
|
|
2425
|
+
});
|
|
2426
|
+
await simulateCall(
|
|
2427
|
+
bundlerClient.client,
|
|
2428
|
+
orgContractAddress,
|
|
2429
|
+
ORGANIZATION_IMPL_ABI,
|
|
2430
|
+
ORG_FUNCTION,
|
|
2431
|
+
executeArgs,
|
|
2432
|
+
managerSmartAccount.address
|
|
2433
|
+
);
|
|
2434
|
+
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2435
|
+
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2436
|
+
account: managerSmartAccount,
|
|
2437
|
+
calls: [{ to: orgContractAddress, data: executeSubmitMetaCalldata }],
|
|
2438
|
+
paymaster: true
|
|
2439
|
+
});
|
|
2440
|
+
await waitForReceiptWithRetries(bundlerClient, userOpHash);
|
|
2441
|
+
return { success: true, message: "Pet Passport Created!" };
|
|
2442
|
+
},
|
|
2443
|
+
[]
|
|
2444
|
+
);
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2394
2447
|
// src/helpers/NonceHelper.tsx
|
|
2395
2448
|
var import_uuid = require("uuid");
|
|
2396
|
-
var
|
|
2449
|
+
var import_viem11 = require("viem");
|
|
2397
2450
|
var generateBytes32Nonce = () => {
|
|
2398
2451
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
2399
|
-
return (0,
|
|
2452
|
+
return (0, import_viem11.padHex)(`0x${uuid3}`, { size: 32 });
|
|
2400
2453
|
};
|
|
2401
2454
|
|
|
2402
2455
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -2606,9 +2659,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
2606
2659
|
}
|
|
2607
2660
|
|
|
2608
2661
|
// src/utils/actions/useFetchActions.ts
|
|
2609
|
-
var
|
|
2662
|
+
var import_react24 = require("react");
|
|
2610
2663
|
function useFetchActions() {
|
|
2611
|
-
return (0,
|
|
2664
|
+
return (0, import_react24.useCallback)(
|
|
2612
2665
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
2613
2666
|
const params = new URLSearchParams({ pid });
|
|
2614
2667
|
if (status) params.set("status", status);
|
|
@@ -2637,9 +2690,9 @@ function useFetchActions() {
|
|
|
2637
2690
|
}
|
|
2638
2691
|
|
|
2639
2692
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
2640
|
-
var
|
|
2693
|
+
var import_react25 = require("react");
|
|
2641
2694
|
function useFetchActionDefinitions() {
|
|
2642
|
-
return (0,
|
|
2695
|
+
return (0, import_react25.useCallback)(
|
|
2643
2696
|
async (idToken, actionsServiceBaseUrl) => {
|
|
2644
2697
|
try {
|
|
2645
2698
|
const response = await fetch(
|
|
@@ -2736,10 +2789,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
2736
2789
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
2737
2790
|
|
|
2738
2791
|
// src/utils/application/useCreateUserAppData.ts
|
|
2739
|
-
var
|
|
2792
|
+
var import_react26 = require("react");
|
|
2740
2793
|
var import_uuid2 = require("uuid");
|
|
2741
2794
|
function useCreateUserAppData() {
|
|
2742
|
-
return (0,
|
|
2795
|
+
return (0, import_react26.useCallback)(
|
|
2743
2796
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
2744
2797
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
2745
2798
|
const appValues = {
|
|
@@ -2794,10 +2847,10 @@ function useCreateUserAppData() {
|
|
|
2794
2847
|
}
|
|
2795
2848
|
|
|
2796
2849
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
2797
|
-
var
|
|
2850
|
+
var import_react27 = require("react");
|
|
2798
2851
|
var import_uuid3 = require("uuid");
|
|
2799
2852
|
function useCreateOrganizationAppData() {
|
|
2800
|
-
return (0,
|
|
2853
|
+
return (0, import_react27.useCallback)(
|
|
2801
2854
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
2802
2855
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
2803
2856
|
const appValues = {
|
|
@@ -2851,17 +2904,17 @@ function useCreateOrganizationAppData() {
|
|
|
2851
2904
|
}
|
|
2852
2905
|
|
|
2853
2906
|
// src/utils/balance/useFetchBalance.ts
|
|
2854
|
-
var
|
|
2855
|
-
var
|
|
2907
|
+
var import_react28 = require("react");
|
|
2908
|
+
var import_viem12 = require("viem");
|
|
2856
2909
|
function useFetchBalance() {
|
|
2857
|
-
return (0,
|
|
2910
|
+
return (0, import_react28.useCallback)(
|
|
2858
2911
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2859
2912
|
try {
|
|
2860
2913
|
const balance = await publicClient.readContract({
|
|
2861
|
-
address: (0,
|
|
2862
|
-
abi:
|
|
2914
|
+
address: (0, import_viem12.getAddress)(kibbleTokenAddress),
|
|
2915
|
+
abi: import_viem12.erc20Abi,
|
|
2863
2916
|
functionName: "balanceOf",
|
|
2864
|
-
args: [(0,
|
|
2917
|
+
args: [(0, import_viem12.getAddress)(walletAddress)]
|
|
2865
2918
|
});
|
|
2866
2919
|
return Number(balance);
|
|
2867
2920
|
} catch (error) {
|
|
@@ -2873,10 +2926,10 @@ function useFetchBalance() {
|
|
|
2873
2926
|
}
|
|
2874
2927
|
|
|
2875
2928
|
// src/utils/actions/useClaimActionReward.ts
|
|
2876
|
-
var
|
|
2877
|
-
var
|
|
2929
|
+
var import_viem13 = require("viem");
|
|
2930
|
+
var import_react29 = require("react");
|
|
2878
2931
|
function useClaimActionReward() {
|
|
2879
|
-
return (0,
|
|
2932
|
+
return (0, import_react29.useCallback)(
|
|
2880
2933
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
2881
2934
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
2882
2935
|
return {
|
|
@@ -2886,7 +2939,7 @@ function useClaimActionReward() {
|
|
|
2886
2939
|
}
|
|
2887
2940
|
const args = [actionId, claimIndex];
|
|
2888
2941
|
const functionName = "claimByIndex";
|
|
2889
|
-
const callData = (0,
|
|
2942
|
+
const callData = (0, import_viem13.encodeFunctionData)({
|
|
2890
2943
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2891
2944
|
functionName,
|
|
2892
2945
|
args
|
|
@@ -2922,10 +2975,10 @@ function useClaimActionReward() {
|
|
|
2922
2975
|
}
|
|
2923
2976
|
|
|
2924
2977
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2925
|
-
var
|
|
2926
|
-
var
|
|
2978
|
+
var import_viem14 = require("viem");
|
|
2979
|
+
var import_react30 = require("react");
|
|
2927
2980
|
function useClaimOrgActionReward() {
|
|
2928
|
-
return (0,
|
|
2981
|
+
return (0, import_react30.useCallback)(
|
|
2929
2982
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
2930
2983
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
2931
2984
|
return {
|
|
@@ -2933,13 +2986,13 @@ function useClaimOrgActionReward() {
|
|
|
2933
2986
|
message: "Missing web3auth account info or contract address."
|
|
2934
2987
|
};
|
|
2935
2988
|
}
|
|
2936
|
-
const claimCallData = (0,
|
|
2989
|
+
const claimCallData = (0, import_viem14.encodeFunctionData)({
|
|
2937
2990
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2938
2991
|
functionName: "claimByIndex",
|
|
2939
2992
|
args: [actionId, claimIndex]
|
|
2940
2993
|
});
|
|
2941
2994
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
2942
|
-
const executeClaimCalldata = (0,
|
|
2995
|
+
const executeClaimCalldata = (0, import_viem14.encodeFunctionData)({
|
|
2943
2996
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2944
2997
|
functionName: ORG_FUNCTION,
|
|
2945
2998
|
args
|
|
@@ -2975,9 +3028,9 @@ function useClaimOrgActionReward() {
|
|
|
2975
3028
|
}
|
|
2976
3029
|
|
|
2977
3030
|
// src/utils/actions/useSubmitContractAction.ts
|
|
2978
|
-
var
|
|
3031
|
+
var import_react31 = require("react");
|
|
2979
3032
|
function useSubmitContractAction() {
|
|
2980
|
-
return (0,
|
|
3033
|
+
return (0, import_react31.useCallback)(
|
|
2981
3034
|
(idToken, pid, source, endpoint, payload) => {
|
|
2982
3035
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2983
3036
|
let sourceTypePayload = {};
|
|
@@ -3141,6 +3194,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
3141
3194
|
useFetchNotifications,
|
|
3142
3195
|
useFetchUserData,
|
|
3143
3196
|
useMintAnymalNFT,
|
|
3197
|
+
useMintOrgAnymalNFT,
|
|
3144
3198
|
useProcessOrgPartialKibblePayment,
|
|
3145
3199
|
useProcessPartialKibblePayment,
|
|
3146
3200
|
useSaveAnymalMetadata,
|
package/dist/index.mjs
CHANGED
|
@@ -2320,6 +2320,58 @@ function useUpdateOrgWalletAddress() {
|
|
|
2320
2320
|
);
|
|
2321
2321
|
}
|
|
2322
2322
|
|
|
2323
|
+
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
2324
|
+
import { encodeFunctionData as encodeFunctionData7 } from "viem";
|
|
2325
|
+
import { useCallback as useCallback23 } from "react";
|
|
2326
|
+
function useMintOrgAnymalNFT() {
|
|
2327
|
+
return useCallback23(
|
|
2328
|
+
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
2329
|
+
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
2330
|
+
return {
|
|
2331
|
+
success: false,
|
|
2332
|
+
message: "Missing authentication token OR NFT ID."
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
const functionName = "submitMetadataByCampaignName";
|
|
2336
|
+
const args = [
|
|
2337
|
+
pid,
|
|
2338
|
+
nftId,
|
|
2339
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
2340
|
+
"petastic-signup-campaign-1",
|
|
2341
|
+
anymalTxId
|
|
2342
|
+
];
|
|
2343
|
+
const callData = encodeFunctionData7({
|
|
2344
|
+
abi: PET_NFT_ABI,
|
|
2345
|
+
functionName,
|
|
2346
|
+
args
|
|
2347
|
+
});
|
|
2348
|
+
const executeArgs = [validationContractAddress, callData];
|
|
2349
|
+
const executeSubmitMetaCalldata = encodeFunctionData7({
|
|
2350
|
+
abi: ORGANIZATION_IMPL_ABI,
|
|
2351
|
+
functionName: ORG_FUNCTION,
|
|
2352
|
+
args: executeArgs
|
|
2353
|
+
});
|
|
2354
|
+
await simulateCall(
|
|
2355
|
+
bundlerClient.client,
|
|
2356
|
+
orgContractAddress,
|
|
2357
|
+
ORGANIZATION_IMPL_ABI,
|
|
2358
|
+
ORG_FUNCTION,
|
|
2359
|
+
executeArgs,
|
|
2360
|
+
managerSmartAccount.address
|
|
2361
|
+
);
|
|
2362
|
+
await applyBundlerGasEstimator(managerSmartAccount, bundlerClient);
|
|
2363
|
+
const userOpHash = await sendUserOpWithRetries(bundlerClient, {
|
|
2364
|
+
account: managerSmartAccount,
|
|
2365
|
+
calls: [{ to: orgContractAddress, data: executeSubmitMetaCalldata }],
|
|
2366
|
+
paymaster: true
|
|
2367
|
+
});
|
|
2368
|
+
await waitForReceiptWithRetries(bundlerClient, userOpHash);
|
|
2369
|
+
return { success: true, message: "Pet Passport Created!" };
|
|
2370
|
+
},
|
|
2371
|
+
[]
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2323
2375
|
// src/helpers/NonceHelper.tsx
|
|
2324
2376
|
import { v4 as uuidv4 } from "uuid";
|
|
2325
2377
|
import { padHex } from "viem";
|
|
@@ -2352,9 +2404,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
2352
2404
|
}
|
|
2353
2405
|
|
|
2354
2406
|
// src/utils/actions/useFetchActions.ts
|
|
2355
|
-
import { useCallback as
|
|
2407
|
+
import { useCallback as useCallback24 } from "react";
|
|
2356
2408
|
function useFetchActions() {
|
|
2357
|
-
return
|
|
2409
|
+
return useCallback24(
|
|
2358
2410
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
2359
2411
|
const params = new URLSearchParams({ pid });
|
|
2360
2412
|
if (status) params.set("status", status);
|
|
@@ -2383,9 +2435,9 @@ function useFetchActions() {
|
|
|
2383
2435
|
}
|
|
2384
2436
|
|
|
2385
2437
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
2386
|
-
import { useCallback as
|
|
2438
|
+
import { useCallback as useCallback25 } from "react";
|
|
2387
2439
|
function useFetchActionDefinitions() {
|
|
2388
|
-
return
|
|
2440
|
+
return useCallback25(
|
|
2389
2441
|
async (idToken, actionsServiceBaseUrl) => {
|
|
2390
2442
|
try {
|
|
2391
2443
|
const response = await fetch(
|
|
@@ -2482,10 +2534,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
2482
2534
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
2483
2535
|
|
|
2484
2536
|
// src/utils/application/useCreateUserAppData.ts
|
|
2485
|
-
import { useCallback as
|
|
2537
|
+
import { useCallback as useCallback26 } from "react";
|
|
2486
2538
|
import { v4 as uuid } from "uuid";
|
|
2487
2539
|
function useCreateUserAppData() {
|
|
2488
|
-
return
|
|
2540
|
+
return useCallback26(
|
|
2489
2541
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
2490
2542
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
2491
2543
|
const appValues = {
|
|
@@ -2540,10 +2592,10 @@ function useCreateUserAppData() {
|
|
|
2540
2592
|
}
|
|
2541
2593
|
|
|
2542
2594
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
2543
|
-
import { useCallback as
|
|
2595
|
+
import { useCallback as useCallback27 } from "react";
|
|
2544
2596
|
import { v4 as uuid2 } from "uuid";
|
|
2545
2597
|
function useCreateOrganizationAppData() {
|
|
2546
|
-
return
|
|
2598
|
+
return useCallback27(
|
|
2547
2599
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
2548
2600
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
2549
2601
|
const appValues = {
|
|
@@ -2597,10 +2649,10 @@ function useCreateOrganizationAppData() {
|
|
|
2597
2649
|
}
|
|
2598
2650
|
|
|
2599
2651
|
// src/utils/balance/useFetchBalance.ts
|
|
2600
|
-
import { useCallback as
|
|
2652
|
+
import { useCallback as useCallback28 } from "react";
|
|
2601
2653
|
import { erc20Abi as erc20Abi4, getAddress } from "viem";
|
|
2602
2654
|
function useFetchBalance() {
|
|
2603
|
-
return
|
|
2655
|
+
return useCallback28(
|
|
2604
2656
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2605
2657
|
try {
|
|
2606
2658
|
const balance = await publicClient.readContract({
|
|
@@ -2619,10 +2671,10 @@ function useFetchBalance() {
|
|
|
2619
2671
|
}
|
|
2620
2672
|
|
|
2621
2673
|
// src/utils/actions/useClaimActionReward.ts
|
|
2622
|
-
import { encodeFunctionData as
|
|
2623
|
-
import { useCallback as
|
|
2674
|
+
import { encodeFunctionData as encodeFunctionData8 } from "viem";
|
|
2675
|
+
import { useCallback as useCallback29 } from "react";
|
|
2624
2676
|
function useClaimActionReward() {
|
|
2625
|
-
return
|
|
2677
|
+
return useCallback29(
|
|
2626
2678
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
2627
2679
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
2628
2680
|
return {
|
|
@@ -2632,7 +2684,7 @@ function useClaimActionReward() {
|
|
|
2632
2684
|
}
|
|
2633
2685
|
const args = [actionId, claimIndex];
|
|
2634
2686
|
const functionName = "claimByIndex";
|
|
2635
|
-
const callData =
|
|
2687
|
+
const callData = encodeFunctionData8({
|
|
2636
2688
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2637
2689
|
functionName,
|
|
2638
2690
|
args
|
|
@@ -2668,10 +2720,10 @@ function useClaimActionReward() {
|
|
|
2668
2720
|
}
|
|
2669
2721
|
|
|
2670
2722
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
2671
|
-
import { encodeFunctionData as
|
|
2672
|
-
import { useCallback as
|
|
2723
|
+
import { encodeFunctionData as encodeFunctionData9 } from "viem";
|
|
2724
|
+
import { useCallback as useCallback30 } from "react";
|
|
2673
2725
|
function useClaimOrgActionReward() {
|
|
2674
|
-
return
|
|
2726
|
+
return useCallback30(
|
|
2675
2727
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
2676
2728
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
2677
2729
|
return {
|
|
@@ -2679,13 +2731,13 @@ function useClaimOrgActionReward() {
|
|
|
2679
2731
|
message: "Missing web3auth account info or contract address."
|
|
2680
2732
|
};
|
|
2681
2733
|
}
|
|
2682
|
-
const claimCallData =
|
|
2734
|
+
const claimCallData = encodeFunctionData9({
|
|
2683
2735
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2684
2736
|
functionName: "claimByIndex",
|
|
2685
2737
|
args: [actionId, claimIndex]
|
|
2686
2738
|
});
|
|
2687
2739
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
2688
|
-
const executeClaimCalldata =
|
|
2740
|
+
const executeClaimCalldata = encodeFunctionData9({
|
|
2689
2741
|
abi: ORGANIZATION_IMPL_ABI,
|
|
2690
2742
|
functionName: ORG_FUNCTION,
|
|
2691
2743
|
args
|
|
@@ -2721,9 +2773,9 @@ function useClaimOrgActionReward() {
|
|
|
2721
2773
|
}
|
|
2722
2774
|
|
|
2723
2775
|
// src/utils/actions/useSubmitContractAction.ts
|
|
2724
|
-
import { useCallback as
|
|
2776
|
+
import { useCallback as useCallback31 } from "react";
|
|
2725
2777
|
function useSubmitContractAction() {
|
|
2726
|
-
return
|
|
2778
|
+
return useCallback31(
|
|
2727
2779
|
(idToken, pid, source, endpoint, payload) => {
|
|
2728
2780
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
2729
2781
|
let sourceTypePayload = {};
|
|
@@ -2886,6 +2938,7 @@ export {
|
|
|
2886
2938
|
useFetchNotifications,
|
|
2887
2939
|
useFetchUserData,
|
|
2888
2940
|
useMintAnymalNFT,
|
|
2941
|
+
useMintOrgAnymalNFT,
|
|
2889
2942
|
useProcessOrgPartialKibblePayment,
|
|
2890
2943
|
useProcessPartialKibblePayment,
|
|
2891
2944
|
useSaveAnymalMetadata,
|
package/package.json
CHANGED