-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(go/cli): pull all cosmos-sdk commands into repo
Signed-off-by: Artur Troian <[email protected]>
- Loading branch information
Showing
91 changed files
with
16,972 additions
and
1,123 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,103 @@ | ||
package cli_test | ||
|
||
// import ( | ||
// "context" | ||
// "encoding/base64" | ||
// "testing" | ||
// | ||
// "github.com/stretchr/testify/require" | ||
// | ||
// "cosmossdk.io/depinject" | ||
// "github.com/cosmos/cosmos-sdk/client" | ||
// "github.com/cosmos/cosmos-sdk/codec" | ||
// "github.com/cosmos/cosmos-sdk/testutil" | ||
// sdk "github.com/cosmos/cosmos-sdk/types" | ||
// authtestutil "github.com/cosmos/cosmos-sdk/x/auth/testutil" | ||
// | ||
// "pkg.akt.dev/go/cli" | ||
// ) | ||
// | ||
// func TestGetCommandEncode(t *testing.T) { | ||
// var ( | ||
// txCfg client.TxConfig | ||
// legacyAmino *codec.LegacyAmino | ||
// codec codec.Codec | ||
// ) | ||
// | ||
// err := depinject.Inject( | ||
// authtestutil.AppConfig, | ||
// &txCfg, | ||
// &legacyAmino, | ||
// &codec, | ||
// ) | ||
// require.NoError(t, err) | ||
// | ||
// cmd := cli.GetEncodeCommand() | ||
// _ = testutil.ApplyMockIODiscardOutErr(cmd) | ||
// | ||
// // Build a test transaction | ||
// builder := txCfg.NewTxBuilder() | ||
// builder.SetGasLimit(50000) | ||
// builder.SetFeeAmount(sdk.Coins{sdk.NewInt64Coin("atom", 150)}) | ||
// builder.SetMemo("foomemo") | ||
// jsonEncoded, err := txCfg.TxJSONEncoder()(builder.GetTx()) | ||
// require.NoError(t, err) | ||
// | ||
// txFile := testutil.WriteToNewTempFile(t, string(jsonEncoded)) | ||
// txFileName := txFile.Name() | ||
// | ||
// ctx := context.Background() | ||
// clientCtx := client.Context{}. | ||
// WithTxConfig(txCfg). | ||
// WithCodec(codec) | ||
// ctx = context.WithValue(ctx, cli.ClientContextKey, &clientCtx) | ||
// | ||
// cmd.SetArgs([]string{txFileName}) | ||
// err = cmd.ExecuteContext(ctx) | ||
// require.NoError(t, err) | ||
// } | ||
// | ||
// func TestGetCommandDecode(t *testing.T) { | ||
// var ( | ||
// txCfg client.TxConfig | ||
// legacyAmino *codec.LegacyAmino | ||
// codec codec.Codec | ||
// ) | ||
// | ||
// err := depinject.Inject( | ||
// authtestutil.AppConfig, | ||
// &txCfg, | ||
// &legacyAmino, | ||
// &codec, | ||
// ) | ||
// require.NoError(t, err) | ||
// | ||
// clientCtx := client.Context{}. | ||
// WithTxConfig(txCfg). | ||
// WithCodec(codec) | ||
// | ||
// cmd := cli.GetDecodeCommand() | ||
// _ = testutil.ApplyMockIODiscardOutErr(cmd) | ||
// | ||
// clientCtx = clientCtx.WithTxConfig(txCfg) | ||
// | ||
// // Build a test transaction | ||
// builder := txCfg.NewTxBuilder() | ||
// builder.SetGasLimit(50000) | ||
// builder.SetFeeAmount(sdk.Coins{sdk.NewInt64Coin("atom", 150)}) | ||
// builder.SetMemo("foomemo") | ||
// | ||
// // Encode transaction | ||
// txBytes, err := clientCtx.TxConfig.TxEncoder()(builder.GetTx()) | ||
// require.NoError(t, err) | ||
// | ||
// // Convert the transaction into base64 encoded string | ||
// base64Encoded := base64.StdEncoding.EncodeToString(txBytes) | ||
// | ||
// ctx := context.Background() | ||
// ctx = context.WithValue(ctx, cli.ClientContextKey, &clientCtx) | ||
// | ||
// // Execute the command | ||
// cmd.SetArgs([]string{base64Encoded}) | ||
// require.NoError(t, cmd.ExecuteContext(ctx)) | ||
// } |
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.