useWalletUiSigner
A hook to get a transaction signer for the active wallet.
The useWalletUiSigner
hook is a convenience hook that provides a TransactionSendingSigner
for the currently connected wallet account.
This signer can be used with libraries like gill
or other transaction-building tools to sign and send transactions on behalf of the user.
This hook is a wrapper around useWalletAccountTransactionSendingSigner
from the @solana/react
package.
Return Value
The hook returns a TransactionSendingSigner
object if a wallet is connected, otherwise it returns undefined
.
Example
This example demonstrates how to get the signer. Connect a wallet to see the signer's address appear.
import { useWalletUiSigner } from '@wallet-ui/react';
function SignerInfo() {
const signer = useWalletUiSigner();
if (!signer) {
return <p>Please connect a wallet to get a signer.</p>;
}
return <p>Signer for {signer.address} is available.</p>;
}
TBD: DEMO