changelong
This commit is contained in:
parent
d7158b70a5
commit
9f2f47a0a5
|
@ -45,6 +45,8 @@ BREAKING CHANGES
|
|||
* [lcd] Switch key creation output to return bech32
|
||||
* [x/stake] store-value for delegation, validator, ubd, and red do not hold duplicate information contained store-key
|
||||
* [gaiad] genesis transactions now use bech32 addresses / pubkeys
|
||||
* [types] Renamed `sdk.Address` to `sdk.AccAddress`/`sdk.ValAddress`
|
||||
* [types] `sdk.AccAddress`/`sdk.ValAddress` natively marshals to Bech32 in String, Sprintf (when used with `%s`), and MarshalJSON
|
||||
|
||||
DEPRECATED
|
||||
* [cli] Deprecate `--name` flag in commands that send txs, in favor of `--from`
|
||||
|
|
|
@ -30,7 +30,7 @@ type Msg interface {
|
|||
// Signers returns the addrs of signers that must sign.
|
||||
// CONTRACT: All signatures must be present to be valid.
|
||||
// CONTRACT: Returns addrs in some deterministic order.
|
||||
GetSigners() []Address
|
||||
GetSigners() []AccAddress
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -43,8 +43,8 @@ For instance, take the simple token sending message type from app1.go:
|
|||
```go
|
||||
// MsgSend to send coins from Input to Output
|
||||
type MsgSend struct {
|
||||
From sdk.Address `json:"from"`
|
||||
To sdk.Address `json:"to"`
|
||||
From sdk.AccAddress `json:"from"`
|
||||
To sdk.AccAddress `json:"to"`
|
||||
Amount sdk.Coins `json:"amount"`
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ func (msg MsgSend) GetSignBytes() []byte {
|
|||
}
|
||||
|
||||
// Implements Msg. Return the signer.
|
||||
func (msg MsgSend) GetSigners() []sdk.Address {
|
||||
return []sdk.Address{msg.From}
|
||||
func (msg MsgSend) GetSigners() []sdk.AccAddress {
|
||||
return []sdk.AccAddress{msg.From}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -277,7 +277,7 @@ Coins](https://godoc.org/github.com/cosmos/cosmos-sdk/types#Coins).
|
|||
Now we're ready to handle the two parts of the MsgSend:
|
||||
|
||||
```go
|
||||
func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result {
|
||||
func handleFrom(store sdk.KVStore, from sdk.AccAddress, amt sdk.Coins) sdk.Result {
|
||||
// Get sender account from the store.
|
||||
accBytes := store.Get(from)
|
||||
if accBytes == nil {
|
||||
|
@ -315,7 +315,7 @@ func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result {
|
|||
return sdk.Result{}
|
||||
}
|
||||
|
||||
func handleTo(store sdk.KVStore, to sdk.Address, amt sdk.Coins) sdk.Result {
|
||||
func handleTo(store sdk.KVStore, to sdk.AccAddress, amt sdk.Coins) sdk.Result {
|
||||
// Add msg amount to receiver account
|
||||
accBytes := store.Get(to)
|
||||
var acc appAccount
|
||||
|
|
|
@ -22,8 +22,8 @@ Let's introduce a new message type for issuing coins:
|
|||
// MsgIssue to allow a registered issuer
|
||||
// to issue new coins.
|
||||
type MsgIssue struct {
|
||||
Issuer sdk.Address
|
||||
Receiver sdk.Address
|
||||
Issuer sdk.AccAddress
|
||||
Receiver sdk.AccAddress
|
||||
Coin sdk.Coin
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func handleMsgIssue(keyIssue *sdk.KVStoreKey, keyAcc *sdk.KVStoreKey) sdk.Handle
|
|||
}
|
||||
}
|
||||
|
||||
func handleIssuer(store sdk.KVStore, issuer sdk.Address, coin sdk.Coin) sdk.Result {
|
||||
func handleIssuer(store sdk.KVStore, issuer sdk.AccAddress, coin sdk.Coin) sdk.Result {
|
||||
// the issuer address is stored directly under the coin denomination
|
||||
denom := []byte(coin.Denom)
|
||||
infoBytes := store.Get(denom)
|
||||
|
@ -95,7 +95,7 @@ func handleIssuer(store sdk.KVStore, issuer sdk.Address, coin sdk.Coin) sdk.Resu
|
|||
|
||||
// coinInfo stores meta data about a coin
|
||||
type coinInfo struct {
|
||||
Issuer sdk.Address `json:"issuer"`
|
||||
Issuer sdk.AccAddress `json:"issuer"`
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ The `Account` interface captures this account model with getters and setters:
|
|||
// Account is a standard account using a sequence number for replay protection
|
||||
// and a pubkey for authentication.
|
||||
type Account interface {
|
||||
GetAddress() sdk.Address
|
||||
SetAddress(sdk.Address) error // errors if already set.
|
||||
GetAddress() sdk.AccAddress
|
||||
SetAddress(sdk.AccAddress) error // errors if already set.
|
||||
|
||||
GetPubKey() crypto.PubKey // can return nil.
|
||||
SetPubKey(crypto.PubKey) error
|
||||
|
@ -76,11 +76,11 @@ The default implementation of `Account` is the `BaseAccount`:
|
|||
// Extend this by embedding this in your AppAccount.
|
||||
// See the examples/basecoin/types/account.go for an example.
|
||||
type BaseAccount struct {
|
||||
Address sdk.Address `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
PubKey crypto.PubKey `json:"public_key"`
|
||||
AccountNumber int64 `json:"account_number"`
|
||||
Sequence int64 `json:"sequence"`
|
||||
Address sdk.AccAddress `json:"address"`
|
||||
Coins sdk.Coins `json:"coins"`
|
||||
PubKey crypto.PubKey `json:"public_key"`
|
||||
AccountNumber int64 `json:"account_number"`
|
||||
Sequence int64 `json:"sequence"`
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -260,7 +260,7 @@ The PubKey is required for signature verification, but it is only required in
|
|||
the StdSignature once. From that point on, it will be stored in the account.
|
||||
|
||||
The fee is paid by the first address returned by `msg.GetSigners()` for the first `Msg`,
|
||||
as provided by the `FeePayer(tx Tx) sdk.Address` function.
|
||||
as provided by the `FeePayer(tx Tx) sdk.AccAddress` function.
|
||||
|
||||
## CoinKeeper
|
||||
|
||||
|
|
Loading…
Reference in New Issue