znft

package
v1.13.14 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 25 Imported by: 0

README

0Chain dStorage backed NFT API

Components and legend

studio client - UI for creating NFTs
nft_factory_contract - FactoryModuleERC721, FactoryModuleERC721Fixed, FactoryModuleERC721Random
nft_contract - DStorageERC721, DStorageERC721Fixed, DStorageERC721Pack, DStorageERC721Random
royalty_contract - is to handle routing for fee sharing
0chain_api - blobber storage API
0nft - is the service for exposing files on 0chain as a normal public url
auth ticker - is the auth ticket generated on the 0chain side and passed to the 0nft service

Current deployments

Network: Rinkeby

Factory: 0xD98602749e7f46036d496e8D3deb6eb9F90996a6

Create a new NFT collection

NFT View

NFT Trading

nft_dstorage_activity_diagram.png

Documentation

Index

Constants

View Source
const (
	ContractStorageERC721Name       = "StorageERC721"
	ContractStorageERC721FixedName  = "StorageERC721Fixed"
	ContractStorageERC721PackName   = "StorageERC721Pack"
	ContractStorageERC721RandomName = "StorageERC721Random"
	Withdraw                        = "withdraw"
	SetReceiver                     = "setReceiver"
	SetRoyalty                      = "setRoyalty"
	SetMintable                     = "setMintable"
	SetAllocation                   = "setAllocation"
	SetURI                          = "setURI"
	TokenURIFallback                = "tokenURIFallback"
	TokenURI                        = "tokenURI"
	Price                           = "price"
	Mint                            = "mint"
	MintOwner                       = "mintOwner"
	RoyaltyInfo                     = "royaltyInfo"
)
View Source
const (
	ConfigFile = "config.yaml"
	WalletDir  = "wallets"
)

Variables

Functions

func AccountExists

func AccountExists(homedir, address string) bool

AccountExists checks if account exists

func CreateEthClient

func CreateEthClient(ethereumNodeURL string) (*ethclient.Client, error)

func CreateKeyStorage

func CreateKeyStorage(homedir, password string) error

CreateKeyStorage create, restore or unlock key storage

func DeleteAccount

func DeleteAccount(homedir, address string) bool

DeleteAccount deletes account from wallet

func GetConfigDir

func GetConfigDir() string

func ImportAccount

func ImportAccount(homedir, mnemonic, password string) (string, error)

ImportAccount imports account using mnemonic password is used to lock and unlock keystorage before signing transaction

func ListStorageAccounts

func ListStorageAccounts(homedir string) []common.Address

ListStorageAccounts List available accounts

func UpdateClientEthereumAddress

func UpdateClientEthereumAddress(homedir, address string) (err error)

UpdateClientEthereumAddress updates Ethereum address

Types

type Configuration

type Configuration struct {
	FactoryAddress                   string // FactoryAddress address
	FactoryModuleERC721Address       string // FactoryModuleERC721Address address
	FactoryModuleERC721PackedAddress string // FactoryModuleERC721PackedAddress address
	FactoryModuleERC721FixedAddress  string // FactoryModuleERC721FixedAddress address
	FactoryModuleERC721RandomAddress string // FactoryModuleERC721RandomAddress address
	EthereumNodeURL                  string // EthereumNodeURL URL of ethereum RPC node (infura or alchemy)
	WalletAddress                    string // WalletAddress client address
	VaultPassword                    string // VaultPassword used to sign transactions on behalf of the client
	Homedir                          string // Homedir is a client config folder
	Value                            int64  // Value to execute Ethereum smart contracts (default = 0)
}

type FactoryERC721

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

func (*FactoryERC721) CreateToken

func (s *FactoryERC721) CreateToken(owner, name, symbol, uri string, max *big.Int, data []byte) error

type FactoryFixed

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

func (*FactoryFixed) CreateToken

func (s *FactoryFixed) CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error

type FactoryPack

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

func (*FactoryPack) CreateToken

func (s *FactoryPack) CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error

type FactoryRandom

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

func (*FactoryRandom) CreateToken

func (s *FactoryRandom) CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error

type IFactoryERC721

type IFactoryERC721 interface {
	CreateToken(owner, name, symbol, uri string, max *big.Int, data []byte) error
}

type IFactoryFixed

type IFactoryFixed interface {
	CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error
}

type IFactoryPack

type IFactoryPack interface {
	CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error
}

type IFactoryRandom

type IFactoryRandom interface {
	CreateToken(owner, name, symbol, uri string, max, price, batch *big.Int, calldata []byte) error
}

type IStorageECR721

type IStorageECR721 interface {
	Withdraw() error
	SetReceiver(receiver string) error
	SetRoyalty(sum *big.Int) error
	SetMintable(status bool) error
	SetAllocation(allocation string) error
	SetURI(uri string) error
	SetURIFallback(uri string) error
	TokenURIFallback(token *big.Int) (string, error)
	Price() (*big.Int, error)
	Mint(amount *big.Int) error
	MintOwner(amount *big.Int) error
	RoyaltyInfo(tokenId, salePrice *big.Int) (string, *big.Int, error)
	Max() (*big.Int, error) // Fields
	Total() (*big.Int, error)
	Batch() (*big.Int, error)
	Mintable() (bool, error)
	Allocation() (string, error)
	Uri() (string, error)
	UriFallback() (string, error)
	Royalty() (*big.Int, error)
	Receiver() (string, error)
}

type IStorageECR721Fixed

type IStorageECR721Fixed interface {
	IStorageECR721
}

type IStorageECR721Pack

type IStorageECR721Pack interface {
	IStorageECR721Fixed
	MintOwner(amount *big.Int) error
	Mint(amount *big.Int) error
	Reveal(tokenId *big.Int) error
	Redeem(tokenId *big.Int) error
	TokenURI(tokenId *big.Int) (string, error)
	TokenURIFallback(tokenId *big.Int) (string, error)
	SetClosed(closed string) error
	SetOpened(opened string) error
}

type IStorageECR721Random

type IStorageECR721Random interface {
	MintOwner(amount *big.Int) error
	Mint(amount *big.Int) error
	Reveal(tokens []*big.Int) error
	TokenURI(token *big.Int) (string, error)
	TokenURIFallback(token *big.Int) (string, error)
	SetHidden(hidden string) error
	SetPack(address common.Address) error
	SetRevealable(status bool) error
	Price() (*big.Int, error)
}

type StorageECR721

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

func (*StorageECR721) Allocation

func (s *StorageECR721) Allocation() (string, error)

func (*StorageECR721) Batch

func (s *StorageECR721) Batch() (*big.Int, error)

func (*StorageECR721) Max

func (s *StorageECR721) Max() (*big.Int, error)

func (*StorageECR721) Mint

func (s *StorageECR721) Mint(amount *big.Int) error

func (*StorageECR721) MintOwner

func (s *StorageECR721) MintOwner(amount *big.Int) error

func (*StorageECR721) Mintable

func (s *StorageECR721) Mintable() (bool, error)

func (*StorageECR721) Price

func (s *StorageECR721) Price() (*big.Int, error)

Price returns price

func (*StorageECR721) Receiver

func (s *StorageECR721) Receiver() (string, error)

func (*StorageECR721) Royalty

func (s *StorageECR721) Royalty() (*big.Int, error)

func (*StorageECR721) RoyaltyInfo

func (s *StorageECR721) RoyaltyInfo(tokenId, salePrice *big.Int) (string, *big.Int, error)

func (*StorageECR721) SetAllocation

func (s *StorageECR721) SetAllocation(allocation string) error

SetAllocation updates allocation

func (*StorageECR721) SetMintable

func (s *StorageECR721) SetMintable(status bool) error

SetMintable updates mintable state

func (*StorageECR721) SetReceiver

func (s *StorageECR721) SetReceiver(receiver string) error

SetReceiver eth balance from token contract - setReceiver(address receiver_)

func (*StorageECR721) SetRoyalty

func (s *StorageECR721) SetRoyalty(sum *big.Int) error

SetRoyalty eth balance from token contract - setReceiver(address receiver_)

func (*StorageECR721) SetURI

func (s *StorageECR721) SetURI(uri string) error

SetURI updates uri

func (*StorageECR721) SetURIFallback

func (s *StorageECR721) SetURIFallback(uri string) error

func (*StorageECR721) TokenURIFallback

func (s *StorageECR721) TokenURIFallback(token *big.Int) (string, error)

func (*StorageECR721) Total

func (s *StorageECR721) Total() (*big.Int, error)

func (*StorageECR721) Uri

func (s *StorageECR721) Uri() (string, error)

func (*StorageECR721) UriFallback

func (s *StorageECR721) UriFallback() (string, error)

func (*StorageECR721) Withdraw

func (s *StorageECR721) Withdraw() error

Withdraw eth balance from token contract - withdraw()

type StorageECR721Fixed

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

func (*StorageECR721Fixed) Allocation

func (s *StorageECR721Fixed) Allocation() (string, error)

func (*StorageECR721Fixed) Batch

func (s *StorageECR721Fixed) Batch() (*big.Int, error)

func (*StorageECR721Fixed) Max

func (s *StorageECR721Fixed) Max() (*big.Int, error)

func (*StorageECR721Fixed) Mint

func (s *StorageECR721Fixed) Mint(amount *big.Int) error

func (*StorageECR721Fixed) MintOwner

func (s *StorageECR721Fixed) MintOwner(amount *big.Int) error

func (*StorageECR721Fixed) Mintable

func (s *StorageECR721Fixed) Mintable() (bool, error)

func (*StorageECR721Fixed) Price

func (s *StorageECR721Fixed) Price() (*big.Int, error)

Price returns price

func (*StorageECR721Fixed) Receiver

func (s *StorageECR721Fixed) Receiver() (string, error)

func (*StorageECR721Fixed) Royalty

func (s *StorageECR721Fixed) Royalty() (*big.Int, error)

func (*StorageECR721Fixed) RoyaltyInfo

func (s *StorageECR721Fixed) RoyaltyInfo(tokenId, salePrice *big.Int) (string, *big.Int, error)

func (*StorageECR721Fixed) SetAllocation

func (s *StorageECR721Fixed) SetAllocation(allocation string) error

SetAllocation updates allocation

func (*StorageECR721Fixed) SetMintable

func (s *StorageECR721Fixed) SetMintable(status bool) error

SetMintable updates mintable state

func (*StorageECR721Fixed) SetReceiver

func (s *StorageECR721Fixed) SetReceiver(receiver string) error

SetReceiver eth balance from token contract - setReceiver(address receiver_)

func (*StorageECR721Fixed) SetRoyalty

func (s *StorageECR721Fixed) SetRoyalty(sum *big.Int) error

SetRoyalty eth balance from token contract - setReceiver(address receiver_)

func (*StorageECR721Fixed) SetURI

func (s *StorageECR721Fixed) SetURI(uri string) error

SetURI updates uri

func (*StorageECR721Fixed) SetURIFallback

func (s *StorageECR721Fixed) SetURIFallback(uri string) error

func (*StorageECR721Fixed) TokenURI

func (s *StorageECR721Fixed) TokenURI(token *big.Int) (string, error)

func (*StorageECR721Fixed) TokenURIFallback

func (s *StorageECR721Fixed) TokenURIFallback(token *big.Int) (string, error)

func (*StorageECR721Fixed) Total

func (s *StorageECR721Fixed) Total() (*big.Int, error)

func (*StorageECR721Fixed) Uri

func (s *StorageECR721Fixed) Uri() (string, error)

func (*StorageECR721Fixed) UriFallback

func (s *StorageECR721Fixed) UriFallback() (string, error)

func (*StorageECR721Fixed) Withdraw

func (s *StorageECR721Fixed) Withdraw() error

Withdraw eth balance from token contract - withdraw()

type StorageECR721Pack

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

func (*StorageECR721Pack) Allocation

func (s *StorageECR721Pack) Allocation() (string, error)

func (*StorageECR721Pack) Batch

func (s *StorageECR721Pack) Batch() (*big.Int, error)

func (*StorageECR721Pack) Max

func (s *StorageECR721Pack) Max() (*big.Int, error)

func (*StorageECR721Pack) Mint

func (s *StorageECR721Pack) Mint(amount *big.Int) error

func (*StorageECR721Pack) MintOwner

func (s *StorageECR721Pack) MintOwner(amount *big.Int) error

func (*StorageECR721Pack) Mintable

func (s *StorageECR721Pack) Mintable() (bool, error)

func (*StorageECR721Pack) Price

func (s *StorageECR721Pack) Price() (*big.Int, error)

func (*StorageECR721Pack) Receiver

func (s *StorageECR721Pack) Receiver() (string, error)

func (*StorageECR721Pack) Redeem

func (s *StorageECR721Pack) Redeem(tokenId *big.Int) error

func (*StorageECR721Pack) Reveal

func (s *StorageECR721Pack) Reveal(tokenId *big.Int) error

func (*StorageECR721Pack) Royalty

func (s *StorageECR721Pack) Royalty() (*big.Int, error)

func (*StorageECR721Pack) RoyaltyInfo

func (s *StorageECR721Pack) RoyaltyInfo(tokenId, salePrice *big.Int) (string, *big.Int, error)

func (*StorageECR721Pack) SetAllocation

func (s *StorageECR721Pack) SetAllocation(allocation string) error

func (*StorageECR721Pack) SetClosed

func (s *StorageECR721Pack) SetClosed(closed string) error

func (*StorageECR721Pack) SetMintable

func (s *StorageECR721Pack) SetMintable(status bool) error

func (*StorageECR721Pack) SetOpened

func (s *StorageECR721Pack) SetOpened(opened string) error

func (*StorageECR721Pack) SetReceiver

func (s *StorageECR721Pack) SetReceiver(receiver string) error

func (*StorageECR721Pack) SetRoyalty

func (s *StorageECR721Pack) SetRoyalty(sum *big.Int) error

func (*StorageECR721Pack) SetURI

func (s *StorageECR721Pack) SetURI(uri string) error

func (*StorageECR721Pack) SetURIFallback

func (s *StorageECR721Pack) SetURIFallback(uri string) error

func (*StorageECR721Pack) TokenURI

func (s *StorageECR721Pack) TokenURI(tokenId *big.Int) (string, error)

func (*StorageECR721Pack) TokenURIFallback

func (s *StorageECR721Pack) TokenURIFallback(tokenId *big.Int) (string, error)

func (*StorageECR721Pack) Total

func (s *StorageECR721Pack) Total() (*big.Int, error)

func (*StorageECR721Pack) Uri

func (s *StorageECR721Pack) Uri() (string, error)

func (*StorageECR721Pack) UriFallback

func (s *StorageECR721Pack) UriFallback() (string, error)

func (*StorageECR721Pack) Withdraw

func (s *StorageECR721Pack) Withdraw() error

type StorageECR721Random

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

func (*StorageECR721Random) Mint

func (s *StorageECR721Random) Mint(amount *big.Int) error

func (*StorageECR721Random) MintOwner

func (s *StorageECR721Random) MintOwner(amount *big.Int) error

func (*StorageECR721Random) Price

func (s *StorageECR721Random) Price() (*big.Int, error)

func (*StorageECR721Random) Reveal

func (s *StorageECR721Random) Reveal(tokens []*big.Int) error

func (*StorageECR721Random) SetHidden

func (s *StorageECR721Random) SetHidden(hidden string) error

func (*StorageECR721Random) SetPack

func (s *StorageECR721Random) SetPack(address common.Address) error

func (*StorageECR721Random) SetRevealable

func (s *StorageECR721Random) SetRevealable(status bool) error

func (*StorageECR721Random) TokenURI

func (s *StorageECR721Random) TokenURI(token *big.Int) (string, error)

func (*StorageECR721Random) TokenURIFallback

func (s *StorageECR721Random) TokenURIFallback(token *big.Int) (string, error)

type Znft

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

func NewNFTApplication

func NewNFTApplication(c *Configuration) *Znft

func (*Znft) CreateFactoryERC721FixedSession

func (app *Znft) CreateFactoryERC721FixedSession(ctx context.Context, addr string) (IFactoryFixed, error)

func (*Znft) CreateFactoryERC721PackSession

func (app *Znft) CreateFactoryERC721PackSession(ctx context.Context, addr string) (IFactoryPack, error)

func (*Znft) CreateFactoryERC721RandomSession

func (app *Znft) CreateFactoryERC721RandomSession(ctx context.Context, addr string) (IFactoryRandom, error)

func (*Znft) CreateFactoryERC721Session

func (app *Znft) CreateFactoryERC721Session(ctx context.Context, addr string) (IFactoryERC721, error)

func (*Znft) CreateStorageERC721FixedSession

func (app *Znft) CreateStorageERC721FixedSession(ctx context.Context, addr string) (IStorageECR721Fixed, error)

func (*Znft) CreateStorageERC721PackSession

func (app *Znft) CreateStorageERC721PackSession(ctx context.Context, addr string) (IStorageECR721Pack, error)

func (*Znft) CreateStorageERC721RandomSession

func (app *Znft) CreateStorageERC721RandomSession(ctx context.Context, addr string) (IStorageECR721Random, error)

func (*Znft) CreateStorageERC721Session

func (app *Znft) CreateStorageERC721Session(ctx context.Context, addr string) (IStorageECR721, error)

Jump to

Keyboard shortcuts

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