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

fix: 🐛 Algorand: remove URL parsing logic, require new opts.indexerUrl #97

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cjsIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import WebBundlr from "./web/index";
// this class allows for CJS imports without .default, as well as still allowing for destructured Node/WebBundlr imports.
class IndexBundlr extends NodeBundlr {
static default = IndexBundlr;
static NodeBundlr = WebBundlr;
static NodeBundlr = NodeBundlr;
static WebBundlr = WebBundlr;
}
export = IndexBundlr;
5 changes: 3 additions & 2 deletions src/node/currencies/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export default class AlgorandConfig extends BaseNodeCurrency {
super(config);
this.base = ["microAlgos", 1e6];
this.keyPair = mnemonicToSecretKey(this.wallet);
this.apiURL = this.providerUrl.slice(0, 8) + "node." + this.providerUrl.slice(8);
this.indexerURL = this.providerUrl.slice(0, 8) + "algoindexer." + this.providerUrl.slice(8);
this.apiURL = config.providerUrl;
if (!config.opts.indexerUrl) throw new Error(`Algorand: required client constructor option 'opts.indexerUrl' is undefined`);
this.indexerURL = config.opts.indexerUrl;
}

async getTx(txId: string): Promise<Tx> {
Expand Down
9 changes: 8 additions & 1 deletion src/node/currencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ export default function getCurrency(
});
}
case "algorand": {
return new AlgorandConfig({ bundlr, name: "algorand", ticker: "ALGO", providerUrl: providerUrl ?? "https://algoexplorerapi.io", wallet, opts });
return new AlgorandConfig({
bundlr,
name: "algorand",
ticker: "ALGO",
providerUrl: providerUrl ?? "https://mainnet-api.algonode.cloud",
wallet,
opts: { indexerUrl: "https://mainnet-idx.algonode.cloud", ...opts },
});
}
case "aptos": {
return new AptosConfig({
Expand Down