{"modulePath":"github.com/hyperledger/fabric-samples/token-erc-721/chaincode-go","version":"v0.0.0-20260918092737-5789681b4f4d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package chaincode\n\n## Types\n\n```go\ntype Approval struct {\n\tOwner    string `json:\"owner\"`\n\tOperator string `json:\"operator\"`\n\tApproved bool   `json:\"approved\"`\n}\n```\n\n```go\ntype Nft struct {\n\tTokenID  string `json:\"tokenId\"`\n\tOwner    string `json:\"owner\"`\n\tTokenURI string `json:\"tokenURI\"`\n\tApproved string `json:\"approved\"`\n}\n```\nNft defines the non-fungible token struct used by chaincode.\n\n```go\ntype TokenERC721Contract struct {\n\tcontractapi.Contract\n}\n```\nTokenERC721Contract contract for managing CRUD operations\n\n```go\nfunc (c *TokenERC721Contract) Approve(ctx contractapi.TransactionContextInterface, operator string, tokenID string) (bool, error)\n```\nApprove 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.\n\n```go\nfunc (c *TokenERC721Contract) BalanceOf(ctx contractapi.TransactionContextInterface, owner string) int\n```\nBalanceOf 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.\n\n```go\nfunc (c *TokenERC721Contract) Burn(ctx contractapi.TransactionContextInterface, tokenID string) (bool, error)\n```\nBurn destroys a non-fungible token. tokenID is the unique ID of the non-fungible token to burn. Returns true if the burn was successful.\n\n```go\nfunc (c *TokenERC721Contract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)\n```\nClientAccountBalance returns the balance of the requesting client's account.\n\n```go\nfunc (c *TokenERC721Contract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)\n```\nClientAccountID 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\n\n```go\nfunc (c *TokenERC721Contract) GetApproved(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)\n```\nGetApproved 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.\n\n```go\nfunc (c *TokenERC721Contract) Initialize(ctx contractapi.TransactionContextInterface, name string, symbol string) (bool, error)\n```\nInitialize sets information for a token and initializes the contract. name is the name of the token. symbol is the symbol of the token.\n\n```go\nfunc (c *TokenERC721Contract) IsApprovedForAll(ctx contractapi.TransactionContextInterface, owner string, operator string) (bool, error)\n```\nIsApprovedForAll 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.\n\n```go\nfunc (c *TokenERC721Contract) MintWithTokenURI(ctx contractapi.TransactionContextInterface, tokenID string, tokenURI string) (*Nft, error)\n```\nMintWithTokenURI 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.\n\n```go\nfunc (c *TokenERC721Contract) Name(ctx contractapi.TransactionContextInterface) (string, error)\n```\nName returns a descriptive name for a collection of non-fungible tokens in this contract.\n\n```go\nfunc (c *TokenERC721Contract) OwnerOf(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)\n```\nOwnerOf 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.\n\n```go\nfunc (c *TokenERC721Contract) SetApprovalForAll(ctx contractapi.TransactionContextInterface, operator string, approved bool) (bool, error)\n```\nSetApprovalForAll 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.\n\n```go\nfunc (c *TokenERC721Contract) Symbol(ctx contractapi.TransactionContextInterface) (string, error)\n```\nSymbol returns an abbreviated name for non-fungible tokens in this contract.\n\n```go\nfunc (c *TokenERC721Contract) TokenURI(ctx contractapi.TransactionContextInterface, tokenID string) (string, error)\n```\nTokenURI returns a distinct Uniform Resource Identifier (URI) for a given token. tokenID is the identifier for the non-fungible token.\n\n```go\nfunc (c *TokenERC721Contract) TotalSupply(ctx contractapi.TransactionContextInterface) int\n```\nTotalSupply 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.\n\n```go\nfunc (c *TokenERC721Contract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, tokenID string) (bool, error)\n```\nTransferFrom 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.\n\n```go\ntype Transfer struct {\n\tFrom    string `json:\"from\"`\n\tTo      string `json:\"to\"`\n\tTokenID string `json:\"tokenId\"`\n}\n```\n\n","path":"github.com/hyperledger/fabric-samples/token-erc-721/chaincode-go/chaincode","name":"chaincode","synopsis":"","isRedistributable":true}
