jam icon indicating copy to clipboard operation
jam copied to clipboard

feat: Add support for 24-word mnemonic phrases and fix API headers

Open naveenkumar29052006 opened this issue 2 weeks ago • 1 comments

Summary

This PR adds support for importing wallets using 24-word mnemonic phrases (in addition to the existing 12-word support) and fixes missing Content-Type headers in API requests that were causing 400 Bad Request errors.

Changes

1. 24-Word Mnemonic Support (ImportWallet.tsx)

  • Added a radio button selector to choose between 12-word and 24-word mnemonic phrases
  • Added phraseLength field to form state to track the selected phrase length
  • Updated mnemonic validation to properly validate variable-length phrases
  • Improved dummy mnemonic generation to work with both 12 and 24-word phrases
  • Added wallettype: 'sw-fb' parameter to the wallet recovery API call

2. API Header Fixes (JmWalletApi.ts)

  • Added missing Content-Type: application/json headers to all POST requests:
    • /v1/token
    • /v1/wallet/create
    • /v1/wallet/recover
    • /v1/wallet/{walletFileName}/unlock
    • /v1/wallet/{walletFileName}/maker/start
    • /v1/wallet/{walletFileName}/taker/direct-send
    • /v1/wallet/{walletFileName}/taker/coinjoin
    • /v1/wallet/{walletFileName}/freeze
    • /v1/wallet/{walletFileName}/taker/schedule
    • /v1/wallet/{walletFileName}/configset
    • /v1/wallet/{walletFileName}/configget

Motivation

  • 24-word support: BIP39 standard supports both 12 and 24-word mnemonic phrases. Users with 24-word phrases were unable to import their wallets.
  • API headers: The JoinMarket API expects Content-Type: application/json headers for POST requests with JSON bodies. Missing headers were causing 400 Bad Request errors during wallet operations.

Testing

  • [x] Manually tested importing wallet with 12-word mnemonic phrase
  • [x] Manually tested importing wallet with 24-word mnemonic phrase
  • [x] Verified API requests now include proper Content-Type headers
  • [x] Code formatted with Prettier (pre-commit hook)

naveenkumar29052006 avatar Dec 08 '25 09:12 naveenkumar29052006