ApeWorX / ape-foundry

Foundry network provider for the Ape Framework
https://www.apeworx.io/
Apache License 2.0
33 stars 13 forks source link

feat: allow connecting to remote anvil nodes [APE-892] #48

Closed antazoey closed 1 year ago

antazoey commented 1 year ago

What I did

Allows specifying a host for connecting remotely to an anvil node.

How I did it

When the user puts host, use that instead of launching the process. Basically, works the same except it won't try to launch anything; it will only try to connect. port field will trigger deprecation warning

How to verify it

Checklist

sabotagebeats commented 1 year ago

I was having trouble getting this to work with my configuration:

foundry:
  - port: 8545
  - host: http://44.200.33.91

or alternatively:

foundry:
  - host: http://44.200.33.91:8545

ape console

WARNING: Unable to load CLI endpoint for plugin 'ape_console'
        RecursionError: maximum recursion depth exceeded while calling a Python object
        (Use `--verbosity DEBUG` to see full stack-trace)
Error: No such command 'console'.
antazoey commented 1 year ago

@sabotagebeats do you maybe need to use https instead of http?

antazoey commented 1 year ago

i can do the same to ape-hardhat if we like this

sabotagebeats commented 1 year ago

@sabotagebeats do you maybe need to use https instead of http?

it does work with http if I don't use the ape configuration file to set the anvil network.

antazoey commented 1 year ago

Using this branch, i can connect to remote anvil nodes!

INFO: Connecting to existing 'anvil' process.

...

In [2]: provider.uri
Out[2]: 'http://xx.x00.xx.xx:8545'
fubuloubu commented 1 year ago

I was having trouble getting this to work with my configuration:

foundry:
  - port: 8545
  - host: http://44.200.33.91

or alternatively:

foundry:
  - host: http://44.200.33.91:8545

ape console

WARNING: Unable to load CLI endpoint for plugin 'ape_console'
        RecursionError: maximum recursion depth exceeded while calling a Python object
        (Use `--verbosity DEBUG` to see full stack-trace)
Error: No such command 'console'.

I was able to get it to work:

do this instead:

foundry:
  host: http://44.200.33.91:8545