### In web
```html
-<script src="https://unpkg.com/nanocurrency-web@1.2.1" type="text/javascript"></script>
+<script src="https://unpkg.com/nanocurrency-web@1.2.2" type="text/javascript"></script>
<script type="text/javascript">
NanocurrencyWeb.wallet.generate(...);
</script>
+import BigNumber from 'bignumber.js'
+//@ts-ignore
+import { blake2b } from 'blakejs'
+
import Ed25519 from './ed25519'
-import Convert from './util/convert'
import NanoAddress from './nano-address'
import NanoConverter from './nano-converter'
import Signer from './signer'
-
-import BigNumber from 'bignumber.js'
-//@ts-ignore
-import { blake2b } from 'blakejs'
+import Convert from './util/convert'
export default class BlockSigner {
/**
* Sign a receive block
- *
+ *
* @param {ReceiveBlock} data The data required to sign a receive block
* @param {string} privateKey Private key to sign the data with
* @returns {SignedBlock} the signed block to publish to the blockchain
/**
* Sign a send block
- *
+ *
* @param {SendBlock} data The data required to sign a send block
* @param {string} privateKey Private key to sign the data with
* @returns {SignedBlock} the signed block to publish to the blockchain
return value.toFixed(0)
case 'NANO':
case 'MRAI':
- return value.shiftedBy(-30).toFixed(15, 1)
+ return value.shiftedBy(-30).toFixed(30, 1)
case 'KRAI':
- return value.shiftedBy(-27).toFixed(12, 1)
+ return value.shiftedBy(-27).toFixed(27, 1)
case 'RAI':
- return value.shiftedBy(-24).toFixed(9, 1)
+ return value.shiftedBy(-24).toFixed(24, 1)
default:
throw new Error(`Unknown output unit ${outputUnit}, expected one of the following: RAW, NANO, MRAI, KRAI, RAI`)
}
{
"name": "nanocurrency-web",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "Toolkit for Nano cryptocurrency client side offline integrations",
"author": "Miro Metsänheimo <miro@metsanheimo.fi>",
"license": "MIT",
it('should convert raw to nano', () => {
const result = tools.convert('1000000000000000000000000000000', 'RAW', 'NANO')
- expect(result).to.equal('1.000000000000000')
+ expect(result).to.equal('1.000000000000000000000000000000')
})
})