minimal-xec-wallet 2.1.3 → 2.2.1
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/CHANGES.md +104 -0
- package/dist/minimal-xec-wallet.esm.js +15755 -33725
- package/dist/minimal-xec-wallet.js +6922 -24893
- package/dist/minimal-xec-wallet.min.js +19 -10
- package/examples/test-examples.js +4 -3
- package/index.js +0 -69
- package/lib/adapters/robust-chronik-router.js +1 -6
- package/lib/adapters/router.js +1 -24
- package/lib/alp-token-handler.js +40 -283
- package/lib/base-token-handler.js +216 -0
- package/lib/consolidate-utxos.js +11 -25
- package/lib/hybrid-token-manager.js +0 -31
- package/lib/key-derivation.js +23 -21
- package/lib/op-return.js +6 -22
- package/lib/security.js +0 -2
- package/lib/send-xec.js +15 -42
- package/lib/slp-token-handler.js +40 -326
- package/lib/token-protocol-detector.js +0 -2
- package/lib/tx-utils.js +77 -0
- package/lib/utxo-analytics/UtxoClassifier.js +1 -18
- package/lib/utxo-analytics/UtxoHealthMonitor.js +1 -20
- package/lib/utxos.js +9 -28
- package/package.json +11 -10
- package/rollup.config.mjs +40 -1
- package/lib/browser-wasm-loader.js +0 -446
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.2.1] - 2025-02-10
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
#### Code Cleanup & Deduplication
|
|
8
|
+
|
|
9
|
+
Major internal cleanup reducing code duplication and removing dead code. No public API changes.
|
|
10
|
+
|
|
11
|
+
**Dead code removed:**
|
|
12
|
+
- Deleted `lib/browser-wasm-loader.js` (446 lines) and `browser-shims/ecash_lib_wasm_browser.js` (309 lines) — unused WASM loader code
|
|
13
|
+
- Removed 3 dead `require('./browser-shims/...')` calls and `_initializeWASM()` method from `index.js`
|
|
14
|
+
- Removed 3 stub methods from `lib/adapters/router.js` (`getETokenData`, `getETokenData2`, `getPsfWritePrice`)
|
|
15
|
+
|
|
16
|
+
**Debug statements removed:**
|
|
17
|
+
- Removed all ~120 `console.log`/`console.warn`/`console.error` statements from lib/ and index.js
|
|
18
|
+
- Errors now propagate via `throw` only, no console side-effects
|
|
19
|
+
|
|
20
|
+
**Shared utilities extracted (`lib/tx-utils.js`):**
|
|
21
|
+
- `getUtxoValue()` — single implementation replacing 6 duplicate copies across lib/
|
|
22
|
+
- `estimateFee()` — single fee calculator replacing 5 duplicates, uses 141 bytes/input (Schnorr P2PKH)
|
|
23
|
+
- `getPrivateKey()` — shared key derivation helper
|
|
24
|
+
- `getOutputScript()` — shared P2PKH script builder
|
|
25
|
+
|
|
26
|
+
**Token handler base class (`lib/base-token-handler.js`):**
|
|
27
|
+
- Extracted ~400 lines of shared logic from SLP and ALP token handlers
|
|
28
|
+
- Shared methods: `sendTokens()`, `burnTokens()`, `_categorizeUtxos()`, `_selectTokenUtxos()`, `_selectXecUtxos()`, `_displayToAtoms()`, `_atomsToDisplay()`
|
|
29
|
+
- SLP and ALP handlers now extend `BaseTokenHandler`, keeping only protocol-specific transaction building
|
|
30
|
+
|
|
31
|
+
**Dependencies cleaned up:**
|
|
32
|
+
- Removed unused: `@chris.troutner/retry-queue-commonjs`, `bignumber.js`
|
|
33
|
+
- Removed unused devDep: `lodash.clonedeep`
|
|
34
|
+
- Moved `qrcode-terminal` to devDependencies (only used in examples/)
|
|
35
|
+
- Fixed `"module"` field to point to ESM bundle (`./dist/minimal-xec-wallet.esm.js`)
|
|
36
|
+
|
|
37
|
+
**Impact:**
|
|
38
|
+
- Bundle size: ~711KB → ~574KB minified (-19%)
|
|
39
|
+
- 0 console statements in production code (was ~120)
|
|
40
|
+
- 527 tests passing (was 504, +23 new tests for shared utilities)
|
|
41
|
+
|
|
42
|
+
### Files Added
|
|
43
|
+
- `lib/tx-utils.js` — shared transaction utilities
|
|
44
|
+
- `lib/base-token-handler.js` — shared SLP/ALP base class
|
|
45
|
+
- `test/unit/a14-tx-utils.js` — unit tests for tx-utils
|
|
46
|
+
|
|
47
|
+
### Files Deleted
|
|
48
|
+
- `lib/browser-wasm-loader.js`
|
|
49
|
+
- `browser-shims/ecash_lib_wasm_browser.js`
|
|
50
|
+
|
|
51
|
+
### Files Modified
|
|
52
|
+
- `index.js` — removed dead WASM code and console statements
|
|
53
|
+
- `lib/slp-token-handler.js` — extends BaseTokenHandler, uses tx-utils
|
|
54
|
+
- `lib/alp-token-handler.js` — extends BaseTokenHandler, uses tx-utils
|
|
55
|
+
- `lib/send-xec.js` — uses tx-utils
|
|
56
|
+
- `lib/op-return.js` — uses tx-utils
|
|
57
|
+
- `lib/consolidate-utxos.js` — uses tx-utils
|
|
58
|
+
- `lib/utxos.js` — uses tx-utils
|
|
59
|
+
- `lib/hybrid-token-manager.js` — removed console statements
|
|
60
|
+
- `lib/adapters/router.js` — removed stubs and console statements
|
|
61
|
+
- `lib/adapters/robust-chronik-router.js` — removed console statements
|
|
62
|
+
- `lib/utxo-analytics/UtxoHealthMonitor.js` — removed console statements
|
|
63
|
+
- `lib/utxo-analytics/UtxoClassifier.js` — removed console statements
|
|
64
|
+
- `lib/token-protocol-detector.js` — removed console statements
|
|
65
|
+
- `lib/security.js` — removed console statements
|
|
66
|
+
- `package.json` — removed unused deps, fixed module field
|
|
67
|
+
|
|
68
|
+
## [2.1.4] - 2025-02-10
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
#### Browser Token Sends (CRITICAL)
|
|
73
|
+
|
|
74
|
+
Fixed SLP/ALP token sends crashing in the browser with `Cannot read properties of undefined (reading 'BASE')`.
|
|
75
|
+
|
|
76
|
+
**The Problem:**
|
|
77
|
+
The `initBrowser-shim.js` used `secp256k1.ProjectivePoint` to access the elliptic curve point class, but `@noble/curves` v2's `ecdsa()` exports it as `Point`, not `ProjectivePoint`. This caused all transaction signing to fail in the browser bundle.
|
|
78
|
+
|
|
79
|
+
**The Fix:**
|
|
80
|
+
- Replaced all 7 `secp256k1.ProjectivePoint` references with `secp256k1.Point` in `browser-shims/initBrowser-shim.js`
|
|
81
|
+
|
|
82
|
+
#### Improved ALP Token Send Error Messages
|
|
83
|
+
|
|
84
|
+
Replaced raw sats values with human-readable XEC amounts and actionable advice in ALP insufficient-funds errors.
|
|
85
|
+
|
|
86
|
+
- "Need 1452 sats, have 546 from tokens" becomes "Need 14.52 XEC total, but only have 5.46 XEC from token UTXOs. Send some XEC to this address first."
|
|
87
|
+
- Added shortfall amount when wallet is partially funded
|
|
88
|
+
|
|
89
|
+
#### More Accurate Fee Estimation
|
|
90
|
+
|
|
91
|
+
Updated transaction size estimation for Schnorr-signed P2PKH inputs (141 bytes instead of 148 for DER-encoded signatures).
|
|
92
|
+
|
|
93
|
+
- `lib/alp-token-handler.js`: 148 -> 141 bytes/input, 50 -> 43 overhead
|
|
94
|
+
- `lib/slp-token-handler.js`: 148 -> 141 bytes/input
|
|
95
|
+
|
|
96
|
+
#### Example Pre-check Threshold
|
|
97
|
+
|
|
98
|
+
Raised the minimum XEC balance check in `examples/test-examples.js` from 1 XEC to 15 XEC, which is the realistic minimum needed for dust outputs + fees in a token send.
|
|
99
|
+
|
|
100
|
+
### Files Updated
|
|
101
|
+
|
|
102
|
+
- `browser-shims/initBrowser-shim.js` - Fix ProjectivePoint -> Point
|
|
103
|
+
- `lib/alp-token-handler.js` - Error messages and fee estimation
|
|
104
|
+
- `lib/slp-token-handler.js` - Fee estimation
|
|
105
|
+
- `examples/test-examples.js` - Pre-check threshold
|
|
106
|
+
|
|
3
107
|
## [2.1.3] - 2025-02-05
|
|
4
108
|
|
|
5
109
|
### Fixed
|