Skip to content

Commit

Permalink
solve issue Error: No QueryClient set, use QueryClientProvider to set…
Browse files Browse the repository at this point in the history
… one
  • Loading branch information
Eason Smith committed Dec 23, 2024
1 parent 10fd8eb commit 1728195
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/SendMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useChain } from "@interchain-kit/react";
import { defaultAssetList, defaultChain, defaultChainName } from "@/config";
import useBalance from "@/hooks/useBalance";
import { useSend } from "interchain-react/cosmos/bank/v1beta1/tx.rpc.func";
import { defaultContext } from "@tanstack/react-query";

export default function SendMsg() {
const coin = defaultAssetList?.assets[0];
Expand All @@ -24,7 +25,9 @@ export default function SendMsg() {
const [error, setError] = useState<string | null>(null);

const { mutate: send, isSuccess: isSendSuccess } = useSend({
clientResolver: signingClient,
options: {
context: defaultContext,
onSuccess: (data) => {
console.log('signAndBroadcast', data)
if (data.code===0) {
Expand All @@ -34,6 +37,11 @@ export default function SendMsg() {
}
setSending(false);
},
onError: (error) => {
console.error('signAndBroadcast', error)
setError(error.message);
setSending(false);
}
},
});

Expand Down

0 comments on commit 1728195

Please sign in to comment.