-
Notifications
You must be signed in to change notification settings - Fork 2
/
wallet_types.go
56 lines (47 loc) · 1.75 KB
/
wallet_types.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
package sacco
import "encoding/json"
// TransactionPayload is the body of a Cosmos transaction.
type TransactionPayload struct {
Message []json.RawMessage `json:"msg"`
Fee Fee `json:"fee"`
Signatures []Signature `json:"signatures"`
Memo string `json:"memo"`
}
// SignedTransactionPayload is a TransactionPayload which has been signed
// by wallet.Sign().
type SignedTransactionPayload TransactionPayload
// TransactionSignature is a Transaction with AccountNumber, ChainID (Network) and
// sequence number, ready to be signed with a wallet's private key.
type TransactionSignature struct {
AccountNumber string `json:"account_number" yaml:"account_number"`
ChainID string `json:"chain_id" yaml:"chain_id"`
Fee Fee `json:"fee" yaml:"fee"`
Sequence string `json:"sequence" yaml:"sequence"`
Memo string `json:"memo" yaml:"memo"`
Msgs []json.RawMessage `json:"msgs" yaml:"msgs"`
}
// Fee represents the fee needed for a Cosmos request,
// with both an amount in Coins and a Gas quantity.
type Fee struct {
Amount []Coin `json:"amount"`
Gas string `json:"gas"`
}
// Coin is an entity describing a token,
// with a specific denomination and amount.
type Coin struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
}
// Coins is a set of Coin.
type Coins []Coin
// Signature is an object holding a cryptographic signature
// and the public key associated with it.
type Signature struct {
SigPubKey SigPubKey `json:"pub_key"`
Signature string `json:"signature"`
}
// SigPubKey represents the public key used to create a Signature.
type SigPubKey struct {
Type string `json:"type"`
Value string `json:"value"`
}