Split
Learn how to interact with your Split contract in the SDK.
Create a Split Contract
- React
- Javascript
- Python
- Go
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%
},
],
});
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%
},
],
});
Python SDK support for deploySplit is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for deploySplit is coming soon.
Want this feature sooner? Let us know in Discord!
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.
- React
- Javascript
- Python
- Go
import { useSplit } from '@thirdweb-dev/react'
export default function Component() {
const split = useSplit("<YOUR-CONTRACT-ADDRESS>")
// Now you can use the split contract in the rest of the component
}
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("{{chainName}}");
const contract = sdk.getSplit("{{contract_address}}");
Python SDK support for initializing the SDK is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for initializing the SDK is coming soon.
Want this feature sooner? Let us know in Discord!
View Recipients
- React
- Javascript
- Python
- Go
const recipients = await contract.getAllRecipients();
console.log(recipients);
const recipients = await contract.getAllRecipients();
console.log(recipients);
Python SDK support for getAllRecipients is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for getAllRecipients is coming soon.
Want this feature sooner? Let us know in Discord!
View Balance
Native Token Balance
Use this if you have been tokens native to the network (e.g., Ether
on the Ethereum network).
- React
- Javascript
- Python
- Go
// The address to check the funds of
const address = "{{wallet_address}}";
const funds = await contract.balanceOf(address);
console.log(funds);
// The address to check the funds of
const address = "{{wallet_address}}";
const funds = await contract.balanceOf(address);
console.log(funds);
Python SDK support for balanceOf is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for balanceOf is coming soon.
Want this feature sooner? Let us know in Discord!
Non-Native Token Balance
Use this if you have been sent custom tokens to the address.
- React
- Javascript
- Python
- Go
// 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);
// 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);
Python SDK support for balanceOfToken is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for balanceOfToken is coming soon.
Want this feature sooner? Let us know in Discord!
Distribute funds
This distributes funds held by the contract to all recipients.
Native Token
- React
- Javascript
- Python
- Go
await contract.distribute();
await contract.distribute();
Python SDK support for distribute is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for distribute is coming soon.
Want this feature sooner? Let us know in Discord!
Non-Native Token
- React
- Javascript
- Python
- Go
// The address of the currency to distribute funds
const tokenAddress = "0x..."
await contract.distributeToken(tokenAddress);
// The address of the currency to distribute funds
const tokenAddress = "0x..."
await contract.distributeToken(tokenAddress);
Python SDK support for distributeToken is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for distributeToken is coming soon.
Want this feature sooner? Let us know in Discord!
Withdraw Funds
- React
- Javascript
- Python
- Go
// the wallet address that wants to withdraw their funds
const walletAddress = "{{wallet_address}}"
await contract.withdraw(walletAddress);
// the wallet address that wants to withdraw their funds
const walletAddress = "{{wallet_address}}"
await contract.withdraw(walletAddress);
Python SDK support for withdraw is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for withdraw is coming soon.
Want this feature sooner? Let us know in Discord!