-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tx CLI proto module interface (#5989)
* WIP * WIP * WIP on removing x/auth dependency from client/tx * Revert unneeded changes * Simplify cli tx UX * Wire up bank tx REST routes * Fix assignment issue * Wire up bank NewSendTxCmd * fix lint * revert file * revert file * fix simcli * Refactor AccountRetriever * Fix build * Fix build * Fix build * Fix integration tests * Fix tests * Docs, linting * Linting * WIP on all modules * Implement other module new tx cmd's * Fix cmd's * Refactor existing GetTxCmd * Fix cmd * Removing deprecated code * Update ADR 020 & CHANGELOG * Lint * Lint * Lint * Lint * Lint * Lint * Lint * Fix client/tx tests * Fix mocks * Fix tests * Lint fixes * REST tx migration * Wire up REST * Linting * Update CHANGELOG, docs * Fix tests * lint * Address review feedback * Update CHANGELOG.md Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Update CHANGELOG.md Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * group vars Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
- Loading branch information
1 parent
970e009
commit 850419f
Showing
71 changed files
with
862 additions
and
1,717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package context | ||
|
||
import "github.com/cosmos/cosmos-sdk/types" | ||
|
||
// AccountRetriever defines the interfaces required by transactions to | ||
// ensure an account exists and to be able to query for account fields necessary | ||
// for signing. | ||
type AccountRetriever interface { | ||
EnsureExists(nodeQuerier NodeQuerier, addr types.AccAddress) error | ||
GetAccountNumberSequence(nodeQuerier NodeQuerier, addr types.AccAddress) (accNum uint64, accSeq uint64, err error) | ||
} | ||
|
||
// NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method | ||
type NodeQuerier interface { | ||
// QueryWithData performs a query to a Tendermint node with the provided path | ||
// and a data payload. It returns the result and height of the query upon success | ||
// or an error if the query fails. | ||
QueryWithData(path string, data []byte) ([]byte, int64, error) | ||
} | ||
|
||
var _ NodeQuerier = CLIContext{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package context | ||
|
||
import ( | ||
"github.com/tendermint/tendermint/crypto" | ||
|
||
"github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
type ( | ||
// TxGenerator defines an interface a client can utilize to generate an | ||
// application-defined concrete transaction type. The type returned must | ||
// implement TxBuilder. | ||
TxGenerator interface { | ||
NewTx() TxBuilder | ||
NewFee() ClientFee | ||
NewSignature() ClientSignature | ||
MarshalTx(tx types.Tx) ([]byte, error) | ||
} | ||
|
||
ClientFee interface { | ||
types.Fee | ||
SetGas(uint64) | ||
SetAmount(types.Coins) | ||
} | ||
|
||
ClientSignature interface { | ||
types.Signature | ||
SetPubKey(crypto.PubKey) error | ||
SetSignature([]byte) | ||
} | ||
|
||
// TxBuilder defines an interface which an application-defined concrete transaction | ||
// type must implement. Namely, it must be able to set messages, generate | ||
// signatures, and provide canonical bytes to sign over. The transaction must | ||
// also know how to encode itself. | ||
TxBuilder interface { | ||
GetTx() types.Tx | ||
|
||
SetMsgs(...types.Msg) error | ||
GetSignatures() []types.Signature | ||
SetSignatures(...ClientSignature) error | ||
GetFee() types.Fee | ||
SetFee(ClientFee) error | ||
GetMemo() string | ||
SetMemo(string) | ||
|
||
// CanonicalSignBytes returns the canonical sign bytes to sign over, given a | ||
// chain ID, along with an account and sequence number. | ||
CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) | ||
} | ||
) |
Oops, something went wrong.