Browse Source

Pass correct accountId when computing transactions

master
meriadec 7 years ago
parent
commit
fa8d48552d
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 8
      src/helpers/btc.js
  2. 1
      src/internals/usb/wallet/accounts.js

8
src/helpers/btc.js

@ -21,7 +21,7 @@ export const networks = [
}, },
] ]
export function computeOperation(addresses: Array<string>) { export function computeOperation(addresses: Array<string>, accountId: string) {
return (t: Object) => { return (t: Object) => {
const outputVal = t.outputs const outputVal = t.outputs
.filter(o => addresses.includes(o.address)) .filter(o => addresses.includes(o.address))
@ -39,7 +39,7 @@ export function computeOperation(addresses: Array<string>) {
amount, amount,
confirmations: t.confirmations, confirmations: t.confirmations,
date: t.received_at, date: t.received_at,
accountId: 'abcd', accountId,
blockHeight: 0, blockHeight: 0,
} }
} }
@ -78,6 +78,7 @@ export async function getAccount({
segwit, segwit,
network, network,
coinType, coinType,
accountId,
asyncDelay = 250, asyncDelay = 250,
onProgress = noop, onProgress = noop,
}: { }: {
@ -88,6 +89,7 @@ export async function getAccount({
hdnode: Object, hdnode: Object,
segwit: boolean, segwit: boolean,
coinType: number, coinType: number,
accountId: string,
network: Object, network: Object,
asyncDelay?: number, asyncDelay?: number,
onProgress?: Function, onProgress?: Function,
@ -165,7 +167,7 @@ export async function getAccount({
const hasOperations = txs.length > 0 const hasOperations = txs.length > 0
if (hasOperations) { if (hasOperations) {
const newOperations = txs.map(computeOperation(allAddresses)) const newOperations = txs.map(computeOperation(allAddresses, accountId))
const txHashs = operations.map(t => t.id) const txHashs = operations.map(t => t.id)

1
src/internals/usb/wallet/accounts.js

@ -150,6 +150,7 @@ export default async ({
const account = await getAccount({ const account = await getAccount({
asyncDelay: 0, asyncDelay: 0,
coinType, coinType,
accountId: xpub58,
hdnode, hdnode,
network, network,
rootPath: path, rootPath: path,

Loading…
Cancel
Save