Typescript migration#22
Merged
Merged
Conversation
Toolchain:
- typescript 6.x, vue-tsc, @vue/tsconfig, @types/node
- @typescript-eslint/{parser,eslint-plugin} for linting TS
- eslint-import-resolver-typescript so eslint-plugin-import
can find .ts modules
- yarn typecheck script (vue-tsc --noEmit)
tsconfig.json extends @vue/tsconfig/tsconfig.dom.json with
strict mode, bundler module resolution, allowJs for the
.vue files we haven't migrated yet.
src/env.d.ts declares ambient *.vue components and shims
bitgo-utxo-lib as `any` since it ships no types.
ESLint config now:
- extends plugin:@typescript-eslint/recommended
- uses vue-eslint-parser with @typescript-eslint/parser
inside <script lang="ts"> blocks (overrides for .ts/.vue)
- import/extensions allows .vue and bare imports for .js/.ts
- caughtErrorsIgnorePattern: ^_ for intentionally-ignored
catch errors
Converted modules to .ts with explicit types:
- src/main.ts
- src/utils.ts (resolveNetwork is now generic over T;
truncateHex preserves null/undefined; validators take
`unknown` and narrow internally)
- src/composables/copyToast.ts
- src/composables/utxoCache.ts
- src/composables/network.ts (Chain union type; Utxo
interface; bitgo exported as `any`)
- src/__tests__/utils.spec.ts
index.html script tag now references main.ts.
The .vue files still use plain <script> blocks. Next commit
flips each to <script lang="ts"> with prop/data/method
annotations.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
App.vue + 13 components flipped to TypeScript: - defineComponent() wrapper for type inference on Options API - PropType<Chain> narrowing on the chain prop - Explicit Data interface returned from each component's data() - Method return types annotated (Promise<void> for async, void for sync side-effect methods, string/number etc. for computed) - catch blocks use `e instanceof Error ? e.message : String(e)` pattern to satisfy unknown error typing Inject for the shared coinControl reactive object uses setup() + Composition API's typed inject<CoinControlState>, since Options-API inject can't carry type info. The rest of each component stays Options API. Template event handlers cast $event.target to HTMLInputElement where checkbox `.checked` was being read; vue-tsc otherwise sees EventTarget which has no .checked property. Verified: lint, vue-tsc typecheck, 26/26 tests, prod build all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that the codebase is TypeScript, vue-tsc --noEmit becomes a real check. Runs after lint and before tests/build so type errors fail fast. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Saved redeem-script library scoped per chain+testnet, backed by localStorage. Save/load/delete UI on Multisig and Sign sections; prompts warn that storage is browser-local so users keep external backups. - Show per-tx and aggregate size readouts (avg/max/total) on Build and Sign, flagging any transaction over 750 KB. - Wire ProgressBar into Finalise and Submit so multi-tx feedback is consistent with Sign. - Sign: fix redeem-script decoder reading 'pubkeys' instead of 'pubKeys' (the property bitgo-utxo-lib actually returns); collapse consecutive identical sig-status rows into a range; map the WIF 'invalid checksum' error to 'Invalid private key checksum'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Export signed transactions from Sign as JSON or gzip-compressed
.json.gz, using the browser's native CompressionStream so no new
dependency is needed. Timestamped, chain/network-aware filenames.
- Import from file on Sign ('Transaction to sign') and Submit
('Transaction to submit'). Auto-detects gzip by magic bytes rather
than filename, and tolerates several JSON shapes (array of hex,
{ transactions: [...] }, { hex: "..." }) or a plain hex blob.
- Redesign the saved-redeem-script UX: drop the native <select> and
replace with a bordered library card matching the rest of the app
(left-accent stripe, mono micro-labels, dotted-rule rows, accent
dot for the row that matches the current textarea). Keyboard
navigable; delete chip fades in on row hover; save button shows
Rename when the current script is already in the library.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The saved-script library now stays collapsed by default and is toggled by a small address-book button in the redeem-script field head. The button shows a count badge of saved entries, plus a pulsing accent dot when the current textarea contents match a saved script (so users can see the library is relevant without expanding). Library mounts under a max-height/opacity Vue <transition> so reveal and hide animate smoothly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oggle To the left of the saved-scripts toggle: - If the current redeem script matches a saved entry, show a small accent-bordered chip 'USING <label>' (clickable to open the library and reveal the active row). - If the script is valid but not yet saved, show a dashed 'Save now' button that calls saveCurrentScript directly so the user can capture it without opening the library. Drop the redundant pulsing dot on the toggle button — the chip now conveys the match state more clearly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror the Sign and Submit UX on Finalise: an Import button in the 'Transaction to finalise' field head, and JSON / .json.gz export options under the finalised output. Reuses the same upload and download composables — auto-detects gzip by magic bytes, files are named finalised-tx-<chain>-<env>-<timestamp>.<ext>. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.