/
txSend.go
60 lines (50 loc) · 1.17 KB
/
txSend.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
48
49
50
51
52
53
54
55
56
57
58
59
60
package evaioTransaction
import "encoding/base64"
type Pub struct {
Type string `json:"type"`
Value string `json:"value"`
}
func NewPub(pubkey []byte, curveType string) Pub {
return Pub{
Type: curveType,
Value: base64.StdEncoding.EncodeToString(pubkey),
}
}
type Sig struct {
Signature string `json:"signature"`
Pubkey Pub `json:"pub_key"`
//AccountNumber string `json:"account_number"`
//Sequence string `json:"sequence"`
}
func NewSig(signature []byte, pubkey Pub) Sig {
return Sig{
Signature: base64.StdEncoding.EncodeToString(signature),
Pubkey: pubkey,
//AccountNumber: accountNumber,
//Sequence: sequence,
}
}
type Tx struct {
Message []Message `json:"msg"`
Fee FeeStruct `json:"fee"`
Memo string `json:"memo"`
Signature []Sig `json:"signatures"`
}
func NewTx(message []Message, memo string, fee FeeStruct, signature []Sig) Tx {
return Tx{
Message: message,
Fee: fee,
Memo: memo,
Signature: signature,
}
}
type TxSend struct {
Mode string `json:"mode"`
Tx Tx `json:"tx"`
}
func NewTxSend(tx Tx, mode string) TxSend {
return TxSend{
Tx: tx,
Mode: mode,
}
}