forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update TxBuilder to use SignatureV2 (cosmos#6443)
* Update TxBuilder to use SignatureV2 * Fix unit tests * Lint * lint * Cleanup * Address review feedback * Add Sign tests * Add more cases for sign tests * Fix lint * Fix gofmt * Deprecate StdTx * Undeprecate StdTx, but leave a comment to use the protobuf Tx * Address review comment Co-authored-by: anilCSE <anil@vitwit.com>
- Loading branch information
Showing
14 changed files
with
211 additions
and
161 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
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 |
---|---|---|
@@ -1,51 +1,32 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/tendermint/tendermint/crypto" | ||
|
||
"github.com/cosmos/cosmos-sdk/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" | ||
"github.com/cosmos/cosmos-sdk/x/auth/signing" | ||
) | ||
|
||
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() Fee | ||
NewSignature() Signature | ||
MarshalTx(tx types.Tx) ([]byte, error) | ||
} | ||
|
||
Fee interface { | ||
types.Fee | ||
SetGas(uint64) | ||
SetAmount(types.Coins) | ||
} | ||
|
||
Signature interface { | ||
types.Signature | ||
SetPubKey(crypto.PubKey) error | ||
SetSignature([]byte) | ||
NewTxBuilder() TxBuilder | ||
SignModeHandler() signing.SignModeHandler | ||
MarshalTx(tx sdk.Tx) ([]byte, error) | ||
} | ||
|
||
// 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(...Signature) error | ||
GetFee() types.Fee | ||
SetFee(Fee) error | ||
GetMemo() string | ||
SetMemo(string) | ||
GetTx() sdk.Tx | ||
|
||
// 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) | ||
SetMsgs(msgs ...sdk.Msg) error | ||
SetSignatures(signatures ...signingtypes.SignatureV2) error | ||
SetMemo(memo string) | ||
SetFeeAmount(amount sdk.Coins) | ||
SetGasLimit(limit uint64) | ||
} | ||
) |
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
Oops, something went wrong.