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

Commit

Permalink
Enable GAIA.* pools (#2290)
Browse files Browse the repository at this point in the history
  • Loading branch information
veado authored Jun 13, 2022
1 parent a7e9fe4 commit 1eea9fb
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ASGARDEX
REACT_APP_DEFAULT_NETWORK=mainnet
# Chains enabled development mode
REACT_APP_CHAINS_ENABLED=THOR,BNB,BTC,LTC,BCH,ETH
REACT_APP_CHAINS_ENABLED=THOR,BNB,BTC,LTC,BCH,ETH,DOGE,GAIA

# Midgard
REACT_APP_MIDGARD_TESTNET_URL=https://testnet.midgard.thorchain.info
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 0.xx.x (2022-xx-xx)
# 0.16.0 (2022-xx-xx)

## ADD

- Support Terra [#2002](https://github.com/thorchain/asgardex-electron/issues/2002), [#2193](https://github.com/thorchain/asgardex-electron/pull/2193), [#2290](https://github.com/thorchain/asgardex-electron/pull/2290)

## Update

- [Pools] Toggle filter buttons to remove clear button
- [Pools] Toggle filter buttons to remove clear button [#2287](https://github.com/thorchain/asgardex-electron/pull/2287)

# 0.15.2 (2022-06-06)

Expand Down
85 changes: 85 additions & 0 deletions src/renderer/assets/svg/asset-atom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/renderer/components/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import arrowGreenIcon from '../../assets/svg/asset-arrow-green.svg'
import greyArrowIcon from '../../assets/svg/asset-arrow-grey.svg'
import arrowTwoIcon from '../../assets/svg/asset-arrow-twoway.svg'
import arrowYellowIcon from '../../assets/svg/asset-arrow-yello.svg'
import atomIcon from '../../assets/svg/asset-atom.svg'
import bnbRuneIcon from '../../assets/svg/asset-bnb-rune.svg'
import bnbIcon from '../../assets/svg/asset-bnb.svg'
import btcIcon from '../../assets/svg/asset-btc.svg'
Expand All @@ -29,6 +30,7 @@ import orbGreenIcon from '../../assets/svg/orb-green.svg'
import terraIcon from '../../assets/svg/terra.svg'

export {
atomIcon,
bnbIcon,
btcIcon,
dogeIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const AssetIcon = styled(UIAssetIcon)``

export const TickerLabel = styled(UILabel).attrs({
textTransform: 'uppercase',
weight: '600'
weight: 'bold'
})`
height: 18px;
padding: 0px 16px 0px 11px;
Expand All @@ -39,7 +39,7 @@ export const ChainLabel = styled(TickerLabel)`

export const AmountLabel = styled(UILabel).attrs({
textTransform: 'uppercase',
weight: '600'
weight: 'bold'
})`
font-family: 'MainFontRegular';
padding-left: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
isRuneBnbAsset,
isRuneNativeAsset,
isTgtERC20Asset,
isXRuneAsset
isXRuneAsset,
isAtomAsset
} from '../../../../helpers/assetHelper'
import { isBnbChain, isEthChain } from '../../../../helpers/chainHelper'
import { getIntFromName, rainbowStop } from '../../../../helpers/colorHelpers'
Expand All @@ -37,7 +38,8 @@ import {
xRuneIcon,
tgtIcon,
lunaIcon,
ustIcon
ustIcon,
atomIcon
} from '../../../icons'
import * as Styled from './AssetIcon.styles'
import { Size } from './AssetIcon.types'
Expand Down Expand Up @@ -96,6 +98,11 @@ export const AssetIcon: React.FC<Props> = ({ asset, size = 'normal', className =
return dogeIcon
}

// Atom
if (isAtomAsset(asset)) {
return atomIcon
}

// LUNA
if (isLunaAsset(asset)) {
return lunaIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Wrapper = styled(Row).attrs({

export const TickerLabel = styled(UILabel).attrs({
textTransform: 'uppercase',
weight: '600'
weight: 'bold'
})`
height: 18px;
padding: 0px 16px 0px 11px;
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/uielements/label/Label.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type Props = {
size?: Size
color?: Color
disabled?: boolean
weight?: string
weight?: 'normal' | 'bold'
textTransform?: TextTransform
nowrap?: boolean
onClick?: (_: React.MouseEvent<HTMLElement>) => void
Expand Down Expand Up @@ -55,12 +55,12 @@ const colors: Colors = {
}

export const LabelWrapper = styled.div<Props>`
padding: 10px 0;
padding: 0;
width: 100%;
white-space: ${({ nowrap = false }) => (nowrap ? 'nowrap' : 'normal')};
font-size: ${({ size = 'normal' }) => fontSettings[size].size};
text-transform: ${({ textTransform = 'none' }) => textTransform};
font-weight: ${({ weight }) => weight};
font-family: ${({ weight }) => (weight === 'bold' ? 'MainFontBold' : 'MainFontRegular')};
letter-spacing: ${({ size = 'normal' }) => fontSettings[size].spacing};
color: ${({ color }) => colors[color || 'normal']};
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const Label = styled(UILabel)`

export const TickerLabel = styled(UILabel).attrs({
textTransform: 'uppercase',
weight: '600'
weight: 'bold'
})`
padding: 0px;
font-size: 16px;
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/helpers/assetHelper.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AssetAtom } from '@xchainjs/xchain-cosmos'
import { ETHAddress } from '@xchainjs/xchain-ethereum'
import { AssetLUNA } from '@xchainjs/xchain-terra'
import {
Expand Down Expand Up @@ -328,6 +329,9 @@ describe('helpers/assetHelper', () => {
it('UST', () => {
expect(isChainAsset(AssetUST)).toBeFalsy()
})
it('ATOM', () => {
expect(isChainAsset(AssetAtom)).toBeTruthy()
})
})

describe('isUSDAsset', () => {
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/helpers/assetHelper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Address } from '@xchainjs/xchain-client'
import { AssetAtom } from '@xchainjs/xchain-cosmos'
import { ETHAddress, getTokenAddress } from '@xchainjs/xchain-ethereum'
import { AssetLUNA } from '@xchainjs/xchain-terra'
import {
Expand Down Expand Up @@ -133,6 +134,11 @@ export const isLunaAsset = (asset: Asset): boolean => eqAsset.equals(asset, Asse
*/
export const isUstAsset = (asset: Asset): boolean => eqAsset.equals(asset, AssetUST)

/**
* Check whether an asset is a ATOM asset
*/
export const isAtomAsset = (asset: Asset): boolean => eqAsset.equals(asset, AssetAtom)

/**
* Check whether an ERC20 asset is white listed or not
*/
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/helpers/chainHelper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AssetAtom } from '@xchainjs/xchain-cosmos'
import { AssetLUNA } from '@xchainjs/xchain-terra'
import {
Asset,
Expand Down Expand Up @@ -36,7 +37,7 @@ export const getChainAsset = (chain: Chain): Asset => {
case THORChain:
return AssetRuneNative
case CosmosChain:
throw Error('Cosmos is not supported yet')
return AssetAtom
case BCHChain:
return AssetBCH
case LTCChain:
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/chain/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const addressByChain$ = (chain: Chain): WalletAddress$ => {
// not supported yet
return Rx.of(O.none)
case CosmosChain:
// not supported yet
// TODO (@veado) Implement Cosmos
return Rx.of(O.none)
case BCHChain:
return BCH.address$
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/services/chain/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BNBChain,
BTCChain,
Chain,
CosmosChain,
DOGEChain,
ETHChain,
LTCChain,
Expand Down Expand Up @@ -43,6 +44,9 @@ export const clientByChain$ = (chain: Chain): XChainClient$ => {
return DOGE.client$
case TerraChain:
return TERRA.client$
case CosmosChain:
// TODO (@veado) Implement Cosmos
return Rx.of(O.none)
default:
return Rx.of(O.none)
}
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/services/chain/transaction/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const sendTx$ = ({
return THOR.sendTx({ walletType, amount, asset, memo, recipient, walletIndex })

case CosmosChain:
// not available yet
// TODO (@veado) Implement Cosmos
return txFailure$(`sendTx$ has not been implemented for Cosmos yet`)

case PolkadotChain:
Expand Down Expand Up @@ -182,6 +182,7 @@ export const txStatusByChain$ = ({ txHash, chain }: { txHash: TxHash; chain: Cha
case THORChain:
return THOR.txStatus$(txHash, O.none)
case CosmosChain:
// TODO (@veado) Implement Cosmos
return txStatusFailure$(`txStatusByChain$ has not been implemented for Cosmos`)
case PolkadotChain:
return txStatusFailure$(`txStatusByChain$ has not been implemented for Polkadot`)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const AVAILABLE_NETWORKS: Network[] = ['testnet', 'stagenet', 'mainnet']

export const ENABLED_CHAINS: Chain[] = envOrDefault(
process.env.REACT_APP_CHAINS_ENABLED,
'THOR,BNB,BTC,LTC,BCH,ETH,DOGE,TERRA'
'THOR,BNB,BTC,LTC,BCH,ETH,DOGE,TERRA,GAIA'
)
.replace(/\s/g, '')
.split(',')
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/services/wallet/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const createBalancesService = ({
LTC.reloadBalances()
DOGE.reloadBalances()
TERRA.reloadBalances()
// TODO (@veado) Implement Cosmos
// GAIA.reloadBalances()
}

// Returns lazy functions to reload balances by given chain
Expand All @@ -95,6 +97,7 @@ export const createBalancesService = ({
case TerraChain:
return TERRA.reloadBalances
case CosmosChain:
// TODO (@veado) Implement Cosmos
return FP.constVoid
case PolkadotChain:
return FP.constVoid
Expand Down Expand Up @@ -175,6 +178,8 @@ export const createBalancesService = ({
balances$: TERRA.balances$(walletType, walletIndex),
reloadBalances$: TERRA.reloadBalances$
}
// TODO (@veado) Implement Cosmos
// case CosmosChain:
default:
return {
reloadBalances: FP.constVoid,
Expand Down Expand Up @@ -580,6 +585,8 @@ export const createBalancesService = ({
LTC: [ltcBalance$, ltcLedgerChainBalance$],
DOGE: [dogeChainBalance$, dogeLedgerChainBalance$],
TERRA: [terraChainBalance$, terraLedgerChainBalance$]
// TODO (@veado) Implement Cosmos
// GAIA: [cosmosChainBalance$, cosmosLedgerChainBalance$]
})
),
// we ignore all `ChainBalances` with state of `initial` balances
Expand Down

0 comments on commit 1eea9fb

Please sign in to comment.