Skip to content

Commit 482c63d

Browse files
authored
feat: genesis config ledger query (#320)
1 parent 2b25708 commit 482c63d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
connectrpc.com/connect v1.17.0
77
connectrpc.com/grpchealth v1.3.0
88
connectrpc.com/grpcreflect v1.2.0
9-
github.com/blinklabs-io/gouroboros v0.106.1
9+
github.com/blinklabs-io/gouroboros v0.106.2
1010
github.com/blinklabs-io/ouroboros-mock v0.3.5
1111
github.com/dgraph-io/badger/v4 v4.5.0
1212
github.com/glebarez/sqlite v1.11.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4
1010
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
1111
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
1212
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
13-
github.com/blinklabs-io/gouroboros v0.106.1 h1:QkPpF4sQAmslUBhilY3m5aOh3CxIjkkGU49K5LHDYwc=
14-
github.com/blinklabs-io/gouroboros v0.106.1/go.mod h1:eXNqQgN88MHZKtNNlmeKtE8xygENLzOsmG2cVSdM9aU=
13+
github.com/blinklabs-io/gouroboros v0.106.2 h1:4J87NAdpBvQrkZWNrYs1GOkcDgK5YxdlNvqsEDa/tgM=
14+
github.com/blinklabs-io/gouroboros v0.106.2/go.mod h1:eXNqQgN88MHZKtNNlmeKtE8xygENLzOsmG2cVSdM9aU=
1515
github.com/blinklabs-io/ouroboros-mock v0.3.5 h1:/KWbSoH8Pjrd9uxOH7mVbI7XFsDCNW/O9FtLlvJDUpQ=
1616
github.com/blinklabs-io/ouroboros-mock v0.3.5/go.mod h1:JtUQ3Luo22hCnGBxuxNp6JaUx63VxidxWwmcaVMremw=
1717
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=

state/queries.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ func (ls *LedgerState) queryShelley(query *olocalstatequery.ShelleyQuery) (any,
9292
return []any{ls.currentEpoch.EpochId}, nil
9393
case *olocalstatequery.ShelleyCurrentProtocolParamsQuery:
9494
return []any{ls.currentPParams}, nil
95+
case *olocalstatequery.ShelleyGenesisConfigQuery:
96+
return ls.queryShelleyGenesisConfig()
9597
case *olocalstatequery.ShelleyUtxoByAddressQuery:
9698
return ls.queryShelleyUtxoByAddress(q.Addrs)
9799
case *olocalstatequery.ShelleyUtxoByTxinQuery:
@@ -126,6 +128,14 @@ func (ls *LedgerState) queryShelley(query *olocalstatequery.ShelleyQuery) (any,
126128
}
127129
}
128130

131+
func (ls *LedgerState) queryShelleyGenesisConfig() (any, error) {
132+
shelleyGenesis, err := ls.config.CardanoNodeConfig.ShelleyGenesis()
133+
if err != nil {
134+
return nil, err
135+
}
136+
return []any{shelleyGenesis}, nil
137+
}
138+
129139
func (ls *LedgerState) queryShelleyUtxoByAddress(addrs []ledger.Address) (any, error) {
130140
ret := make(map[olocalstatequery.UtxoId]ledger.TransactionOutput)
131141
// TODO: support multiple addresses

0 commit comments

Comments
 (0)