reach-sh/reach-lang

@reach-sh/stdlib: Make it possible to set up the custom API key header for algod (e.g. to use PureStake)

flyingleafe opened this issue · 2 comments

On our project, we are using PureStake algod and indexer APIs: https://www.purestake.com/

The caveat with using Purestake API is that they use X-API-Key header for token authentication instead of the default X-Algo-API-Token header. This can be easily configured with algod client, but Reach does not allow configuring a different header name, therefore we resort to using the default algoexplorer URLs for Reach.

The fix should be very simple (ALGO.ts:771): just allow the configuration of the header name in a separate variable like ALGO_TOKEN_HEADER or allow the ALGO_TOKEN variable to contain either the string or {[tokenName]: token} object.

Same goes for algoindexer instance creation (ALGO.ts:762)

Thanks for the report. We'll work on this.

I've finally implemented this. You may enjoy checking out this example program: https://github.com/reach-sh/reach-lang/tree/master/examples/algo-wallet-demo