feat: docgen: use real values for Eth types (#9938)

This commit is contained in:
Aayush Rajasekaran 2022-12-27 11:15:22 -05:00 committed by GitHub
parent a5851a1763
commit a4d93d7088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 43 deletions

View File

@ -376,8 +376,10 @@ func init() {
addExample(ethint)
addExample(&ethint)
ethaddr, _ := ethtypes.EthAddressFromHex("0x5CbEeCF99d3fDB3f25E309Cc264f240bb0664031")
addExample(ethaddr)
addExample(&ethaddr)
ethhash, _ := ethtypes.NewEthHashFromCid(c)
addExample(ethhash)
addExample(&ethhash)
ethFeeHistoryReward := [][]ethtypes.EthBigInt{}
@ -468,7 +470,7 @@ func ExampleValue(method string, t, parent reflect.Type) interface{} {
case reflect.Ptr:
if t.Elem().Kind() == reflect.Struct {
es := exampleStruct(method, t.Elem(), t)
// ExampleValues[t] = es
ExampleValues[t] = es
return es
}
case reflect.Interface:

Binary file not shown.

View File

@ -2253,7 +2253,7 @@ Inputs: `null`
Response:
```json
[
"0x0707070707070707070707070707070707070707"
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031"
]
```
@ -2366,7 +2366,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707",
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"string value"
]
```
@ -2381,7 +2381,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707070707070707070707070707",
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
true
]
```
@ -2389,13 +2389,13 @@ Inputs:
Response:
```json
{
"hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"parentHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"sha3Uncles": "0x0707070707070707070707070707070707070707070707070707070707070707",
"miner": "0x0707070707070707070707070707070707070707",
"stateRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"transactionsRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"receiptsRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"hash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"parentHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"sha3Uncles": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"miner": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"stateRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"transactionsRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"receiptsRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"logsBloom": "0x07",
"difficulty": "0x5",
"totalDifficulty": "0x5",
@ -2404,7 +2404,7 @@ Response:
"gasUsed": "0x5",
"timestamp": "0x5",
"extraData": "Ynl0ZSBhcnJheQ==",
"mixHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"mixHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"nonce": "0x0707070707070707",
"baseFeePerGas": "0x0",
"size": "0x5",
@ -2412,7 +2412,7 @@ Response:
{}
],
"uncles": [
"0x0707070707070707070707070707070707070707070707070707070707070707"
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
]
}
```
@ -2433,13 +2433,13 @@ Inputs:
Response:
```json
{
"hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"parentHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"sha3Uncles": "0x0707070707070707070707070707070707070707070707070707070707070707",
"miner": "0x0707070707070707070707070707070707070707",
"stateRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"transactionsRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"receiptsRoot": "0x0707070707070707070707070707070707070707070707070707070707070707",
"hash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"parentHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"sha3Uncles": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"miner": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"stateRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"transactionsRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"receiptsRoot": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"logsBloom": "0x07",
"difficulty": "0x5",
"totalDifficulty": "0x5",
@ -2448,7 +2448,7 @@ Response:
"gasUsed": "0x5",
"timestamp": "0x5",
"extraData": "Ynl0ZSBhcnJheQ==",
"mixHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"mixHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"nonce": "0x0707070707070707",
"baseFeePerGas": "0x0",
"size": "0x5",
@ -2456,7 +2456,7 @@ Response:
{}
],
"uncles": [
"0x0707070707070707070707070707070707070707070707070707070707070707"
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
]
}
```
@ -2470,7 +2470,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707070707070707070707070707"
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
]
```
@ -2499,7 +2499,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707",
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"string value"
]
```
@ -2648,7 +2648,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707",
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"0x07",
"string value"
]
@ -2664,7 +2664,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707070707070707070707070707",
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"0x5"
]
```
@ -2674,11 +2674,11 @@ Response:
{
"chainId": "0x5",
"nonce": "0x5",
"hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"hash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockNumber": "0x5",
"transactionIndex": "0x5",
"from": "0x0707070707070707070707070707070707070707",
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"to": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"value": "0x0",
"type": "0x5",
@ -2710,11 +2710,11 @@ Response:
{
"chainId": "0x5",
"nonce": "0x5",
"hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"hash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockNumber": "0x5",
"transactionIndex": "0x5",
"from": "0x0707070707070707070707070707070707070707",
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"to": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"value": "0x0",
"type": "0x5",
@ -2745,11 +2745,11 @@ Response:
{
"chainId": "0x5",
"nonce": "0x5",
"hash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"hash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockNumber": "0x5",
"transactionIndex": "0x5",
"from": "0x0707070707070707070707070707070707070707",
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"to": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"value": "0x0",
"type": "0x5",
@ -2771,7 +2771,7 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707",
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"string value"
]
```
@ -2786,20 +2786,20 @@ Perms: read
Inputs:
```json
[
"0x0707070707070707070707070707070707070707070707070707070707070707"
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
]
```
Response:
```json
{
"transactionHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"transactionHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"transactionIndex": "0x5",
"blockHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"blockHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockNumber": "0x5",
"from": "0x0707070707070707070707070707070707070707",
"from": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"to": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"root": "0x0707070707070707070707070707070707070707070707070707070707070707",
"root": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"status": "0x5",
"contractAddress": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"cumulativeGasUsed": "0x5",
@ -2808,7 +2808,7 @@ Response:
"logsBloom": "0x07",
"logs": [
{
"address": "0x0707070707070707070707070707070707070707",
"address": "0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
"data": "0x07",
"topics": [
"0x07"
@ -2816,8 +2816,8 @@ Response:
"removed": true,
"logIndex": "0x5",
"transactionIndex": "0x5",
"transactionHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"blockHash": "0x0707070707070707070707070707070707070707070707070707070707070707",
"transactionHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockHash": "0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e",
"blockNumber": "0x5"
}
],
@ -3004,7 +3004,7 @@ Inputs:
]
```
Response: `"0x0707070707070707070707070707070707070707070707070707070707070707"`
Response: `"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"`
### EthSubscribe
Subscribe to different event types using websockets
@ -3025,7 +3025,7 @@ Inputs:
{
"topics": [
[
"0x0707070707070707070707070707070707070707070707070707070707070707"
"0x37690cfec6c1bf4c3b9288c7a5d783e98731e90b0a4c177c2a374c7a9427355e"
]
]
}