Skip to content

Commit

Permalink
Merge pull request #11938 from Gamboster/fix/walletCreationFromSwapCr…
Browse files Browse the repository at this point in the history
…ypto

Fix: wallet creation from Swap Crypto
  • Loading branch information
cmgustavo authored Oct 22, 2021
2 parents de65011 + 772f945 commit 86a8469
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions src/pages/coin-and-wallet-selector/coin-and-wallet-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,22 @@ export class CoinAndWalletSelectorPage {
}

for (const coin of supportedTokens) {
const c = {
unitCode: coin,
name: this.currencyProvider.getCoinName(coin),
availableWallets: _.filter(this.wallets, w => w.coin === coin)
};
this.tokens.push(c);
const availableWallets: any[] = _.filter(
this.wallets,
w => w.coin === coin
);
if (
!this.currencyProvider.isCustomERCToken(coin) ||
(this.currencyProvider.isCustomERCToken(coin) &&
availableWallets.length > 0)
) {
const c = {
unitCode: coin,
name: this.currencyProvider.getCoinName(coin),
availableWallets
};
this.tokens.push(c);
}
}
}

Expand Down Expand Up @@ -173,7 +183,6 @@ export class CoinAndWalletSelectorPage {
coin.unitCode.toUpperCase(),
option => {
if (option) {
this.close();
this.navCtrl.push(CreateWalletPage, {
isShared: false,
coin: coin.unitCode,
Expand Down Expand Up @@ -266,6 +275,16 @@ export class CoinAndWalletSelectorPage {
}

private createAndBindTokenWallet(pairedWallet, token): Promise<any> {
if (this.currencyProvider.isCustomERCToken(token.symbol.toLowerCase())) {
const _token = this.currencyProvider
.getAvailableCustomTokens()
.filter(t => {
return t.symbol.toLowerCase() == token.symbol.toLowerCase();
});

if (_token.length > 0) token = _token[0];
}

const customToken = {
keyId: pairedWallet.keyId,
name: token.name,
Expand Down

0 comments on commit 86a8469

Please sign in to comment.