Prefer sending tx_bytes to Simulate gRPC endpoint (#8926)
* First run * Remove dead code * Make test pass * Proto gen * Fix lint * Add changelog * Fix tests * Fix test * Update x/auth/tx/service.go Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * Remove protoTxProvider * Add grpc-gateway test * Add comment * move to api breaking * lesser diff * remove conflict * empty commit to rerun CI * empty commit to rerun CI Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Marie Gauthier
Alessio Treglia
mergify[bot]
parent
7ac436d2f7
commit
1fa2c22d8a
+4
-16
@@ -305,15 +305,13 @@ func simulateTx() error {
|
||||
// Simulate the tx via gRPC. We create a new client for the Protobuf Tx
|
||||
// service.
|
||||
txClient := tx.NewServiceClient(grpcConn)
|
||||
// We then call the BroadcastTx method on this client.
|
||||
protoTx := txBuilderToProtoTx(txBuilder)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
txBytes := /* Fill in with your signed transaction bytes. */
|
||||
|
||||
// We then call the Simulate method on this client.
|
||||
grpcRes, err := txClient.Simulate(
|
||||
context.Background(),
|
||||
&tx.SimulateRequest{
|
||||
Tx: protoTx,
|
||||
TxBytes: txBytes,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -324,16 +322,6 @@ func simulateTx() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// txBuilderToProtoTx converts a txBuilder into a proto tx.Tx.
|
||||
func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { // nolint
|
||||
protoProvider, ok := txBuilder.(authtx.ProtoTxProvider)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected proto tx builder, got %T", txBuilder)
|
||||
}
|
||||
|
||||
return protoProvider.GetProtoTx(), nil
|
||||
}
|
||||
```
|
||||
|
||||
## Using REST
|
||||
|
||||
Reference in New Issue
Block a user