Skip to content

Commit

Permalink
chore: Transports guide - installation page (docs) (#1850)
Browse files Browse the repository at this point in the history
* chore: custom RPC section on chains page (docs)

* chore: update docs and tweak changeset

* chore: tweak changeset

* chore: tweaks

---------

Co-authored-by: Magomed Khamidov <[email protected]>
Co-authored-by: Daniel Sinclair <[email protected]>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent b11118f commit 3ab4bfd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-badgers-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"site": patch
---

Added "Preparing to deploy" section in "Installation" page and explaining why it's important to use transports when deploying your dApp. Additionally also added a quick example with `http` and `getDefaultConfig`.
26 changes: 26 additions & 0 deletions site/data/en-US/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,32 @@ export default {
};
```

### Preparing to deploy

By default, your dApp uses public RPC providers for each chain to fetch balances, resolve ENS names, and more. This can often cause reliability issues for your users as public nodes are rate-limited. You should instead purchase access to an RPC provider through services like [Alchemy](https://www.alchemy.com/) or [QuickNode](https://www.quicknode.com/), and define your own Transports in Wagmi. This can be achieved by adding the `transports` param in `getDefaultConfig` or via Wagmi's `createConfig` directly.

A Transport is the networking middle layer that handles sending JSON-RPC requests to the Ethereum Node Provider (like Alchemy, Infura, etc).

**Example with an `http` transport**

```tsx
import { getDefaultConfig } from '@rainbow-me/rainbowkit';
import { http } from 'wagmi';
import { mainnet, sepolia } from 'wagmi/chains';

const config = getDefaultConfig({
appName: 'My RainbowKit App',
projectId: 'YOUR_PROJECT_ID',
chains: [mainnet, sepolia],
transports: {
[mainnet.id]: http('https://eth-mainnet.g.alchemy.com/v2/...'),
[sepolia.id]: http('https://eth-sepolia.g.alchemy.com/v2/...'),
},
});
```

For more details, view the [wagmi transport docs](https://wagmi.sh/core/api/transports#transports).

### Add your own functionality

Now that your users can connect their wallets, you can start building out the rest of your app using [wagmi.](https://wagmi.sh)
Expand Down

0 comments on commit 3ab4bfd

Please sign in to comment.