From e8a6074bae25c39bea1197a65fe23a02791632a8 Mon Sep 17 00:00:00 2001 From: sophian Date: Thu, 12 Sep 2024 13:03:43 -0400 Subject: [PATCH] Clean up --- .../InvestRedeem/InvestRedeemLiquidityPoolsProvider.tsx | 2 +- centrifuge-app/src/components/Root.tsx | 3 +++ centrifuge-js/esbuild.js | 2 +- centrifuge-js/src/modules/liquidityPools.ts | 5 +++-- centrifuge-react/src/components/Provider/Provider.tsx | 9 +++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/centrifuge-app/src/components/InvestRedeem/InvestRedeemLiquidityPoolsProvider.tsx b/centrifuge-app/src/components/InvestRedeem/InvestRedeemLiquidityPoolsProvider.tsx index 07b3e3093a..411c5c070d 100644 --- a/centrifuge-app/src/components/InvestRedeem/InvestRedeemLiquidityPoolsProvider.tsx +++ b/centrifuge-app/src/components/InvestRedeem/InvestRedeemLiquidityPoolsProvider.tsx @@ -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}`) diff --git a/centrifuge-app/src/components/Root.tsx b/centrifuge-app/src/components/Root.tsx index 5cae7b5760..2ba8c053c1 100644 --- a/centrifuge-app/src/components/Root.tsx +++ b/centrifuge-app/src/components/Root.tsx @@ -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} > diff --git a/centrifuge-js/esbuild.js b/centrifuge-js/esbuild.js index 57ac0d4081..bf620dd23d 100644 --- a/centrifuge-js/esbuild.js +++ b/centrifuge-js/esbuild.js @@ -19,7 +19,7 @@ Promise.all([ : undefined, external: Object.keys(pkg.dependencies), format: 'esm', - target: ['es6'], + target: ['es2020'], }), esbuild.build({ entryPoints: ['src/index.ts'], diff --git a/centrifuge-js/src/modules/liquidityPools.ts b/centrifuge-js/src/modules/liquidityPools.ts index 47df1062db..2732a11901 100644 --- a/centrifuge-js/src/modules/liquidityPools.ts +++ b/centrifuge-js/src/modules/liquidityPools.ts @@ -1,7 +1,7 @@ import BN from 'bn.js' import { signERC2612Permit } from 'eth-permit' import type { TransactionRequest, TransactionResponse } from 'ethers' -import { Contract, Interface, Provider } from 'ethers' +import { Contract, Interface, Provider, ethers } from 'ethers' import set from 'lodash/set' import { combineLatestWith, firstValueFrom, from, map, startWith, switchMap } from 'rxjs' import { Centrifuge } from '../Centrifuge' @@ -70,7 +70,8 @@ export function getLiquidityPoolsModule(inst: Centrifuge) { function centrifugeRouter(chainId: number) { const centrifugeRouter = getCentrifugeRouterAddress(chainId) - const getEstimate = from(contract(centrifugeRouter, new Interface(ABI.CentrifugeRouter)).estimate([0])) + const bytes = ethers.hexlify(new Uint8Array([0x12])) + const getEstimate = from(contract(centrifugeRouter, new Interface(ABI.CentrifugeRouter)).estimate(bytes)) return getEstimate.pipe( map((estimate) => { return { estimate, centrifugeRouter } diff --git a/centrifuge-react/src/components/Provider/Provider.tsx b/centrifuge-react/src/components/Provider/Provider.tsx index 3b837af31a..c5e9cd6967 100644 --- a/centrifuge-react/src/components/Provider/Provider.tsx +++ b/centrifuge-react/src/components/Provider/Provider.tsx @@ -20,6 +20,9 @@ export type ProviderProps = { walletConnectId?: string subscanUrl?: string transactionToastPositionProps?: TransactionToastsProps['positionProps'] + infuraApiKey?: string + alchemyApiKey?: string + tenderlyApiKey?: string } export function Provider({ @@ -30,6 +33,9 @@ export function Provider({ walletConnectId, subscanUrl, transactionToastPositionProps, + infuraApiKey, + alchemyApiKey, + tenderlyApiKey, }: ProviderProps) { return ( @@ -39,6 +45,9 @@ export function Provider({ evmAdditionalConnectors={evmAdditionalConnectors} walletConnectId={walletConnectId} subscanUrl={subscanUrl} + infuraApiKey={infuraApiKey} + alchemyApiKey={alchemyApiKey} + tenderlyApiKey={tenderlyApiKey} >