Getting Started
Get started with the TDK within your React application.
Installation
Install the TDK React package and its peer dependency thirdweb
:
Quick Start
Configure context provider
Wrap your app in the ThirdwebProvider
and TreasureProvider
React Context providers and pass the required props:
Ecosystem game partners should contact Treasure to obtain their development and production config values.
See the TreasureProvider docs for more configuration options.
Add connect button
Now that the context provider is set up, you can begin to use the TDK’s hooks and components. First, import the Treasure styling in your app’s entry point:
Then, add the ConnectButton
component to your app:
See the ConnectButton docs for more configuration options.
Call contract write
After starting a user session with approved target contract addresses, you can now use the TDKAPI
object to call contract writes:
See the connect-react example application for the full end-to-end source code.