-
Notifications
You must be signed in to change notification settings - Fork 271
/
signer.go
26 lines (22 loc) · 1.04 KB
/
signer.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
package testnode
import (
"github.com/celestiaorg/celestia-app/v2/app"
"github.com/celestiaorg/celestia-app/v2/app/encoding"
"github.com/celestiaorg/celestia-app/v2/pkg/appconsts"
"github.com/celestiaorg/celestia-app/v2/pkg/user"
"github.com/celestiaorg/celestia-app/v2/test/util/testfactory"
)
func NewOfflineSigner() (*user.Signer, error) {
encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
kr, addr := NewKeyring(testfactory.TestAccName)
return user.NewSigner(kr, nil, addr[0], encCfg.TxConfig, testfactory.ChainID, 1, 0, appconsts.LatestVersion)
}
func NewSingleSignerFromContext(ctx Context) (*user.Signer, error) {
encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
return user.SetupSingleSigner(ctx.GoContext(), ctx.Keyring, ctx.GRPCClient, encCfg)
}
func NewSignerFromContext(ctx Context, acc string) (*user.Signer, error) {
encCfg := encoding.MakeConfig(app.ModuleEncodingRegisters...)
addr := testfactory.GetAddress(ctx.Keyring, acc)
return user.SetupSigner(ctx.GoContext(), ctx.Keyring, ctx.GRPCClient, addr, encCfg)
}