@near-js/providers
Advanced tools
Comparing version 0.1.1 to 0.2.0
export { exponentialBackoff } from './exponential-backoff'; | ||
export { JsonRpcProvider } from './json-rpc-provider'; | ||
export { FailoverRpcProvider } from './failover-rpc-provider'; | ||
export { Provider } from './provider'; | ||
export { fetchJson } from './fetch_json'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetchJson = exports.Provider = exports.JsonRpcProvider = exports.exponentialBackoff = void 0; | ||
exports.fetchJson = exports.Provider = exports.FailoverRpcProvider = exports.JsonRpcProvider = exports.exponentialBackoff = void 0; | ||
var exponential_backoff_1 = require("./exponential-backoff"); | ||
@@ -8,2 +8,4 @@ Object.defineProperty(exports, "exponentialBackoff", { enumerable: true, get: function () { return exponential_backoff_1.exponentialBackoff; } }); | ||
Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return json_rpc_provider_1.JsonRpcProvider; } }); | ||
var failover_rpc_provider_1 = require("./failover-rpc-provider"); | ||
Object.defineProperty(exports, "FailoverRpcProvider", { enumerable: true, get: function () { return failover_rpc_provider_1.FailoverRpcProvider; } }); | ||
var provider_1 = require("./provider"); | ||
@@ -10,0 +12,0 @@ Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return provider_1.Provider; } }); |
@@ -5,2 +5,16 @@ import { AccessKeyWithPublicKey, BlockId, BlockReference, BlockResult, BlockChangeResult, ChangeResult, ChunkId, ChunkResult, EpochValidatorInfo, FinalExecutionOutcome, GasPrice, LightClientProof, LightClientProofRequest, NextLightClientBlockRequest, NextLightClientBlockResponse, NearProtocolConfig, NodeStatusResult, QueryResponseKind } from '@near-js/types'; | ||
import { ConnectionInfo } from './fetch_json'; | ||
type RequestOptions = { | ||
/** | ||
* Number of retries before giving up on a request | ||
*/ | ||
retries: number; | ||
/** | ||
* Wait until next retry in milliseconds | ||
*/ | ||
wait: number; | ||
/** | ||
* Exponential back off for waiting to retry again | ||
*/ | ||
backoff: number; | ||
}; | ||
/** | ||
@@ -13,6 +27,8 @@ * Client class to interact with the [NEAR RPC API](https://docs.near.org/api/rpc/introduction). | ||
readonly connection: ConnectionInfo; | ||
/** @hidden */ | ||
readonly options: RequestOptions; | ||
/** | ||
* @param connectionInfo Connection info | ||
*/ | ||
constructor(connectionInfo: ConnectionInfo); | ||
constructor(connectionInfo: ConnectionInfo, options?: Partial<RequestOptions>); | ||
/** | ||
@@ -162,2 +178,3 @@ * Gets the RPC's status | ||
} | ||
export {}; | ||
//# sourceMappingURL=json-rpc-provider.d.ts.map |
@@ -54,5 +54,11 @@ "use strict"; | ||
*/ | ||
constructor(connectionInfo) { | ||
constructor(connectionInfo, options) { | ||
super(); | ||
this.connection = connectionInfo || { url: '' }; | ||
const defaultOptions = { | ||
retries: REQUEST_RETRY_NUMBER, | ||
wait: REQUEST_RETRY_WAIT, | ||
backoff: REQUEST_RETRY_WAIT_BACKOFF | ||
}; | ||
this.options = Object.assign({}, defaultOptions, options); | ||
} | ||
@@ -350,3 +356,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield (0, exponential_backoff_1.exponentialBackoff)(REQUEST_RETRY_WAIT, REQUEST_RETRY_NUMBER, REQUEST_RETRY_WAIT_BACKOFF, () => __awaiter(this, void 0, void 0, function* () { | ||
const response = yield (0, exponential_backoff_1.exponentialBackoff)(this.options.wait, this.options.retries, this.options.backoff, () => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
@@ -407,3 +413,3 @@ try { | ||
if (typeof result === 'undefined') { | ||
throw new types_1.TypedError(`Exceeded ${REQUEST_RETRY_NUMBER} attempts for request to ${method}.`, 'RetriesExceeded'); | ||
throw new types_1.TypedError(`Exceeded ${this.options.retries} attempts for request to ${method}.`, 'RetriesExceeded'); | ||
} | ||
@@ -410,0 +416,0 @@ return result; |
{ | ||
"name": "@near-js/providers", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Library of implementations for interfacing with the NEAR blockchain", | ||
@@ -10,8 +10,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"bn.js": "5.2.1", | ||
"borsh": "1.0.0", | ||
"http-errors": "1.7.2", | ||
"@near-js/transactions": "1.1.2", | ||
"@near-js/types": "0.0.4", | ||
"@near-js/utils": "0.1.0" | ||
"@near-js/transactions": "1.2.0", | ||
"@near-js/types": "0.1.0", | ||
"@near-js/utils": "0.2.0" | ||
}, | ||
@@ -18,0 +17,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74397
6
24
1255
+ Added@near-js/crypto@1.2.2(transitive)
+ Added@near-js/keystores@0.0.10(transitive)
+ Added@near-js/signers@0.1.2(transitive)
+ Added@near-js/transactions@1.2.0(transitive)
+ Added@near-js/types@0.1.0(transitive)
+ Added@near-js/utils@0.2.0(transitive)
- Removedbn.js@5.2.1
- Removed@near-js/crypto@1.2.1(transitive)
- Removed@near-js/keystores@0.0.9(transitive)
- Removed@near-js/signers@0.1.1(transitive)
- Removed@near-js/transactions@1.1.2(transitive)
- Removed@near-js/types@0.0.4(transitive)
- Removed@near-js/utils@0.1.0(transitive)
- Removedbn.js@5.2.1(transitive)
Updated@near-js/transactions@1.2.0
Updated@near-js/types@0.1.0
Updated@near-js/utils@0.2.0