anymal-protocol 1.0.130 → 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 +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +69 -52
- package/dist/index.mjs +26 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -54,7 +54,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
|
|
|
54
54
|
declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
|
|
55
55
|
|
|
56
56
|
declare function useSendCoinbaseUserOperation(): {
|
|
57
|
-
sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}
|
|
57
|
+
sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}`) => Promise<{
|
|
58
58
|
success: boolean;
|
|
59
59
|
message: string;
|
|
60
60
|
}>;
|
|
@@ -63,13 +63,13 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
63
63
|
error: Error | undefined;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}
|
|
66
|
+
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
67
|
success: boolean;
|
|
68
68
|
message: string;
|
|
69
69
|
status: string;
|
|
70
70
|
}>;
|
|
71
71
|
|
|
72
|
-
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}
|
|
72
|
+
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
73
73
|
success: boolean;
|
|
74
74
|
message: string;
|
|
75
75
|
status: string;
|
|
@@ -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
|
@@ -54,7 +54,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
|
|
|
54
54
|
declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
|
|
55
55
|
|
|
56
56
|
declare function useSendCoinbaseUserOperation(): {
|
|
57
|
-
sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}
|
|
57
|
+
sendOperationFn: (evmAddress: `0x${string}`, callData: any, contractAddress: `0x${string}`) => Promise<{
|
|
58
58
|
success: boolean;
|
|
59
59
|
message: string;
|
|
60
60
|
}>;
|
|
@@ -63,13 +63,13 @@ declare function useSendCoinbaseUserOperation(): {
|
|
|
63
63
|
error: Error | undefined;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}
|
|
66
|
+
declare function useCoinbaseClaimActionReward(): (evmAddress: `0x${string}`, actionId: string, claimIndex: number, validationContractAddress: `0x${string}`) => Promise<{
|
|
67
67
|
success: boolean;
|
|
68
68
|
message: string;
|
|
69
69
|
status: string;
|
|
70
70
|
}>;
|
|
71
71
|
|
|
72
|
-
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}
|
|
72
|
+
declare function useCoinbaseMintAnymalNFT(): (evmAddress: `0x${string}`, pid: string, nftId: string, anymalTxId: string, validationContractAddress: `0x${string}`) => Promise<{
|
|
73
73
|
success: boolean;
|
|
74
74
|
message: string;
|
|
75
75
|
status: string;
|
|
@@ -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,24 +467,43 @@ 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)(
|
|
473
|
-
async (evmAddress, callData, contractAddress
|
|
475
|
+
async (evmAddress, callData, contractAddress) => {
|
|
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,
|
|
480
500
|
network: "base-sepolia",
|
|
481
501
|
useCdpPaymaster: true,
|
|
482
|
-
paymasterUrl,
|
|
483
502
|
calls: [{ data: callData, to: contractAddress }]
|
|
484
503
|
});
|
|
485
504
|
return { success: true, message: "Operation submitted." };
|
|
486
505
|
} catch (e) {
|
|
487
|
-
console.error(e);
|
|
506
|
+
console.error("Full error:", e);
|
|
488
507
|
return { success: false, message: e.message };
|
|
489
508
|
}
|
|
490
509
|
},
|
|
@@ -494,10 +513,10 @@ function useSendCoinbaseUserOperation() {
|
|
|
494
513
|
}
|
|
495
514
|
|
|
496
515
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
497
|
-
var
|
|
516
|
+
var import_viem3 = require("viem");
|
|
498
517
|
|
|
499
518
|
// src/helpers/BlockchainAbiHelper.tsx
|
|
500
|
-
var
|
|
519
|
+
var import_viem2 = require("viem");
|
|
501
520
|
var PET_NFT_ABI = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, {
|
|
502
521
|
"inputs": [],
|
|
503
522
|
"name": "AccessControlBadConfirmation",
|
|
@@ -2924,7 +2943,7 @@ var OZ_ERROR_FRAGMENTS = [
|
|
|
2924
2943
|
"error AddressLowLevelCallFailed(address target, bytes data)",
|
|
2925
2944
|
"error AddressEmptyCode(address target)"
|
|
2926
2945
|
];
|
|
2927
|
-
var ERROR_ABI = [...LOCAL_ERRORS, (0,
|
|
2946
|
+
var ERROR_ABI = [...LOCAL_ERRORS, (0, import_viem2.parseAbi)([...OZ_ERROR_FRAGMENTS])];
|
|
2928
2947
|
var ORG_FUNCTION = "executeCall";
|
|
2929
2948
|
|
|
2930
2949
|
// src/utils/coinbase/useCoinbaseClaimActionReward.ts
|
|
@@ -2932,7 +2951,7 @@ var import_react11 = require("react");
|
|
|
2932
2951
|
function useCoinbaseClaimActionReward() {
|
|
2933
2952
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2934
2953
|
return (0, import_react11.useCallback)(
|
|
2935
|
-
async (evmAddress, actionId, claimIndex, validationContractAddress
|
|
2954
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2936
2955
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2937
2956
|
return {
|
|
2938
2957
|
success: false,
|
|
@@ -2943,7 +2962,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2943
2962
|
try {
|
|
2944
2963
|
const args = [actionId, claimIndex];
|
|
2945
2964
|
const functionName = "claimByIndex";
|
|
2946
|
-
const callData = (0,
|
|
2965
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
2947
2966
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
2948
2967
|
functionName,
|
|
2949
2968
|
args
|
|
@@ -2951,8 +2970,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2951
2970
|
const opsRes = await sendOperationFn(
|
|
2952
2971
|
evmAddress,
|
|
2953
2972
|
callData,
|
|
2954
|
-
validationContractAddress
|
|
2955
|
-
paymasterUrl
|
|
2973
|
+
validationContractAddress
|
|
2956
2974
|
);
|
|
2957
2975
|
return { success: opsRes.success, message: opsRes.message, status };
|
|
2958
2976
|
} catch (error) {
|
|
@@ -2969,12 +2987,12 @@ function useCoinbaseClaimActionReward() {
|
|
|
2969
2987
|
}
|
|
2970
2988
|
|
|
2971
2989
|
// src/utils/coinbase/useCoinbaseMintAnymalNFT.ts
|
|
2972
|
-
var
|
|
2990
|
+
var import_viem4 = require("viem");
|
|
2973
2991
|
var import_react12 = require("react");
|
|
2974
2992
|
function useCoinbaseMintAnymalNFT() {
|
|
2975
2993
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2976
2994
|
return (0, import_react12.useCallback)(
|
|
2977
|
-
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress
|
|
2995
|
+
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2978
2996
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2979
2997
|
return {
|
|
2980
2998
|
success: false,
|
|
@@ -2991,7 +3009,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2991
3009
|
"petastic-signup-campaign-1",
|
|
2992
3010
|
anymalTxId
|
|
2993
3011
|
];
|
|
2994
|
-
const callData = (0,
|
|
3012
|
+
const callData = (0, import_viem4.encodeFunctionData)({
|
|
2995
3013
|
abi: PET_NFT_ABI,
|
|
2996
3014
|
functionName,
|
|
2997
3015
|
args
|
|
@@ -2999,8 +3017,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2999
3017
|
const opsRes = await sendOperationFn(
|
|
3000
3018
|
evmAddress,
|
|
3001
3019
|
callData,
|
|
3002
|
-
validationContractAddress
|
|
3003
|
-
paymasterUrl
|
|
3020
|
+
validationContractAddress
|
|
3004
3021
|
);
|
|
3005
3022
|
return { success: opsRes.success, message: opsRes.message, status };
|
|
3006
3023
|
} catch (error) {
|
|
@@ -3013,7 +3030,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
3013
3030
|
}
|
|
3014
3031
|
|
|
3015
3032
|
// src/utils/anymals/useMintAnymalNFT.ts
|
|
3016
|
-
var
|
|
3033
|
+
var import_viem6 = require("viem");
|
|
3017
3034
|
var import_react13 = require("react");
|
|
3018
3035
|
|
|
3019
3036
|
// src/helpers/GasEstimateHelper.tsx
|
|
@@ -3058,18 +3075,18 @@ async function applyBundlerGasEstimator(account, bundlerClient, options) {
|
|
|
3058
3075
|
}
|
|
3059
3076
|
|
|
3060
3077
|
// src/helpers/HumanRevert.tsx
|
|
3061
|
-
var
|
|
3078
|
+
var import_viem5 = require("viem");
|
|
3062
3079
|
function humanRevert(raw, shortMessage) {
|
|
3063
3080
|
if (!raw) return shortMessage ?? "Simulation reverted";
|
|
3064
3081
|
try {
|
|
3065
|
-
const { errorName, args } = (0,
|
|
3082
|
+
const { errorName, args } = (0, import_viem5.decodeErrorResult)({
|
|
3066
3083
|
abi: ERROR_ABI,
|
|
3067
3084
|
data: raw
|
|
3068
3085
|
});
|
|
3069
3086
|
return `${errorName}(${args.map(String).join(", ")})`;
|
|
3070
3087
|
} catch {
|
|
3071
3088
|
if (raw.startsWith("0x08c379a0") && raw.length >= 138) {
|
|
3072
|
-
return (0,
|
|
3089
|
+
return (0, import_viem5.hexToString)(`0x${raw.slice(138)}`);
|
|
3073
3090
|
}
|
|
3074
3091
|
return `${raw.slice(0, 10)}\u2026`;
|
|
3075
3092
|
}
|
|
@@ -3111,7 +3128,7 @@ function useMintAnymalNFT() {
|
|
|
3111
3128
|
"petastic-signup-campaign-1",
|
|
3112
3129
|
anymalTxId
|
|
3113
3130
|
];
|
|
3114
|
-
const callData = (0,
|
|
3131
|
+
const callData = (0, import_viem6.encodeFunctionData)({
|
|
3115
3132
|
abi: PET_NFT_ABI,
|
|
3116
3133
|
functionName,
|
|
3117
3134
|
args
|
|
@@ -3298,7 +3315,7 @@ function useUploadAnymalImage() {
|
|
|
3298
3315
|
var import_react16 = require("react");
|
|
3299
3316
|
|
|
3300
3317
|
// src/helpers/ProcessDirectPartialPayment.tsx
|
|
3301
|
-
var
|
|
3318
|
+
var import_viem7 = require("viem");
|
|
3302
3319
|
|
|
3303
3320
|
// src/helpers/SendUserOpWithRetries.tsx
|
|
3304
3321
|
async function sendUserOpWithRetries(bundlerClient, params, retries = 3, delay = 1e3) {
|
|
@@ -3358,7 +3375,7 @@ async function processDirectPartialPayment(marketplaceContract, smartAccount, bu
|
|
|
3358
3375
|
deadline,
|
|
3359
3376
|
backendSignature
|
|
3360
3377
|
];
|
|
3361
|
-
const partialPayCalldata = (0,
|
|
3378
|
+
const partialPayCalldata = (0, import_viem7.encodeFunctionData)({
|
|
3362
3379
|
abi: MARKETPLACE_ABI,
|
|
3363
3380
|
functionName,
|
|
3364
3381
|
args
|
|
@@ -3454,20 +3471,20 @@ function useProcessPartialKibblePayment() {
|
|
|
3454
3471
|
var import_react17 = require("react");
|
|
3455
3472
|
|
|
3456
3473
|
// src/helpers/ProcessDirectKibbleApproval.tsx
|
|
3457
|
-
var
|
|
3474
|
+
var import_viem8 = require("viem");
|
|
3458
3475
|
async function processDirectKibbleApproval(kibbleTokenAddress, spenderAddress, smartAccount, bundlerClient, approveAmount) {
|
|
3459
3476
|
try {
|
|
3460
3477
|
const functionName = "approve";
|
|
3461
3478
|
const args = [spenderAddress, approveAmount];
|
|
3462
|
-
const approveCalldata = (0,
|
|
3463
|
-
abi:
|
|
3479
|
+
const approveCalldata = (0, import_viem8.encodeFunctionData)({
|
|
3480
|
+
abi: import_viem8.erc20Abi,
|
|
3464
3481
|
functionName,
|
|
3465
3482
|
args
|
|
3466
3483
|
});
|
|
3467
3484
|
await simulateCall(
|
|
3468
3485
|
bundlerClient.client,
|
|
3469
3486
|
kibbleTokenAddress,
|
|
3470
|
-
|
|
3487
|
+
import_viem8.erc20Abi,
|
|
3471
3488
|
functionName,
|
|
3472
3489
|
args,
|
|
3473
3490
|
smartAccount.address
|
|
@@ -3524,7 +3541,7 @@ function useApproveKibbleToken() {
|
|
|
3524
3541
|
|
|
3525
3542
|
// src/utils/organization/useCreateOrganizationBase.ts
|
|
3526
3543
|
var import_react18 = require("react");
|
|
3527
|
-
var
|
|
3544
|
+
var import_viem9 = require("viem");
|
|
3528
3545
|
function useCreateOrganizationBase() {
|
|
3529
3546
|
return (0, import_react18.useCallback)(
|
|
3530
3547
|
/**
|
|
@@ -3548,7 +3565,7 @@ function useCreateOrganizationBase() {
|
|
|
3548
3565
|
try {
|
|
3549
3566
|
const functionName = "createOrganizationProxy";
|
|
3550
3567
|
const args = [ownerAddress, orgName, orgPid];
|
|
3551
|
-
const callData = (0,
|
|
3568
|
+
const callData = (0, import_viem9.encodeFunctionData)({
|
|
3552
3569
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3553
3570
|
functionName,
|
|
3554
3571
|
args
|
|
@@ -3586,7 +3603,7 @@ function useCreateOrganizationBase() {
|
|
|
3586
3603
|
let proxyAddress;
|
|
3587
3604
|
for (const log of txReceipt.logs) {
|
|
3588
3605
|
try {
|
|
3589
|
-
const decoded = (0,
|
|
3606
|
+
const decoded = (0, import_viem9.decodeEventLog)({
|
|
3590
3607
|
abi: ORGANIZATION_BEACON_ABI,
|
|
3591
3608
|
data: log.data,
|
|
3592
3609
|
topics: log.topics
|
|
@@ -3625,10 +3642,10 @@ function useCreateOrganizationBase() {
|
|
|
3625
3642
|
var import_react19 = require("react");
|
|
3626
3643
|
|
|
3627
3644
|
// src/helpers/ProcessOrgKibbleApproval.tsx
|
|
3628
|
-
var
|
|
3645
|
+
var import_viem11 = require("viem");
|
|
3629
3646
|
|
|
3630
3647
|
// src/helpers/WaitForAllowance.tsx
|
|
3631
|
-
var
|
|
3648
|
+
var import_viem10 = require("viem");
|
|
3632
3649
|
async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spenderAddress, expectedAmount) {
|
|
3633
3650
|
const MAX_RETRIES = 10;
|
|
3634
3651
|
const RETRY_INTERVAL = 2e3;
|
|
@@ -3637,7 +3654,7 @@ async function waitForAllowance(publicClient, tokenAddress, ownerAddress, spende
|
|
|
3637
3654
|
try {
|
|
3638
3655
|
const currentAllowance = await publicClient.readContract({
|
|
3639
3656
|
address: tokenAddress,
|
|
3640
|
-
abi:
|
|
3657
|
+
abi: import_viem10.erc20Abi,
|
|
3641
3658
|
functionName: "allowance",
|
|
3642
3659
|
args: [ownerAddress, spenderAddress]
|
|
3643
3660
|
});
|
|
@@ -3662,13 +3679,13 @@ async function processOrgKibbleApproval(orgContractAddress, kibbleTokenAddress,
|
|
|
3662
3679
|
if (approveAmount <= 0n) {
|
|
3663
3680
|
return { success: false, message: "Approval amount must be greater than zero." };
|
|
3664
3681
|
}
|
|
3665
|
-
const approveCalldata = (0,
|
|
3666
|
-
abi:
|
|
3682
|
+
const approveCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3683
|
+
abi: import_viem11.erc20Abi,
|
|
3667
3684
|
functionName: "approve",
|
|
3668
3685
|
args: [partialPaymentModuleAddress, approveAmount]
|
|
3669
3686
|
});
|
|
3670
3687
|
const args = [kibbleTokenAddress, approveCalldata];
|
|
3671
|
-
const executeApproveCalldata = (0,
|
|
3688
|
+
const executeApproveCalldata = (0, import_viem11.encodeFunctionData)({
|
|
3672
3689
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3673
3690
|
functionName: ORG_FUNCTION,
|
|
3674
3691
|
args
|
|
@@ -3755,10 +3772,10 @@ function useApproveOrgPartialPayment() {
|
|
|
3755
3772
|
var import_react20 = require("react");
|
|
3756
3773
|
|
|
3757
3774
|
// src/helpers/ProcessOrgPartialPayment.tsx
|
|
3758
|
-
var
|
|
3775
|
+
var import_viem12 = require("viem");
|
|
3759
3776
|
async function processOrgPartialPayment(orgContractAddress, partialPaymentModuleAddress, managerSmartAccount, bundlerClient, orderId, anymalNftId, pid, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) {
|
|
3760
3777
|
try {
|
|
3761
|
-
const partialPayCalldata = (0,
|
|
3778
|
+
const partialPayCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3762
3779
|
abi: MARKETPLACE_ABI,
|
|
3763
3780
|
functionName: "partialPay",
|
|
3764
3781
|
args: [
|
|
@@ -3773,7 +3790,7 @@ async function processOrgPartialPayment(orgContractAddress, partialPaymentModule
|
|
|
3773
3790
|
]
|
|
3774
3791
|
});
|
|
3775
3792
|
const args = [partialPaymentModuleAddress, partialPayCalldata];
|
|
3776
|
-
const executePartialPayCalldata = (0,
|
|
3793
|
+
const executePartialPayCalldata = (0, import_viem12.encodeFunctionData)({
|
|
3777
3794
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3778
3795
|
functionName: ORG_FUNCTION,
|
|
3779
3796
|
args
|
|
@@ -3889,7 +3906,7 @@ function useUpdateOrgWalletAddress() {
|
|
|
3889
3906
|
}
|
|
3890
3907
|
|
|
3891
3908
|
// src/utils/organization/useMintOrgAnymalNFT.ts
|
|
3892
|
-
var
|
|
3909
|
+
var import_viem13 = require("viem");
|
|
3893
3910
|
var import_react22 = require("react");
|
|
3894
3911
|
function useMintOrgAnymalNFT() {
|
|
3895
3912
|
return (0, import_react22.useCallback)(
|
|
@@ -3908,13 +3925,13 @@ function useMintOrgAnymalNFT() {
|
|
|
3908
3925
|
"petastic-signup-campaign-1",
|
|
3909
3926
|
anymalTxId
|
|
3910
3927
|
];
|
|
3911
|
-
const callData = (0,
|
|
3928
|
+
const callData = (0, import_viem13.encodeFunctionData)({
|
|
3912
3929
|
abi: PET_NFT_ABI,
|
|
3913
3930
|
functionName,
|
|
3914
3931
|
args
|
|
3915
3932
|
});
|
|
3916
3933
|
const executeArgs = [validationContractAddress, callData];
|
|
3917
|
-
const executeSubmitMetaCalldata = (0,
|
|
3934
|
+
const executeSubmitMetaCalldata = (0, import_viem13.encodeFunctionData)({
|
|
3918
3935
|
abi: ORGANIZATION_IMPL_ABI,
|
|
3919
3936
|
functionName: ORG_FUNCTION,
|
|
3920
3937
|
args: executeArgs
|
|
@@ -3947,10 +3964,10 @@ function useMintOrgAnymalNFT() {
|
|
|
3947
3964
|
|
|
3948
3965
|
// src/helpers/NonceHelper.tsx
|
|
3949
3966
|
var import_uuid = require("uuid");
|
|
3950
|
-
var
|
|
3967
|
+
var import_viem14 = require("viem");
|
|
3951
3968
|
var generateBytes32Nonce = () => {
|
|
3952
3969
|
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
3953
|
-
return (0,
|
|
3970
|
+
return (0, import_viem14.padHex)(`0x${uuid3}`, { size: 32 });
|
|
3954
3971
|
};
|
|
3955
3972
|
|
|
3956
3973
|
// src/helpers/CryptoUtils.tsx
|
|
@@ -4406,16 +4423,16 @@ function useCreateOrganizationAppData() {
|
|
|
4406
4423
|
|
|
4407
4424
|
// src/utils/balance/useFetchBalance.ts
|
|
4408
4425
|
var import_react27 = require("react");
|
|
4409
|
-
var
|
|
4426
|
+
var import_viem15 = require("viem");
|
|
4410
4427
|
function useFetchBalance() {
|
|
4411
4428
|
return (0, import_react27.useCallback)(
|
|
4412
4429
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
4413
4430
|
try {
|
|
4414
4431
|
const balance = await publicClient.readContract({
|
|
4415
|
-
address: (0,
|
|
4416
|
-
abi:
|
|
4432
|
+
address: (0, import_viem15.getAddress)(kibbleTokenAddress),
|
|
4433
|
+
abi: import_viem15.erc20Abi,
|
|
4417
4434
|
functionName: "balanceOf",
|
|
4418
|
-
args: [(0,
|
|
4435
|
+
args: [(0, import_viem15.getAddress)(walletAddress)]
|
|
4419
4436
|
});
|
|
4420
4437
|
return Number(balance);
|
|
4421
4438
|
} catch (error) {
|
|
@@ -4427,7 +4444,7 @@ function useFetchBalance() {
|
|
|
4427
4444
|
}
|
|
4428
4445
|
|
|
4429
4446
|
// src/utils/actions/useClaimActionReward.ts
|
|
4430
|
-
var
|
|
4447
|
+
var import_viem16 = require("viem");
|
|
4431
4448
|
var import_react28 = require("react");
|
|
4432
4449
|
function useClaimActionReward() {
|
|
4433
4450
|
return (0, import_react28.useCallback)(
|
|
@@ -4440,7 +4457,7 @@ function useClaimActionReward() {
|
|
|
4440
4457
|
}
|
|
4441
4458
|
const args = [actionId, claimIndex];
|
|
4442
4459
|
const functionName = "claimByIndex";
|
|
4443
|
-
const callData = (0,
|
|
4460
|
+
const callData = (0, import_viem16.encodeFunctionData)({
|
|
4444
4461
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4445
4462
|
functionName,
|
|
4446
4463
|
args
|
|
@@ -4476,7 +4493,7 @@ function useClaimActionReward() {
|
|
|
4476
4493
|
}
|
|
4477
4494
|
|
|
4478
4495
|
// src/utils/actions/useClaimOrgActionReward.ts
|
|
4479
|
-
var
|
|
4496
|
+
var import_viem17 = require("viem");
|
|
4480
4497
|
var import_react29 = require("react");
|
|
4481
4498
|
function useClaimOrgActionReward() {
|
|
4482
4499
|
return (0, import_react29.useCallback)(
|
|
@@ -4487,13 +4504,13 @@ function useClaimOrgActionReward() {
|
|
|
4487
4504
|
message: "Missing web3auth account info or contract address."
|
|
4488
4505
|
};
|
|
4489
4506
|
}
|
|
4490
|
-
const claimCallData = (0,
|
|
4507
|
+
const claimCallData = (0, import_viem17.encodeFunctionData)({
|
|
4491
4508
|
abi: REWARDABLE_ACTIONS_ABI,
|
|
4492
4509
|
functionName: "claimByIndex",
|
|
4493
4510
|
args: [actionId, claimIndex]
|
|
4494
4511
|
});
|
|
4495
4512
|
const args = [rewardableActionContractAddress, claimCallData];
|
|
4496
|
-
const executeClaimCalldata = (0,
|
|
4513
|
+
const executeClaimCalldata = (0, import_viem17.encodeFunctionData)({
|
|
4497
4514
|
abi: ORGANIZATION_IMPL_ABI,
|
|
4498
4515
|
functionName: ORG_FUNCTION,
|
|
4499
4516
|
args
|
package/dist/index.mjs
CHANGED
|
@@ -389,24 +389,43 @@ 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(
|
|
395
|
-
async (evmAddress, callData, contractAddress
|
|
397
|
+
async (evmAddress, callData, contractAddress) => {
|
|
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,
|
|
402
422
|
network: "base-sepolia",
|
|
403
423
|
useCdpPaymaster: true,
|
|
404
|
-
paymasterUrl,
|
|
405
424
|
calls: [{ data: callData, to: contractAddress }]
|
|
406
425
|
});
|
|
407
426
|
return { success: true, message: "Operation submitted." };
|
|
408
427
|
} catch (e) {
|
|
409
|
-
console.error(e);
|
|
428
|
+
console.error("Full error:", e);
|
|
410
429
|
return { success: false, message: e.message };
|
|
411
430
|
}
|
|
412
431
|
},
|
|
@@ -2854,7 +2873,7 @@ import { useCallback as useCallback11 } from "react";
|
|
|
2854
2873
|
function useCoinbaseClaimActionReward() {
|
|
2855
2874
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2856
2875
|
return useCallback11(
|
|
2857
|
-
async (evmAddress, actionId, claimIndex, validationContractAddress
|
|
2876
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2858
2877
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2859
2878
|
return {
|
|
2860
2879
|
success: false,
|
|
@@ -2873,8 +2892,7 @@ function useCoinbaseClaimActionReward() {
|
|
|
2873
2892
|
const opsRes = await sendOperationFn(
|
|
2874
2893
|
evmAddress,
|
|
2875
2894
|
callData,
|
|
2876
|
-
validationContractAddress
|
|
2877
|
-
paymasterUrl
|
|
2895
|
+
validationContractAddress
|
|
2878
2896
|
);
|
|
2879
2897
|
return { success: opsRes.success, message: opsRes.message, status };
|
|
2880
2898
|
} catch (error) {
|
|
@@ -2896,7 +2914,7 @@ import { useCallback as useCallback12 } from "react";
|
|
|
2896
2914
|
function useCoinbaseMintAnymalNFT() {
|
|
2897
2915
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2898
2916
|
return useCallback12(
|
|
2899
|
-
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress
|
|
2917
|
+
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2900
2918
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2901
2919
|
return {
|
|
2902
2920
|
success: false,
|
|
@@ -2921,8 +2939,7 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2921
2939
|
const opsRes = await sendOperationFn(
|
|
2922
2940
|
evmAddress,
|
|
2923
2941
|
callData,
|
|
2924
|
-
validationContractAddress
|
|
2925
|
-
paymasterUrl
|
|
2942
|
+
validationContractAddress
|
|
2926
2943
|
);
|
|
2927
2944
|
return { success: opsRes.success, message: opsRes.message, status };
|
|
2928
2945
|
} catch (error) {
|
package/package.json
CHANGED