@orca-so/whirlpool-sdk
Version:
Whirlpool SDK for the Orca protocol.
32 lines (31 loc) • 1.5 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultOffchainDataURI = exports.getDefaultConnection = exports.defaultNetwork = exports.ZERO_SLIPPAGE = exports.defaultSlippagePercentage = void 0;
const web3_js_1 = require("@solana/web3.js");
const percentage_1 = require("../../utils/public/percentage");
const network_1 = require("./network");
exports.defaultSlippagePercentage = percentage_1.Percentage.fromFraction(1, 1000); // 0.1%
exports.ZERO_SLIPPAGE = percentage_1.Percentage.fromFraction(0, 1000);
exports.defaultNetwork = network_1.OrcaNetwork.MAINNET;
function getDefaultConnection(network) {
switch (network) {
case network_1.OrcaNetwork.MAINNET:
return new web3_js_1.Connection("https://ssc-dao.genesysgo.net", "processed");
case network_1.OrcaNetwork.DEVNET:
return new web3_js_1.Connection("https://api.devnet.solana.com", "processed");
default:
throw new Error(`type ${network} is an Unknown network`);
}
}
exports.getDefaultConnection = getDefaultConnection;
function getDefaultOffchainDataURI(network) {
switch (network) {
case network_1.OrcaNetwork.MAINNET:
return "https://api.mainnet.orca.so/v1";
case network_1.OrcaNetwork.DEVNET:
return "https://api.devnet.orca.so/v1";
default:
throw new Error(`type ${network} is an Unknown network`);
}
}
exports.getDefaultOffchainDataURI = getDefaultOffchainDataURI;
;