Skip to content

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 ​

PropertyTypeDescription
dataSigner | undefinedThe transaction signer from the connected wallet
isLoadingbooleanWhether the signer is currently being loaded

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.

Released under the MIT License.