2019-02-20 10:21:57 -08:00
|
|
|
# Types
|
2018-12-05 16:48:08 -08:00
|
|
|
|
|
|
|
Besides accounts (specified in [State](state.md)), the types exposed by the auth module
|
|
|
|
are `StdFee`, the combination of an amount and gas limit, `StdSignature`, the combination
|
|
|
|
of an optional public key and a cryptographic signature as a byte array, `StdTx`,
|
|
|
|
a struct which implements the `sdk.Tx` interface using `StdFee` and `StdSignature`, and
|
|
|
|
`StdSignDoc`, a replay-prevention structure for `StdTx` which transaction senders must sign over.
|
|
|
|
|
2019-02-20 10:21:57 -08:00
|
|
|
## StdFee
|
2018-12-05 16:48:08 -08:00
|
|
|
|
|
|
|
A `StdFee` is simply the combination of a fee amount, in any number of denominations,
|
|
|
|
and a gas limit (where dividing the amount by the gas limit gives a "gas price").
|
|
|
|
|
2019-08-26 06:09:18 -07:00
|
|
|
```go
|
2018-12-05 16:48:08 -08:00
|
|
|
type StdFee struct {
|
|
|
|
Amount Coins
|
|
|
|
Gas uint64
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-02-20 10:21:57 -08:00
|
|
|
## StdSignature
|
2018-12-05 16:48:08 -08:00
|
|
|
|
2019-06-08 03:04:52 -07:00
|
|
|
A `StdSignature` is the combination of an optional public key and a cryptographic signature
|
|
|
|
as a byte array. The SDK is agnostic to particular key or signature formats and supports any
|
|
|
|
supported by the `PubKey` interface.
|
2018-12-05 16:48:08 -08:00
|
|
|
|
2019-08-26 06:09:18 -07:00
|
|
|
```go
|
2018-12-05 16:48:08 -08:00
|
|
|
type StdSignature struct {
|
|
|
|
PubKey PubKey
|
|
|
|
Signature []byte
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-02-20 10:21:57 -08:00
|
|
|
## StdTx
|
2018-12-05 16:48:08 -08:00
|
|
|
|
|
|
|
A `StdTx` is a struct which implements the `sdk.Tx` interface, and is likely to be generic
|
|
|
|
enough to serve the purposes of many Cosmos SDK blockchains.
|
|
|
|
|
2019-08-26 06:09:18 -07:00
|
|
|
```go
|
2018-12-05 16:48:08 -08:00
|
|
|
type StdTx struct {
|
|
|
|
Msgs []sdk.Msg
|
|
|
|
Fee StdFee
|
|
|
|
Signatures []StdSignature
|
|
|
|
Memo string
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-02-20 10:21:57 -08:00
|
|
|
## StdSignDoc
|
2018-12-05 16:48:08 -08:00
|
|
|
|
|
|
|
A `StdSignDoc` is a replay-prevention structure to be signed over, which ensures that
|
|
|
|
any submitted transaction (which is simply a signature over a particular bytestring)
|
|
|
|
will only be executable once on a particular blockchain.
|
|
|
|
|
|
|
|
`json.RawMessage` is preferred over using the SDK types for future compatibility.
|
|
|
|
|
2019-08-26 06:09:18 -07:00
|
|
|
```go
|
2018-12-05 16:48:08 -08:00
|
|
|
type StdSignDoc struct {
|
|
|
|
AccountNumber uint64
|
|
|
|
ChainID string
|
|
|
|
Fee json.RawMessage
|
|
|
|
Memo string
|
|
|
|
Msgs []json.RawMessage
|
|
|
|
Sequence uint64
|
|
|
|
}
|
|
|
|
```
|