widgets icon indicating copy to clipboard operation
widgets copied to clipboard

Property 'jsonRpcEndpoint' does not exist on type 'IntrinsicAttributes & SwapProps & WidgetProps'.

Open code-bajju opened this issue 1 year ago • 1 comments

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'.

Screenshot 2024-05-05 at 10 49 15 AM

code-bajju avatar May 05 '24 05:05 code-bajju

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>
}

zohaibadnan137 avatar Dec 10 '24 13:12 zohaibadnan137