widgets
widgets copied to clipboard
Property 'jsonRpcEndpoint' does not exist on type 'IntrinsicAttributes & SwapProps & WidgetProps'.
Bug Description
When user specify the token user get an error message
Type '{ jsonRpcEndpoint: string; tokenList: string; provider: Web3Provider | undefined; onConnectWallet: () => void; defaultInputTokenAddress: string; defaultInputAmount: string; defaultOutputTokenAddress: string; }' is not assignable to type 'IntrinsicAttributes & SwapProps & WidgetProps'. Property 'jsonRpcEndpoint' does not exist on type 'IntrinsicAttributes & SwapProps & WidgetProps'.
You should be able to use the jsonRpcUrlMap property instead. Here's the example that Uniswap includes in their documentation:
import { SwapWidget } from '@uniswap/widgets'
import '@uniswap/widgets/fonts.css'
// We recommend you pass a web3 provider.
import { provider } from './your/provider'
// We recommend you pass your own JSON-RPC endpoints.
const jsonRpcUrlMap = {
1: ['https://mainnet.infura.io/v3/<YOUR_INFURA_PROJECT_ID>'],
3: ['https://ropsten.infura.io/v3/<YOUR_INFURA_PROJECT_ID>']
}
function App() {
<div className="Uniswap">
<SwapWidget provider={provider} jsonRpcUrlMap={jsonRpcUrlMap} />
</div>
}