@portal-hq/utils 0.2.7 → 0.2.9
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.
- package/lib/definitions/index.js +4 -0
- package/lib/{esm/index.js → index.js} +1 -1
- package/package.json +1 -1
- package/src/currency/countries/currency-codes.ts +0 -1
- package/src/definitions/index.ts +55 -0
- package/src/errors/provider-rpc-error.ts +1 -1
- package/src/eth-requests/index.ts +14 -9
- package/src/index.ts +10 -2
- package/types.d.ts +60 -14
- package/lib/commonjs/currency/countries/country-codes.js +0 -250
- package/lib/commonjs/currency/countries/currency-codes.js +0 -248
- package/lib/commonjs/currency/countries/index.js +0 -10
- package/lib/commonjs/currency/index.js +0 -29
- package/lib/commonjs/errors/http-error.js +0 -10
- package/lib/commonjs/errors/index.js +0 -23
- package/lib/commonjs/errors/invalid-api-key-error.js +0 -10
- package/lib/commonjs/errors/invalid-chain-id-error.js +0 -10
- package/lib/commonjs/errors/invalid-gateway-config-error.js +0 -10
- package/lib/commonjs/errors/invalid-rpc-config-error.js +0 -10
- package/lib/commonjs/errors/missing-option-error.js +0 -10
- package/lib/commonjs/errors/mpc-signing-error.js +0 -10
- package/lib/commonjs/errors/no-address-error.js +0 -10
- package/lib/commonjs/errors/provider-rpc-error.js +0 -52
- package/lib/commonjs/eth-requests/index.js +0 -87
- package/lib/commonjs/http-request/index.js +0 -72
- package/lib/commonjs/index.js +0 -27
- package/lib/commonjs/requesters/http.js +0 -52
- package/lib/commonjs/requesters/index.js +0 -8
- package/lib/esm/errors/invalid-rpc-config-error.js +0 -26
- /package/lib/{esm/currency → currency}/countries/country-codes.js +0 -0
- /package/lib/{esm/currency → currency}/countries/currency-codes.js +0 -0
- /package/lib/{esm/currency → currency}/countries/index.js +0 -0
- /package/lib/{esm/currency → currency}/index.js +0 -0
- /package/lib/{esm/errors → errors}/http-error.js +0 -0
- /package/lib/{esm/errors → errors}/index.js +0 -0
- /package/lib/{esm/errors → errors}/invalid-api-key-error.js +0 -0
- /package/lib/{esm/errors → errors}/invalid-chain-id-error.js +0 -0
- /package/lib/{esm/errors → errors}/invalid-gateway-config-error.js +0 -0
- /package/lib/{esm/errors → errors}/missing-option-error.js +0 -0
- /package/lib/{esm/errors → errors}/mpc-signing-error.js +0 -0
- /package/lib/{esm/errors → errors}/no-address-error.js +0 -0
- /package/lib/{esm/errors → errors}/provider-rpc-error.js +0 -0
- /package/lib/{esm/eth-requests → eth-requests}/index.js +0 -0
- /package/lib/{esm/http-request → http-request}/index.js +0 -0
- /package/lib/{esm/requesters → requesters}/http.js +0 -0
- /package/lib/{esm/requesters → requesters}/index.js +0 -0
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const index_1 = require("../index");
|
|
13
|
-
class HttpRequester {
|
|
14
|
-
constructor({ baseUrl }) {
|
|
15
|
-
this.baseUrl = baseUrl.startsWith('https://')
|
|
16
|
-
? baseUrl
|
|
17
|
-
: `https://${baseUrl}`;
|
|
18
|
-
}
|
|
19
|
-
get(path, options) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const requestOptions = {
|
|
22
|
-
method: 'GET',
|
|
23
|
-
url: `${this.baseUrl}${path}`,
|
|
24
|
-
};
|
|
25
|
-
if (options && options.headers) {
|
|
26
|
-
requestOptions.headers = this.buildHeaders(options.headers);
|
|
27
|
-
}
|
|
28
|
-
const request = new index_1.HttpRequest(requestOptions);
|
|
29
|
-
const response = (yield request.send());
|
|
30
|
-
return response;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
post(path, options) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const requestOptions = {
|
|
36
|
-
method: 'POST',
|
|
37
|
-
url: `${this.baseUrl}${path}`,
|
|
38
|
-
};
|
|
39
|
-
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
40
|
-
if (options && options.body) {
|
|
41
|
-
requestOptions.body = options.body;
|
|
42
|
-
}
|
|
43
|
-
const request = new index_1.HttpRequest(requestOptions);
|
|
44
|
-
const response = (yield request.send());
|
|
45
|
-
return response;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
buildHeaders(headers) {
|
|
49
|
-
return Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.default = HttpRequester;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HttpRequester = void 0;
|
|
7
|
-
var http_1 = require("./http");
|
|
8
|
-
Object.defineProperty(exports, "HttpRequester", { enumerable: true, get: function () { return __importDefault(http_1).default; } });
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var InvalidRpcConfigError = /** @class */ (function (_super) {
|
|
17
|
-
__extends(InvalidRpcConfigError, _super);
|
|
18
|
-
function InvalidRpcConfigError() {
|
|
19
|
-
var _this = _super.call(this, '[Portal] A valid RPC configuration was not provided.') || this;
|
|
20
|
-
// Set the prototype explicitly.
|
|
21
|
-
Object.setPrototypeOf(_this, InvalidRpcConfigError.prototype);
|
|
22
|
-
return _this;
|
|
23
|
-
}
|
|
24
|
-
return InvalidRpcConfigError;
|
|
25
|
-
}(Error));
|
|
26
|
-
export default InvalidRpcConfigError;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|