working tsc build
This commit is contained in:
parent
08e7a140f3
commit
d663ce1f14
9 changed files with 36 additions and 14 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -59,3 +59,5 @@ typings/
|
||||||
|
|
||||||
# next.js build output
|
# next.js build output
|
||||||
.next
|
.next
|
||||||
|
|
||||||
|
dist
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import * as blake from 'blakejs'
|
|
||||||
import { Ed25519 } from './ed25519'
|
import { Ed25519 } from './ed25519'
|
||||||
import { NanoAddress } from './nano-address'
|
import { NanoAddress } from './nano-address'
|
||||||
import NanoConverter from './nano-converter'
|
import NanoConverter from './nano-converter'
|
||||||
import { Convert } from './util/convert'
|
import { Convert } from './util/convert'
|
||||||
|
|
||||||
|
const blake = require('blakejs')
|
||||||
|
|
||||||
export default class BlockSigner {
|
export default class BlockSigner {
|
||||||
|
|
||||||
nanoAddress = new NanoAddress()
|
nanoAddress = new NanoAddress()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import * as blake from 'blakejs'
|
|
||||||
import { Convert } from './util/convert'
|
import { Convert } from './util/convert'
|
||||||
import { Curve25519 } from './util/curve25519'
|
import { Curve25519 } from './util/curve25519'
|
||||||
|
|
||||||
|
const blake = require('blakejs')
|
||||||
|
|
||||||
export class Ed25519 {
|
export class Ed25519 {
|
||||||
|
|
||||||
curve: Curve25519
|
curve: Curve25519
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import * as blake from 'blakejs'
|
|
||||||
import { Convert } from './util/convert'
|
import { Convert } from './util/convert'
|
||||||
|
|
||||||
|
const blake = require('blakejs')
|
||||||
|
|
||||||
export class NanoAddress {
|
export class NanoAddress {
|
||||||
|
|
||||||
readonly alphabet = '13456789abcdefghijkmnopqrstuwxyz'
|
readonly alphabet = '13456789abcdefghijkmnopqrstuwxyz'
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ export default class NanoConverter {
|
||||||
/**
|
/**
|
||||||
* Converts the input value to the wanted unit
|
* Converts the input value to the wanted unit
|
||||||
*
|
*
|
||||||
* @param input {BigNumber} value
|
* @param input {string | BigNumber} value
|
||||||
* @param inputUnit {Unit} the unit to convert from
|
* @param inputUnit {string} the unit to convert from
|
||||||
* @param outputUnit {Unit} the unit to convert to
|
* @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())
|
let value = new BigNumber(input.toString())
|
||||||
|
|
||||||
switch (inputUnit) {
|
switch (inputUnit) {
|
||||||
|
|
|
||||||
|
|
@ -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++) {
|
for (let i = 0; i < 16; i++) {
|
||||||
o[i] = n[2 * i] + (n[2 * i + 1] << 8)
|
o[i] = n[2 * i] + (n[2 * i + 1] << 8)
|
||||||
}
|
}
|
||||||
|
|
@ -563,7 +563,7 @@ export class Curve25519 {
|
||||||
o[15] &= 0x7fff
|
o[15] &= 0x7fff
|
||||||
}
|
}
|
||||||
|
|
||||||
unpackNeg(r: Int32Array[], p: Int32Array): number {
|
unpackNeg(r: Int32Array[], p: Uint8Array): number {
|
||||||
const t = this.gf(),
|
const t = this.gf(),
|
||||||
chk = this.gf(),
|
chk = this.gf(),
|
||||||
num = this.gf(),
|
num = this.gf(),
|
||||||
|
|
|
||||||
15
package-lock.json
generated
15
package-lock.json
generated
|
|
@ -4,6 +4,15 @@
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"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": {
|
"@types/node": {
|
||||||
"version": "12.7.12",
|
"version": "12.7.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.12.tgz",
|
"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",
|
"resolved": "https://registry.npmjs.org/bignumber/-/bignumber-1.1.0.tgz",
|
||||||
"integrity": "sha1-5qsKdD2l8+oBjlwXWX0SH3howVk="
|
"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": {
|
"blakejs": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,16 @@
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bignumber": "^1.1.0",
|
"bignumber": "1.1.0",
|
||||||
"blakejs": "^1.1.0"
|
"blakejs": "1.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.7.12",
|
"@types/bignumber.js": "5.0.0",
|
||||||
|
"@types/node": "12.7.12",
|
||||||
"typescript": "3.6.3"
|
"typescript": "3.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
|
"strictNullChecks": false,
|
||||||
"types": [
|
"types": [
|
||||||
"node",
|
"node"
|
||||||
"index.d.ts"
|
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2017"
|
"es2017"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue