Skip to main content

Multiwrap

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

Create a Multiwrap Contract

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

const contractAddress = await sdk.deployer.deployMultiwrap({
name: "My Multiwrap",
});
View in React SDK Documentation

Getting the contract in your application

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

This feature is missing a code snippet or might not be supported yet.

Check the React SDK Reference for more information.

Reach out on Discord for further assistance!

Setting Royalty Fees

Configure royalties
// royalties on the whole contract
contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalties.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});
View in React SDK Documentation

Wrapping Tokens

You can wrap any number of ERC20, ERC721, or ERC1155 tokens into a single wrapped ERC721 NFT.

When you wrap NFTs, you mint a new NFT into the Multiwrap contract.

const tx = await contract.wrap({
erc20Tokens: [{
contractAddress: "0x...",
quantity: "0.8"
}],
erc721Tokens: [{
contractAddress: "0x...",
tokenId: "0"
}],
erc1155Tokens: [{
contractAddress: "0x...",
tokenId: "1",
quantity: "2"
}]
}, {
name: "Wrapped bundle",
description: "This is a wrapped bundle of tokens and NFTs",
image: "ipfs://...",
});
const receipt = tx.receipt(); // the transaction receipt
const wrappedTokenId = tx.id; // the id of the wrapped token bundle
View in React SDK Documentation

Viewing Wrapped NFTs

One wrapped NFT

Get a single NFT Metadata
const tokenId = 0;
const nft = await contract.get(tokenId);
View in React SDK Documentation

All wrapped NFTs

Get All Minted NFTs
const nfts = await contract.getAll();
console.log(nfts);
View in React SDK Documentation

Amount of tokens owned by a specific wallet

Get NFT Balance
const walletAddress = "{{wallet_address}}";
const balance = await contract.balanceOf(walletAddress);
console.log(balance);
View in React SDK Documentation

View Wrapped NFT Contents

Get the contents of a wrapped token bundle
const contents = await contract.getWrappedContents(wrappedTokenId);
console.log(contents.erc20Tokens);
console.log(contents.erc721Tokens);
console.log(contents.erc1155Tokens);
View in React SDK Documentation

Unwrapping Tokens

When you unwrap a wrapped NFT, you can get the underlying tokens back and burn the wrapped NFT.

await contract.unwrap(wrappedTokenId);
View in React SDK Documentation

Transferring NFTs

Transfer a single NFT
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.transfer(walletAddress, tokenId);
View in React SDK Documentation