Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mix-labs/IC-Go
https://github.com/mix-labs/IC-Go
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mix-labs/IC-Go
- Owner: openos-labs
- License: apache-2.0
- Created: 2022-01-07T14:37:24.000Z (almost 3 years ago)
- Default Branch: v0.0.1
- Last Pushed: 2023-08-26T10:27:18.000Z (about 1 year ago)
- Last Synced: 2024-05-22T19:14:09.110Z (6 months ago)
- Language: Go
- Size: 179 KB
- Stars: 21
- Watchers: 3
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-icp - mix-labs/IC-Go
- awesome-internet-computer - ic-go - Libraries for interfacing with the IC using Go. (Client Libraries (Agents) / Go)
README
# IC-Go: Go Agent for the Internet Computer
Here is the beta version of go agent for IC
Please send us the issues you found, thanks!
You can find the examples to use IC-Go in agent_test.go
The implementations of IDL and principal are borrowed from [candid-go](https://github.com/aviate-labs/candid-go) and [principal](https://github.com/aviate-labs/principal-go), and fix the bugs
**[update 2022.3.6]** fix the bugs for the recursive structs during decode, (like a struct A with a field which is a vec of A)
**[update 2022.1.24]** add the auto-decoder to decode the result to the data structure in Golang automatically, see utils/decode.go
Tips for the auto-decoder:
- Due to the limitation of member variable name in Golang, you should put the label for member variable in the tag of `ic:"**"`
- You are supposed to define Enum class as a struct. The extra member variant with tag `ic:"EnumIndex"`, whose value is set as the final result's tag, is used to formulate the enumeration in such a "enum" struct
- "Option" should be defined as a struct, and the tag of the member variants in such a struct are "none" and "some", the member variant with tag "none" is initialized as 0, and once the option is nil, it will be set to 1
- "Tuple" is also defined as a struct, the tag for the first member in tuple should be `ic:"0"`, and so on.- "Nat" is also supposed to be defined as big.Int
- The type of members in record or enum without type of value in motoko should be set as a *uint8. The tag of members in record or enum without name in motoko should be set as `ic:"0"`, `ic:"1"` and so on.
- See more details in utils/decode.go and agent_test.go
**[update 2022.1.14]** add the new function of agent from pem file and show an example to decode the result to the data structure in Golang