thirdweb

package
v1.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAINNET   ChainID = 1
	RINKEBY           = 4
	GOERLI            = 5
	POLYGON           = 137
	FANTOM            = 250
	AVALANCHE         = 43114
	MUMBAI            = 80001
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainID

type ChainID int

type ChainName added in v1.1.4

type ChainName string

type ClaimCondition

type ClaimCondition struct {
	// contains filtered or unexported fields
}

type ClaimConditionOutput

type ClaimConditionOutput struct {
	// contains filtered or unexported fields
}

type ClaimVerification

type ClaimVerification struct {
	// contains filtered or unexported fields
}

type Currency

type Currency struct {
	// contains filtered or unexported fields
}

type CurrencyValue

type CurrencyValue struct {
	// contains filtered or unexported fields
}

type ERC721

type ERC721 struct {
	// contains filtered or unexported fields
}

func (*ERC721) Balance

func (erc721 *ERC721) Balance() (*big.Int, error)

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

func (erc721 *ERC721) BalanceOf(address string) (*big.Int, error)

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

func (*ERC721) Burn

func (erc721 *ERC721) Burn(tokenId int) (*types.Transaction, error)

Burn

Burn a specified NFT from the connected wallet

tokenId: tokenID of the token to burn

returns: the transaction receipt of the burn

func (*ERC721) Get

func (erc721 *ERC721) Get(tokenId int) (*NFTMetadataOwner, error)

Get

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

func (*ERC721) GetAll

func (erc721 *ERC721) GetAll() ([]*NFTMetadataOwner, error)

GetAll

Get the metadata of all the NFTs on this contract

returns: the metadata of all the NFTs on this contract

func (*ERC721) GetOwned

func (erc721 *ERC721) GetOwned(address string) ([]*NFTMetadataOwner, error)

GetOwned

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

func (*ERC721) GetOwnedTokenIDs

func (erc721 *ERC721) GetOwnedTokenIDs(address string) ([]*big.Int, error)

GetOwnedTokenIDs

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 (*ERC721) GetTotalCount

func (erc721 *ERC721) GetTotalCount() (*big.Int, error)

GetTotalCount

Get the total number of NFTs on this contract

returns: the total number of NFTs on this contract

func (*ERC721) IsApproved

func (erc721 *ERC721) IsApproved(address string, operator string) (bool, error)

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

func (erc721 *ERC721) OwnerOf(tokenId int) (string, error)

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

func (erc721 *ERC721) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)

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) TotalSupply

func (erc721 *ERC721) TotalSupply() (*big.Int, error)

TotalSupply

Get the total number of NFTs on this contract

returns: the supply of NFTs on this contract

func (*ERC721) Transfer

func (erc721 *ERC721) Transfer(to string, tokenId int) (*types.Transaction, error)

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

type ERC1155

type ERC1155 struct {
	// contains filtered or unexported fields
}

func (*ERC1155) Balance

func (erc1155 *ERC1155) Balance(tokenId int) (*big.Int, error)

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

func (erc1155 *ERC1155) BalanceOf(address string, tokenId int) (*big.Int, error)

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

func (*ERC1155) Burn

func (erc1155 *ERC1155) Burn(tokenId int, amount int) (*types.Transaction, error)

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

func (*ERC1155) Get

func (erc1155 *ERC1155) Get(tokenId int) (*EditionMetadata, error)

Get

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

func (*ERC1155) GetAll

func (erc1155 *ERC1155) GetAll() ([]*EditionMetadata, error)

GetAll

Get the metadata of all the NFTs on this contract

returns: the metadatas and supplies of all the NFTs on this contract

func (*ERC1155) GetOwned

func (erc1155 *ERC1155) GetOwned(address string) ([]*EditionMetadataOwner, error)

GetOwned

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

func (*ERC1155) GetTotalCount

func (erc1155 *ERC1155) GetTotalCount() (*big.Int, error)

GetTotalCount

Get the total number of NFTs on this contract

returns: the total number of NFTs on this contract

func (*ERC1155) IsApproved

func (erc1155 *ERC1155) IsApproved(address string, operator string) (bool, error)

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)

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 (*ERC1155) TotalSupply added in v1.1.4

func (erc1155 *ERC1155) TotalSupply(tokenId int) (*big.Int, error)

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

func (erc1155 *ERC1155) Transfer(to string, tokenId int, amount int) (*types.Transaction, error)

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

type Edition

type Edition struct {
	*ERC1155
	// contains filtered or unexported fields
}

func (*Edition) Mint

func (edition *Edition) Mint(metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)

Mint

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)

MintAdditionalSupply

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)

MintAdditionalSupplyTo

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) MintBatchTo

func (edition *Edition) MintBatchTo(to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)

MintBatchTo

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

func (*Edition) MintTo

func (edition *Edition) MintTo(address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)

MintTo

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

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 added in v1.1.4

type EditionResult struct {
	// contains filtered or unexported fields
}

type IpfsStorage

type IpfsStorage struct {
	Url 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 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 []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 Metadata

type Metadata struct {
	MetadataUri    string
	MetadataObject interface{}
}

type NFTCollection

type NFTCollection struct {
	*ERC721
	// contains filtered or unexported fields
}

func (*NFTCollection) Mint

func (nft *NFTCollection) Mint(metadata *NFTMetadataInput) (*types.Transaction, error)

Mint

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)

MintBatch

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)

MintBatchTo

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

func (*NFTCollection) MintTo

func (nft *NFTCollection) MintTo(address string, metadata *NFTMetadataInput) (*types.Transaction, error)

Mint

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

type NFTDrop

type NFTDrop struct {
	*ERC721
	// contains filtered or unexported fields
}

func (*NFTDrop) Claim

func (drop *NFTDrop) Claim(quantity int) (*types.Transaction, error)

Claim

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

func (drop *NFTDrop) ClaimTo(destinationAddress string, quantity int) (*types.Transaction, error)

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

func (*NFTDrop) CreateBatch

func (drop *NFTDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)

CreateBatch

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

func (*NFTDrop) GetAllClaimed

func (drop *NFTDrop) GetAllClaimed() ([]*NFTMetadataOwner, error)

GetAllClaimed

Get a list of all the NFTs that have been claimed from this contract

returns: a list of the metadatas of the claimed NFTs

func (*NFTDrop) GetAllUnclaimed

func (drop *NFTDrop) GetAllUnclaimed() ([]*NFTMetadata, error)

GetAllUnclaimed

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

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"`
}

type NFTMetadataInput

type NFTMetadataInput struct {
	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"`
}

type NFTMetadataOwner

type NFTMetadataOwner struct {
	Metadata *NFTMetadata
	Owner    string
}

type NFTResult

type NFTResult struct {
	// contains filtered or unexported fields
}

type NativeToken

type NativeToken struct {
	// contains filtered or unexported fields
}

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) 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 SDKOptions struct {
	PrivateKey string
	GatewayUrl string
}

type ThirdwebSDK

type ThirdwebSDK struct {
	*ProviderHandler
	Storage IpfsStorage
}

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) 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) 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 WrappedToken

type WrappedToken struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL