From 69dea1f27b99e1fbc6c1f57fc9f721959aaeda41 Mon Sep 17 00:00:00 2001 From: mPaella <93682696+mPaella@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:03:09 -0500 Subject: [PATCH] merge doc code blocks --- docs/rpc.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/rpc.md b/docs/rpc.md index 545d24c..aa3330f 100644 --- a/docs/rpc.md +++ b/docs/rpc.md @@ -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"))); ```