Thirdweb SDK - Node RPC Integration
Thirdweb offers tools and services for integrating apps and games with decentralized networks, featuring customizable wallet connection components, contract deployment, and an engine for reliable smart contract calls, aimed at simplifying the development process for blockchain applications.
Connect
You can connect Thirdweb SDK with Node RPC, by supplying the chainRpc
property of ThirdwebProvider
with a map of chainIds to RPC links.
App.tsx
import { ThirdwebProvider, metamaskWallet, coinbaseWallet, walletConnect, ChainId } from "@thirdweb-dev/react";
import * as chains from "@thirdweb-dev/chains";
function AppWithProviders() {
return (
<ThirdwebProvider
chainRpc={{
[ChainId.Mainnet]: `https://mainnet.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_NODE_ACCESS_KEY_MAINNET}`,
[ChainId.Optimism]: `https://optimism.gateway.tenderly.co/${process.env.NEXT_TENDERLY_NODE_ACCESS_KEY_OPTIMISM}`,
[ChainId.Polygon]: `https://polygon.gateway.tenderly.co/${process.env.NEXT_TENDERLY_NODE_ACCESS_KEY_POLYGON}`,
}}
supportedChains={[chains.Ethereum, chains.Optimism, chains.Polygon]}
desiredChainId={ChainId.Mainnet}
supportedWallets={[
metamaskWallet({
recommended: true,
}),
coinbaseWallet(),
walletConnect(),
]}
clientId="<your_client_id>"
>
<App />
</ThirdwebProvider>
);
}
<ThirdwebProvider
chainRpc={{ [ChainId.Mainnet]: "rpc URL here!" }}
desiredChainId={ChainId.Mainnet}
>
<Component {...pageProps} />
</ThirdwebProvider>
Thirdweb Typescript SDK
You can connect to a custom RPC provider when instantiating a new ThirdWebSDK
instance:
backend.ts
const sdk = new ThirdwebSDK(`https://mainnet.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_NODE_ACCESS_KEY_MAINNET}`);