chaincode

package
v0.0.0-...-d669a3f Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Approval

type Approval struct {
	Owner    string `json:"owner"`
	Operator string `json:"operator"`
	Approved bool   `json:"approved"`
}

type Nft

type Nft struct {
	TokenId  string `json:"tokenId"`
	Owner    string `json:"owner"`
	TokenURI string `json:"tokenURI"`
	Approved string `json:"approved"`
}

Define structs to be 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 param {String} operator The new approved client param {String} tokenId the non-fungible token to approve returns {Boolean} Return whether the approval was successful or not

func (*TokenERC721Contract) BalanceOf

BalanceOf counts all non-fungible tokens assigned to an owner param owner {String} An owner for whom to query the balance returns {int} The number of non-fungible tokens owned by the owner, possibly zero

func (*TokenERC721Contract) Burn

Burn a non-fungible token param {String} tokenId Unique ID of a non-fungible token returns {Boolean} Return whether the burn was successful or not

func (*TokenERC721Contract) ClientAccountBalance

func (c *TokenERC721Contract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)

ClientAccountBalance returns the balance of the requesting client's account. returns {Number} Returns the account balance

func (*TokenERC721Contract) ClientAccountID

func (*TokenERC721Contract) GetApproved

GetApproved returns the approved client for a single non-fungible token param {String} tokenId the non-fungible token to find the approved client for returns {Object} Return the approved client for this non-fungible token, or null if there is none

func (*TokenERC721Contract) Initialize

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 param {String} owner The client that owns the non-fungible tokens param {String} operator The client that acts on behalf of the owner returns {Boolean} Return true if the operator is an approved operator for the owner, false otherwise

func (*TokenERC721Contract) MintWithTokenURI

func (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContextInterface, tokenId string, tokenURI string) (*Nft, error)

func (*TokenERC721Contract) Name

func (*TokenERC721Contract) OwnerOf

OwnerOf finds the owner of a non-fungible token param {String} tokenId The identifier for a non-fungible token returns {String} Return 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 param {String} operator A client to add to the set of authorized operators param {Boolean} approved True if the operator is approved, false to revoke approval returns {Boolean} Return whether the approval was successful or not

func (*TokenERC721Contract) Symbol

func (*TokenERC721Contract) TokenURI

func (*TokenERC721Contract) TotalSupply

func (*TokenERC721Contract) TransferFrom

func (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, tokenId string) (bool, error)

type Transfer

type Transfer struct {
	From    string `json:"from"`
	To      string `json:"to"`
	TokenId string `json:"tokenId"`
}

Jump to

Keyboard shortcuts

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