@parcl-finance/product-sdk
Version:
TypeScript SDK for interacting with Parcl's product APIs
56 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultExpressApiUrl = exports.getDefaultApiUrl = void 0;
/*
* Get the default API URL for a given environment.
* @param env - The environment to get the URL for. Default is "devnet".
* @param version - The version of the API to use. Default is "v1".
* @param express - Whether to use the parcl express api. Default is false.
* @returns The default API URL.
*/
function getDefaultApiUrl(env, version) {
env = env ?? "devnet";
version = version ?? "v1";
if (env === "m" || env === "main" || env === "mainnet" || env === "mainnet-beta") {
return `https://parcl-api.com/${version}`;
}
else if (env === "s" || env === "stage" || env === "staging" || env === "mainnet-staging") {
return `https://staging.parcl-api.com/${version}`;
}
else if (env === "d" || env === "dev" || env === "devnet") {
return `https://dev.parcl-api.com/${version}`;
}
else if (env === "local") {
return `http://localhost:8080/v1`;
}
else {
throw new Error(`Invalid api environment: ${env}`);
}
}
exports.getDefaultApiUrl = getDefaultApiUrl;
function getDefaultExpressApiUrl(env, version) {
env = env ?? "devnet";
version = version ?? "v1";
if (env === "prod" ||
env === "m" ||
env === "main" ||
env === "mainnet" ||
env === "mainnet-beta" ||
env === "mainnet-staging") {
return `https://express-prod.parcl-api.com/${version}`;
}
else if (env === "d" ||
env === "dev" ||
env === "devnet" ||
env === "s" ||
env === "stage" ||
env === "staging" ||
env === "local") {
return `https://express-dev.parcl-api.com/${version}`;
}
else {
throw new Error(`Invalid api environment: ${env}`);
}
}
exports.getDefaultExpressApiUrl = getDefaultExpressApiUrl;
//# sourceMappingURL=defaults.js.map