Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bignumber support #144

Merged
merged 2 commits into from
Oct 25, 2018
Merged

Add bignumber support #144

merged 2 commits into from
Oct 25, 2018

Conversation

ddeath
Copy link
Contributor

@ddeath ddeath commented Oct 25, 2018

No description provided.

@ddeath ddeath requested a review from ppershing October 25, 2018 11:06
@ddeath ddeath added this to In progress in Mobile [Deprecated] Oct 25, 2018
@ddeath ddeath self-assigned this Oct 25, 2018
const fee = util.signTransaction(fakeWallet, inputs, outputs, changeAddress)
.fee
const fee = new BigNumber(
util.signTransaction(fakeWallet, inputs, outputs, changeAddress).fee,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I wonder whether util.signTransaction shouldn't do this conversion...

}

// Note(ppershing): upgrade to bignum once we use it
const _sum = (a: Array<{amount: number}>) =>
a.reduce((acc, x) => acc + x.amount, 0)
const _sum = (a: Array<{amount: BigNumber}>): BigNumber =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

const _sum = (a: Array<{amount: number}>) =>
a.reduce((acc, x) => acc + x.amount, 0)
const _sum = (a: Array<{amount: BigNumber}>): BigNumber =>
a.reduce((acc: BigNumber, x) => acc.plus(x.amount), new BigNumber(0, 10))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why new Bignumber(0, 10) ?

Copy link
Contributor

@ppershing ppershing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve let's hope you fixed this in all locations!

@ddeath ddeath merged commit 9a67efd into master Oct 25, 2018
Mobile [Deprecated] automation moved this from In progress to Done Oct 25, 2018
@ddeath ddeath deleted the bignumber branch October 25, 2018 15:20
@ppershing ppershing mentioned this pull request Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants