@leather.io/utils 0.49.1 → 0.49.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@leather.io/utils",
3
3
  "author": "Leather.io contact@leather.io",
4
4
  "description": "Shared bitcoin utilities",
5
- "version": "0.49.1",
5
+ "version": "0.49.3",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/leather-io/mono/tree/dev/packages/utils",
8
8
  "repository": {
@@ -19,16 +19,17 @@
19
19
  "dependencies": {
20
20
  "bignumber.js": "9.1.2",
21
21
  "dompurify": "3.2.4",
22
- "@leather.io/constants": "0.28.1",
23
- "@leather.io/models": "0.50.0"
22
+ "@leather.io/constants": "0.28.3",
23
+ "@leather.io/models": "0.50.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/dompurify": "3.0.5",
27
27
  "prettier": "3.5.1",
28
- "tsup": "8.4.0",
29
- "typescript": "5.8.3",
28
+ "tsdown": "0.16.5",
29
+ "typescript": "5.9.3",
30
30
  "vitest": "2.1.9",
31
- "@leather.io/tsconfig-config": "0.11.0",
31
+ "@leather.io/test-config": "0.1.2",
32
+ "@leather.io/tsconfig-config": "0.11.1",
32
33
  "@leather.io/prettier-config": "0.9.0"
33
34
  },
34
35
  "keywords": [
@@ -40,11 +41,14 @@
40
41
  "publishConfig": {
41
42
  "access": "public"
42
43
  },
44
+ "types": "./dist/index.d.ts",
43
45
  "scripts": {
44
- "build": "tsup",
45
- "build:watch": "tsup --watch --onSuccess 'tsup --dts-only'",
46
+ "build": "tsdown",
47
+ "build:watch": "tsdown --watch",
46
48
  "format": "prettier . --write --ignore-path ../../.prettierignore",
47
49
  "format:check": "prettier . --check --ignore-path ../../.prettierignore",
50
+ "lint": "eslint --cache --max-warnings 0",
51
+ "lint:fix": "pnpm lint --fix",
48
52
  "test:coverage": "vitest run --coverage",
49
53
  "test:unit": "vitest run",
50
54
  "typecheck": "tsc --noEmit"
@@ -9,10 +9,7 @@ import {
9
9
 
10
10
  interface CreateCurrencyFormatterParams {
11
11
  locale: string;
12
- onError?: (
13
- error: unknown,
14
- context: { locale: string; options: Intl.NumberFormatOptions }
15
- ) => void;
12
+ onError?(error: unknown, context: { locale: string; options: Intl.NumberFormatOptions }): void;
16
13
  }
17
14
 
18
15
  const fallback = '';
package/src/index.ts CHANGED
@@ -22,7 +22,6 @@ export * from './special-char';
22
22
  export { spamFilter } from './spam-filter/spam-filter';
23
23
  export { extractPhraseFromString } from './extract-phrase-from-string/extract-phrase-from-string';
24
24
  export { pxStringToNumber } from './px-string-to-number/px-string-to-number';
25
- export { makeStacksTxExplorerLink } from './explorer/make-stacks-tx-explorer-link';
26
25
  export function isNumber(value: unknown): value is number {
27
26
  return typeof value === 'number';
28
27
  }
@@ -72,8 +71,9 @@ export function isTypedArray(val: unknown): val is Uint8Array {
72
71
  return val instanceof TypedArray;
73
72
  }
74
73
 
75
- // eslint-disable-next-line @typescript-eslint/no-empty-function
76
- export function noop() {}
74
+ export function noop() {
75
+ // expected to be empty
76
+ }
77
77
 
78
78
  export function ensureArray<T>(value: T | T[]): T[] {
79
79
  return Array.isArray(value) ? value : [value];
@@ -98,7 +98,7 @@ export const defaultWalletKeyId = 'default';
98
98
 
99
99
  export function reverseBytes(bytes: Buffer): Buffer;
100
100
  export function reverseBytes(bytes: Uint8Array): Uint8Array;
101
- export function reverseBytes(bytes: Buffer | Uint8Array) {
101
+ export function reverseBytes(bytes: Buffer | Uint8Array): Buffer | Uint8Array {
102
102
  if (Buffer.isBuffer(bytes)) return Buffer.from(bytes).reverse();
103
103
  return new Uint8Array(bytes.slice().reverse());
104
104
  }
@@ -159,7 +159,7 @@ export function getTicker(value: string) {
159
159
  name = `${getLetters(words[0])}${getLetters(words[1], 2)}`;
160
160
  }
161
161
  } else if (name.length >= 3) {
162
- name = `${getLetters(name, 3)}`;
162
+ name = getLetters(name, 3);
163
163
  }
164
164
  return name.toUpperCase();
165
165
  }
package/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "extends": ["@leather.io/tsconfig-config/tsconfig.base.json"],
3
- "include": ["**/*", ".*.ts"],
4
- "exclude": ["./dist/"],
3
+ "include": ["src/**/*"],
5
4
  "compilerOptions": {
6
- "baseUrl": "src",
5
+ "baseUrl": "./src",
6
+ "rootDir": "./src",
7
7
  "types": ["vitest/globals"],
8
8
  "outDir": "./dist"
9
9
  }
@@ -1,10 +1,8 @@
1
- import { defineConfig } from 'tsup';
1
+ import { defineConfig } from 'tsdown';
2
2
 
3
3
  export default defineConfig({
4
4
  entry: ['src/index.ts'],
5
- sourcemap: true,
6
- clean: false,
7
5
  dts: true,
8
- format: 'esm',
9
6
  external: ['dompurify'],
7
+ fixedExtension: false,
10
8
  });
package/vitest.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineProject } from 'vitest/config';
2
2
 
3
- import { defaultVitestUnitTestingConfig } from '../../config/vitest-configs';
3
+ import { defaultVitestUnitTestingConfig } from '@leather.io/test-config';
4
4
 
5
5
  export default defineProject({ ...defaultVitestUnitTestingConfig });
@@ -1,21 +0,0 @@
1
- import { HIRO_EXPLORER_URL } from '@leather.io/constants';
2
- import { BitcoinNetworkModes, HIRO_API_BASE_URL_NAKAMOTO_TESTNET } from '@leather.io/models';
3
-
4
- interface MakeStacksTxExplorerLinkArgs {
5
- mode: BitcoinNetworkModes;
6
- searchParams?: URLSearchParams;
7
- txid: string;
8
- isNakamoto?: boolean;
9
- }
10
- // TODO LEA-2285: Remove this function from the extension
11
- export function makeStacksTxExplorerLink({
12
- mode,
13
- searchParams = new URLSearchParams(),
14
- txid,
15
- isNakamoto = false,
16
- }: MakeStacksTxExplorerLinkArgs) {
17
- if (mode === 'regtest') return 'http://localhost:8000/txid/' + txid;
18
- searchParams.append('chain', mode);
19
- if (isNakamoto) searchParams.append('api', HIRO_API_BASE_URL_NAKAMOTO_TESTNET);
20
- return `${HIRO_EXPLORER_URL}/txid/${txid}?${searchParams.toString()}`;
21
- }