Skip to content

Commit

Permalink
fix: assume valid json in events output (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Aug 30, 2024
1 parent b433c2f commit b5257e6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions features/dapp_develop/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,13 @@ func getEventsFromCliTool(ledgerFrom uint32, deployedContractId string, size uin

status, stdOutLines, err := e2e.RunCommand(envCmd, e2eConfig)
var jsonEvents []map[string]interface{}
var stdOutLinesTrimmed []string

if status != 0 || err != nil {
return jsonEvents, fmt.Errorf("soroban cli get events had error %v, %v", status, err)
}

// put commas between any json event objects if more than one found
stdOutEventsValidJson := strings.ReplaceAll(strings.Join(stdOutLinesTrimmed, "\n"), `\n}\n{\n`, `\n}\n,\n{\n`)
stdOutEventsValidJson := strings.ReplaceAll(strings.Join(stdOutLines, "\n"), `\n}\n{\n`, `\n}\n,\n{\n`)
// wrap the json objects in json array brackets
stdOutEventsValidJson = "[" + stdOutEventsValidJson + "]"

Expand Down

0 comments on commit b5257e6

Please sign in to comment.