From 872f39794a08f4f956ec4cb51898e80f28cddef4 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 1 Dec 2021 23:03:42 -0300 Subject: [PATCH] [FEAT] shib --- package.json | 2 +- src/assets/img/currencies/shib.svg | 17 +++++++++ src/components/coin-icon/coin-icon.scss | 3 ++ .../settings/alt-currency/alt-currency.ts | 3 ++ src/providers/currency/coin.ts | 38 +++++++++++++++++++ src/providers/currency/currency.ts | 9 ++++- src/providers/currency/token.ts | 6 +++ src/providers/rate/rate.ts | 6 ++- src/providers/tx-format/tx-format.ts | 3 +- src/theme/lists.scss | 3 ++ 10 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 src/assets/img/currencies/shib.svg diff --git a/package.json b/package.json index 7ae8472bceb..8eb6b09c48a 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "apple-wallet-ng": "1.1.1", "base64-js": "1.3.0", "bitauth": "git+https://github.com/bitpay/bitauth.git#68cf0353bf517a7e5293478608839fa904351eb6", - "bitcore-wallet-client": "8.25.24", + "bitcore-wallet-client": "8.25.25", "buffer-compare": "1.1.1", "chart.js": "2.9.4", "cordova": "10.0.0", diff --git a/src/assets/img/currencies/shib.svg b/src/assets/img/currencies/shib.svg new file mode 100644 index 00000000000..09a91d70e0a --- /dev/null +++ b/src/assets/img/currencies/shib.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/coin-icon/coin-icon.scss b/src/components/coin-icon/coin-icon.scss index 2b1ae981586..3a49868ade0 100644 --- a/src/components/coin-icon/coin-icon.scss +++ b/src/components/coin-icon/coin-icon.scss @@ -50,6 +50,9 @@ coin-icon { &_ltc { background-color: #a6a9aa; } + &_shib { + background-color: #f00500; + } &_default { background-color: #e6f8e9; } diff --git a/src/pages/settings/alt-currency/alt-currency.ts b/src/pages/settings/alt-currency/alt-currency.ts index 0e62a7b9961..c42659bca57 100644 --- a/src/pages/settings/alt-currency/alt-currency.ts +++ b/src/pages/settings/alt-currency/alt-currency.ts @@ -75,6 +75,9 @@ export class AltCurrencyPage { }, { isoCode: 'WBTC' + }, + { + isoCode: 'SHIB' } ]; } diff --git a/src/providers/currency/coin.ts b/src/providers/currency/coin.ts index 33067cf5dfb..714d5c8343b 100644 --- a/src/providers/currency/coin.ts +++ b/src/providers/currency/coin.ts @@ -489,5 +489,43 @@ export const availableCoins: CoinsMap = { backgroundColor: '#f7921a', gradientBackgroundColor: '#f7921a' } + }, + shib: { + name: 'SHIBA INU', + chain: 'ETH', + coin: 'shib', + unitInfo: { + unitName: 'SHIB', + unitToSatoshi: 1e18, + unitDecimals: 18, + unitCode: 'shib' + }, + properties: { + hasMultiSig: false, + hasMultiSend: false, + isUtxo: false, + isERCToken: true, + isStableCoin: false, + singleAddress: true, + isCustom: false + }, + paymentInfo: { + paymentCode: 'EIP681b', + protocolPrefix: { livenet: 'ethereum', testnet: 'ethereum' }, + ratesApi: 'https://bws.bitpay.com/bws/api/v3/fiatrates/shib', + blockExplorerUrls: 'etherscan.io/', + blockExplorerUrlsTestnet: 'kovan.etherscan.io/' + }, + feeInfo: { + feeUnit: 'Gwei', + feeUnitAmount: 1000000000, + blockTime: 0.2, + maxMerchantFee: 'urgent' + }, + theme: { + coinColor: '#2775ca', + backgroundColor: '#2775c9', + gradientBackgroundColor: '#2775c9' + } } }; diff --git a/src/providers/currency/currency.ts b/src/providers/currency/currency.ts index f5adc3ad199..e68cd9d88e0 100644 --- a/src/providers/currency/currency.ts +++ b/src/providers/currency/currency.ts @@ -31,7 +31,8 @@ export class CurrencyProvider { DAI: 'dai', WBTC: 'wbtc', DOGE: 'doge', - LTC: 'ltc' + LTC: 'ltc', + SHIB: 'shib' }; public popularERC20TokensSymbols: string[] = [ @@ -140,7 +141,7 @@ export class CurrencyProvider { hasMultiSend: false, isUtxo: false, isERCToken: true, - isStableCoin: true, + isStableCoin: false, singleAddress: true, isCustom: true }, @@ -215,6 +216,10 @@ export class CurrencyProvider { return !!this.coinOpts[coin].properties.isERCToken; } + isStableCoin(coin: string): boolean { + return !!this.coinOpts[coin].properties.isStableCoin; + } + isCustomERCToken(coin: string) { let isBitpaySupportedToken: boolean = this.getBitpaySupportedTokens().filter(token => { diff --git a/src/providers/currency/token.ts b/src/providers/currency/token.ts index 8309813be2a..84c0a00dd68 100644 --- a/src/providers/currency/token.ts +++ b/src/providers/currency/token.ts @@ -44,5 +44,11 @@ export const TokenOpts = { symbol: 'WBTC', decimal: 9, address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' + }, + '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce': { + name: 'SHIBA INU', + symbol: 'SHIB', + decimal: 18, + address: '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce' } }; diff --git a/src/providers/rate/rate.ts b/src/providers/rate/rate.ts index 9a68e02f7a7..e9408b974d6 100644 --- a/src/providers/rate/rate.ts +++ b/src/providers/rate/rate.ts @@ -90,7 +90,11 @@ export class RateProvider { this.alternatives[r.code] = { name: r.name }; } }); - this.rates[coin] = !_.isEmpty(coinRates) ? coinRates : { USD: 1 }; + this.rates[coin] = !_.isEmpty(coinRates) + ? coinRates + : this.currencyProvider.isStableCoin(coin) + ? { USD: 1 } + : null; this.ratesAvailable[coin] = true; }); return Promise.resolve(); diff --git a/src/providers/tx-format/tx-format.ts b/src/providers/tx-format/tx-format.ts index c93c4d5372a..720e2577db2 100644 --- a/src/providers/tx-format/tx-format.ts +++ b/src/providers/tx-format/tx-format.ts @@ -19,7 +19,8 @@ export enum Coin { BUSD = 'busd', DAI = 'dai', WBTC = 'wbtc', - DOGE = 'doge' + DOGE = 'doge', + SHIB = 'shib' } @Injectable() export class TxFormatProvider { diff --git a/src/theme/lists.scss b/src/theme/lists.scss index 1b244749a60..5b37ee71eb1 100644 --- a/src/theme/lists.scss +++ b/src/theme/lists.scss @@ -100,6 +100,9 @@ &_ltc { background-color: #a6a9aa; } + &_shib { + background-color: #f00500; + } } } }