Multiwrap
When using the Multiwrap smart contract, additional top-level functionality is available to use.
To access the top-level functionality, use the get_multiwrap
method when creating the contract instance:
contract = python.get_multiwrap(
"{{contract_address}}",
)
As each multiwrap NFT is a newly created NFT, in addition to functionalities listed, the multiwrap contract also implements the following extensions for you to use:
get_wrapped_contents
Get the contents of a wrapped token bundle.
token_id = 0
contents = contract.get_wrapped_contents(token_id)
print(contents.erc20_tokens)
print(contents.erc721_tokens)
print(contents.erc1155_tokens)
Configuration
wrap
Wrap any number of ERC20, ERC721, or ERC1155 tokens into a single wrapped token.
from thirdweb.types import (
TokensToWrap,
ERC20Wrappable,
ERC721Wrappable,
ERC1155Wrappable,
NFTMetadataInput,
)
# Contract setup goes here...
tx = contract.wrap(
TokensToWrap(
erc20_tokens=[
ERC20Wrappable(contract_address="0x...", quantity=0.8),
],
erc721_tokens=[
ERC721Wrappable(contract_address="0x...", token_id=0),
],
erc1155_tokens=[
ERC1155Wrappable(contract_address="0x...", token_id=0, quantity=1),
]
),
NFTMetadataInput(
name="Wrapped NFT",
description="This is a wrapped bundle of tokens and NFTs",
image="ipfs://...",
)
)
print(tx.receipt, tx.id)
Configuration
unwrap
Unwrap a wrapped token bundle
wrapped_token_id = 0
recipient_address = "0x..."
tx = contract.unwrap(wrapped_token_id, recipient_address)