Allowance/Approve

increaseAllowance

increaseAllowance is a method that helps developers to increase allowance from payment method token for the multiSend contract if the paymentToken of multiSend contract is an erc20 token. It is commonly used before any methods except BatchTransferNative in the Batch Transfer section pages. See more details about its usage in the section for batchTransfer method

Parameter

ArgumentTypeDescription
tokenAddressstringone of the payment method token of the presale contract
allowanceAmountstringamount of increased allowance
signerSignerthe instance to represent wallet address.

Example

const paymentToken = await multiSendSdk.getPaymentToken()
await multiSendSdk.increaseAllowance(paymentToken, "20", signer)

getAllowance

getAllowance is a method that helps get the allowance amount of a given erc20 contract for multiSend contract to spend. It is commonly used to check allowance of payment contract before increaseAllowance

Parameter

ArgumentTypeDesciption
spenderstringthe address of the erc20 token
ownerstringthe address of the owner

Response

Returns a BigNumber type value that indicates the amount of allowance

PropertyTypeDescription
PromiseBigNumberthe amount of allowance

Example

const allowance = await multiSendSdk.getAllowance(paymentToken, await signer.getAddress())

approve

Approve is a method that helps developers to set approval from any ERC721 contract for the multiSend contract. It is commonly used before BatchTransferERC721 with increaseAllowance

See more details about its usage in the section for BatchTransferERC721 method

Parameter

ArgumentTypeDescription
tokenAddressstringcontract address of an ERC721 contract
tokenIdstringthe token id under the erc721 contract
signerSignerthe instance to represent wallet address.

Example

const erc721Address = <ERC721_CONTRACT_ADDRESS>
await multiSendSdk.approve(erc721Address, "1", signer)

getApproved

getApproved is a method that helps get the approved status of a given erc721 contract for multiSend contract to spend. It is commonly used to check approval of nft contract before approve

Parameter

ArgumentTypeDescription
contractAddressstringthe token address of the ERC721 contract
tokenIdstringthe nftId of the nft under the contractAddress

Response

PropertyTypeDescription
Promisebooleanthe approved status of the nft which indicates whether the multiSend contract is allowed to transfer this nft

Example

const erc721Address = <ERC721_CONTRACT_ADDRESS>
**const approved = await multiSendSdk.getApproved(erc721Address, "1")**

setApproveForAll

setApproveForAll is a method that helps developers to set approval from ERC1155 contract for multiSend contract. It is commonly used before batchTransferERC1155 with increaseAllowance

See more details about its usage in the section for BatchTransferERC1155 method

Parameter

ArgumentTypeDescription
tokenAddressstringcontract address of erc1155 contract
approvebooleanboolean indication approval for erc1155 transfer, if true, transfer is allowed
signerSignerthe instance to represent wallet address.

Example

const erc1155Address = <ERC1155_CONTRACT_ADDRESS>
await multiSendSdk.setApproveForAll(erc1155Address, true, signer)

getApprovalForAll

getApprovalForAll is a method that helps get the approved status of a given erc1155 contract for multiSend contract to spend. It is commonly used to check approval of nft token before setApproveForAll

Parameter

ArgumentTypeDescription
contractAddressstringthe token address of the ERC1155 contract
ownerAddressstringthe wallet address of the owner of the ERC1155 token

Response

PropertyTypeDescription
Promisebooleanappoved status of ERC1155 contract which indicates whether the multiSend contract is allowed to transfer all of the ERC1155 tokens under the contract address

Example

const erc1155Address = <ERC1155_CONTRACT_ADDRESS>
const approved = await multiSendSdk.getApproved(erc1155Address, await signer.getAddress())