From 7928ad9cb1b772b1293cca366b7467f5d4d8b0d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Miro=20Mets=C3=A4nheimo?= Date: Fri, 18 Oct 2019 19:03:17 +0300 Subject: [PATCH] add default exports, clear dist before compile --- index.ts | 4 ++-- lib/address-generator.ts | 6 +++--- lib/address-importer.ts | 6 +++--- lib/bip32-key-derivation.ts | 3 +-- lib/bip39-mnemonic.ts | 4 ++-- lib/block-signer.ts | 6 +++--- lib/ed25519.ts | 6 +++--- lib/nano-address.ts | 4 ++-- lib/util/convert.ts | 2 +- lib/util/curve25519.ts | 4 ++-- lib/util/util.ts | 2 +- package.json | 11 +++++++---- tsconfig.json | 1 + 13 files changed, 31 insertions(+), 28 deletions(-) diff --git a/index.ts b/index.ts index 8133a47..c7e6941 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,5 @@ -import { AddressGenerator } from './lib/address-generator' -import { AddressImporter, Account, Wallet } from './lib/address-importer' +import AddressGenerator from './lib/address-generator' +import AddressImporter, { Account, Wallet } from './lib/address-importer' import BlockSigner, { TransactionBlock, RepresentativeBlock, SignedBlock } from './lib/block-signer' import BigNumber from 'bignumber.js' import NanoConverter from './lib/nano-converter' diff --git a/lib/address-generator.ts b/lib/address-generator.ts index 629cc95..c03f27e 100644 --- a/lib/address-generator.ts +++ b/lib/address-generator.ts @@ -1,10 +1,10 @@ import Bip32KeyDerivation from './bip32-key-derivation' import Bip39Mnemonic from './bip39-mnemonic' -import { Ed25519 } from './ed25519' -import { NanoAddress } from './nano-address' +import Ed25519 from './ed25519' +import NanoAddress from './nano-address' import { Wallet } from './address-importer' -export class AddressGenerator { +export default class AddressGenerator { /** * Generates the wallet diff --git a/lib/address-importer.ts b/lib/address-importer.ts index fe6418a..ea57594 100644 --- a/lib/address-importer.ts +++ b/lib/address-importer.ts @@ -1,9 +1,9 @@ import Bip32KeyDerivation from './bip32-key-derivation' import Bip39Mnemonic from './bip39-mnemonic' -import { Ed25519 } from './ed25519' -import { NanoAddress } from './nano-address' +import Ed25519 from './ed25519' +import NanoAddress from './nano-address' -export class AddressImporter { +export default class AddressImporter { fromMnemonic(mnemonic: string, seedPassword = ''): Wallet { const bip39 = new Bip39Mnemonic(seedPassword) diff --git a/lib/bip32-key-derivation.ts b/lib/bip32-key-derivation.ts index 5c73913..5a25801 100644 --- a/lib/bip32-key-derivation.ts +++ b/lib/bip32-key-derivation.ts @@ -1,7 +1,6 @@ -import { Convert } from './util/convert' - //@ts-ignore import { enc, algo } from 'crypto-js' +import Convert from './util/convert' const ED25519_CURVE = 'ed25519 seed' const HARDENED_OFFSET = 0x80000000 diff --git a/lib/bip39-mnemonic.ts b/lib/bip39-mnemonic.ts index 94dc752..931d25c 100644 --- a/lib/bip39-mnemonic.ts +++ b/lib/bip39-mnemonic.ts @@ -1,6 +1,6 @@ +import Convert from './util/convert' +import Util from './util/util' import words from './words' -import { Util } from './util/util' -import { Convert } from './util/convert' //@ts-ignore import { algo, enc, lib, PBKDF2, SHA256 } from 'crypto-js' diff --git a/lib/block-signer.ts b/lib/block-signer.ts index 27c87b8..e02249e 100644 --- a/lib/block-signer.ts +++ b/lib/block-signer.ts @@ -1,8 +1,8 @@ import BigNumber from 'bignumber.js' -import { Ed25519 } from './ed25519' -import { NanoAddress } from './nano-address' +import Convert from './util/convert' +import Ed25519 from './ed25519' +import NanoAddress from './nano-address' import NanoConverter from './nano-converter' -import { Convert } from './util/convert' //@ts-ignore import { blake2b, blake2bInit, blake2bUpdate, blake2bFinal } from 'blakejs' diff --git a/lib/ed25519.ts b/lib/ed25519.ts index 4797ef1..e14fd4e 100644 --- a/lib/ed25519.ts +++ b/lib/ed25519.ts @@ -1,10 +1,10 @@ -import { Convert } from './util/convert' -import { Curve25519 } from './util/curve25519' +import Convert from './util/convert' +import Curve25519 from './util/curve25519' //@ts-ignore import { blake2b } from 'blakejs' -export class Ed25519 { +export default class Ed25519 { curve: Curve25519 X: Int32Array diff --git a/lib/nano-address.ts b/lib/nano-address.ts index 4079458..8f37cb9 100644 --- a/lib/nano-address.ts +++ b/lib/nano-address.ts @@ -1,9 +1,9 @@ -import { Convert } from './util/convert' +import Convert from './util/convert' //@ts-ignore import { blake2b } from 'blakejs' -export class NanoAddress { +export default class NanoAddress { readonly alphabet = '13456789abcdefghijkmnopqrstuwxyz' readonly prefix = 'nano_' diff --git a/lib/util/convert.ts b/lib/util/convert.ts index dad46e9..63dba1b 100644 --- a/lib/util/convert.ts +++ b/lib/util/convert.ts @@ -1,4 +1,4 @@ -export class Convert { +export default class Convert { /** * Convert a string (UTF-8 encoded) to a byte array diff --git a/lib/util/curve25519.ts b/lib/util/curve25519.ts index b006acb..7c71222 100644 --- a/lib/util/curve25519.ts +++ b/lib/util/curve25519.ts @@ -1,6 +1,6 @@ -import { Util } from './util' +import Util from './util' -export class Curve25519 { +export default class Curve25519 { gf0: Int32Array gf1: Int32Array diff --git a/lib/util/util.ts b/lib/util/util.ts index 4f5e4b6..7e3bb8b 100644 --- a/lib/util/util.ts +++ b/lib/util/util.ts @@ -1,4 +1,4 @@ -export class Util { +export default class Util { /** * Time constant comparison of two arrays diff --git a/package.json b/package.json index c534f97..e4c5ba7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nanocurrency-web", - "version": "1.0.3", - "description": "Toolset for Nano cryptocurrency client side offline integrations", + "version": "1.0.4", + "description": "Toolkit for Nano cryptocurrency client side offline integrations", "author": "Miro Metsänheimo ", "license": "MIT", "homepage": "https://github.com/numsu/nanocurrency-web-js#readme", @@ -16,13 +16,16 @@ "nano", "currency", "mnemonic", - "crypto" + "crypto", + "wallet", + "block", + "sign" ], "main": "dist/index.js", "types": "dist/index.d.ts", "unpkg": "dist/index.min.js", "scripts": { - "build": "tsc && npm run build:webpack", + "build": "rm -rf dist && tsc && npm run build:webpack", "build:webpack": "webpack", "test": "mocha --reporter spec" }, diff --git a/tsconfig.json b/tsconfig.json index 8c3ddd8..440093c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "esModuleInterop": true, "downlevelIteration": true, "strictNullChecks": false, + "forceConsistentCasingInFileNames": true, "types": [ "node" ], -- 2.34.1