Skip to content

Commit

Permalink
merge doc code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mPaella authored Nov 5, 2023
1 parent a9cd3af commit 69dea1f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions docs/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@ When creating a new Umi instance via the default bundle, you must pass the RPC's

```ts
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { Connection } from '@solana/web3.js';

// Pass in your RPC endpoint.
const umi = createUmi("https://api.mainnet-beta.solana.com");
```
```ts
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { Connection } from '@solana/web3.js';

// Or an explicit Connection instance from web3.js.
const umi = createUmi(new Connection("https://api.mainnet-beta.solana.com"));
```

Alternatively, you may set or update the RPC implementation explicitly by the using the plugin they provide. For instance, the `web3JsRpc` plugin will set the RPC implementation to use the `@solana/web3.js` library.

```ts
import { web3JsRpc } from '@metaplex-foundation/umi-rpc-web3js';

umi.use(web3JsRpc("https://api.mainnet-beta.solana.com"));
```
```ts
import { web3JsRpc } from '@metaplex-foundation/umi-rpc-web3js';
import { Connection } from '@solana/web3.js';

umi.use(web3JsRpc("https://api.mainnet-beta.solana.com"));
umi.use(web3JsRpc(new Connection("https://api.mainnet-beta.solana.com")));
```

Expand Down

0 comments on commit 69dea1f

Please sign in to comment.