-
Notifications
You must be signed in to change notification settings - Fork 15
Add support for external testnets #3
Description
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
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 😄