ERC1155
This interface is currently support by the Edition and Edition Drop contracts. You can access all of its functions through an Edition or Edition Drop contract instance.
type ERC1155 struct {
ClaimConditions *EditionDropClaimConditions
}
func (*ERC1155) Balance
func (erc1155 *ERC1155) Balance(ctx context.Context, tokenId int) (int, error)
Get NFT balance
@extension: ERC1155
tokenId: the token ID of a specific token to check the balance of
returns: the number of NFTs of the specified token ID owned by the connected wallet
func (*ERC1155) BalanceOf
func (erc1155 *ERC1155) BalanceOf(ctx context.Context, address string, tokenId int) (int, error)
Get NFT balance of a specific wallet
@extension: ERC1155
address: the address of the wallet to get the NFT balance of
returns: the number of NFTs of the specified token ID owned by the specified wallet
Example
address := "{{wallet_address}}"
tokenId := 0
balance, err := contract.BalanceOf(context.Background(), address, tokenId)
func (*ERC1155) Burn
func (erc1155 *ERC1155) Burn(ctx context.Context, tokenId int, amount int) (*types.Transaction, error)
Burn NFTs
@extension: ERC1155Burnable
tokenId: tokenID of the token to burn
amount: number of NFTs of the token ID to burn
returns: the transaction receipt of the burn
Example
tokenId := 0
amount := 1
tx, err := contract.Burn(context.Background(), tokenId, amount)
func (*ERC1155) Claim
func (erc1155 *ERC1155) Claim(ctx context.Context, tokenId int, quantity int) (*types.Transaction, error)
Claim an NFT
@extension: ERC1155ClaimCustom | ERC1155ClaimPhasesV2 | ERC1155ClaimConditionsV2
tokenId: the token ID of the NFT to claim
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
Example
tokenId = 0
quantity = 1
tx, err := contract.ClaimTo(context.Background(), tokenId, quantity)
func (*ERC1155) ClaimTo
func (erc1155 *ERC1155) ClaimTo(ctx context.Context, destinationAddress string, tokenId int, quantity int) (*types.Transaction, error)
Claim an NFT to a specific wallet
@extension: ERC1155ClaimCustom | ERC1155ClaimPhasesV2 | ERC1155ClaimConditionsV2
tokenId: the token ID of the NFT to claim
destinationAddress: the address of the wallet to claim the NFTs to
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
Example
address = "{{wallet_address}}"
tokenId = 0
quantity = 1
tx, err := contract.ClaimTo(context.Background(), address, tokenId, quantity)
func (*ERC1155) CreateBatch
func (erc1155 *ERC1155) CreateBatch(ctx context.Context, metadatas []*NFTMetadataInput) (*types.Transaction, error)
Lazy mint NFTs
@extension: ERC1155LazyMintableV2
metadatas: a list of the metadatas of the NFTs to create
returns: the transaction receipt of the batch creation
Example
image0, err := os.Open("path/to/image/0.jpg")
defer image0.Close()
image1, err := os.Open("path/to/image/1.jpg")
defer image1.Close()
metadatasWithSupply := []*thirdweb.EditionMetadataInput{
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
Image: image0,
},
Supply: 100,
},
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
Image: image1,
},
Supply: 100,
},
}
tx, err := contract.CreateBatch(context.Background(), metadatasWithSupply)
func (*ERC1155) Get
func (erc1155 *ERC1155) Get(ctx context.Context, tokenId int) (*EditionMetadata, error)
Get an NFT
@extension: ERC1155
tokenId: token ID of the token to get the metadata for
returns: the metadata for the NFT and its supply
Example
nft, err := contract.Get(context.Background(), 0)
supply := nft.Supply
name := nft.Metadata.Name
func (*ERC1155) GetAll
func (erc1155 *ERC1155) GetAll(ctx context.Context) ([]*EditionMetadata, error)
Get all NFTs
@extension: ERC1155
returns: the metadatas and supplies of all the NFTs on this contract
Example
nfts, err := contract.GetAll(context.Background())
supplyOne := nfts[0].Supply
nameOne := nfts[0].Metadata.Name
func (*ERC1155) GetOwned
func (erc1155 *ERC1155) GetOwned(ctx context.Context, address string) ([]*EditionMetadataOwner, error)
Get owned NFTs
@extension: ERC1155Enumerable
address: the address of the owner of the NFTs
returns: the metadatas and supplies of all the NFTs owned by the address
Example
owner := "{{wallet_address}}"
nfts, err := contract.GetOwned(context.Background(), owner)
name := nfts[0].Metadata.Name
func (*ERC1155) GetTotalCount
func (erc1155 *ERC1155) GetTotalCount(ctx context.Context) (int, error)
Get the total number of NFTs
@extension: ERC1155Enumerable
returns: the total number of NFTs on this contract
Example
totalCount, err := contract.GetTotalCount(context.Background())
func (*ERC1155) IsApproved
func (erc1155 *ERC1155) IsApproved(ctx context.Context, owner string, operator string) (bool, error)
Check NFT approval
@extension: ERC1155
address: the address whose assets are to be checked
operator: the address of the operator to check
returns: true if the operator is approved for all operations of the assets, otherwise false
Example
owner := "{{wallet_address}}"
operator := "0x..."
isApproved, err := contract.IsApproved(context.Background, owner, operator)
func (*ERC1155) Mint
func (erc1155 *ERC1155) Mint(ctx context.Context, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint an NFT
@extension: ERC1155Mintable
metadataWithSupply: nft metadata with supply of the NFT to mint
returns: the transaction receipt of the mint
Example
image, err := os.Open("path/to/image.jpg")
defer image.Close()
metadataWithSupply := &thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
Image: image,
},
Supply: 100,
}
tx, err := contract.Mint(context.Background(), metadataWithSupply)
func (*ERC1155) MintAdditionalSupply
func (erc1155 *ERC1155) MintAdditionalSupply(ctx context.Context, tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additionally supply of an NFT
@extension: ERC1155Mintable
tokenId: token ID to mint additional supply of
additionalSupply: additional supply to mint
returns: the transaction receipt of the mint
Example
tokenId := 0
additionalSupply := 100
tx, err := contract.MintAdditionalSupply(context.Background(), tokenId, additionalSupply)
func (*ERC1155) MintAdditionalSupplyTo
func (erc1155 *ERC1155) MintAdditionalSupplyTo(ctx context.Context, to string, tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additional supply of an NFT to a specific wallet
@extension: ERC1155Mintable
to: address of the wallet to mint NFTs to
tokenId: token Id to mint additional supply of
additionalySupply: additional supply to mint
returns: the transaction receipt of the mint
Example
to := "{{wallet_address}}"
tokenId := 0
additionalSupply := 100
tx, err := contract.MintAdditionalSupplyTo(context.Background(), to, tokenId, additionalSupply)
func (*ERC1155) MintBatch
func (erc1155 *ERC1155) MintBatch(ctx context.Context, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Mint many NFTs
@extension: ERC1155BatchMintable
metadatasWithSupply: list of NFT metadatas with supplies to mint
returns: the transaction receipt of the mint
Example
metadatasWithSupply := []*thirdweb.EditionMetadataInput{
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
},
Supply: 100,
},
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
},
Supply: 100,
},
}
tx, err := contract.MintBatch(context.Background(), metadatasWithSupply)
func (*ERC1155) MintBatchTo
func (erc1155 *ERC1155) MintBatchTo(ctx context.Context, to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Mint many NFTs to a specific wallet
@extension: ERC1155BatchMintable
to: address of the wallet to mint NFTs to
metadatasWithSupply: list of NFT metadatas with supplies to mint
returns: the transaction receipt of the mint
Example
metadatasWithSupply := []*thirdweb.EditionMetadataInput{
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
},
Supply: 100,
},
&thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
},
Supply: 100,
},
}
tx, err := contract.MintBatchTo(context.Background(), "{{wallet_address}}", metadatasWithSupply)
func (*ERC1155) MintTo
func (erc1155 *ERC1155) MintTo(ctx context.Context, address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint an NFT to a specific wallet
@extension: ERC1155Mintable
address: the wallet address to mint the NFT to
metadataWithSupply: nft metadata with supply of the NFT to mint
returns: the transaction receipt of the mint
Example
image, err := os.Open("path/to/image.jpg")
defer image.Close()
metadataWithSupply := &thirdweb.EditionMetadataInput{
Metadata: &thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
Image: image,
},
Supply: 100,
}
tx, err := contract.MintTo(context.Background(), "{{wallet_address}}", metadataWithSupply)
func (*ERC1155) SetApprovalForAll
func (erc1155 *ERC1155) SetApprovalForAll(ctx context.Context, operator string, approved bool) (*types.Transaction, error)
Set approval for all NFTs
@extension: ERC1155
address: the address whose assets are to be approved
operator: the address of the operator to set the approval for
approved: true if the operator is approved for all operations of the assets, otherwise false
returns: the transaction receipt of the approval
Example
operator := "{{wallet_address}}"
approved := true
tx, err := contract.SetApprovalForAll(context.Background(), operator, approved)
func (*ERC1155) TotalSupply
func (erc1155 *ERC1155) TotalSupply(ctx context.Context, tokenId int) (int, error)
Get the total supply of an NFT
@extension: ERC1155
tokenId: the token ID to check the total supply of
returns: the supply of NFTs on the specified token ID
Example
tokenId := 0
totalSupply, err := contract.TotalSupply(context.Background, tokenId)
func (*ERC1155) Transfer
func (erc1155 *ERC1155) Transfer(ctx context.Context, to string, tokenId int, amount int) (*types.Transaction, error)
Transfer NFTs
@extension: ERC1155
to: wallet address to transfer the tokens to
tokenId: the token ID of the NFT to transfer
amount: number of NFTs of the token ID to transfer
returns: the transaction of the NFT transfer
Example
to := "0x..."
tokenId := 0
amount := 1
tx, err := contract.Transfer(context.Background(), to, tokenId, amount)