Skip to content

Commit

Permalink
f: fix runtime tx code type
Browse files Browse the repository at this point in the history
  • Loading branch information
aefhm committed Mar 14, 2023
1 parent 01527f4 commit 18ac305
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/v1/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ func renderRuntimeTransaction(storageTransaction client.RuntimeTransaction) (api
Success: cr.IsSuccess(),
}
if !cr.IsSuccess() {
// `module` should be present but message may be null
// https://github.com/oasisprotocol/oasis-sdk/blob/fb741678585c04fdb413441f2bfba18aafbf98f3/client-sdk/go/types/transaction.go#L488-L492
apiTransaction.Error = &apiTypes.TxError{
Code: int(cr.Failed.Code),
Module: cr.Failed.Module,
Message: cr.Failed.Message,
Code: cr.Failed.Code,
Module: &cr.Failed.Module,
}
if len(cr.Failed.Message) > 0 {
apiTransaction.Error.Message = &cr.Failed.Message
}
}
if err = uncategorized.VisitCall(&tx.Call, &cr, &uncategorized.CallHandler{
Expand Down

0 comments on commit 18ac305

Please sign in to comment.