-
Notifications
You must be signed in to change notification settings - Fork 170
/
client.go
45 lines (39 loc) · 1.15 KB
/
client.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
45
package client
import (
"context"
"github.com/cosmos/cosmos-sdk/codec"
sdkparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/umee-network/umee/v5/sdkclient"
)
// Client sdkclient.Client and provides umee chain specific transactions and queries.
type Client struct {
sdkclient.Client
codec codec.Codec
}
// NewClient constructs Client object.
// Accounts are generated using the list of mnemonics. Each string must be a sequence of words,
// eg: `["w11 w12 w13", "w21 w22 w23"]`. Keyring names for created accounts will be: val1, val2....
func NewClient(
chainDataDir,
chainID,
tmrpcEndpoint,
grpcEndpoint string,
mnemonics map[string]string,
gasAdjustment float64,
encCfg sdkparams.EncodingConfig,
) (Client, error) {
c, err := sdkclient.NewClient(chainDataDir, chainID, tmrpcEndpoint, grpcEndpoint, mnemonics, gasAdjustment, encCfg)
if err != nil {
return Client{}, err
}
return Client{
Client: c,
codec: encCfg.Codec,
}, nil
}
func (c Client) NewQCtx() (context.Context, context.CancelFunc) {
return c.Query.NewCtx()
}
func (c Client) NewQCtxWithCancel() (context.Context, context.CancelFunc) {
return c.Query.NewCtxWithCancel()
}