Skip to content

Commit

Permalink
refactor(experimental): update readme to remove dist/types
Browse files Browse the repository at this point in the history
  • Loading branch information
mcintyre94 committed Dec 11, 2023
1 parent 1f94d53 commit 9cd5b8a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ const rpc = createJsonRpc<SolanaRpcMethods>({ api, transport });
If you want to, you can also reduce the scope of the API’s type-spec so you are left only with the types you need. Keep in mind types don’t affect bundle size, but you may choose to scope the type-spec for a variety of reasons, including reducing TypeScript noise.

```tsx
import { createSolanaRpcApi } from '@solana/rpc-core';
import type { GetAccountInfoApi } from '@solana/rpc-core/dist/types/rpc-methods/getAccountInfo';
import { createSolanaRpcApi, type GetAccountInfoApi } from '@solana/rpc-core';
import type { GetAccountInfoApi } from '@solana/rpc-core';
import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport';

const api = createSolanaRpcApi();
Expand Down Expand Up @@ -325,8 +325,7 @@ Here’s an example of how someone might implement a “round robin” approach

```tsx
import { createSolanaRpcApi } from '@solana/rpc-core';
import { createJsonRpc } from '@solana/rpc-transport';
import { IRpcTransport } from '@solana/rpc-transport/dist/types/transports/transport-types';
import { createJsonRpc, type IRpcTransport } from '@solana/rpc-transport';
import { createDefaultRpcTransport } from '@solana/web3.js';

// Create a transport for each RPC server
Expand Down Expand Up @@ -364,10 +363,9 @@ Another example of a possible customization for RPC transports is sharding. Here
The transport library can also be used to implement custom retry logic on any request:

```tsx
import { createDefaultRpcTransport } from "@solana/web3.js";
import { IRpcTransport } from "@solana/rpc-transport/dist/types/transports/transport-types";
import { createJsonRpc } from "@solana/rpc-transport";
import { createSolanaRpcApi } from "@solana/rpc-core";
import { createDefaultRpcTransport } from '@solana/web3.js';
import { createJsonRpc, IRpcTransport } from '@solana/rpc-transport';
import { createSolanaRpcApi } from '@solana/rpc-core';

// Set the maximum number of attempts to retry a request
const MAX_ATTEMPTS = 4;
Expand Down Expand Up @@ -425,8 +423,7 @@ Perhaps your application needs to make a large number of requests, or needs to f

```tsx
import { createSolanaRpcApi } from '@solana/rpc-core';
import { createJsonRpc } from '@solana/rpc-transport';
import { IRpcTransport } from '@solana/rpc-transport/dist/types/transports/transport-types';
import { createJsonRpc, IRpcTransport } from '@solana/rpc-transport';
import { createDefaultRpcTransport } from '@solana/web3.js';

// Create multiple transports
Expand Down

0 comments on commit 9cd5b8a

Please sign in to comment.