anymal-protocol 1.0.148 → 1.0.150
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 +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +123 -80
- package/dist/index.mjs +107 -65
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -443,6 +443,12 @@ declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, pid:
|
|
|
443
443
|
status: string;
|
|
444
444
|
}>;
|
|
445
445
|
|
|
446
|
+
declare function useCoinbaseClaimOrgActionReward(): (evmSmartAddress: `0x${string}`, orgContractAddress: `0x${string}`, rewardableActionContractAddress: string, actionId: string, claimIndex: number) => Promise<{
|
|
447
|
+
success: boolean;
|
|
448
|
+
message: string;
|
|
449
|
+
status: string;
|
|
450
|
+
}>;
|
|
451
|
+
|
|
446
452
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
|
447
453
|
success: boolean;
|
|
448
454
|
message: string;
|
|
@@ -879,4 +885,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
879
885
|
*/
|
|
880
886
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
881
887
|
|
|
882
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -443,6 +443,12 @@ declare function useCoinbaseMintOrgAnymalNFT(): (evmAddress: `0x${string}`, pid:
|
|
|
443
443
|
status: string;
|
|
444
444
|
}>;
|
|
445
445
|
|
|
446
|
+
declare function useCoinbaseClaimOrgActionReward(): (evmSmartAddress: `0x${string}`, orgContractAddress: `0x${string}`, rewardableActionContractAddress: string, actionId: string, claimIndex: number) => Promise<{
|
|
447
|
+
success: boolean;
|
|
448
|
+
message: string;
|
|
449
|
+
status: string;
|
|
450
|
+
}>;
|
|
451
|
+
|
|
446
452
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
|
447
453
|
success: boolean;
|
|
448
454
|
message: string;
|
|
@@ -879,4 +885,4 @@ declare function useSubmitContractAction(): (idToken: string, pid: string, sourc
|
|
|
879
885
|
*/
|
|
880
886
|
declare function humanRevert(raw: `0x${string}` | undefined, shortMessage?: string): string;
|
|
881
887
|
|
|
882
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ __export(index_exports, {
|
|
|
62
62
|
useClaimActionReward: () => useClaimActionReward,
|
|
63
63
|
useClaimOrgActionReward: () => useClaimOrgActionReward,
|
|
64
64
|
useCoinbaseClaimActionReward: () => useCoinbaseClaimActionReward,
|
|
65
|
+
useCoinbaseClaimOrgActionReward: () => useCoinbaseClaimOrgActionReward,
|
|
65
66
|
useCoinbaseCreateOrganizationWallet: () => useCoinbaseCreateOrganizationWallet,
|
|
66
67
|
useCoinbaseMintAnymalNFT: () => useCoinbaseMintAnymalNFT,
|
|
67
68
|
useCoinbaseMintOrgAnymalNFT: () => useCoinbaseMintOrgAnymalNFT,
|
|
@@ -3066,6 +3067,7 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
3066
3067
|
|
|
3067
3068
|
// src/utils/coinbase/useCoinbaseMintOrgAnymalNFT.ts
|
|
3068
3069
|
var import_react14 = require("react");
|
|
3070
|
+
var import_viem4 = require("viem");
|
|
3069
3071
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
3070
3072
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3071
3073
|
return (0, import_react14.useCallback)(
|
|
@@ -3077,18 +3079,25 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3077
3079
|
status: "error"
|
|
3078
3080
|
};
|
|
3079
3081
|
}
|
|
3082
|
+
const args = [
|
|
3083
|
+
pid,
|
|
3084
|
+
nftId,
|
|
3085
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
3086
|
+
"petastic-signup-campaign-1",
|
|
3087
|
+
anymalTxId
|
|
3088
|
+
];
|
|
3089
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
3090
|
+
abi: PET_NFT_ABI,
|
|
3091
|
+
functionName: "submitMetadataByCampaignName",
|
|
3092
|
+
args
|
|
3093
|
+
});
|
|
3094
|
+
const executeArgs = [validationContractAddress, callData];
|
|
3080
3095
|
const result = await sendOperationFn(
|
|
3081
3096
|
evmAddress,
|
|
3082
3097
|
validationContractAddress,
|
|
3083
3098
|
PET_NFT_ABI,
|
|
3084
3099
|
"submitMetadataByCampaignName",
|
|
3085
|
-
|
|
3086
|
-
pid,
|
|
3087
|
-
nftId,
|
|
3088
|
-
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
3089
|
-
"petastic-signup-campaign-1",
|
|
3090
|
-
anymalTxId
|
|
3091
|
-
]
|
|
3100
|
+
executeArgs
|
|
3092
3101
|
);
|
|
3093
3102
|
return { ...result, status };
|
|
3094
3103
|
},
|
|
@@ -3096,9 +3105,42 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3096
3105
|
);
|
|
3097
3106
|
}
|
|
3098
3107
|
|
|
3099
|
-
// src/utils/
|
|
3100
|
-
var import_viem5 = require("viem");
|
|
3108
|
+
// src/utils/coinbase/useCoinbaseClaimOrgActionReward.ts
|
|
3101
3109
|
var import_react15 = require("react");
|
|
3110
|
+
var import_viem5 = require("viem");
|
|
3111
|
+
function useCoinbaseClaimOrgActionReward() {
|
|
3112
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3113
|
+
return (0, import_react15.useCallback)(
|
|
3114
|
+
async (evmSmartAddress, orgContractAddress, rewardableActionContractAddress, actionId, claimIndex) => {
|
|
3115
|
+
if (!evmSmartAddress || !orgContractAddress || !actionId || claimIndex === void 0) {
|
|
3116
|
+
return {
|
|
3117
|
+
success: false,
|
|
3118
|
+
message: "Coinbase Org Kibble Claim: Missing Data",
|
|
3119
|
+
status: "error"
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
|
+
const claimCallData = (0, import_viem5.encodeFunctionData)({
|
|
3123
|
+
abi: REWARDABLE_ACTIONS_ABI,
|
|
3124
|
+
functionName: "claimByIndex",
|
|
3125
|
+
args: [actionId, claimIndex]
|
|
3126
|
+
});
|
|
3127
|
+
const args = [rewardableActionContractAddress, claimCallData];
|
|
3128
|
+
const result = await sendOperationFn(
|
|
3129
|
+
evmSmartAddress,
|
|
3130
|
+
orgContractAddress,
|
|
3131
|
+
ORGANIZATION_IMPL_ABI,
|
|
3132
|
+
ORG_FUNCTION,
|
|
3133
|
+
args
|
|
3134
|
+
);
|
|
3135
|
+
return { ...result, status };
|
|
3136
|
+
},
|
|
3137
|
+
[sendOperationFn, status]
|
|
3138
|
+
);
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3142
|
+
var import_viem7 = require("viem");
|
|
3143
|
+
var import_react16 = require("react");
|
|
3102
3144
|
|
|
3103
3145
|
// src/helpers/GasEstimateHelper.tsx
|
|
3104
3146
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3142,18 +3184,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3142
3184
|
}
|
|
3143
3185
|
|
|
3144
3186
|
// src/helpers/HumanRevert.tsx
|
|
3145
|
-
var
|
|
3187
|
+
var import_viem6 = require("viem");
|
|
3146
3188
|
function humanRevert(raw, shortMessage) {
|
|
3147
3189
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3148
3190
|
try {
|
|
3149
|
-
const { errorName, args } = (0,
|
|
3191
|
+
const { errorName, args } = (0, import_viem6.decodeErrorResult)({
|
|
3150
3192
|
abi: ERROR_ABI,
|
|
3151
3193
|
data: raw
|
|
3152
3194
|
});
|
|
3153
3195
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3154
3196
|
} catch {
|
|
3155
3197
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3156
|
-
return (0,
|
|
3198
|
+
return (0, import_viem6.hexToString)(`0x${raw.slice(138)}`);
|
|
3157
3199
|
}
|
|
3158
3200
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3159
3201
|
}
|
|
@@ -3179,7 +3221,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3179
3221
|
|
|
3180
3222
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3181
3223
|
function useMintAnymalNFT() {
|
|
3182
|
-
return (0,
|
|
3224
|
+
return (0, import_react16.useCallback)(
|
|
3183
3225
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3184
3226
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3185
3227
|
return {
|
|
@@ -3195,7 +3237,7 @@ function useMintAnymalNFT() {
|
|
|
3195
3237
|
"petastic-signup-campaign-1",
|
|
3196
3238
|
anymalTxId
|
|
3197
3239
|
];
|
|
3198
|
-
const callData = (0,
|
|
3240
|
+
const callData = (0, import_viem7.encodeFunctionData)({
|
|
3199
3241
|
abi: PET_NFT_ABI,
|
|
3200
3242
|
functionName,
|
|
3201
3243
|
args
|
|
@@ -3231,9 +3273,9 @@ function useMintAnymalNFT() {
|
|
|
3231
3273
|
}
|
|
3232
3274
|
|
|
3233
3275
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3234
|
-
var
|
|
3276
|
+
var import_react17 = require("react");
|
|
3235
3277
|
function useSaveAnymalMetadata() {
|
|
3236
|
-
return (0,
|
|
3278
|
+
return (0, import_react17.useCallback)(
|
|
3237
3279
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3238
3280
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3239
3281
|
method: "POST",
|
|
@@ -3261,7 +3303,7 @@ function useSaveAnymalMetadata() {
|
|
|
3261
3303
|
}
|
|
3262
3304
|
|
|
3263
3305
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3264
|
-
var
|
|
3306
|
+
var import_react18 = require("react");
|
|
3265
3307
|
|
|
3266
3308
|
// src/helpers/UploadImageHelper.tsx
|
|
3267
3309
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3318,7 +3360,7 @@ function toBase64(file) {
|
|
|
3318
3360
|
|
|
3319
3361
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3320
3362
|
function useUploadAnymalImage() {
|
|
3321
|
-
return (0,
|
|
3363
|
+
return (0, import_react18.useCallback)(
|
|
3322
3364
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3323
3365
|
if (!imageFile || !idToken) {
|
|
3324
3366
|
return {
|
|
@@ -3379,10 +3421,10 @@ function useUploadAnymalImage() {
|
|
|
3379
3421
|
}
|
|
3380
3422
|
|
|
3381
3423
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3382
|
-
var
|
|
3424
|
+
var import_react19 = require("react");
|
|
3383
3425
|
|
|
3384
3426
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3385
|
-
var
|
|
3427
|
+
var import_viem8 = require("viem");
|
|
3386
3428
|
|
|
3387
3429
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3388
3430
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3442,7 +3484,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3442
3484
|
deadline,
|
|
3443
3485
|
backendSignature
|
|
3444
3486
|
];
|
|
3445
|
-
const partialPayCalldata = (0,
|
|
3487
|
+
const partialPayCalldata = (0, import_viem8.encodeFunctionData)({
|
|
3446
3488
|
abi: MARKETPLACE_ABI,
|
|
3447
3489
|
functionName,
|
|
3448
3490
|
args
|
|
@@ -3479,7 +3521,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3479
3521
|
|
|
3480
3522
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3481
3523
|
function useProcessPartialKibblePayment() {
|
|
3482
|
-
return (0,
|
|
3524
|
+
return (0, import_react19.useCallback)(
|
|
3483
3525
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3484
3526
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3485
3527
|
return {
|
|
@@ -3535,23 +3577,23 @@ function useProcessPartialKibblePayment() {
|
|
|
3535
3577
|
}
|
|
3536
3578
|
|
|
3537
3579
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3538
|
-
var
|
|
3580
|
+
var import_react20 = require("react");
|
|
3539
3581
|
|
|
3540
3582
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3541
|
-
var
|
|
3583
|
+
var import_viem9 = require("viem");
|
|
3542
3584
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3543
3585
|
try {
|
|
3544
3586
|
const functionName = "approve";
|
|
3545
3587
|
const args = [spenderAddress, approveAmount];
|
|
3546
|
-
const approveCalldata = (0,
|
|
3547
|
-
abi:
|
|
3588
|
+
const approveCalldata = (0, import_viem9.encodeFunctionData)({
|
|
3589
|
+
abi: import_viem9.erc20Abi,
|
|
3548
3590
|
functionName,
|
|
3549
3591
|
args
|
|
3550
3592
|
});
|
|
3551
3593
|
await simulateCall(
|
|
3552
3594
|
bundlerClient.client,
|
|
3553
3595
|
kibbleTokenAddress,
|
|
3554
|
-
|
|
3596
|
+
import_viem9.erc20Abi,
|
|
3555
3597
|
functionName,
|
|
3556
3598
|
args,
|
|
3557
3599
|
smartAccount.address
|
|
@@ -3580,7 +3622,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3580
3622
|
|
|
3581
3623
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3582
3624
|
function useApproveKibbleToken() {
|
|
3583
|
-
return (0,
|
|
3625
|
+
return (0, import_react20.useCallback)(
|
|
3584
3626
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3585
3627
|
try {
|
|
3586
3628
|
const result = await processDirectKibbleApproval(
|
|
@@ -3607,10 +3649,10 @@ function useApproveKibbleToken() {
|
|
|
3607
3649
|
}
|
|
3608
3650
|
|
|
3609
3651
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3610
|
-
var
|
|
3611
|
-
var
|
|
3652
|
+
var import_react21 = require("react");
|
|
3653
|
+
var import_viem10 = require("viem");
|
|
3612
3654
|
function useCreateOrganizationBase() {
|
|
3613
|
-
return (0,
|
|
3655
|
+
return (0, import_react21.useCallback)(
|
|
3614
3656
|
/**
|
|
3615
3657
|
* Creates a new organization on-chain.
|
|
3616
3658
|
*
|
|
@@ -3632,7 +3674,7 @@ function useCreateOrganizationBase() {
|
|
|
3632
3674
|
try {
|
|
3633
3675
|
const functionName = "createOrganizationProxy";
|
|
3634
3676
|
const args = [ownerAddress, orgName, orgPid];
|
|
3635
|
-
const callData = (0,
|
|
3677
|
+
const callData = (0, import_viem10.encodeFunctionData)({
|
|
3636
3678
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3637
3679
|
functionName,
|
|
3638
3680
|
args
|
|
@@ -3670,7 +3712,7 @@ function useCreateOrganizationBase() {
|
|
|
3670
3712
|
let proxyAddress;
|
|
3671
3713
|
for (const log of txReceipt.logs) {
|
|
3672
3714
|
try {
|
|
3673
|
-
const decoded = (0,
|
|
3715
|
+
const decoded = (0, import_viem10.decodeEventLog)({
|
|
3674
3716
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3675
3717
|
data: log.data,
|
|
3676
3718
|
topics: log.topics
|
|
@@ -3706,13 +3748,13 @@ function useCreateOrganizationBase() {
|
|
|
3706
3748
|
}
|
|
3707
3749
|
|
|
3708
3750
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3709
|
-
var
|
|
3751
|
+
var import_react22 = require("react");
|
|
3710
3752
|
|
|
3711
3753
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3712
|
-
var
|
|
3754
|
+
var import_viem12 = require("viem");
|
|
3713
3755
|
|
|
3714
3756
|
// src/helpers/WaitForAllowance.tsx
|
|
3715
|
-
var
|
|
3757
|
+
var import_viem11 = require("viem");
|
|
3716
3758
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3717
3759
|
const MAX_RETRIES = 10;
|
|
3718
3760
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3721,7 +3763,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3721
3763
|
try {
|
|
3722
3764
|
const currentAllowance = await publicClient.readContract({
|
|
3723
3765
|
address: tokenAddress,
|
|
3724
|
-
abi:
|
|
3766
|
+
abi: import_viem11.erc20Abi,
|
|
3725
3767
|
functionName: "allowance",
|
|
3726
3768
|
args: [ownerAddress, spenderAddress]
|
|
3727
3769
|
});
|
|
@@ -3746,13 +3788,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3746
3788
|
if (approveAmount <= 0n) {
|
|
3747
3789
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3748
3790
|
}
|
|
3749
|
-
const approveCalldata = (0,
|
|
3750
|
-
abi:
|
|
3791
|
+
const approveCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3792
|
+
abi: import_viem12.erc20Abi,
|
|
3751
3793
|
functionName: "approve",
|
|
3752
3794
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3753
3795
|
});
|
|
3754
3796
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3755
|
-
const executeApproveCalldata = (0,
|
|
3797
|
+
const executeApproveCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3756
3798
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3757
3799
|
functionName: ORG_FUNCTION,
|
|
3758
3800
|
args
|
|
@@ -3804,7 +3846,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3804
3846
|
|
|
3805
3847
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3806
3848
|
function useApproveOrgPartialPayment() {
|
|
3807
|
-
return (0,
|
|
3849
|
+
return (0, import_react22.useCallback)(
|
|
3808
3850
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3809
3851
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3810
3852
|
return {
|
|
@@ -3836,13 +3878,13 @@ function useApproveOrgPartialPayment() {
|
|
|
3836
3878
|
}
|
|
3837
3879
|
|
|
3838
3880
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3839
|
-
var
|
|
3881
|
+
var import_react23 = require("react");
|
|
3840
3882
|
|
|
3841
3883
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3842
|
-
var
|
|
3884
|
+
var import_viem13 = require("viem");
|
|
3843
3885
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3844
3886
|
try {
|
|
3845
|
-
const partialPayCalldata = (0,
|
|
3887
|
+
const partialPayCalldata = (0, import_viem13.encodeFunctionData)({
|
|
3846
3888
|
abi: MARKETPLACE_ABI,
|
|
3847
3889
|
functionName: "partialPay",
|
|
3848
3890
|
args: [
|
|
@@ -3857,7 +3899,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3857
3899
|
]
|
|
3858
3900
|
});
|
|
3859
3901
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3860
|
-
const executePartialPayCalldata = (0,
|
|
3902
|
+
const executePartialPayCalldata = (0, import_viem13.encodeFunctionData)({
|
|
3861
3903
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3862
3904
|
functionName: ORG_FUNCTION,
|
|
3863
3905
|
args
|
|
@@ -3894,7 +3936,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3894
3936
|
|
|
3895
3937
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3896
3938
|
function useProcessOrgPartialKibblePayment() {
|
|
3897
|
-
return (0,
|
|
3939
|
+
return (0, import_react23.useCallback)(
|
|
3898
3940
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3899
3941
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3900
3942
|
return {
|
|
@@ -3932,9 +3974,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3932
3974
|
}
|
|
3933
3975
|
|
|
3934
3976
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3935
|
-
var
|
|
3977
|
+
var import_react24 = require("react");
|
|
3936
3978
|
function useUpdateOrgWalletAddress() {
|
|
3937
|
-
return (0,
|
|
3979
|
+
return (0, import_react24.useCallback)(
|
|
3938
3980
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3939
3981
|
try {
|
|
3940
3982
|
const mutation = `
|
|
@@ -3973,10 +4015,10 @@ function useUpdateOrgWalletAddress() {
|
|
|
3973
4015
|
}
|
|
3974
4016
|
|
|
3975
4017
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3976
|
-
var
|
|
3977
|
-
var
|
|
4018
|
+
var import_viem14 = require("viem");
|
|
4019
|
+
var import_react25 = require("react");
|
|
3978
4020
|
function useMintOrgAnymalNFT() {
|
|
3979
|
-
return (0,
|
|
4021
|
+
return (0, import_react25.useCallback)(
|
|
3980
4022
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
3981
4023
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
3982
4024
|
return {
|
|
@@ -3992,13 +4034,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3992
4034
|
"petastic-signup-campaign-1",
|
|
3993
4035
|
anymalTxId
|
|
3994
4036
|
];
|
|
3995
|
-
const callData = (0,
|
|
4037
|
+
const callData = (0, import_viem14.encodeFunctionData)({
|
|
3996
4038
|
abi: PET_NFT_ABI,
|
|
3997
4039
|
functionName,
|
|
3998
4040
|
args
|
|
3999
4041
|
});
|
|
4000
4042
|
const executeArgs = [validationContractAddress, callData];
|
|
4001
|
-
const executeSubmitMetaCalldata = (0,
|
|
4043
|
+
const executeSubmitMetaCalldata = (0, import_viem14.encodeFunctionData)({
|
|
4002
4044
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4003
4045
|
functionName: ORG_FUNCTION,
|
|
4004
4046
|
args: executeArgs
|
|
@@ -4031,10 +4073,10 @@ function useMintOrgAnymalNFT() {
|
|
|
4031
4073
|
|
|
4032
4074
|
// src/helpers/NonceHelper.tsx
|
|
4033
4075
|
var import_uuid = require("uuid");
|
|
4034
|
-
var
|
|
4076
|
+
var import_viem15 = require("viem");
|
|
4035
4077
|
var generateBytes32Nonce = () => {
|
|
4036
4078
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
4037
|
-
return (0,
|
|
4079
|
+
return (0, import_viem15.padHex)(`0x${uuid3}`, { size: 32 });
|
|
4038
4080
|
};
|
|
4039
4081
|
|
|
4040
4082
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4244,9 +4286,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
4244
4286
|
}
|
|
4245
4287
|
|
|
4246
4288
|
// src/utils/actions/useFetchActions.ts
|
|
4247
|
-
var
|
|
4289
|
+
var import_react26 = require("react");
|
|
4248
4290
|
function useFetchActions() {
|
|
4249
|
-
return (0,
|
|
4291
|
+
return (0, import_react26.useCallback)(
|
|
4250
4292
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
4251
4293
|
const params = new URLSearchParams({ pid });
|
|
4252
4294
|
if (status) params.set("status", status);
|
|
@@ -4275,9 +4317,9 @@ function useFetchActions() {
|
|
|
4275
4317
|
}
|
|
4276
4318
|
|
|
4277
4319
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4278
|
-
var
|
|
4320
|
+
var import_react27 = require("react");
|
|
4279
4321
|
function useFetchActionDefinitions() {
|
|
4280
|
-
return (0,
|
|
4322
|
+
return (0, import_react27.useCallback)(
|
|
4281
4323
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4282
4324
|
try {
|
|
4283
4325
|
const response = await fetch(
|
|
@@ -4374,10 +4416,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4374
4416
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4375
4417
|
|
|
4376
4418
|
// src/utils/application/useCreateUserAppData.ts
|
|
4377
|
-
var
|
|
4419
|
+
var import_react28 = require("react");
|
|
4378
4420
|
var import_uuid2 = require("uuid");
|
|
4379
4421
|
function useCreateUserAppData() {
|
|
4380
|
-
return (0,
|
|
4422
|
+
return (0, import_react28.useCallback)(
|
|
4381
4423
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4382
4424
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4383
4425
|
const appValues = {
|
|
@@ -4432,10 +4474,10 @@ function useCreateUserAppData() {
|
|
|
4432
4474
|
}
|
|
4433
4475
|
|
|
4434
4476
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4435
|
-
var
|
|
4477
|
+
var import_react29 = require("react");
|
|
4436
4478
|
var import_uuid3 = require("uuid");
|
|
4437
4479
|
function useCreateOrganizationAppData() {
|
|
4438
|
-
return (0,
|
|
4480
|
+
return (0, import_react29.useCallback)(
|
|
4439
4481
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4440
4482
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4441
4483
|
const appValues = {
|
|
@@ -4489,17 +4531,17 @@ function useCreateOrganizationAppData() {
|
|
|
4489
4531
|
}
|
|
4490
4532
|
|
|
4491
4533
|
// src/utils/balance/useFetchBalance.ts
|
|
4492
|
-
var
|
|
4493
|
-
var
|
|
4534
|
+
var import_react30 = require("react");
|
|
4535
|
+
var import_viem16 = require("viem");
|
|
4494
4536
|
function useFetchBalance() {
|
|
4495
|
-
return (0,
|
|
4537
|
+
return (0, import_react30.useCallback)(
|
|
4496
4538
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4497
4539
|
try {
|
|
4498
4540
|
const balance = await publicClient.readContract({
|
|
4499
|
-
address: (0,
|
|
4500
|
-
abi:
|
|
4541
|
+
address: (0, import_viem16.getAddress)(kibbleTokenAddress),
|
|
4542
|
+
abi: import_viem16.erc20Abi,
|
|
4501
4543
|
functionName: "balanceOf",
|
|
4502
|
-
args: [(0,
|
|
4544
|
+
args: [(0, import_viem16.getAddress)(walletAddress)]
|
|
4503
4545
|
});
|
|
4504
4546
|
return Number(balance);
|
|
4505
4547
|
} catch (error) {
|
|
@@ -4511,10 +4553,10 @@ function useFetchBalance() {
|
|
|
4511
4553
|
}
|
|
4512
4554
|
|
|
4513
4555
|
// src/utils/actions/useClaimActionReward.ts
|
|
4514
|
-
var
|
|
4515
|
-
var
|
|
4556
|
+
var import_viem17 = require("viem");
|
|
4557
|
+
var import_react31 = require("react");
|
|
4516
4558
|
function useClaimActionReward() {
|
|
4517
|
-
return (0,
|
|
4559
|
+
return (0, import_react31.useCallback)(
|
|
4518
4560
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4519
4561
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4520
4562
|
return {
|
|
@@ -4524,7 +4566,7 @@ function useClaimActionReward() {
|
|
|
4524
4566
|
}
|
|
4525
4567
|
const args = [actionId, claimIndex];
|
|
4526
4568
|
const functionName = "claimByIndex";
|
|
4527
|
-
const callData = (0,
|
|
4569
|
+
const callData = (0, import_viem17.encodeFunctionData)({
|
|
4528
4570
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4529
4571
|
functionName,
|
|
4530
4572
|
args
|
|
@@ -4560,10 +4602,10 @@ function useClaimActionReward() {
|
|
|
4560
4602
|
}
|
|
4561
4603
|
|
|
4562
4604
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4563
|
-
var
|
|
4564
|
-
var
|
|
4605
|
+
var import_viem18 = require("viem");
|
|
4606
|
+
var import_react32 = require("react");
|
|
4565
4607
|
function useClaimOrgActionReward() {
|
|
4566
|
-
return (0,
|
|
4608
|
+
return (0, import_react32.useCallback)(
|
|
4567
4609
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4568
4610
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4569
4611
|
return {
|
|
@@ -4571,13 +4613,13 @@ function useClaimOrgActionReward() {
|
|
|
4571
4613
|
message: "Missing web3auth account info or contract address."
|
|
4572
4614
|
};
|
|
4573
4615
|
}
|
|
4574
|
-
const claimCallData = (0,
|
|
4616
|
+
const claimCallData = (0, import_viem18.encodeFunctionData)({
|
|
4575
4617
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4576
4618
|
functionName: "claimByIndex",
|
|
4577
4619
|
args: [actionId, claimIndex]
|
|
4578
4620
|
});
|
|
4579
4621
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4580
|
-
const executeClaimCalldata = (0,
|
|
4622
|
+
const executeClaimCalldata = (0, import_viem18.encodeFunctionData)({
|
|
4581
4623
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4582
4624
|
functionName: ORG_FUNCTION,
|
|
4583
4625
|
args
|
|
@@ -4613,9 +4655,9 @@ function useClaimOrgActionReward() {
|
|
|
4613
4655
|
}
|
|
4614
4656
|
|
|
4615
4657
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4616
|
-
var
|
|
4658
|
+
var import_react33 = require("react");
|
|
4617
4659
|
function useSubmitContractAction() {
|
|
4618
|
-
return (0,
|
|
4660
|
+
return (0, import_react33.useCallback)(
|
|
4619
4661
|
(idToken, pid, source, endpoint, payload) => {
|
|
4620
4662
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4621
4663
|
let sourceTypePayload = {};
|
|
@@ -4774,6 +4816,7 @@ function isMarketplacePurchaseAction(payload) {
|
|
|
4774
4816
|
useClaimActionReward,
|
|
4775
4817
|
useClaimOrgActionReward,
|
|
4776
4818
|
useCoinbaseClaimActionReward,
|
|
4819
|
+
useCoinbaseClaimOrgActionReward,
|
|
4777
4820
|
useCoinbaseCreateOrganizationWallet,
|
|
4778
4821
|
useCoinbaseMintAnymalNFT,
|
|
4779
4822
|
useCoinbaseMintOrgAnymalNFT,
|
package/dist/index.mjs
CHANGED
|
@@ -2986,6 +2986,7 @@ function useCoinbaseCreateOrganizationWallet() {
|
|
|
2986
2986
|
|
|
2987
2987
|
// src/utils/coinbase/useCoinbaseMintOrgAnymalNFT.ts
|
|
2988
2988
|
import { useCallback as useCallback14 } from "react";
|
|
2989
|
+
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
2989
2990
|
function useCoinbaseMintOrgAnymalNFT() {
|
|
2990
2991
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2991
2992
|
return useCallback14(
|
|
@@ -2997,18 +2998,25 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
2997
2998
|
status: "error"
|
|
2998
2999
|
};
|
|
2999
3000
|
}
|
|
3001
|
+
const args = [
|
|
3002
|
+
pid,
|
|
3003
|
+
nftId,
|
|
3004
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
3005
|
+
"petastic-signup-campaign-1",
|
|
3006
|
+
anymalTxId
|
|
3007
|
+
];
|
|
3008
|
+
const callData = encodeFunctionData2({
|
|
3009
|
+
abi: PET_NFT_ABI,
|
|
3010
|
+
functionName: "submitMetadataByCampaignName",
|
|
3011
|
+
args
|
|
3012
|
+
});
|
|
3013
|
+
const executeArgs = [validationContractAddress, callData];
|
|
3000
3014
|
const result = await sendOperationFn(
|
|
3001
3015
|
evmAddress,
|
|
3002
3016
|
validationContractAddress,
|
|
3003
3017
|
PET_NFT_ABI,
|
|
3004
3018
|
"submitMetadataByCampaignName",
|
|
3005
|
-
|
|
3006
|
-
pid,
|
|
3007
|
-
nftId,
|
|
3008
|
-
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
3009
|
-
"petastic-signup-campaign-1",
|
|
3010
|
-
anymalTxId
|
|
3011
|
-
]
|
|
3019
|
+
executeArgs
|
|
3012
3020
|
);
|
|
3013
3021
|
return { ...result, status };
|
|
3014
3022
|
},
|
|
@@ -3016,9 +3024,42 @@ function useCoinbaseMintOrgAnymalNFT() {
|
|
|
3016
3024
|
);
|
|
3017
3025
|
}
|
|
3018
3026
|
|
|
3019
|
-
// src/utils/
|
|
3020
|
-
import { encodeFunctionData as encodeFunctionData2 } from "viem";
|
|
3027
|
+
// src/utils/coinbase/useCoinbaseClaimOrgActionReward.ts
|
|
3021
3028
|
import { useCallback as useCallback15 } from "react";
|
|
3029
|
+
import { encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
3030
|
+
function useCoinbaseClaimOrgActionReward() {
|
|
3031
|
+
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
3032
|
+
return useCallback15(
|
|
3033
|
+
async (evmSmartAddress, orgContractAddress, rewardableActionContractAddress, actionId, claimIndex) => {
|
|
3034
|
+
if (!evmSmartAddress || !orgContractAddress || !actionId || claimIndex === void 0) {
|
|
3035
|
+
return {
|
|
3036
|
+
success: false,
|
|
3037
|
+
message: "Coinbase Org Kibble Claim: Missing Data",
|
|
3038
|
+
status: "error"
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
const claimCallData = encodeFunctionData3({
|
|
3042
|
+
abi: REWARDABLE_ACTIONS_ABI,
|
|
3043
|
+
functionName: "claimByIndex",
|
|
3044
|
+
args: [actionId, claimIndex]
|
|
3045
|
+
});
|
|
3046
|
+
const args = [rewardableActionContractAddress, claimCallData];
|
|
3047
|
+
const result = await sendOperationFn(
|
|
3048
|
+
evmSmartAddress,
|
|
3049
|
+
orgContractAddress,
|
|
3050
|
+
ORGANIZATION_IMPL_ABI,
|
|
3051
|
+
ORG_FUNCTION,
|
|
3052
|
+
args
|
|
3053
|
+
);
|
|
3054
|
+
return { ...result, status };
|
|
3055
|
+
},
|
|
3056
|
+
[sendOperationFn, status]
|
|
3057
|
+
);
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3061
|
+
import { encodeFunctionData as encodeFunctionData4 } from "viem";
|
|
3062
|
+
import { useCallback as useCallback16 } from "react";
|
|
3022
3063
|
|
|
3023
3064
|
// src/helpers/GasEstimateHelper.tsx
|
|
3024
3065
|
async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
@@ -3099,7 +3140,7 @@ async function simulateCall(publicClient, target, abi, functionName, args, calle
|
|
|
3099
3140
|
|
|
3100
3141
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3101
3142
|
function useMintAnymalNFT() {
|
|
3102
|
-
return
|
|
3143
|
+
return useCallback16(
|
|
3103
3144
|
async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
|
|
3104
3145
|
if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
|
|
3105
3146
|
return {
|
|
@@ -3115,7 +3156,7 @@ function useMintAnymalNFT() {
|
|
|
3115
3156
|
"petastic-signup-campaign-1",
|
|
3116
3157
|
anymalTxId
|
|
3117
3158
|
];
|
|
3118
|
-
const callData =
|
|
3159
|
+
const callData = encodeFunctionData4({
|
|
3119
3160
|
abi: PET_NFT_ABI,
|
|
3120
3161
|
functionName,
|
|
3121
3162
|
args
|
|
@@ -3151,9 +3192,9 @@ function useMintAnymalNFT() {
|
|
|
3151
3192
|
}
|
|
3152
3193
|
|
|
3153
3194
|
// src/utils/anymals/useSaveAnymalMetadata.ts
|
|
3154
|
-
import { useCallback as
|
|
3195
|
+
import { useCallback as useCallback17 } from "react";
|
|
3155
3196
|
function useSaveAnymalMetadata() {
|
|
3156
|
-
return
|
|
3197
|
+
return useCallback17(
|
|
3157
3198
|
async (userPid, anymalTxId, idToken, nftMetadataInput, authServiceBaseUrl) => {
|
|
3158
3199
|
const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
|
|
3159
3200
|
method: "POST",
|
|
@@ -3181,7 +3222,7 @@ function useSaveAnymalMetadata() {
|
|
|
3181
3222
|
}
|
|
3182
3223
|
|
|
3183
3224
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3184
|
-
import { useCallback as
|
|
3225
|
+
import { useCallback as useCallback18 } from "react";
|
|
3185
3226
|
|
|
3186
3227
|
// src/helpers/UploadImageHelper.tsx
|
|
3187
3228
|
function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
|
|
@@ -3238,7 +3279,7 @@ function toBase64(file) {
|
|
|
3238
3279
|
|
|
3239
3280
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
3240
3281
|
function useUploadAnymalImage() {
|
|
3241
|
-
return
|
|
3282
|
+
return useCallback18(
|
|
3242
3283
|
async (imageFile, type, idToken, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
3243
3284
|
if (!imageFile || !idToken) {
|
|
3244
3285
|
return {
|
|
@@ -3299,10 +3340,10 @@ function useUploadAnymalImage() {
|
|
|
3299
3340
|
}
|
|
3300
3341
|
|
|
3301
3342
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3302
|
-
import { useCallback as
|
|
3343
|
+
import { useCallback as useCallback19 } from "react";
|
|
3303
3344
|
|
|
3304
3345
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3305
|
-
import { encodeFunctionData as
|
|
3346
|
+
import { encodeFunctionData as encodeFunctionData5 } from "viem";
|
|
3306
3347
|
|
|
3307
3348
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3308
3349
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3362,7 +3403,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3362
3403
|
deadline,
|
|
3363
3404
|
backendSignature
|
|
3364
3405
|
];
|
|
3365
|
-
const partialPayCalldata =
|
|
3406
|
+
const partialPayCalldata = encodeFunctionData5({
|
|
3366
3407
|
abi: MARKETPLACE_ABI,
|
|
3367
3408
|
functionName,
|
|
3368
3409
|
args
|
|
@@ -3399,7 +3440,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3399
3440
|
|
|
3400
3441
|
// src/utils/marketplace/useProcessPartialKibblePayment.ts
|
|
3401
3442
|
function useProcessPartialKibblePayment() {
|
|
3402
|
-
return
|
|
3443
|
+
return useCallback19(
|
|
3403
3444
|
async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3404
3445
|
if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
|
|
3405
3446
|
return {
|
|
@@ -3455,15 +3496,15 @@ function useProcessPartialKibblePayment() {
|
|
|
3455
3496
|
}
|
|
3456
3497
|
|
|
3457
3498
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3458
|
-
import { useCallback as
|
|
3499
|
+
import { useCallback as useCallback20 } from "react";
|
|
3459
3500
|
|
|
3460
3501
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3461
|
-
import { encodeFunctionData as
|
|
3502
|
+
import { encodeFunctionData as encodeFunctionData6, erc20Abi } from "viem";
|
|
3462
3503
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3463
3504
|
try {
|
|
3464
3505
|
const functionName = "approve";
|
|
3465
3506
|
const args = [spenderAddress, approveAmount];
|
|
3466
|
-
const approveCalldata =
|
|
3507
|
+
const approveCalldata = encodeFunctionData6({
|
|
3467
3508
|
abi: erc20Abi,
|
|
3468
3509
|
functionName,
|
|
3469
3510
|
args
|
|
@@ -3500,7 +3541,7 @@ async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, s
|
|
|
3500
3541
|
|
|
3501
3542
|
// src/utils/marketplace/useApproveKibbleToken.ts
|
|
3502
3543
|
function useApproveKibbleToken() {
|
|
3503
|
-
return
|
|
3544
|
+
return useCallback20(
|
|
3504
3545
|
async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
|
|
3505
3546
|
try {
|
|
3506
3547
|
const result = await processDirectKibbleApproval(
|
|
@@ -3527,10 +3568,10 @@ function useApproveKibbleToken() {
|
|
|
3527
3568
|
}
|
|
3528
3569
|
|
|
3529
3570
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3530
|
-
import { useCallback as
|
|
3531
|
-
import { decodeEventLog, encodeFunctionData as
|
|
3571
|
+
import { useCallback as useCallback21 } from "react";
|
|
3572
|
+
import { decodeEventLog, encodeFunctionData as encodeFunctionData7 } from "viem";
|
|
3532
3573
|
function useCreateOrganizationBase() {
|
|
3533
|
-
return
|
|
3574
|
+
return useCallback21(
|
|
3534
3575
|
/**
|
|
3535
3576
|
* Creates a new organization on-chain.
|
|
3536
3577
|
*
|
|
@@ -3552,7 +3593,7 @@ function useCreateOrganizationBase() {
|
|
|
3552
3593
|
try {
|
|
3553
3594
|
const functionName = "createOrganizationProxy";
|
|
3554
3595
|
const args = [ownerAddress, orgName, orgPid];
|
|
3555
|
-
const callData =
|
|
3596
|
+
const callData = encodeFunctionData7({
|
|
3556
3597
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3557
3598
|
functionName,
|
|
3558
3599
|
args
|
|
@@ -3626,10 +3667,10 @@ function useCreateOrganizationBase() {
|
|
|
3626
3667
|
}
|
|
3627
3668
|
|
|
3628
3669
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3629
|
-
import { useCallback as
|
|
3670
|
+
import { useCallback as useCallback22 } from "react";
|
|
3630
3671
|
|
|
3631
3672
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3632
|
-
import { encodeFunctionData as
|
|
3673
|
+
import { encodeFunctionData as encodeFunctionData8, erc20Abi as erc20Abi3 } from "viem";
|
|
3633
3674
|
|
|
3634
3675
|
// src/helpers/WaitForAllowance.tsx
|
|
3635
3676
|
import { erc20Abi as erc20Abi2 } from "viem";
|
|
@@ -3666,13 +3707,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3666
3707
|
if (approveAmount <= 0n) {
|
|
3667
3708
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3668
3709
|
}
|
|
3669
|
-
const approveCalldata =
|
|
3710
|
+
const approveCalldata = encodeFunctionData8({
|
|
3670
3711
|
abi: erc20Abi3,
|
|
3671
3712
|
functionName: "approve",
|
|
3672
3713
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3673
3714
|
});
|
|
3674
3715
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3675
|
-
const executeApproveCalldata =
|
|
3716
|
+
const executeApproveCalldata = encodeFunctionData8({
|
|
3676
3717
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3677
3718
|
functionName: ORG_FUNCTION,
|
|
3678
3719
|
args
|
|
@@ -3724,7 +3765,7 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3724
3765
|
|
|
3725
3766
|
// src/utils/organization/useApproveOrgKibbleToken.ts
|
|
3726
3767
|
function useApproveOrgPartialPayment() {
|
|
3727
|
-
return
|
|
3768
|
+
return useCallback22(
|
|
3728
3769
|
async (orgContractAddress, kibbleTokenAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, approveAmount) => {
|
|
3729
3770
|
if (!orgContractAddress || !kibbleTokenAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !approveAmount) {
|
|
3730
3771
|
return {
|
|
@@ -3756,13 +3797,13 @@ function useApproveOrgPartialPayment() {
|
|
|
3756
3797
|
}
|
|
3757
3798
|
|
|
3758
3799
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3759
|
-
import { useCallback as
|
|
3800
|
+
import { useCallback as useCallback23 } from "react";
|
|
3760
3801
|
|
|
3761
3802
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3762
|
-
import { encodeFunctionData as
|
|
3803
|
+
import { encodeFunctionData as encodeFunctionData9 } from "viem";
|
|
3763
3804
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3764
3805
|
try {
|
|
3765
|
-
const partialPayCalldata =
|
|
3806
|
+
const partialPayCalldata = encodeFunctionData9({
|
|
3766
3807
|
abi: MARKETPLACE_ABI,
|
|
3767
3808
|
functionName: "partialPay",
|
|
3768
3809
|
args: [
|
|
@@ -3777,7 +3818,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3777
3818
|
]
|
|
3778
3819
|
});
|
|
3779
3820
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3780
|
-
const executePartialPayCalldata =
|
|
3821
|
+
const executePartialPayCalldata = encodeFunctionData9({
|
|
3781
3822
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3782
3823
|
functionName: ORG_FUNCTION,
|
|
3783
3824
|
args
|
|
@@ -3814,7 +3855,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3814
3855
|
|
|
3815
3856
|
// src/utils/organization/useProcessOrgPartialKibblePayment.ts
|
|
3816
3857
|
function useProcessOrgPartialKibblePayment() {
|
|
3817
|
-
return
|
|
3858
|
+
return useCallback23(
|
|
3818
3859
|
async (orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
|
|
3819
3860
|
if (!orgContractAddress || !partialPaymentModuleAddress || !managerSmartAccount || !bundlerClient || !orderId || !pid || !nonce || !backendSignature) {
|
|
3820
3861
|
return {
|
|
@@ -3852,9 +3893,9 @@ function useProcessOrgPartialKibblePayment() {
|
|
|
3852
3893
|
}
|
|
3853
3894
|
|
|
3854
3895
|
// src/utils/organization/useUpdateOrgWalletAddress.ts
|
|
3855
|
-
import { useCallback as
|
|
3896
|
+
import { useCallback as useCallback24 } from "react";
|
|
3856
3897
|
function useUpdateOrgWalletAddress() {
|
|
3857
|
-
return
|
|
3898
|
+
return useCallback24(
|
|
3858
3899
|
async (dbAuthToken, docID, baseWalletAddress, endpoint) => {
|
|
3859
3900
|
try {
|
|
3860
3901
|
const mutation = `
|
|
@@ -3893,10 +3934,10 @@ function useUpdateOrgWalletAddress() {
|
|
|
3893
3934
|
}
|
|
3894
3935
|
|
|
3895
3936
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3896
|
-
import { encodeFunctionData as
|
|
3897
|
-
import { useCallback as
|
|
3937
|
+
import { encodeFunctionData as encodeFunctionData10 } from "viem";
|
|
3938
|
+
import { useCallback as useCallback25 } from "react";
|
|
3898
3939
|
function useMintOrgAnymalNFT() {
|
|
3899
|
-
return
|
|
3940
|
+
return useCallback25(
|
|
3900
3941
|
async (orgContractAddress, pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, managerSmartAccount, bundlerClient) => {
|
|
3901
3942
|
if (!dbAuthToken || !nftId || !bundlerClient || !managerSmartAccount || !pid || !validationContractAddress || !orgContractAddress) {
|
|
3902
3943
|
return {
|
|
@@ -3912,13 +3953,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3912
3953
|
"petastic-signup-campaign-1",
|
|
3913
3954
|
anymalTxId
|
|
3914
3955
|
];
|
|
3915
|
-
const callData =
|
|
3956
|
+
const callData = encodeFunctionData10({
|
|
3916
3957
|
abi: PET_NFT_ABI,
|
|
3917
3958
|
functionName,
|
|
3918
3959
|
args
|
|
3919
3960
|
});
|
|
3920
3961
|
const executeArgs = [validationContractAddress, callData];
|
|
3921
|
-
const executeSubmitMetaCalldata =
|
|
3962
|
+
const executeSubmitMetaCalldata = encodeFunctionData10({
|
|
3922
3963
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3923
3964
|
functionName: ORG_FUNCTION,
|
|
3924
3965
|
args: executeArgs
|
|
@@ -3981,9 +4022,9 @@ async function submitAction(idToken, pid, sourceType, payload, endpointBaseUrl)
|
|
|
3981
4022
|
}
|
|
3982
4023
|
|
|
3983
4024
|
// src/utils/actions/useFetchActions.ts
|
|
3984
|
-
import { useCallback as
|
|
4025
|
+
import { useCallback as useCallback26 } from "react";
|
|
3985
4026
|
function useFetchActions() {
|
|
3986
|
-
return
|
|
4027
|
+
return useCallback26(
|
|
3987
4028
|
async (idToken, actionsServiceBaseUrl, pid, status, limit, offset) => {
|
|
3988
4029
|
const params = new URLSearchParams({ pid });
|
|
3989
4030
|
if (status) params.set("status", status);
|
|
@@ -4012,9 +4053,9 @@ function useFetchActions() {
|
|
|
4012
4053
|
}
|
|
4013
4054
|
|
|
4014
4055
|
// src/utils/actions/useFetchActionDefinitions.ts
|
|
4015
|
-
import { useCallback as
|
|
4056
|
+
import { useCallback as useCallback27 } from "react";
|
|
4016
4057
|
function useFetchActionDefinitions() {
|
|
4017
|
-
return
|
|
4058
|
+
return useCallback27(
|
|
4018
4059
|
async (idToken, actionsServiceBaseUrl) => {
|
|
4019
4060
|
try {
|
|
4020
4061
|
const response = await fetch(
|
|
@@ -4111,10 +4152,10 @@ var convertToMultipleActionRecords = (frs) => frs.map(convertToActionRecord);
|
|
|
4111
4152
|
var convertToMultipleActionDefinitions = (frs) => frs.map(convertToActionDefinition);
|
|
4112
4153
|
|
|
4113
4154
|
// src/utils/application/useCreateUserAppData.ts
|
|
4114
|
-
import { useCallback as
|
|
4155
|
+
import { useCallback as useCallback28 } from "react";
|
|
4115
4156
|
import { v4 as uuid } from "uuid";
|
|
4116
4157
|
function useCreateUserAppData() {
|
|
4117
|
-
return
|
|
4158
|
+
return useCallback28(
|
|
4118
4159
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4119
4160
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4120
4161
|
const appValues = {
|
|
@@ -4169,10 +4210,10 @@ function useCreateUserAppData() {
|
|
|
4169
4210
|
}
|
|
4170
4211
|
|
|
4171
4212
|
// src/utils/application/useCreateOrganizationAppData.ts
|
|
4172
|
-
import { useCallback as
|
|
4213
|
+
import { useCallback as useCallback29 } from "react";
|
|
4173
4214
|
import { v4 as uuid2 } from "uuid";
|
|
4174
4215
|
function useCreateOrganizationAppData() {
|
|
4175
|
-
return
|
|
4216
|
+
return useCallback29(
|
|
4176
4217
|
async (appId, pid, dbAuthToken, endpoint) => {
|
|
4177
4218
|
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
4178
4219
|
const appValues = {
|
|
@@ -4226,10 +4267,10 @@ function useCreateOrganizationAppData() {
|
|
|
4226
4267
|
}
|
|
4227
4268
|
|
|
4228
4269
|
// src/utils/balance/useFetchBalance.ts
|
|
4229
|
-
import { useCallback as
|
|
4270
|
+
import { useCallback as useCallback30 } from "react";
|
|
4230
4271
|
import { erc20Abi as erc20Abi4, getAddress } from "viem";
|
|
4231
4272
|
function useFetchBalance() {
|
|
4232
|
-
return
|
|
4273
|
+
return useCallback30(
|
|
4233
4274
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4234
4275
|
try {
|
|
4235
4276
|
const balance = await publicClient.readContract({
|
|
@@ -4248,10 +4289,10 @@ function useFetchBalance() {
|
|
|
4248
4289
|
}
|
|
4249
4290
|
|
|
4250
4291
|
// src/utils/actions/useClaimActionReward.ts
|
|
4251
|
-
import { encodeFunctionData as
|
|
4252
|
-
import { useCallback as
|
|
4292
|
+
import { encodeFunctionData as encodeFunctionData11 } from "viem";
|
|
4293
|
+
import { useCallback as useCallback31 } from "react";
|
|
4253
4294
|
function useClaimActionReward() {
|
|
4254
|
-
return
|
|
4295
|
+
return useCallback31(
|
|
4255
4296
|
async (actionId, claimIndex, rewardableActionContractAddress, smartAccount, bundlerClient) => {
|
|
4256
4297
|
if (!actionId || claimIndex === void 0 || !bundlerClient || !smartAccount || !rewardableActionContractAddress) {
|
|
4257
4298
|
return {
|
|
@@ -4261,7 +4302,7 @@ function useClaimActionReward() {
|
|
|
4261
4302
|
}
|
|
4262
4303
|
const args = [actionId, claimIndex];
|
|
4263
4304
|
const functionName = "claimByIndex";
|
|
4264
|
-
const callData =
|
|
4305
|
+
const callData = encodeFunctionData11({
|
|
4265
4306
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4266
4307
|
functionName,
|
|
4267
4308
|
args
|
|
@@ -4297,10 +4338,10 @@ function useClaimActionReward() {
|
|
|
4297
4338
|
}
|
|
4298
4339
|
|
|
4299
4340
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4300
|
-
import { encodeFunctionData as
|
|
4301
|
-
import { useCallback as
|
|
4341
|
+
import { encodeFunctionData as encodeFunctionData12 } from "viem";
|
|
4342
|
+
import { useCallback as useCallback32 } from "react";
|
|
4302
4343
|
function useClaimOrgActionReward() {
|
|
4303
|
-
return
|
|
4344
|
+
return useCallback32(
|
|
4304
4345
|
async (orgContractAddress, rewardableActionContractAddress, actionId, claimIndex, smartAccount, bundlerClient) => {
|
|
4305
4346
|
if (!orgContractAddress || !actionId || claimIndex === void 0 || !bundlerClient || !smartAccount) {
|
|
4306
4347
|
return {
|
|
@@ -4308,13 +4349,13 @@ function useClaimOrgActionReward() {
|
|
|
4308
4349
|
message: "Missing web3auth account info or contract address."
|
|
4309
4350
|
};
|
|
4310
4351
|
}
|
|
4311
|
-
const claimCallData =
|
|
4352
|
+
const claimCallData = encodeFunctionData12({
|
|
4312
4353
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4313
4354
|
functionName: "claimByIndex",
|
|
4314
4355
|
args: [actionId, claimIndex]
|
|
4315
4356
|
});
|
|
4316
4357
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4317
|
-
const executeClaimCalldata =
|
|
4358
|
+
const executeClaimCalldata = encodeFunctionData12({
|
|
4318
4359
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4319
4360
|
functionName: ORG_FUNCTION,
|
|
4320
4361
|
args
|
|
@@ -4350,9 +4391,9 @@ function useClaimOrgActionReward() {
|
|
|
4350
4391
|
}
|
|
4351
4392
|
|
|
4352
4393
|
// src/utils/actions/useSubmitContractAction.ts
|
|
4353
|
-
import { useCallback as
|
|
4394
|
+
import { useCallback as useCallback33 } from "react";
|
|
4354
4395
|
function useSubmitContractAction() {
|
|
4355
|
-
return
|
|
4396
|
+
return useCallback33(
|
|
4356
4397
|
(idToken, pid, source, endpoint, payload) => {
|
|
4357
4398
|
if (!idToken || !pid || !source || !endpoint || !payload) return;
|
|
4358
4399
|
let sourceTypePayload = {};
|
|
@@ -4510,6 +4551,7 @@ export {
|
|
|
4510
4551
|
useClaimActionReward,
|
|
4511
4552
|
useClaimOrgActionReward,
|
|
4512
4553
|
useCoinbaseClaimActionReward,
|
|
4554
|
+
useCoinbaseClaimOrgActionReward,
|
|
4513
4555
|
useCoinbaseCreateOrganizationWallet,
|
|
4514
4556
|
useCoinbaseMintAnymalNFT,
|
|
4515
4557
|
useCoinbaseMintOrgAnymalNFT,
|
package/package.json
CHANGED