Skip to content

Commit

Permalink
add bundlr network urls
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictwlee committed Jul 21, 2022
1 parent 69a6480 commit 057ff1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bundlr.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type BundlrNetwork = "node1" | "node2" | "devnet";
export type BundlrNetwork = "node1" | "node2" | "devnet";

interface StorageManagerConfig {
network: BundlrNetwork;
Expand Down
9 changes: 7 additions & 2 deletions src/bundlr.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/usr/bin/env ts-node

import Bundlr from "@bundlr-network/client";
import bundlrConfig from "../bundlr.config";
import bundlrConfig, { BundlrNetwork } from "../bundlr.config";
import * as fs from "fs";
import * as path from "path";
import * as fsp from "fs/promises";
import * as log from "./log";

const PROJECT_ROOT = path.resolve(__dirname, "../");
const ASSETS_PATH = path.resolve(PROJECT_ROOT, "assets");
const bundlrNetworks: { [K in BundlrNetwork]: string } = {
node1: "https://node1.bundlr.network",
node2: "https://node2.bundlr.network",
devnet: "https://devnet.bundlr.network",
};

async function main() {
const { network, currency, providerUrl, walletPath } = bundlrConfig;
Expand All @@ -17,7 +22,7 @@ async function main() {
encoding: "utf8",
})
);
const bundlr = new Bundlr(network, currency, jwk, {
const bundlr = new Bundlr(bundlrNetworks[network], currency, jwk, {
providerUrl,
});
const balance = await bundlr.getLoadedBalance();
Expand Down

0 comments on commit 057ff1a

Please sign in to comment.