Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Parse json output of flow-cli for transaction using cadence/json

未关闭
#2,045 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
go
领域
blockchain, cli

调研方向

首先运行文档中说明的 flow transactions get 命令并加上 -o json,检查输出以及 cadence/json.Decode 返回的错误。然后将该输出与 cadence Go dependency 预期的格式进行比较。当交易输出可以解码为 Go 中的内存表示时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Instructions

I am trying to parse the output of flow-cli`s -o json flag into a cadence transaction using cadence go dependency. This used to work, but now it does not work anymore

Problem
flow transactions get c82243bb504e49a0bd55191d8a7b6001ef391ce6fa5e69f580e2e3ca8524372e -n mainnet -o json | ./overflow-json

this does not work where code is

package main

import (
	"fmt"
	"io"
	"os"

	"github.com/bjartek/underflow"
	jsoncdc "github.com/onflow/cadence/encoding/json"
)

func main() {
	_, err := os.Stdin.Stat()
	if err != nil {
		panic(err)
	}

	bytes, err := io.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	value, err := jsoncdc.Decode(nil, bytes)
	if err != nil {
		panic(err)
	}
	output, err := underflow.CadenceValueToJsonString(value)
	if err != nil {
		panic(err)
	}
	fmt.Println(output)
}

It fails on line 24, so before my code even runs.

Steps to Reproduce

Build the binary from the code above and try to run the cli command

Acceptance Criteria

It is possible to parse flow-cli transaction output into a in memory representation in golang.

Context

Debugging things

主要语言
Go
星标
209
派生
88
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

onflow/flow-cli 的其他 Issue

查看 onflow/flow-cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。