This repository has been archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(setup): Download rai_node from endpoint
Also fixes a few bugs surfaced during demo.
- Loading branch information
Showing
23 changed files
with
784 additions
and
298 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import BigNumber from 'npm:bignumber.js'; | ||
|
||
import getConversion from './get-conversion'; | ||
|
||
export default function fromAmount(value, { unit = 'Mxrb' } = {}) { | ||
const divisor = getConversion(unit); | ||
return BigNumber(value).dividedBy(divisor); | ||
} |
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,10 +1,7 @@ | ||
import BigNumber from 'npm:bignumber.js'; | ||
|
||
import getConversion from './get-conversion'; | ||
import fromAmount from './from-amount'; | ||
|
||
export default function fromRaw(value, { unit = 'Mxrb', precision = 6 } = {}) { | ||
const divisor = getConversion(unit); | ||
const quotient = BigNumber(value).dividedBy(divisor); | ||
const digits = Math.min(precision, Math.max(0, quotient.decimalPlaces())); | ||
return quotient.toFormat(digits); | ||
const amount = fromAmount(value, { unit }); | ||
const digits = Math.min(precision, Math.max(0, amount.decimalPlaces())); | ||
return amount.toFormat(digits); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import BigNumber from 'npm:bignumber.js'; | ||
|
||
import getConversion from './get-conversion'; | ||
|
||
export default function toAmount(value, { unit = 'Mxrb' } = {}) { | ||
const multiplier = getConversion(unit); | ||
const multiplicand = BigNumber(value); | ||
return multiplicand.times(multiplier); | ||
} |
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,9 +1,5 @@ | ||
import BigNumber from 'npm:bignumber.js'; | ||
|
||
import getConversion from './get-conversion'; | ||
import toAmount from './to-amount'; | ||
|
||
export default function toRaw(value, { unit = 'Mxrb' } = {}) { | ||
const multiplier = getConversion(unit); | ||
const multiplicand = BigNumber(value); | ||
return multiplicand.times(multiplier).toFixed(0); | ||
return toAmount(value, { unit }).toFixed(0); | ||
} |
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,16 +1,17 @@ | ||
import Route from '@ember/routing/route'; | ||
import { get } from '@ember/object'; | ||
|
||
import { action } from 'ember-decorators/object'; | ||
import { service } from 'ember-decorators/service'; | ||
|
||
export default Route.extend({ | ||
afterModel(model) { | ||
return get(model, 'accounts').reload(); | ||
}, | ||
@service intl: null, | ||
@service flashMessages: null, | ||
|
||
@action | ||
createAccount(wallet) { | ||
const account = this.store.createRecord('account', { wallet }); | ||
return this.transitionTo('wallets.accounts', account.save()); | ||
async createAccount(wallet) { | ||
const account = await this.store.createRecord('account', { wallet }).save(); | ||
const message = this.get('intl').t('wallets.overview.created'); | ||
this.get('flashMessages').success(message); | ||
return this.transitionTo('wallets.accounts', account); | ||
}, | ||
}); |
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
Binary file not shown.
Oops, something went wrong.