anymal-protocol 1.0.128 → 1.0.130
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +41 -21
- package/dist/index.mjs +41 -21
- 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}`, paymasterUrl: 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}`, paymasterUrl: 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}`, paymasterUrl: string) => Promise<{
|
|
73
73
|
success: boolean;
|
|
74
74
|
message: string;
|
|
75
75
|
status: string;
|
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}`, paymasterUrl: 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}`, paymasterUrl: 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}`, paymasterUrl: string) => Promise<{
|
|
73
73
|
success: boolean;
|
|
74
74
|
message: string;
|
|
75
75
|
status: string;
|
package/dist/index.js
CHANGED
|
@@ -470,7 +470,7 @@ var import_cdp_hooks = require("@coinbase/cdp-hooks");
|
|
|
470
470
|
function useSendCoinbaseUserOperation() {
|
|
471
471
|
const { sendUserOperation, data, error, status } = (0, import_cdp_hooks.useSendUserOperation)();
|
|
472
472
|
const sendOperationFn = (0, import_react10.useCallback)(
|
|
473
|
-
async (evmAddress, callData, contractAddress) => {
|
|
473
|
+
async (evmAddress, callData, contractAddress, paymasterUrl) => {
|
|
474
474
|
if (!evmAddress || !callData || !contractAddress) {
|
|
475
475
|
return { success: false, message: "Missing required information" };
|
|
476
476
|
}
|
|
@@ -479,6 +479,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
479
479
|
evmSmartAccount: evmAddress,
|
|
480
480
|
network: "base-sepolia",
|
|
481
481
|
useCdpPaymaster: true,
|
|
482
|
+
paymasterUrl,
|
|
482
483
|
calls: [{ data: callData, to: contractAddress }]
|
|
483
484
|
});
|
|
484
485
|
return { success: true, message: "Operation submitted." };
|
|
@@ -2931,7 +2932,7 @@ var import_react11 = require("react");
|
|
|
2931
2932
|
function useCoinbaseClaimActionReward() {
|
|
2932
2933
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2933
2934
|
return (0, import_react11.useCallback)(
|
|
2934
|
-
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2935
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress, paymasterUrl) => {
|
|
2935
2936
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2936
2937
|
return {
|
|
2937
2938
|
success: false,
|
|
@@ -2947,11 +2948,20 @@ function useCoinbaseClaimActionReward() {
|
|
|
2947
2948
|
functionName,
|
|
2948
2949
|
args
|
|
2949
2950
|
});
|
|
2950
|
-
await sendOperationFn(
|
|
2951
|
-
|
|
2951
|
+
const opsRes = await sendOperationFn(
|
|
2952
|
+
evmAddress,
|
|
2953
|
+
callData,
|
|
2954
|
+
validationContractAddress,
|
|
2955
|
+
paymasterUrl
|
|
2956
|
+
);
|
|
2957
|
+
return { success: opsRes.success, message: opsRes.message, status };
|
|
2952
2958
|
} catch (error) {
|
|
2953
2959
|
console.error(error);
|
|
2954
|
-
return {
|
|
2960
|
+
return {
|
|
2961
|
+
success: false,
|
|
2962
|
+
message: "Reward not claimed",
|
|
2963
|
+
status: "error"
|
|
2964
|
+
};
|
|
2955
2965
|
}
|
|
2956
2966
|
},
|
|
2957
2967
|
[]
|
|
@@ -2964,7 +2974,7 @@ var import_react12 = require("react");
|
|
|
2964
2974
|
function useCoinbaseMintAnymalNFT() {
|
|
2965
2975
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2966
2976
|
return (0, import_react12.useCallback)(
|
|
2967
|
-
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2977
|
+
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress, paymasterUrl) => {
|
|
2968
2978
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2969
2979
|
return {
|
|
2970
2980
|
success: false,
|
|
@@ -2972,21 +2982,31 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2972
2982
|
status: "error"
|
|
2973
2983
|
};
|
|
2974
2984
|
}
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2985
|
+
try {
|
|
2986
|
+
const functionName = "submitMetadataByCampaignName";
|
|
2987
|
+
const args = [
|
|
2988
|
+
pid,
|
|
2989
|
+
nftId,
|
|
2990
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
2991
|
+
"petastic-signup-campaign-1",
|
|
2992
|
+
anymalTxId
|
|
2993
|
+
];
|
|
2994
|
+
const callData = (0, import_viem3.encodeFunctionData)({
|
|
2995
|
+
abi: PET_NFT_ABI,
|
|
2996
|
+
functionName,
|
|
2997
|
+
args
|
|
2998
|
+
});
|
|
2999
|
+
const opsRes = await sendOperationFn(
|
|
3000
|
+
evmAddress,
|
|
3001
|
+
callData,
|
|
3002
|
+
validationContractAddress,
|
|
3003
|
+
paymasterUrl
|
|
3004
|
+
);
|
|
3005
|
+
return { success: opsRes.success, message: opsRes.message, status };
|
|
3006
|
+
} catch (error) {
|
|
3007
|
+
console.error(error);
|
|
3008
|
+
return { success: false, message: "Error", status: "error" };
|
|
3009
|
+
}
|
|
2990
3010
|
},
|
|
2991
3011
|
[]
|
|
2992
3012
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -392,7 +392,7 @@ import { useSendUserOperation } from "@coinbase/cdp-hooks";
|
|
|
392
392
|
function useSendCoinbaseUserOperation() {
|
|
393
393
|
const { sendUserOperation, data, error, status } = useSendUserOperation();
|
|
394
394
|
const sendOperationFn = useCallback10(
|
|
395
|
-
async (evmAddress, callData, contractAddress) => {
|
|
395
|
+
async (evmAddress, callData, contractAddress, paymasterUrl) => {
|
|
396
396
|
if (!evmAddress || !callData || !contractAddress) {
|
|
397
397
|
return { success: false, message: "Missing required information" };
|
|
398
398
|
}
|
|
@@ -401,6 +401,7 @@ function useSendCoinbaseUserOperation() {
|
|
|
401
401
|
evmSmartAccount: evmAddress,
|
|
402
402
|
network: "base-sepolia",
|
|
403
403
|
useCdpPaymaster: true,
|
|
404
|
+
paymasterUrl,
|
|
404
405
|
calls: [{ data: callData, to: contractAddress }]
|
|
405
406
|
});
|
|
406
407
|
return { success: true, message: "Operation submitted." };
|
|
@@ -2853,7 +2854,7 @@ import { useCallback as useCallback11 } from "react";
|
|
|
2853
2854
|
function useCoinbaseClaimActionReward() {
|
|
2854
2855
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2855
2856
|
return useCallback11(
|
|
2856
|
-
async (evmAddress, actionId, claimIndex, validationContractAddress) => {
|
|
2857
|
+
async (evmAddress, actionId, claimIndex, validationContractAddress, paymasterUrl) => {
|
|
2857
2858
|
if (!evmAddress || !actionId || claimIndex === void 0 || !validationContractAddress) {
|
|
2858
2859
|
return {
|
|
2859
2860
|
success: false,
|
|
@@ -2869,11 +2870,20 @@ function useCoinbaseClaimActionReward() {
|
|
|
2869
2870
|
functionName,
|
|
2870
2871
|
args
|
|
2871
2872
|
});
|
|
2872
|
-
await sendOperationFn(
|
|
2873
|
-
|
|
2873
|
+
const opsRes = await sendOperationFn(
|
|
2874
|
+
evmAddress,
|
|
2875
|
+
callData,
|
|
2876
|
+
validationContractAddress,
|
|
2877
|
+
paymasterUrl
|
|
2878
|
+
);
|
|
2879
|
+
return { success: opsRes.success, message: opsRes.message, status };
|
|
2874
2880
|
} catch (error) {
|
|
2875
2881
|
console.error(error);
|
|
2876
|
-
return {
|
|
2882
|
+
return {
|
|
2883
|
+
success: false,
|
|
2884
|
+
message: "Reward not claimed",
|
|
2885
|
+
status: "error"
|
|
2886
|
+
};
|
|
2877
2887
|
}
|
|
2878
2888
|
},
|
|
2879
2889
|
[]
|
|
@@ -2886,7 +2896,7 @@ import { useCallback as useCallback12 } from "react";
|
|
|
2886
2896
|
function useCoinbaseMintAnymalNFT() {
|
|
2887
2897
|
const { sendOperationFn, status } = useSendCoinbaseUserOperation();
|
|
2888
2898
|
return useCallback12(
|
|
2889
|
-
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress) => {
|
|
2899
|
+
async (evmAddress, pid, nftId, anymalTxId, validationContractAddress, paymasterUrl) => {
|
|
2890
2900
|
if (!nftId || !pid || !validationContractAddress) {
|
|
2891
2901
|
return {
|
|
2892
2902
|
success: false,
|
|
@@ -2894,21 +2904,31 @@ function useCoinbaseMintAnymalNFT() {
|
|
|
2894
2904
|
status: "error"
|
|
2895
2905
|
};
|
|
2896
2906
|
}
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2907
|
+
try {
|
|
2908
|
+
const functionName = "submitMetadataByCampaignName";
|
|
2909
|
+
const args = [
|
|
2910
|
+
pid,
|
|
2911
|
+
nftId,
|
|
2912
|
+
`https://dev-nft.petastic.com/metadata/${nftId}`,
|
|
2913
|
+
"petastic-signup-campaign-1",
|
|
2914
|
+
anymalTxId
|
|
2915
|
+
];
|
|
2916
|
+
const callData = encodeFunctionData2({
|
|
2917
|
+
abi: PET_NFT_ABI,
|
|
2918
|
+
functionName,
|
|
2919
|
+
args
|
|
2920
|
+
});
|
|
2921
|
+
const opsRes = await sendOperationFn(
|
|
2922
|
+
evmAddress,
|
|
2923
|
+
callData,
|
|
2924
|
+
validationContractAddress,
|
|
2925
|
+
paymasterUrl
|
|
2926
|
+
);
|
|
2927
|
+
return { success: opsRes.success, message: opsRes.message, status };
|
|
2928
|
+
} catch (error) {
|
|
2929
|
+
console.error(error);
|
|
2930
|
+
return { success: false, message: "Error", status: "error" };
|
|
2931
|
+
}
|
|
2912
2932
|
},
|
|
2913
2933
|
[]
|
|
2914
2934
|
);
|
package/package.json
CHANGED