Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ramtinms committed Sep 5, 2024
1 parent c4f8095 commit dff67a4
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions cmd/util/cmd/link-reporter/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ type LinkDataPoint struct {
LinkTypeID string `json:"linkType"`
}

type CapDataPoint struct {
Address string `json:"address"`
Identifier string `json:"identifier"`
BorrowType string `json:"borrowType"`
ID string `json:"id"`
}

func run(*cobra.Command, []string) {

if flagPayloads == "" && flagState == "" {
Expand All @@ -85,8 +92,11 @@ func run(*cobra.Command, []string) {
}

reporter := reporters.NewReportFileWriterFactory(flagOutputDirectory, log.Logger)
writer := reporter.ReportWriter("link-reporter")
defer writer.Close()
linkReporter := reporter.ReportWriter("link-reporter")
defer linkReporter.Close()

capabilityReporter := reporter.ReportWriter("capability-reporter")
defer capabilityReporter.Close()

chainID := flow.ChainID(flagChain)
// Validate chain ID
Expand Down Expand Up @@ -157,28 +167,25 @@ func run(*cobra.Command, []string) {

value := interpreter.MustConvertUnmeteredStoredValue(v)

switch link := value.(type) {
switch obj := value.(type) {
case interpreter.PathLinkValue:
targetPath := link.TargetPath
linkType := link.Type

targetPath := obj.TargetPath
linkType := obj.Type
linkTypeID := linkType.ID()

writer.Write(LinkDataPoint{
linkReporter.Write(LinkDataPoint{
Address: address.String(),
Identifier: identifier,
TargetPath: targetPath.String(),
LinkTypeID: string(linkTypeID),
})

// log.Info().Msgf("%s: %s -> %s = %s", address, identifier, targetPath, linkType.ID())
// temp test after the first one break
break

case interpreter.AccountLinkValue:
default:
// ignore
continue
default:
log.Fatal().Msgf("unexpected value type: %T", value)

}
}
return nil
Expand Down

0 comments on commit dff67a4

Please sign in to comment.