anymal-protocol 1.0.129 → 1.0.131
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +64 -44
- package/dist/index.mjs +21 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -368,7 +368,7 @@ declare const KIBBLE_TOKEN_ABI: ({
|
|
|
368
368
|
type: string;
|
|
369
369
|
anonymous?: undefined;
|
|
370
370
|
})[];
|
|
371
|
-
declare const ERROR_ABI: ({
|
|
371
|
+
declare const ERROR_ABI: (abitype.Abi | {
|
|
372
372
|
inputs: {
|
|
373
373
|
internalType: string;
|
|
374
374
|
name: string;
|
|
@@ -417,7 +417,7 @@ declare const ERROR_ABI: ({
|
|
|
417
417
|
name?: undefined;
|
|
418
418
|
anonymous?: undefined;
|
|
419
419
|
outputs?: undefined;
|
|
420
|
-
}
|
|
420
|
+
})[];
|
|
421
421
|
declare const ORG_FUNCTION = "executeCall";
|
|
422
422
|
|
|
423
423
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -368,7 +368,7 @@ declare const KIBBLE_TOKEN_ABI: ({
|
|
|
368
368
|
type: string;
|
|
369
369
|
anonymous?: undefined;
|
|
370
370
|
})[];
|
|
371
|
-
declare const ERROR_ABI: ({
|
|
371
|
+
declare const ERROR_ABI: (abitype.Abi | {
|
|
372
372
|
inputs: {
|
|
373
373
|
internalType: string;
|
|
374
374
|
name: string;
|
|
@@ -417,7 +417,7 @@ declare const ERROR_ABI: ({
|
|
|
417
417
|
name?: undefined;
|
|
418
418
|
anonymous?: undefined;
|
|
419
419
|
outputs?: undefined;
|
|
420
|
-
}
|
|
420
|
+
})[];
|
|
421
421
|
declare const ORG_FUNCTION = "executeCall";
|
|
422
422
|
|
|
423
423
|
declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
|
package/dist/index.js
CHANGED
|
@@ -467,6 +467,8 @@ function useFetchNotifications() {
|
|
|
467
467
|
// src/utils/coinbase/useSendCoinbaseUserOperation.ts
|
|
468
468
|
var import_react10 = require("react");
|
|
469
469
|
var import_cdp_hooks = require("@coinbase/cdp-hooks");
|
|
470
|
+
var import_viem = require("viem");
|
|
471
|
+
var import_chains = require("viem/chains");
|
|
470
472
|
function useSendCoinbaseUserOperation() {
|
|
471
473
|
const { sendUserOperation, data, error, status } = (0, import_cdp_hooks.useSendUserOperation)();
|
|
472
474
|
const sendOperationFn = (0, import_react10.useCallback)(
|
|
@@ -474,6 +476,24 @@ function useSendCoinbaseUserOperation() {
|
|
|
474
476
|
if (!evmAddress || !callData || !contractAddress) {
|
|
475
477
|
return { success: false, message: "Missing required information" };
|
|
476
478
|
}
|
|
479
|
+
const publicClient = (0, import_viem.createPublicClient)({
|
|
480
|
+
chain: import_chains.baseSepolia,
|
|
481
|
+
transport: (0, import_viem.http)()
|
|
482
|
+
});
|
|
483
|
+
try {
|
|
484
|
+
const result = await publicClient.call({
|
|
485
|
+
account: evmAddress,
|
|
486
|
+
to: contractAddress,
|
|
487
|
+
data: callData
|
|
488
|
+
});
|
|
489
|
+
console.log("Simulation successful:", result);
|
|
490
|
+
} catch (simError) {
|
|
491
|
+
console.error("Simulation failed:", simError);
|
|
492
|
+
return {
|
|
493
|
+
success: false,
|
|
494
|
+
message: `Simulation failed: ${simError.message}`
|
|
495
|
+
};
|
|
496
|
+
}
|
|
477
497
|
try {
|
|
478
498
|
await sendUserOperation({
|
|
479
499
|
evmSmartAccount: evmAddress,
|
|
@@ -483,7 +503,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
483
503
|
});
|
|
484
504
|
return { success: true, message: "Operation submitted." };
|
|
485
505
|
} catch (e) {
|
|
486
|
-
console.error(e);
|
|
506
|
+
console.error("Full error:", e);
|
|
487
507
|
return { success: false, message: e.message };
|
|
488
508
|
}
|
|
489
509
|
},
|
|
@@ -493,10 +513,10 @@ function useSendCoinbaseUserOperation() {
|
|
|
493
513
|
}
|
|
494
514
|
|
|
495
515
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
496
|
-
var
|
|
516
|
+
var import_viem3 = require("viem");
|
|
497
517
|
|
|
498
518
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
499
|
-
var
|
|
519
|
+
var import_viem2 = require("viem");
|
|
500
520
|
var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
|
|
501
521
|
"inputs": [],
|
|
502
522
|
"name": "AccessControlBadConfirmation",
|
|
@@ -2923,7 +2943,7 @@ var OZ_ERROR_FRAGMENTS = [
|
|
|
2923
2943
|
"error AddressLowLevelCallFailed(address target, bytes data)",
|
|
2924
2944
|
"error AddressEmptyCode(address target)"
|
|
2925
2945
|
];
|
|
2926
|
-
var ERROR_ABI = [...LOCAL_ERRORS, (0,
|
|
2946
|
+
var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem2.parseAbi)([...OZ_ERROR_FRAGMENTS])];
|
|
2927
2947
|
var ORG_FUNCTION = "executeCall";
|
|
2928
2948
|
|
|
2929
2949
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
@@ -2942,7 +2962,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2942
2962
|
try {
|
|
2943
2963
|
const args = [actionId, claimIndex];
|
|
2944
2964
|
const functionName = "claimByIndex";
|
|
2945
|
-
const callData = (0,
|
|
2965
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
2946
2966
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2947
2967
|
functionName,
|
|
2948
2968
|
args
|
|
@@ -2967,7 +2987,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2967
2987
|
}
|
|
2968
2988
|
|
|
2969
2989
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2970
|
-
var
|
|
2990
|
+
var import_viem4 = require("viem");
|
|
2971
2991
|
var import_react12 = require("react");
|
|
2972
2992
|
function useCoinbaseMintAnymalNFT() {
|
|
2973
2993
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
@@ -2989,7 +3009,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2989
3009
|
"petastic-signup-campaign-1",
|
|
2990
3010
|
anymalTxId
|
|
2991
3011
|
];
|
|
2992
|
-
const callData = (0,
|
|
3012
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
2993
3013
|
abi: PET_NFT_ABI,
|
|
2994
3014
|
functionName,
|
|
2995
3015
|
args
|
|
@@ -3010,7 +3030,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3010
3030
|
}
|
|
3011
3031
|
|
|
3012
3032
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3013
|
-
var
|
|
3033
|
+
var import_viem6 = require("viem");
|
|
3014
3034
|
var import_react13 = require("react");
|
|
3015
3035
|
|
|
3016
3036
|
// src/helpers/GasEstimateHelper.tsx
|
|
@@ -3055,18 +3075,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3055
3075
|
}
|
|
3056
3076
|
|
|
3057
3077
|
// src/helpers/HumanRevert.tsx
|
|
3058
|
-
var
|
|
3078
|
+
var import_viem5 = require("viem");
|
|
3059
3079
|
function humanRevert(raw, shortMessage) {
|
|
3060
3080
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3061
3081
|
try {
|
|
3062
|
-
const { errorName, args } = (0,
|
|
3082
|
+
const { errorName, args } = (0, import_viem5.decodeErrorResult)({
|
|
3063
3083
|
abi: ERROR_ABI,
|
|
3064
3084
|
data: raw
|
|
3065
3085
|
});
|
|
3066
3086
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3067
3087
|
} catch {
|
|
3068
3088
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3069
|
-
return (0,
|
|
3089
|
+
return (0, import_viem5.hexToString)(`0x${raw.slice(138)}`);
|
|
3070
3090
|
}
|
|
3071
3091
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3072
3092
|
}
|
|
@@ -3108,7 +3128,7 @@ function useMintAnymalNFT() {
|
|
|
3108
3128
|
"petastic-signup-campaign-1",
|
|
3109
3129
|
anymalTxId
|
|
3110
3130
|
];
|
|
3111
|
-
const callData = (0,
|
|
3131
|
+
const callData = (0, import_viem6.encodeFunctionData)({
|
|
3112
3132
|
abi: PET_NFT_ABI,
|
|
3113
3133
|
functionName,
|
|
3114
3134
|
args
|
|
@@ -3295,7 +3315,7 @@ function useUploadAnymalImage() {
|
|
|
3295
3315
|
var import_react16 = require("react");
|
|
3296
3316
|
|
|
3297
3317
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3298
|
-
var
|
|
3318
|
+
var import_viem7 = require("viem");
|
|
3299
3319
|
|
|
3300
3320
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3301
3321
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3355,7 +3375,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3355
3375
|
deadline,
|
|
3356
3376
|
backendSignature
|
|
3357
3377
|
];
|
|
3358
|
-
const partialPayCalldata = (0,
|
|
3378
|
+
const partialPayCalldata = (0, import_viem7.encodeFunctionData)({
|
|
3359
3379
|
abi: MARKETPLACE_ABI,
|
|
3360
3380
|
functionName,
|
|
3361
3381
|
args
|
|
@@ -3451,20 +3471,20 @@ function useProcessPartialKibblePayment() {
|
|
|
3451
3471
|
var import_react17 = require("react");
|
|
3452
3472
|
|
|
3453
3473
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3454
|
-
var
|
|
3474
|
+
var import_viem8 = require("viem");
|
|
3455
3475
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3456
3476
|
try {
|
|
3457
3477
|
const functionName = "approve";
|
|
3458
3478
|
const args = [spenderAddress, approveAmount];
|
|
3459
|
-
const approveCalldata = (0,
|
|
3460
|
-
abi:
|
|
3479
|
+
const approveCalldata = (0, import_viem8.encodeFunctionData)({
|
|
3480
|
+
abi: import_viem8.erc20Abi,
|
|
3461
3481
|
functionName,
|
|
3462
3482
|
args
|
|
3463
3483
|
});
|
|
3464
3484
|
await simulateCall(
|
|
3465
3485
|
bundlerClient.client,
|
|
3466
3486
|
kibbleTokenAddress,
|
|
3467
|
-
|
|
3487
|
+
import_viem8.erc20Abi,
|
|
3468
3488
|
functionName,
|
|
3469
3489
|
args,
|
|
3470
3490
|
smartAccount.address
|
|
@@ -3521,7 +3541,7 @@ function useApproveKibbleToken() {
|
|
|
3521
3541
|
|
|
3522
3542
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3523
3543
|
var import_react18 = require("react");
|
|
3524
|
-
var
|
|
3544
|
+
var import_viem9 = require("viem");
|
|
3525
3545
|
function useCreateOrganizationBase() {
|
|
3526
3546
|
return (0, import_react18.useCallback)(
|
|
3527
3547
|
/**
|
|
@@ -3545,7 +3565,7 @@ function useCreateOrganizationBase() {
|
|
|
3545
3565
|
try {
|
|
3546
3566
|
const functionName = "createOrganizationProxy";
|
|
3547
3567
|
const args = [ownerAddress, orgName, orgPid];
|
|
3548
|
-
const callData = (0,
|
|
3568
|
+
const callData = (0, import_viem9.encodeFunctionData)({
|
|
3549
3569
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3550
3570
|
functionName,
|
|
3551
3571
|
args
|
|
@@ -3583,7 +3603,7 @@ function useCreateOrganizationBase() {
|
|
|
3583
3603
|
let proxyAddress;
|
|
3584
3604
|
for (const log of txReceipt.logs) {
|
|
3585
3605
|
try {
|
|
3586
|
-
const decoded = (0,
|
|
3606
|
+
const decoded = (0, import_viem9.decodeEventLog)({
|
|
3587
3607
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3588
3608
|
data: log.data,
|
|
3589
3609
|
topics: log.topics
|
|
@@ -3622,10 +3642,10 @@ function useCreateOrganizationBase() {
|
|
|
3622
3642
|
var import_react19 = require("react");
|
|
3623
3643
|
|
|
3624
3644
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3625
|
-
var
|
|
3645
|
+
var import_viem11 = require("viem");
|
|
3626
3646
|
|
|
3627
3647
|
// src/helpers/WaitForAllowance.tsx
|
|
3628
|
-
var
|
|
3648
|
+
var import_viem10 = require("viem");
|
|
3629
3649
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3630
3650
|
const MAX_RETRIES = 10;
|
|
3631
3651
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3634,7 +3654,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3634
3654
|
try {
|
|
3635
3655
|
const currentAllowance = await publicClient.readContract({
|
|
3636
3656
|
address: tokenAddress,
|
|
3637
|
-
abi:
|
|
3657
|
+
abi: import_viem10.erc20Abi,
|
|
3638
3658
|
functionName: "allowance",
|
|
3639
3659
|
args: [ownerAddress, spenderAddress]
|
|
3640
3660
|
});
|
|
@@ -3659,13 +3679,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3659
3679
|
if (approveAmount <= 0n) {
|
|
3660
3680
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3661
3681
|
}
|
|
3662
|
-
const approveCalldata = (0,
|
|
3663
|
-
abi:
|
|
3682
|
+
const approveCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3683
|
+
abi: import_viem11.erc20Abi,
|
|
3664
3684
|
functionName: "approve",
|
|
3665
3685
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3666
3686
|
});
|
|
3667
3687
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3668
|
-
const executeApproveCalldata = (0,
|
|
3688
|
+
const executeApproveCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3669
3689
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3670
3690
|
functionName: ORG_FUNCTION,
|
|
3671
3691
|
args
|
|
@@ -3752,10 +3772,10 @@ function useApproveOrgPartialPayment() {
|
|
|
3752
3772
|
var import_react20 = require("react");
|
|
3753
3773
|
|
|
3754
3774
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3755
|
-
var
|
|
3775
|
+
var import_viem12 = require("viem");
|
|
3756
3776
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3757
3777
|
try {
|
|
3758
|
-
const partialPayCalldata = (0,
|
|
3778
|
+
const partialPayCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3759
3779
|
abi: MARKETPLACE_ABI,
|
|
3760
3780
|
functionName: "partialPay",
|
|
3761
3781
|
args: [
|
|
@@ -3770,7 +3790,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3770
3790
|
]
|
|
3771
3791
|
});
|
|
3772
3792
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3773
|
-
const executePartialPayCalldata = (0,
|
|
3793
|
+
const executePartialPayCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3774
3794
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3775
3795
|
functionName: ORG_FUNCTION,
|
|
3776
3796
|
args
|
|
@@ -3886,7 +3906,7 @@ function useUpdateOrgWalletAddress() {
|
|
|
3886
3906
|
}
|
|
3887
3907
|
|
|
3888
3908
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3889
|
-
var
|
|
3909
|
+
var import_viem13 = require("viem");
|
|
3890
3910
|
var import_react22 = require("react");
|
|
3891
3911
|
function useMintOrgAnymalNFT() {
|
|
3892
3912
|
return (0, import_react22.useCallback)(
|
|
@@ -3905,13 +3925,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3905
3925
|
"petastic-signup-campaign-1",
|
|
3906
3926
|
anymalTxId
|
|
3907
3927
|
];
|
|
3908
|
-
const callData = (0,
|
|
3928
|
+
const callData = (0, import_viem13.encodeFunctionData)({
|
|
3909
3929
|
abi: PET_NFT_ABI,
|
|
3910
3930
|
functionName,
|
|
3911
3931
|
args
|
|
3912
3932
|
});
|
|
3913
3933
|
const executeArgs = [validationContractAddress, callData];
|
|
3914
|
-
const executeSubmitMetaCalldata = (0,
|
|
3934
|
+
const executeSubmitMetaCalldata = (0, import_viem13.encodeFunctionData)({
|
|
3915
3935
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3916
3936
|
functionName: ORG_FUNCTION,
|
|
3917
3937
|
args: executeArgs
|
|
@@ -3944,10 +3964,10 @@ function useMintOrgAnymalNFT() {
|
|
|
3944
3964
|
|
|
3945
3965
|
// src/helpers/NonceHelper.tsx
|
|
3946
3966
|
var import_uuid = require("uuid");
|
|
3947
|
-
var
|
|
3967
|
+
var import_viem14 = require("viem");
|
|
3948
3968
|
var generateBytes32Nonce = () => {
|
|
3949
3969
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
3950
|
-
return (0,
|
|
3970
|
+
return (0, import_viem14.padHex)(`0x${uuid3}`, { size: 32 });
|
|
3951
3971
|
};
|
|
3952
3972
|
|
|
3953
3973
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4403,16 +4423,16 @@ function useCreateOrganizationAppData() {
|
|
|
4403
4423
|
|
|
4404
4424
|
// src/utils/balance/useFetchBalance.ts
|
|
4405
4425
|
var import_react27 = require("react");
|
|
4406
|
-
var
|
|
4426
|
+
var import_viem15 = require("viem");
|
|
4407
4427
|
function useFetchBalance() {
|
|
4408
4428
|
return (0, import_react27.useCallback)(
|
|
4409
4429
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4410
4430
|
try {
|
|
4411
4431
|
const balance = await publicClient.readContract({
|
|
4412
|
-
address: (0,
|
|
4413
|
-
abi:
|
|
4432
|
+
address: (0, import_viem15.getAddress)(kibbleTokenAddress),
|
|
4433
|
+
abi: import_viem15.erc20Abi,
|
|
4414
4434
|
functionName: "balanceOf",
|
|
4415
|
-
args: [(0,
|
|
4435
|
+
args: [(0, import_viem15.getAddress)(walletAddress)]
|
|
4416
4436
|
});
|
|
4417
4437
|
return Number(balance);
|
|
4418
4438
|
} catch (error) {
|
|
@@ -4424,7 +4444,7 @@ function useFetchBalance() {
|
|
|
4424
4444
|
}
|
|
4425
4445
|
|
|
4426
4446
|
// src/utils/actions/useClaimActionReward.ts
|
|
4427
|
-
var
|
|
4447
|
+
var import_viem16 = require("viem");
|
|
4428
4448
|
var import_react28 = require("react");
|
|
4429
4449
|
function useClaimActionReward() {
|
|
4430
4450
|
return (0, import_react28.useCallback)(
|
|
@@ -4437,7 +4457,7 @@ function useClaimActionReward() {
|
|
|
4437
4457
|
}
|
|
4438
4458
|
const args = [actionId, claimIndex];
|
|
4439
4459
|
const functionName = "claimByIndex";
|
|
4440
|
-
const callData = (0,
|
|
4460
|
+
const callData = (0, import_viem16.encodeFunctionData)({
|
|
4441
4461
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4442
4462
|
functionName,
|
|
4443
4463
|
args
|
|
@@ -4473,7 +4493,7 @@ function useClaimActionReward() {
|
|
|
4473
4493
|
}
|
|
4474
4494
|
|
|
4475
4495
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4476
|
-
var
|
|
4496
|
+
var import_viem17 = require("viem");
|
|
4477
4497
|
var import_react29 = require("react");
|
|
4478
4498
|
function useClaimOrgActionReward() {
|
|
4479
4499
|
return (0, import_react29.useCallback)(
|
|
@@ -4484,13 +4504,13 @@ function useClaimOrgActionReward() {
|
|
|
4484
4504
|
message: "Missing web3auth account info or contract address."
|
|
4485
4505
|
};
|
|
4486
4506
|
}
|
|
4487
|
-
const claimCallData = (0,
|
|
4507
|
+
const claimCallData = (0, import_viem17.encodeFunctionData)({
|
|
4488
4508
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4489
4509
|
functionName: "claimByIndex",
|
|
4490
4510
|
args: [actionId, claimIndex]
|
|
4491
4511
|
});
|
|
4492
4512
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4493
|
-
const executeClaimCalldata = (0,
|
|
4513
|
+
const executeClaimCalldata = (0, import_viem17.encodeFunctionData)({
|
|
4494
4514
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4495
4515
|
functionName: ORG_FUNCTION,
|
|
4496
4516
|
args
|
package/dist/index.mjs
CHANGED
|
@@ -389,6 +389,8 @@ function useFetchNotifications() {
|
|
|
389
389
|
// src/utils/coinbase/useSendCoinbaseUserOperation.ts
|
|
390
390
|
import { useCallback as useCallback10 } from "react";
|
|
391
391
|
import { useSendUserOperation } from "@coinbase/cdp-hooks";
|
|
392
|
+
import { createPublicClient, http } from "viem";
|
|
393
|
+
import { baseSepolia } from "viem/chains";
|
|
392
394
|
function useSendCoinbaseUserOperation() {
|
|
393
395
|
const { sendUserOperation, data, error, status } = useSendUserOperation();
|
|
394
396
|
const sendOperationFn = useCallback10(
|
|
@@ -396,6 +398,24 @@ function useSendCoinbaseUserOperation() {
|
|
|
396
398
|
if (!evmAddress || !callData || !contractAddress) {
|
|
397
399
|
return { success: false, message: "Missing required information" };
|
|
398
400
|
}
|
|
401
|
+
const publicClient = createPublicClient({
|
|
402
|
+
chain: baseSepolia,
|
|
403
|
+
transport: http()
|
|
404
|
+
});
|
|
405
|
+
try {
|
|
406
|
+
const result = await publicClient.call({
|
|
407
|
+
account: evmAddress,
|
|
408
|
+
to: contractAddress,
|
|
409
|
+
data: callData
|
|
410
|
+
});
|
|
411
|
+
console.log("Simulation successful:", result);
|
|
412
|
+
} catch (simError) {
|
|
413
|
+
console.error("Simulation failed:", simError);
|
|
414
|
+
return {
|
|
415
|
+
success: false,
|
|
416
|
+
message: `Simulation failed: ${simError.message}`
|
|
417
|
+
};
|
|
418
|
+
}
|
|
399
419
|
try {
|
|
400
420
|
await sendUserOperation({
|
|
401
421
|
evmSmartAccount: evmAddress,
|
|
@@ -405,7 +425,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
405
425
|
});
|
|
406
426
|
return { success: true, message: "Operation submitted." };
|
|
407
427
|
} catch (e) {
|
|
408
|
-
console.error(e);
|
|
428
|
+
console.error("Full error:", e);
|
|
409
429
|
return { success: false, message: e.message };
|
|
410
430
|
}
|
|
411
431
|
},
|
package/package.json
CHANGED