Skip to content

Commit

Permalink
transaction-sender: Add logging for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
janbormet committed Dec 15, 2023
1 parent 01dc202 commit eec4bef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/neuron-wallet/src/services/transaction-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ export default class TransactionSender {
skipLastInput: boolean = true,
context?: RPC.RawTransaction[]
) {
logger.info('json tx:', JSON.stringify(transaction))
logger.info(`trying to sign transaction with wallet ${walletID}`)
logger.info(`signing tx: ${transaction}`)
const wallet = this.walletService.get(walletID)
const tx = Transaction.fromObject(transaction)
logger.info('tx to sign:', tx)

logger.info('computing tx hash')
const txHash: string = tx.computeHash()

Expand Down Expand Up @@ -166,16 +168,18 @@ export default class TransactionSender {
const paths = addressInfos.map(info => info.path)
const pathAndPrivateKeys = this.getPrivateKeys(wallet, paths, password)
const findPrivateKey = (args: string) => {
logger.log('inside findPrivateKey, args: ', args)
let path: string | undefined
if (args.length === TransactionSender.MULTI_SIGN_ARGS_LENGTH) {
path = multiSignBlake160s.find(i => args.slice(0, 42) === i.multiSignBlake160)?.path
} else if (args.length === 42) {
path = addressInfos.find(i => i.blake160 === args)?.path
} else {
logger.log('inside findPrivateKey, else case')
const addressInfo = AssetAccountInfo.findSignPathForCheque(addressInfos, args)
path = addressInfo?.path
}

logger.log('inside findPrivateKey, path: ', path)
return pathAndPrivateKeys.find(p => p.path === path)?.privateKey
}

Expand Down

0 comments on commit eec4bef

Please sign in to comment.