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

Commit

Permalink
Merge pull request #97 from Bundlr-Network/fix/algorand
Browse files Browse the repository at this point in the history
fix: 🐛 Algorand: remove URL parsing logic, require new opts.indexerUrl
  • Loading branch information
JesseTheRobot authored Jun 26, 2023
2 parents 8fef053 + 4e47874 commit c8211ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
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

0 comments on commit c8211ce

Please sign in to comment.