Skip to content

Commit

Permalink
feat(dynamic custodial): switch over to custodial wallet balance
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed Jul 26, 2021
1 parent 3935d08 commit e5a81a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions config/mocks/wallet-options-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"coinfig": {
"name": "Bitcoin",
"precision": 8,
"products": ["PrivateKey", "SimpleBuyBalance"],
"products": ["PrivateKey", "CustodialWalletBalance"],
"symbol": "BTC",
"type": {
"logoPngUrl": "",
Expand All @@ -106,7 +106,7 @@
"coinfig": {
"name": "Ethereum",
"precision": 18,
"products": ["PrivateKey", "SimpleBuyBalance"],
"products": ["PrivateKey", "CustodialWalletBalance"],
"symbol": "ETH",
"type": {
"logoPngUrl": "",
Expand All @@ -132,7 +132,7 @@
"coinfig": {
"name": "Bitcoin Cash",
"precision": 8,
"products": ["PrivateKey", "SimpleBuyBalance"],
"products": ["PrivateKey", "CustodialWalletBalance"],
"symbol": "BCH",
"type": {
"logoPngUrl": "",
Expand Down Expand Up @@ -160,7 +160,7 @@
"coinfig": {
"name": "Stellar",
"precision": 7,
"products": ["PrivateKey", "SimpleBuyBalance"],
"products": ["PrivateKey", "CustodialWalletBalance"],
"symbol": "XLM",
"type": {
"logoPngUrl": "",
Expand Down Expand Up @@ -225,7 +225,7 @@
"coinfig": {
"name": "Algorand",
"precision": 6,
"products": ["SimpleBuyBalance"],
"products": ["CustodialWalletBalance"],
"symbol": "ALGO",
"type": {
"logoPngUrl": "",
Expand All @@ -247,7 +247,7 @@
"coinfig": {
"name": "BitClout",
"precision": 9,
"products": ["SimpleBuyBalance"],
"products": ["CustodialWalletBalance"],
"symbol": "CLOUT",
"type": {
"logoPngUrl": "https://raw.githubusercontent.com/blockchain/coin-definitions/master/extensions/blockchains/bitclout/info/logo.png",
Expand All @@ -269,7 +269,7 @@
"coinfig": {
"name": "Polkadot",
"precision": 10,
"products": ["SimpleBuyBalance"],
"products": ["CustodialWalletBalance"],
"symbol": "DOT",
"type": {
"logoPngUrl": "",
Expand All @@ -291,7 +291,7 @@
"coinfig": {
"name": "DogeCoin",
"precision": 8,
"products": ["SimpleBuyBalance"],
"products": ["CustodialWalletBalance"],
"symbol": "DOGE",
"type": {
"logoPngUrl": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,12 @@ export const getCoinsBalanceInfo = createDeepEqualSelector(
[selectors.core.data.coins.getCoins, selectors.core.settings.getCurrency, (state) => state],
(coins, currencyR, state) => {
const transform = (currency) => {
return coins.map((coin, balance) => {
const transform2 = (rates) => {
return coins.map((coin) => {
const transform2 = (rates, balance) => {
return Exchange.convertCoinToFiat({ coin, currency, rates, value: balance })
}

const balanceR = getCoinBalance(coin)(state)
// @ts-ignore
const ratesR = selectors.core.data.coins.getRates(coin, state)
return ratesR ? lift(transform2)(ratesR, balanceR) : Remote.of('0')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getData = (state) => {
return Object.keys(coins).filter(
(value) =>
window.coins[value].coinfig.products.includes('PrivateKey') ||
window.coins[value].coinfig.products.includes('SimpleBuyBalance')
window.coins[value].coinfig.products.includes('CustodialWalletBalance')
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const coinsReducer = (state = INITIAL_STATE, action: CoinsActionTypes): C
...state,
rates: {
...state.rates,
[action.payload.coin]: Remote.Success(action.payload)
[action.payload.coin]: Remote.Success(action.payload.rates)
}
}
default: {
Expand Down

0 comments on commit e5a81a4

Please sign in to comment.