mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-27 18:58:08 +00:00
ripple/BlockbookAction temporary commented
This commit is contained in:
parent
39c4198fcc
commit
c53dfcfaeb
@ -24,20 +24,47 @@ export const subscribe = (network: string): PromiseAction<void> => async (dispat
|
||||
};
|
||||
|
||||
export const onBlockMined = (network: string): PromiseAction<void> => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
|
||||
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<any> = 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<BlockchainNotification, 'pa
|
||||
const updatedAccount = await TrezorConnect.rippleGetAccountInfo({
|
||||
account: {
|
||||
address: account.address,
|
||||
block: account.block,
|
||||
from: account.block,
|
||||
history: false,
|
||||
},
|
||||
coin: account.network,
|
||||
@ -81,7 +108,7 @@ export const onNotification = (payload: $ElementType<BlockchainNotification, 'pa
|
||||
dispatch(AccountsActions.update({
|
||||
...account,
|
||||
balance: toDecimalAmount(updatedAccount.payload.balance, DECIMALS),
|
||||
availableDevice: toDecimalAmount(updatedAccount.payload.availableBalance, DECIMALS),
|
||||
availableBalance: toDecimalAmount(updatedAccount.payload.availableBalance, DECIMALS),
|
||||
block: updatedAccount.payload.block,
|
||||
sequence: updatedAccount.payload.sequence,
|
||||
}));
|
||||
|
@ -9,8 +9,9 @@ import type { BlockchainConnect, BlockchainError, BlockchainBlock } from 'trezor
|
||||
export type BlockchainNetwork = {
|
||||
+shortcut: string,
|
||||
connected: boolean,
|
||||
fee: string,
|
||||
block: number,
|
||||
reserved: string, // xrp specific
|
||||
fee: string,
|
||||
};
|
||||
|
||||
export type State = Array<BlockchainNetwork>;
|
||||
@ -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',
|
||||
}]);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user