@bluefin-exchange/bluefin7k-aggregator-sdk
Version:
47 lines (46 loc) • 1.26 kB
JavaScript
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { SuiPriceServiceConnection, SuiPythClient, } from "@pythnetwork/pyth-sui-js";
const HERMES_API = "https://hermes.pyth.network";
const WORMHOLE_STATE_ID = "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
let apiKey = "";
let suiClient = new SuiClient({
url: getFullnodeUrl("mainnet"),
});
let pythClient = new SuiPythClient(suiClient, PYTH_STATE_ID, WORMHOLE_STATE_ID);
let pythConnection = new SuiPriceServiceConnection(HERMES_API);
function setApiKey(key) {
apiKey = key;
}
function getApiKey() {
return apiKey;
}
function getSuiClient() {
return suiClient;
}
function setSuiClient(client) {
suiClient = client;
}
function setPythClient(client) {
pythClient = client;
}
function getPythClient() {
return pythClient;
}
function setPythConnection(connection) {
pythConnection = connection;
}
function getPythConnection() {
return pythConnection;
}
const Config = {
setApiKey,
getApiKey,
setSuiClient,
getSuiClient,
setPythClient,
getPythClient,
setPythConnection,
getPythConnection,
};
export { Config };