diff --git a/types/result.go b/types/result.go index 3f3fdd827..cb2fb7a38 100644 --- a/types/result.go +++ b/types/result.go @@ -8,6 +8,11 @@ const ( CodeTypeOK uint32 = 0 ) +// IsOK returns true if Code is OK. +func (r ResponseCheckTx) IsOK() bool { + return r.Code == CodeTypeOK +} + // IsErr returns true if Code is something other than OK. func (r ResponseCheckTx) IsErr() bool { return r.Code != CodeTypeOK @@ -18,6 +23,11 @@ func (r ResponseCheckTx) Error() string { return fmtError(r.Code, r.Log) } +// IsOK returns true if Code is OK. +func (r ResponseDeliverTx) IsOK() bool { + return r.Code == CodeTypeOK +} + // IsErr returns true if Code is something other than OK. func (r ResponseDeliverTx) IsErr() bool { return r.Code != CodeTypeOK @@ -28,6 +38,11 @@ func (r ResponseDeliverTx) Error() string { return fmtError(r.Code, r.Log) } +// IsOK returns true if Code is OK. +func (r ResponseCommit) IsOK() bool { + return r.Code == CodeTypeOK +} + // IsErr returns true if Code is something other than OK. func (r ResponseCommit) IsErr() bool { return r.Code != CodeTypeOK @@ -38,6 +53,11 @@ func (r ResponseCommit) Error() string { return fmtError(r.Code, r.Log) } +// IsOK returns true if Code is OK. +func (r ResponseQuery) IsOK() bool { + return r.Code == CodeTypeOK +} + // IsErr returns true if Code is something other than OK. func (r ResponseQuery) IsErr() bool { return r.Code != CodeTypeOK