Search Apps Documentation Source Content File Folder Download Copy Actions Download

tokenhub package

Functions

GetAllMultiTokens

func GetAllMultiTokens() string
Execute

GetAllMultiTokens returns a string of all the multi-tokens registered

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetAllMultiTokens()"

Result

GetAllNFTs

func GetAllNFTs() string
Execute

GetAllNFTs returns a string of all the NFTs registered

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetAllNFTs()"

Result

GetAllRegistered

func GetAllRegistered() string
Execute

GetAllRegistered returns a string of all the registered tokens, NFTs and multi-tokens

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetAllRegistered()"

Result

GetAllTokenWithDetails

func GetAllTokenWithDetails() string
Execute

GetAllTokenWithDetails returns a string of all the tokens registered with their details

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetAllTokenWithDetails()"

Result

GetAllTokens

func GetAllTokens() string
Execute

GetAllTokens returns a string of all the tokens registered

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetAllTokens()"

Result

GetMultiToken

func GetMultiToken(key string) grc1155.IGRC1155
Execute

GetMultiToken returns a multi-token instance for a given key

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetMultiToken()"

Result

GetNFT

func GetNFT(key string) grc721.IGRC721
Execute

GetNFT returns an NFT instance for a given key

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetNFT()"

Result

GetToken

func GetToken(key string) *grc20.Token
Execute

GetToken returns a token instance for a given key

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetToken()"

Result

GetUserMultiTokenBalances

func GetUserMultiTokenBalances(userNameOrAddress string) string
Execute

GetUserMultiTokenBalances returns a string of all the multi-tokens the user owns

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetUserMultiTokenBalances()"

Result

GetUserMultiTokenBalancesNonZero

func GetUserMultiTokenBalancesNonZero(userNameOrAddress string) string
Execute

GetUserMultiTokenBalancesNonZero returns a string of all the multi-tokens the user owns, but only the ones that have a balance greater than 0

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetUserMultiTokenBalancesNonZero()"

Result

GetUserNFTBalances

func GetUserNFTBalances(userNameOrAddress string) string
Execute

GetUserNFTBalances returns a string of all the NFTs the user owns

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetUserNFTBalances()"

Result

GetUserTokenBalances

func GetUserTokenBalances(userNameOrAddress string) string
Execute

GetUserTokenBalances returns a string of all the grc20 tokens the user owns

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetUserTokenBalances()"

Result

GetUserTokenBalancesNonZero

func GetUserTokenBalancesNonZero(userNameOrAddress string) string
Execute

GetUserTokenBalancesNonZero returns a string of all the grc20 tokens the user owns, but only the ones that have a balance greater than 0

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.GetUserTokenBalancesNonZero()"

Result

MustGetMultiToken

func MustGetMultiToken(key string) grc1155.IGRC1155
Execute

MustGetMultiToken returns a multi-token instance for a given key, panics if the multi-token is not found

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.MustGetMultiToken()"

Result

MustGetNFT

func MustGetNFT(key string) grc721.IGRC721
Execute

MustGetNFT returns an NFT instance for a given key, panics if the NFT is not found

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.MustGetNFT()"

Result

MustGetToken

func MustGetToken(key string) *grc20.Token
Execute

MustGetToken returns a token instance for a given key, panics if the token is not found

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.MustGetToken()"

Result

RegisterMultiToken

func RegisterMultiToken(cur realm, mtGetter grc1155.MultiTokenGetter, tokenID string) error
Execute

RegisterMultiToken is a function that registers a multi-token in an avl.Tree The avl.Tree value is a struct defined in this realm. It contains not only the getter (like other token types) but also the tokenID

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/matijamarjanovic/tokenhub" -func "RegisterMultiToken" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test10" -remote "https://rpc.test10.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test10.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/matijamarjanovic/tokenhub" -func "RegisterMultiToken" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test10" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test10.testnets.gno.land" call.tx
  

RegisterNFT

func RegisterNFT(cur realm, nftGetter grc721.NFTGetter, collection string, tokenId string) error
Execute

RegisterNFT is a function that registers an NFT in an avl.Tree

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/matijamarjanovic/tokenhub" -func "RegisterNFT" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test10" -remote "https://rpc.test10.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test10.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/matijamarjanovic/tokenhub" -func "RegisterNFT" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test10" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test10.testnets.gno.land" call.tx
  

RegisterToken

func RegisterToken(cur realm, token *grc20.Token, slug string) string
Execute

RegisterToken is a function that uses gno.land/r/demo/defi/grc20reg to register a token It uses the slug to construct a key and then registers the token in the registry The logic is the same as in grc20reg, but it's done here so the key path is callers pkgpath and not of this realm After doing so, the token hub realm uses grc20reg's registry as a read-only avl.Tree Note: register token returns the key path that can be used to retrieve the token

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/matijamarjanovic/tokenhub" -func "RegisterToken" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" -broadcast -chainid "test10" -remote "https://rpc.test10.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.test10.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/matijamarjanovic/tokenhub" -func "RegisterToken" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 5000000 -send "" ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "test10" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.test10.testnets.gno.land" call.tx
  

Render

func Render(path string) string
Execute

Param

Command

gnokey query vm/qeval -remote "https://rpc.test10.testnets.gno.land" -data "gno.land/r/matijamarjanovic/tokenhub.Render()"

Result