Skip to main content

Multiwrap.wrap() method

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Wrap any number of ERC20/ERC721/ERC1155 tokens into a single wrapped token

Example

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

Signature:

wrap(contents: TokensToWrap, wrappedTokenMetadata: NFTMetadataOrUri, recipientAddress?: string): Promise<TransactionResultWithId<NFT>>;

Parameters

ParameterTypeDescription
contentsTokensToWrapthe contents to wrap
wrappedTokenMetadataNFTMetadataOrUrimetadata to represent the wrapped token bundle
recipientAddressstring(Optional) Optional. The address to send the wrapped token bundle to

Returns:

Promise<TransactionResultWithId<NFT>>