diff --git a/src/core/client.ts b/src/core/client.ts index 1545e8f..01a76c5 100644 --- a/src/core/client.ts +++ b/src/core/client.ts @@ -112,7 +112,9 @@ export class AlphalendClient { * @param network One of the supported Sui networks. * @param graphqlUrl Optional GraphQL endpoint override. If omitted, a default * public endpoint for the given `network` is used. - * @param options Optional prebuilt coin metadata map for offline testing. + * @param options Optional prebuilt coin metadata map for offline testing, + * and an optional `pythFullnodeUrl` JSON-RPC override for + * the internal Pyth client. */ constructor( network: Network, @@ -125,11 +127,12 @@ export class AlphalendClient { // Minimal internal SuiClient ONLY for SuiPythClient (upstream dep still // uses JSON-RPC). All other reads go through Blockchain (GraphQL). const pythFullnodeUrl = - network === "mainnet" + options?.pythFullnodeUrl?.trim() || + (network === "mainnet" ? "https://alphalen-suimain-ef6f.mainnet.sui.rpcpool.com/" : network === "testnet" ? "https://fullnode.testnet.sui.io/" - : "https://fullnode.devnet.sui.io/"; + : "https://fullnode.devnet.sui.io/"); const pythSuiClient = new SuiJsonRpcClient({ url: pythFullnodeUrl, network, diff --git a/src/core/types.ts b/src/core/types.ts index 7713aab..9fc9986 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -21,6 +21,11 @@ import { Decimal } from "decimal.js"; export interface AlphalendClientOptions { coinMetadataMap?: Map; useLazer?: boolean; + /** + * JSON-RPC endpoint for the internal `SuiPythClient`. Defaults to a per-network + * endpoint. Must serve JSON-RPC — a gRPC or GraphQL URL will not work here. + */ + pythFullnodeUrl?: string; } /**