Thirdweb SDK
Create Application
thirdweb offers SDKs for a range of programming languages, such as React, React Native, TypeScript, Python, Go, and Unity.
- 
In your CLI run the following command: npx thirdweb create --app
- 
Input your preferences for the command line prompts: - Give your project a name
- Choose your network: We will choose EVM for Moonbeam
- Choose your preferred framework: Next.js, CRA, Vite, React Native, Node.js, or Express
- Choose your preferred language: JavaScript or TypeScript
 
- 
Use the React or TypeScript SDK to interact with your application’s functions. See section on “interact with your contract” 
Interact With a Contract
Initialize SDK On Celo
Wrap your application in the ThirdwebProvider component and change the activeChain to Celo
import { ThirdwebProvider } from "@thirdweb-dev/react";
import { Celo } from "@thirdweb-dev/chains";
const App = () => {
  return (
    <ThirdwebProvider activeChain={Celo}>
      <YourApp />
    </ThirdwebProvider>
  );
};
Get Contract
To connect to your contract, use the SDK’s [getContract](https://portal.thirdweb.com/typescript/sdk.thirdwebsdk.getcontract)method.
import { useContract } from "@thirdweb-dev/react";
function App() {
  const { contract, isLoading, error } = useContract("{{contract_address}}");
}
Calling Contract Functions
- 
For extension based functions, use the built-in supported hooks. The following is an example using the NFTs extension to access a list of NFTs owned by an address- useOwnedNFTsimport { useOwnedNFTs, useContract, useAddress } from "@thirdweb-dev/react";
 // Your smart contract address
 const contractAddress = "{{contract_address}}";
 function App() {
 const address = useAddress();
 const { contract } = useContract(contractAddress);
 const { data, isLoading, error } = useOwnedNFTs(contract, address);
 }Full reference: https://portal.thirdweb.com/react/react.usenft 
- 
Use the useContractReadhook to call any read functions on your contract by passing in the name of the function you want to use.import { useContractRead, useContract } from "@thirdweb-dev/react";
 // Your smart contract address
 const contractAddress = "{{contract_address}}";
 function App() {
 const { contract } = useContract(contractAddress);
 const { data, isLoading, error } = useContractRead(contract, "getName");
 }Full reference: https://portal.thirdweb.com/react/react.usecontractread 
- 
Use the useContractWritehook to call any writefunctions on your contract by passing in the name of the function you want to use.import {
 useContractWrite,
 useContract,
 Web3Button,
 } from "@thirdweb-dev/react";
 // Your smart contract address
 const contractAddress = "{{contract_address}}";
 function App() {
 const { contract } = useContract(contractAddress);
 const { mutateAsync, isLoading, error } = useContractWrite(
 contract,
 "setName"
 );
 return (
 <Web3Button
 contractAddress={contractAddress}
 // Calls the "setName" function on your smart contract with "My Name" as the first argument
 action={() => mutateAsync({ args: ["My Name"] })}
 >
 Send Transaction
 </Web3Button>
 );
 }Full reference: https://portal.thirdweb.com/react/react.usecontractwrite 
Connect Wallet
Create a custom connect wallet experience by declaring supported wallets passed to your provider.
import {
  ThirdwebProvider,
  metamaskWallet,
  coinbaseWallet,
  walletConnectV1,
  walletConnect,
  safeWallet,
  paperWallet,
} from "@thirdweb-dev/react";
function MyApp() {
  return (
    <ThirdwebProvider
      supportedWallets={[
        metamaskWallet(),
        coinbaseWallet(),
        walletConnect({
          projectId: "YOUR_PROJECT_ID", // optional
        }),
        walletConnectV1(),
        safeWallet(),
        paperWallet({
          clientId: "YOUR_CLIENT_ID", // required
        }),
      ]}
      activeChain={Celo}
    >
      <App />
    </ThirdwebProvider>
  );
}
Add in a connect wallet button to prompt end-users to login with any of the above supported wallets.
import { ConnectWallet } from "@thirdweb-dev/react";
function App() {
  return <ConnectWallet />;
}
Full reference: https://portal.thirdweb.com/react/connecting-wallets
Deploy Application
To host your static web application on decentralized storage, run:
npx thirdweb deploy --app
By running this command, your application is built for production and stored using Storage. The built application is uploaded to IPFS, a decentralized storage network, and a unique URL is generated for your application.
This URL serves as a permanent hosting location for your application on the web.
If you have any further questions or encounter any issues during the process, please reach out to thirdweb support at support.thirdweb.com.