Attempted fix for publishing

This commit is contained in:
Jim Hamill
2025-01-12 03:02:58 +00:00
parent 31ecf52540
commit fa46c5a4f8
11 changed files with 88 additions and 74 deletions
+1
View File
@@ -3,4 +3,5 @@
</script>
<!-- Resume Markdown parsing -->
TODO: Once we have other tools, we might want to turn this into a page like that on Quick Start that presents a "box" of each Tool Group.
+34 -11
View File
@@ -24,26 +24,31 @@ import {
# Primitive Tools
## Address
<div class="tool">
<p>A Utility tool for converting between different address formats.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="address.from"
:toFunctions="address.to"
/>
</div>
## Block Header
<div class="tool">
<p>A utility tool for converting between different byte representations.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="blockHeader.from"
:toFunctions="blockHeader.to"
/>
</div>
## Bytes
<div class="tool">
<p>A utility tool for converting between different byte representations.</p>
@@ -54,93 +59,111 @@ import {
</div>
## Hasher
<div class="tool">
<p>A utility tool for computing various cryptographic hashes commonly used in Bitcoin Cash.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="hasher.from"
:toFunctions="hasher.to"
/>
</div>
## HD Private Node
<div class="tool">
<p>A utility tool for generating and manipulating HD Private Nodes.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="hdPrivateNode.from"
:toFunctions="hdPrivateNode.to"
/>
</div>
## HD Public Node
<div class="tool">
<p>A utility tool for generating and manipulating HD Public Nodes.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="hdPublicNode.from"
:toFunctions="hdPublicNode.to"
/>
</div>
## Mnemonic
<div class="tool">
<p>A utility tool for generating and validating BIP39 Mnemonics. Note that mnemonics will be normalized by removing redundant whitespace and will also be validated against the BIP39 English Word List (other word-lists can be specified via the API)</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="mnemonic.from"
:toFunctions="mnemonic.to"
/>
</div>
## Private Key
<div class="tool">
<p>A utility tool for generating and manipulating Private Keys.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="privateKey.from"
:toFunctions="privateKey.to"
:methods="privateKey.methods"
/>
</div>
## Public Key
<div class="tool">
<p>A utility tool for generating and manipulating Public Keys.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="publicKey.from"
:toFunctions="publicKey.to"
:methods="publicKey.methods"
/>
</div>
## Satoshis
<div class="tool">
<p>A utility tool for converting between Bitcoin Cash value units.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="satoshis.from"
:toFunctions="satoshis.to"
/>
</div>
## Script
<div class="tool">
<p>A utility tool for generating and manipulating Script objects.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="script.from"
:toFunctions="script.to"
/>
</div>
## Transaction
<div class="tool">
<p>A utility tool for generating and manipulating Transaction objects.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="transaction.from"
:toFunctions="transaction.to"
/>
</div>
+3 -1
View File
@@ -12,12 +12,14 @@ import {
# Utils
## Encryption
<div class="tool">
<p>A Utility tool for converting between different address formats.</p>
<PrimitiveToolVue
<PrimitiveToolVue
:fromFunctions="encryption.from"
:toFunctions="encryption.to"
:methods="encryption.methods"
/>
</div>
+4 -2
View File
@@ -12,10 +12,12 @@
"scripts": {
"build": "tsc --build --clean && tsc --build",
"prepublishOnly": "npm run build",
"test": "vitest",
"test": "vitest --run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"watch": "tsc --watch"
},
"author": "",
"license": "ISC"
"license": "ISC",
"gitHead": "2d550cef4b179b17110363512ee0fde54a5da79a"
}
+18 -9
View File
@@ -6,7 +6,7 @@ import {
export type MnemonicRaw = {
words: string[];
passphrase?: string;
}
};
/**
* Class representing a BIP39 Mnemonic phrase.
@@ -32,7 +32,10 @@ export class Mnemonic {
* @throws {Error} If mnemonic could not be generated.
* @returns Instance of Mnemonic.
*/
public static from(phraseOrWords: string | Array<string>, wordList: Array<string> = bip39WordListEnglish) {
public static from(
phraseOrWords: string | Array<string>,
wordList: Array<string> = bip39WordListEnglish,
) {
// If this is a list of words...
if (Array.isArray(phraseOrWords)) {
return this.fromWords(phraseOrWords, wordList);
@@ -49,7 +52,10 @@ export class Mnemonic {
* @throws {Error} If mnemonic could not be generated.
* @returns Instance of Mnemonic.
*/
public static fromString(phrase: string, wordList: Array<string> = bip39WordListEnglish) {
public static fromString(
phrase: string,
wordList: Array<string> = bip39WordListEnglish,
) {
// Split into words and remove any whitespace.
const allWords = phrase
.trim()
@@ -67,7 +73,10 @@ export class Mnemonic {
* @throws {Error} If mnemonic could not be generated.
* @returns Instance of Mnemonic.
*/
public static fromWords(words: Array<string>, wordList: Array<string> = bip39WordListEnglish) {
public static fromWords(
words: Array<string>,
wordList: Array<string> = bip39WordListEnglish,
) {
// Check if last word is a passphrase by looking at total count
const hasPassphrase =
words.length === 13 ||
@@ -79,10 +88,10 @@ export class Mnemonic {
// Parse words and optional passphrase
const mnemonicRaw: MnemonicRaw = {
words: hasPassphrase ? words.slice(0, -1) : words,
}
};
if(hasPassphrase) {
mnemonicRaw.passphrase = words[words.length - 1]
if (hasPassphrase) {
mnemonicRaw.passphrase = words[words.length - 1];
}
// Validate word count
@@ -226,9 +235,9 @@ export class Mnemonic {
* @returns Number of words.
*/
public toWords(includePassphrase: boolean = true): Array<string> {
const words = [ ...this.mnemonic.words ];
const words = [...this.mnemonic.words];
if(this.mnemonic.passphrase && includePassphrase) {
if (this.mnemonic.passphrase && includePassphrase) {
words.push(this.mnemonic.passphrase);
}
+3 -10
View File
@@ -4,16 +4,9 @@
"outDir": "./dist",
"rootDir": "./src",
"paths": {
"~/*": [
"./*"
]
"~/*": ["./*"]
}
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
+2 -1
View File
@@ -24,8 +24,9 @@
"bench": "vitest bench",
"build": "tsc --build --clean && tsc --build",
"prepublishOnly": "npm run build",
"test": "vitest",
"test": "vitest --run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"watch": "tsc --watch"
},
"author": "",
@@ -1,9 +1,7 @@
import { BaseStorage, BaseStore, StorageOpts } from './base-store.js';
import { StoreInMemorySynced } from './store-inmemory-synced.js';
import {
Encryption,
} from '../utils';
import { Encryption } from '../utils';
import {
encodeExtendedJsonObject,
+4 -13
View File
@@ -4,19 +4,10 @@
"outDir": "./dist",
"rootDir": "./src",
"paths": {
"~/*": [
"./*"
]
"~/*": ["./*"]
},
"lib": [
"dom"
]
"lib": ["dom"]
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}