Skip to content

Commit

Permalink
Merge pull request #63 from pnetwork-association/fix/custom-endpoints
Browse files Browse the repository at this point in the history
Fix/custom endpoints
  • Loading branch information
envin3 authored Jan 8, 2024
2 parents 8a77787 + 44ca549 commit 998449c
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 174 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dist.zip
.eslintcache
.vscode/
coverage/
.hostingConfig.json

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.17.0",
"version": "1.18.0",
"type": "module",
"scripts": {
"dev": "npm run create-version-file && vite",
Expand Down
3 changes: 0 additions & 3 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const WALLET_ALGORAND_ACCOUNT_CHANGED = 'WALLET_ALGORAND_ACCOUNT_CHANGED'
export const WALLET_FTM_CONNECTED = 'WALLET_FTM_CONNECTED'
export const WALLET_FTM_DISCONNECTED = 'WALLET_FTM_DISCONNECTED'
export const WALLET_FTM_ACCOUNT_CHANGED = 'WALLET_FTM_ACCOUNT_CHANGED'
export const WALLET_ORE_CONNECTED = 'WALLET_ORE_CONNECTED'
export const WALLET_ORE_DISCONNECTED = 'WALLET_ORE_DISCONNECTED'

// swap-old-pnt
export const ASSETS_LOADED_SWAP_OLD_PNT = 'ASSETS_LOADED_SWAP_OLD_PNT'
Expand Down Expand Up @@ -157,7 +155,6 @@ export const PUSDC_ON_ALGORAND_MAINNET = 'PUSDC_ON_ALGORAND_MAINNET'
export const USDC_ON_ALGORAND_MAINNET = 'USDC_ON_ALGORAND_MAINNET'
export const PUSDT_ON_ALGORAND_MAINNET = 'PUSDT_ON_ALGORAND_MAINNET'
export const USDT_ON_ALGORAND_MAINNET = 'USDT_ON_ALGORAND_MAINNET'
export const ORE_ON_ETH_MAINNET = 'ORE_ON_ETH_MAINNET'
export const PWOMBAT_ON_EOS_MAINNET = 'PWOMBAT_ON_EOS_MAINNET'
export const PFTM_ON_ETH_MAINNET = 'PFTM_ON_ETH_MAINNET'
export const NUCO_ON_TELOS_MAINNET = 'NUCO_ON_TELOS_MAINNET'
Expand Down
12 changes: 0 additions & 12 deletions src/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ const settings = {
name: 'Fantom',
symbol: 'FTM',
},
{
name: 'Ore',
symbol: 'ORE',
},
],
rpc: {
mainnet: {
Expand Down Expand Up @@ -141,14 +137,6 @@ const settings = {
chainId: 250,
label: 'Fantom',
},
ore: {
chainId: '7900eaca71d5b213d3e1e15d54d98ad235a7a5b8166361be78e672edeeb2b47a',
host: 'https://ore-node-1.ptokens.io',
port: 443,
protocol: 'https',
endpoint: 'https://ore-node-1.ptokens.io',
label: 'ORE',
},
btc: {
endpoint: 'https://blockstream.info/api/',
label: 'Bitcoin',
Expand Down
13 changes: 0 additions & 13 deletions src/store/swap/swap.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,6 @@ const loadBalances = (_account, _blockchain) => {
})
break
}
case 'ORE': {
loadEosioCompatibleBalances({
assets: getAssetsByBlockchain('ORE'),
account: _account,
dispatch: _dispatch,
blockchain: 'ORE',
})
break
}
case 'BSC': {
loadEvmCompatibleBalances({
assets: getAssetsByBlockchain('BSC'),
Expand Down Expand Up @@ -278,10 +269,6 @@ const loadBalanceByAssetId = (_id) => {
loadEosioCompatibleBalance({ asset, account, dispatch: _dispatch })
break
}
case 'ORE': {
loadEosioCompatibleBalance({ asset, account, dispatch: _dispatch })
break
}
case 'BSC': {
loadEvmCompatibleBalance({ asset, account, blockchain: 'BSC', dispatch: _dispatch })
break
Expand Down
16 changes: 11 additions & 5 deletions src/store/wallets/arbitrum/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { getWeb3Settings } from 'react-web3-settings'
import WalletLink from 'walletlink'
import Web3 from 'web3'
import Web3Modal from 'web3modal'
import WalletLink from 'walletlink'
import settings from '../../../settings'

import {
WALLET_ARBITRUM_CONNECTED,
WALLET_ARBITRUM_DISCONNECTED,
WALLET_ARBITRUM_NETWORK_CHANGED,
WALLET_ARBITRUM_ACCOUNT_CHANGED,
} from '../../../constants'
import settings from '../../../settings'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { getTheme } from '../../pages/pages.selectors'
import { getWalletProviderByBlockchain } from '../wallets.selectors'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { createWalletConnect2 } from '../wallets.utils'

let web3Modal

const connectWithArbitrumWallet = async (_dispatch) => {
const configs = getWeb3Settings()

try {
if (document.getElementById('WEB3_CONNECT_MODAL_ID')) {
document.getElementById('WEB3_CONNECT_MODAL_ID').remove()
Expand All @@ -30,7 +34,7 @@ const connectWithArbitrumWallet = async (_dispatch) => {
package: WalletLink,
options: {
appName: settings.dappName,
rpc: settings.rpc.mainnet.arbitrum.endpoint,
rpc: configs.arbitrum,
chainId: settings.rpc.mainnet.arbitrum.chainId,
darkMode: getTheme() === 'dark',
},
Expand Down Expand Up @@ -78,6 +82,8 @@ const disconnectFromArbitrumWallet = async (_dispatch) => {
}

const _connectionSuccesfull = async (_provider, _dispatch) => {
const configs = getWeb3Settings()

try {
const { accounts, chainId } = _provider
const account = accounts ? accounts[0] : await _getAccount(_provider)
Expand All @@ -99,7 +105,7 @@ const _connectionSuccesfull = async (_provider, _dispatch) => {
symbol: 'AETH',
decimals: 18,
},
nodes: [settings.rpc.mainnet.arbitrum.endpoint],
nodes: [configs.arbitrum],
blockExplorerUrls: [settings.explorers.mainnet.arbitrum],
})
}
Expand Down
14 changes: 10 additions & 4 deletions src/store/wallets/bsc/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { getWeb3Settings } from 'react-web3-settings'
import WalletLink from 'walletlink'
import Web3 from 'web3'
import Web3Modal from 'web3modal'

import { WALLET_BSC_CONNECTED, WALLET_BSC_DISCONNECTED, WALLET_BSC_ACCOUNT_CHANGED } from '../../../constants'
import WalletLink from 'walletlink'
import settings from '../../../settings'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { getTheme } from '../../pages/pages.selectors'
import { getWalletProviderByBlockchain } from '../wallets.selectors'
import { createWalletConnect2 } from '../wallets.utils'

let web3Modal

const connectWithBscWallet = async (_dispatch) => {
const configs = getWeb3Settings()

try {
if (document.getElementById('WEB3_CONNECT_MODAL_ID')) {
document.getElementById('WEB3_CONNECT_MODAL_ID').remove()
Expand All @@ -25,7 +29,7 @@ const connectWithBscWallet = async (_dispatch) => {
package: WalletLink,
options: {
appName: settings.dappName,
rpc: settings.rpc.mainnet.bsc.endpoint,
rpc: configs.bsc,
chainId: settings.rpc.mainnet.bsc.chainId,
darkMode: getTheme() === 'dark',
},
Expand Down Expand Up @@ -70,6 +74,8 @@ const disconnectFromBscWallet = async (_dispatch) => {
}

const _connectionSuccesfull = async (_provider, _dispatch) => {
const configs = getWeb3Settings()

try {
const { accounts, chainId } = _provider
const account = accounts ? accounts[0] : await _getAccount(_provider)
Expand All @@ -91,7 +97,7 @@ const _connectionSuccesfull = async (_provider, _dispatch) => {
symbol: 'bnb',
decimals: 18,
},
nodes: [settings.rpc.mainnet.bsc.endpoint],
nodes: [configs.bsc],
blockExplorerUrls: [settings.explorers.mainnet.bsc],
})
}
Expand Down
10 changes: 7 additions & 3 deletions src/store/wallets/eos/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import settings from '../../../settings'
import { getWeb3Settings } from 'react-web3-settings'

import { WALLET_EOS_CONNECTED, WALLET_EOS_DISCONNECTED } from '../../../constants'
import EosConnect from '../../../lib/eosConnect/'
import settings from '../../../settings'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { getTheme } from '../../pages/pages.selectors'

const connectWithEosWallet = (_dispatch) => {
const configs = getWeb3Settings()

if (document.getElementById('EOS_CONNECT')) {
document.getElementById('EOS_CONNECT').remove()
}
Expand All @@ -14,10 +18,10 @@ const connectWithEosWallet = (_dispatch) => {
theme: getWeb3ModalTheme(getTheme()),
providerOptions: {
tokenPocket: {
settings: settings.rpc.mainnet.eos,
settings: { ...settings.rpc.mainnet.eos, endpoint: configs.eos },
},
anchor: {
settings: settings.rpc.mainnet.eos,
settings: { ...settings.rpc.mainnet.eos, endpoint: configs.eos },
},
},
})
Expand Down
12 changes: 8 additions & 4 deletions src/store/wallets/eth/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { getWeb3Settings } from 'react-web3-settings'
import WalletLink from 'walletlink'
import Web3 from 'web3'
import Web3Modal from 'web3modal'
import WalletLink from 'walletlink'
import settings from '../../../settings'
import { changeNetwork } from '../../../utils/wallet'

import {
WALLET_ETH_CONNECTED,
WALLET_ETH_DISCONNECTED,
WALLET_ETH_NETWORK_CHANGED,
WALLET_ETH_ACCOUNT_CHANGED,
} from '../../../constants'
import settings from '../../../settings'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { changeNetwork } from '../../../utils/wallet'
import { getTheme } from '../../pages/pages.selectors'
import { getWalletProviderByBlockchain } from '../wallets.selectors'
import { createWalletConnect2 } from '../wallets.utils'

let web3Modal

const connectWithEthWallet = async (_dispatch) => {
const configs = getWeb3Settings()

try {
if (document.getElementById('WEB3_CONNECT_MODAL_ID')) {
document.getElementById('WEB3_CONNECT_MODAL_ID').remove()
Expand All @@ -31,7 +35,7 @@ const connectWithEthWallet = async (_dispatch) => {
package: WalletLink,
options: {
appName: settings.dappName,
rpc: settings.rpc.mainnet.eth.endpoint,
rpc: configs.eth,
chainId: settings.rpc.mainnet.eth.chainId,
darkMode: getTheme() === 'dark',
},
Expand Down
14 changes: 10 additions & 4 deletions src/store/wallets/ftm/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { getWeb3Settings } from 'react-web3-settings'
import WalletLink from 'walletlink'
import Web3 from 'web3'
import Web3Modal from 'web3modal'

import { WALLET_FTM_CONNECTED, WALLET_FTM_DISCONNECTED, WALLET_FTM_ACCOUNT_CHANGED } from '../../../constants'
import WalletLink from 'walletlink'
import settings from '../../../settings'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { changeNetwork, setupNetwork } from '../../../utils/wallet'
import { getTheme } from '../../pages/pages.selectors'
import { getWalletProviderByBlockchain } from '../wallets.selectors'
import { createWalletConnect2 } from '../wallets.utils'

let web3Modal

const connectWithFtmWallet = async (_dispatch) => {
const configs = getWeb3Settings()

try {
if (document.getElementById('WEB3_CONNECT_MODAL_ID')) {
document.getElementById('WEB3_CONNECT_MODAL_ID').remove()
Expand All @@ -25,7 +29,7 @@ const connectWithFtmWallet = async (_dispatch) => {
package: WalletLink,
options: {
appName: settings.dappName,
rpc: settings.rpc.mainnet.ftm.endpoint,
rpc: configs.ftm,
chainId: settings.rpc.mainnet.ftm.chainId,
darkMode: getTheme() === 'dark',
},
Expand Down Expand Up @@ -70,6 +74,8 @@ const disconnectFromFtmWallet = async (_dispatch) => {
}

const _connectionSuccesfull = async (_provider, _dispatch) => {
const configs = getWeb3Settings()

try {
const { accounts, chainId } = _provider
const account = accounts ? accounts[0] : await _getAccount(_provider)
Expand All @@ -91,7 +97,7 @@ const _connectionSuccesfull = async (_provider, _dispatch) => {
symbol: 'ftm',
decimals: 18,
},
nodes: [settings.rpc.mainnet.ftm.endpoint],
nodes: [configs.ftm],
blockExplorerUrls: [settings.explorers.mainnet.ftm],
})
}
Expand Down
9 changes: 7 additions & 2 deletions src/store/wallets/gnosis/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getWeb3Settings } from 'react-web3-settings'
import WalletLink from 'walletlink'
import Web3 from 'web3'
import Web3Modal from 'web3modal'
Expand All @@ -13,6 +14,8 @@ import { createWalletConnect2 } from '../wallets.utils'
let web3Modal

const connectWithGnosisWallet = async (_dispatch) => {
const configs = getWeb3Settings()

try {
if (document.getElementById('WEB3_CONNECT_MODAL_ID')) {
document.getElementById('WEB3_CONNECT_MODAL_ID').remove()
Expand All @@ -26,7 +29,7 @@ const connectWithGnosisWallet = async (_dispatch) => {
package: WalletLink,
options: {
appName: settings.dappName,
rpc: settings.rpc.mainnet.gnosis.endpoint,
rpc: configs.gnosis,
chainId: settings.rpc.mainnet.gnosis.chainId,
darkMode: getTheme() === 'dark',
},
Expand Down Expand Up @@ -64,6 +67,8 @@ const disconnectFromGnosisWallet = async (_dispatch) => {
}

const _connectionSuccesfull = async (_provider, _dispatch) => {
const configs = getWeb3Settings()

try {
const { accounts, chainId } = _provider
const account = accounts ? accounts[0] : await _getAccount(_provider)
Expand All @@ -85,7 +90,7 @@ const _connectionSuccesfull = async (_provider, _dispatch) => {
symbol: 'xDAI',
decimals: 18,
},
nodes: [settings.rpc.mainnet.gnosis.endpoint],
nodes: [configs.gnosis],
blockExplorerUrls: [settings.explorers.mainnet.gnosis],
})
}
Expand Down
10 changes: 7 additions & 3 deletions src/store/wallets/libre/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import settings from '../../../settings'
import { toastr } from 'react-redux-toastr'
import { getWeb3Settings } from 'react-web3-settings'

import { WALLET_LIBRE_CONNECTED, WALLET_LIBRE_DISCONNECTED } from '../../../constants'
import EosConnect from '../../../lib/eosConnect/'
import settings from '../../../settings'
import { getWeb3ModalTheme } from '../../../theme/web3-modal'
import { getTheme } from '../../pages/pages.selectors'

const connectWithLibreWallet = (_dispatch) => {
const configs = getWeb3Settings()

if (document.getElementById('EOS_CONNECT')) {
document.getElementById('EOS_CONNECT').remove()
}
Expand All @@ -15,10 +19,10 @@ const connectWithLibreWallet = (_dispatch) => {
theme: getWeb3ModalTheme(getTheme()),
providerOptions: {
libre: {
settings: settings.rpc.mainnet.libre,
settings: { ...settings.rpc.mainnet.libre, endpoint: configs.libre },
},
anchor: {
settings: settings.rpc.mainnet.libre,
settings: { ...settings.rpc.mainnet.libre, endpoint: configs.libre },
},
},
})
Expand Down
Loading

1 comment on commit 998449c

@4everland
Copy link

@4everland 4everland bot commented on 998449c Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following parameters

parameters Value
IPFS CID bafybeiekpu4jrczd4mbarhgomoaen2v34zrwafnoe55cfyar33onqk4hza
Assigned domain https://ptokens-dapp-4ophzy71-pnetwork-association.4everland.app
https://ptokens-dapp.4everland.app
Custom domain

Please sign in to comment.