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

Add support for external testnets #3

@jim-toth

Description

@jim-toth

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 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions