]> git.codecow.com Git - libnemo.git/commitdiff
Mark restricted constructors as private to inform Typescript engine.
authorChris Duncan <chris@zoso.dev>
Thu, 17 Jul 2025 15:37:22 +0000 (08:37 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 17 Jul 2025 15:37:22 +0000 (08:37 -0700)
src/lib/account.ts
src/lib/bip39-mnemonic.ts
src/lib/entropy.ts
src/lib/wallets/bip44-wallet.ts
src/lib/wallets/blake2b-wallet.ts
src/lib/wallets/ledger-wallet.ts

index 6fa9f442376700aae9c18366acc3be79a6bfb494..9d571ccb3f3f2c264d0712c8f83512c958e06ed8 100644 (file)
@@ -50,7 +50,7 @@ export class Account {
        }\r
        set weight (v) { this.#weight = v ? BigInt(v) : undefined }\r
 \r
-       constructor (address: string, publicKey: Uint8Array<ArrayBuffer>) {\r
+       private constructor (address: string, publicKey: Uint8Array<ArrayBuffer>) {\r
                if (!Account.#isInternal) {\r
                        throw new Error(`Account cannot be instantiated directly. Use factory methods instead.`)\r
                }\r
index c1d7cfe4d6e38d3efb930b02c3a28a86147b3445..e286d766c2a79a33fd71e702462c8cf0eb764dd4 100644 (file)
@@ -18,7 +18,7 @@ export class Bip39Mnemonic {
        #phrase: string = ''\r
        get phrase (): string { return this.#phrase.normalize('NFKD') }\r
 \r
-       constructor () {\r
+       private constructor () {\r
                if (!Bip39Mnemonic.#isInternal) {\r
                        throw new Error(`Bip39Mnemonic must be created with async methods 'fromPhrase()' or 'fromEntropy().`)\r
                }\r
index f3563a6e768cb76cb90ab20cf1d02cb94e4ee04d..ccacb0690eb08d5e3c75424f7db054d56d2f1f99 100644 (file)
@@ -24,7 +24,7 @@ export class Entropy {
        get bytes (): Uint8Array { return this.#bytes }
        get hex (): string { return bytes.toHex(this.#bytes) }
 
-       constructor (bytes: Uint8Array<ArrayBuffer>) {
+       private constructor (bytes: Uint8Array<ArrayBuffer>) {
                if (!Entropy.#isInternal) {
                        throw new Error(`Entropy cannot be instantiated directly. Use 'await Entropy.create()' instead.`)
                }
index bd1ca66690e4ad9582fafd18b89d085c9cb7413f..79c18cd082f1aa38bc0e81e85bb2a2ad1fd1f77c 100644 (file)
@@ -34,7 +34,7 @@ import { Bip44CkdWorker } from '#workers'
 export class Bip44Wallet extends Wallet {\r
        static #isInternal: boolean = false\r
 \r
-       constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
+       private constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
                if (!Bip44Wallet.#isInternal) {\r
                        throw new Error(`Bip44Wallet cannot be instantiated directly. Use 'await Bip44Wallet.create()' instead.`)\r
                }\r
index 505e4182a31c6763a62344dba61178177396e2d3..e093069d412d2def6c1903417d39ccc17af718a7 100644 (file)
@@ -28,7 +28,7 @@ import { KeyPair } from '#types'
 export class Blake2bWallet extends Wallet {\r
        static #isInternal: boolean = false\r
 \r
-       constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
+       private constructor (id: Entropy, seed?: Uint8Array<ArrayBuffer>, mnemonic?: Bip39Mnemonic) {\r
                if (!Blake2bWallet.#isInternal) {\r
                        throw new Error(`Blake2bWallet cannot be instantiated directly. Use 'await Blake2bWallet.create()' instead.`)\r
                }\r
index ec9cf03b607271272bd1d273ebba74ac9060ec44..ca7175fac5b17c5a7c34b92088d34ea09e340fdf 100644 (file)
@@ -61,7 +61,7 @@ export class LedgerWallet extends Wallet {
 \r
        DynamicTransport: typeof TransportBLE | typeof TransportUSB | typeof TransportHID = TransportHID\r
 \r
-       constructor (id: Entropy) {\r
+       private constructor (id: Entropy) {\r
                if (!LedgerWallet.#isInternal) {\r
                        throw new Error(`LedgerWallet cannot be instantiated directly. Use 'await LedgerWallet.create()' instead.`)\r
                }\r