useSigner â
The useSigner
hook provides access to the transaction signer from the connected wallet, which is required for signing and submitting transactions.
Import â
tsx
import { useSigner } from '@luno-kit/react'
Usage â
Basic Usage â
tsx
import { useSigner } from '@luno-kit/react'
function ConditionalSigner() {
const { signer, isLoading } = useSigner()
if (isLoading) {
return <div>âŗ Loading signer...</div>
}
if (!signer) {
return <div>âšī¸ Please connect a wallet to access the signer</div>
}
return (
<div>
<h3>â
Signer Ready</h3>
<p>You can now sign transactions and messages</p>
</div>
)
}
ts
import { createConfig, kusama, polkadot, polkadotjsConnector } from '@luno-kit/react'
const config = createConfig({
appName: 'luno with-vite example',
chains: [polkadot, kusama],
connectors: [polkadotjsConnector()],
autoConnect: true,
});
Return Value â
The hook returns an object with the following properties:
Methods â
This hook doesn't provide any methods.
Data & Status â
Property | Type | Description |
---|---|---|
data | Signer | undefined | The transaction signer from the connected wallet |
isLoading | boolean | Whether the signer is currently being loaded |
Related Types â
Signer â
tsx
interface Signer extends InjectedSigner {
// Inherits all properties and methods from InjectedSigner
}
TIP
Inherits from: InjectedSigner
(dedot library)
The Signer
interface provides methods for:
- Signing transactions
- Signing messages
- Managing cryptographic operations
- Interacting with the wallet's signing capabilities
TIP
This hook automatically manages the signer lifecycle. It will attempt to retrieve the signer whenever the active connector or account changes. The signer is required for most transaction-related operations in LunoKit.
Related Hooks â
useAccount
- Get current account informationuseSendTransaction
- Send transactions using the signeruseSignMessage
- Sign messages using the signer