diff --git a/src/actions/ripple/BlockchainActions.js b/src/actions/ripple/BlockchainActions.js index 94100f9b..4fb5b0fe 100644 --- a/src/actions/ripple/BlockchainActions.js +++ b/src/actions/ripple/BlockchainActions.js @@ -24,20 +24,47 @@ export const subscribe = (network: string): PromiseAction => async (dispat }; export const onBlockMined = (network: string): PromiseAction => async (dispatch: Dispatch, getState: GetState): Promise => { - const fee = await TrezorConnect.blockchainGetFee({ - coin: network, - }); - if (!fee.success) return; - const blockchain = getState().blockchain.find(b => b.shortcut === network); if (!blockchain) return; - if (fee.payload !== blockchain.fee) { - dispatch({ - type: BLOCKCHAIN.UPDATE_FEE, - shortcut: network, - fee: fee.payload, - }); + // const fee = await TrezorConnect.blockchainGetFee({ + // coin: network, + // }); + // if (!fee.success) return; + + + // if (fee.payload !== blockchain.fee) { + // dispatch({ + // type: BLOCKCHAIN.UPDATE_FEE, + // shortcut: network, + // fee: fee.payload, + // }); + // } + + const accounts: Array = getState().accounts.filter(a => a.network === network); + // console.warn('ACCOUNTS', accounts); + if (accounts.length > 0) { + // const response = await TrezorConnect.rippleGetAccountInfo({ + // bundle: accounts, + // level: 'transactions', + // coin: network, + // }); + + // console.warn('APDEJT RESP', response); + // if (!response.success) return; + + // response.payload.forEach((a, i) => { + // if (a.transactions.length > 0) { + // console.warn('APDEJTED!', a, i); + // dispatch(AccountsActions.update({ + // ...accounts[i], + // balance: toDecimalAmount(a.balance, DECIMALS), + // availableBalance: toDecimalAmount(a.availableBalance, DECIMALS), + // block: a.block, + // sequence: a.sequence, + // })); + // } + // }); } }; @@ -71,7 +98,7 @@ export const onNotification = (payload: $ElementType; @@ -34,8 +35,9 @@ const onConnect = (state: State, action: BlockchainConnect): State => { return state.concat([{ shortcut, connected: true, - fee: info.fee, block: info.block, + fee: info.fee, + reserved: info.reserved || '0', }]); }; @@ -53,8 +55,9 @@ const onError = (state: State, action: BlockchainError): State => { return state.concat([{ shortcut, connected: false, - fee: '0', block: 0, + fee: '0', + reserved: '0', }]); };