-
Notifications
You must be signed in to change notification settings - Fork 0
/
msg.go
37 lines (31 loc) · 893 Bytes
/
msg.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
package account_watcher
import (
"fmt"
processorCommon "github.com/LampardNguyen234/whale-alert/internal/processor/common"
)
type Direction string
const (
directionIn Direction = "IN"
directionOut Direction = "OUT"
directionBothWay Direction = "BI"
)
type Msg struct {
processorCommon.TxMsg
Account []string
Direction Direction
Type string
}
func (msg Msg) String() string {
accMsg := msg.Account[0]
if len(msg.Account) > 1 {
accMsg = fmt.Sprintf("%v ==> %v", msg.Account[0], msg.Account[1])
}
msgFormatter := new(processorCommon.MsgFormatter).
FormatTitle("Account Watching").
FormatKeyValueMsg("Account", accMsg).
FormatKeyValueMsg("Direction", msg.Direction).
FormatKeyValueMsg("Amount", msg.Amount).
FormatKeyValueMsg("Type", msg.Type).
FormatKeyValueMsg("TxHash", processorCommon.FormatTxURL(msg.TxHash))
return msgFormatter.String()
}