Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

market/v1 package

Overview

Package market trades Launchpad NFTs: fixed-price listings and funded offers. A sale pays the seller, the treasury and the collection's royalty receivers inside the same transaction. The realm holds only the escrow of open offers, which their buyers can always take back, and has no admin. It keeps open orders only: a closed one is deleted, so its storage deposit is released, and its history is the event log.

Functions

AcceptOffer

func AcceptOffer(cur realm, id string, number int64, proof, currencyKey string, price int64)

AcceptOffer sells the caller's token number to an open offer. proof is the comma-separated Merkle path of the token's trait for a trait offer, and empty otherwise. currencyKey and price are the terms the seller read: an offer on other terms, such as an ID the seller never saw, buys nothing. The caller must first approve this realm in the NFT ledger.

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/samcrew/launchpad/market/v1" -func "AcceptOffer" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "AcceptOffer" -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Buy

func Buy(cur realm, id, currencyKey string, price int64)

Buy pays a listing's exact price and moves the token to the caller. currencyKey and price are the terms the buyer read: a listing on other terms, such as an ID the buyer never saw, takes nothing.

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/samcrew/launchpad/market/v1" -func "Buy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "Buy" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

BuyerOffersJSON

func BuyerOffersJSON(buyer, afterID string, size int64) string

BuyerOffersJSON reads an account's open offers, oldest first, starting after the offer ID afterID ("" starts from the oldest).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.BuyerOffersJSON(,,)"

Result

Cancel

func Cancel(cur realm, id string)

Cancel withdraws a listing. The seller can always do it, paused market or not. Anyone can clear a listing whose seller no longer owns the token, or one that expired more than graceToClose ago; the chain returns the storage deposit of what a call frees to its caller, so clearing pays whoever does it.

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/samcrew/launchpad/market/v1" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "Cancel" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

CancelOffer

func CancelOffer(cur realm, id string)

CancelOffer takes back the caller's own open offer, expired or not.

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/samcrew/launchpad/market/v1" -func "CancelOffer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "CancelOffer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

CollectionListingsJSON

func CollectionListingsJSON(collection string, afterNumber, size int64) string

CollectionListingsJSON reads a collection's open listings in token number order, starting after the token number afterNumber (0 starts from the first).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.CollectionListingsJSON(,,)"

Result

CollectionOffersJSON

func CollectionOffersJSON(collection, afterID string, size int64) string

CollectionOffersJSON reads a collection's open offers of every kind, oldest first, starting after the offer ID afterID ("" starts from the oldest).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.CollectionOffersJSON(,,)"

Result

EscrowOf

func EscrowOf(currencyKey string) int64

EscrowOf is the total of open offers in a currency.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.EscrowOf()"

Result

ExpireOffer

func ExpireOffer(cur realm, id string)

ExpireOffer returns to its buyer the escrow of an offer that expired more than graceToClose ago. Anyone may call it: the price goes to the buyer, and the chain pays the caller the storage deposit of the bytes the offer occupied, so for a week after expiry only the buyer, with CancelOffer, takes its own offer back.

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/samcrew/launchpad/market/v1" -func "ExpireOffer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "ExpireOffer" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

List

func List(cur realm, collection string, number, price, expiresAt int64, currencyKey string, maxFeeBPS int64) string

List offers the caller's token for sale and returns the listing ID. The caller must first approve this realm in the NFT ledger, and names the highest protocol fee it accepts; the fee in force is pinned on the listing. A new listing replaces the token's previous one.

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/samcrew/launchpad/market/v1" -func "List" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "List" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

ListingJSON

func ListingJSON(id string) string

ListingJSON is an open listing, or "null" once it is closed.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.ListingJSON()"

Result

ListingsJSON

func ListingsJSON(before string, size int64) string

ListingsJSON reads every open listing, newest first, starting below the listing ID before ("" starts from the newest).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.ListingsJSON(,)"

Result

MakeOffer

func MakeOffer(cur realm, kind, collection string, number int64, trait string, price, expiresAt int64, currencyKey string, maxFeeBPS int64) string

MakeOffer escrows price and returns the offer ID. kind selects what the offer is for: number is set for a token offer, trait for a trait offer, and both are zero and empty otherwise. A trait offer needs a collection whose creator committed its traits. The protocol fee in force is pinned on the offer; it comes out of what the seller receives, never on top of the price, and maxFeeBPS is the highest the buyer lets a seller be charged.

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/samcrew/launchpad/market/v1" -func "MakeOffer" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/samcrew/launchpad/market/v1" -func "MakeOffer" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

OfferJSON

func OfferJSON(id string) string

OfferJSON is an open offer, or "null" once it is closed. An open offer can be past its expiry: it then only waits for its refund.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.OfferJSON()"

Result

OffersJSON

func OffersJSON(before string, size int64) string

OffersJSON reads every open offer, newest first, starting below the offer ID before ("" starts from the newest).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.OffersJSON(,)"

Result

Render

func Render(path string) string

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.Render()"

Result

SellerListingsJSON

func SellerListingsJSON(seller, afterID string, size int64) string

SellerListingsJSON reads an account's open listings, oldest first, starting after the listing ID afterID ("" starts from the oldest).

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.SellerListingsJSON(,,)"

Result

TermsJSON

func TermsJSON(collection string, price int64) string

TermsJSON is what a sale costs now: the protocol fee a new listing would pin, and how a price would split for the collection. A fee of -1 means the lane is closed; config's ActionStatusJSON tells whether the market lane accepts new orders right now.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.TermsJSON(,)"

Result

TokenListingJSON

func TokenListingJSON(collection string, number int64) string

TokenListingJSON is the open listing of a token, or "null".

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.TokenListingJSON(,)"

Result

TraitLeaf

func TraitLeaf(collection string, number int64, trait string) merkle.Hash

TraitLeaf is the Merkle leaf that proves a token carries a trait, as committed by the collection's creator in the NFT ledger.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.TraitLeaf(,,)"

Result

GetListing

func GetListing(id string) Listing

GetListing returns an open listing; a closed or unknown ID aborts.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.GetListing()"

Result

GetOffer

func GetOffer(id string) Offer

GetOffer returns an open offer; a closed or unknown ID aborts.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/samcrew/launchpad/market/v1.GetOffer()"

Result