mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
update BlockchainNotification event values to match BlockchainLinkTransaction
This commit is contained in:
parent
7ad19dd1c0
commit
24524d7445
@ -135,66 +135,12 @@ export const onNotification = (payload: $ElementType<BlockchainNotification, 'pa
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: PENDING.ADD,
|
type: PENDING.ADD,
|
||||||
payload: {
|
payload: {
|
||||||
type: notification.type,
|
...notification,
|
||||||
address: notification.address,
|
|
||||||
deviceState: account.deviceState,
|
deviceState: account.deviceState,
|
||||||
|
|
||||||
inputs: notification.inputs,
|
|
||||||
outputs: notification.outputs,
|
|
||||||
|
|
||||||
sequence: notification.sequence,
|
|
||||||
hash: notification.hash,
|
|
||||||
network: account.network,
|
network: account.network,
|
||||||
|
|
||||||
currency: notification.currency || account.network, // TODO: how to catch token?
|
|
||||||
|
|
||||||
amount: notification.amount,
|
|
||||||
total: notification.total,
|
|
||||||
fee: notification.fee,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: replace "send success" notification with link to explorer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: get transaction history here
|
|
||||||
// console.warn("OnBlAccount", account);
|
|
||||||
// this event can be triggered multiple times
|
|
||||||
// // 1. check if pair [txid + address] is already in reducer
|
|
||||||
// const network: string = payload.coin.shortcut.toLowerCase();
|
|
||||||
// const address: string = EthereumjsUtil.toChecksumAddress(payload.tx.address);
|
|
||||||
// const txInfo = await dispatch(Web3Actions.getPendingInfo(network, payload.tx.txid));
|
|
||||||
|
|
||||||
// // const exists = getState().pending.filter(p => p.id === payload.tx.txid && p.address === address);
|
|
||||||
// const exists = getState().pending.filter(p => p.address === address);
|
|
||||||
// if (exists.length < 1) {
|
|
||||||
// if (txInfo) {
|
|
||||||
// dispatch({
|
|
||||||
// type: PENDING.ADD,
|
|
||||||
// payload: {
|
|
||||||
// type: 'send',
|
|
||||||
// id: payload.tx.txid,
|
|
||||||
// network,
|
|
||||||
// currency: 'tETH',
|
|
||||||
// amount: txInfo.value,
|
|
||||||
// total: '0',
|
|
||||||
// tx: {},
|
|
||||||
// nonce: txInfo.nonce,
|
|
||||||
// address,
|
|
||||||
// rejected: false,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// // tx info not found (yet?)
|
|
||||||
// // dispatch({
|
|
||||||
// // type: PENDING.ADD_UNKNOWN,
|
|
||||||
// // payload: {
|
|
||||||
// // network,
|
|
||||||
// // ...payload.tx,
|
|
||||||
// // }
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const onError = (network: string): PromiseAction<void> => async (dispatch: Dispatch): Promise<void> => {
|
export const onError = (network: string): PromiseAction<void> => async (dispatch: Dispatch): Promise<void> => {
|
||||||
|
@ -532,7 +532,7 @@ export const onSend = (): AsyncAction => async (dispatch: Dispatch, getState: Ge
|
|||||||
const blockchainNotification = {
|
const blockchainNotification = {
|
||||||
type: 'send',
|
type: 'send',
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
date: '',
|
confirmations: 0,
|
||||||
address: account.address,
|
address: account.address,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
@ -554,7 +554,7 @@ export const onSend = (): AsyncAction => async (dispatch: Dispatch, getState: Ge
|
|||||||
total: currentState.total,
|
total: currentState.total,
|
||||||
|
|
||||||
sequence: nonce,
|
sequence: nonce,
|
||||||
currency: isToken ? currentState.currency : null,
|
currency: isToken ? currentState.currency : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(BlockchainActions.onNotification({
|
dispatch(BlockchainActions.onNotification({
|
||||||
|
@ -50,20 +50,10 @@ export const onNotification = (payload: $ElementType<BlockchainNotification, 'pa
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: PENDING.ADD,
|
type: PENDING.ADD,
|
||||||
payload: {
|
payload: {
|
||||||
type: notification.type,
|
...notification,
|
||||||
address: account.address,
|
|
||||||
deviceState: account.deviceState,
|
deviceState: account.deviceState,
|
||||||
|
|
||||||
inputs: notification.inputs,
|
|
||||||
outputs: notification.outputs,
|
|
||||||
|
|
||||||
sequence: notification.sequence,
|
|
||||||
hash: notification.hash,
|
|
||||||
network: account.network,
|
network: account.network,
|
||||||
|
|
||||||
currency: account.network,
|
|
||||||
// amount: notification.amount,
|
|
||||||
// fee: notification.fee,
|
|
||||||
amount: toDecimalAmount(notification.amount, DECIMALS),
|
amount: toDecimalAmount(notification.amount, DECIMALS),
|
||||||
total: notification.type === 'send' ? toDecimalAmount(notification.total, DECIMALS) : toDecimalAmount(notification.amount, DECIMALS),
|
total: notification.type === 'send' ? toDecimalAmount(notification.total, DECIMALS) : toDecimalAmount(notification.amount, DECIMALS),
|
||||||
fee: toDecimalAmount(notification.fee, DECIMALS),
|
fee: toDecimalAmount(notification.fee, DECIMALS),
|
||||||
|
Loading…
Reference in New Issue
Block a user