Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import { Decimal } from "decimal.js";
export interface AlphalendClientOptions {
coinMetadataMap?: Map<string, CoinMetadata>;
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;
}

/**
Expand Down
Loading