Hooks
useTreasure
Hook for accessing values from the TreasureProvider context.
Usage
Return Type
chain
Chain
- The currently selected chain with chain details.
contractAddresses
Record<Contract, AddressString>
- Contract address mapping for the currently selected chain.
tdk
TDKAPI
- The client for interacting with the TDK API.
client
TreasureConnectClient
- Client used to interact with Treasure Connect and other on-chain flows. This is a re-export of the ThirdwebClient.
user
User | undefined
- The logged in user, if any.
isConnecting
boolean
- True if the user is actively connecting, whether explicitly or in the background.
logIn
(wallet: Wallet) => void
- Log in a new user with an active wallet and start a new session.
logOut
() => void
- Log out and disconnect the current user.
startUserSession
(options: SessionOptions) => void
- Start a new session with the current user.
- Useful for chain switching or changing the list or approved target contract addresses during a user’s session.