@tango-crypto/tangocrypto-js
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -31,3 +31,3 @@ import { AxiosInstance, AxiosRequestConfig } from "axios"; | ||
/** | ||
* Retrieve ipfs content by a `id`. | ||
* Retrieve ipfs content by `id`. | ||
* @summary Retrieve ipfs content | ||
@@ -34,0 +34,0 @@ * @param {string} version Tangocrypto version. |
@@ -98,3 +98,3 @@ "use strict"; | ||
/** | ||
* Retrieve ipfs content by a `id`. | ||
* Retrieve ipfs content by `id`. | ||
* @summary Retrieve ipfs content | ||
@@ -101,0 +101,0 @@ * @param {string} version Tangocrypto version. |
@@ -26,3 +26,3 @@ import { AxiosInstance } from 'axios'; | ||
export interface ApiConfiguration extends ClientConfiguration { | ||
basePath?: string; | ||
basePath: string; | ||
} | ||
@@ -32,3 +32,3 @@ export declare class Tangocrypto { | ||
protected axios: AxiosInstance; | ||
constructor(config: ApiConfiguration); | ||
constructor(config: ClientConfiguration); | ||
/** | ||
@@ -35,0 +35,0 @@ * Get Transaction api client |
@@ -35,20 +35,15 @@ "use strict"; | ||
Object.assign(configuration, config); | ||
if (config.basePath) { | ||
this.configuration = Object.assign(Object.assign({}, configuration), { basePath: config.basePath }); | ||
let basePath = ''; | ||
switch (configuration.network) { | ||
case exports.Network.CARDANO_TESTNET: | ||
basePath = base_1.BASE_PATH_TEST; | ||
break; | ||
case exports.Network.CARDANO_TESTNET_STAGING: | ||
basePath = base_1.BASE_PATH_TEST_STAGING; | ||
break; | ||
default: | ||
basePath = base_1.BASE_PATH; | ||
break; | ||
} | ||
else { | ||
let basePath = ''; | ||
switch (configuration.network) { | ||
case exports.Network.CARDANO_TESTNET: | ||
basePath = base_1.BASE_PATH_TEST; | ||
break; | ||
case exports.Network.CARDANO_TESTNET_STAGING: | ||
basePath = base_1.BASE_PATH_TEST_STAGING; | ||
break; | ||
default: | ||
basePath = base_1.BASE_PATH; | ||
break; | ||
} | ||
this.configuration = Object.assign(Object.assign({}, configuration), { basePath }); | ||
} | ||
this.configuration = Object.assign(Object.assign({}, configuration), { basePath }); | ||
} | ||
@@ -119,5 +114,6 @@ /** | ||
ipfs() { | ||
return new ipfs_1.IpfsApi(this.configuration, this.axios); | ||
const config = Object.assign(Object.assign({}, this.configuration), { basePath: base_1.IPFS_BASE_PATH }); | ||
return new ipfs_1.IpfsApi(config, this.axios); | ||
} | ||
} | ||
exports.Tangocrypto = Tangocrypto; |
{ | ||
"name": "@tango-crypto/tangocrypto-js", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Javascript client for tangocrypto API", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -41,5 +41,4 @@ ## tangocrypto-js | ||
### Settings Options | ||
* `basePath`: base URL (e.g. `https://cardano-mainnet.tangocrypto.com`) | ||
* `apiKey`: Your account Id (required). | ||
* `appId`: Your app Id (required). | ||
* `appId`: Your app Id. | ||
* `network`: Network to determine the base URL, default to `https://cardano-mainnet.tangocrypto.com` | ||
@@ -147,3 +146,2 @@ * `version`: String for API version, default to `v1`. | ||
apiKey: process.env.API_KEY, | ||
basePath: IPFS_BASE_PATH // https://storage.tangocrypto.cloud | ||
}).ipfs() | ||
@@ -150,0 +148,0 @@ |
@@ -103,3 +103,3 @@ import globalAxios, { AxiosInstance, AxiosRequestConfig } from "axios"; | ||
/** | ||
* Retrieve ipfs content by a `id`. | ||
* Retrieve ipfs content by `id`. | ||
* @summary Retrieve ipfs content | ||
@@ -386,2 +386,2 @@ * @param {string} version Tangocrypto version. | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { BASE_PATH, BASE_PATH_TEST, BASE_PATH_TEST_STAGING, V1 } from "../base"; | ||
import { BASE_PATH, BASE_PATH_TEST, BASE_PATH_TEST_STAGING, IPFS_BASE_PATH, V1 } from "../base"; | ||
import globalAxios, { AxiosInstance } from 'axios'; | ||
@@ -31,3 +31,3 @@ import { TransactionApi } from "./transactions"; | ||
export interface ApiConfiguration extends ClientConfiguration { | ||
basePath?: string; | ||
basePath: string; | ||
} | ||
@@ -47,22 +47,18 @@ | ||
constructor(config: ApiConfiguration) { | ||
constructor(config: ClientConfiguration) { | ||
const configuration = defaultConfig; | ||
Object.assign(configuration, config); | ||
if (config.basePath) { | ||
this.configuration = { ...configuration, basePath: config.basePath }; | ||
} else { | ||
let basePath = ''; | ||
switch (configuration.network) { | ||
case Network.CARDANO_TESTNET: | ||
basePath = BASE_PATH_TEST; | ||
break; | ||
case Network.CARDANO_TESTNET_STAGING: | ||
basePath = BASE_PATH_TEST_STAGING; | ||
break; | ||
default: | ||
basePath = BASE_PATH; | ||
break; | ||
} | ||
this.configuration = { ...configuration, basePath }; | ||
let basePath = ''; | ||
switch (configuration.network) { | ||
case Network.CARDANO_TESTNET: | ||
basePath = BASE_PATH_TEST; | ||
break; | ||
case Network.CARDANO_TESTNET_STAGING: | ||
basePath = BASE_PATH_TEST_STAGING; | ||
break; | ||
default: | ||
basePath = BASE_PATH; | ||
break; | ||
} | ||
this.configuration = { ...configuration, basePath }; | ||
} | ||
@@ -144,5 +140,6 @@ | ||
public ipfs(): IpfsApi { | ||
return new IpfsApi(this.configuration, this.axios); | ||
const config = {...this.configuration, basePath: IPFS_BASE_PATH }; | ||
return new IpfsApi(config, this.axios); | ||
} | ||
} |
@@ -22,3 +22,2 @@ import * as chai from 'chai'; | ||
api = new Tangocrypto({ | ||
basePath: IPFS_BASE_PATH, | ||
apiKey: process.env.API_KEY!, | ||
@@ -25,0 +24,0 @@ }).ipfs(); |
2325069
36526
183