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

T415 bigint #61

Merged
merged 9 commits into from Jun 22, 2018
Merged

T415 bigint #61

merged 9 commits into from Jun 22, 2018

Conversation

mederic-p
Copy link
Contributor

Issue/Task Number: 415

Overview

The current version of the SDK uses Double to store the different amounts of transactions.
There is a problem with precision when the number becomes too big.
This PR adds the BigInt library and convert all Double to BigInt type.
This allow the coding / decoding of numbers with up to 38 digits. If the value in the JSON contains more than 38 digits, we raise an error. That's also the case when we try to make a transaction with an overly big amount.

Changes

  • Add BigInt library
  • Update Double to BigInt when needed
  • Changed subunitToUnit type to UInt64 which allows to store up to 19 digits

@@ -0,0 +1,108 @@
//
// OMGNumberFormatter.swift
// OmiseGOTests
Copy link

Choose a reason for hiding this comment

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

A small thing, Is it should be OmiseGO instead of OmiseGOTests?

@mederic-p mederic-p merged commit b38788b into master Jun 22, 2018
@mederic-p mederic-p deleted the T415-bigint branch June 22, 2018 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants