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

Multiple RPC endpoint support #2394

Merged
merged 33 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4654b18
Switch out JSON provider for default provider to auto switch to a bet…
sophialittlejohn Aug 19, 2024
d9f728a
Remove references to goerli
sophialittlejohn Aug 19, 2024
af8ff3c
Clean up
sophialittlejohn Aug 20, 2024
891e249
Use JsonRpcProvider as fallback if defaultprovider doesn't support ne…
sophialittlejohn Aug 20, 2024
eab7786
Fix console warnings
sophialittlejohn Aug 20, 2024
1493e33
Fix start script in main package
sophialittlejohn Aug 20, 2024
6b9dc81
Clean up
sophialittlejohn Aug 20, 2024
dd9ae1f
Upgrade ethersjs
sophialittlejohn Aug 26, 2024
ae84511
Do manual health check on rpcs instead of relying on getDefaultBrowse…
sophialittlejohn Aug 27, 2024
a214de9
Fix ts error
sophialittlejohn Aug 27, 2024
091a710
Fix more type errros from upgrade
sophialittlejohn Aug 28, 2024
a7ef87a
Add connection checks to centrifuge base before connecting to parachain
sophialittlejohn Aug 29, 2024
1551fc6
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Aug 30, 2024
f973f50
Clean up substrate network detection
sophialittlejohn Sep 4, 2024
470a409
Fix event parsing
sophialittlejohn Sep 5, 2024
6ff7e7c
Add tenderly node rpc key
sophialittlejohn Sep 5, 2024
bb8c0cf
Enable getDefaultProvider for evm instead of manual implementation
sophialittlejohn Sep 5, 2024
2566ad7
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Sep 5, 2024
6cf73e0
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Sep 9, 2024
c3cf7c8
Replace BigInt with bigint
sophialittlejohn Sep 11, 2024
a5a0c56
Update imports
sophialittlejohn Sep 11, 2024
b050d4f
Clean up for centrifuge base
sophialittlejohn Sep 11, 2024
e8a6074
Clean up
sophialittlejohn Sep 12, 2024
e8a66c1
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Sep 16, 2024
42ebed4
Remove outdated eth-permit in favor of custom code
sophialittlejohn Sep 16, 2024
3126dc5
Fix typescript errors in tinlake
sophialittlejohn Sep 16, 2024
be6b4cf
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Sep 16, 2024
5ca0a25
Use set for parachain url cache
sophialittlejohn Sep 16, 2024
ea806c3
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Oct 7, 2024
713e77c
Match with rpc endpoints
sophialittlejohn Oct 7, 2024
85efdea
Fix typo
sophialittlejohn Oct 7, 2024
7226612
Merge branch 'main' of github.com:centrifuge/apps into default-provider
sophialittlejohn Oct 16, 2024
b24b6b3
Fix import from ethers
sophialittlejohn Oct 16, 2024
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: 2 additions & 0 deletions centrifuge-app/.env-config/.env.altair
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=kAJkmGxAd6iqX9JjWTdhXgCf2PL1TAphTRYrmEqzBrYhwbXAn
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_ONFINALITY_KEY=18704429-288d-4f55-bda8-8b60f4c53b96
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
4 changes: 3 additions & 1 deletion centrifuge-app/.env-config/.env.catalyst
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=4bo2vNkwZtr2PuqppWwqya6dPC8MzxqZ4kgnAoTZyK
REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=kAJkmGxAd6iqX9JjWTdhXgCf2PL1TAphTRYrmEqzBrYhwbXAn
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_ONFINALITY_KEY=18704429-288d-4f55-bda8-8b60f4c53b96
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
4 changes: 3 additions & 1 deletion centrifuge-app/.env-config/.env.demo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode-apps.demo.k-f.dev
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.demo.k-f.dev,wss://fullnode-apps.demo.k-f.dev
REACT_APP_DEFAULT_UNLIST_POOLS=true
REACT_APP_FAUCET_URL=https://europe-central2-peak-vista-185616.cloudfunctions.net/faucet-api-demo
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand All @@ -20,3 +20,5 @@ REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=kAJkmGxAd6iqX9JjWTdhXgCf2PL1TAphTRYrmEqzBrYhwbXAn
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_ONFINALITY_KEY=0e1c049f-d876-4e77-a45f-b5afdf5739b2
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
2 changes: 2 additions & 0 deletions centrifuge-app/.env-config/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=kAJkmGxAd6iqX9JjWTdhXgCf2PL1TAphTRYrmEqzBrYhwbXAn
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_ONFINALITY_KEY=0e1c049f-d876-4e77-a45f-b5afdf5739b2
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
2 changes: 2 additions & 0 deletions centrifuge-app/.env-config/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=kAJkmGxAd6iqX9JjWTdhXgCf2PL1TAphTRYrmEqzBrYhwbXAn
REACT_APP_PRIME_IPFS_HASH=QmQfcuHM3EGrtpjhitDwJsgie5THLPtRNzvk7N3uymgHGc
REACT_APP_ONFINALITY_KEY=0e1c049f-d876-4e77-a45f-b5afdf5739b2
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
6 changes: 4 additions & 2 deletions centrifuge-app/.env-config/.env.ff-prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.parachain.centrifuge.io
REACT_APP_COLLATOR_WSS_URL=wss://fullnode.parachain.centrifuge.io,wss://centrifuge-parachain.api.onfinality.io/public-ws
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand All @@ -19,4 +19,6 @@ REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpS
REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=4dpEcgqJRyJK3J8Es6v8ZfVntV7c64Ysgcjd4hYwyGoFPWbg
REACT_APP_PRIME_IPFS_HASH=QmS5gX2sk1ZCEyWnMjjmQyYkLTz27VVNGzVtCKWneABbj5
REACT_APP_PRIME_IPFS_HASH=QmS5gX2sk1ZCEyWnMjjmQyYkLTz27VVNGzVtCKWneABbj5
REACT_APP_ONFINALITY_KEY=18704429-288d-4f55-bda8-8b60f4c53b96
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
6 changes: 4 additions & 2 deletions centrifuge-app/.env-config/.env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REACT_APP_COLLATOR_WSS_URL=wss://apps.fullnode.centrifuge.io
REACT_APP_COLLATOR_WSS_URL=wss://apps.fullnode.centrifuge.io,wss://centrifuge-parachain.api.onfinality.io/public-ws
REACT_APP_DEFAULT_UNLIST_POOLS=false
REACT_APP_FAUCET_URL=
REACT_APP_IPFS_GATEWAY=https://centrifuge.mypinata.cloud/
Expand All @@ -19,4 +19,6 @@ REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpS
REACT_APP_WALLETCONNECT_ID=c32fa79350803519804a67fcab0b742a
REACT_APP_TINLAKE_SUBGRAPH_URL=https://api.goldsky.com/api/public/project_clhi43ef5g4rw49zwftsvd2ks/subgraphs/main/prod/gn
REACT_APP_TREASURY=4dpEcgqJRyJK3J8Es6v8ZfVntV7c64Ysgcjd4hYwyGoFPWbg
REACT_APP_PRIME_IPFS_HASH=QmS5gX2sk1ZCEyWnMjjmQyYkLTz27VVNGzVtCKWneABbj5
REACT_APP_PRIME_IPFS_HASH=QmS5gX2sk1ZCEyWnMjjmQyYkLTz27VVNGzVtCKWneABbj5
REACT_APP_ONFINALITY_KEY=84bb59f4-05cc-440b-8fd4-7917623a90c6
REACT_APP_TENDERLY_KEY=18aMTJlpNb1lElcYNkkunC
1 change: 1 addition & 0 deletions centrifuge-app/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ interface ImportMetaEnv {
REACT_APP_ALCHEMY_KEY: string
REACT_APP_WALLETCONNECT_ID: string
REACT_APP_PRIME_IPFS_HASH: string
REACT_APP_ONFINALITY_KEY: string
}
3 changes: 0 additions & 3 deletions centrifuge-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
"@centrifuge/centrifuge-js": "workspace:*",
"@centrifuge/centrifuge-react": "workspace:*",
"@centrifuge/fabric": "workspace:*",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/contracts": "^5.6.0",
"@ethersproject/providers": "^5.6.0",
"@makerdao/multicall": "^0.12.0",
"@polkadot/react-identicon": "~3.1.4",
"@styled-system/css": "^5.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
useWallet,
} from '@centrifuge/centrifuge-react'
import { Dialog, Grid, Select, Stack, Text, TextInput } from '@centrifuge/fabric'
import { isAddress as isEvmAddress } from '@ethersproject/address'
import { isAddress as isSubstrateAddress } from '@polkadot/util-crypto'
import { isAddress as isEvmAddress } from 'ethers'
import * as React from 'react'
import { useQuery } from 'react-query'
import { firstValueFrom } from 'rxjs'
Expand Down
3 changes: 1 addition & 2 deletions centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import * as React from 'react'
import { useNavigate } from 'react-router-dom'
import { useTheme } from 'styled-components'
import { ethConfig } from '../../config'
import { formatBalance } from '../../utils/formatting'
import { useAddress } from '../../utils/useAddress'
import { useGmp } from '../../utils/useGmp'
Expand Down Expand Up @@ -52,7 +51,7 @@ export function InvestRedeem({ poolId, trancheId, ...rest }: InvestRedeemProps)
const domainsWithAtLeastOneLP =
domains && domains.filter((domain) => Object.values(domain.liquidityPools[trancheId] ?? {}).some((p) => !!p))

const networks: Network[] = poolId.startsWith('0x') ? [ethConfig.network === 'goerli' ? 5 : 1] : ['centrifuge']
const networks: Network[] = poolId.startsWith('0x') ? [1] : ['centrifuge']
if (domainsWithAtLeastOneLP) {
networks.push(...domainsWithAtLeastOneLP.map((d) => d.chainId))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
useEvmProvider,
useWallet,
} from '@centrifuge/centrifuge-react'
import { TransactionRequest } from '@ethersproject/providers'
import BN from 'bn.js'
import { TransactionRequest } from 'ethers'
import * as React from 'react'
import { Dec } from '../../utils/Decimal'
import { useEvmTransaction } from '../../utils/tinlake/useEvmTransaction'
Expand Down Expand Up @@ -45,7 +45,7 @@ export function InvestRedeemLiquidityPoolsProvider({ poolId, trancheId, children
const tranche = pool.tranches.find((t) => t.id === trancheId)
const { data: metadata, isLoading: isMetadataLoading } = usePoolMetadata(pool)
const trancheMeta = metadata?.tranches?.[trancheId]
const chainId = provider?.network.chainId || 1
const chainId = Number(provider?._network.chainId)

if (!tranche) throw new Error(`Token not found. Pool id: ${poolId}, token id: ${trancheId}`)

Expand Down Expand Up @@ -226,7 +226,7 @@ export function InvestRedeemLiquidityPoolsProvider({ poolId, trancheId, children
// If the last tx was an approve, we may not have refetched the allowance yet,
// so assume the allowance is enough to do a normal invest
else if (lpInvest.lpCurrencyAllowance.lt(assets) && supportsPermits && pendingAction !== 'approvePoolCurrency') {
const signer = provider!.getSigner()
const signer = await provider!.getSigner()
const connectedCent = cent.connectEvm(evmAddress!, signer)
const permit = await connectedCent.liquidityPools.signPermit([lpInvest.currency.address, assets, chainId])
console.log('permit', permit)
Expand Down
5 changes: 3 additions & 2 deletions centrifuge-app/src/components/LiquidityEpochSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useWallet,
} from '@centrifuge/centrifuge-react'
import { Button, IconInfo, Shelf, Stack, Text } from '@centrifuge/fabric'
import { Contract } from 'ethers'
import * as React from 'react'
import { switchMap } from 'rxjs'
import { Dec } from '../utils/Decimal'
Expand Down Expand Up @@ -336,9 +337,9 @@ function TinlakeEpochStatus({ pool }: { pool: TinlakePool }) {
(cent) => cent.tinlake.closeEpoch,
{
onSuccess: async () => {
const signer = provider!.getSigner()
const signer = await provider!.getSigner()
const connectedCent = cent.connectEvm(selectedAddress!, signer)
const coordinator = connectedCent.tinlake.contract(pool.addresses, undefined, 'COORDINATOR')
const coordinator = connectedCent.tinlake.contract(pool.addresses, undefined, 'COORDINATOR') as Contract
if ((await coordinator.submissionPeriod()) === true) {
// didn't execute right away, run solver
solveEpochTx([])
Expand Down
9 changes: 4 additions & 5 deletions centrifuge-app/src/components/OnboardingAuthProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Centrifuge from '@centrifuge/centrifuge-js'
import { useCentrifuge, useCentrifugeUtils, useEvmProvider, useWallet } from '@centrifuge/centrifuge-react'
import { BigNumber } from '@ethersproject/bignumber'
import { Signer } from '@polkadot/types/types'
import { encodeAddress } from '@polkadot/util-crypto'
import { ethers, utils } from 'ethers'
import { ethers, hashMessage } from 'ethers'
import * as React from 'react'
import { useMutation, useQuery } from 'react-query'

Expand Down Expand Up @@ -240,7 +239,7 @@ Issued At: ${new Date().toISOString()}`
let body

if (signedMessage === '0x') {
const messageHash = utils.hashMessage(message)
const messageHash = hashMessage(message)

const isValid = await isValidSignature(signer, address, messageHash, evmChainId || 1)

Expand Down Expand Up @@ -308,9 +307,9 @@ const isValidSignature = async (provider: any, safeAddress: string, messageHash:
throw new Error('Unable to fetch SafeMessage')
}

const threshold = BigNumber.from(await safeContract.getThreshold()).toNumber()
const threshold = BigInt(await safeContract.getThreshold())

if (!threshold || threshold > safeMessage.confirmations.length) {
if (!threshold || threshold > BigInt(safeMessage.confirmations.length)) {
throw new Error('Threshold has not been met')
}

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/PoolOverview/KeyMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const AvailableNetworks = ({ poolId }: { poolId: string }) => {
<Spinner size="iconSmall" />
)}
{activeDomains.data
?.filter((domain) => domain.isActive)
?.filter((domain) => domain.isActive && domain.chainId !== 5)
.map((domain) => {
const chain = (evmChains as any)[domain.chainId]
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
TabsItem,
Text,
} from '@centrifuge/fabric'
import { isAddress as isEvmAddress } from '@ethersproject/address'
import { isAddress } from '@polkadot/util-crypto'
import BN from 'bn.js'
import Decimal from 'decimal.js-light'
import { isAddress as isEvmAddress } from 'ethers'
import { Field, FieldProps, Form, FormikProvider, useFormik } from 'formik'
import React, { useEffect } from 'react'
import { useQuery } from 'react-query'
Expand Down
3 changes: 3 additions & 0 deletions centrifuge-app/src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export function Root() {
showAdvancedAccounts={debugState.showAdvancedAccounts}
showTestNets={debugState.showTestNets}
showFinoa={debugState.showFinoa}
infuraApiKey={import.meta.env.REACT_APP_INFURA_KEY}
alchemyApiKey={import.meta.env.REACT_APP_ALCHEMY_KEY}
tenderlyApiKey={import.meta.env.REACT_APP_TENDERLY_KEY}
>
<SupportedBrowserBanner />
<OnboardingAuthProvider>
Expand Down
20 changes: 18 additions & 2 deletions centrifuge-app/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ const CENTRIFUGE: EnvironmentConfig = {
const ethNetwork = import.meta.env.REACT_APP_TINLAKE_NETWORK || 'mainnet'

const alchemyKey = import.meta.env.REACT_APP_ALCHEMY_KEY
const onfinalityKey = import.meta.env.REACT_APP_ONFINALITY_KEY
const tenderlyKey = import.meta.env.REACT_APP_TENDERLY_KEY

export const ethConfig = {
rpcUrl: `https://eth-mainnet.g.alchemy.com/v2/${alchemyKey}`,
Expand Down Expand Up @@ -129,15 +131,24 @@ export const evmChains: EvmChains = {
decimals: 18,
},
blockExplorerUrl: 'https://etherscan.io/',
urls: [`https://eth-mainnet.g.alchemy.com/v2/${alchemyKey}`],
urls: [
`https://mainnet.gateway.tenderly.co/${tenderlyKey}`,
`https://eth-mainnet.g.alchemy.com/v2/${alchemyKey}`,
`https://eth.api.onfinality.io/rpc?apikey=${onfinalityKey}`,
],
network: 'mainnet',
iconUrl: ethereumLogo,
isTestnet: false,
},
11155111: {
name: 'Ethereum Sepolia',
nativeCurrency: { name: 'Sepolia Ether', symbol: 'sepETH', decimals: 18 },
blockExplorerUrl: 'https://sepolia.etherscan.io/',
urls: [`https://eth-sepolia.g.alchemy.com/v2/${alchemyKey}`],
urls: [
`https://eth-sepolia.g.alchemy.com/v2/${alchemyKey}`,
`https://eth-sepolia.api.onfinality.io/rpc?apikey=${onfinalityKey}`,
],
network: 'sepolia',
iconUrl: sepoliaLogo,
isTestnet: true,
},
Expand All @@ -147,6 +158,7 @@ export const evmChains: EvmChains = {
blockExplorerUrl: 'https://basescan.org/',
urls: ['https://mainnet.base.org'],
iconUrl: baseLogo,
network: 'base-mainnet',
isTestnet: false,
},
84532: {
Expand All @@ -155,6 +167,7 @@ export const evmChains: EvmChains = {
blockExplorerUrl: 'https://sepolia.basescan.org/',
urls: [`https://sepolia.base.org`],
iconUrl: baseLogo,
network: 'base-sepolia',
isTestnet: true,
},
42161: {
Expand All @@ -167,6 +180,7 @@ export const evmChains: EvmChains = {
blockExplorerUrl: 'https://arbiscan.io/',
urls: ['https://arb1.arbitrum.io/rpc'],
iconUrl: arbitrumLogo,
network: 'arbitrum-mainnet',
isTestnet: false,
},
42220: {
Expand All @@ -180,6 +194,7 @@ export const evmChains: EvmChains = {
urls: ['https://forno.celo.org'],
iconUrl: celoLogo,
isTestnet: false,
network: 'celo-mainnet',
},
44787: {
name: 'Celo Alfajores',
Expand All @@ -192,6 +207,7 @@ export const evmChains: EvmChains = {
urls: ['https://alfajores-forno.celo-testnet.org'],
iconUrl: celoLogo,
isTestnet: true,
network: 'celo-alfajores',
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
useGetNetworkName,
} from '@centrifuge/centrifuge-react'
import { Button, IconMinusCircle, InputErrorMessage, SelectInner, Stack, Text, TextInput } from '@centrifuge/fabric'
import { isAddress as isEvmAddress } from '@ethersproject/address'
import { isAddress as isSubstrateAddress, sortAddresses } from '@polkadot/util-crypto'
import { BN } from 'bn.js'
import { isAddress as isEvmAddress } from 'ethers'
import {
ErrorMessage,
Field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
Text,
TextWithPlaceholder,
} from '@centrifuge/fabric'
import { isAddress as isEvmAddress } from '@ethersproject/address'
import { isAddress } from '@polkadot/util-crypto'
import { isAddress as isEvmAddress } from 'ethers'
import React, { useMemo } from 'react'
import { useParams } from 'react-router'
import { DataTable } from '../../../components/DataTable'
Expand Down
10 changes: 6 additions & 4 deletions centrifuge-app/src/pages/Onboarding/queries/useSignRemark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useWallet,
} from '@centrifuge/centrifuge-react'
import { useNativeBalance } from '@centrifuge/centrifuge-react/dist/components/WalletProvider/evm/utils'
import { Contract } from '@ethersproject/contracts'
import { Contract } from 'ethers'
import React, { useEffect } from 'react'
import { UseMutateFunction } from 'react-query'
import { lastValueFrom } from 'rxjs'
Expand Down Expand Up @@ -149,11 +149,13 @@ export const useSignRemark = (
try {
const [message] = args
const remarkerContract = new Contract(ethConfig.remarkerAddress, RemarkerAbi)
if (!evmProvider?.getSigner()) {
const signer = await evmProvider?.getSigner()
if (!signer) {
throw new Error('Signer may not be set')
}
const connectedContract = remarkerContract.connect(evmProvider?.getSigner())
const result = await connectedContract.functions.remarkWithEvent(message)
const connectedContract = remarkerContract.connect(signer) as Contract

const result = await connectedContract.remarkWithEvent(message)
updateTransaction(txId, () => ({
status: 'pending',
hash: result.hash,
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/utils/address.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isAddress as isEvmAddress } from '@ethersproject/address'
import { isAddress } from '@polkadot/util-crypto'
import { isAddress as isEvmAddress } from 'ethers'

export function isSubstrateAddress(address: string) {
return isAddress(address) && !isEvmAddress(address)
Expand Down
4 changes: 2 additions & 2 deletions centrifuge-app/src/utils/tinlake/useEvmTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useTransactions,
useWallet,
} from '@centrifuge/centrifuge-react'
import { TransactionRequest, TransactionResponse } from '@ethersproject/providers'
import { TransactionRequest, TransactionResponse } from 'ethers'
import * as React from 'react'
import { Observable, lastValueFrom, tap } from 'rxjs'
import { useGmp } from '../useGmp'
Expand Down Expand Up @@ -36,7 +36,7 @@ export function useEvmTransaction<T extends Array<any>>(
gmpOptions?: { poolId: string; trancheId: string }
) {
try {
const signer = provider!.getSigner()
const signer = await provider!.getSigner()
const connectedCent = centrifuge.connectEvm(selectedAddress!, signer)
const transaction = transactionCallback(connectedCent)
updateTransaction(id, { status: 'unconfirmed' })
Expand Down
Loading
Loading