Skip to content

update to ts-sdk 0.2.0 - #121

Merged
altafan merged 28 commits into
masterfrom
v7
Jul 22, 2025
Merged

altafan merged 28 commits into
masterfrom
v7

Conversation

@louisinger

@louisinger louisinger commented Jul 10, 2025 •

Copy link
Copy Markdown
Contributor

Update using @arkade-os/sdk v0.2.0

@bordalix please review

Summary by CodeRabbit

  • New Features

    • Added options to view spent and swept virtual coins in the settings.
  • Improvements

    • Enhanced type handling and precision for server and transaction limits, improving reliability when displaying or validating amounts.
    • Updated the display and calculation of expiry times and market hours for better accuracy.
    • Improved address validation and note parsing in wallet forms for a smoother user experience.
    • Switched to a more robust SDK for server info and transaction history, enhancing stability.
    • Refined loading logic and UI rendering conditions for better user feedback.
    • Adjusted server environment detection to distinguish localhost from other test domains.
    • Consolidated wallet loading logic and added public key derivation during wallet initialization.
    • Improved async flow simplification and error handling in wallet and notification providers.
    • Enhanced market hour calculations with duration and better type safety.
    • Cleared sensitive initialization info after wallet setup to enhance security.
    • Expanded wallet context usage and updated navigation flow based on wallet state.
    • Improved faucet URL handling for network consistency.
    • Broadened acceptance criteria for ArkNote input validation.
    • Added text wrapping for error messages to improve readability.
    • Scoped header styles more specifically for better UI consistency.
    • Updated input components to support focus control and Enter key handling for better usability.
  • Bug Fixes

    • Fixed issues related to type mismatches for server and note values in various screens.
  • Chores

    • Updated dependencies to use the latest SDK version.
    • Refactored internal logic to improve maintainability and type safety.
    • Simplified wallet initialization and notification logging.
    • Disabled network-first fetch handling in the service worker to streamline caching behavior.
    • Removed back-to-wallet button components from multiple success and receive screens for UI simplification.
    • Ensured configuration URLs always include proper protocols for reliable connectivity.
    • Removed unused imports and streamlined component structures for cleaner code.

@coderabbitai

coderabbitai Bot commented Jul 10, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the project to use the latest SDK version and refactor code to leverage new SDK abstractions, especially for ASP information retrieval and transaction handling. Types and constants are updated for improved type safety, particularly with BigInt values. Several components and providers are refactored to use the new types and SDK interfaces, new database query methods are introduced, and UI components related to back navigation buttons are removed.

Changes

File(s) or Group Change Summary
package.json Updated @arkade-os/sdk dependency from 0.1.4 to ^0.2.1; added new dependency @noble/secp256k1 version ^2.3.0.
src/App.tsx Revised wallet navigation logic to rely on wallet.pubkey and walletLoaded; replaced aspInfo.pubkey with aspInfo.signerPubkey in page rendering condition.
src/lib/asp.ts Refactored to use SDK’s RestArkProvider for ASP info fetching; replaced manual fetch and JSON parsing; updated types to ArkInfo with BigInt fields and added properties; updated transaction field names (roundTxid→commitmentTxid, redeemTxid→arkTxid); concurrently fetch offchain and boarding addresses; parse notes to ArkNote objects before redeeming; removed withZeroFees argument in offchain send; removed unused helpers and types.
src/lib/constants.ts Added devServer constant; updated testDomains to include 'pages.dev'; changed testServer URL to 'https://mutinynet.arkade.sh'; defaultArkServer returns devServer for 'localhost', testServer for other test domains, else mainServer.
src/lib/db.ts Added getSpentVtxos and getSweptVtxos methods to vtxosRepository for filtered queries of spent and swept vtxos.
src/lib/wallet.ts Changed calcNextRollover parameter vtxoTreeExpiry from number to bigint; adjusted arithmetic by converting vtxoTreeExpiry to number internally.
src/providers/asp.tsx Switched to SDK’s ArkInfo type for ASP info; updated context and provider types accordingly; enhanced calcBestMarketHour and calcNextMarketHour to include duration and return undefined if no market hour; updated getDustLimit and getMaxSatsAllowed to handle BigInt values correctly; wrapped async effect callback for getAspInfo.
src/providers/notifications.tsx Removed consoleLog import; replaced with direct console.log call in sendNostrNotification.
src/providers/wallet.tsx Changed walletLoaded from `Wallet
src/screens/Settings/About.tsx Used Number() to convert aspInfo.vtxoTreeExpiry before passing to prettyDelta; displayed aspInfo.signerPubkey instead of pubkey.
src/screens/Settings/Server.tsx Changed info state type from AspInfo to ArkInfo & { unreachable: boolean; url: string }.
src/screens/Settings/Vtxos.tsx Changed aspInfo prop type to ArkInfo & { unreachable: boolean; url: string }; used Number() for expiry and market hour times; updated lifetime display accordingly.
src/screens/Wallet/Notes/Form.tsx Simplified ArkNote value extraction by destructuring value directly from ArkNote.fromString.
src/screens/Wallet/Receive/QrCode.tsx Used Number() to convert utxoMaxAmount and vtxoMaxAmount before zero comparison in address assignment logic.
src/screens/Wallet/Send/Form.tsx Used Number() for max amount checks; simplified ArkNote value extraction by destructuring value directly from ArkNote.fromString; added clickable div for available balance to set max amount.
src/screens/Wallet/Transaction.tsx Used Number() for vtxoTreeExpiry and market hour times in expiration and start time calculations.
src/wallet-service-worker.ts Commented out networkFirst function and fetch event listener, disabling network-first fetch handling.
src/components/Error.tsx Added wrap prop to Text component in Error component for enabling text wrapping.
src/lib/types.ts Added optional pubkey?: string property to exported Wallet type.
src/screens/Init/Connect.tsx Added setInitInfo usage to clear sensitive password and privateKey fields after wallet initialization before navigation.
src/ionic.css Scoped ion-header styles to descendants of ion-app by changing selector from ion-header to ion-app ion-header.
src/lib/faucet.ts Simplified faucet URL structure; replaced nested mutinynet URLs with single URL; updated AspInfo type locally; removed url destructuring and logic in getFaucetUrl.
src/lib/arknote.ts Reduced minimum length check for isArkNote from >100 to >55 characters while retaining prefix pattern check.
src/components/BackToWalletButton.tsx Removed the entire BackToWalletButton component file and its usage from multiple screens.
src/providers/config.tsx Updated updateConfig to prepend http:// or https:// protocol to aspUrl if missing, based on hostname.
src/providers/iframe.tsx Changed sendStatus call argument from boolean walletLoaded to the wallet object.
src/screens/Wallet/Notes/Success.tsx Removed ButtonsOnBottom and BackToWalletButton components and their JSX wrappers.
src/screens/Wallet/Receive/Amount.tsx Removed BackToWalletButton import and JSX wrapper.
src/screens/Wallet/Receive/Success.tsx Removed ButtonsOnBottom and BackToWalletButton components and their JSX wrappers.
src/screens/Wallet/Send/Success.tsx Removed ButtonsOnBottom and BackToWalletButton components and their JSX wrappers.
src/components/Input.tsx Refactored Input component: replaced InputAmountProps with InputProps adding optional focus and onEnter props; removed placeholder and value props; added focus management using useRef and useEffect; wrapped input in InputContainer replacing conditional label rendering; added onKeyUp handler to trigger onEnter on Enter key press.
src/screens/Init/Restore.tsx Replaced Textarea with Input component for private key input; removed value prop; updated imports accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant AspProvider
    participant SDK(RestArkProvider)
    participant Wallet

    User->>App: Load/Interact
    App->>AspProvider: Request ASP info
    AspProvider->>SDK(RestArkProvider): getInfo(url)
    SDK(RestArkProvider)-->>AspProvider: Return ArkInfo (with BigInt fields)
    AspProvider-->>App: Provide ArkInfo (with unreachable, url)
    App->>Wallet: Wallet operations (send, redeem, etc.)
    Wallet->>SDK(RestArkProvider): Use SDK abstractions for transactions
    SDK(RestArkProvider)-->>Wallet: Transaction results
    Wallet-->>App: Update UI
Loading
sequenceDiagram
    participant App
    participant DB(vtxosRepository)
    App->>DB: getSpentVtxos()
    DB-->>App: Return spent vtxos
    App->>DB: getSweptVtxos()
    DB-->>App: Return swept vtxos
Loading

Estimated code review effort

1 (package.json, constants.ts, types.ts, ionic.css, Error.tsx, notifications.tsx, screens/Settings/About.tsx, screens/Wallet/Notes/Form.tsx, screens/Wallet/Receive/QrCode.tsx, screens/Wallet/Send/Form.tsx, screens/Wallet/Transaction.tsx, screens/Settings/Server.tsx, screens/Settings/Vtxos.tsx, screens/Init/Connect.tsx, lib/arknote.ts, components/BackToWalletButton.tsx, screens/Wallet/Notes/Success.tsx, screens/Wallet/Receive/Amount.tsx, screens/Wallet/Receive/Success.tsx) (<30 minutes)
2 (App.tsx, providers/asp.tsx, providers/wallet.tsx, lib/wallet.ts, lib/faucet.ts, providers/config.tsx, providers/iframe.tsx, screens/Wallet/Send/Success.tsx, components/Input.tsx, screens/Init/Restore.tsx) (10–30 minutes)
3 (lib/asp.ts, lib/db.ts) (30–60 minutes)
2 (wallet-service-worker.ts) (10–30 minutes)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 531410a and 89af714.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 11, 2025 •

Copy link
Copy Markdown

Deploying arkade-wallet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 89af714
Status: ✅  Deploy successful!
Preview URL: https://5431a4bb.arkade-wallet.pages.dev
Branch Preview URL: https://v7.arkade-wallet.pages.dev

View logs

@bordalix

Copy link
Copy Markdown
Collaborator

tACK

@louisinger
louisinger marked this pull request as ready for review July 11, 2025 14:37
@louisinger louisinger changed the title update to ts-sdk next-version update to ts-sdk 0.2.0 Jul 11, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/screens/Settings/Server.tsx (1)

3-3: Rename Error import to avoid shadowing global.

The import name Error shadows the global Error constructor, which can cause confusion.

-import Error from '../../components/Error'
+import ErrorComponent from '../../components/Error'

Then update the usage on line 74:

-            <Error error={Boolean(error)} text={error} />
+            <ErrorComponent error={Boolean(error)} text={error} />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9535f6b and f7157f7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • package.json (1 hunks)
  • src/App.tsx (1 hunks)
  • src/lib/asp.ts (5 hunks)
  • src/lib/constants.ts (1 hunks)
  • src/lib/db.ts (1 hunks)
  • src/lib/wallet.ts (1 hunks)
  • src/providers/asp.tsx (4 hunks)
  • src/providers/notifications.tsx (1 hunks)
  • src/providers/wallet.tsx (1 hunks)
  • src/screens/Settings/About.tsx (1 hunks)
  • src/screens/Settings/Server.tsx (2 hunks)
  • src/screens/Settings/Vtxos.tsx (4 hunks)
  • src/screens/Wallet/Notes/Form.tsx (1 hunks)
  • src/screens/Wallet/Receive/QrCode.tsx (1 hunks)
  • src/screens/Wallet/Send/Form.tsx (2 hunks)
  • src/screens/Wallet/Transaction.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/screens/Settings/About.tsx (1)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/App.tsx (1)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/screens/Wallet/Transaction.tsx (1)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/screens/Wallet/Notes/Form.tsx (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
src/screens/Wallet/Receive/QrCode.tsx (3)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
Learnt from: bordalix
PR: arkade-os/wallet#114
File: public/wallet-service-worker.mjs:6350-6353
Timestamp: 2025-06-30T18:23:34.163Z
Learning: Do not review `public/wallet-service-worker.mjs` as it is a built file generated by Vite.
src/screens/Wallet/Send/Form.tsx (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
src/providers/wallet.tsx (3)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#114
File: public/wallet-service-worker.mjs:6350-6353
Timestamp: 2025-06-30T18:23:34.163Z
Learning: Do not review `public/wallet-service-worker.mjs` as it is a built file generated by Vite.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
src/lib/wallet.ts (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
src/lib/db.ts (1)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/screens/Settings/Vtxos.tsx (1)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/providers/asp.tsx (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
src/lib/asp.ts (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Learnt from: bordalix
PR: arkade-os/wallet#106
File: src/lib/bolt11.ts:153-155
Timestamp: 2025-07-07T14:41:35.991Z
Learning: In src/lib/bolt11.ts, the code is copied from the original bitcoinjs/bolt11 library (https://github.com/bitcoinjs/bolt11/blob/master/payreq.js) and should be kept unchanged to maintain compatibility with the upstream source, even if there are potential improvements or syntax issues.
🧬 Code Graph Analysis (4)
src/screens/Settings/About.tsx (1)
src/lib/format.ts (1)
  • prettyDelta (36-55)
src/screens/Settings/Server.tsx (3)
src/providers/asp.tsx (1)
  • AspContext (15-22)
src/providers/config.tsx (1)
  • ConfigContext (28-36)
src/providers/wallet.tsx (1)
  • WalletContext (40-54)
src/providers/asp.tsx (1)
src/lib/asp.ts (1)
  • getAspInfo (44-56)
src/lib/asp.ts (1)
src/lib/logs.ts (1)
  • consoleError (40-44)
🪛 Biome (1.9.4)
src/screens/Settings/Server.tsx

[error] 7-7: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

🔇 Additional comments (28)
package.json (1)

7-7: SDK @arkade-os/sdk v0.2.0 verified—no known vulnerabilities

  • package.json (line 7) now pins @arkade-os/sdk to 0.2.0, which exists in the npm registry.
  • npm view @arkade-os/sdk versions shows 0.2.0 as the latest release.
  • npm audit (moderate level) reports no security advisories for this version.

Given the major bump from 0.1.x to 0.2.0, please review the SDK’s CHANGELOG for any breaking changes before merging.

src/providers/notifications.tsx (1)

30-30: LGTM - Clean logging simplification.

The change from custom consoleLog to standard console.log is a good simplification that maintains the same functionality while reducing dependencies.

src/screens/Settings/About.tsx (1)

26-27: LGTM - Proper SDK type adaptations.

The changes correctly adapt to the new SDK:

  • Number() conversion handles the BigInt type returned by the new SDK
  • Property name change from pubkey to signerPubkey aligns with the SDK API update

These changes are consistent with the SDK upgrade pattern seen across the codebase.

src/screens/Wallet/Transaction.tsx (2)

49-49: LGTM - Consistent BigInt to number conversion.

The Number() conversion properly handles the BigInt type returned by the new SDK for vtxoTreeExpiry. This is consistent with the pattern used across other files in this PR.


54-54: LGTM - Proper timestamp conversion.

The conversion of bestMarketHour.nextStartTime to a number is appropriate for the state update and aligns with the SDK's BigInt return types.

src/App.tsx (1)

88-88: LGTM - Consistent SDK property name update.

The change from aspInfo.pubkey to aspInfo.signerPubkey correctly adapts the conditional rendering logic to the new SDK API. This maintains the same functionality while using the updated property name.

src/screens/Wallet/Receive/QrCode.tsx (1)

31-32: Type conversion correctly handles BigInt values.

The explicit conversion to Number() is appropriate for handling the ArkInfo type's BigInt fields when comparing to zero. This maintains type consistency after the migration from AspInfo to ArkInfo.

src/screens/Wallet/Notes/Form.tsx (1)

40-41: API simplification improves code clarity.

The direct destructuring of value from ArkNote.fromString() eliminates the need for the intermediate decoded variable and .data property access. This aligns with the SDK's simplified API.

src/screens/Settings/Server.tsx (2)

1-1: Type migration to SDK's ArkInfo is correct.

The migration from the local AspInfo type to the SDK's ArkInfo type maintains consistency with the broader refactoring across the codebase.


27-27: Composite type correctly extends ArkInfo.

The intersection type ArkInfo & { unreachable: boolean; url: string } properly extends the SDK's ArkInfo with the additional properties needed by the application.

src/providers/wallet.tsx (1)

163-163: Consistent API simplification with SDK changes.

The direct destructuring of value from ArkNote.fromString() aligns with the SDK's simplified API and maintains consistency with similar changes in other components.

src/lib/constants.ts (1)

4-4: Good addition for local development.

The devServer constant provides proper support for local development environments.

src/lib/db.ts (1)

27-32: LGTM! Clean repository method additions.

The new getSpentVtxos and getSweptVtxos methods follow the established patterns and correctly implement the filtering logic using Dexie's query API.

src/lib/wallet.ts (1)

17-20: Type update handled correctly with proper conversion.

The parameter type change to bigint aligns with the SDK update, and the explicit Number() conversion is appropriately placed for the arithmetic operation.

src/screens/Wallet/Send/Form.tsx (2)

81-82: Updated to new ArkNote API structure.

The direct destructuring of value aligns with the simplified SDK API.


97-101: Proper BigInt handling for amount comparisons.

The explicit Number() conversions ensure correct comparison with zero values.

src/screens/Settings/Vtxos.tsx (2)

20-22: Successfully migrated to SDK's ArkInfo type.

The type migration from local AspInfo to SDK's ArkInfo with extended properties is implemented correctly throughout the component.

Also applies to: 39-47


49-49: Consistent BigInt to Number conversions.

All numeric conversions for vtxoTreeExpiry and market hour timestamps are properly handled for calculations and display.

Also applies to: 84-84, 146-147

src/providers/asp.tsx (3)

1-13: Clean migration to SDK's ArkInfo type.

The context interface and state are properly updated to use the extended ArkInfo type, maintaining backward compatibility with the additional unreachable and url properties.

Also applies to: 27-34


44-66: Well-implemented market hour enhancements.

Good defensive programming with null checks for aspInfo.marketHour. The duration calculation is correctly added to the return type.


68-86: Robust BigInt handling in limit calculations.

The getDustLimit and getMaxSatsAllowed functions correctly handle BigInt to Number conversions with appropriate comparison logic.

src/lib/asp.ts (7)

1-1: LGTM! Import updates align with SDK upgrade.

The new imports from @arkade-os/sdk properly support the refactoring to use SDK abstractions.


6-22: Good BigInt migration for financial precision.

The conversion of numeric fields to BigInt is appropriate for handling large satoshi values and ensures consistency with the updated SDK types.


44-56: Clean refactoring to use SDK provider.

The migration from manual HTTP fetching to RestArkProvider simplifies the code while maintaining the same URL normalization logic and error handling behavior.


73-79: Consistent field renaming with SDK conventions.

The transaction field updates (roundTxid → commitmentTxid, redeemTxid → arkTxid) correctly align with the new SDK naming conventions.


99-104: Nice performance optimization with concurrent fetching.

Using Promise.all to fetch both addresses concurrently reduces latency and improves performance.


116-124: Proper ArkNote parsing and BigInt arithmetic.

The refactoring correctly uses ArkNote.fromString for parsing and BigInt for precise amount calculations, aligning with the SDK's type system.


128-128: API simplification looks correct.

The removal of the withZeroFees parameter aligns with the updated SDK API.

Comment thread src/lib/constants.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9425a61 and 4ac5ee8.

📒 Files selected for processing (1)
  • src/wallet-service-worker.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/wallet-service-worker.ts (2)
Learnt from: bordalix
PR: arkade-os/wallet#114
File: public/wallet-service-worker.mjs:6350-6353
Timestamp: 2025-06-30T18:23:34.163Z
Learning: Do not review `public/wallet-service-worker.mjs` as it is a built file generated by Vite.
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.

Comment on lines +65 to +83
// async function networkFirst(request: Request): Promise<Response> {
// const cache = await caches.open(CACHE_NAME)
// try {
// const response = await fetch(request)
// if (request.method === 'GET') {
// cache.put(request, response.clone())
// }
// return response
// } catch (error) {
// const cachedResponse = await cache.match(request)
// if (!cachedResponse) throw new Error('No cached response found')
// return cachedResponse
// }
// }
//
// // fetch event: use network first, then cache
// self.addEventListener('fetch', (event: FetchEvent) => {
// event.respondWith(networkFirst(event.request))
// })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Consider removing commented code and verify offline functionality.

The commented-out networkFirst function and fetch event listener align with the SDK upgrade approach of delegating network handling to the SDK layer. However, consider:

  1. Code cleanup: Remove the commented code entirely rather than leaving it commented out to avoid code bloat and confusion.

  2. Offline functionality impact: Verify that removing the fetch event listener doesn't break offline functionality, as the service worker will no longer intercept and cache network requests.


🏁 Script executed:

#!/bin/bash
# Verify if there are any other fetch event listeners or network handling in the codebase
rg -A 3 -B 3 "addEventListener.*fetch|fetch.*event" --type ts --type js

Length of output: 457


Remove commented-out fetch handler and verify offline support

The commented-out networkFirst function and fetch event listener in src/wallet-service-worker.ts (lines 65–83) should be cleaned up, and you should ensure that offline-caching/fallback behavior is still covered by the new SDK:

  • Remove the dead code block (lines 65–83) to avoid confusion and bloat.
  • Confirm that the upgraded SDK (v0.2.0) includes equivalent offline support; add manual tests or automated checks for offline scenarios.
  • If offline functionality is no longer provided by the SDK, reintroduce or implement a replacement service-worker fetch strategy.
🤖 Prompt for AI Agents
In src/wallet-service-worker.ts between lines 65 and 83, remove the entire
commented-out networkFirst function and fetch event listener to clean up dead
code. After removal, verify that the upgraded SDK v0.2.0 still provides offline
caching and fallback support by performing manual offline tests or adding
automated checks. If the SDK no longer supports offline functionality, implement
a replacement fetch event handler with an appropriate caching strategy to
maintain offline support.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/screens/Init/Connect.tsx (1)

23-26: Excellent security enhancement: Clearing sensitive data after use

This change properly clears sensitive information (password and privateKey) from the context after successful wallet initialization, which is a security best practice to prevent sensitive data from remaining in memory longer than necessary.

The implementation correctly:

  • Clears data only after successful initialization
  • Maintains the original navigation flow
  • Prevents sensitive information from persisting in the context

For consistency, consider setting password to undefined instead of an empty string to match the privateKey approach:

-        setInitInfo({ password: '', privateKey: undefined })
+        setInitInfo({ password: undefined, privateKey: undefined })
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d77adf and 6596ac7.

📒 Files selected for processing (4)
  • src/App.tsx (3 hunks)
  • src/lib/types.ts (1 hunks)
  • src/providers/wallet.tsx (8 hunks)
  • src/screens/Init/Connect.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/lib/types.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/App.tsx
  • src/providers/wallet.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
🧬 Code Graph Analysis (1)
src/screens/Init/Connect.tsx (1)
src/providers/flow.tsx (1)
  • FlowContext (71-82)
🔇 Additional comments (1)
src/screens/Init/Connect.tsx (1)

13-13: LGTM: Correct context destructuring

The addition of setInitInfo to the destructured FlowContext is correct and necessary for the security enhancement implemented below.

@tiero

tiero commented Jul 21, 2025

Copy link
Copy Markdown
Member

I have tested against mutinynet seems to work well now!

@tiero

tiero commented Jul 21, 2025

Copy link
Copy Markdown
Member

Just tested the notes

After redeeming a note and clicking to "Back to Wallet" it goes dark. It's a bit of anti-pattern to have a button to change screen, it coukld be removed?

the other little issue is that we throw the server error straight to user in case of a note already used, is not super helpful to know if you can catch that error explicitly and returns some message more explanatory would be best @bordalix

https://www.loom.com/share/f94f3916833e476ca0d1e81590353612?from_recorder=1&focus_title=1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/providers/config.tsx (1)

49-52: Consider improving URL normalization robustness and avoiding parameter mutation.

The protocol normalization logic has a few potential issues:

  1. Parameter mutation: The function modifies the input data object directly, which could be unexpected for callers.
  2. Limited localhost detection: The logic only checks for URLs starting with "localhost" but misses other localhost variants like "127.0.0.1" or "::1".
  3. No URL validation: After prepending the protocol, there's no validation that the resulting URL is actually valid.

Consider this improved implementation:

 const updateConfig = (data: Config) => {
+  const updatedData = { ...data }
-  if (!data.aspUrl.startsWith('http://') && !data.aspUrl.startsWith('https://')) {
-    const protocol = data.aspUrl.startsWith('localhost') ? 'http://' : 'https://'
-    data.aspUrl = protocol + data.aspUrl
-  }
+  if (!updatedData.aspUrl.startsWith('http://') && !updatedData.aspUrl.startsWith('https://')) {
+    const isLocalhost = /^(localhost|127\.0\.0\.1|::1)(:|$)/.test(updatedData.aspUrl)
+    const protocol = isLocalhost ? 'http://' : 'https://'
+    updatedData.aspUrl = protocol + updatedData.aspUrl
+  }
-  setConfig(data)
-  updateTheme(data)
-  saveConfigToStorage(data)
+  setConfig(updatedData)
+  updateTheme(updatedData)
+  saveConfigToStorage(updatedData)
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f66e32 and 254652e.

📒 Files selected for processing (9)
  • src/components/BackToWalletButton.tsx (0 hunks)
  • src/providers/config.tsx (1 hunks)
  • src/providers/iframe.tsx (1 hunks)
  • src/screens/Settings/Server.tsx (2 hunks)
  • src/screens/Wallet/Notes/Success.tsx (0 hunks)
  • src/screens/Wallet/Receive/Amount.tsx (0 hunks)
  • src/screens/Wallet/Receive/Success.tsx (0 hunks)
  • src/screens/Wallet/Send/Form.tsx (3 hunks)
  • src/screens/Wallet/Send/Success.tsx (0 hunks)
💤 Files with no reviewable changes (5)
  • src/screens/Wallet/Receive/Amount.tsx
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Notes/Success.tsx
  • src/screens/Wallet/Send/Success.tsx
  • src/components/BackToWalletButton.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/Wallet/Send/Form.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
src/providers/config.tsx (1)

Learnt from: bordalix
PR: #114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.

src/providers/iframe.tsx (1)

Learnt from: bordalix
PR: #114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.

🧬 Code Graph Analysis (1)
src/screens/Settings/Server.tsx (3)
src/providers/asp.tsx (1)
  • AspContext (15-22)
src/providers/config.tsx (1)
  • ConfigContext (28-36)
src/providers/wallet.tsx (1)
  • WalletContext (43-57)
🪛 Biome (1.9.4)
src/screens/Settings/Server.tsx

[error] 7-7: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

🔇 Additional comments (5)
src/providers/iframe.tsx (1)

84-86: LGTM! Change aligns with wallet state refactoring.

The modification correctly passes the wallet object to sendStatus instead of the boolean walletLoaded. This change is consistent with the broader refactoring where walletLoaded became a boolean flag separate from the wallet object, ensuring the iframe receives proper wallet status information.

src/screens/Settings/Server.tsx (4)

1-1: LGTM! Import change aligns with SDK upgrade.

The import change from local AspInfo to ArkInfo from @arkade-os/sdk is consistent with the SDK upgrade to version 0.2.0.


9-9: LGTM! Function import is appropriate.

The getAspInfo import remains unchanged and the function usage in the component appears compatible with the new type system.


27-27: LGTM! Type migration is well-structured.

The state type change to ArkInfo & { unreachable: boolean; url: string } properly extends the new SDK type with the additional properties required by the application. This maintains compatibility with existing usage patterns.


7-7: Static analysis false positive - component import is fine.

The static analysis tool incorrectly flagged the Error component import as shadowing the global Error property. This is a React component import following standard naming conventions, and the usage context makes it clear this is not the global Error constructor.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/Input.tsx (1)

16-21: Add dependency array to useEffect for better performance.

The useEffect hook runs on every render without a dependency array. While the firstRun ref prevents multiple focus calls, this is inefficient and not the typical React pattern.

  useEffect(() => {
    if (focus && firstRun.current) {
      firstRun.current = false
      input.current?.setFocus()
    }
- })
+ }, [focus])
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 254652e and 531410a.

📒 Files selected for processing (2)
  • src/components/Input.tsx (1 hunks)
  • src/screens/Init/Restore.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
🧬 Code Graph Analysis (2)
src/screens/Init/Restore.tsx (1)
src/components/Input.tsx (1)
  • Input (12-38)
src/components/Input.tsx (1)
src/components/InputContainer.tsx (1)
  • InputContainer (16-37)
🔇 Additional comments (3)
src/components/Input.tsx (2)

1-10: LGTM! Clean interface refactoring.

The new InputProps interface is well-designed with optional focus and onEnter props that enhance the component's functionality while maintaining backward compatibility.


28-37: Good use of InputContainer abstraction.

The integration with InputContainer provides consistent styling and error handling across the application. The Enter key handling is implemented correctly.

src/screens/Init/Restore.tsx (1)

14-14: Consider UX impact of single-line input for private keys.

Replacing Textarea with Input changes this from multi-line to single-line input. Private keys are often long strings that may be easier to read and verify in a multi-line format.

Consider whether single-line input provides adequate UX for private key entry, especially for longer keys or when users need to verify their input.

<Padded>
<FlexCol>
<Textarea label='Private key' onChange={setSomeKey} value={someKey} />
<Input label='Private key' onChange={setSomeKey} />

@coderabbitai coderabbitai Bot Jul 21, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: Input component is now uncontrolled.

The removal of the value prop makes this an uncontrolled input, meaning the input field won't display the current state value. Users won't see their entered private key if they navigate away and return to this screen.

Add the value prop back or update the Input component to support controlled behavior:

- <Input label='Private key' onChange={setSomeKey} />
+ <Input label='Private key' onChange={setSomeKey} value={someKey} />

Note: This will require updating the Input component to accept and use a value prop.

🤖 Prompt for AI Agents
In src/screens/Init/Restore.tsx at line 58, the Input component for the private
key is missing the value prop, making it uncontrolled and causing the input
field to not reflect the current state. Fix this by adding the value prop to the
Input component, passing the corresponding state variable that holds the private
key. Also, ensure the Input component itself is updated to accept and use the
value prop to maintain controlled behavior.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on purpose, we don't want to show the private key if they navigate away and return to this screen

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bordalix Thank you for the clarification! That makes perfect sense from a security perspective. Intentionally making the private key input uncontrolled to clear sensitive data when navigating away is a good security practice. I appreciate you explaining the reasoning behind this design decision.


✏️ Learnings added
Learnt from: bordalix
PR: arkade-os/wallet#121
File: src/screens/Init/Restore.tsx:58-58
Timestamp: 2025-07-21T18:25:36.350Z
Learning: In src/screens/Init/Restore.tsx, the Input component for private key restoration intentionally omits the `value` prop to make it uncontrolled. This is a security feature to prevent the private key from being displayed if users navigate away and return to the screen, avoiding potential exposure of sensitive data in the UI.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.

@altafan
altafan merged commit 8809969 into master Jul 22, 2025
bordalix added a commit that referenced this pull request Jul 30, 2025
* update to ts-sdk `0.2.1` (#121)

* update to ts-sdk next-version

* remove console.log

* hotfix

* don't show notImplemented on logs

* lint

* @arkade-os/sdk v0.2.0 from npm registry

* fix constants.ts

* disable service worker cache

* build worker

* update test server to signet

* add pages.dev to test server domains

* fix locked wallet after creation

* add @noble/secp256k1

* fix css

* update faucet

* use en var VITE_ARK_SERVER to define default ark server

* revert testServer back to mutinynet

* fix notes

* save asp url to config with protocol

* lint

* lint

* remove "back to wallet" button after button redeem

* remove "back to wallet" button, anti pattern

* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

---------

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* fix: lnurl support

* support OCP

* Show valid urls in clipboard viewer
Lock input amount if min == max
Refactor dealing with lnurl limits

---------

Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>
bordalix added a commit that referenced this pull request Jul 31, 2025
* update to ts-sdk `0.2.1` (#121)

* update to ts-sdk next-version

* remove console.log

* hotfix

* don't show notImplemented on logs

* lint

* @arkade-os/sdk v0.2.0 from npm registry

* fix constants.ts

* disable service worker cache

* build worker

* update test server to signet

* add pages.dev to test server domains

* fix locked wallet after creation

* add @noble/secp256k1

* fix css

* update faucet

* use en var VITE_ARK_SERVER to define default ark server

* revert testServer back to mutinynet

* fix notes

* save asp url to config with protocol

* lint

* lint

* remove "back to wallet" button after button redeem

* remove "back to wallet" button, anti pattern

* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

---------

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* fix: lnurl support

* support OCP

* Show valid urls in clipboard viewer
Lock input amount if min == max
Refactor dealing with lnurl limits

---------

Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 31, 2025
bordalix added a commit that referenced this pull request Aug 4, 2025
* implement lightning swaps

* WIP

* bug fix on send

* working on limits with swaps

* docker files and instruction to test in regtest

* puts Error at the same level as WarningBox to minimize jumps on the UI

* pass default ark server url as environment variable VITE_ARK_SERVER

* bug fix for wallet-sdk 0.0.15

* fix: only cache GETs on service worker

* new build

* update wallet-sdk to 0.0.15

* improve swaps test documentation

* don't cache

* update docs

* add NO_MACAROONS to boltz-fulmine container environment variables

* disable reverse swaps

* don't cache on service worker

* new build

* add note to test docs

* fix package.json

* fix package.json

* use mainnet URLs

* chore: import from arkade-os/sdk

* feat: integrate Lightning payment monitoring and status handling

* chore: arkade url

* updates docker env

* fix test fail

* typo

* remove console.log

* Implements reverse swaps

* fix nobles hashes import

* fix error on amount screen

* Fix error handling and remove duplicate API URL call

* Fix grammatical issue with "therefore" usage

* Capitalize "Mac" as it refers to Apple's trademark

* fix react warnings

* bug fix

* show less chars in prettyLongText

* More robust Lightning invoice validation

* Simplify the type assertion for setInterval

* Clean APK cache to reduce image size

* Fix grammatical issues in lndconnect instructions

* add keys to remaining icons

* add @noble/hashes to package.json

* Fix heading-level jump, spelling, and wording

* typo

* update ripemd160 import

* Update src/lib/boltz.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: João Bordalo <bordalix@users.noreply.github.com>

* update to ts-sdk next-version

* remove console.log

* hotfix

* don't show notImplemented on logs

* lint

* update pnpm-lock.yaml

* @arkade-os/sdk v0.2.0 from npm registry

* fix constants.ts

* update to sdk 2.0

* general fixes

* general fixes

* update swaps test docs

* fix signing

* remove debug console.logs

* disable service worker cache

* build worker

* verify vhtlc script on send

* update test server to signet

* add pages.dev to test server domains

* new refundVHTLC method

* fix locked wallet after creation

* add @noble/secp256k1

* fix css

* update faucet

* use en var VITE_ARK_SERVER to define default ark server

* nit test text

* new boltzd image

* revert testServer back to mutinynet

* fix notes

* chore: --no-frozen-lockfile

* save asp url to config with protocol

* lint

* lint

* remove "back to wallet" button after button redeem

* remove "back to wallet" button, anti pattern

* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

* add @noble/hashes

* refactor + delete over-engineering code

* wip

* lnurl support

* use @arkade-os/boltz-swap package

* fix

* add retry logic to submarineSwap sendOffchain

* revert sendOffChain retry

* Fix Progress Indicator Style Inconsistency [1]

* fix Incorrect Typography Weight in Subtext [2]

* fix Incorrect Button Font Style [4]

* fix “Skip for Now” Button Missing Fill Color [6]

* new setup regtest env script

* Refactor pr124 (#125)

* update to ts-sdk `0.2.1` (#121)

* update to ts-sdk next-version

* remove console.log

* hotfix

* don't show notImplemented on logs

* lint

* @arkade-os/sdk v0.2.0 from npm registry

* fix constants.ts

* disable service worker cache

* build worker

* update test server to signet

* add pages.dev to test server domains

* fix locked wallet after creation

* add @noble/secp256k1

* fix css

* update faucet

* use en var VITE_ARK_SERVER to define default ark server

* revert testServer back to mutinynet

* fix notes

* save asp url to config with protocol

* lint

* lint

* remove "back to wallet" button after button redeem

* remove "back to wallet" button, anti pattern

* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

---------

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* fix: lnurl support

* support OCP

* Show valid urls in clipboard viewer
Lock input amount if min == max
Refactor dealing with lnurl limits

---------

Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>

* fix script

* add gist font

* use published package

* fix merge issues

* fix merge issues

* fix and suggestions from the rabbit

* chore: bump 0.1.1

* more rabbit suggestions

* several ui fixes

* fix bip21 parsing

* fix details font size and weight

* add empty state to tx list and logs

* add empty list to coin control

* new toggle per design

* more ui updates

* major settings refactor

* more ui fixes

* fix "show password" icon color

* new success pages after wallet initialization

* full width texts

* remove apps links

* css color bug fix

* handle selects with keyboard

* fix title

* fixes

* fix balance

---------

Signed-off-by: João Bordalo <bordalix@users.noreply.github.com>
Co-authored-by: tiero <3596602+tiero@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: louisinger <louis@vulpem.com>
Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Aug 11, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Aug 26, 2025
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Sep 12, 2025
bordalix added a commit that referenced this pull request Oct 10, 2025
* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

* add @noble/hashes

* refactor + delete over-engineering code

* lnurl support

* add retry logic to submarineSwap sendOffchain

* revert sendOffChain retry

* new setup regtest env script

* Refactor pr124 (#125)

* update to ts-sdk `0.2.1` (#121)

* update to ts-sdk next-version

* remove console.log

* hotfix

* don't show notImplemented on logs

* lint

* @arkade-os/sdk v0.2.0 from npm registry

* fix constants.ts

* disable service worker cache

* build worker

* update test server to signet

* add pages.dev to test server domains

* fix locked wallet after creation

* add @noble/secp256k1

* fix css

* update faucet

* use en var VITE_ARK_SERVER to define default ark server

* revert testServer back to mutinynet

* fix notes

* save asp url to config with protocol

* lint

* lint

* remove "back to wallet" button after button redeem

* remove "back to wallet" button, anti pattern

* send all by clicking the balance

* build worker

* use input instead of textarea to get nsec

* update ts-sdk to 0.2.1

---------

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* fix: lnurl support

* support OCP

* Show valid urls in clipboard viewer
Lock input amount if min == max
Refactor dealing with lnurl limits

---------

Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>

* fix script

* bug fix when no amount is defined

* hide settlement when utxo txs are not allowed

* hide buttons on coin control

* remove lib/boltz

* Update wrangler.jsonc

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* remove wrangler.jsonc configuration file

* hotfix UI

* add BBS

* fix alignment

* update visuals

* New Settings / Advanced / Change password

* Create motd.html

* change alert to final url

* remove console logs

* fix silently swallowing error

* update bbs

* update megaphone icon

* castrate

* invert logic

* pulsing alerts

* change default main server

* change default test server

* hide qrcode until reverse swap is done

* double scanner

* rabbit hotfix

* make sure qrcode is shown if reverse swap fails

* new Lightning provider

* fix backup error with wrong password

* hide rollver nudge in riga

* wip

* fix lightning: invoices

* wallets with no password

* update to boltz-swap 0.1.2

* New 'Max' button on input amount

* disables receive for riga

* hide txid

* fix lightning: invoices

* update to boltz-swap 0.1.2

* New 'Max' button on input amount

* disables receive for riga

* hide txid

* omit password step in onboard (use default password)
nudge to create password after 10.000 sats on balance

* fixes

* back to mutinynet

* better var names

* reload service worker on pull-to-reload

* Update motd.html

Signed-off-by: Andrew Camilleri <evilkukka@gmail.com>

* Update motd.html

Signed-off-by: Andrew Camilleri <evilkukka@gmail.com>

* Update motd.html

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* Update motd.html

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* make PSA html

* initial works on boltz swap

* add getLimits to lightning provider

* fetch limits on lightning provider

* fixes

* hotfix: don't throw if no boltz provider

* fixes

* remove waitBox in qrcode

* hide PSA unless isRiga

* update sdk dependency to 0.2.3

* remove console.log

* fix details fee

* use methods by the react provider

* fix '1 SATS' to '1 SAT'

* pass apiurl instead of only network

* handle lock when user as no defined password

* allow remove password

* lint

* move max button to the right

* Boltz app

* allow upgradability in config

* removes motd

* update package.json engine node

* Move setActive() side effects out of render and into a useEffect tied to tab

* Security: Sanitize HTML content before rendering

* Accessibility and UX: Make “Max” control keyboard-accessible and disabled-aware

* fix consoleError arguments reversed

* Use event.waitUntil for message handler to keep SW alive during reload

* fix GreenStatusIcon small size distorts aspect ratio

* fix: Non-React SVG attribute “stroke-width” should be camelCased

* fix potential TypeError when swapProvider is null

* handle preimages

* try to get server info only if url is valid

* reload service worker when reload wallet

* bug fix with reset wallet

* Fix:
- Fallback uses 'pending' (lowercase) which isn’t a valid statusUI key, breaking color/icon lookups.
- colorDict stores single-element tuples; you then index [0]. Use a plain string.
- Local Date component shadows the global Date object.

* Type-guard refundability check to avoid false assumptions about error shape.

* Lint

* Inline the icon element instead of wrapping it in a component function.

* Make the row keyboard accessible

* Strengthen exhaustiveness/typo safety on status mapping with “satisfies”.

* Prefer JSX.Element over React.JSX.Element to avoid requiring a React import

* Type the derived status to keep Record index access type-safe

* move typescript to dev dependencies

* revert reload sw on reload wallet

* fix alignment

* don't log settlement messages

* use ARKD_VTXO_TREE_EXPIRY=604672

* typo

* revert VTXO_TREE_EXPIRY

* log settlement of vtxos

* fix glitch when reseting wallet

* fix success page on change password

* fix swap list UI in narrow screens

* hide amount in swaps

* Guard auto-copy on expand when BIP21 URI is absent

* Avoid shadowing the global Error identifier; alias the component.

* To avoid briefly toggling wallet.lockedByBiometrics when the save could fail, update the wallet after saveNewPassword completes.

* lint

* Prevent double-submits and provide feedback when changing password

* pixel perfect About

* fix unsafe optional chaining

* Only flip lockedByBiometrics to false after a confirmed save

* use method from lib

* new isValidInvoice lib/bolt11  method

* remove not used function

* fix singulars on prettyDelta

* new throw error message

* return note instead of description in decode invoice

* fix types in biometrics

* refactor lib/bip21 and get rid of qs

* throw on invalid private keys

* refactor empty states

* start making tests

* Update src/test/components/AlertBox.test.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: João Bordalo <bordalix@users.noreply.github.com>

* lint

* raise engines.node to ≥20

* Throw an Error, not a string

* more bip21 tests

* small fixes

* fixes

* update eslint dependencies

* fixes

* prettier

* new qr code scanner module that works with vitest

* remove console.log

* remove @dotmind/react-use-pwa

* screen tests

* update eslint

* fix

* implements VITE_BOLTZ_URL env var

* lint

* lib/fiat and lib/lnurl tests

* new unlock test

* show ln fees on receive

* remove console.log

* update regtest to v0.7.1

* remove nostr notifications

* new ts-sdk storage

* fix

* bug fix

* remove console.log

* fix wallet reload

* replace sleeps with tests

* chore: bump sdk

* chore: format

* fix sleep in test setup script

* fix merge conflicts

* fix merge conflicts

* rename lib file

* fix: getSwapHistory() is now async

* update regtest env to arkd v8

* update servers urls to v8

* bump dependencies

* fix label when sending

* refreshSwapsStatus and refundFailedSubmarineSwaps on swap provider first run

* update dependencies to alpha.4

* fixes for v8

* lint

* improve prettyAgo

* fix prettyAgo

* clearContractData on resetWallet

* use messages from service worker to listen for payments

* delay wallet reload by 5 seconds

* bump sdk dependencies

* remove console.log + refundVHTLC

* new 'down' param to setupRegtestEnv.sh

* catch error on refundVHTLC

* fix bug in server url when is localhost

* use new svcWallet.reload() to reload

* nit

* update dependencies to alpha.6

* remove not used function

* setInitialized(true) after updateWallet

* Update README.md

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* silent curls in setupRegtestEnv.sh

* update fulmine image in docker compose

* update dependencies to alpha.7

* rabbit fixes

* fix decodeArkAddress

* better validation of sats in reverse swap

* works in setupRegtestEnv.sh

* wait for lnd

* rename decodeAddress returned keys

* show something when tx has createdAt = 0

* tx with no date go to the top

* fix reactivity when receiving events from service worker

* remove not needed effect

* deal with unconfirmed onboarding txs

* fix

* don't settle if total < dust

* update dependencies

* fix and add more tests to Transaction

* refactor canSettleNow

* update noble and scure dependencies

* don't throw if bip21 ark address from different server (try lightning or mainnet)

* fix Transaction tests

* fix

* refactor Transaction screen

* works on expired boarding txs

* fix

* fix Transaction screen

* new /v1/info return object

* fix tests

* fix nginx conf

* remove dust checks (#123)

Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* update docker composer to use time in regtest

* update to new arkInfo

* update dependencies

* update dependencies

* fix rabbit reported bugs

---------

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Signed-off-by: Andrew Camilleri <evilkukka@gmail.com>
Signed-off-by: João Bordalo <bordalix@users.noreply.github.com>
Co-authored-by: louisinger <louis@vulpem.com>
Co-authored-by: louisinger <41042567+louisinger@users.noreply.github.com>
Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com>
Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Oct 13, 2025
@bordalix
bordalix deleted the v7 branch October 15, 2025 13:52
@coderabbitai coderabbitai Bot mentioned this pull request Oct 29, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Nov 6, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Dec 12, 2025
This was referenced Dec 29, 2025
This was referenced Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants