thirdweb

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MAINNET   ChainID = 1
	RINKEBY           = 4
	GOERLI            = 5
	POLYGON           = 137
	FANTOM            = 250
	AVALANCHE         = 43114
	MUMBAI            = 80001
)
View Source
const DEFAULT_IPFS_GATEWAY_URL = "https://gateway.ipfscdn.io/ipfs/"
View Source
const DEFAULT_MERKLE_ROOT = "0x0000000000000000000000000000000000000000000000000000000000000000"

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseUriWithUris

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

type ChainID

type ChainID int

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 ContractWrapper

type ContractWrapper[TContractABI any] struct {
	*ProviderHandler
	// contains filtered or unexported fields
}

func NewContractWrapper

func NewContractWrapper[TContractABI any](abi TContractABI, address common.Address, provider *ethclient.Client, privateKey string) (*ContractWrapper[TContractABI], error)

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 NewERC721

func NewERC721(provider *ethclient.Client, address common.Address, privateKey string, storage Storage) (*ERC721, error)

func (*ERC721) Balance

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

func (*ERC721) BalanceOf

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

func (*ERC721) Burn

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

func (*ERC721) Get

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

func (*ERC721) GetAll

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

func (*ERC721) GetOwned

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

func (*ERC721) GetOwnedTokenIDs

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

func (*ERC721) GetTotalCount

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

func (*ERC721) IsApproved

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

func (*ERC721) OwnerOf

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

func (*ERC721) SetApprovalForAll

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

func (*ERC721) TotalSupply

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

func (*ERC721) Transfer

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

type ERC1155

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

func NewERC1155

func NewERC1155(contractWrapper *ContractWrapper[*abi.TokenERC1155], storage Storage) *ERC1155

func (*ERC1155) Balance

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

func (*ERC1155) BalanceOf

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

func (*ERC1155) Burn

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

func (*ERC1155) Get

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

func (*ERC1155) GetAll

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

func (*ERC1155) GetOwned

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

func (*ERC1155) GetTotalCount

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

func (*ERC1155) GetTotalSupply

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

func (*ERC1155) IsApproved

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

func (*ERC1155) SetApprovalForAll

func (erc1155 *ERC1155) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)

func (*ERC1155) Transfer

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

type Edition

type Edition struct {
	*ERC1155
}

func NewEdition

func NewEdition(provider *ethclient.Client, address common.Address, privateKey string, storage Storage) (*Edition, error)

func (*Edition) Mint

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

func (*Edition) MintAdditionalSupply

func (edition *Edition) MintAdditionalSupply(tokenId int, additionalSupply int) (*types.Transaction, error)

func (*Edition) MintAdditionalSupplyTo

func (edition *Edition) MintAdditionalSupplyTo(to string, tokenId int, additionalSupply int) (*types.Transaction, error)

func (*Edition) MintBatchTo

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

func (*Edition) MintTo

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

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 FailedToUploadError

type FailedToUploadError struct {
	Payload         interface{}
	UnderlyingError error
	// contains filtered or unexported fields
}

func (*FailedToUploadError) Error

func (m *FailedToUploadError) Error() string

type IpfsStorage

type IpfsStorage struct {
	Url string
}

func (*IpfsStorage) Get

func (gw *IpfsStorage) Get(uri string) ([]byte, error)

func (*IpfsStorage) Upload

func (ipfs *IpfsStorage) Upload(data any, contractAddress string, signerAddress string) (string, error)

Upload method can be used to upload a generic payload to IPFS. NftLabs provides a default proxy in the SDK. You can override this with the ISdk.SetStorage

func (*IpfsStorage) UploadBatch

func (ipfs *IpfsStorage) UploadBatch(data []any, contractAddress string, signerAddress string) (*BaseUriWithUris, error)

UploadBatch uploads a list of arbitrary objects and returns their URIs *in the order they were passed*

type Metadata

type Metadata struct {
	MetadataUri    string
	MetadataObject interface{}
}

type NFTCollection

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

func NewNFTCollection

func NewNFTCollection(provider *ethclient.Client, address common.Address, privateKey string, storage Storage) (*NFTCollection, error)

func (*NFTCollection) Mint

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

func (*NFTCollection) MintBatch

func (nft *NFTCollection) MintBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)

func (*NFTCollection) MintBatchTo

func (nft *NFTCollection) MintBatchTo(address string, metadatas []*NFTMetadataInput) (*types.Transaction, error)

func (*NFTCollection) MintTo

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

type NFTDrop

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

func NewNFTDrop

func NewNFTDrop(provider *ethclient.Client, address common.Address, privateKey string, storage Storage) (*NFTDrop, error)

func (*NFTDrop) Claim

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

func (*NFTDrop) ClaimTo

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

func (*NFTDrop) CreateBatch

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

func (*NFTDrop) GetAllClaimed

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

func (*NFTDrop) GetAllUnclaimed

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

type NFTDropClaimConditions

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

func NewNFTDropClaimConditions

func NewNFTDropClaimConditions(contractWrapper *ContractWrapper[*abi.DropERC721], storage Storage) *NFTDropClaimConditions

func (*NFTDropClaimConditions) GetActive

func (claim *NFTDropClaimConditions) GetActive() (*ClaimConditionOutput, error)

type NFTMetadata

type NFTMetadata struct {
	Id              *big.Int    `json:"id"`
	Uri             string      `json:"uri"`
	Name            string      `json:"name"`
	Description     string      `json:"description"`
	Image           string      `json:"image"`
	ExternalUrl     string      `json:"external_url"`
	AnimationUrl    string      `json:"animation_url"`
	BackgroundColor string      `json:"background_color"`
	Properties      interface{} `json:"properties"`
}

type NFTMetadataInput

type NFTMetadataInput struct {
	Name            string      `json:"name"`
	Description     string      `json:"description"`
	Image           string      `json:"image"`
	ExternalUrl     string      `json:"external_url"`
	AnimationUrl    string      `json:"animation_url"`
	BackgroundColor string      `json:"background_color"`
	Properties      interface{} `json:"properties"`
}

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 NoAddressError

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

func (*NoAddressError) Error

func (m *NoAddressError) Error() string

type NoSignerError

type NoSignerError struct {
	Err error
	// contains filtered or unexported fields
}

func (*NoSignerError) Error

func (m *NoSignerError) Error() string

type NotFoundError

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

func (*NotFoundError) Error

func (m *NotFoundError) Error() string

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 Storage

type Storage interface {
	Get(uri string) ([]byte, error)
	Upload(data any, contractAddress string, signerAddress string) (string, error)
	UploadBatch(data []any, contractAddress string, signerAddress string) (*BaseUriWithUris, error)
}

func NewIpfsStorage

func NewIpfsStorage(uri string) Storage

type ThirdwebSDK

type ThirdwebSDK struct {
	*ProviderHandler
	// contains filtered or unexported fields
}

func NewThirdwebSDK

func NewThirdwebSDK(rpcUrl string, options *SDKOptions) (*ThirdwebSDK, error)

func (*ThirdwebSDK) GetEdition

func (sdk *ThirdwebSDK) GetEdition(address string) (*Edition, error)

func (*ThirdwebSDK) GetNFTCollection

func (sdk *ThirdwebSDK) GetNFTCollection(address string) (*NFTCollection, error)

func (*ThirdwebSDK) GetNFTDrop

func (sdk *ThirdwebSDK) GetNFTDrop(address string) (*NFTDrop, error)

type UnmarshalError

type UnmarshalError struct {
	UnderlyingError error
	// contains filtered or unexported fields
}

func (*UnmarshalError) Error

func (m *UnmarshalError) Error() string

type UnsupportedFunctionError

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

func (*UnsupportedFunctionError) Error

func (m *UnsupportedFunctionError) Error() string

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