Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/method-specs.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ The `specs` package embeds the specs below (see [`pkg/methods/specs/`](../pkg/me
| `hyperliquid` | `hyperliquid-eth`, `hyperliquid-rest-additional` |
| `tron` | `tron-json-rpc`, `tron-rest`, `tron-rest-solidity` |
| `bitcoin` | `bitcoin-json-rpc`, `bitcoin-esplora` |
| `algorand` | `algorand-json-rpc`, `algorand-rest` |
| `near` | `near-json-rpc` |
| `starknet` | `starknet-json-rpc` |
| `stellar` | `stellar-json-rpc`, `stellar-horizon` |
Expand All @@ -249,10 +250,10 @@ 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` | `algorand`, `aztec`, `bitcoin-json-rpc`, `celestia`, `near-json-rpc`, `starknet-json-rpc`, `stellar-json-rpc`, `tron-json-rpc` |
| `json-rpc` | `algorand-json-rpc`, `aztec`, `bitcoin-json-rpc`, `celestia`, `near-json-rpc`, `starknet-json-rpc`, `stellar-json-rpc`, `tron-json-rpc` |
| `websocket` | `eth-websocket`, `klaytn-websocket`, `polkadot-websocket`, `solana-websocket` |
| `tendermint` | `cosmos-tendermint` |
| `rest` | `aptos`, `cosmos-rest`, `eth-beacon-chain`, `stellar-horizon`, `ton-http-v2`, `tron-rest` |
| `rest` | `algorand-rest`, `aptos`, `cosmos-rest`, `eth-beacon-chain`, `stellar-horizon`, `ton-http-v2`, `tron-rest` |
| `rest-indexer` | `ton-index-v3` |
| `grpc` | `cosmos-grpc`, `sui-grpc` |
| `rest-additional` | `bitcoin-esplora`, `hyperliquid-rest-additional`, `tron-rest-solidity` |
Expand Down
30 changes: 30 additions & 0 deletions pkg/methods/methods_spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,36 @@ func TestStellarSpecLoads(t *testing.T) {
assert.Empty(t, params)
}

func TestAlgorandSpecLoads(t *testing.T) {
err := specs.NewMethodSpecLoader().Load()
assert.NoError(t, err)

spec := specs.GetSpecMethod("algorand", "getBlock")
assert.NotNil(t, spec)

spec = specs.GetSpecMethod("algorand", "GET#/v2/status")
assert.NotNil(t, spec)

spec = specs.GetSpecMethod("algorand", "eth_call")
assert.Nil(t, spec)

// each API's methods resolve only for upstreams that carry its connector
jsonRpcMethods := specs.GetSpecMethodsByConnectors("algorand", []specs.ApiConnectorType{specs.JsonRpcConnector})
assert.Contains(t, jsonRpcMethods[specs.DefaultMethodGroup], "getHealth")
assert.Contains(t, jsonRpcMethods[specs.DefaultMethodGroup], "sendRawTransaction")
assert.NotContains(t, jsonRpcMethods[specs.DefaultMethodGroup], "GET#/health")

restMethods := specs.GetSpecMethodsByConnectors("algorand", []specs.ApiConnectorType{specs.RestConnector})
assert.Contains(t, restMethods[specs.DefaultMethodGroup], "GET#/health")
assert.Contains(t, restMethods[specs.DefaultMethodGroup], "POST#/v2/transactions")
assert.NotContains(t, restMethods[specs.DefaultMethodGroup], "getHealth")

template, params, ok := specs.MatchRestMethod("algorand", "GET#/v2/blocks/12345/hash")
assert.True(t, ok)
assert.Equal(t, "GET#/v2/blocks/*/hash", template)
assert.Equal(t, []string{"12345"}, params)
}

func TestLoadSpecGrpcDefaults(t *testing.T) {
err := specs.NewMethodSpecLoaderWithFs(os.DirFS("test_specs/grpc")).Load()
assert.NoError(t, err)
Expand Down
89 changes: 89 additions & 0 deletions pkg/methods/specs/algorand-json-rpc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"openrpc": "1.0.0",
"info": {
"title": "Algorand JSON-RPC methods",
"version": "1.0.0"
},
"spec": {
"name": "algorand-json-rpc",
"api-connectors": [
"json-rpc"
],
"type": "plain"
},
"methods": [
{
"name": "status",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getBlock",
"params": []
},
{
"name": "getTransaction",
"params": []
},
{
"name": "getAccount",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getAssetByID",
"params": []
},
{
"name": "getApplicationByID",
"params": []
},
{
"name": "sendRawTransaction",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getTransactionParams",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getPendingTransactions",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getSupply",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "getVersions",
"params": []
},
{
"name": "getGenesis",
"params": []
},
{
"name": "getHealth",
"params": [],
"settings": {
"cacheable": false
}
}
]
}
121 changes: 121 additions & 0 deletions pkg/methods/specs/algorand-rest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"openrpc": "1.0.0",
"info": {
"title": "Algorand REST methods",
"version": "1.0.0"
},
"spec": {
"name": "algorand-rest",
"api-connectors": [
"rest"
],
"type": "plain"
},
"methods": [
{
"name": "GET#/v2/status",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/status/wait-for-block-after/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/blocks/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/blocks/*/hash",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/accounts/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/transactions/params",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/transactions/pending",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/transactions/pending/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "POST#/v2/transactions",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/applications/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/assets/*",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/v2/ledger/supply",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/genesis",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/versions",
"params": [],
"settings": {
"cacheable": false
}
},
{
"name": "GET#/health",
"params": [],
"settings": {
"cacheable": false
}
}
]
}
Loading
Loading