Skip to main content

Split

Learn how to interact with your Split contract in the SDK.

Create a Split Contract

Deploys a new Split contract
const sdk = useSDK();

const contractAddress = await sdk.deployer.deploySplit({
name: "My Split",
primary_sale_recipient: "your-address",
recipients: [
{
address: "your-address",
sharesBps: 80 * 100, // 80%
},
{
address: "another-address",
sharesBps: 20 * 100, // 20%
},
],
});
View in React SDK Documentation

Getting the contract in your application

To start using your Split contract inside your application, you'll need to use its contract address. You can get the contract address from the dashboard.

import { useContract } from '@thirdweb-dev/react'

export default function Component() {
const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "split")

// Now you can use the split contract in the rest of the component
}

View Recipients

Get Recipients of this splits contract
const recipients = await contract.getAllRecipients();
console.log(recipients);
View in React SDK Documentation

View Balance

Native Token Balance

Use this if you have been tokens native to the network (e.g., Ether on the Ethereum network).

Get Funds owed to a particular wallet
// The address to check the funds of
const address = "{{wallet_address}}";
const funds = await contract.balanceOf(address);
console.log(funds);
View in React SDK Documentation

Non-Native Token Balance

Use this if you have been sent custom tokens to the address.

Get non-native Token Funds owed to a particular wallet
// The address to check the funds of
const address = "{{wallet_address}}";
// The address of the currency to check the contracts funds of
const tokenAddress = "0x..."
const funds = await contract.balanceOfToken(address, tokenAddress);
console.log(funds);
View in React SDK Documentation

Distribute funds

This distributes funds held by the contract to all recipients.

Native Token

await contract.distribute();
View in React SDK Documentation

Non-Native Token

// The address of the currency to distribute funds
const tokenAddress = "0x..."
await contract.distributeToken(tokenAddress);
View in React SDK Documentation

Withdraw Funds

// the wallet address that wants to withdraw their funds
const walletAddress = "{{wallet_address}}"
await contract.withdraw(walletAddress);
View in React SDK Documentation