Skip to content

Commit

Permalink
✨ feat(gentest): config
Browse files Browse the repository at this point in the history
  • Loading branch information
raxhvl committed Oct 14, 2024
1 parent bf43261 commit a88511b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 35 deletions.
22 changes: 11 additions & 11 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"remote_nodes": [
{
"name": "<YOUR_NODE_NAME>",
"node_url": "<YOUR_NODE_URL>",
"rpc_headers": {
"Authorization": "Bearer your_token_here",
"Another-Header": "value"
}
}
]
}
"remote_nodes": [
{
"name": "<YOUR_NODE_NAME>",
"node_url": "<YOUR_NODE_URL>",
"rpc_headers": {
"Authorization": "Bearer your_token_here",
"Another-Header": "value"
}
}
]
}
30 changes: 6 additions & 24 deletions src/cli/gentest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,9 @@
1. Access to an archive node for the network where the transaction
originates. A provider may be used.
2. A config file with the remote node data in JSON format
```json
{
"remote_nodes" : [
{
"name" : "mainnet_archive",
"node_url" : "https://example.archive.node.url/v1
"client_id" : "",
"secret" : ""
}
]
}
```
`client_id` and `secret` may be left empty if the node does not require
them.
2. A config file with the remote node data in JSON format. Refer `config.json.example` in root dir
for a template config. You can include any node specific request headers in `rpc_headers`.
If no headers are required, this field can be empty.
3. The transaction hash of a type 0 transaction (currently only legacy
transactions are supported).
Expand Down Expand Up @@ -70,7 +56,7 @@
"-c",
envvar="GENTEST_CONFIG_FILE",
type=click.File("r"),
default=os.path.expanduser("~/.eest/gentest"),
default=os.path.expanduser("~/.eest/gentest/config.json"),
help="Config file with remote node data.",
)
@click.argument("transaction_hash")
Expand Down Expand Up @@ -236,8 +222,7 @@ class RemoteNode:

name: str
node_url: str
client_id: str
secret: str
rpc_headers: Dict[str, str]

remote_nodes: List["Config.RemoteNode"]

Expand Down Expand Up @@ -284,10 +269,7 @@ def __init__(self, node_config: Config.RemoteNode):
Initialize the RequestManager with specific client config.
"""
self.node_url = node_config.node_url
headers = {
"CF-Access-Client-Id": node_config.client_id,
"CF-Access-Client-Secret": node_config.secret,
}
headers = node_config.rpc_headers
self.rpc = EthRPC(node_config.node_url, extra_headers=headers)
self.debug_rpc = DebugRPC(node_config.node_url, extra_headers=headers)

Expand Down

0 comments on commit a88511b

Please sign in to comment.