-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Improve RPC configuration and remove unused imports
- Loading branch information
Showing
4 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { LENS_MAINNET_RPCS, LENS_TESTNET_RPCS } from "@hey/data/rpcs"; | ||
import type { FallbackTransport } from "viem"; | ||
import { fallback, http } from "viem"; | ||
|
||
const getRpc = ({ mainnet }: { mainnet: boolean }): FallbackTransport => { | ||
if (mainnet) { | ||
return fallback( | ||
LENS_MAINNET_RPCS.map((rpc) => http(rpc, { batch: { batchSize: 10 } })) | ||
); | ||
} | ||
|
||
return fallback( | ||
LENS_TESTNET_RPCS.map((rpc) => http(rpc, { batch: { batchSize: 10 } })) | ||
); | ||
}; | ||
|
||
export default getRpc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { createWalletClient, http, type Hex } from "viem"; | ||
import { IS_MAINNET } from "@hey/data/constants"; | ||
import { type Hex, createWalletClient } from "viem"; | ||
import { privateKeyToAccount } from "viem/accounts"; | ||
import getRpc from "./getRpc"; | ||
|
||
export const heyWalletClient = createWalletClient({ | ||
account: privateKeyToAccount(process.env.PRIVATE_KEY as Hex), | ||
transport: http("https://rpc.yoginth.com") | ||
transport: getRpc({ mainnet: IS_MAINNET }) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters