Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
domechn committed Nov 8, 2023
1 parent 78e8bb2 commit b29091b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 0 additions & 7 deletions src/components/historical-data/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
.historical-data-card:hover {
box-shadow: 0 0 5px #aaa;

.historical-data-card-bottom .historical-data-card-bottom-operations {
display: flex;
}
}

.historical-data-card-total {
Expand Down Expand Up @@ -50,10 +47,6 @@
display: flex;
}

.historical-data-card-bottom-operations {
display: none;
}

/* fix bottom right */
.historical-data-card-bottom-changes {
position: absolute;
Expand Down
4 changes: 2 additions & 2 deletions src/components/historical-data/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const App = ({
return (
<div
key={d.id}
className="historical-data-card"
className="historical-data-card group"
onClick={() => onRowClick(d.id)}
>
<div>
Expand All @@ -171,7 +171,7 @@ const App = ({
</div>

<div className="historical-data-card-bottom">
<div className="historical-data-card-bottom-operations">
<div className="hidden group-hover:inline-block">
<a onClick={() => onHistoricalDataDeleteClick(d.id)}>
<img
src={deleteIcon}
Expand Down
14 changes: 9 additions & 5 deletions src/middlelayers/datafetch/coins/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class BscERC20Query extends EthplorerERC20Query {

export class ERC20Analyzer implements Analyzer {
private readonly config: Pick<TokenConfig, 'erc20'>
private readonly queries = [new EthERC20Query(), new BscERC20Query()]
// !bsc first, because of this provider has some bug, if call eth first, balance of bsc will be the same as eth
private readonly queries = [new BscERC20Query(), new EthERC20Query()]

constructor(config: Pick<TokenConfig, 'erc20'>) {
this.config = config
Expand All @@ -110,9 +111,12 @@ export class ERC20Analyzer implements Analyzer {
}

private async query(address: string): Promise<WalletCoin[]> {
const coins = await bluebird.map(this.queries, async q => q.query(address), {
concurrency: 2
})
const coins: Coin[][] = []
// currency must be 1, because of bug of ethplorer.io
for (const q of this.queries) {
const coin = await q.query(address)
coins.push(coin)
}

return _(coins).flatten().map(c => ({
...c,
Expand All @@ -133,7 +137,7 @@ export class ERC20Analyzer implements Analyzer {
if (max <= 0) {
throw new Error("failed to query erc20 assets, with max retry")
}
const coinLists = await asyncMap(getAddressList(this.config.erc20), async addr => this.query(addr), 1, 1000)
const coinLists = await asyncMap(getAddressList(this.config.erc20), async addr => this.query(addr), 2, 1000)

return _(coinLists).flatten().value()
} catch (e) {
Expand Down

0 comments on commit b29091b

Please sign in to comment.