MCPcopy Index your code
hub / github.com/eoscanada/eos-go

github.com/eoscanada/eos-go @v0.10.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.10.2 ↗ · + Follow
1,457 symbols 4,757 edges 184 files 336 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

用 Go 语言与 EOS.IO 交互的 API 库

GoDoc

该库提供对数据架构(二进制打包和JSON接口)的简单访问, 以及对远程或本地运行的EOS.IO RPC服务器的API调用。 它提供钱包功能(KeyBag),或者可以通过 keosd 钱包签署交易。 它还明白端口9876上的P2P协议。

截至6月的发布之前,这个库不断的在变化。 先不要期望稳定性, 因为我们要追着主网 eosio 代码库的脚步,而它的变化又那么快。

该库主网启动编排工具是 eosio 的基础,网址: https://github.com/eoscanada/eos-bios

基本用法

package main

import (
    "context"
    "encoding/json"
    "fmt"

    eos "github.com/eoscanada/eos-go"
    cli "github.com/streamingfast/cli"
)

func main() {
    api := eos.New("https://api.eosn.io")
    ctx := context.Background()

    infoResp, err := api.GetInfo(ctx)
    cli.NoError(err, "unable to get chain info")

    fmt.Println("Chain Info", toJson(infoResp))

    accountResp, _ := api.GetAccount(ctx, "eosio")
    fmt.Println("Account Info", toJson(accountResp))
}

func toJson(v interface{}) string {
    out, err := json.MarshalIndent(v, "", "  ")
    cli.NoError(err, "unable to marshal json")

    return string(out)
}

例子

参考

二进制文件

cmd/ 下的 main 包中有一些二进制文件,主要围绕 P2P 通信。

召集开源贡献者

我们欢迎所有的开源贡献,直接用 GitHub-fu来提议、帮我们改进吧。

证书

MIT

Extension points exported contracts — how you extend this code

UnmarshalerBinary (Interface)
UnmarshalerBinary is the interface implemented by types that can unmarshal an EOSIO binary description of themselves. * [16 …
decoder.go
P2PMessage (Interface)
(no doc) [9 implementers]
p2ptypes.go
Variant (Interface)
Variant (emulates `fc::static_variant` type) [1 implementers]
types.go
BlockHeaderExtension (Interface)
(no doc) [3 implementers]
transaction.go
Signer (Interface)
(no doc) [2 implementers]
signer.go
MarshalerBinary (Interface)
MarshalerBinary is the interface implemented by types that can marshal to an EOSIO binary description of themselves. **
encoder.go
GetAccountOption (Interface)
(no doc)
api.go
Handler (Interface)
(no doc)
p2p/handler.go

Core symbols most depended-on inside this repo

Square
called by 260
btcsuite/btcd/btcec/field.go
ActN
called by 121
types.go
String
called by 115
types.go
Bytes
called by 110
abiencoder_test.go
NewDecoder
called by 103
decoder.go
Set
called by 95
btcsuite/btcd/btcec/field.go
Mul
called by 91
btcsuite/btcd/btcec/field.go
AN
called by 84
types.go

Shape

Function 540
Method 536
Struct 317
TypeAlias 45
Interface 12
FuncType 7

Languages

Go100%

Modules by API surface

types.go173 symbols
api.go77 symbols
p2ptypes.go69 symbols
responses.go65 symbols
decoder.go61 symbols
snapshot/typesv3.go52 symbols
decoder_test.go49 symbols
abidecoder_test.go45 symbols
encoder.go37 symbols
transaction.go36 symbols
types_test.go33 symbols
btcsuite/btcd/btcec/field.go25 symbols

For agents

$ claude mcp add eos-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact