nft

package
v0.0.0-...-9520fd6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_U64 = ^uint64(0)

Variables

View Source
var TOKEN_ABIS = []string{

	"01186372656174655F636F6C6C656374696F6E5F736372697074000000000000000000000000000000000000000000000000000000000000000305746F6B656E3020637265617465206120656D70747920746F6B656E20636F6C6C656374696F6E207769746820706172616D65746572730005046E616D6507000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67000B6465736372697074696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67000375726907000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700076D6178696D756D020E6D75746174655F73657474696E670600",

	"01136372656174655F746F6B656E5F736372697074000000000000000000000000000000000000000000000000000000000000000305746F6B656E1D2063726561746520746F6B656E20776974682072617720696E70757473000D0A636F6C6C656374696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700046E616D6507000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67000B6465736372697074696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67000762616C616E636502076D6178696D756D020375726907000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E670015726F79616C74795F70617965655F61646472657373041A726F79616C74795F706F696E74735F64656E6F6D696E61746F720218726F79616C74795F706F696E74735F6E756D657261746F72020E6D75746174655F73657474696E6706000D70726F70657274795F6B6579730607000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67000F70726F70657274795F76616C7565730606010E70726F70657274795F74797065730607000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700",

	"01166469726563745f7472616e736665725f736372697074000000000000000000000000000000000000000000000000000000000000000305746f6b656e0000051063726561746f72735f61646472657373040a636f6c6c656374696f6e07000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e6700046e616d6507000000000000000000000000000000000000000000000000000000000000000106737472696e6706537472696e67001070726f70657274795f76657273696f6e0206616d6f756e7402",

	"010C6F666665725F73637269707400000000000000000000000000000000000000000000000000000000000000030F746F6B656E5F7472616E7366657273000006087265636569766572040763726561746F72040A636F6C6C656374696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700046E616D6507000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67001070726F70657274795F76657273696F6E0206616D6F756E7402",

	"010C636C61696D5F73637269707400000000000000000000000000000000000000000000000000000000000000030F746F6B656E5F7472616E73666572730000050673656E646572040763726561746F72040A636F6C6C656374696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700046E616D6507000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67001070726F70657274795F76657273696F6E02",

	"011363616E63656C5F6F666665725F73637269707400000000000000000000000000000000000000000000000000000000000000030F746F6B656E5F7472616E7366657273000005087265636569766572040763726561746F72040A636F6C6C656374696F6E07000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E6700046E616D6507000000000000000000000000000000000000000000000000000000000000000106737472696E6706537472696E67001070726F70657274795F76657273696F6E02",
}

Functions

This section is empty.

Types

type CollectionData

type CollectionData struct {
	// Describes the collection
	Description string `json:"description"`
	// Unique name within this creators account for this collection
	Name string `json:"name"`
	// URL for additional information/media
	Uri string `json:"uri"`
	// Total number of distinct Tokens tracked by the collection
	Count uint64 `json:"count"`
	// Optional maximum number of tokens allowed within this collections
	Maximum uint64 `json:"maximum"`

	Supply uint64 `json:"supply"`
}

type GraphQLToken

type GraphQLToken struct {
	Name                     string `json:"name"`
	CollectionName           string `json:"collection_name"`
	PropertyVersion          uint64 `json:"property_version"`
	Amount                   uint64 `json:"amount"`
	CreatorAddress           string `json:"creator_address"`
	LastTransactionTimestamp string `json:"last_transaction_timestamp"`
	LastTransactionVersion   uint64 `json:"last_transaction_version"`
	OwnerAddress             string `json:"owner_address"`
	CurrentTokenData         struct {
		MetadataUri string `json:"metadata_uri"`
		Description string `json:"description"`
	} `json:"current_token_data"`
}

func FetchGraphqlTokensOfOwner

func FetchGraphqlTokensOfOwner(owner, graphUrl, creatorAddress string) ([]GraphQLToken, error)

FetchGraphqlTokensOfOwner @param graphUrl Default is mainnet url if unspecified

type NFTInfo

type NFTInfo struct {
	TokenData        *TokenData
	TokenId          *TokenDataId
	RelatedHash      string
	RelatedTimestamp uint64
}

type NFTPayloadBuilder

type NFTPayloadBuilder struct {
	// contains filtered or unexported fields
}

func NewNFTPayloadBuilder

func NewNFTPayloadBuilder() (*NFTPayloadBuilder, error)

func (*NFTPayloadBuilder) CancelTokenOffer

func (n *NFTPayloadBuilder) CancelTokenOffer(receiver, creator txnBuilder.AccountAddress, collectionName, name string, propertyVersion uint64) (txnBuilder.TransactionPayload, error)

*

  • Removes a token from pending claims list *
  • @param receiver Hex-encoded 32 byte Aptos account address which had to claim token
  • @param creator Hex-encoded 32 byte Aptos account address which created a token
  • @param collectionName Name of collection where token is strored
  • @param name Token name
  • @param propertyVersion the version of token PropertyMap with a default value 0.

func (*NFTPayloadBuilder) ClaimToken

func (n *NFTPayloadBuilder) ClaimToken(sender, creator txnBuilder.AccountAddress, collectionName, name string, propertyVersion uint64) (txnBuilder.TransactionPayload, error)

*

  • Claims a token *
  • @param sender Hex-encoded 32 byte Aptos account address which holds a token
  • @param creator Hex-encoded 32 byte Aptos account address which created a token
  • @param collectionName Name of collection where token is stored
  • @param name Token name
  • @param propertyVersion the version of token PropertyMap with a default value 0.

func (*NFTPayloadBuilder) CreateCollection

func (n *NFTPayloadBuilder) CreateCollection(name, description, uri string, maxAmount uint64) (txnBuilder.TransactionPayload, error)

*

  • Creates a new NFT collection payload. *
  • @param name Collection name
  • @param description Collection description
  • @param uri URL to additional info about collection
  • @param maxAmount Maximum number of `token_data` allowed within this collection

func (*NFTPayloadBuilder) CreateToken

func (n *NFTPayloadBuilder) CreateToken(collectionName, name, description, uri string, supply, max uint64, royalty NFTRoyalty, property *NFTProperty) (txnBuilder.TransactionPayload, error)

*

  • Creates a new NFT payload. *
  • @param collectionName Name of collection, that token belongs to
  • @param name Token name
  • @param description Token description
  • @param supply Token supply
  • @param uri URL to additional info about token
  • @param max The maxium of tokens can be minted from this token
  • @param royalty.PayeeAddress the address to receive the royalty
  • @param royalty.PointsDenominator the denominator for calculating royalty
  • @param royalty.PointsNumerator the numerator for calculating royalty
  • @param property.Keys the property keys for storing on-chain properties
  • @param property.Values the property values to be stored on-chain
  • @param property.Types the type of property values

func (*NFTPayloadBuilder) OfferToken

func (n *NFTPayloadBuilder) OfferToken(receiver, creator txnBuilder.AccountAddress, collectionName, name string, amount uint64, propertyVersion uint64) (txnBuilder.TransactionPayload, error)

*

  • Offer token payload. *
  • @param receiver Hex-encoded 32 byte Aptos account address to which tokens will be transfered
  • @param creator Hex-encoded 32 byte Aptos account address to which created tokens
  • @param collectionName Name of collection where token is stored
  • @param name Token name
  • @param amount Amount of tokens which will be transfered
  • @param propertyVersion the version of token PropertyMap with a default value 0.

type NFTProperty

type NFTProperty struct {
	// contains filtered or unexported fields
}

type NFTRoyalty

type NFTRoyalty struct {
	PayeeAddress      txnBuilder.AccountAddress
	PointsDenominator uint64
	PointsNumerator   uint64
}

type Token

type Token struct {
	Id TokenId `json:"id"`
	/** server will return string for u64 */
	Amount string `json:"amount"`
}

type TokenClient

type TokenClient struct {
	*aptosclient.RestClient
}

func NewTokenClient

func NewTokenClient(client *aptosclient.RestClient) *TokenClient

func (*TokenClient) GetAllTokenForAccount

func (c *TokenClient) GetAllTokenForAccount(account txnBuilder.AccountAddress) ([]*NFTInfo, error)

func (*TokenClient) GetCollectionData

func (c *TokenClient) GetCollectionData(creator txnBuilder.AccountAddress, collectionName string) (*CollectionData, error)

*

  • Queries collection data
  • @param creator Hex-encoded 32 byte Aptos account address which created a collection
  • @param collectionName Collection name

func (*TokenClient) GetTokenData

func (c *TokenClient) GetTokenData(creator txnBuilder.AccountAddress, collectionName, tokenName string) (*TokenData, error)

*

  • Queries token data from collection *
  • @param creator Hex-encoded 32 byte Aptos account address which created a token
  • @param collectionName Name of collection, which holds a token
  • @param tokenName Token name

func (*TokenClient) GetTokenForAccount

func (c *TokenClient) GetTokenForAccount(account txnBuilder.AccountAddress, tokenId TokenId) (*Token, error)

*

  • Queries token balance for a token account
  • @param account Hex-encoded 32 byte Aptos account address which created a token
  • @param tokenId token id

type TokenData

type TokenData struct {
	// Unique name within this creators account for this Token's collection
	Collection string `json:"collection"`
	// Describes this Token
	Description string `json:"description"`
	// The name of this Token
	Name string `json:"name"`
	// Optional maximum number of this type of Token.
	Maximum uint64 `json:"maximum"`
	// Total number of this type of Token
	Supply uint64 `json:"supply"`
	/// URL for additional information / media
	Uri string `json:"uri"`
}

type TokenDataId

type TokenDataId struct {
	/** Token creator address */
	Creator string `json:"creator"`
	/** Unique name within this creator's account for this Token's collection */
	Collection string `json:"collection"`
	/** Name of Token */
	Name string `json:"name"`
}

func (*TokenDataId) String

func (id *TokenDataId) String() string

type TokenId

type TokenId struct {
	TokenDataId TokenDataId `json:"token_data_id"`
	/** version number of the property map */
	PropertyVersion string `json:"property_version"`
}

Jump to

Keyboard shortcuts

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