Skip to content

Commit

Permalink
Fix bity message signing for BTC
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes committed Aug 19, 2024
1 parent 2c968f9 commit e60f6d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- changed: Enable Bitpay payments for FIO names and domains
- fixed: Disable max spend for zkSync
- fixed: Do not show duplicate password-recovery modals when launching a freshly-installed app for the first time.
- fixed: Fix broken Bity message signing
- fixed: If handling a deep link requires a signed-in account, correctly save it for later.

## 4.10.0 (2024-08-07)
Expand Down
30 changes: 29 additions & 1 deletion src/plugins/gui/providers/bityProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ const approveBityQuote = async (
if (orderData.message_to_sign != null) {
const { body } = orderData.message_to_sign
const { publicAddress } = await wallet.getReceiveAddress({ tokenId: null })
const signedMessage = await wallet.signBytes(utf8.parse(body), { otherParams: { publicAddress } })
const signedMessage = isUtxoWallet(wallet)
? await wallet.signMessage(body, { otherParams: { publicAddress } })
: await wallet.signBytes(utf8.parse(body), { otherParams: { publicAddress } })
const signUrl = baseUrl + orderData.message_to_sign.signature_submission_url
const request = {
method: 'POST',
Expand Down Expand Up @@ -768,3 +770,29 @@ const executeBuyOrderFetch = async (
clientId
)
}

function isUtxoWallet(wallet: EdgeCurrencyWallet) {
return [
'wallet:badcoin',
'wallet:bitcoin',
'wallet:bitcoincash',
'wallet:bitcoincashtestnet',
'wallet:bitcoingold',
'wallet:bitcoingoldtestnet',
'wallet:bitcoinsv',
'wallet:bitcointestnet',
'wallet:dash',
'wallet:digibyte',
'wallet:dogecoin',
'wallet:eboost',
'wallet:feathercoin',
'wallet:groestlcoin',
'wallet:litecoin',
'wallet:qtum',
'wallet:ravencoin',
'wallet:smartcash',
'wallet:ufo',
'wallet:vertcoin',
'wallet:zcoin'
].includes(wallet.currencyInfo.walletType)
}

0 comments on commit e60f6d6

Please sign in to comment.