@@ -3,8 +3,10 @@ package supplyverifier
33import (
44 "context"
55 "fmt"
6+ "time"
67
78 "github.com/btcsuite/btcd/wire"
9+ "github.com/lightninglabs/lndclient"
810 "github.com/lightninglabs/taproot-assets/asset"
911 "github.com/lightninglabs/taproot-assets/fn"
1012 "github.com/lightninglabs/taproot-assets/mssmt"
@@ -33,10 +35,17 @@ type SupplyCommitView interface {
3335 assetSpec asset.Specifier ,
3436 localIssuerOnly bool ) lfn.Result [supplycommit.PreCommits ]
3537
36- // SupplyCommit returns the latest supply commitment for a given asset
37- // spec.
38- SupplyCommit (ctx context.Context ,
39- assetSpec asset.Specifier ) supplycommit.RootCommitResp
38+ // FetchStartingCommitment fetches the very first supply commitment of
39+ // an asset group. If no commitment is found, it returns
40+ // ErrCommitmentNotFound.
41+ FetchStartingCommitment (ctx context.Context ,
42+ assetSpec asset.Specifier ) (* supplycommit.RootCommitment , error )
43+
44+ // FetchLatestCommitment fetches the latest supply commitment of an
45+ // asset group. If no commitment is found, it returns
46+ // ErrCommitmentNotFound.
47+ FetchLatestCommitment (ctx context.Context ,
48+ assetSpec asset.Specifier ) (* supplycommit.RootCommitment , error )
4049
4150 // FetchCommitmentByOutpoint fetches a supply commitment by its outpoint
4251 // and group key. If no commitment is found, it returns
@@ -53,12 +62,6 @@ type SupplyCommitView interface {
5362 spentOutpoint wire.OutPoint ) (* supplycommit.RootCommitment ,
5463 error )
5564
56- // FetchStartingCommitment fetches the very first supply commitment of
57- // an asset group. If no commitment is found, it returns
58- // ErrCommitmentNotFound.
59- FetchStartingCommitment (ctx context.Context ,
60- assetSpec asset.Specifier ) (* supplycommit.RootCommitment , error )
61-
6265 // InsertSupplyCommit inserts a supply commitment into the database.
6366 InsertSupplyCommit (ctx context.Context ,
6467 assetSpec asset.Specifier , commit supplycommit.RootCommitment ,
@@ -100,6 +103,29 @@ type Environment struct {
100103 // pre-commitments.
101104 SupplyCommitView SupplyCommitView
102105
106+ // SupplyTreeView is used to fetch supply leaves by height.
107+ SupplyTreeView SupplyTreeView
108+
109+ // AssetLookup is used to look up asset information such as asset groups
110+ // and asset metadata.
111+ AssetLookup supplycommit.AssetLookup
112+
113+ // Lnd is a collection of useful LND clients.
114+ Lnd * lndclient.LndServices
115+
116+ // GroupFetcher is used to fetch asset groups.
117+ GroupFetcher tapgarden.GroupFetcher
118+
119+ // SupplySyncer is used to retrieve supply commitments from a universe
120+ // server.
121+ SupplySyncer SupplySyncer
122+
123+ // SpendSyncDelay is the wait time after detecting a spend before
124+ // starting the sync of the corresponding supply commitment. The delay
125+ // allows the peer node to submit the new commitment to the universe
126+ // server and for it to be available for retrieval.
127+ SpendSyncDelay time.Duration
128+
103129 // ErrChan is the channel that is used to send errors to the caller.
104130 ErrChan chan <- error
105131
0 commit comments