Signer represents a connected wallet. It hides the differences between wallet implementations — browser extensions, mobile apps, hardware devices — behind a single interface. You use a signer to get addresses, check balances, sign messages, and submit transactions.
Signer types
CCC supports wallets from multiple ecosystems. TheSignerType enum identifies which ecosystem a signer belongs to:
Each signer type produces a valid CKB address using a lock script that corresponds to its native signing algorithm (secp256k1, EVM personal sign, BTC ECDSA, etc.).
Connect and disconnect
connect() is async and may throw if the user rejects the connection request. Always await it before calling any other method.Get addresses
A signer can control more than one address (e.g. a BTC wallet with multiple account derivation paths).getRecommendedAddress returns the primary one as a string:
getAddresses to retrieve all controlled addresses:
getRecommendedAddressObj when you need the underlying Address object (which carries the lock script):
Check balance
getBalance returns the total CKB capacity across all controlled addresses, in shannons (1 CKB = 10⁸ shannons):
Sign messages
Sign an arbitrary message and receive a structuredSignature object:
Sign and send transactions
Build a transaction, then hand it to the signer.sendTransaction signs and broadcasts in one step:
signTransaction:
Find cells and transactions
A signer exposes the same search helpers asClient, but scoped to the signer’s own addresses:
Access the underlying client
Every signer holds a reference to theClient it was created with:
Network preferences
When the UI needs to enforce a particular network, pass aNetworkPreference array to matchNetworkPreference. The signer returns the preferred entry when a switch is needed, or undefined when already on a compatible network: