Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update xDAI with Gnosis chain #53

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __mocks__/react-web3-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const getWeb3Settings = () => ({
telos: 'https://telos.eosphere.io',
libre: 'https://libre-node-2.ptokens.io:8889',
bsc: 'https://bsc-dataseed1.binance.org/',
xdai: 'https://rpc.xdaichain.com/',
gnosis: 'https://rpc.gnosischain.com',
polygon: 'https://polygon-rpc.com/',
ultra: 'https://corsproxy.ptokens.io/v1/?apiurl=http://ultra-mainnet-1.ptokens.io:8888',
arbitrum: 'https://arb1.arbitrum.io/rpc',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "plain-dapp-update",
"private": true,
"version": "1.14.1",
"version": "1.14.2",
"type": "module",
"scripts": {
"dev": "npm run create-version-file && vite",
Expand Down
14 changes: 14 additions & 0 deletions public/assets/svg/GNOSIS.svg
oliviera9 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 0 additions & 22 deletions public/assets/svg/XDAI.svg

This file was deleted.

12 changes: 6 additions & 6 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export const WALLET_POLYGON_CONNECTED = 'WALLET_POLYGON_CONNECTED'
export const WALLET_POLYGON_DISCONNECTED = 'WALLET_POLYGON_DISCONNECTED'
export const WALLET_POLYGON_NETWORK_CHANGED = 'WALLET_POLYGON_NETWORK_CHANGED'
export const WALLET_POLYGON_ACCOUNT_CHANGED = 'WALLET_POLYGON_ACCOUNT_CHANGED'
export const WALLET_XDAI_CONNECTED = 'WALLET_XDAI_CONNECTED'
export const WALLET_XDAI_DISCONNECTED = 'WALLET_XDAI_DISCONNECTED'
export const WALLET_XDAI_NETWORK_CHANGED = 'WALLET_XDAI_NETWORK_CHANGED'
export const WALLET_XDAI_ACCOUNT_CHANGED = 'WALLET_XDAI_ACCOUNT_CHANGED'
export const WALLET_GNOSIS_CONNECTED = 'WALLET_GNOSIS_CONNECTED'
export const WALLET_GNOSIS_DISCONNECTED = 'WALLET_GNOSIS_DISCONNECTED'
export const WALLET_GNOSIS_NETWORK_CHANGED = 'WALLET_GNOSIS_NETWORK_CHANGED'
export const WALLET_GNOSIS_ACCOUNT_CHANGED = 'WALLET_GNOSIS_ACCOUNT_CHANGED'
export const WALLET_EOS_CONNECTED = 'WALLET_EOS_CONNECTED'
export const WALLET_EOS_DISCONNECTED = 'WALLET_EOS_DISCONNECTED'
export const WALLET_TELOS_CONNECTED = 'WALLET_TELOS_CONNECTED'
Expand Down Expand Up @@ -108,7 +108,7 @@ export const PZRX_ON_EOS_MAINNET = 'PZRX_ON_EOS_MAINNET'
export const PPNK_ON_EOS_MAINNET = 'PPNK_ON_EOS_MAINNET'
export const PDOGE_ON_ETH_MAINNET = 'PDOGE_ON_ETH_MAINNET'
export const PBTC_ON_BSC_MAINNET = 'PBTC_ON_BSC_MAINNET'
export const PBTC_ON_XDAI_MAINNET = 'PBTC_ON_XDAI_MAINNET'
export const PBTC_ON_GNOSIS_MAINNET = 'PBTC_ON_GNOSIS_MAINNET'
export const PEOS_ON_POLYGON_MAINNET = 'PEOS_ON_POLYGON_MAINNET'
export const IQ_ON_ETH_MAINNET = 'IQ_ON_ETH_MAINNET'
export const TLOS_ON_ETH_MAINNET = 'TLOS_ON_ETH_MAINNET'
Expand All @@ -125,7 +125,7 @@ export const PNT_ON_TELOS_MAINNET = 'PNT_ON_TELOS_MAINNET'
export const PUSDT_ON_TELOS_MAINNET = 'PUSDT_ON_TELOS_MAINNET'
export const PUSDT_ON_LIBRE_MAINNET = 'PUSDT_ON_LIBRE_MAINNET'
export const PUSDC_ON_TELOS_MAINNET = 'PUSDC_ON_TELOS_MAINNET'
export const PNT_ON_XDAI_MAINNET = 'PNT_ON_XDAI_MAINNET'
export const PNT_ON_GNOSIS_MAINNET = 'PNT_ON_GNOSIS_MAINNET'
export const PRVN_ON_BSC_MAINNET = 'PRVN_ON_BSC_MAINNET'
export const TLOS_ON_BSC_MAINNET = 'TLOS_ON_BSC_MAINNET'
export const POPEN_ON_BSC_MAINNET = 'POPEN_ON_BSC_MAINNET'
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/use-assets.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useMemo, useState } from 'react'
import _ from 'lodash'
import { stringUtils } from 'ptokens-helpers'
import { useMemo, useState } from 'react'

import { offChainFormat, strip } from '../utils/amount-utils'
import { blockchainSymbolToName, blockchainSymbolToCoin } from '../utils/maps'
import { getCorrespondingTokenExplorerLinkByBlockchain } from '../utils/explorer'
import { stringUtils } from 'ptokens-helpers'
import { blockchainSymbolToName, blockchainSymbolToCoin } from '../utils/maps'

const useAssets = (_assets) => {
return useMemo(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/use-wallets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMemo } from 'react'
import { blockchainSymbolToName } from '../utils/maps'

import { slicerByBlockchain } from '../utils/account-viewer'
import { blockchainSymbolToName } from '../utils/maps'

const useWallets = (_wallets) => {
return useMemo(() => {
Expand Down
14 changes: 7 additions & 7 deletions src/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
WALLET_EOS_CONNECTED,
WALLET_BSC_CONNECTED,
WALLET_BSC_ACCOUNT_CHANGED,
WALLET_XDAI_ACCOUNT_CHANGED,
WALLET_XDAI_CONNECTED,
WALLET_GNOSIS_ACCOUNT_CHANGED,
WALLET_GNOSIS_CONNECTED,
WALLET_POLYGON_ACCOUNT_CHANGED,
WALLET_POLYGON_CONNECTED,
WALLET_TELOS_CONNECTED,
Expand All @@ -22,13 +22,13 @@ import {
WALLET_FTM_CONNECTED,
WALLET_FTM_ACCOUNT_CHANGED,
} from '../constants'
import { loadBalances } from '../store/swap/swap.actions'
import settings from '../settings'
import * as migrationActions from '../store/migration/migration.actions'
import { loadOldPntBalance } from '../store/swap-old-pnt/swap-old-pnt.actions'
import { loadNftsData } from '../store/nfts/nfts.actions'
import { setLoading } from '../store/pages/pages.actions'
import { getIsLoading } from '../store/pages/pages.selectors'
import settings from '../settings'
import { loadBalances } from '../store/swap/swap.actions'
import { loadOldPntBalance } from '../store/swap-old-pnt/swap-old-pnt.actions'

let countNftsLoading = 0
const middleware = ({ dispatch }) => {
Expand All @@ -49,8 +49,8 @@ const middleware = ({ dispatch }) => {
dispatch(loadOldPntBalance(payload.account))
}

if (type === WALLET_XDAI_CONNECTED || type === WALLET_XDAI_ACCOUNT_CHANGED) {
dispatch(loadBalances(payload.account, 'XDAI'))
if (type === WALLET_GNOSIS_CONNECTED || type === WALLET_GNOSIS_ACCOUNT_CHANGED) {
dispatch(loadBalances(payload.account, 'GNOSIS'))
}

if (type === WALLET_POLYGON_CONNECTED || type === WALLET_POLYGON_ACCOUNT_CHANGED) {
Expand Down
12 changes: 6 additions & 6 deletions src/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const settings = {
symbol: 'LIBRE',
},
{
name: 'xDai',
symbol: 'XDAI',
name: 'Gnosis Chain',
symbol: 'GNOSIS',
},
{
name: 'Ultra',
Expand Down Expand Up @@ -102,10 +102,10 @@ const settings = {
chainId: 56,
label: 'BSC',
},
xdai: {
endpoint: 'https://rpc.xdaichain.com/',
gnosis: {
endpoint: 'https://rpc.gnosischain.com',
chainId: 100,
label: 'xDAI',
label: 'Gnosis',
},
polygon: {
endpoint: 'https://polygon-rpc.com/',
Expand Down Expand Up @@ -164,7 +164,7 @@ const settings = {
libre: 'https://lb.libre.org/v2/explore/',
ltc: 'https://live.blockcypher.com/ltc/',
bsc: 'https://bscscan.com/',
xdai: 'https://gnosisscan.io/',
gnosis: 'https://gnosisscan.io/',
polygon: 'https://polygonscan.com/',
doge: 'https://dogechain.info/',
rvn: 'https://ravencoin.network/',
Expand Down
10 changes: 5 additions & 5 deletions src/settings/swap-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,13 @@ const swapAssets = [
},
{
address: '0x3effbc016fc50beacd4fa1c7be20cddca38e7f66',
id: 'PBTC_ON_XDAI_MAINNET',
id: 'PBTC_ON_GNOSIS_MAINNET',
name: 'pBTC',
workingName: 'pbtc',
nativeDecimals: 8,
network: 'mainnet',
isHidden: false,
blockchain: 'XDAI',
blockchain: 'GNOSIS',
decimals: 18,
withMiniImage: true,
symbol: 'PBTC',
Expand All @@ -669,7 +669,7 @@ const swapAssets = [
nativeBlockchain: 'BTC',
image: 'pBTC.svg',
withBalanceDecimalsConversion: true,
chainId: ChainId.XDaiMainnet,
chainId: ChainId.XdaiMainnet,
},
{
address: '0xa23d33d5e0a61ba81919bfd727c671bb03ab0fea',
Expand Down Expand Up @@ -968,13 +968,13 @@ const swapAssets = [
},
{
address: '0x0259461eed4d76d4f0f900f9035f6c4dfb39159a',
id: 'PNT_ON_XDAI_MAINNET',
id: 'PNT_ON_GNOSIS_MAINNET',
name: 'PNT',
workingName: 'pnt',
nativeDecimals: 18,
network: 'mainnet',
isHidden: false,
blockchain: 'XDAI',
blockchain: 'GNOSIS',
decimals: 18,
withMiniImage: true,
symbol: 'PNT',
Expand Down
40 changes: 21 additions & 19 deletions src/store/swap/swap.actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import axios from 'axios'
import assets from '../../settings/swap-assets'
import settings from '../../settings'
import BigNumber from 'bignumber.js'
import { getAmountInEosFormat } from 'ptokens-assets-eosio'
import Web3 from 'web3'

import {
ASSETS_LOADED,
SHOW_DEPOSIT_ADDRESS_MODAL,
Expand All @@ -11,29 +13,29 @@ import {
BPM_LOADED,
SWAPPERS_BALANCES_LOADED,
} from '../../constants/index'
import settings from '../../settings'
import assets from '../../settings/swap-assets'
import eosioTokenAbi from '../../utils/abi/eosio.token'
import { parseError } from '../../utils/errors'
import { createAsset, getSwapBuilder } from '../../utils/ptokens'
import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers'
import { updateInfoModal } from '../pages/pages.actions'
import { getWallets, getWalletByBlockchain } from '../wallets/wallets.selectors'

import { getAssetsByBlockchain, getAssetById } from './swap.selectors'
import { getAsaBalance, encodeUserData, buildPoolSwapTransactions } from './utils/algorand'
import {
loadEvmCompatibleBalances,
loadEosioCompatibleBalances,
loadEvmCompatibleBalance,
loadEosioCompatibleBalance,
loadAlgorandBalances,
} from './utils/balances'
import { parseError } from '../../utils/errors'
import { updateInfoModal } from '../pages/pages.actions'
import { getReadOnlyProviderByBlockchain } from '../../utils/read-only-providers'
import { getDefaultSelection } from './utils/default-selection'
import peginWithDepositAddress from './utils/pegin-with-deposit-address'
import peginWithWallet from './utils/pegin-with-wallet'
import pegout from './utils/pegout'
import pegoutFromCurve from './utils/pegout-curve'
import { getAssetsByBlockchain, getAssetById } from './swap.selectors'
import { getWallets, getWalletByBlockchain } from '../wallets/wallets.selectors'
import { getDefaultSelection } from './utils/default-selection'
import { getAsaBalance, encodeUserData, buildPoolSwapTransactions } from './utils/algorand'
import { getAmountInEosFormat } from 'ptokens-assets-eosio'
import Web3 from 'web3'
import BigNumber from 'bignumber.js'
import eosioTokenAbi from '../../utils/abi/eosio.token'
import { createAsset, getSwapBuilder } from '../../utils/ptokens'

const loadSwapData = (_opts = {}) => {
const {
Expand Down Expand Up @@ -194,12 +196,12 @@ const loadBalances = (_account, _blockchain) => {
})
break
}
case 'XDAI': {
case 'GNOSIS': {
loadEvmCompatibleBalances({
assets: getAssetsByBlockchain('XDAI'),
assets: getAssetsByBlockchain('GNOSIS'),
account: _account,
dispatch: _dispatch,
blockchain: 'XDAI',
blockchain: 'GNOSIS',
})
break
}
Expand Down Expand Up @@ -288,8 +290,8 @@ const loadBalanceByAssetId = (_id) => {
loadEvmCompatibleBalance({ asset, account, blockchain: 'POLYGON', dispatch: _dispatch })
break
}
case 'XDAI': {
loadEvmCompatibleBalance({ asset, account, blockchain: 'XDAI', dispatch: _dispatch })
case 'GNOSIS': {
loadEvmCompatibleBalance({ asset, account, blockchain: 'GNOSIS', dispatch: _dispatch })
break
}
case 'TELOS': {
Expand Down
Loading
Loading