Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Workaround: dealing with both checksum and lowercase addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonfraga committed Oct 11, 2018
1 parent 007b535 commit 8d61dbf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/client/lib/helpers/templateHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ Template.registerHelper('selectAccounts', function(hideWallets) {
});

// array of string addresses
var accountsAddresses = accounts.map(function(e) {
return e.address;
});
// we can't be sure how the addresses would look like, checksum or lowercase,
// so we add both types to the search.
var accountsAddresses = _.flatten(
accounts.map(function(e) {
return [e.address, web3.utils.toChecksumAddress(e.address)];
})
);

if (hideWallets !== true)
accounts = _.union(
Expand Down
7 changes: 7 additions & 0 deletions app/client/templates/views/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@ Template['views_send'].events({
if (sendAll && (selectedAccount.owners || tokenAddress !== 'ether'))
sendAll = false;

// if is a wallet contract, normalize addresses to lowercase
if (selectedAccount.owners) {
selectedAccount.owners = selectedAccount.owners.map(function(e) {
return e.toLowerCase();
});
}

console.log('Providing gas: ', estimatedGas, sendAll ? '' : ' + 100000');

if (TemplateVar.get('selectedAction') === 'deploy-contract' && !data)
Expand Down

0 comments on commit 8d61dbf

Please sign in to comment.