Getting Started
To get started using the Contract SDK to interact with contracts, there are two options:
- Create a new project with the CLI which automatically sets up the relevant package(s).
- Add to an existing project by installing the relevant package(s).
1. Create a New Project
To create a new project, use the thirdweb create
command to setup a front-end or scripting project and install the required dependencies:
- Next.js
- Vite
- React App
- React Native
- Node
- Express
npx thirdweb create --next
npx thirdweb create --vite
npx thirdweb create --cra
npx thirdweb create --reactNative
npx thirdweb create --node
npx thirdweb create --express
2. Add to an Existing Project
To add to an existing project, install the relevant package(s) and import into the desired files. For example, to install the React and TypeScript SDKs, run the following command:
- npm
- yarn
- pnpm
npm i @thirdweb-dev/react @thirdweb-dev/sdk
yarn add @thirdweb-dev/react @thirdweb-dev/sdk
pnpm i @thirdweb-dev/react @thirdweb-dev/sdk
Then, you can import the relevant hooks and functions, e.g. the useContract
hook, which you need to install from the React SDK:
import { useContract } from "@thirdweb-dev/react";
For more information on how to get started using each of the SDKs, see the full references.
Full Reference
How and what can be done with the SDKs depends on the required language. The same base set of functionality is included but consult the full references: