|
@ -73,7 +73,7 @@ const txToOps = (account: Account) => (tx: Tx): Operation[] => { |
|
|
const value = BigNumber(tx.value) |
|
|
const value = BigNumber(tx.value) |
|
|
const fee = BigNumber(tx.gas_price * tx.gas_used) |
|
|
const fee = BigNumber(tx.gas_price * tx.gas_used) |
|
|
if (sending) { |
|
|
if (sending) { |
|
|
ops.push({ |
|
|
const op: $Exact<Operation> = { |
|
|
id: `${account.id}-${tx.hash}-OUT`, |
|
|
id: `${account.id}-${tx.hash}-OUT`, |
|
|
hash: tx.hash, |
|
|
hash: tx.hash, |
|
|
type: 'OUT', |
|
|
type: 'OUT', |
|
@ -85,10 +85,12 @@ const txToOps = (account: Account) => (tx: Tx): Operation[] => { |
|
|
senders: [tx.from], |
|
|
senders: [tx.from], |
|
|
recipients: [tx.to], |
|
|
recipients: [tx.to], |
|
|
date: new Date(tx.received_at), |
|
|
date: new Date(tx.received_at), |
|
|
}) |
|
|
extra: {}, |
|
|
|
|
|
} |
|
|
|
|
|
ops.push(op) |
|
|
} |
|
|
} |
|
|
if (receiving) { |
|
|
if (receiving) { |
|
|
ops.push({ |
|
|
const op: $Exact<Operation> = { |
|
|
id: `${account.id}-${tx.hash}-IN`, |
|
|
id: `${account.id}-${tx.hash}-IN`, |
|
|
hash: tx.hash, |
|
|
hash: tx.hash, |
|
|
type: 'IN', |
|
|
type: 'IN', |
|
@ -100,7 +102,9 @@ const txToOps = (account: Account) => (tx: Tx): Operation[] => { |
|
|
senders: [tx.from], |
|
|
senders: [tx.from], |
|
|
recipients: [tx.to], |
|
|
recipients: [tx.to], |
|
|
date: new Date(new Date(tx.received_at) + 1), // hack: make the IN appear after the OUT in history.
|
|
|
date: new Date(new Date(tx.received_at) + 1), // hack: make the IN appear after the OUT in history.
|
|
|
}) |
|
|
extra: {}, |
|
|
|
|
|
} |
|
|
|
|
|
ops.push(op) |
|
|
} |
|
|
} |
|
|
return ops |
|
|
return ops |
|
|
} |
|
|
} |
|
@ -169,7 +173,7 @@ const signAndBroadcast = async ({ |
|
|
|
|
|
|
|
|
const hash = await api.broadcastTransaction(transaction) |
|
|
const hash = await api.broadcastTransaction(transaction) |
|
|
|
|
|
|
|
|
onOperationBroadcasted({ |
|
|
const op: $Exact<Operation> = { |
|
|
id: `${a.id}-${hash}-OUT`, |
|
|
id: `${a.id}-${hash}-OUT`, |
|
|
hash, |
|
|
hash, |
|
|
type: 'OUT', |
|
|
type: 'OUT', |
|
@ -182,7 +186,10 @@ const signAndBroadcast = async ({ |
|
|
recipients: [t.recipient], |
|
|
recipients: [t.recipient], |
|
|
transactionSequenceNumber: nonce, |
|
|
transactionSequenceNumber: nonce, |
|
|
date: new Date(), |
|
|
date: new Date(), |
|
|
}) |
|
|
extra: {}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onOperationBroadcasted(op) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|