@tatumio/shared-core
Advanced tools
Comparing version 2.1.14 to 2.1.15
{ | ||
"name": "@tatumio/shared-core", | ||
"version": "2.1.14", | ||
"version": "2.1.15", | ||
"license": "MIT", | ||
@@ -8,3 +8,3 @@ "main": "./src/index.js", | ||
"dependencies": { | ||
"@tatumio/api-client": "2.1.14", | ||
"@tatumio/api-client": "2.1.15", | ||
"axios": "^0.26.0", | ||
@@ -11,0 +11,0 @@ "form-data": "^4.0.0", |
import { AxiosRequestConfig } from 'axios'; | ||
import { Blockchain, EvmBasedBlockchain } from './models/Blockchain'; | ||
export declare const httpCommon: { | ||
web3Endpoint: (blockchain: EvmBasedBlockchain, url: string, apiKey: string) => string; | ||
rpcEndpoint: (blockchain: Blockchain, url: string, apiKey: string) => string; | ||
}; | ||
export declare const httpAxios: { | ||
web3Endpoint: (blockchain: EvmBasedBlockchain, url: string, apiKey: string) => string; | ||
rpcEndpoint: (blockchain: Blockchain, url: string, apiKey: string) => string; | ||
get: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D>) => Promise<R>; | ||
post: <T_1 = any, R_1 = import("axios").AxiosResponse<T_1, any>, D_1 = any>(url: string, data?: D_1, config?: AxiosRequestConfig<D_1>) => Promise<R_1>; | ||
axios: import("axios").AxiosInstance; | ||
CancelToken: import("axios").CancelTokenStatic; | ||
}; | ||
export declare const httpFetch: { | ||
web3Endpoint: (blockchain: EvmBasedBlockchain, url: string, apiKey: string) => string; | ||
rpcEndpoint: (blockchain: Blockchain, url: string, apiKey: string) => string; | ||
get: (url: string, config?: any) => Promise<any>; | ||
post: (url: string, body: any, config?: any) => Promise<any>; | ||
}; | ||
export declare const httpHelper: { | ||
web3Endpoint: (blockchain: EvmBasedBlockchain, url: string, apiKey: string) => string; | ||
rpcEndpoint: (blockchain: Blockchain, url: string, apiKey: string) => string; | ||
get: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D>) => Promise<R>; | ||
@@ -8,4 +28,7 @@ post: <T_1 = any, R_1 = import("axios").AxiosResponse<T_1, any>, D_1 = any>(url: string, data?: D_1, config?: AxiosRequestConfig<D_1>) => Promise<R_1>; | ||
CancelToken: import("axios").CancelTokenStatic; | ||
} | { | ||
web3Endpoint: (blockchain: EvmBasedBlockchain, url: string, apiKey: string) => string; | ||
rpcEndpoint: (blockchain: Blockchain, url: string, apiKey: string) => string; | ||
get: (url: string, config?: any) => Promise<any>; | ||
post: (url: string, body: any, config?: any) => Promise<any>; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.httpHelper = void 0; | ||
exports.httpHelper = exports.httpFetch = exports.httpAxios = exports.httpCommon = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -36,7 +36,3 @@ const axios_1 = tslib_1.__importDefault(require("axios")); | ||
['DedicatedWorkerGlobalScope', 'ServiceWorkerGlobalScope'].includes(self.constructor.name); | ||
exports.httpHelper = { | ||
get: axios_1.default.get, | ||
post: axios_1.default.post, | ||
axios: axios_1.default.create(), | ||
CancelToken: axios_1.default.CancelToken, | ||
exports.httpCommon = { | ||
web3Endpoint: (blockchain, url, apiKey) => { | ||
@@ -50,2 +46,18 @@ return `${url}/${api_client_1.TATUM_API_CONSTANTS.API_VERSION}/${EndpointsMapping[blockchain]}/web3/${apiKey}`; | ||
}; | ||
exports.httpAxios = Object.assign({ get: axios_1.default.get, post: axios_1.default.post, axios: axios_1.default.create(), CancelToken: axios_1.default.CancelToken }, exports.httpCommon); | ||
exports.httpFetch = Object.assign({ get: (url, config) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield fetch(url, { | ||
method: 'GET', | ||
headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), { 'Content-Type': 'application/json' }), | ||
}); | ||
return response.json(); | ||
}), post: (url, body, config) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
const response = yield fetch(url, { | ||
method: 'POST', | ||
headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), { 'Content-Type': 'application/json' }), | ||
body: JSON.stringify(body), | ||
}); | ||
return response.json(); | ||
}) }, exports.httpCommon); | ||
exports.httpHelper = isWebWorker ? exports.httpFetch : exports.httpAxios; | ||
//# sourceMappingURL=http.common.js.map |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
43165
643
2
+ Added@tatumio/api-client@2.1.15(transitive)
- Removed@tatumio/api-client@2.1.14(transitive)
Updated@tatumio/api-client@2.1.15