Skip to content

Commit

Permalink
remove alias request (#110)
Browse files Browse the repository at this point in the history
* remove alias request

* remove logs

* fix
  • Loading branch information
Veserion authored Jun 17, 2021
1 parent a844abb commit b1f5ee1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
30 changes: 10 additions & 20 deletions src/js/pages/SingleAddressPage/TransactionList.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class TransactionListContainer extends React.Component {

state = {
transactions: [],
invertedAliases: [],
loading: false,
hasMore: true
};
Expand All @@ -30,25 +29,17 @@ class TransactionListContainer extends React.Component {
const {address, networkId} = this.props.match.params;
const addressService = ServiceFactory.forNetwork(networkId).addressService();

return addressService.loadRawAliases(address).then(rawAliases => {
const currentUser = {
address,
aliases: {}
};
const currentUser = {
address,
};

return addressService.loadTransactions(address, TX_PAGE_SIZE).then(transactions => {
rawAliases.forEach(item => {
currentUser.aliases[item] = true;
});

return transactionMapper(transactions, currentUser);
})
.then(transactions => {
this._isMounted && this.setState({
transactions,
invertedAliases: currentUser.aliases,
hasMore: transactions.length === TX_PAGE_SIZE
});
return addressService.loadTransactions(address, TX_PAGE_SIZE).then(transactions => {
return transactionMapper(transactions, currentUser);
}).then(transactions => {
this._isMounted && this.setState({
transactions,
invertedAliases: currentUser.aliases,
hasMore: transactions.length === TX_PAGE_SIZE
});
});
};
Expand All @@ -60,7 +51,6 @@ class TransactionListContainer extends React.Component {
return addressService.loadTransactions(address, TX_PAGE_SIZE, after).then(transactions => {
const currentUser = {
address,
aliases: this.state.invertedAliases
};

return transactionMapper(transactions, currentUser);
Expand Down
7 changes: 1 addition & 6 deletions src/js/pages/SingleAddressPage/TransactionMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ const moneyToObject = money => ({
currency: money.currency.toString()
});

const matchesUser = (currentUser, addressOrAlias) => {
if (addressOrAlias === currentUser.address)
return true;

return !!currentUser.aliases[addressOrAlias];
};
const matchesUser = (currentUser, addressOrAlias) => addressOrAlias === currentUser.address;

const mapScriptInvocation = (tx, currentAddress) => {
const tail = {
Expand Down
2 changes: 2 additions & 0 deletions src/js/services/AliasService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export class AliasService extends ApiClientService {
loadAddress = (alias) => {
return this.getApi().aliases.address(alias)
.then(addressResponse => {
addressResponse = addressResponse.data

if (addressResponse.__type === 'alias') {
return addressResponse.data.address;
}
Expand Down

0 comments on commit b1f5ee1

Please sign in to comment.