Edition
You can access the Edition interface from the SDK as follows:
import (
"github.com/thirdweb-dev/go-sdk/thirdweb"
)
privateKey = "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
})
contract, err := sdk.GetEdition("{{contract_address}}")
type Edition struct {
*ERC1155
Signature *ERC1155SignatureMinting
Encoder *ContractEncoder
}
func (*Edition) Mint
func (edition *Edition) Mint(metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint an NFT to the connected wallet.
metadataWithSupply: nft metadata with supply of the NFT to mint
returns: the transaction receipt of the mint
func (*Edition) MintAdditionalSupply
func (edition *Edition) MintAdditionalSupply(tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additionaly supply of a token to the connected wallet.
tokenId: token ID to mint additional supply of
additionalSupply: additional supply to mint
returns: the transaction receipt of the mint
func (*Edition) MintAdditionalSupplyTo
func (edition *Edition) MintAdditionalSupplyTo(to string, tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additional supply of a token to the specified wallet.
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
func (*Edition) MintBatch
func (edition *Edition) MintBatch(metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Mint a batch of NFTs to the connected wallet.
metadatasWithSupply: list of NFT metadatas with supplies to mint
returns: the transaction receipt of the mint
func (*Edition) MintBatchTo
func (edition *Edition) MintBatchTo(to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Mint a batch of NFTs to a specific wallet.
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("{{wallet_address}}", metadatasWithSupply)
func (*Edition) MintTo
func (edition *Edition) MintTo(address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint a new NFT to the specified wallet.
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("{{wallet_address}}", metadataWithSupply)