Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Add support for external testnets #3

Open
jim-toth opened this issue Mar 27, 2021 · 7 comments
Open

Add support for external testnets #3

jim-toth opened this issue Mar 27, 2021 · 7 comments

Comments

@jim-toth
Copy link

jim-toth commented Mar 27, 2021

Hi,

I've recently started a project using Arweave and long story short I'm using a cloud container to host my testnet rather than run it locally. I've got the testnet running and responding to external requests, and when I don't initialize TestWeave everything works fine.

I noticed an uncaught error where the http response was undefined. I was able to trace this down to TestWeaveTransactionsManager where it's explicitly overriding the baseURL of the request to localhost

https://github.com/ArweaveTeam/testweave-sdk/blob/main/src/classes/class.testweave-transactions-manager.ts#L69

request.defaults.baseURL = 'http://localhost';

I imagine the same issue would arise later on in the getPost() method on this line:
https://github.com/ArweaveTeam/testweave-sdk/blob/main/src/classes/class.testweave-transactions-manager.ts#L93

if (endpoint === 'graphql') {
  request.defaults.baseURL = 'http://localhost';
}

Would it be possible to use the same baseURL building logic from ArweaveJS to allow for external testnets based on the config passed to the Arweave instance? e.g.

const config = this._arweave.api.config
request.defaults.baseURL = `${config.protocol}://${config.host}:${config.port}`

I was going to fork this repo and make the changes for my own use, but I wanted to see if this is something I could contribute to the project if that's something that is desired. I can open a PR if that's something the team wants 😄

@akangaziz
Copy link

no response (yet)?

@wshino
Copy link

wshino commented Oct 18, 2021

I have encountered the same problem. node is running on GKE. I would like to support this change.

@pnutmath
Copy link

pnutmath commented Feb 1, 2022

Just commenting/removing those line should work! @jim-toth

@jim-toth
Copy link
Author

jim-toth commented Feb 1, 2022

Just commenting/removing those line should work! @jim-toth

definitely! I haven't looked at the source since I opened this issue but iirc there are other parts in the code that would prevent this from working outside of localhost

@pnutmath
Copy link

pnutmath commented Feb 2, 2022

Hi @jim-toth, I have setup this on EC2. It works for me till now apart from balance transfer, it keeps on waiting state!

Created fork and made some smaller changes

"testweave-sdk": "github:pnutmath/testweave-sdk#develop"

@xudexa
Copy link

xudexa commented Feb 23, 2022

Hello,

I have a problem with the baseURL=localhost.
Would it be possible to merge the branch.

Thank you very much

@saadtroon
Copy link

When will this branch be merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants