bnToU8a supports endian (#87)

* bnToU8a supports endian

* Update with new bn.js flow
This commit is contained in:
Jaco Greeff
2018-02-13 14:30:10 +01:00
committed by GitHub
parent 05b5d600bf
commit f79d7fe68e
5 changed files with 29 additions and 11 deletions
+2 -2
View File
@@ -61,11 +61,11 @@ bnToHex(new BN(0x123456)); // => '0x123456'
Creates a Uint8Array object from a BN.
```js
bnToU8a (value?: BN | number, bitLength: number = -1): Uint8Array
bnToU8a (value?: BN | number, bitLength: number = -1, isLE: boolean = false): Uint8Array
```
`null`/`undefined`/`NaN` inputs returns an empty `Uint8Array` result. `BN` input values return the actual bytes value converted to a `Uint8Array`.
`null`/`undefined`/`NaN` inputs returns an empty `Uint8Array` result. `BN` input values return the actual bytes value converted to a `Uint8Array`. Optionally convert using little-endian format if `isLE` is set.
```js
import { bnToU8a } from '@polkadot/util';