-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: QA file-restructure * fixes * more tweaks * Update src/config/encoding.ts * Update tests/qa.sh * fixups * rm commander.test.ts * fix cli opts bug with multiple accountOptions * drop async argParser function! (unsupported) * tweeeks * add setSelectedAccount * push verifyingKeys into admin account * revert: push verifyingKeys into registration keyring account * reverting changes from new sdk * Update src/config/types.ts --------- Co-authored-by: Nayyir Jutha <nayyir.jutha@gmail.com>
- Loading branch information
Showing
14 changed files
with
194 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
import { Command } from "commander"; | ||
import Entropy from "@entropyxyz/sdk"; | ||
import { cliWrite, endpointOption, loadEntropy } from "src/common/utils-cli"; | ||
|
||
import { EntropyBalance } from "./main"; | ||
import { endpointOption, cliWrite, loadEntropy } from "../common/utils-cli"; | ||
import { findAccountByAddressOrName } from "../common/utils"; | ||
import * as config from "../config"; | ||
|
||
export function entropyBalanceCommand () { | ||
const balanceCommand = new Command('balance') | ||
balanceCommand | ||
.description('Command to retrieive the balance of an account on the Entropy Network') | ||
.argument('address', 'Account address whose balance you want to query') | ||
.argument('account <address|name>', 'Account address whose balance you want to query') | ||
.addOption(endpointOption()) | ||
.action(async (address, opts) => { | ||
const entropy: Entropy = await loadEntropy(address, opts.endpoint) | ||
.action(async (account, opts) => { | ||
const entropy: Entropy = await loadEntropy(account, opts.endpoint) | ||
const BalanceService = new EntropyBalance(entropy, opts.endpoint) | ||
|
||
const { accounts } = await config.get() | ||
const address = findAccountByAddressOrName(accounts, account)?.address | ||
|
||
const balance = await BalanceService.getBalance(address) | ||
cliWrite(`${balance.toLocaleString('en-US')} BITS`) | ||
process.exit(0) | ||
}) | ||
|
||
return balanceCommand | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.