| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
✅ Deploy Preview for oasisprotocol-cli canceled.
|
Sorry, something went wrong.
| if err != nil { | ||
| common.Warnf("Warning: failed to query metadata registry: %v\n", err) | ||
| } | ||
| fromOasisscan, err := metadata.EntitiesFromOasisscan(ctx) |
There was a problem hiding this comment.
Why do you need data also from Oasis scan?
Sorry, something went wrong.
| {&fromRegistry, ""}, | ||
| {&fromOasisscan, " (from oasisscan)"}, | ||
| } { | ||
| if src.m == nil || *src.m == nil { |
There was a problem hiding this comment.
Hm ... 🤔
// Build a lookup map from entity ID to entity name.
fromRegistry, err := metadata.EntitiesFromRegistry(ctx)
if err != nil {
common.Warnf("Warning: failed to query metadata registry: %v\n", err)
}
fromOasisscan, err := metadata.EntitiesFromOasisscan(ctx)
if err != nil {
common.Warnf("Warning: failed to query oasisscan: %v\n", err)
}
entityNameByID := make(map[string]string)
for _, src := range []struct {
m map[types.Address]*metadata.Entity
suffix string
}{
{fromRegistry, ""},
{fromOasisscan, " (oasisscan)"},
} {
for _, ent := range src.m {
id := ent.ID.String()
if _, ok := entityNameByID[id]; ok {
continue
}
entityNameByID[id] = ent.Name + src.suffix
}
}
Sorry, something went wrong.
| } | ||
| table := table.New() | ||
| table.Header("Entity ID", "Node ID", "Role") | ||
| table.Header("Entity Name", "Entity ID", "Node ID", "Role") |
There was a problem hiding this comment.
Since the entity name is not to be trusted and can be empty, I would not put it in the first column.
Sorry, something went wrong.
|
|
||
| name := entityNameByID[node.EntityID.String()] | ||
| if name == "" { | ||
| name = "unknown" |
There was a problem hiding this comment.
I would just use "", as one could have an entity with name unknown.
Sorry, something went wrong.
| if _, exists := entityNameByID[ent.ID.String()]; exists { | ||
| continue | ||
| } | ||
| entityNameByID[ent.ID.String()] = ent.Name + src.suffix |
There was a problem hiding this comment.
If the name is empty, would this produce name " (from oasiscan)"?
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #633
Vibe coded with qwen3.6:35b.