Socket
Socket
Sign inDemoInstall

@near-js/providers

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@near-js/providers - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/failover-rpc-provider.d.ts

1

lib/index.d.ts
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

4

lib/index.js
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc