diff --git a/packages/json-rpc/index.js b/packages/json-rpc/index.js index 37e3e9294..7eb3ba8d1 100644 --- a/packages/json-rpc/index.js +++ b/packages/json-rpc/index.js @@ -3,5 +3,5 @@ * @name index.js */ -import * as utils from './utils' +import * as utils from './utils.js' export {utils} diff --git a/packages/ledger/package.json b/packages/ledger/package.json index dacc16d19..d81b191ca 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -6,7 +6,7 @@ "dependencies": { "@fluent-wallet/base32-address": "workspace:packages/base32-address", "@fluent-wallet/hw-app-conflux": "0.0.8", - "@ledgerhq/hw-app-eth": "6.24.1", - "@ledgerhq/hw-transport-webusb": "6.19.0" + "@ledgerhq/hw-app-eth": "6.38.0", + "@ledgerhq/hw-transport-webusb": "6.29.2" } } diff --git a/packages/rpcs/eth_signTxWithLedgerNanoS/index.js b/packages/rpcs/eth_signTxWithLedgerNanoS/index.js index 08f2ff9d4..450c8d958 100644 --- a/packages/rpcs/eth_signTxWithLedgerNanoS/index.js +++ b/packages/rpcs/eth_signTxWithLedgerNanoS/index.js @@ -3,9 +3,9 @@ import {decrypt} from 'browser-passworder' import {Ethereum as LedgerEthereum} from '@fluent-wallet/ledger' import {TransactionFactory} from '@ethereumjs/tx' import {RLP} from '@ethereumjs/rlp' -import {bufArrToArr} from '@ethereumjs/util' import {Common} from '@ethereumjs/common' import {addHexPrefix} from '@fluent-wallet/utils' +import {bytesToHex} from '@ethereumjs/util' export const NAME = 'eth_signTxWithLedgerNanoS' @@ -63,10 +63,9 @@ export const main = async ({ const common = Common.custom({chainId: tx.chainId}) const txData = TransactionFactory.fromTxData(newTx, {common}) - let messageToSign = txData.getMessageToSign(false) - const rawTxHex = Buffer.isBuffer(messageToSign) - ? messageToSign.toString('hex') - : Buffer.from(RLP.encode(bufArrToArr(messageToSign))) + const messageToSign = txData.getMessageToSign() + const rawTxHex = + txData.type === 0 ? RLP.encode(messageToSign) : messageToSign const {r, s, v} = await new LedgerEthereum().signTransaction( hdPath, @@ -85,8 +84,8 @@ export const main = async ({ throw InvalidParams( `The address in LedgerNanoS (${recoveredAddr}) doesn't match the address in fluent (${addr.value})`, ) + const rawTx = bytesToHex(signedTx.serialize()) - const rawTx = signedTx.serialize().toString('hex') return addHexPrefix(rawTx) } catch (err) { const newError = UserRejected( diff --git a/packages/rpcs/eth_signTxWithLedgerNanoS/package.json b/packages/rpcs/eth_signTxWithLedgerNanoS/package.json index a5c534d53..75780ab40 100644 --- a/packages/rpcs/eth_signTxWithLedgerNanoS/package.json +++ b/packages/rpcs/eth_signTxWithLedgerNanoS/package.json @@ -5,9 +5,9 @@ "packageManager": "yarn@3.1.0", "version": "0.0.4", "dependencies": { - "@ethereumjs/rlp": "4.0.1", - "@ethereumjs/tx": "4.1.1", - "@ethereumjs/util": "8.0.5", + "@ethereumjs/rlp": "5.0.2", + "@ethereumjs/tx": "5.3.0", + "@ethereumjs/util": "9.0.3", "@fluent-wallet/ledger": "workspace:*", "@fluent-wallet/spec": "workspace:*", "@fluent-wallet/utils": "workspace:packages/utils",