Skip to content

Commit

Permalink
Merge pull request #40 from SIDANWhatever/main
Browse files Browse the repository at this point in the history
feat: adding base url option
  • Loading branch information
Vardominator authored Mar 4, 2024
2 parents fe9032d + a94a0bb commit 07d6b8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maestro-org/typescript-sdk",
"version": "1.5.1",
"version": "1.5.2",
"description": "TypeScript SDK for the Maestro Dapp Platform",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
11 changes: 8 additions & 3 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import globalAxios, { AxiosInstance, AxiosRequestConfig } from 'axios';
export type MaestroSupportedNetworks = 'Mainnet' | 'Preprod' | 'Preview';

export interface ConfigurationParameters {
readonly apiKey: string;
readonly apiKey?: string;
readonly baseUrl?: string;
readonly network: MaestroSupportedNetworks;
readonly baseOptions?: AxiosRequestConfig;
readonly axiosInstance?: AxiosInstance;
Expand Down Expand Up @@ -36,8 +37,12 @@ export class Configuration {
readonly axiosInstance: AxiosInstance;

constructor(param: ConfigurationParameters) {
this.apiKey = param.apiKey;
this.baseUrl = `https://${param.network}.gomaestro-api.org/v1`;
if (param.baseUrl) {
this.baseUrl = param.baseUrl;
} else {
this.baseUrl = `https://${param.network}.gomaestro-api.org/v1`;
}
this.apiKey = param.apiKey || '';
this.baseOptions = param.baseOptions;
this.axiosInstance = param.axiosInstance ?? globalAxios;
}
Expand Down

0 comments on commit 07d6b8f

Please sign in to comment.