-
Notifications
You must be signed in to change notification settings - Fork 0
/
source.go
44 lines (35 loc) · 991 Bytes
/
source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package local
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/forbole/juno/v4/node/local"
mintsource "github.com/rarimo/bdjuno/modules/mint/source"
)
var (
_ mintsource.Source = &Source{}
)
// Source implements mintsource.Source using a local node
type Source struct {
*local.Source
querier minttypes.QueryServer
}
// NewSource returns a new Source instace
func NewSource(source *local.Source, querier minttypes.QueryServer) *Source {
return &Source{
Source: source,
querier: querier,
}
}
// Params implements mintsource.Source
func (s Source) Params(height int64) (minttypes.Params, error) {
ctx, err := s.LoadHeight(height)
if err != nil {
return minttypes.Params{}, fmt.Errorf("error while loading height: %s", err)
}
res, err := s.querier.Params(sdk.WrapSDKContext(ctx), &minttypes.QueryParamsRequest{})
if err != nil {
return minttypes.Params{}, err
}
return res.Params, nil
}