Search Apps Documentation Source Content File Folder Download Copy Actions Download

gnft package

Overview

Package gnft implements GRC721-compliant NFTs for GnoSwap LP positions. Each LP position in GnoSwap is represented as a unique NFT with dynamically generated SVG artwork. The contract manages ownership, transfers, and visual representation of positions while minimizing storage costs.

Functions

Approve

func Approve(cur realm, approved address, tid grc721.TokenID) error

Approve grants permission to transfer a specific token ID to another address. Parameters: - approved: address to approve - tid: token ID to approve for transfer Returns error if approval fails. Only callable when not halted.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Approve" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Approve" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

BalanceOf

func BalanceOf(owner address) (int64, error)

BalanceOf returns the number of NFTs owned by the specified address.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.BalanceOf()"

Result

Burn

func Burn(cur realm, tid grc721.TokenID)

Burn removes a specific token ID. Parameters: - tid: token ID to burn Only callable by position.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Burn" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Burn" -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Exists

func Exists(tid grc721.TokenID) bool

Exists checks if token ID exists.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.Exists()"

Result

IsApprovedForAll

func IsApprovedForAll(owner, operator address) bool

IsApprovedForAll checks if operator can manage all owner's tokens. Parameters: - owner: token owner address - operator: operator address to check Returns true if operator is approved for all owner's tokens.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.IsApprovedForAll(,)"

Result

Mint

func Mint(cur realm, to address, tid grc721.TokenID) grc721.TokenID

Mint creates new NFT and transfers to address. Parameters: - to: recipient address - tid: token ID Returns minted token ID. Only callable by position contract.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Mint" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "Mint" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Name

func Name() string

Name returns the NFT collection name.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.Name()"

Result

Render

func Render(path string) string

Render returns the HTML representation of the NFT.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.Render()"

Result

SafeTransferFrom

func SafeTransferFrom(cur realm, from, to address, tid grc721.TokenID) error

SafeTransferFrom transfers token ownership with receiver validation. Parameters: - from: current owner address - to: recipient address - tid: token ID to transfer Returns error if transfer fails. Only callable by staker contract.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SafeTransferFrom" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SafeTransferFrom" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetApprovalForAll

func SetApprovalForAll(cur realm, operator address, approved bool) error

SetApprovalForAll enables/disables operator approval for all tokens. Parameters: - operator: address to set approval for - approved: true to approve, false to revoke Returns error if operation fails. Only callable when not halted.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SetApprovalForAll" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SetApprovalForAll" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

SetTokenURI

func SetTokenURI(cur realm, tid grc721.TokenID, tURI grc721.TokenURI) (bool, error)

SetTokenURI sets the metadata URI for the specified token. Parameters: - tid: token ID - tURI: token URI Only callable by position contract.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SetTokenURI" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "SetTokenURI" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx
  

Symbol

func Symbol() string

Symbol returns the NFT symbol.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.Symbol()"

Result

TokenURI

func TokenURI(tid grc721.TokenID) (string, error)

TokenURI returns the metadata URI for the specified token ID. If stored value is in parameter format (x1,y1,x2,y2,color1,color2), it converts to full base64-encoded SVG image URI on read.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.TokenURI()"

Result

TotalSupply

func TotalSupply() int64

TotalSupply returns the total number of NFTs minted.

Command

gnokey query vm/qeval -remote "https://rpc.test11.testnets.gno.land" -data "gno.land/r/gnoswap/gnft.TotalSupply()"

Result

TransferFrom

func TransferFrom(cur realm, from, to address, tid grc721.TokenID) error

TransferFrom transfers a token from one address to another. Parameters: - from: current owner address - to: recipient address - tid: token ID Returns error if transfer fails. Only callable by staker contract.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "TransferFrom" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test11" -remote "https://rpc.test11.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test11.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/gnoswap/gnft" -func "TransferFrom" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test11" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test11.testnets.gno.land" call.tx