Categorygithub.com/eoscodes/eos-go
modulepackage
0.9.1
Repository: https://github.com/eoscodes/eos-go.git
Documentation: pkg.go.dev

# README

EOS.IO API library for Go

点击查看中文版

GoDoc

This library provides simple access to data structures (binary packing and JSON interface) and API calls to an EOS.IO RPC server, running remotely or locally. It provides wallet functionalities (KeyBag), or can sign transaction through the keosd wallet. It also knows about the P2P protocol on port 9876.

As of before the June launch, this library is pretty much in flux. Don't expect stability, as we're moving alongside the main eosio codebase, which changes very fast.

This library is the basis for the eos-bios launch orchestrator tool at https://github.com/eoscanada/eos-bios

Basic usage

api := eos.New("http://testnet1.eos.io")

infoResp, _ := api.GetInfo()
accountResp, _ := api.GetAccount("initn")
fmt.Println("Permission for initn:", accountResp.Permissions[0].RequiredAuth.Keys)

eosio.system and eosio.token contract Actions are respectively in:

Binaries

There is some binaries in main packages under cmd/, mainly around P2P communication.

Example

Reference

Running

The easiest way to see the actual output for a given example is to add a line // Output: any at the very end of the test, looks like this for ExampleAPI_GetInfo file (examples_api_get_info.go):

    if err != nil {
        panic(fmt.Errorf("json marshal response: %s", err))
    }

    fmt.Println(string(bytes))
    // Output: any
}

This tells go test that it can execute this test correctly. Then, simply run only this example:

go test -run ExampleAPI_GetInfo

Replacing ExampleAPI_GetInfo with the actual example name you want to try out where line // Output: any was added.

This will run the example and compares the standard output with the any which will fail. But it's ok an expected, so you can see the actual output printed to your terminal.

Note Some examples will not succeed out of the box because it requires some configuration. A good example being the transfer operation which requires having the authorizations and balance necessary to perform the transaction. It's quite possible to run them through a development environment however.

Environment Variables

All examples uses by default the https://mainnet.eos.dfuse.io API endpoint for all HTTP communication and peering.mainnet.eoscanada.com for P2P communication. They can respectively be overridden by specifying environment variable EOS_GO_API_URL and EOS_GO_P2P_ENDPOINT respectively.

Contributing

Any contributions are welcome, use your standard GitHub-fu to pitch in and improve.

License

MIT

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
BlockNum extracts the block number (or height) from a hex-encoded block ID.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ExtendedStringToName acts similar to StringToName with the big differences that it will automtically try to infer from which format to convert to a name.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewAsset reads from a string an EOS asset.
NewAssetFromString reads a string an decode it to an eos.Asset structure if possible.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewLogger a wrap to newLogger.
No description provided by the author
NewPermissionLevel parses strings like `account@active`, `otheraccount@owner` and builds a PermissionLevel struct.
No description provided by the author
No description provided by the author
No description provided by the author
NewTransaction creates a transaction.
NewWalletSigner takes an `api`, because often the wallet will be a second endpoint, and not the server node with whom you're pushing transactions to.
ParseJSONTime will parse a string into a JSONTime object.
No description provided by the author
No description provided by the author
Registers Action objects..
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
2.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39.
0.
No description provided by the author
4.
No description provided by the author
8.
No description provided by the author
7.
6.
No description provided by the author
< transaction delayed.
< succeed, no error handler executed.
< transaction expired.
< objectively failed and error handler objectively failed thus no state change.
< objectively failed (not executed), error handler executed.
No description provided by the author

# Variables

EOSSymbol represents the standard EOS symbol on the chain.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
REXSymbol represents the standard REX symbol on the chain.
No description provided by the author

# Structs

see: libraries/chain/contracts/abi_serializer.cpp:53..
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Action.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIError represents the errors as reported by the server.
No description provided by the author
NOTE: there's also ExtendedAsset which is a quantity with the attached contract (AccountName).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
See libraries/chain/include/eosio/chain/producer_schedule.hpp#L161.
See libraries/chain/include/eosio/chain/producer_schedule.hpp#L100.
No description provided by the author
No description provided by the author
No description provided by the author
ClausePair represents clauses, related to Ricardian Contracts.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Decoder implements the EOS unpacking, similar to FC_BUFFER.
No description provided by the author
No description provided by the author
-------------------------------------------------------------- Encoder implements the EOS packing, similar to FC_BUFFER --------------------------------------------------------------.
No description provided by the author
No description provided by the author
LogMessage is a line of message in an exception.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
KeyBag holds private keys in memory, for signing transactions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NetConnectionResp.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
PackedTransaction represents a fully packed transaction, with signatures, and all.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ProducerScheduleChangeExtension is a block header extension present in the signed block when a new producer authority schedule should be applied.
No description provided by the author
No description provided by the author
ProtocolFeatureActivationExtension is a block header extension present in the signed block when a particular set of protocol features has been activated by this blockl.
PushTransactionFullResp unwraps the responses from a successful `push_transaction`.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetABI represents the hard-coded `setabi` action.
SetCode represents the hard-coded `setcode` action.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NOTE: there's also a new ExtendedSymbol (which includes the contract (as AccountName) on which it is).
No description provided by the author
TableDef defines a table.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
TxOptions represents options you want to pass to the transaction you're sending.
No description provided by the author
VariantDef defines a variant type.
No description provided by the author
No description provided by the author
`eosiowd` wallet-based signer.
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UnmarshalerBinary is the interface implemented by types that can unmarshal an EOSIO binary description of themselves.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
Blob is base64 encoded data https://github.com/EOSIO/fc/blob/0e74738e938c2fe0f36c5238dbc549665ddaef82/include/fc/variant.hpp#L47.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
JSONInt64 is deprecated in favor of Int64.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SHA256Bytes is deprecated and renamed to Checksum256 for consistency.
No description provided by the author
No description provided by the author
TimePoint represents the number of microseconds since EPOCH (Jan 1st 1970).
TimePointSec represents the number of seconds since EPOCH (Jan 1st 1970).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author