Prerequisite: Install dependencies
Add the SDK to your repository:
npm i @uniblock/launcher-multisend
or
yarn add @uniblock/launcher-multisend
Step 1: Initialize the SDK
To initialize the SDK, you must first create a multisend contract through the Uniblock dashboard. Then you must provide a Uniblock API key which can be found after creating a project on the Uniblock site. The Uniblock API key can be seen on the project page. Then collect the contract address of your deployed contract and chain ID and pass them into the initialize function with the Uniblock API key:
- Nodejs:
import { initializeMultiSend } from "@uniblock/launcher-multisend"
const uniblockApiKey = <YOUR_UNIBLOCK_API_KEY>
const contractAddress = <YOUR_CONTRACT_ADDRESS>
const chainId = <YOUR_CHAIN_ID>
const option = {
rpc: <YOUR_RPC_URL> // You can assign your own rpc url
}
const multiSendSdk = await initializeMultiSend(uniblockApiKey, {contractAddress, chainId}, option)
// or if you don't have your own rpc url, you can use uniblock sdk default url
// and use the following code:
// const multiSendSdk = await initializeMultiSend(uniblockApiKey, {contractAddress, chainId})
// also chainId is optional and the default chainId of the following code will be 1:
// const multiSendSdk = await initializeMultiSend(uniblockApiKey, {contractAddress})
- Web browser:
<script type="module">
import { initializeMultiSend } from "https://cdn.jsdelivr.net/npm/@uniblock/launcher-market/index.esm.min.js"
const uniblockApiKey = <YOUR_UNIBLOCK_API_KEY>
const marketplaceContractAddress = <YOUR_CONTRACT_ADDRESS>
const chainId = <YOUR_CHAIN_ID>
const option = {
rpc: <YOUR_RPC_URL> // You can assign your own rpc url
}
const multiSendSdk = await initializeMultiSend(uniblockApiKey, {contractAddress: marketplaceContractAddress, chainId}, option)
</script>
Step 2: Explore the SDK methods
After initializing the SDK instance, developers can call any method on the SDK instance. For more details on each method of the SDK instance, explore the Batch Transfer and Get Methods sections.
npm i @uniblock/launcher-multisend
or
yarn add @uniblock/launcher-multisend