Skip to content

Commit

Permalink
properly escape markdown when showing starknet ABI to user
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Sep 20, 2024
1 parent b6e6803 commit 74eb208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func init() {
panic(err)
}
}

func MarkdownEscape(s string) string {
return "```\n" + s + "\n```\n"
}

func parseCommonTemplates() (*template.Template, error) {
t := template.New("").Funcs(templateFuncs)
filenames, err := doublestar.Glob(commonTemplatesFS, "**/*.gotmpl")
Expand Down
3 changes: 2 additions & 1 deletion starknet-events/convo.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ func (c *Convo) Update(msg loop.Msg) loop.Cmd {
return c.NextStep()
}

peekABI := c.Msg().Message(string(contract.RawABI)).Cmd()
peekABI := c.Msg().Message(codegen.MarkdownEscape(string(contract.RawABI))).Cmd()

informMessage := c.Msg().Message("The ABI is retrieved from the latest block. Changes to the contract's ABI since its deployment are not currently handled.").Cmd()
return loop.Seq(peekABI, informMessage, cmd(AskConfirmContractABI{}))

Expand Down

0 comments on commit 74eb208

Please sign in to comment.