Multiwrap
Multiwrap lets you wrap any number of ERC20, ERC721 and ERC1155 tokens you own into a single wrapped token bundle.
import { ThirdwebSDK } from "@thirdweb-dev/sdk"; const sdk = new ThirdwebSDK("{{chainName}}");const contract = await sdk.getContract( "{{contract_address}}", "multiwrap",);
class Multiwrap extends StandardErc721<MultiwrapContract> {}
function constructor(network: NetworkInput, address: string, storage: ThirdwebStorage<IpfsUploadBatchOptions>, options: undefined | ({ clientId?: string; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest" }; gasless?: ({ experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean } }) | ({ biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number } }) | ({ engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string }; experimentalChainlessSupport?: boolean }); gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string }; rpc: Array<string>; slug: string }> }), abi: Array<objectInputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>, chainId: number, contractWrapper: ContractWrapper<Multiwrap>) : Multiwrap
let options: | undefined | { clientId?: string; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest"; }; gasless?: | { experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean; }; } | { biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number; }; } | { engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; }; experimentalChainlessSupport?: boolean; }; gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string; }; rpc: Array<string>; slug: string; }>; };
let abi: Array<objectInputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>
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);
function getWrappedContents( wrappedTokenId: BigNumberish,
function transfer( to: string, tokenId: BigNumberish,): Promise<TResult>;
Preparable
You can also prepare the transaction without executing it by calling transfer.prepare()
with same arguments. Learn more
function unwrap( wrappedTokenId: BigNumberish, recipientAddress: string,): Promise<TResult>;
Preparable
You can also prepare the transaction without executing it by calling unwrap.prepare()
with same arguments. Learn more
function wrap(contents: TokensToWrap, wrappedTokenMetadata: string | (objectInputType<extendShape<{ animation_url: ZodNullable<ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; image: ZodOptional<ZodNullable<ZodUnion<[ZodUnion<...>, ZodString]>>>; name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>> }, { attributes: ZodNullable<ZodOptional<ZodUnion<[ZodEffects<..., ..., ...>, ZodArray<..., ...>, ZodObject<..., ..., ..., ..., ...>]>>>; background_color: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodEffects<..., ..., ...>, ZodString]>>>; external_url: ZodOptional<ZodNullable<ZodUnion<[ZodUnion<...>, ZodString]>>>; properties: ZodNullable<ZodOptional<ZodUnion<[ZodEffects<..., ..., ...>, ZodArray<..., ...>, ZodObject<..., ..., ..., ..., ...>]>>> }>, ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | (BN) | (BigNumber)>, ZodUnknown]>, "strip">), recipientAddress: string) : Promise<TResult>
let wrappedTokenMetadata: string | (objectInputType<extendShape<{ animation_url: ZodNullable<ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; image: ZodOptional<ZodNullable<ZodUnion<[ZodUnion<...>, ZodString]>>>; name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>> }, { attributes: ZodNullable<ZodOptional<ZodUnion<[ZodEffects<..., ..., ...>, ZodArray<..., ...>, ZodObject<..., ..., ..., ..., ...>]>>>; background_color: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodEffects<..., ..., ...>, ZodString]>>>; external_url: ZodOptional<ZodNullable<ZodUnion<[ZodUnion<...>, ZodString]>>>; properties: ZodNullable<ZodOptional<ZodUnion<[ZodEffects<..., ..., ...>, ZodArray<..., ...>, ZodObject<..., ..., ..., ..., ...>]>>> }>, ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | (BN) | (BigNumber)>, ZodUnknown]>, "strip">)
Preparable
You can also prepare the transaction without executing it by calling wrap.prepare()
with same arguments. Learn more
StandardErc721.balanceOf
Get NFT Balance
Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).
const walletAddress = "{{wallet_address}}";const balance = await contract.balanceOf(walletAddress);console.log(balance);
function balanceOf(address: string): Promise<BigNumber>;
StandardErc721.get
Get a single NFT
const tokenId = 0;const nft = await contract.get(tokenId);
let returnType: | { id: bigint; owner: string | null; tokenURI: string; type: "ERC721"; } | { id: bigint; owner: string | null; supply: bigint; tokenURI: string; type: "ERC1155"; };
The NFT metadata
StandardErc721.getAll
Get all NFTs
Get all the data associated with every NFT in this contract.
By default, returns the first 100 NFTs, use queryParams to fetch more.
const nfts = await contract.getAll();console.log(nfts);
function getAll(queryParams?: { count?: number; start?: number;
let returnType: | { id: bigint; owner: string | null; tokenURI: string; type: "ERC721"; } | { id: bigint; owner: string | null; supply: bigint; tokenURI: string; type: "ERC1155"; };
The NFT metadata for all NFTs queried.
StandardErc721.getOwned
Get all NFTs owned by a specific wallet
Get all the data associated with the NFTs owned by a specific wallet.
// Address of the wallet to get the NFTs ofconst address = "{{wallet_address}}";const nfts = await contract.getOwned(address);console.log(nfts);
function getOwned( walletAddress?: string, queryParams?: { count?: number; start?: number },
let returnType: | { id: bigint; owner: string | null; tokenURI: string; type: "ERC721"; } | { id: bigint; owner: string | null; supply: bigint; tokenURI: string; type: "ERC1155"; };
The NFT metadata for all NFTs in the contract.
StandardErc721.getOwnedTokenIds
Get Owned Token Ids
Get all the token ids of NFTs owned by a specific wallet (no metadata)
function getOwnedTokenIds( walletAddress?: string,): Promise<Array<BigNumber>>;
StandardErc721.isApproved
Get whether this wallet has approved transfers from the given operator
function isApproved( address: string, operator: string,): Promise<boolean>;
let abi: Array<objectOutputType<{ inputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; name: ZodDefault<ZodString>; outputs: ZodDefault<ZodArray<ZodObject<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<ZodObject<..., ..., ..., ..., ...>, "many">>; stateMutability: ZodOptional<ZodString> }>, "strip", ZodAny, objectOutputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">, objectInputType<extendShape<{ name: ZodDefault<ZodString>; type: ZodString }, { components: ZodOptional<ZodArray<..., ...>>; stateMutability: ZodOptional<ZodString> }>, ZodAny, "strip">>, "many">>; type: ZodString }, ZodAny, "strip">>
let metadata: ContractMetadata<Multiwrap, { deploy: ZodObject<extendShape<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<..., ..., ...>, ZodType<..., ..., ...>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { }>, { symbol: ZodDefault<ZodString> }>, { trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>, "many">> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol: string; trusted_forwarders: Array<string> }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol?: string; trusted_forwarders?: Array<string> }>; input: ZodObject<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<[..., ...]>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { }>, { symbol: ZodDefault<ZodString> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol: string }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol?: string }>; output: ZodObject<extendShape<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<..., ..., ...>, ZodType<..., ..., ...>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { image: ZodOptional<ZodString> }>, { }>, { symbol: ZodDefault<ZodString> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: string; name: string; social_urls?: Record<string, string>; symbol: string }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: string; name: string; social_urls?: Record<string, string>; symbol?: string }> }>
Multiwrap, "transfer" | "minter" | "admin" | "asset" | "unwrap">;
Configure royalties
let royalties: ContractRoyalty<Multiwrap, { deploy: ZodObject<extendShape<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<..., ..., ...>, ZodType<..., ..., ...>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { }>, { symbol: ZodDefault<ZodString> }>, { trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>, "many">> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol: string; trusted_forwarders: Array<string> }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol?: string; trusted_forwarders?: Array<string> }>; input: ZodObject<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${...}`, ZodTypeDef, (...) | (...)>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<[..., ...]>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { }>, { symbol: ZodDefault<ZodString> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol: string }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: any; name: string; social_urls?: Record<string, string>; symbol?: string }>; output: ZodObject<extendShape<extendShape<extendShape<{ app_uri: ZodOptional<ZodString>; defaultAdmin: ZodOptional<ZodUnion<[ZodType<..., ..., ...>, ZodType<..., ..., ...>]>>; description: ZodOptional<ZodString>; external_link: ZodOptional<ZodString>; image: ZodOptional<ZodUnion<[ZodUnion<...>, ZodString]>>; name: ZodString; social_urls: ZodOptional<ZodRecord<ZodString, ZodString>> }, { image: ZodOptional<ZodString> }>, { }>, { symbol: ZodDefault<ZodString> }>, "strip", ZodTypeAny, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: string; name: string; social_urls?: Record<string, string>; symbol: string }, { app_uri?: string; defaultAdmin?: string; description?: string; external_link?: string; image?: string; name: string; social_urls?: Record<string, string>; symbol?: string }> }>
let contractRoles: readonly [ "admin", "transfer", "minter", "unwrap", "asset",];