-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
msgs.go
36 lines (30 loc) · 1.08 KB
/
msgs.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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
var (
_ sdk.Msg = &MsgSend{}
_ sdk.Msg = &MsgMultiSend{}
_ sdk.Msg = &MsgUpdateParams{}
)
// NewMsgSend - construct a msg to send coins from one account to another.
func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend {
return &MsgSend{FromAddress: fromAddr.String(), ToAddress: toAddr.String(), Amount: amount}
}
// GetSigners Implements Msg.
func (msg MsgSend) GetSigners() []sdk.AccAddress {
fromAddress, _ := sdk.AccAddressFromBech32(msg.FromAddress)
return []sdk.AccAddress{fromAddress}
}
// NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg.
func NewMsgMultiSend(in Input, out []Output) *MsgMultiSend {
return &MsgMultiSend{Inputs: []Input{in}, Outputs: out}
}
// NewMsgSetSendEnabled Construct a message to set one or more SendEnabled entries.
func NewMsgSetSendEnabled(authority string, sendEnabled []*SendEnabled, useDefaultFor []string) *MsgSetSendEnabled {
return &MsgSetSendEnabled{
Authority: authority,
SendEnabled: sendEnabled,
UseDefaultFor: useDefaultFor,
}
}