-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gRPC endpoint for CosmWasm app (#43)
* grpc for wasm app * wip rpc client * rpc client * cleanup * network name * block signature * logs * logs * fix error `codespace sdk code 2: tx parse error: unable to resolve type URL /cosmwasm.wasm.v1.MsgStoreCode`. interfaceRegistry in ClientContext should be taken from Wasm Application --------- Co-authored-by: ramil <ramilexe@gmail.com>
- Loading branch information
1 parent
ef508a7
commit 2f517b5
Showing
4 changed files
with
250 additions
and
8 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,48 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
const ( | ||
defaultRPCPort = 9752 | ||
defaultGRPCPort = 9090 | ||
defaultMaxOpenConnections = 0 // unlimited | ||
defaultTimeoutBroadcastTxCommit time.Duration = 30 * time.Second | ||
) | ||
|
||
// VmConfig ... | ||
type VmConfig struct { | ||
RPCPort uint16 `json:"rpc_port"` | ||
GRPCPort uint16 `json:"grpc_port"` | ||
GRPCMaxOpenConnections int `json:"grpc_max_open_connections"` | ||
TimeoutBroadcastTxCommit time.Duration `json:"broadcast_commit_timeout"` | ||
NetworkName string `json:"network_name"` | ||
} | ||
|
||
// SetDefaults sets the default values for the config. | ||
func (c *VmConfig) SetDefaults() { | ||
c.RPCPort = defaultRPCPort | ||
c.GRPCPort = defaultGRPCPort | ||
c.GRPCMaxOpenConnections = defaultMaxOpenConnections | ||
c.TimeoutBroadcastTxCommit = defaultTimeoutBroadcastTxCommit | ||
c.NetworkName = "landslide-test" | ||
} | ||
|
||
// Validate returns an error if this is an invalid config. | ||
func (c *VmConfig) Validate() error { | ||
if c.GRPCMaxOpenConnections < 0 { | ||
return fmt.Errorf("grpc_max_open_connections can't be negative") | ||
} | ||
|
||
if c.TimeoutBroadcastTxCommit < 0 { | ||
return fmt.Errorf("broadcast_tx_commit_timeout can't be negative") | ||
} | ||
|
||
if len(c.NetworkName) == 0 { | ||
return fmt.Errorf("network_name can't be empty") | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.