diff --git a/src/eth/filter.yaml b/src/eth/filter.yaml index 0138a4ee..95b9b9b4 100644 --- a/src/eth/filter.yaml +++ b/src/eth/filter.yaml @@ -27,7 +27,7 @@ params: - name: Filter Identifier schema: - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' result: name: Success schema: @@ -37,7 +37,7 @@ params: - name: Filter Identifier schema: - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' result: name: Log objects schema: @@ -47,7 +47,7 @@ params: - name: Filter Identifier schema: - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' result: name: Log objects schema: diff --git a/src/eth/transaction.yaml b/src/eth/transaction.yaml index 3beee725..3fa9e3ce 100644 --- a/src/eth/transaction.yaml +++ b/src/eth/transaction.yaml @@ -21,7 +21,7 @@ - name: Transaction index required: true schema: - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' result: name: Transaction information schema: @@ -38,7 +38,7 @@ - name: Transaction index required: true schema: - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' result: name: Transaction information schema: diff --git a/src/schemas/base-types.yaml b/src/schemas/base-types.yaml index f301e2bf..193d57ee 100644 --- a/src/schemas/base-types.yaml +++ b/src/schemas/base-types.yaml @@ -48,6 +48,14 @@ uint: title: hex encoded unsigned integer type: string pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$ +uintParam: + title: unsigned integer number or hex string + description: clients accept both integer kinds in request parameters + oneOf: + - title: hex encoded unsigned integer + $ref: '#/components/schemas/uint' + - title: decimal unsigned integer + type: number uint64: title: hex encoded 64 bit unsigned integer type: string diff --git a/src/schemas/block.yaml b/src/schemas/block.yaml index c0d2bd89..b3474b73 100644 --- a/src/schemas/block.yaml +++ b/src/schemas/block.yaml @@ -116,14 +116,14 @@ BlockNumberOrTag: title: Block number or tag oneOf: - title: Block number - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' - title: Block tag $ref: '#/components/schemas/BlockTag' BlockNumberOrTagOrHash: title: Block number, tag, or block hash anyOf: - title: Block number - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' - title: Block tag $ref: '#/components/schemas/BlockTag' - title: Block hash diff --git a/src/schemas/filter.yaml b/src/schemas/filter.yaml index 2d454204..433c50d1 100644 --- a/src/schemas/filter.yaml +++ b/src/schemas/filter.yaml @@ -20,10 +20,10 @@ Filter: properties: fromBlock: title: from block - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' toBlock: title: to block - $ref: '#/components/schemas/uint' + $ref: '#/components/schemas/uintParam' address: title: Address(es) oneOf: diff --git a/tests/eth_getBlockByNumber/get-block-n.io b/tests/eth_getBlockByNumber/get-block-n-hex.io similarity index 100% rename from tests/eth_getBlockByNumber/get-block-n.io rename to tests/eth_getBlockByNumber/get-block-n-hex.io diff --git a/tests/eth_getBlockByNumber/get-block-n-number.io b/tests/eth_getBlockByNumber/get-block-n-number.io new file mode 100644 index 00000000..459b9df4 --- /dev/null +++ b/tests/eth_getBlockByNumber/get-block-n-number.io @@ -0,0 +1,2 @@ +>> {"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":[2,true]} +<< {"jsonrpc":"2.0","id":1,"result":{"baseFeePerGas":"0x2db08786","difficulty":"0x0","extraData":"0x","gasLimit":"0x4c4b40","gasUsed":"0x5208","hash":"0xb019ea73504c933a601125fc37ebfd9629a2119a91792a5653365ed73ec56acb","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x2","parentHash":"0x7cb4dd3daba1f739d0c1ec7d998b4a2f6fd83019116455afa54ca4f49dfa0ad4","receiptsRoot":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x2bf","stateRoot":"0xf87c613573a54e020b1bf5d540b6ed339fe982a90dc01da3f45f9714367ea9a3","timestamp":"0x14","totalDifficulty":"0x1","transactions":[{"blockHash":"0xb019ea73504c933a601125fc37ebfd9629a2119a91792a5653365ed73ec56acb","blockNumber":"0x2","from":"0x658bdf435d810c91414ec09147daa6db62406379","gas":"0x5208","gasPrice":"0x2db08787","hash":"0x0d9ba049a158972e7fc1066122ceb31e431483ebf84f90f845f02e326942d467","input":"0x","nonce":"0x1","to":"0x658bdf435d810c91414ec09147daa6db62406379","transactionIndex":"0x0","value":"0x3e8","type":"0x0","chainId":"0x539","v":"0xa95","r":"0x52a6f622013359249316f4c017a67bc2c659f513dac5efea43a84b6ce4e462b1","s":"0x55ba2a779eaf62efa7d641a32ea329faabf9f097d376e2e400115a5151b9470"}],"transactionsRoot":"0x14488a14ae59174bedee90344854fb9b6a308143ce4bf688c00f2e81a9aae2a3","uncles":[],"withdrawals":[{"index":"0x0","validatorIndex":"0x2a","address":"0xee00000000000000000000000000000000000000","amount":"0x539"},{"index":"0x1","validatorIndex":"0xd","address":"0xee00000000000000000000000000000000000000","amount":"0x1"}],"withdrawalsRoot":"0x625ee608ff633ca6371503f9a8159a9e158f3fa9585650418562ef7bd1d1dfc9"}}