From fa8d48552d7d0741dff3d914ec7a1f3edffa5a9e Mon Sep 17 00:00:00 2001 From: meriadec Date: Wed, 18 Apr 2018 16:09:07 +0200 Subject: [PATCH] Pass correct accountId when computing transactions --- src/helpers/btc.js | 8 +++++--- src/internals/usb/wallet/accounts.js | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/helpers/btc.js b/src/helpers/btc.js index a653893b..4ec15342 100644 --- a/src/helpers/btc.js +++ b/src/helpers/btc.js @@ -21,7 +21,7 @@ export const networks = [ }, ] -export function computeOperation(addresses: Array) { +export function computeOperation(addresses: Array, accountId: string) { return (t: Object) => { const outputVal = t.outputs .filter(o => addresses.includes(o.address)) @@ -39,7 +39,7 @@ export function computeOperation(addresses: Array) { amount, confirmations: t.confirmations, date: t.received_at, - accountId: 'abcd', + accountId, blockHeight: 0, } } @@ -78,6 +78,7 @@ export async function getAccount({ segwit, network, coinType, + accountId, asyncDelay = 250, onProgress = noop, }: { @@ -88,6 +89,7 @@ export async function getAccount({ hdnode: Object, segwit: boolean, coinType: number, + accountId: string, network: Object, asyncDelay?: number, onProgress?: Function, @@ -165,7 +167,7 @@ export async function getAccount({ const hasOperations = txs.length > 0 if (hasOperations) { - const newOperations = txs.map(computeOperation(allAddresses)) + const newOperations = txs.map(computeOperation(allAddresses, accountId)) const txHashs = operations.map(t => t.id) diff --git a/src/internals/usb/wallet/accounts.js b/src/internals/usb/wallet/accounts.js index 61780c49..7abe412a 100644 --- a/src/internals/usb/wallet/accounts.js +++ b/src/internals/usb/wallet/accounts.js @@ -150,6 +150,7 @@ export default async ({ const account = await getAccount({ asyncDelay: 0, coinType, + accountId: xpub58, hdnode, network, rootPath: path,