Skip to content

Commit 8c5b96c

Browse files
authored
Change promptCurrency to accept iron not ore (#3565)
* Change promptCurrency to accept iron not ore Users were typing iron in here, but this prompt accepted ore. Changes this to accept and decode iron now. * Fix lint
1 parent a99c110 commit 8c5b96c

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

ironfish-cli/src/utils/currency.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

55
import { Asset } from '@ironfish/rust-nodejs'
6-
import { Assert, CurrencyUtils, RpcClient } from '@ironfish/sdk'
6+
import { CurrencyUtils, RpcClient } from '@ironfish/sdk'
77
import { CliUx } from '@oclif/core'
88

99
export async function promptCurrency(options: {
@@ -50,13 +50,7 @@ export async function promptCurrency(options: {
5050
return null
5151
}
5252

53-
const [amount, error] = CurrencyUtils.decodeTry(input)
54-
55-
if (error) {
56-
throw error
57-
}
58-
59-
Assert.isNotNull(amount)
53+
const amount = CurrencyUtils.decodeIron(input)
6054

6155
if (options.minimum != null && amount < options.minimum) {
6256
continue

ironfish/src/utils/currency.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class CurrencyUtils {
1818
}
1919

2020
/**
21-
* Parses iron as ore
21+
* Parses iron into ore
2222
*/
2323
static decodeIron(amount: string | number): bigint {
2424
return parseFixed(amount.toString(), 8).toBigInt()

0 commit comments

Comments
 (0)