因为官方sdk主干存在一些问题,一直没法直接使用。因此拉取分支修改了部分代码用以使用。
修改内容主要如下:
- 修改chain_properties结构体的映射字段
- 修改accountInfo,以获取正确的地址信息
- 增加MultiAddress,可以正确发送交易
- 增加MortalEraPeriod,方便根据block height获取rea。方便设置交易的存活时间
- 在method目录下封装了接口,方便调用
主要的使用可参考dot_test.go文件
Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This client is modelled after polkadot-js/api.
This package is feature complete, but it is relatively new and might still contain bugs. We advice to use it with caution in production. It comes without any warranties, please refer to LICENCE for details.
Please refer to https://godoc.org/github.com/centrifuge/go-substrate-rpc-client
- Install dependencies by running
make
followed bymake install
- Run tests
make test
- Lint
make lint
(you can usemake lint-fix
to automatically fix issues)
- Run the docker container
make test-dockerized
- Start the Substrate Default Docker image:
make run-substrate-docker
- In another terminal, run the tests against that image:
make test
- Visit https://polkadot.js.org/apps for inspection
- Set the endpoint:
export RPC_URL="http://example.com:9933"
- Run the tests
make test