Documentation
¶
Overview ¶
An API client for lanyard.org.
Index ¶
- Variables
- type Client
- func (c *Client) CreateTree(ctx context.Context, addresses []hexutil.Bytes) (*CreateResponse, error)
- func (c *Client) CreateTypedTree(ctx context.Context, unhashedLeaves []hexutil.Bytes, ...) (*CreateResponse, error)
- func (c *Client) GetProofFromLeaf(ctx context.Context, root hexutil.Bytes, unhashedLeaf hexutil.Bytes) (*ProofResponse, error)
- func (c *Client) GetRootFromProof(ctx context.Context, proof []hexutil.Bytes) (*RootResponse, error)
- func (c *Client) GetTreeFromRoot(ctx context.Context, root hexutil.Bytes) (*TreeResponse, error)
- type ClientOpt
- type CreateResponse
- type ProofResponse
- type RootResponse
- type TreeResponse
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound error = xerrors.New("resource not found")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
Uses https://lanyard.org/api/v1 for a default url and http.Client with a 30s timeout unless specified using WithURL or WithClient
func (*Client) CreateTree ¶
func (c *Client) CreateTree( ctx context.Context, addresses []hexutil.Bytes, ) (*CreateResponse, error)
If you have a list of addresses for an allowlist, you can create a Merkle tree using CreateTree. Any Merkle tree published on Lanyard will be publicly available to any user of Lanyard’s API, including minting interfaces such as Zora or mint.fun.
func (*Client) CreateTypedTree ¶
func (c *Client) CreateTypedTree( ctx context.Context, unhashedLeaves []hexutil.Bytes, leafTypeDescriptor []string, packedEncoding bool, ) (*CreateResponse, error)
CreateTypedTree is a more advanced way of creating a tree. Useful if your tree has ABI encoded data, such as quantity or other values. unhashedLeaves is a slice of addresses or ABI encoded types. leafTypeDescriptor describes the abi-encoded types of the leaves, and is required if leaves are not address types. Set packedEncoding to true if your arguments are packed/encoded
func (*Client) GetProofFromLeaf ¶
func (c *Client) GetProofFromLeaf( ctx context.Context, root hexutil.Bytes, unhashedLeaf hexutil.Bytes, ) (*ProofResponse, error)
If the tree has been published to Lanyard, GetProof will return the proof associated with an unHashedLeaf. This endpoint will return ErrNotFound if the tree associated with the root has not been published.
func (*Client) GetRootFromProof ¶
func (c *Client) GetRootFromProof( ctx context.Context, proof []hexutil.Bytes, ) (*RootResponse, error)
If a Merkle tree has been published to Lanyard, GetRootFromLeaf will return the root of the tree based on a proof of a leaf. This endpoint will return ErrNotFound if the tree associated with the leaf has not been published.
func (*Client) GetTreeFromRoot ¶
If a Merkle tree has been published to Lanyard, GetTreeFromRoot will return the entire tree based on the root. This endpoint will return ErrNotFound if the tree associated with the root has not been published.
type CreateResponse ¶
type ProofResponse ¶
type RootResponse ¶
type TreeResponse ¶
type TreeResponse struct { // UnhashedLeaves is a slice of addresses or ABI encoded types UnhashedLeaves []hexutil.Bytes `json:"unhashedLeaves"` // LeafTypeDescriptor describes the abi-encoded types of the leaves, and // is required if leaves are not address types LeafTypeDescriptor []string `json:"leafTypeDescriptor"` // PackedEncoding is true by default PackedEncoding bool `json:"packedEncoding"` LeafCount int `json:"leafCount"` }