import { signals } from "@apophis-sdk/core";
import { Cosmos } from "@apophis-sdk/cosmos";
import { useMemo } from "preact/hooks";
import { useComputed } from "@preact/signals";
function MyComponent() {
const msgs = useComputed(() => [
new Bank.Send({
fromAddress: signals.address.value,
toAddress: 'neutron1...', // e.g. your developer address
amount: [Cosmos.coin(1_000000n, 'untrn')],
}),
]);
const tx = useMemo(() => Cosmos.signalTx(msgs), [msgs]);
return (
<button onClick={() => {
const txHash = await tx.signAndBroadcast(); // uses `signals.signer` internally when not specified above during `signalTx` call
console.log(txHash);
}}>Send Payment</button>
);
}