working tsc build

This commit is contained in:
Miro Metsänheimo 2019-10-09 21:31:40 +03:00
commit d663ce1f14
9 changed files with 36 additions and 14 deletions

2
.gitignore vendored
View file

@ -59,3 +59,5 @@ typings/
# next.js build output
.next
dist

View file

@ -1,10 +1,11 @@
import BigNumber from 'bignumber.js'
import * as blake from 'blakejs'
import { Ed25519 } from './ed25519'
import { NanoAddress } from './nano-address'
import NanoConverter from './nano-converter'
import { Convert } from './util/convert'
const blake = require('blakejs')
export default class BlockSigner {
nanoAddress = new NanoAddress()

View file

@ -1,7 +1,8 @@
import * as blake from 'blakejs'
import { Convert } from './util/convert'
import { Curve25519 } from './util/curve25519'
const blake = require('blakejs')
export class Ed25519 {
curve: Curve25519

View file

@ -1,6 +1,7 @@
import * as blake from 'blakejs'
import { Convert } from './util/convert'
const blake = require('blakejs')
export class NanoAddress {
readonly alphabet = '13456789abcdefghijkmnopqrstuwxyz'

View file

@ -5,11 +5,11 @@ export default class NanoConverter {
/**
* Converts the input value to the wanted unit
*
* @param input {BigNumber} value
* @param inputUnit {Unit} the unit to convert from
* @param outputUnit {Unit} the unit to convert to
* @param input {string | BigNumber} value
* @param inputUnit {string} the unit to convert from
* @param outputUnit {string} the unit to convert to
*/
static convert(input: BigNumber, inputUnit: string, outputUnit: string): string {
static convert(input: string | BigNumber, inputUnit: string, outputUnit: string): string {
let value = new BigNumber(input.toString())
switch (inputUnit) {

View file

@ -555,7 +555,7 @@ export class Curve25519 {
}
}
unpack25519(o: Int32Array, n: Int32Array): void {
unpack25519(o: Int32Array, n: Uint8Array): void {
for (let i = 0; i < 16; i++) {
o[i] = n[2 * i] + (n[2 * i + 1] << 8)
}
@ -563,7 +563,7 @@ export class Curve25519 {
o[15] &= 0x7fff
}
unpackNeg(r: Int32Array[], p: Int32Array): number {
unpackNeg(r: Int32Array[], p: Uint8Array): number {
const t = this.gf(),
chk = this.gf(),
num = this.gf(),

15
package-lock.json generated
View file

@ -4,6 +4,15 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/bignumber.js": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-5.0.0.tgz",
"integrity": "sha512-0DH7aPGCClywOFaxxjE6UwpN2kQYe9LwuDQMv+zYA97j5GkOMo8e66LYT+a8JYU7jfmUFRZLa9KycxHDsKXJCA==",
"dev": true,
"requires": {
"bignumber.js": "9.0.0"
}
},
"@types/node": {
"version": "12.7.12",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz",
@ -15,6 +24,12 @@
"resolved": "https://registry.npmjs.org/bignumber/-/bignumber-1.1.0.tgz",
"integrity": "sha1-5qsKdD2l8+oBjlwXWX0SH3howVk="
},
"bignumber.js": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
"dev": true
},
"blakejs": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz",

View file

@ -14,14 +14,16 @@
},
"main": "index.js",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"bignumber": "^1.1.0",
"blakejs": "^1.1.0"
"bignumber": "1.1.0",
"blakejs": "1.1.0"
},
"devDependencies": {
"@types/node": "^12.7.12",
"@types/bignumber.js": "5.0.0",
"@types/node": "12.7.12",
"typescript": "3.6.3"
}
}

View file

@ -7,9 +7,9 @@
"strict": true,
"esModuleInterop": true,
"downlevelIteration": true,
"strictNullChecks": false,
"types": [
"node",
"index.d.ts"
"node"
],
"lib": [
"es2017"