Documentation
¶
Index ¶
- type Approval
- type Nft
- type TokenERC721Contract
- func (c *TokenERC721Contract) Approve(ctx contractapi.TransactionContextInterface, operator string, tokenID string) (bool, error)
- func (c *TokenERC721Contract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
- func (c *TokenERC721Contract) Burn(ctx contractapi.TransactionContextInterface, tokenID string) (bool, error)
- func (c *TokenERC721Contract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)
- func (c *TokenERC721Contract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)
- func (c *TokenERC721Contract) GetApproved(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
- func (c *TokenERC721Contract) Initialize(ctx contractapi.TransactionContextInterface, name string, symbol string) (bool, error)
- func (c *TokenERC721Contract) IsApprovedForAll(ctx contractapi.TransactionContextInterface, owner string, operator string) (bool, error)
- func (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContextInterface, tokenID string, tokenURI string) (*Nft, error)
- func (c *TokenERC721Contract) Name(ctx contractapi.TransactionContextInterface) (string, error)
- func (c *TokenERC721Contract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
- func (c *TokenERC721Contract) SetApprovalForAll(ctx contractapi.TransactionContextInterface, operator string, approved bool) (bool, error)
- func (c *TokenERC721Contract) Symbol(ctx contractapi.TransactionContextInterface) (string, error)
- func (c *TokenERC721Contract) TokenURI(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
- func (c *TokenERC721Contract) TotalSupply(ctx contractapi.TransactionContextInterface) int
- func (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, ...) (bool, error)
- type Transfer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Nft ¶
type Nft struct {
TokenID string `json:"tokenId"`
Owner string `json:"owner"`
TokenURI string `json:"tokenURI"`
Approved string `json:"approved"`
}
Nft defines the non-fungible token struct used by chaincode.
type TokenERC721Contract ¶
type TokenERC721Contract struct {
contractapi.Contract
}
TokenERC721Contract contract for managing CRUD operations
func (*TokenERC721Contract) Approve ¶
func (c *TokenERC721Contract) Approve(ctx contractapi.TransactionContextInterface, operator string, tokenID string) (bool, error)
Approve changes or reaffirms the approved client for a non-fungible token. operator is the new approved client. tokenID is the non-fungible token to approve. Returns true if the approval was successful.
func (*TokenERC721Contract) BalanceOf ¶
func (c *TokenERC721Contract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int
BalanceOf counts all non-fungible tokens assigned to an owner. owner is the address for whom to query the balance. Returns the number of non-fungible tokens owned by owner, possibly zero.
func (*TokenERC721Contract) Burn ¶
func (c *TokenERC721Contract) Burn(ctx contractapi.TransactionContextInterface, tokenID string) (bool, error)
Burn destroys a non-fungible token. tokenID is the unique ID of the non-fungible token to burn. Returns true if the burn was successful.
func (*TokenERC721Contract) ClientAccountBalance ¶
func (c *TokenERC721Contract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)
ClientAccountBalance returns the balance of the requesting client's account.
func (*TokenERC721Contract) ClientAccountID ¶
func (c *TokenERC721Contract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)
ClientAccountID returns the id of the requesting client's account. In this implementation, the client account ID is the clientId itself. Users can use this function to get their own account id, which they can then give to others as the payment address
func (*TokenERC721Contract) GetApproved ¶
func (c *TokenERC721Contract) GetApproved(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
GetApproved returns the approved client for a single non-fungible token. tokenID is the non-fungible token to find the approved client for. Returns the approved client for this non-fungible token, or an empty string if there is none.
func (*TokenERC721Contract) Initialize ¶
func (c *TokenERC721Contract) Initialize(ctx contractapi.TransactionContextInterface, name string, symbol string) (bool, error)
Initialize sets information for a token and initializes the contract. name is the name of the token. symbol is the symbol of the token.
func (*TokenERC721Contract) IsApprovedForAll ¶
func (c *TokenERC721Contract) IsApprovedForAll(ctx contractapi.TransactionContextInterface, owner string, operator string) (bool, error)
IsApprovedForAll returns if a client is an authorized operator for another client. owner is the client that owns the non-fungible tokens. operator is the client that acts on behalf of the owner. Returns true if operator is an approved operator for owner, false otherwise.
func (*TokenERC721Contract) MintWithTokenURI ¶
func (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContextInterface, tokenID string, tokenURI string) (*Nft, error)
MintWithTokenURI creates a new non-fungible token. tokenID is the unique ID of the non-fungible token to be minted. tokenURI is the URI containing metadata of the minted non-fungible token. Returns the minted non-fungible token.
func (*TokenERC721Contract) Name ¶
func (c *TokenERC721Contract) Name(ctx contractapi.TransactionContextInterface) (string, error)
Name returns a descriptive name for a collection of non-fungible tokens in this contract.
func (*TokenERC721Contract) OwnerOf ¶
func (c *TokenERC721Contract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
OwnerOf finds the owner of a non-fungible token. tokenID is the identifier for a non-fungible token. Returns the owner of the non-fungible token.
func (*TokenERC721Contract) SetApprovalForAll ¶
func (c *TokenERC721Contract) SetApprovalForAll(ctx contractapi.TransactionContextInterface, operator string, approved bool) (bool, error)
SetApprovalForAll enables or disables approval for a third party ("operator") to manage all the message sender's assets. operator is a client to add to the set of authorized operators. approved is true if the operator is approved, false to revoke approval. Returns true if the approval was successful.
func (*TokenERC721Contract) Symbol ¶
func (c *TokenERC721Contract) Symbol(ctx contractapi.TransactionContextInterface) (string, error)
Symbol returns an abbreviated name for non-fungible tokens in this contract.
func (*TokenERC721Contract) TokenURI ¶
func (c *TokenERC721Contract) TokenURI(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)
TokenURI returns a distinct Uniform Resource Identifier (URI) for a given token. tokenID is the identifier for the non-fungible token.
func (*TokenERC721Contract) TotalSupply ¶
func (c *TokenERC721Contract) TotalSupply(ctx contractapi.TransactionContextInterface) int
TotalSupply counts non-fungible tokens tracked by this contract. Returns a count of valid non-fungible tokens tracked by this contract, where each one has an assigned and queryable owner.
func (*TokenERC721Contract) TransferFrom ¶
func (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, tokenID string) (bool, error)
TransferFrom transfers the ownership of a non-fungible token from one owner to another owner. from is the current owner of the non-fungible token. to is the new owner. tokenID is the non-fungible token to transfer. Returns true if the transfer was successful.