@@ -208,14 +208,14 @@ type ProofResponse struct {
208208 Proof []hexutil.Bytes `json:"proof"`
209209}
210210
211- // If the tree has been published to Lanyard, GetProof will
212- // return the proof associated with an unHashedLeaf.
213- // This endpoint will return ErrNotFound if the tree
214- // associated with the root has not been published.
211+ // If the tree has been published to Lanyard,
212+ // GetProofFromLeaf will return the proof associated
213+ // with an unhashedLeaf. This endpoint will return
214+ // ErrNotFound if the tree associated with the root
215+ // has not been published.
215216func (c * Client ) GetProofFromLeaf (
216217 ctx context.Context ,
217- root hexutil.Bytes ,
218- unhashedLeaf hexutil.Bytes ,
218+ root , unhashedLeaf hexutil.Bytes ,
219219) (* ProofResponse , error ) {
220220 resp := & ProofResponse {}
221221
@@ -234,6 +234,32 @@ func (c *Client) GetProofFromLeaf(
234234 return resp , nil
235235}
236236
237+ // If the tree has been published to Lanyard,
238+ // GetProofFromAddr will return the proof associated
239+ // with an address. This endpoint will return
240+ // ErrNotFound if the tree associated with the root
241+ // has not been published.
242+ func (c * Client ) GetProofFromAddr (
243+ ctx context.Context ,
244+ root , addr hexutil.Bytes ,
245+ ) (* ProofResponse , error ) {
246+ resp := & ProofResponse {}
247+
248+ err := c .sendRequest (
249+ ctx , http .MethodGet ,
250+ fmt .Sprintf ("/proof?root=%s&address=%s" ,
251+ root .String (), addr .String (),
252+ ),
253+ nil , resp ,
254+ )
255+
256+ if err != nil {
257+ return nil , err
258+ }
259+
260+ return resp , nil
261+ }
262+
237263type RootResponse struct {
238264 Root hexutil.Bytes `json:"root"`
239265}
0 commit comments