-
Notifications
You must be signed in to change notification settings - Fork 114
/
wallet.go
47 lines (38 loc) · 1.04 KB
/
wallet.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
46
47
package penumbra
import (
"github.com/cosmos/cosmos-sdk/types"
"github.com/strangelove-ventures/interchaintest/v5/ibc"
)
var _ ibc.Wallet = &PenumbraWallet{}
type PenumbraWallet struct {
mnemonic string
address []byte
keyName string
chainCfg ibc.ChainConfig
}
func NewWallet(keyname string, address []byte, mnemonic string, chainCfg ibc.ChainConfig) *PenumbraWallet {
return &PenumbraWallet{
mnemonic: mnemonic,
address: address,
keyName: keyname,
chainCfg: chainCfg,
}
}
func (w *PenumbraWallet) KeyName() string {
return w.keyName
}
// Get Address formatted with chain's prefix
func (w *PenumbraWallet) FormattedAddress() string {
return types.MustBech32ifyAddressBytes(w.chainCfg.Bech32Prefix, w.address)
}
// Get mnemonic, only used for relayer wallets
func (w *PenumbraWallet) Mnemonic() string {
return w.mnemonic
}
// Get Address
func (w *PenumbraWallet) Address() []byte {
return w.address
}
func (w *PenumbraWallet) FormattedAddressWithPrefix(prefix string) string {
return types.MustBech32ifyAddressBytes(prefix, w.address)
}