wagmi-extended 1.0.5 → 1.0.6
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/README.md +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,14 +104,19 @@ const { writeContractAsync, isPending, errorMessage } = useContractWriteX({
|
|
|
104
104
|
|
|
105
105
|
const handleWrite = async () => {
|
|
106
106
|
try {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
const txHash = await writeContractAsync({
|
|
108
|
+
address: "0xContractAddress",
|
|
109
|
+
abi: [], // Provide your contract ABI
|
|
110
|
+
functionName: "executeFunction",
|
|
111
|
+
args: [/* function arguments */],
|
|
112
|
+
}, {
|
|
113
|
+
// use calbacks here in writeContractAsync or in useContractWriteX
|
|
114
|
+
onSuccess: (txHash) => console.log("Transaction successful:", txHash),
|
|
115
|
+
onError: (error) => console.error("Transaction error:", error),
|
|
116
|
+
});
|
|
117
|
+
console.log("Received txHash:", txHash);
|
|
113
118
|
} catch (err) {
|
|
114
|
-
|
|
119
|
+
console.error("Failed writing transaction:", err);`
|
|
115
120
|
}
|
|
116
121
|
};
|
|
117
122
|
|
|
@@ -146,12 +151,7 @@ function TransactionButton() {
|
|
|
146
151
|
const handleTransaction = async () => {
|
|
147
152
|
try {
|
|
148
153
|
// Replace with actual transaction parameters
|
|
149
|
-
const txHash = await sendTransactionAsync({
|
|
150
|
-
address: "0xContractAddress",
|
|
151
|
-
abi: [], // Provide your contract ABI
|
|
152
|
-
functionName: "executeFunction",
|
|
153
|
-
args: [/* function arguments */],
|
|
154
|
-
});
|
|
154
|
+
const txHash = await sendTransactionAsync({ transaction params here.. });
|
|
155
155
|
console.log("Transaction hash:", txHash);
|
|
156
156
|
} catch (error) {
|
|
157
157
|
console.error(error);
|