diff --git a/chains.yaml b/chains.yaml index a11c338..f0d3865 100644 --- a/chains.yaml +++ b/chains.yaml @@ -494,6 +494,7 @@ chain-settings: label: Avalanche type: eth settings: + method-spec: "avalanche" expected-block-time: 2s allow-pruning-requirement: true options: diff --git a/docs/method-specs.md b/docs/method-specs.md index a2f4825..1d5df6b 100644 --- a/docs/method-specs.md +++ b/docs/method-specs.md @@ -250,7 +250,7 @@ Grouped by the transports they declare: | `api-connectors` | Specs | | --- | --- | -| `json-rpc`, `websocket` | `arbitrum`, `avail`, `cronos_zkevm`, `eth-json-rpc`, `fantom`, `filecoin`, `harmony_0`, `harmony_1`, `hyperliquid-eth`, `klaytn-json-rpc`, `linea`, `mantle`, `optimism`, `polkadot-json-rpc`, `polygon`, `polygon_zkevm`, `rootstock`, `scroll`, `sei`, `solana-json-rpc`, `viction`, `zk` | +| `json-rpc`, `websocket` | `arbitrum`, `avail`, `avalanche`, `cronos_zkevm`, `eth-json-rpc`, `fantom`, `filecoin`, `harmony_0`, `harmony_1`, `hyperliquid-eth`, `klaytn-json-rpc`, `linea`, `mantle`, `optimism`, `polkadot-json-rpc`, `polygon`, `polygon_zkevm`, `rootstock`, `scroll`, `sei`, `solana-json-rpc`, `viction`, `zk` | | `json-rpc` | `algorand-json-rpc`, `aztec`, `bitcoin-json-rpc`, `celestia-json-rpc`, `near-json-rpc`, `starknet-json-rpc`, `stellar-json-rpc`, `tron-json-rpc` | | `websocket` | `eth-websocket`, `klaytn-websocket`, `polkadot-websocket`, `solana-websocket` | | `tendermint` | `cosmos-tendermint` | diff --git a/pkg/methods/methods_spec_test.go b/pkg/methods/methods_spec_test.go index 3ff9ae7..da7883b 100644 --- a/pkg/methods/methods_spec_test.go +++ b/pkg/methods/methods_spec_test.go @@ -427,6 +427,23 @@ func TestAlgorandSpecLoads(t *testing.T) { assert.Equal(t, []string{"12345"}, params) } +func TestAvalancheSpecLoads(t *testing.T) { + err := specs.NewMethodSpecLoader().Load() + assert.NoError(t, err) + + // avalanche's own extension method is available... + spec := specs.GetSpecMethod("avalanche", "eth_baseFee") + assert.NotNil(t, spec) + assert.False(t, spec.IsCacheable()) + + // ...on top of every method the imported `eth` spec already provides. + spec = specs.GetSpecMethod("avalanche", "eth_blockNumber") + assert.NotNil(t, spec) + + spec = specs.GetSpecMethod("avalanche", "ftm_effectiveBaseFee") + assert.Nil(t, spec) +} + func TestLoadSpecGrpcDefaults(t *testing.T) { err := specs.NewMethodSpecLoaderWithFs(os.DirFS("test_specs/grpc")).Load() assert.NoError(t, err) diff --git a/pkg/methods/specs/avalanche.json b/pkg/methods/specs/avalanche.json new file mode 100644 index 0000000..5a2c9e6 --- /dev/null +++ b/pkg/methods/specs/avalanche.json @@ -0,0 +1,27 @@ +{ + "openrpc": "1.0.0", + "info": { + "title": "Avalanche C-Chain JSON-RPC methods", + "version": "1.0.0" + }, + "spec": { + "name": "avalanche", + "api-connectors": [ + "json-rpc", + "websocket" + ], + "type": "plain" + }, + "spec-imports": [ + "eth" + ], + "methods": [ + { + "name": "eth_baseFee", + "settings": { + "cacheable": false + }, + "params": [] + } + ] +}