@injectivelabs/sdk-ts 1.0.333 → 1.0.334
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpRestClient } from '@injectivelabs/utils';
|
|
2
2
|
/**
|
|
3
3
|
* @hidden
|
|
4
4
|
*/
|
|
5
|
-
export default class BaseRestConsumer {
|
|
6
|
-
protected client: HttpClient;
|
|
7
|
-
constructor(endpoint: string);
|
|
8
|
-
protected get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
9
|
-
protected post<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
5
|
+
export default class BaseRestConsumer extends HttpRestClient {
|
|
10
6
|
}
|
|
11
7
|
//# sourceMappingURL=BaseRestConsumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRestConsumer.d.ts","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BaseRestConsumer.d.ts","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,cAAc;CAE3D"}
|
|
@@ -1,82 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
const utils_1 = require("@injectivelabs/utils");
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
18
|
-
const http_status_codes_1 = require("http-status-codes");
|
|
19
4
|
/**
|
|
20
5
|
* @hidden
|
|
21
6
|
*/
|
|
22
|
-
class BaseRestConsumer {
|
|
23
|
-
constructor(endpoint) {
|
|
24
|
-
this.client = new utils_1.HttpClient(endpoint);
|
|
25
|
-
}
|
|
26
|
-
get(endpoint, params = {}) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
try {
|
|
29
|
-
return this.client.get(endpoint, params);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
const error = e;
|
|
33
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
34
|
-
const message = error.response
|
|
35
|
-
? typeof error.response.data === 'string'
|
|
36
|
-
? error.response.data
|
|
37
|
-
: error.response.statusText
|
|
38
|
-
: `The request to ${endpoint} has failed.`;
|
|
39
|
-
throw new exceptions_1.HttpRequestException(new Error(message), {
|
|
40
|
-
code: error.response
|
|
41
|
-
? error.response.status
|
|
42
|
-
: http_status_codes_1.StatusCodes.BAD_REQUEST,
|
|
43
|
-
method: exceptions_1.HttpRequestMethod.Get,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
throw new exceptions_1.HttpRequestException(new Error(error.message), {
|
|
47
|
-
code: exceptions_1.UnspecifiedErrorCode,
|
|
48
|
-
contextModule: exceptions_1.HttpRequestMethod.Get,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
post(endpoint, params = {}) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
try {
|
|
56
|
-
return this.client.post(endpoint, params);
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
const error = e;
|
|
60
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
61
|
-
const message = error.response
|
|
62
|
-
? typeof error.response.data === 'string'
|
|
63
|
-
? error.response.data
|
|
64
|
-
: error.response.statusText
|
|
65
|
-
: `The request to ${endpoint} has failed.`;
|
|
66
|
-
throw new exceptions_1.HttpRequestException(new Error(message), {
|
|
67
|
-
code: error.response
|
|
68
|
-
? error.response.status
|
|
69
|
-
: http_status_codes_1.StatusCodes.BAD_REQUEST,
|
|
70
|
-
contextModule: exceptions_1.HttpRequestMethod.Post,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
throw new exceptions_1.HttpRequestException(new Error(error.message), {
|
|
74
|
-
code: exceptions_1.UnspecifiedErrorCode,
|
|
75
|
-
contextModule: exceptions_1.HttpRequestMethod.Post,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
7
|
+
class BaseRestConsumer extends utils_1.HttpRestClient {
|
|
80
8
|
}
|
|
81
9
|
exports.default = BaseRestConsumer;
|
|
82
10
|
//# sourceMappingURL=BaseRestConsumer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRestConsumer.js","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseRestConsumer.js","sourceRoot":"","sources":["../../src/client/BaseRestConsumer.ts"],"names":[],"mappings":";;AAAA,gDAAqD;AAErD;;GAEG;AACH,MAAqB,gBAAiB,SAAQ,sBAAc;CAE3D;AAFD,mCAEC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
3
|
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.334",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bojan Angjelkoski",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@injectivelabs/chain-api": "1.8.3",
|
|
44
44
|
"@injectivelabs/exceptions": "^1.0.32",
|
|
45
45
|
"@injectivelabs/indexer-api": "1.0.32-rc",
|
|
46
|
-
"@injectivelabs/networks": "^1.0.
|
|
46
|
+
"@injectivelabs/networks": "^1.0.57",
|
|
47
47
|
"@injectivelabs/ninja-api": "^1.0.11",
|
|
48
|
-
"@injectivelabs/token-metadata": "^1.0.
|
|
48
|
+
"@injectivelabs/token-metadata": "^1.0.93",
|
|
49
49
|
"@injectivelabs/ts-types": "^1.0.18",
|
|
50
|
-
"@injectivelabs/utils": "^1.0.
|
|
50
|
+
"@injectivelabs/utils": "^1.0.48",
|
|
51
51
|
"@metamask/eth-sig-util": "^5.0.1",
|
|
52
52
|
"@types/google-protobuf": "^3.15.5",
|
|
53
53
|
"axios": "^0.27.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"shx": "^0.3.2",
|
|
69
69
|
"snakecase-keys": "^5.4.1"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "67884f9f9c3c782307cf3b65b3a9c03fb080bf80",
|
|
72
72
|
"typedoc": {
|
|
73
73
|
"entryPoint": "./src/index.ts",
|
|
74
74
|
"readmeFile": "./README.md",
|