Documentation ¶
Index ¶
- Constants
- type AuctionListing
- type ChainID
- type ChainName
- type ClaimConditionOutput
- type ClaimVerification
- type ContractDeployer
- func (deployer *ContractDeployer) DeployEdition(metadata *DeployEditionMetadata) (string, error)
- func (deployer *ContractDeployer) DeployEditionDrop(metadata *DeployEditionDropMetadata) (string, error)
- func (deployer *ContractDeployer) DeployMarketplace(metadata *DeployMarketplaceMetadata) (string, error)
- func (deployer *ContractDeployer) DeployMultiwrap(metadata *DeployMultiwrapMetadata) (string, error)
- func (deployer *ContractDeployer) DeployNFTCollection(metadata *DeployNFTCollectionMetadata) (string, error)
- func (deployer *ContractDeployer) DeployNFTDrop(metadata *DeployNFTDropMetadata) (string, error)
- func (deployer *ContractDeployer) DeployToken(metadata *DeployTokenMetadata) (string, error)
- type ContractEncoder
- type Currency
- type CurrencyValue
- type DeployEditionDropMetadata
- type DeployEditionMetadata
- type DeployMarketplaceMetadata
- type DeployMultiwrapMetadata
- type DeployNFTCollectionMetadata
- type DeployNFTDropMetadata
- type DeployTokenMetadata
- type DirectListing
- type ERC1155
- func (erc1155 *ERC1155) Balance(tokenId int) (int, error)
- func (erc1155 *ERC1155) BalanceOf(address string, tokenId int) (int, error)
- func (erc1155 *ERC1155) Burn(tokenId int, amount int) (*types.Transaction, error)
- func (erc1155 *ERC1155) Get(tokenId int) (*EditionMetadata, error)
- func (erc1155 *ERC1155) GetAll() ([]*EditionMetadata, error)
- func (erc1155 *ERC1155) GetOwned(address string) ([]*EditionMetadataOwner, error)
- func (erc1155 *ERC1155) GetTotalCount() (int, error)
- func (erc1155 *ERC1155) IsApproved(address string, operator string) (bool, error)
- func (erc1155 *ERC1155) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)
- func (erc1155 *ERC1155) TotalSupply(tokenId int) (int, error)
- func (erc1155 *ERC1155) Transfer(to string, tokenId int, amount int) (*types.Transaction, error)
- type ERC1155SignatureMinting
- func (signature *ERC1155SignatureMinting) Generate(payloadToSign *Signature1155PayloadInput) (*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateBatch(payloadsToSign []*Signature1155PayloadInput) ([]*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateBatchFromTokenIds(payloadsToSign []*Signature1155PayloadInputWithTokenId) ([]*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateFromTokenId(payloadToSign *Signature1155PayloadInputWithTokenId) (*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) Mint(signedPayload *SignedPayload1155) (*types.Transaction, error)
- func (signature *ERC1155SignatureMinting) MintBatch(signedPayloads []*SignedPayload1155) (*types.Transaction, error)
- func (signature *ERC1155SignatureMinting) Verify(signedPayload *SignedPayload1155) (bool, error)
- type ERC20
- func (erc20 *ERC20) Allowance(spender string) (*CurrencyValue, error)
- func (erc20 *ERC20) AllowanceOf(owner string, spender string) (*CurrencyValue, error)
- func (erc20 *ERC20) Balance() (*CurrencyValue, error)
- func (erc20 *ERC20) BalanceOf(address string) (*CurrencyValue, error)
- func (erc20 *ERC20) Burn(amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) BurnFrom(holder string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) Get() (*Currency, error)
- func (erc20 *ERC20) SetAllowance(spender string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) TotalSupply() (*CurrencyValue, error)
- func (erc20 *ERC20) Transfer(to string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) TransferBatch(args []*TokenAmount) (*types.Transaction, error)
- func (erc20 *ERC20) TransferFrom(from string, to string, amount float64) (*types.Transaction, error)
- type ERC721
- func (erc721 *ERC721) Balance() (int, error)
- func (erc721 *ERC721) BalanceOf(address string) (int, error)
- func (erc721 *ERC721) Burn(tokenId int) (*types.Transaction, error)
- func (erc721 *ERC721) Get(tokenId int) (*NFTMetadataOwner, error)
- func (erc721 *ERC721) GetAll() ([]*NFTMetadataOwner, error)
- func (erc721 *ERC721) GetTotalCount() (int, error)
- func (erc721 *ERC721) IsApproved(address string, operator string) (bool, error)
- func (erc721 *ERC721) OwnerOf(tokenId int) (string, error)
- func (erc721 *ERC721) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)
- func (erc721 *ERC721) SetApprovalForToken(operator string, tokenId int) (*types.Transaction, error)
- func (erc721 *ERC721) TotalSupply() (int, error)
- func (erc721 *ERC721) Transfer(to string, tokenId int) (*types.Transaction, error)
- type ERC721SignatureMinting
- func (signature *ERC721SignatureMinting) Generate(payloadToSign *Signature721PayloadInput) (*SignedPayload721, error)
- func (signature *ERC721SignatureMinting) GenerateBatch(payloadsToSign []*Signature721PayloadInput) ([]*SignedPayload721, error)
- func (signature *ERC721SignatureMinting) Mint(signedPayload *SignedPayload721) (*types.Transaction, error)
- func (signature *ERC721SignatureMinting) MintBatch(signedPayloads []*SignedPayload721) (*types.Transaction, error)
- func (signature *ERC721SignatureMinting) Verify(signedPayload *SignedPayload721) (bool, error)
- type Edition
- func (edition *Edition) Mint(metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
- func (edition *Edition) MintAdditionalSupply(tokenId int, additionalSupply int) (*types.Transaction, error)
- func (edition *Edition) MintAdditionalSupplyTo(to string, tokenId int, additionalSupply int) (*types.Transaction, error)
- func (edition *Edition) MintBatch(metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
- func (edition *Edition) MintBatchTo(to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
- func (edition *Edition) MintTo(address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
- type EditionDrop
- type EditionDropClaimConditions
- type EditionMetadata
- type EditionMetadataInput
- type EditionMetadataOwner
- type EditionResult
- type IpfsStorage
- func (ipfs *IpfsStorage) Get(uri string) ([]byte, error)
- func (ipfs *IpfsStorage) Upload(data map[string]interface{}, contractAddress string, signerAddress string) (string, error)
- func (ipfs *IpfsStorage) UploadBatch(data []map[string]interface{}, fileStartNumber int, contractAddress string, ...) (*baseUriWithUris, error)
- type Marketplace
- func (marketplace *Marketplace) BuyoutListing(listingId int, quantityDesired int) (*types.Transaction, error)
- func (marketplace *Marketplace) BuyoutListingTo(listingId int, quantityDesired int, receiver string) (*types.Transaction, error)
- func (marketplace *Marketplace) CancelListing(listingId int) (*types.Transaction, error)
- func (marketplace *Marketplace) CreateListing(listing *NewDirectListing) (int, error)
- func (marketplace *Marketplace) GetActiveListings(filter *MarketplaceFilter) ([]*DirectListing, error)
- func (marketplace *Marketplace) GetAllListings(filter *MarketplaceFilter) ([]*DirectListing, error)
- func (marketplace *Marketplace) GetListing(listingId int) (*DirectListing, error)
- func (marketplace *Marketplace) GetTotalCount() (int, error)
- type MarketplaceEncoder
- func (encoder *MarketplaceEncoder) ApproveBuyoutListing(signerAddress string, listingId int, quantityDesired int, receiver string) (*types.Transaction, error)
- func (encoder *MarketplaceEncoder) ApproveCreateListing(signerAddress string, listing *NewDirectListing) (*types.Transaction, error)
- func (encoder *MarketplaceEncoder) BuyoutListing(signerAddress string, listingId int, quantityDesired int, receiver string) (*types.Transaction, error)
- func (encoder *MarketplaceEncoder) CancelListing(signerAddress string, listingId int) (*types.Transaction, error)
- func (encoder *MarketplaceEncoder) CreateListing(signerAddress string, listing *NewDirectListing) (*types.Transaction, error)
- type MarketplaceFilter
- type Metadata
- type Multiwrap
- func (multiwrap *Multiwrap) GetWrappedContents(wrappedTokenId int) (*MultiwrapBundle, error)
- func (multiwrap *Multiwrap) Unwrap(wrappedTokenId int, recipientAddress string) (*types.Transaction, error)
- func (multiwrap *Multiwrap) Wrap(contents *MultiwrapBundle, wrappedTokenMetadata interface{}, ...) (*types.Transaction, error)
- type MultiwrapBundle
- type MultiwrapERC1155
- type MultiwrapERC20
- type MultiwrapERC721
- type NFTCollection
- func (nft *NFTCollection) GetOwned(address string) ([]*NFTMetadataOwner, error)
- func (nft *NFTCollection) GetOwnedTokenIDs(address string) ([]*big.Int, error)
- func (nft *NFTCollection) Mint(metadata *NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintBatchTo(address string, metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintTo(address string, metadata *NFTMetadataInput) (*types.Transaction, error)
- type NFTDrop
- func (drop *NFTDrop) Claim(quantity int) (*types.Transaction, error)
- func (drop *NFTDrop) ClaimTo(destinationAddress string, quantity int) (*types.Transaction, error)
- func (drop *NFTDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (drop *NFTDrop) GetAllClaimed() ([]*NFTMetadataOwner, error)
- func (drop *NFTDrop) GetAllUnclaimed() ([]*NFTMetadata, error)
- func (nft *NFTDrop) GetOwned(address string) ([]*NFTMetadataOwner, error)
- func (nft *NFTDrop) GetOwnedTokenIDs(address string) ([]*big.Int, error)
- type NFTDropClaimConditions
- type NFTDropEncoder
- type NFTMetadata
- type NFTMetadataInput
- type NFTMetadataOwner
- type NFTResult
- type NativeToken
- type NewDirectListing
- type ProviderHandler
- func (handler *ProviderHandler) GetChainID() (*big.Int, error)
- func (handler *ProviderHandler) GetPrivateKey() *ecdsa.PrivateKey
- func (handler *ProviderHandler) GetProvider() *ethclient.Client
- func (handler *ProviderHandler) GetRawPrivateKey() string
- func (handler *ProviderHandler) GetSignerAddress() common.Address
- func (handler *ProviderHandler) UpdatePrivateKey(privateKey string) error
- func (handler *ProviderHandler) UpdateProvider(provider *ethclient.Client)
- type SDKOptions
- type Signature1155PayloadInput
- type Signature1155PayloadInputWithTokenId
- type Signature1155PayloadOutput
- type Signature721PayloadInput
- type Signature721PayloadOutput
- type SignedPayload1155
- type SignedPayload721
- type SmartContract
- type ThirdwebSDK
- func (sdk *ThirdwebSDK) GetContract(address string) (*SmartContract, error)
- func (sdk *ThirdwebSDK) GetContractFromAbi(address string, abi string) (*SmartContract, error)
- func (sdk *ThirdwebSDK) GetEdition(address string) (*Edition, error)
- func (sdk *ThirdwebSDK) GetEditionDrop(address string) (*EditionDrop, error)
- func (sdk *ThirdwebSDK) GetMarketplace(address string) (*Marketplace, error)
- func (sdk *ThirdwebSDK) GetMultiwrap(address string) (*Multiwrap, error)
- func (sdk *ThirdwebSDK) GetNFTCollection(address string) (*NFTCollection, error)
- func (sdk *ThirdwebSDK) GetNFTDrop(address string) (*NFTDrop, error)
- func (sdk *ThirdwebSDK) GetToken(address string) (*Token, error)
- type Token
- func (token *Token) DelegateTo(delegatreeAddress string) (*types.Transaction, error)
- func (token *Token) GetDelegation() (string, error)
- func (token *Token) GetDelegationOf(address string) (string, error)
- func (token *Token) GetVoteBalance() (*CurrencyValue, error)
- func (token *Token) GetVoteBalanceOf(address string) (*CurrencyValue, error)
- func (token *Token) Mint(amount float64) (*types.Transaction, error)
- func (token *Token) MintBatchTo(args []*TokenAmount) (*types.Transaction, error)
- func (token *Token) MintTo(to string, amount float64) (*types.Transaction, error)
- type TokenAmount
- type WalletAuthenticationOptions
- type WalletAuthenticationPayloadData
- type WalletAuthenticator
- func (auth *WalletAuthenticator) Authenticate(domain string, token string) (string, error)
- func (auth *WalletAuthenticator) GenerateAuthToken(domain string, payload *WalletLoginPayload, ...) (string, error)
- func (auth *WalletAuthenticator) Login(domain string, options *WalletLoginOptions) (*WalletLoginPayload, error)
- func (auth *WalletAuthenticator) Verify(domain string, payload *WalletLoginPayload, options *WalletVerifyOptions) (string, error)
- type WalletLoginOptions
- type WalletLoginPayload
- type WalletLoginPayloadData
- type WalletVerifyOptions
- type WrappedToken
Constants ¶
const ( MAINNET ChainID = 1 RINKEBY = 4 GOERLI = 5 POLYGON = 137 FANTOM = 250 FANTOM_TESTNET = 4002 AVALANCHE_TESTNET = 43113 AVALANCHE = 43114 MUMBAI = 80001 OPTIMISM = 10 OPTIMISM_TESTNET = 69 ARBITRUM = 42161 ARBITRUM_TESTNET = 421611 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuctionListing ¶ added in v1.2.6
type AuctionListing struct { Id string AssetContractAddress string TokenId int Asset *NFTMetadata StartTimeInEpochSeconds int EndTimeInEpochSeconds int Quantity int CurrencyContractAddress string ReservePrice string BuyoutPrice string BuyoutCurrencyValuePerToken *CurrencyValue ReservePriceCurrencyValuePerToken *CurrencyValue SellerAddress string }
type ClaimConditionOutput ¶
type ClaimVerification ¶
type ClaimVerification struct {
// contains filtered or unexported fields
}
type ContractDeployer ¶ added in v1.2.4
type ContractDeployer struct { *ProviderHandler // contains filtered or unexported fields }
The contract deployer lets you deploy new contracts to the blockchain using just the thirdweb SDK. You can access the contract deployer interface as follows:
import ( "github.com/thirdweb-dev/go-sdk/thirdweb" ) privateKey = "..." sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{ PrivateKey: privateKey, }) // Now you can deploy a contract address, err := sdk.Deployer.DeployNFTCollection( &thirdweb.DeployNFTCollectionMetadata{ Name: "Go NFT", } })
func (*ContractDeployer) DeployEdition ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployEdition(metadata *DeployEditionMetadata) (string, error)
Deploy a new Edition contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployEdition( &thirdweb.DeployEditionMetadata{ Name: "Go Edition", } })
func (*ContractDeployer) DeployEditionDrop ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployEditionDrop(metadata *DeployEditionDropMetadata) (string, error)
Deploy a new Edition Drop contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployEditionDrop( &thirdweb.DeployEditionDropMetadata{ Name: "Go Edition Drop", } })
func (*ContractDeployer) DeployMarketplace ¶ added in v1.2.6
func (deployer *ContractDeployer) DeployMarketplace(metadata *DeployMarketplaceMetadata) (string, error)
Deploy a new Marketplace contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployMarketplace( &thirdweb.DeployMarketplaceMetadata{ Name: "Go Marketplace", } })
func (*ContractDeployer) DeployMultiwrap ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployMultiwrap(metadata *DeployMultiwrapMetadata) (string, error)
Deploy a new Multiwrap contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployMultiwrap( &thirdweb.DeployMultiwrapMetadata{ Name: "Go Multiwrap", } })
func (*ContractDeployer) DeployNFTCollection ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployNFTCollection(metadata *DeployNFTCollectionMetadata) (string, error)
Deploy a new NFT Collection contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployNFTCollection( &thirdweb.DeployNFTCollectionMetadata{ Name: "Go NFT", } })
func (*ContractDeployer) DeployNFTDrop ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployNFTDrop(metadata *DeployNFTDropMetadata) (string, error)
Deploy a new NFT Drop contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployNFTDrop( &thirdweb.DeployNFTDropMetadata{ Name: "Go NFT Drop", } })
func (*ContractDeployer) DeployToken ¶ added in v1.2.4
func (deployer *ContractDeployer) DeployToken(metadata *DeployTokenMetadata) (string, error)
Deploy a new Token contract.
metadata: the contract metadata
returns: the address of the deployed contract
Example
address, err := sdk.Deployer.DeployToken( &thirdweb.DeployTokenMetadata{ Name: "Go Token", } })
type ContractEncoder ¶ added in v1.2.6
type ContractEncoder struct {
// contains filtered or unexported fields
}
This interface is currently supported by all contract encoder classes and provides a generic method to encode write function calls.
func (*ContractEncoder) Encode ¶ added in v1.2.6
func (encoder *ContractEncoder) Encode(signerAddress string, method string, args ...interface{}) (*types.Transaction, error)
Get the unsigned transaction data for any contract call on a contract.
signerAddress: the address expected to sign this transaction
method: the name of the contract function to encode transaction data for
args: the arguments to pass to the contract function.
returns: the encoded transaction data for the transaction.
Example
toAddress := "0x..." amount := 1 // Now you can get the transaction data for the contract call. tx, err := contract.Encoder.Encode("transfer", toAddress, amount) fmt.Println(tx.Data()) // Now you can access all transaction data, like the following fields fmt.Println(tx.Nonce()) fmt.Println(tx.Value())
type CurrencyValue ¶
type DeployEditionDropMetadata ¶ added in v1.2.4
type DeployEditionDropMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"` FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"` Merkle interface{} `mapstructure:"merkle" json:"merkle"` Symbol string `mapstructure:"symbol" json:"symbol"` PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployEditionMetadata ¶ added in v1.2.4
type DeployEditionMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"` FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"` Symbol string `mapstructure:"symbol" json:"symbol"` PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployMarketplaceMetadata ¶ added in v1.2.6
type DeployMarketplaceMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployMultiwrapMetadata ¶ added in v1.2.4
type DeployMultiwrapMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"` FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"` Symbol string `mapstructure:"symbol" json:"symbol"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployNFTCollectionMetadata ¶ added in v1.2.4
type DeployNFTCollectionMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"` FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"` Symbol string `mapstructure:"symbol" json:"symbol"` PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployNFTDropMetadata ¶ added in v1.2.4
type DeployNFTDropMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` SellerFeeBasisPoints int `mapstructure:"seller_fee_basis_points" json:"seller_fee_basis_points"` FeeRecipient string `mapstructure:"fee_recipient" json:"fee_recipient"` Merkle interface{} `mapstructure:"merkle" json:"merkle"` Symbol string `mapstructure:"symbol" json:"symbol"` PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DeployTokenMetadata ¶ added in v1.2.4
type DeployTokenMetadata struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalLink string `mapstructure:"external_link" json:"external_link"` Symbol string `mapstructure:"symbol" json:"symbol"` PrimarySaleRecipient string `mapstructure:"primary_sale_recipient" json:"primary_sale_recipient"` PlatformFeeBasisPoints int `mapstructure:"platform_fee_basis_points" json:"platform_fee_basis_points"` PlatformFeeRecipient string `mapstructure:"platform_fee_recipient" json:"platform_fee_recipient"` TrustedForwarders []string `mapstructure:"trusted_forwarders,omitempty" json:"trusted_forwarders"` }
type DirectListing ¶ added in v1.2.6
type ERC1155 ¶
type ERC1155 struct {
// contains filtered or unexported fields
}
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.
func (*ERC1155) Balance ¶
Get the NFT balance of the connected wallet for a specific token ID.
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 ¶
Get the NFT balance of a specific wallet.
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(address, tokenId)
func (*ERC1155) Burn ¶
Burn an amount of a specified NFT from the connected wallet.
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(tokenId, amount)
func (*ERC1155) Get ¶
func (erc1155 *ERC1155) Get(tokenId int) (*EditionMetadata, error)
Get metadata for a token.
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(0) supply := nft.Supply name := nft.Metadata.Name
func (*ERC1155) GetAll ¶
func (erc1155 *ERC1155) GetAll() ([]*EditionMetadata, error)
Get the metadata of all the NFTs on this contract.
returns: the metadatas and supplies of all the NFTs on this contract
Example
nfts, err := contract.GetAll() supplyOne := nfts[0].Supply nameOne := nfts[0].Metadata.Name
func (*ERC1155) GetOwned ¶
func (erc1155 *ERC1155) GetOwned(address string) ([]*EditionMetadataOwner, error)
Get the metadatas of all the NFTs owned by a specific address.
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(owner) name := nfts[0].Metadata.Name
func (*ERC1155) GetTotalCount ¶
Get the total number of NFTs on this contract.
returns: the total number of NFTs on this contract
func (*ERC1155) IsApproved ¶
Check whether an operator address is approved for all operations of a specifc addresses assets.
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
func (*ERC1155) SetApprovalForAll ¶
func (erc1155 *ERC1155) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)
Set the approval for all operations of a specific address's assets.
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
func (*ERC1155) TotalSupply ¶
Get the total number of NFTs of a specific token ID.
tokenId: the token ID to check the total supply of
returns: the supply of NFTs on the specified token ID
func (*ERC1155) Transfer ¶
Transfer a specific quantity of a token ID from the connected wallet to a specified address.
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(to, tokenId, amount)
type ERC1155SignatureMinting ¶ added in v1.2.1
type ERC1155SignatureMinting struct {
// contains filtered or unexported fields
}
You can access this interface from the edition contract under the signature interface
func (*ERC1155SignatureMinting) Generate ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) Generate(payloadToSign *Signature1155PayloadInput) (*SignedPayload1155, error)
Generate a payload to mint a new token ID
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &thirdweb.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", // address to mint to Price: 0, // cost of minting CurrencyAddress: "0x0000000000000000000000000000000000000000", // currency to pay in order to mint MintStartTime: 0, // time where minting is allowed to start (epoch seconds) MintEndTime: 100000000000000, // time when this signature expires (epoch seconds) PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", // address to receive the primary sales of this mint Metadata: &thirdweb.NFTMetadataInput{ // metadata of the NFT to mint Name: "ERC721 Sigmint!", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", // address to receive royalties of this mint RoyaltyBps: 0, // royalty cut of this mint in basis points Quantity: 1, // number of tokens to mint } signedPayload, err := contract.Signature.Generate(payload)
func (*ERC1155SignatureMinting) GenerateBatch ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) GenerateBatch(payloadsToSign []*Signature1155PayloadInput) ([]*SignedPayload1155, error)
Generate a batch of payloads to mint multiple new token IDs
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*thirdweb.Signature1155PayloadInput{ &thirdweb.Signature1155PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &thirdweb.NFTMetadataInput{ Name: "ERC1155 Sigmint 1", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, }, &thirdweb.Signature1155PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &thirdweb.NFTMetadataInput{ Name: "ERC1155 Sigmint 2", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, }, } signedPayload, err := contract.Signature.GenerateBatch(payload)
func (*ERC1155SignatureMinting) GenerateBatchFromTokenIds ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) GenerateBatchFromTokenIds(payloadsToSign []*Signature1155PayloadInputWithTokenId) ([]*SignedPayload1155, error)
Generate a batch of payloads to mint multiple new token IDs
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*thirdweb.Signature1155PayloadInputWithTokenId{ &thirdweb.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &thirdweb.NFTMetadataInput{ Name: "ERC1155 Sigmint 1", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 0, }, &thirdweb.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: nil RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 1, }, } signedPayload, err := contract.Signature.GenerateBatchFromTokenIds(payload)
func (*ERC1155SignatureMinting) GenerateFromTokenId ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) GenerateFromTokenId(payloadToSign *Signature1155PayloadInputWithTokenId) (*SignedPayload1155, error)
Generate a new payload to mint additionaly supply to an existing token ID
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &thirdweb.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: nil, // we don't need to pass NFT metadata since we are minting an existing token RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 0, // now we need to specify the token ID to mint supply to } signedPayload, err := contract.Signature.GenerateFromTokenId(payload)
func (*ERC1155SignatureMinting) Mint ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) Mint(signedPayload *SignedPayload1155) (*types.Transaction, error)
Mint a token with the data in given payload.
signedPayload: the payload signed by the minters private key being used to mint
returns: the transaction receipt of the mint
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) tx, err := contract.Signature.Mint(signedPayload)
func (*ERC1155SignatureMinting) MintBatch ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) MintBatch(signedPayloads []*SignedPayload1155) (*types.Transaction, error)
Mint a batch of token with the data in given payload.
signedPayload: the list of payloads signed by the minters private key being used to mint
returns: the transaction receipt of the batch mint
Example
// Learn more about how to craft multiple payloads in the GenerateBatch() function signedPayloads, err := contract.Signature.GenerateBatch(payloads) tx, err := contract.Signature.MintBatch(signedPayloads)
func (*ERC1155SignatureMinting) Verify ¶ added in v1.2.1
func (signature *ERC1155SignatureMinting) Verify(signedPayload *SignedPayload1155) (bool, error)
Verify that a signed payload is valid
signedPayload: the payload to verify
returns: true if the payload is valid, otherwise false.
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) isValid, err := contract.Signature.Verify(signedPayload)
type ERC20 ¶
type ERC20 struct {
// contains filtered or unexported fields
}
This interface is currently support by the Token contract. You can access all of its functions through a Token contract instance.
func (*ERC20) Allowance ¶
func (erc20 *ERC20) Allowance(spender string) (*CurrencyValue, error)
Get a specified spenders allowance for the connected wallets tokens.
spender: wallet address to check the allowance of
returns: allowance of the spender for the connected wallets tokens
Example
spender := "0x..." allowance, err := contract.Allowance(spender) allowanceValue := allowance.DisplayValue
func (*ERC20) AllowanceOf ¶
func (erc20 *ERC20) AllowanceOf(owner string, spender string) (*CurrencyValue, error)
Get a specified spenders allowance for the a specific wallets tokens.
owner: wallet address who owns the assets
spender: wallet address to check the allowance of
returns: allowance of the spender for the connected wallets tokens
Example
address := "{{wallet_address}}" spender := "0x..." allowance, err := contract.AllowanceOf(address, spender) allowanceValue := allowance.DisplayValue
func (*ERC20) Balance ¶
func (erc20 *ERC20) Balance() (*CurrencyValue, error)
Get the token balance of the connected wallet.
returns: balance of the connected wallet
Example
balance, err := contract.Balance() balanceValue := balance.DisplayValue
func (*ERC20) BalanceOf ¶
func (erc20 *ERC20) BalanceOf(address string) (*CurrencyValue, error)
Get the balance of the specified wallet.
address: wallet address to check the balance of
returns: balance of the specified wallet
Example
address := "{{wallet_address}}" balance, err := contract.BalanceOf() balanceValue := balance.DisplayValue
func (*ERC20) Burn ¶
func (erc20 *ERC20) Burn(amount float64) (*types.Transaction, error)
Burn a specified amount of tokens from the connected wallet.
amount: amount of tokens to burn
returns: transaction receipt of the burn
Example
amount := 1 tx, err := contract.Burn(amount)
func (*ERC20) BurnFrom ¶
Burn a specified amount of tokens from a specific wallet.
holder: wallet address to burn the tokens from
amount: amount of tokens to burn
returns: transaction receipt of the burn
Example
holder := "0x..." amount := 1 tx, err := contract.BurnFrom(holder, amount)
func (*ERC20) Get ¶
Get token metadata including name, symbol, decimals, etc.
returns: the metadata for the token
Example
currency, err := contract.Get() symbol := currency.Symbol
func (*ERC20) SetAllowance ¶
Sets the allowance of a wallet to spend the connected wallets funds.
spender: wallet address to set the allowance of
amount: amount of tokens to grant the spender allowance of
returns: transaction receipt of the allowance set
Example
spender := "0x..." amount := 1 tx, err := contract.SetAllowance(spender, amount)
func (*ERC20) TotalSupply ¶
func (erc20 *ERC20) TotalSupply() (*CurrencyValue, error)
Get the total minted supply of the token.
returns: total minted supply of the token
func (*ERC20) Transfer ¶
Transfer a specified amount of tokens from the connected wallet to a specified address.
to: address to transfer the tokens to
amount: amount of tokens to transfer
returns: transaction receipt of the transfer
Example
to := "0x..." amount := 1 tx, err := contract.Transfer(to, amount)
func (*ERC20) TransferBatch ¶
func (erc20 *ERC20) TransferBatch(args []*TokenAmount) (*types.Transaction, error)
Transfer tokens from the connected wallet to many wallets.
args: list of token amounts with amounts and addresses to transfer to
returns: transaction receipt of the transfers
Example
args = []*thirdweb.TokenAmount{ &thirdweb.TokenAmount{ ToAddress: "0x...", Amount: 1 } &thirdweb.TokenAmount{ ToAddress: "0x...", Amount: 2 } } tx, err := contract.TransferBatch(args)
func (*ERC20) TransferFrom ¶
func (erc20 *ERC20) TransferFrom(from string, to string, amount float64) (*types.Transaction, error)
Transfer a specified amount of tokens from one specified address to another.
from: address to transfer the tokens from
to: address to transfer the tokens to
amount: amount of tokens to transfer
returns: transaction receipt of the transfer
Example
from := "{{wallet_address}}" to := "0x..." amount := 1 tx, err := contract.TransferFrom(from, to, amount)
type ERC721 ¶
type ERC721 struct {
// contains filtered or unexported fields
}
This interface is currently support by the NFT Collection and NFT Drop contracts. You can access all of its functions through an NFT Collection or NFT Drop contract instance.
func (*ERC721) Balance ¶
Get the NFT balance of the connected wallet.
returns: the number of NFTs on this contract owned by the connected wallet
func (*ERC721) BalanceOf ¶
Get the NFT balance of a specific wallet.
address: the address of the wallet to get the NFT balance of
returns: the number of NFTs on this contract owned by the specified wallet
Example
address := "{{wallet_address}}" balance, err := contract.BalanceOf(address)
func (*ERC721) Burn ¶
func (erc721 *ERC721) Burn(tokenId int) (*types.Transaction, error)
Burn a specified NFT from the connected wallet.
tokenId: tokenID of the token to burn
returns: the transaction receipt of the burn
Example
tokenId := 0 tx, err := contract.Burn(tokenId)
func (*ERC721) Get ¶
func (erc721 *ERC721) Get(tokenId int) (*NFTMetadataOwner, error)
Get metadata for a token.
tokenId: token ID of the token to get the metadata for
returns: the metadata for the NFT and its owner
Example
nft, err := contract.Get(0) owner := nft.Owner name := nft.Metadata.Name
func (*ERC721) GetAll ¶
func (erc721 *ERC721) GetAll() ([]*NFTMetadataOwner, error)
Get the metadata of all the NFTs on this contract.
returns: the metadata of all the NFTs on this contract
Example
nfts, err := contract.GetAll() ownerOne := nfts[0].Owner nameOne := nfts[0].Metadata.Name
func (*ERC721) GetTotalCount ¶
Get the total number of NFTs on this contract.
returns: the total number of NFTs on this contract
func (*ERC721) IsApproved ¶
Check whether an operator address is approved for all operations of a specifc addresses assets.
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
func (*ERC721) OwnerOf ¶
Get the owner of an NFT.
tokenId: the token ID of the NFT to get the owner of
returns: the owner of the NFT
func (*ERC721) SetApprovalForAll ¶
Set the approval for all operations of a specific address's assets.
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
func (*ERC721) SetApprovalForToken ¶ added in v1.2.2
Approve an operator for the NFT owner, which allows the operator to call transferFrom or safeTransferFrom for the specified token.
operator: the address of the operator to approve
tokenId: the token ID of the NFT to approve
returns: the transaction receipt of the approval
func (*ERC721) TotalSupply ¶
Get the total number of NFTs on this contract.
returns: the supply of NFTs on this contract
func (*ERC721) Transfer ¶
Transfer a specified token from the connected wallet to a specified address.
to: wallet address to transfer the tokens to
tokenId: the token ID of the NFT to transfer
returns: the transaction of the NFT transfer
Example
to := "0x..." tokenId := 0 tx, err := contract.Transfer(to, tokenId)
type ERC721SignatureMinting ¶ added in v1.2.1
type ERC721SignatureMinting struct {
// contains filtered or unexported fields
}
You can access this interface from the NFT Collection contract under the signature interface.
func (*ERC721SignatureMinting) Generate ¶ added in v1.2.1
func (signature *ERC721SignatureMinting) Generate(payloadToSign *Signature721PayloadInput) (*SignedPayload721, error)
Generate a new payload from the given data
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &thirdweb.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", // address to mint to Price: 0, // cost of minting CurrencyAddress: "0x0000000000000000000000000000000000000000", // currency to pay in order to mint MintStartTime: 0, // time where minting is allowed to start (epoch seconds) MintEndTime: 100000000000000, // time when this signature expires (epoch seconds) PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", // address to receive the primary sales of this mint Metadata: &thirdweb.NFTMetadataInput{ // metadata of the NFT to mint Name: "ERC721 Sigmint!", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", // address to receive royalties of this mint RoyaltyBps: 0, // royalty cut of this mint in basis points } signedPayload, err := contract.Signature.Generate(payload)
func (*ERC721SignatureMinting) GenerateBatch ¶ added in v1.2.1
func (signature *ERC721SignatureMinting) GenerateBatch(payloadsToSign []*Signature721PayloadInput) ([]*SignedPayload721, error)
Generate a batch of new payload from the given data
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*thirdweb.Signature721PayloadInput{ &thirdweb.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &thirdweb.NFTMetadataInput{ Name: "ERC721 Sigmint!", Image: imageFile, }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, }, &thirdweb.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &thirdweb.NFTMetadataInput{ Name: "ERC721 Sigmint!", Image: imageFile, }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, }, } signedPayload, err := contract.Signature.GenerateBatch(payload)
func (*ERC721SignatureMinting) Mint ¶ added in v1.2.1
func (signature *ERC721SignatureMinting) Mint(signedPayload *SignedPayload721) (*types.Transaction, error)
Mint a token with the data in given payload.
signedPayload: the payload signed by the minters private key being used to mint
returns: the transaction receipt of the mint
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) tx, err := contract.Signature.Mint(signedPayload)
func (*ERC721SignatureMinting) MintBatch ¶ added in v1.2.1
func (signature *ERC721SignatureMinting) MintBatch(signedPayloads []*SignedPayload721) (*types.Transaction, error)
Mint a batch of token with the data in given payload.
signedPayload: the list of payloads signed by the minters private key being used to mint
returns: the transaction receipt of the batch mint
Example
// Learn more about how to craft multiple payloads in the GenerateBatch() function signedPayloads, err := contract.Signature.GenerateBatch(payloads) tx, err := contract.Signature.MintBatch(signedPayloads)
func (*ERC721SignatureMinting) Verify ¶ added in v1.2.1
func (signature *ERC721SignatureMinting) Verify(signedPayload *SignedPayload721) (bool, error)
Verify that a signed payload is valid
signedPayload: the payload to verify
returns: true if the payload is valid, otherwise false.
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) isValid, err := contract.Signature.Verify(signedPayload)
type Edition ¶
type Edition struct { *ERC1155 Signature *ERC1155SignatureMinting Encoder *ContractEncoder // contains filtered or unexported fields }
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}}")
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 ¶ added in v1.2.6
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)
type EditionDrop ¶
type EditionDrop struct { *ERC1155 ClaimConditions *EditionDropClaimConditions Encoder *ContractEncoder // contains filtered or unexported fields }
You can access the Edition Drop 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.GetEditionDrop("{{contract_address}}")
func (*EditionDrop) Claim ¶
func (drop *EditionDrop) Claim(tokenId int, quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
tokenId: the token ID of the NFT to claim
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
func (*EditionDrop) ClaimTo ¶
func (drop *EditionDrop) ClaimTo(destinationAddress string, tokenId int, quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
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(address, tokenId, quantity)
func (*EditionDrop) CreateBatch ¶
func (drop *EditionDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Create a batch of NFTs on this contract.
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.MintBatchTo("{{wallet_address}}", metadatasWithSupply)
type EditionDropClaimConditions ¶ added in v1.2.12
type EditionDropClaimConditions struct {
// contains filtered or unexported fields
}
This interface is currently accessible from the Edition Drop contract contract type via the ClaimConditions property.
func (*EditionDropClaimConditions) GetActive ¶ added in v1.2.12
func (claim *EditionDropClaimConditions) GetActive(tokenId int) (*ClaimConditionOutput, error)
Get the currently active claim condition for a given token
tokenId: the token ID of the token to get the active claim condition for
returns: the currently active claim condition metadata
Example
tokenId := 0 condition, err := contract.ClaimConditions.GetActive(tokenId) // Now you have access to all the claim condition metadata fmt.Println("Start Time:", condition.StartTime) fmt.Println("Available:", condition.AvailableSupply) fmt.Println("Quantity:", condition.MaxQuantity) fmt.Println("Quantity Limit:", condition.QuantityLimitPerTransaction) fmt.Println("Price:", condition.Price) fmt.Println("Wait In Seconds", condition.WaitInSeconds)
func (*EditionDropClaimConditions) GetAll ¶ added in v1.2.12
func (claim *EditionDropClaimConditions) GetAll(tokenId int) ([]*ClaimConditionOutput, error)
Get all claim conditions on this contract for a given token
tokenId: the token ID of the token to get the claim conditions for
returns: the metadata for all the claim conditions on this contract
Example
tokenId := 0 conditions, err := contract.ClaimConditions.GetAll(tokenId) // Now you have access to all the claim condition metadata condition := conditions[0] fmt.Println("Start Time:", condition.StartTime) fmt.Println("Available:", condition.AvailableSupply) fmt.Println("Quantity:", condition.MaxQuantity) fmt.Println("Quantity Limit:", condition.QuantityLimitPerTransaction) fmt.Println("Price:", condition.Price) fmt.Println("Wait In Seconds", condition.WaitInSeconds)
type EditionMetadata ¶
type EditionMetadata struct { Metadata *NFTMetadata Supply int }
type EditionMetadataInput ¶
type EditionMetadataInput struct { Metadata *NFTMetadataInput Supply int }
type EditionMetadataOwner ¶
type EditionMetadataOwner struct { Metadata *NFTMetadata Supply int Owner string QuantityOwned int }
type EditionResult ¶
type EditionResult struct {
// contains filtered or unexported fields
}
type IpfsStorage ¶
type IpfsStorage struct {
GatewayUrl string
}
func (*IpfsStorage) Get ¶
func (ipfs *IpfsStorage) Get(uri string) ([]byte, error)
Get
Get IPFS data at a given hash and return it as byte data ¶
uri: the IPFS URI to fetch data from
returns: byte data of the IPFS data at the URI
func (*IpfsStorage) Upload ¶
func (ipfs *IpfsStorage) Upload(data map[string]interface{}, contractAddress string, signerAddress string) (string, error)
Upload
Upload method can be used to upload a generic payload to IPFS.
data: the individual data to upload to IPFS
contractAddress: the optional contractAddress upload is being called from
signerAddress: the optional signerAddress upload is being called from
returns: the URI of the IPFS upload
func (*IpfsStorage) UploadBatch ¶
func (ipfs *IpfsStorage) UploadBatch(data []map[string]interface{}, fileStartNumber int, contractAddress string, signerAddress string) (*baseUriWithUris, error)
UploadBatch
UploadBatch method can be used to upload a batch of generic payloads to IPFS.
data: the array of data to upload to IPFS
contractAddress: the optional contractAddress upload is being called from
signerAddress: the optional signerAddress upload is being called from
returns: the base URI of the IPFS upload folder with the URIs of each subfile
type Marketplace ¶ added in v1.2.6
type Marketplace struct { Encoder *MarketplaceEncoder // contains filtered or unexported fields }
You can access the Marketplace 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.GetMarketplace("{{contract_address}}")
func (*Marketplace) BuyoutListing ¶ added in v1.2.6
func (marketplace *Marketplace) BuyoutListing(listingId int, quantityDesired int) (*types.Transaction, error)
Buy a specific listing from the marketplace.
listingId: listing ID of the asset you want to buy
quantityDesired: the quantity of the asset to buy from the listing
returns: transaction receipt of the purchase
func (*Marketplace) BuyoutListingTo ¶ added in v1.2.6
func (marketplace *Marketplace) BuyoutListingTo(listingId int, quantityDesired int, receiver string) (*types.Transaction, error)
Buy a specific listing from the marketplace to a specific address.
listingId: listing ID of the asset you want to buy
quantityDesired: the quantity of the asset to buy from the listing
receiver: specific address to receive the assets from the listing
returns: transaction receipt of the purchase
Example
listingId := 0 quantityDesired := 1 receiver := "0x..." receipt, err := marketplace.BuyoutListingTo(listingId, quantityDesired, receiver)
func (*Marketplace) CancelListing ¶ added in v1.2.6
func (marketplace *Marketplace) CancelListing(listingId int) (*types.Transaction, error)
Cancel a listing on the marketplace.
listingId: listing ID to cancel
returns: transaction receipt of the cancellation
Example
listingId := 0 receipt, err := marketplace.CancelListing(listingId)
func (*Marketplace) CreateListing ¶ added in v1.2.6
func (marketplace *Marketplace) CreateListing(listing *NewDirectListing) (int, error)
Create a new listing on the marketplace where people can buy an asset directly.
listing: the data for the listing to create
returns: the ID of the listing that was created
Example
listing := &NewDirectListing{ AssetContractAddress: "0x...", // Address of the asset contract TokenId: 0, // Token ID of the asset to list StartTimeInEpochSeconds: int(time.Now().Unix()), // Defaults to current time ListingDurationInSeconds: int(time.Now().Unix() + 3600), // Defaults to current time + 1 hour Quantity: 1, // Quantity of the asset to list CurrencyContractAddress: "0x...", // Contract address of currency to sell for, defaults to native token BuyoutPricePerToken: 1, // Price per token of the asset to list } listingId, err := marketplace.CreateListing(listing)
func (*Marketplace) GetActiveListings ¶ added in v1.2.6
func (marketplace *Marketplace) GetActiveListings(filter *MarketplaceFilter) ([]*DirectListing, error)
Get all active listings from the marketplace.
filter: optional filter parameters
returns: all active listings in the marketplace
Example
listings, err := marketplace.GetActiveListings() // Price per token of the first listing listings[0].BuyoutCurrencyValuePerToken.DisplayValue
func (*Marketplace) GetAllListings ¶ added in v1.2.6
func (marketplace *Marketplace) GetAllListings(filter *MarketplaceFilter) ([]*DirectListing, error)
Get all the listings from the marketplace.
filter: optional filter parameters
returns: all listings in the marketplace
Example
listings, err := marketplace.GetAllListings() // Price per token of the first listing listings[0].BuyoutCurrencyValuePerToken.DisplayValue
func (*Marketplace) GetListing ¶ added in v1.2.6
func (marketplace *Marketplace) GetListing(listingId int) (*DirectListing, error)
Get a single listing from the marketplace.
listingId: listing ID to get
returns: listing at the given listing ID
Example
listingId := 0 listing, err := marketplace.GetListing(listingId)
func (*Marketplace) GetTotalCount ¶ added in v1.2.6
func (marketplace *Marketplace) GetTotalCount() (int, error)
Get the total number of listings in the marketplace.
returns: total number of listings in the marketplace
type MarketplaceEncoder ¶ added in v1.2.6
type MarketplaceEncoder struct { *ContractEncoder // contains filtered or unexported fields }
The marketplace encoder class is used to get the unsigned transaction data for marketplace contract contract calls that can be signed at a later time after generation.
It can be accessed from the SDK through the `Encoder` namespace of the marketplace contract:
You can access the Marketplace interface from the SDK as follows:
import ( "github.com/thirdweb-dev/go-sdk/thirdweb" ) privateKey = "..." sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{ PrivateKey: privateKey, }) marketplace, err := sdk.GetMarketplace("{{contract_address}}") // Now the encoder can be accessed from the contract marketplace.Encoder.CreateListing(...)
func (*MarketplaceEncoder) ApproveBuyoutListing ¶ added in v1.2.6
func (encoder *MarketplaceEncoder) ApproveBuyoutListing( signerAddress string, listingId int, quantityDesired int, receiver string, ) (*types.Transaction, error)
Get the transaction data to approve the tokens needed for a buyout listing transaction. If the transaction wouldn't require any additional token approvals, this method will return nil.
signerAddress: the address intended to sign the transaction
listingId: the ID of the listing to buyout
quantityDesired: the quantity of the listed tokens to purchase
receiver: the address to receive the purchased tokens
returns: the transaction data for the token approval if an approval is needed, or nil
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." // ID of the listing to buyout listingId := 1 // Quantity of the listed tokens to purchase quantityDesired := 1 // receiver address to receive the purchased tokens receiver := "0x..." // Transaction data required for this request tx, err := marketplace.Encoder.ApproveBuyoutListing(signerAddress, listingId, quantityDesired, receiver) // Now you can get transaction all the standard data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
func (*MarketplaceEncoder) ApproveCreateListing ¶ added in v1.2.6
func (encoder *MarketplaceEncoder) ApproveCreateListing(signerAddress string, listing *NewDirectListing) (*types.Transaction, error)
Get the transaction data to approve the tokens needed for a create liting transaction. If the transaction wouldn't require any additional token approvals, this method will return nil.
signerAddress: the address intended to sign the transaction
listing: the parameters for the new direct listing to create
returns: the transaction data for the create listing transaction
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." listing := &NewDirectListing{ AssetContractAddress: "0x...", // Address of the asset contract TokenId: 0, // Token ID of the asset to list StartTimeInEpochSeconds: int(time.Now().Unix()), // Defaults to current time ListingDurationInSeconds: int(time.Now().Unix() + 3600), // Defaults to current time + 1 hour Quantity: 1, // Quantity of the asset to list CurrencyContractAddress: "0x...", // Contract address of currency to sell for, defaults to native token BuyoutPricePerToken: 1, // Price per token of the asset to list } // Transaction data required for this request tx, err := marketplace.Encoder.ApproveCreateListing(signerAddress, listing) // Now you can get transaction data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
func (*MarketplaceEncoder) BuyoutListing ¶ added in v1.2.6
func (encoder *MarketplaceEncoder) BuyoutListing( signerAddress string, listingId int, quantityDesired int, receiver string, ) (*types.Transaction, error)
Get the transaction data for the buyout listing transaction. This method will throw an error if the listing requires payment in ERC20 tokens and the ERC20 tokens haven't yet been approved by the spender. You can get the transaction data of this required approval transaction from the `ApproveBuyoutListing` method.
signerAddress: the address intended to sign the transaction
listingId: the ID of the listing to buyout
quantityDesired: the quantity of the listed tokens to purchase
receiver: the address to receive the purchased tokens
returns: the transaction data for this purchase
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." // ID of the listing to buyout listingId := 1 // Quantity of the listed tokens to purchase quantityDesired := 1 // receiver address to receive the purchased tokens receiver := "0x..." // Transaction data required for this request tx, err := marketplace.Encoder.BuyoutListing(signerAddress, listingId, quantityDesired, receiver) // Now you can get transaction all the standard data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
func (*MarketplaceEncoder) CancelListing ¶ added in v1.2.6
func (encoder *MarketplaceEncoder) CancelListing(signerAddress string, listingId int) (*types.Transaction, error)
Get the data for the transaction required to cancel a listing on the marketplace
signerAddress: the address intended to sign the transaction
listingId: the ID of the listing to cancel
returns: the transaction data for the cancellation
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." // ID of the listing to cancel listingId := 1 // Transaction data required for this request tx, err := marketplace.Encoder.CancelListing(signerAddress, listingId) // Now you can get transaction all the standard data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
func (*MarketplaceEncoder) CreateListing ¶ added in v1.2.6
func (encoder *MarketplaceEncoder) CreateListing(signerAddress string, listing *NewDirectListing) (*types.Transaction, error)
Get the data for the transaction required to create a direct listing. This method will throw an error if the tokens needed for the listing have not yet been approved by the asset owner for the marketplace to spend. You can get the transaction data of this required approval transaction from the `ApproveCreateListing` method.
signerAddress: the address intended to sign the transaction
listing: the parameters for the new direct listing to create
returns: the transaction data for the create listing transaction
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." listing := &NewDirectListing{ AssetContractAddress: "0x...", // Address of the asset contract TokenId: 0, // Token ID of the asset to list StartTimeInEpochSeconds: int(time.Now().Unix()), // Defaults to current time ListingDurationInSeconds: int(time.Now().Unix() + 3600), // Defaults to current time + 1 hour Quantity: 1, // Quantity of the asset to list CurrencyContractAddress: "0x...", // Contract address of currency to sell for, defaults to native token BuyoutPricePerToken: 1, // Price per token of the asset to list } // Transaction data required for this request tx, err := marketplace.Encoder.CreateListing(signerAddress, listing) // Now you can get transaction data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
type MarketplaceFilter ¶ added in v1.2.9
type Multiwrap ¶ added in v1.2.2
type Multiwrap struct { *ERC721 Encoder *ContractEncoder // contains filtered or unexported fields }
You can access the Multiwrap 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.GetMultiwrap("{{contract_address}}")
func (*Multiwrap) GetWrappedContents ¶ added in v1.2.2
func (multiwrap *Multiwrap) GetWrappedContents(wrappedTokenId int) (*MultiwrapBundle, error)
Get the contents of a wrapped token bundle.
wrappedTokenId: the ID of the wrapped token bundle
returns: the contents of the wrapped token bundle
Example
tokenId := 0 contents, err := contract.GetWrappedContents(tokenId) erc20Tokens := contents.Erc20Tokens erc721Tokens := contents.Erc721Tokens erc1155Tokens := contents.Erc1155Tokens
func (*Multiwrap) Unwrap ¶ added in v1.2.2
func (multiwrap *Multiwrap) Unwrap(wrappedTokenId int, recipientAddress string) (*types.Transaction, error)
Unwrap a wrapped token bundle into its contents
wrappedTokenId: the ID of the wrapped token bundle
recipientAddress: the optional address to send the wrapped token to
returns: the contents of the wrapped token bundle
Example
tokenId := 0 tx, err := contract.Unwrap(tokenId, "")
func (*Multiwrap) Wrap ¶ added in v1.2.2
func (multiwrap *Multiwrap) Wrap(contents *MultiwrapBundle, wrappedTokenMetadata interface{}, recipientAddress string) (*types.Transaction, error)
Wrap any number of ERC20, ERC721, or ERC1155 tokens into a single wrapped token
contents: the tokens to wrap into a single wrapped token
wrappedTokenMetadata: the NFT Metadata or URI to as the metadata for the wrapped token
recipientAddress: the optional address to send the wrapped token to
returns: the transaction receipt of the wrapping
Example
contents := &thirdweb.MultiwrapBundle{ ERC20Tokens: []*thirdweb.MultiwrapERC20{ &thirdweb.MultiwrapERC20{ ContractAddress: "0x...", Quantity: 1, }, }, ERC721Tokens: []*thirdweb.MultiwrapERC721{ &thirdweb.MultiwrapERC721{ ContractAddress: "0x...", TokenId: 1, }, }, ERC1155Tokens: []*thirdweb.MultiwrapERC1155{ &thirdweb.MultiwrapERC1155{ ContractAddress: "0x...", TokenId: 1, Quantity: 1, }, }, } wrappedTokenMetadata := &thirdweb.NFTMetadataInput{ Name: "Wrapped Token" } // This will mint the wrapped token to the connected wallet tx, err := contract.Wrap(contents, wrappedTokenMetadata, "")
type MultiwrapBundle ¶ added in v1.2.2
type MultiwrapBundle struct { ERC20Tokens []*MultiwrapERC20 ERC721Tokens []*MultiwrapERC721 ERC1155Tokens []*MultiwrapERC1155 }
type MultiwrapERC1155 ¶ added in v1.2.2
type MultiwrapERC20 ¶ added in v1.2.2
type MultiwrapERC721 ¶ added in v1.2.2
type NFTCollection ¶
type NFTCollection struct { *ERC721 Signature *ERC721SignatureMinting Encoder *ContractEncoder // contains filtered or unexported fields }
You can access the NFT Collection 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.GetNFTCollection("{{contract_address}}")
func (*NFTCollection) GetOwned ¶ added in v1.2.2
func (nft *NFTCollection) GetOwned(address string) ([]*NFTMetadataOwner, error)
Get the metadatas of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the metadata of all the NFTs owned by the address
Example
owner := "{{wallet_address}}" nfts, err := contract.GetOwned(owner) name := nfts[0].Metadata.Name
func (*NFTCollection) GetOwnedTokenIDs ¶ added in v1.2.2
func (nft *NFTCollection) GetOwnedTokenIDs(address string) ([]*big.Int, error)
Get the tokenIds of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the tokenIds of all the NFTs owned by the address
func (*NFTCollection) Mint ¶
func (nft *NFTCollection) Mint(metadata *NFTMetadataInput) (*types.Transaction, error)
Mint a new NFT to the connected wallet.
metadata: metadata of the NFT to mint
returns: the transaction receipt of the mint
func (*NFTCollection) MintBatch ¶
func (nft *NFTCollection) MintBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Mint a batch of new NFTs to the connected wallet.
metadatas: list of metadata of the NFTs to mint
returns: the transaction receipt of the mint
func (*NFTCollection) MintBatchTo ¶
func (nft *NFTCollection) MintBatchTo(address string, metadatas []*NFTMetadataInput) (*types.Transaction, error)
Mint a batch of new NFTs to the specified wallet.
to: the wallet address to mint to
metadatas: list of metadata of the NFTs to mint
returns: the transaction receipt of the mint
Example
metadatas := []*thirdweb.NFTMetadataInput{ &thirdweb.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", } &thirdweb.NFTMetadataInput{ Name: "Cool NFT 2", Description: "This is also a cool NFT", } } tx, err := contract.MintBatchTo("{{wallet_address}}", metadatas)
func (*NFTCollection) MintTo ¶
func (nft *NFTCollection) MintTo(address string, metadata *NFTMetadataInput) (*types.Transaction, error)
Mint a new NFT to the specified wallet.
address: the wallet address to mint to
metadata: metadata of the NFT to mint
returns: the transaction receipt of the mint
Example
image, err := os.Open("path/to/image.jpg") defer image.Close() metadata := &thirdweb.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image, } tx, err := contract.MintTo("{{wallet_address}}", metadata)
type NFTDrop ¶
type NFTDrop struct { *ERC721 ClaimConditions *NFTDropClaimConditions Encoder *NFTDropEncoder // contains filtered or unexported fields }
You can access the NFT Drop 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.GetNFTDrop("{{contract_address}}")
func (*NFTDrop) Claim ¶
func (drop *NFTDrop) Claim(quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
func (*NFTDrop) ClaimTo ¶
Claim NFTs from this contract to the connect wallet.
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}}" quantity = 1 tx, err := contract.ClaimTo(address, quantity)
func (*NFTDrop) CreateBatch ¶
func (drop *NFTDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Create a batch of NFTs on this contract.
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() metadatas := []*thirdweb.NFTMetadataInput{ &thirdweb.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image1 } &thirdweb.NFTMetadataInput{ Name: "Cool NFT 2", Description: "This is also a cool NFT", Image: image2 } } tx, err := contract.CreateBatch(metadatas)
func (*NFTDrop) GetAllClaimed ¶
func (drop *NFTDrop) GetAllClaimed() ([]*NFTMetadataOwner, error)
Get a list of all the NFTs that have been claimed from this contract.
returns: a list of the metadatas of the claimed NFTs
Example
claimedNfts, err := contract.GetAllClaimed() firstOwner := claimedNfts[0].Owner
func (*NFTDrop) GetAllUnclaimed ¶
func (drop *NFTDrop) GetAllUnclaimed() ([]*NFTMetadata, error)
Get a list of all the NFTs on this contract that have not yet been claimed.
returns: a list of the metadatas of the unclaimed NFTs
Example
unclaimedNfts, err := contract.GetAllUnclaimed() firstNftName := unclaimedNfts[0].Name
func (*NFTDrop) GetOwned ¶ added in v1.2.2
func (nft *NFTDrop) GetOwned(address string) ([]*NFTMetadataOwner, error)
Get the metadatas of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the metadata of all the NFTs owned by the address
Example
owner := "{{wallet_address}}" nfts, err := contract.GetOwned(owner) name := nfts[0].Metadata.Name
type NFTDropClaimConditions ¶ added in v1.2.11
type NFTDropClaimConditions struct {
// contains filtered or unexported fields
}
This interface is currently accessible from the NFT Drop contract contract type via the ClaimConditions property.
func (*NFTDropClaimConditions) GetActive ¶ added in v1.2.11
func (claim *NFTDropClaimConditions) GetActive() (*ClaimConditionOutput, error)
Get the currently active claim condition
returns: the currently active claim condition metadata
Example
condition, err := contract.ClaimConditions.GetActive() // Now you have access to all the claim condition metadata fmt.Println("Start Time:", condition.StartTime) fmt.Println("Available:", condition.AvailableSupply) fmt.Println("Quantity:", condition.MaxQuantity) fmt.Println("Quantity Limit:", condition.QuantityLimitPerTransaction) fmt.Println("Price:", condition.Price) fmt.Println("Wait In Seconds", condition.WaitInSeconds)
func (*NFTDropClaimConditions) GetAll ¶ added in v1.2.11
func (claim *NFTDropClaimConditions) GetAll() ([]*ClaimConditionOutput, error)
Get all claim conditions on this contract
returns: the metadata for all the claim conditions on this contract
Example
conditions, err := contract.ClaimConditions.GetAll() // Now you have access to all the claim condition metadata condition := conditions[0] fmt.Println("Start Time:", condition.StartTime) fmt.Println("Available:", condition.AvailableSupply) fmt.Println("Quantity:", condition.MaxQuantity) fmt.Println("Quantity Limit:", condition.QuantityLimitPerTransaction) fmt.Println("Price:", condition.Price) fmt.Println("Wait In Seconds", condition.WaitInSeconds)
type NFTDropEncoder ¶ added in v1.2.14
type NFTDropEncoder struct { *ContractEncoder // contains filtered or unexported fields }
The nft drop encoder class is used to get the unsigned transaction data for nft drop contract contract calls that can be signed at a later time after generation.
It can be accessed from the SDK through the `Encoder` namespace of the nft drop contract:
You can access the NFTDrop 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.GetNFTDrop("{{contract_address}}") // Now the encoder can be accessed from the contract contract.Encoder.ClaimTo(...)
func (*NFTDropEncoder) ApproveClaimTo ¶ added in v1.2.14
func (encoder *NFTDropEncoder) ApproveClaimTo(signerAddress string, destinationAddress string, quantity int) (*types.Transaction, error)
Get the data for the transaction data required to approve the ERC20 token transfers necessary to claim NFTs from this contract.
signerAddress: the address intended to sign the transaction
destinationAddress: the address of the wallet to claim the NFTs to
quantity: the number of NFTs to claim
returns: the transaction data of the token approval for the claim
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." // Address of the wallet we want to claim the NFTs to destinationAddress := "{{wallet_address}}" // Number of NFTs to claim quantity = 1 tx, err := contract.Encoder.ApproveClaimTo(signerAddress, destinationAddress, quantity) // Now you can get all the standard transaction data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
func (*NFTDropEncoder) ClaimTo ¶ added in v1.2.14
func (encoder *NFTDropEncoder) ClaimTo(signerAddress string, destinationAddress string, quantity int) (*types.Transaction, error)
Get the data for the transaction required to claim NFTs from this contract.
signerAddress: the address intended to sign the transaction
destinationAddress: the address of the wallet to claim the NFTs to
quantity: the number of NFTs to claim
returns: the transaction data of the claim
Example
// Address of the wallet we expect to sign this message signerAddress := "0x..." // Address of the wallet we want to claim the NFTs to destinationAddress := "{{wallet_address}}" // Number of NFTs to claim quantity = 1 tx, err := contract.Encoder.ClaimTo(signerAddress, destinationAddress, quantity) // Now you can get all the standard transaction data as needed fmt.Println(tx.Data()) // Ex: get the data field or the nonce field (others are available) fmt.Println(tx.Nonce())
type NFTMetadata ¶
type NFTMetadata struct { Id *big.Int `json:"id"` Uri string `json:"uri"` Name string `json:"name"` Description string `json:"description"` Image interface{} `json:"image"` ExternalUrl string `json:"external_url"` AnimationUrl string `json:"animation_url"` BackgroundColor string `json:"background_color"` Properties interface{} `json:"properties,omitempty"` Attributes interface{} `json:"attributes,omitempty"` }
type NFTMetadataInput ¶
type NFTMetadataInput struct { Name string `mapstructure:"name" json:"name"` Description string `mapstructure:"description,omitempty" json:"description"` Image interface{} `mapstructure:"image,omitempty" json:"image"` ExternalUrl string `mapstructure:"external_url,omitempty" json:"external_url"` AnimationUrl string `mapstructure:"animation_url,omitempty" json:"animation_url"` BackgroundColor string `mapstructure:"background_color,omitempty" json:"background_color"` Properties interface{} `mapstructure:"properties,omitempty" json:"properties,omitempty"` Attributes interface{} `mapstructure:"attributes,omitempty" json:"attributes,omitempty"` }
type NFTMetadataOwner ¶
type NFTMetadataOwner struct { Metadata *NFTMetadata Owner string }
type NativeToken ¶
type NativeToken struct {
// contains filtered or unexported fields
}
type NewDirectListing ¶ added in v1.2.6
type ProviderHandler ¶
type ProviderHandler struct {
// contains filtered or unexported fields
}
func NewProviderHandler ¶
func NewProviderHandler(provider *ethclient.Client, privateKey string) (*ProviderHandler, error)
func (*ProviderHandler) GetChainID ¶
func (handler *ProviderHandler) GetChainID() (*big.Int, error)
func (*ProviderHandler) GetPrivateKey ¶ added in v1.2.1
func (handler *ProviderHandler) GetPrivateKey() *ecdsa.PrivateKey
func (*ProviderHandler) GetProvider ¶
func (handler *ProviderHandler) GetProvider() *ethclient.Client
func (*ProviderHandler) GetRawPrivateKey ¶
func (handler *ProviderHandler) GetRawPrivateKey() string
func (*ProviderHandler) GetSignerAddress ¶
func (handler *ProviderHandler) GetSignerAddress() common.Address
func (*ProviderHandler) UpdatePrivateKey ¶
func (handler *ProviderHandler) UpdatePrivateKey(privateKey string) error
func (*ProviderHandler) UpdateProvider ¶
func (handler *ProviderHandler) UpdateProvider(provider *ethclient.Client)
type SDKOptions ¶
type Signature1155PayloadInput ¶ added in v1.2.1
type Signature1155PayloadInputWithTokenId ¶ added in v1.2.1
type Signature1155PayloadOutput ¶ added in v1.2.1
type Signature721PayloadInput ¶ added in v1.2.1
type Signature721PayloadOutput ¶ added in v1.2.1
type SignedPayload1155 ¶ added in v1.2.1
type SignedPayload1155 struct { Payload *Signature1155PayloadOutput Signature []byte }
type SignedPayload721 ¶ added in v1.2.1
type SignedPayload721 struct { Payload *Signature721PayloadOutput Signature []byte }
type SmartContract ¶ added in v1.2.3
type SmartContract struct {
// contains filtered or unexported fields
}
Custom Contracts
With the thirdweb SDK, you can get a contract instance for any contract. Additionally, if you deployed your contract using thirdweb deploy, you can get a more explicit and intuitive interface to interact with your contracts.
Getting a Custom Contract Instance ¶
Let's take a look at how you can get a custom contract instance for one of your contracts deployed using the thirdweb deploy flow:
import ( "github.com/thirdweb-dev/go-sdk/thirdweb" ) privateKey = "..." sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{ PrivateKey: privateKey, }) // You can replace your own contract address here contractAddress := "{{contract_address}}" // Now you have a contract instance ready to go contract, err := sdk.GetContract(contractAddress)
Alternatively, if you didn't deploy your contract with thirdweb deploy, you can still get a contract instance for any contract using your contracts ABI:
import ( "github.com/thirdweb-dev/go-sdk/thirdweb" ) privateKey = "..." sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{ PrivateKey: privateKey, }) // You can replace your own contract address here contractAddress := "{{contract_address}}" // Add your contract ABI here abi := "[...]" // Now you have a contract instance ready to go contract, err := sdk.GetContractFromAbi(contractAddress, abi)
Calling Contract Functions ¶
Now that you have an SDK instance for your contract, you can easily call any function on your contract with the contract "call" method as follows:
// The first parameter to the call function is the method name // All other parameters to the call function get passed as arguments to your contract balance, err := contract.Call("balanceOf", "{{wallet_address}}") // You can also make a transaction to your contract with the call method tx, err := contract.Call("mintTo", "{{wallet_address}}", "ipfs://...")
func (*SmartContract) Call ¶ added in v1.2.3
func (c *SmartContract) Call(method string, args ...interface{}) (interface{}, error)
Call any function on your contract.
method: the name of the method on your contract you want to call
args: the arguments to pass to the method
Example
// The first parameter to the call function is the method name // All other parameters to the call function get passed as arguments to your contract balance, err := contract.Call("balanceOf", "{{wallet_address}}") // You can also make a transaction to your contract with the call method tx, err := contract.Call("mintTo", "{{wallet_address}}", "ipfs://...")
type ThirdwebSDK ¶
type ThirdwebSDK struct { *ProviderHandler Storage IpfsStorage Deployer ContractDeployer Auth WalletAuthenticator }
func NewThirdwebSDK ¶
func NewThirdwebSDK(rpcUrlOrChainName string, options *SDKOptions) (*ThirdwebSDK, error)
NewThirdwebSDK
Create a new instance of the Thirdweb SDK ¶
rpcUrlOrName: the name of the chain to connection to (e.g. "rinkeby", "mumbai", "polygon", "mainnet", "fantom", "avalanche") or the RPC URL to connect to
options: an SDKOptions instance to specify a private key and/or an IPFS gateway URL
func (*ThirdwebSDK) GetContract ¶ added in v1.2.3
func (sdk *ThirdwebSDK) GetContract(address string) (*SmartContract, error)
GetContract
Get an instance of a custom contract deployed with thirdweb deploy ¶
address: the address of the contract
func (*ThirdwebSDK) GetContractFromAbi ¶ added in v1.2.3
func (sdk *ThirdwebSDK) GetContractFromAbi(address string, abi string) (*SmartContract, error)
GetContractFromABI
Get an instance of ant custom contract from its ABI ¶
address: the address of the contract
abi: the ABI of the contract
func (*ThirdwebSDK) GetEdition ¶
func (sdk *ThirdwebSDK) GetEdition(address string) (*Edition, error)
GetEdition
Get an Edition contract SDK instance ¶
address: the address of the Edition contract
func (*ThirdwebSDK) GetEditionDrop ¶
func (sdk *ThirdwebSDK) GetEditionDrop(address string) (*EditionDrop, error)
GetEditionDrop
Get an Edition Drop contract SDK instance ¶
address: the address of the Edition Drop contract
func (*ThirdwebSDK) GetMarketplace ¶ added in v1.2.6
func (sdk *ThirdwebSDK) GetMarketplace(address string) (*Marketplace, error)
GetMarketplace
Get a Marketplace contract SDK instance ¶
address: the address of the Marketplace contract
func (*ThirdwebSDK) GetMultiwrap ¶ added in v1.2.2
func (sdk *ThirdwebSDK) GetMultiwrap(address string) (*Multiwrap, error)
GetMultiwrap
Get a Multiwrap contract SDK instance ¶
address: the address of the Multiwrap contract
func (*ThirdwebSDK) GetNFTCollection ¶
func (sdk *ThirdwebSDK) GetNFTCollection(address string) (*NFTCollection, error)
GetNFTCollection
Get an NFT Collection contract SDK instance ¶
address: the address of the NFT Collection contract
func (*ThirdwebSDK) GetNFTDrop ¶
func (sdk *ThirdwebSDK) GetNFTDrop(address string) (*NFTDrop, error)
GetNFTDrop
Get an NFT Drop contract SDK instance ¶
address: the address of the NFT Drop contract
type Token ¶
type Token struct { *ERC20 Encoder *ContractEncoder // contains filtered or unexported fields }
You can access the Token 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.GetToken("{{contract_address}}")
func (*Token) DelegateTo ¶
func (token *Token) DelegateTo(delegatreeAddress string) (*types.Transaction, error)
Delegate the connected wallets tokens to a specified wallet.
delegateeAddress: wallet address to delegate tokens to
returns: transaction receipt of the delegation
func (*Token) GetDelegation ¶
Get the connected wallets delegatee address for this token.
returns: delegation address of the connected wallet
func (*Token) GetDelegationOf ¶
Get a specified wallets delegatee for this token.
returns: delegation address of the connected wallet
func (*Token) GetVoteBalance ¶
func (token *Token) GetVoteBalance() (*CurrencyValue, error)
Get the connected wallets voting power in this token.
returns: vote balance of the connected wallet
func (*Token) GetVoteBalanceOf ¶
func (token *Token) GetVoteBalanceOf(address string) (*CurrencyValue, error)
Get the voting power of the specified wallet in this token.
address: wallet address to check the vote balance of
returns: vote balance of the specified wallet
func (*Token) Mint ¶
func (token *Token) Mint(amount float64) (*types.Transaction, error)
Mint tokens to the connected wallet.
amount: amount of tokens to mint
returns: transaction receipt of the mint
func (*Token) MintBatchTo ¶
func (token *Token) MintBatchTo(args []*TokenAmount) (*types.Transaction, error)
Mint tokens to a list of wallets.
args: list of wallet addresses and amounts to mint
returns: transaction receipt of the mint
Example
args = []*thirdweb.TokenAmount{ &thirdweb.TokenAmount{ ToAddress: "{{wallet_address}}", Amount: 1 } &thirdweb.TokenAmount{ ToAddress: "{{wallet_address}}", Amount: 2 } } tx, err := contract.MintBatchTo(args)
type TokenAmount ¶
type WalletAuthenticationOptions ¶ added in v1.2.5
type WalletAuthenticationPayloadData ¶ added in v1.2.5
type WalletAuthenticator ¶ added in v1.2.5
type WalletAuthenticator struct {
*ProviderHandler
}
> 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.
The wallet authenticator enables server-side applications to securely identify the connected wallet address of users on the client-side, and also enables users to authenticate to any backend using just their wallet. It implements the JSON Web Token (JWT) authentication standard.
You can use the wallet authenticator as follows:
// First we specify the domain of the application to authenticate to domain := "thirdweb.com" // We can then generate a payload for the connected wallet to login // This can also be done on the client side with the thirdweb TypeScript SDK payload, err := sdk.Auth.Login(domain, nil) // Then, on the server, we can securely verify the connected address that signed the payload address, err := sdk.Auth.Verify(domain, payload, nil) // And we can also generate an authentication token to send back to the original payload sender token, err := sdk.Auth.GenerateAuthToken(domain, payload, nil) // Finally, the token can be use dby the original payload sender to authenticate to the backend // And the server can use the following function to authenticate the token and verify the address address, err := sdk.Auth.Authenticate(domain, token)
func (*WalletAuthenticator) Authenticate ¶ added in v1.2.5
func (auth *WalletAuthenticator) Authenticate( domain string, token string, ) (string, error)
Server-side function that authenticates the provided JWT token. This function verifies that the provided authentication token is valid and returns the address of the authenticated wallet.
domain: The domain of the application to authenticate the token to
token: The authentication token to authenticate with
returns: The address of the authenticated wallet
Example
domain := "thirdweb.com" payload, err := sdk.Auth.Login(domain) token, err := sdk.Auth.GenerateAuthToken(domain, payload) // Authenticate the token and get the address of the authenticating wallet address, err := sdk.Auth.Authenticate(domain, token)
func (*WalletAuthenticator) GenerateAuthToken ¶ added in v1.2.5
func (auth *WalletAuthenticator) GenerateAuthToken( domain string, payload *WalletLoginPayload, options *WalletAuthenticationOptions, ) (string, error)
Server-side function that generates a JWT token from the provided login request that the client-side wallet can use to authenticate to the server-side application.
domain: The domain of the application to authenticate to
payload: The login payload to authenticate with
options: Optional configuration options for the authentication token
returns: An authentication token that can be used to make authenticated requests to the server
Example
domain := "thirdweb.com" payload, err := sdk.Auth.Login(domain, nil) // Generate an authentication token for the logged in wallet token, err := sdk.Auth.GenerateAuthToken(domain, payload, nil)
func (*WalletAuthenticator) Login ¶ added in v1.2.5
func (auth *WalletAuthenticator) Login( domain string, options *WalletLoginOptions, ) (*WalletLoginPayload, error)
Client-side function that allows the connected wallet to login to a server-side application. Generates a login payload that can be sent to the server-side for verification or authentication.
domain: The domain of the application that you want to log in to
options: Optional configuration options for the login payload
returns: A login payload that can be sent to the server-side for verification or authentication
Example
// Add the domain of the application that you want to log in to domain := "thirdweb.com" // Generate a signed login payload for the connected wallet to authenticate with payload, err := sdk.Auth.Login(domain, nil)
func (*WalletAuthenticator) Verify ¶ added in v1.2.5
func (auth *WalletAuthenticator) Verify( domain string, payload *WalletLoginPayload, options *WalletVerifyOptions, ) (string, error)
Server-side function to securely verify the address of the logged in client-side wallet by validating the provided client-side login request.
domain: The domain of the application to verify the login request for
payload: The login payload to verify
returns: The address of the logged in wallet that signed the payload
Example
domain := "thirdweb.com" payload, err := sdk.Auth.Login(domain, nil) // Verify the login request address, err := sdk.Auth.Verify(domain, payload, nil)
type WalletLoginOptions ¶ added in v1.2.5
type WalletLoginPayload ¶ added in v1.2.5
type WalletLoginPayload struct { Payload *WalletLoginPayloadData `json:"payload"` Signature string `json:"signature"` }
type WalletLoginPayloadData ¶ added in v1.2.5
type WalletVerifyOptions ¶ added in v1.2.5
type WalletVerifyOptions struct {
ChainId int
}
type WrappedToken ¶
type WrappedToken struct {
// contains filtered or unexported fields
}
Source Files ¶
- common.go
- constants.go
- contract_deployer.go
- contract_encoder.go
- contract_helper.go
- edition.go
- edition_drop.go
- edition_drop_claim_conditions.go
- erc1155.go
- erc1155_signature_minting.go
- erc20.go
- erc721.go
- erc721_signature_minting.go
- error.go
- ipfs_storage.go
- marketplace.go
- marketplace_encoder.go
- multiwrap.go
- nft_collection.go
- nft_drop.go
- nft_drop_claim_conditions.go
- nft_drop_encoder.go
- provider_handler.go
- sdk.go
- smart_contract.go
- token.go
- types.go
- wallet_authenticator.go