https://github.com/daisuke310vvv/infura-go
INFURA api client written in golang
https://github.com/daisuke310vvv/infura-go
api client dapp ethereum golang infura
Last synced: 4 months ago
JSON representation
INFURA api client written in golang
- Host: GitHub
- URL: https://github.com/daisuke310vvv/infura-go
- Owner: daisuke310vvv
- License: mit
- Created: 2018-04-12T10:28:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-10T17:15:58.000Z (over 6 years ago)
- Last Synced: 2024-06-19T10:14:23.317Z (about 2 years ago)
- Topics: api, client, dapp, ethereum, golang, infura
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 25
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# infura-go
[INFURA](https://infura.io) api client written in golang
## Installation
To install `infura-go`, simply execute the following command in a terminal from your `$GOPATH`:
```
go get github.com/daisuke310vvv/infura-go
```
## How to use
```
config, _ := infura.NewConfig("", infura.Ropsten)
infuraClient := infura.New(config)
input := &infura.EthGetBalanceInput{
Address: "0x5c66b0d82df26e8FE165Be6628F5f5e1f1bccD5C",
BlockParameter: infura.NewBlockParameter("latest"),
}
req, resp := infuraClient.EthGetBalanceRequest(input)
_ = req.Call()
fmt.Println(res.Result)
// => 0x7759d50972e9800
```
## Test
**NOTE**: Be careful many api calls will be restricted.
```
$ go test *_test.go -projectID=""
```
## TODO
- [ ] Error handling
- [ ] Decode all result parameters
- [ ] Test
## Supported JSON-RPC methods
- `web3_clientVerwsion`
- `web3_sha3`
- `net_version`
- `net_listening`
- `net_peerCount`
- `eth_protocolVersion`
- `eth_syncing`
- `eth_mining`
- `eth_hashrate`
- `eth_gasPrice`
- `eth_accounts`
- `eth_blockNumber`
- `eth_getBalance`
- `eth_getTransactionCount`
- `eth_getBlockTransactionCountByHash`
- `eth_getBlockTransactionCountByNumber`
- `eth_getUncleCountByBlockHash`
- `eth_getUncleCountByBlockNumber`
- `eth_getCode`
- `eth_sendRawTransaction`
- `eth_call`
- `eth_estimateGas`
- `eth_getBlockByHash`
- `eth_getBlockByNumber`
- `eth_getTransactionByHash`
- `eth_getTransactionByBlockHashAndIndex`
- `eth_getTransactionByBlockNumberAndIndex`
- `eth_getTransactionReceipt`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getUncleByBlockNumberAndIndex`
## Donation
Donations help me keep this development❤️
Send me eth to `0x5c66b0d82df26e8FE165Be6628F5f5e1f1bccD5C`
## License
`infura-go` is available under the MIT license. See the LICENSE file for more info.