Skip to content

Add a gitmark badge: git mark badge, then a verified badge endpoint #49

Description

@melvincarvalho

There's no way yet to show on a repo that it's gitmarked. This adds one, in two steps.

1. git mark badge

A new command that prints badge markdown for the current repo. It reads the origin remote, the current branch and blocktrails.json, and builds a shields.io dynamic JSON badge that counts states in the pushed trail file:

[![gitmarks](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2F<owner>%2F<repo>%2F<branch>%2Fblocktrails.json&query=%24.states.length&label=gitmarks&suffix=%20%C2%B7%20<chain>&color=f7931a)](<link>)
  • The badge renders as gitmarks | 1 · txbt4, and the count updates whenever blocktrails.json is pushed.
  • It links to the latest mark's transaction on the chain's explorer (derived from CHAINS[chain].explorer). It could link to a trail page later.
  • Tested against melvincarvalho/delivery-day, whose trail is on txbt4. The badge renders gitmarks: 1 · txbt4.
  • It's only as current as the pushed file: it shows what the repo claims, not what the chain confirms. Step 2 fixes that.
  • Non-GitHub remotes: print the markdown with a placeholder URL for the raw trail file, and say so.

2. A verified badge (later)

A small endpoint that does what git mark verify does: re-derive each address from pubkeyBase and states, and check the outputs on the chain's explorer. It returns shields.io endpoint JSON:

  • verified 3/3 · txbt4, green
  • 2/3 verified, red, when a mark is missing or doesn't match
  • unconfirmed, amber, while the newest mark is still in the mempool

git mark badge --verified would print the markdown pointing at it. It needs hosting and some caching, so it can be a separate piece; step 1 doesn't depend on it.

Also

  • A Badge section in the README showing the markdown, and a badge on this repo if it gets a trail of its own.
  • Tests: the badge URL built from a fixture remote and trail, and the non-GitHub fallback.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions