You are on page 1of 2

12/3/22, 11:51 PM Dashboard | thirdweb

0.1 GOR
0x67...186 (Goerli)

Dwill
0xcada...6C93 Contract Badge

Dwill
Decentralised Will to secure funds of a wall…
0xa4A9...20d7 v1.0.0

Explorer Events Code Settings Sources

Getting Started
First, install the latest version of the SDK.
React Web3Button JavaScript Python Go
npm install @thirdweb-dev/react @thirdweb-dev/sdk ethers

Follow along below to get started using this contract in your code.
import { useContract } from "@thirdweb-dev/react";

export default function Component() {


// While isLoading is true, contract is undefined.
const { contract, isLoading, error } =
useContract("0xcada0843BEb86A7aC38c0cC662e45e3d3e586C93");
// Now you can use the contract in the rest of the component
}

Reading Data
Once you setup your contract, you can read data from contract functions as follows:
Users
React JavaScript Python Go
import { useContract, useContractRead } from "@thirdweb-dev/react";
https://thirdweb.com/goerli/0xcada0843BEb86A7aC38c0cC662e45e3d3e586C93/code 1/2
12/3/22, 11:51 PM Dashboard | thirdweb

export default function Component() {


const { contract } =
useContract("0xcada0843BEb86A7aC38c0cC662e45e3d3e586C93");
const { data, isLoading } = useContractRead(contract, "Users")
}

Writing Data
And you can also make write function calls with the following setup:
register
React Web3Button JavaScript Python Go
import { useContract, useContractWrite } from "@thirdweb-dev/react";

export default function Component() {


const { contract } =
useContract("0xcada0843BEb86A7aC38c0cC662e45e3d3e586C93");
const { mutateAsync: register, isLoading } = useContractWrite(contract,
"register")

const call = async () => {


try {
const data = await register([ _beneficiaryWallet, _tokenList,
_percentList ]);
console.info("contract call successs", data);
} catch (err) {
console.error("contract call failure", err);
}
}
}

Feedback Privacy Policy Terms of Service


thirdweb © 2022

https://thirdweb.com/goerli/0xcada0843BEb86A7aC38c0cC662e45e3d3e586C93/code 2/2

You might also like