@harmony-js/network
Advanced tools
Comparing version 0.1.14 to 0.1.19
@@ -26,4 +26,5 @@ import { HarmonyCore, ChainType, ChainID } from '@harmony-js/utils'; | ||
JsonRpc: JsonRpc; | ||
defaultShardID?: number; | ||
constructor(provider: HttpProvider | WSProvider, chainType?: ChainType, chainId?: ChainID, config?: object); | ||
readonly currentShard: number | undefined; | ||
readonly currentShard: number; | ||
readonly shardCount: number; | ||
@@ -81,4 +82,5 @@ /** | ||
getCurrentShardID(): number | undefined; | ||
setDefaultShardID(shardID: number): void; | ||
} | ||
export { Messenger }; | ||
//# sourceMappingURL=messenger.d.ts.map |
@@ -33,3 +33,3 @@ "use strict"; | ||
_this.send = function (method, params, rpcPrefix, shardID) { | ||
if (shardID === void 0) { shardID = 0; } | ||
if (shardID === void 0) { shardID = _this.currentShard; } | ||
return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -76,3 +76,3 @@ var rpcMethod, payload, provider, result, e_1; | ||
if (rpcPrefix === void 0) { rpcPrefix = _this.chainPrefix; } | ||
if (shardID === void 0) { shardID = 0; } | ||
if (shardID === void 0) { shardID = _this.currentShard; } | ||
return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -136,3 +136,3 @@ var rpcMethod, id, provider, reProvider_1, payload, error_1; | ||
_this.unsubscribe = function (method, params, rpcPrefix, shardID) { | ||
if (shardID === void 0) { shardID = 0; } | ||
if (shardID === void 0) { shardID = _this.currentShard; } | ||
return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -203,3 +203,3 @@ var rpcMethod, provider, reProvider, payload, response, error_2; | ||
get: function () { | ||
return this.getCurrentShardID(); | ||
return this.getCurrentShardID() || this.defaultShardID || 0; | ||
}, | ||
@@ -349,2 +349,5 @@ enumerable: true, | ||
}; | ||
Messenger.prototype.setDefaultShardID = function (shardID) { | ||
this.defaultShardID = shardID; | ||
}; | ||
return Messenger; | ||
@@ -351,0 +354,0 @@ }(utils_1.HarmonyCore)); |
{ | ||
"name": "@harmony-js/network", | ||
"version": "0.1.14", | ||
"version": "0.1.19", | ||
"description": "network suites for harmony", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "17e721ace88d57e95a5145015342c9fd781559df" | ||
"gitHead": "1a76aeebacecd1e3a1c1eca91517f2889e23171a" | ||
} |
@@ -32,2 +32,3 @@ import { HarmonyCore, ChainType, isString, ChainID, defaultConfig } from '@harmony-js/utils'; | ||
JsonRpc: JsonRpc; | ||
defaultShardID?: number; | ||
@@ -76,4 +77,4 @@ constructor( | ||
} | ||
get currentShard(): number | undefined { | ||
return this.getCurrentShardID(); | ||
get currentShard(): number { | ||
return this.getCurrentShardID() || this.defaultShardID || 0; | ||
} | ||
@@ -95,3 +96,3 @@ | ||
rpcPrefix?: string, | ||
shardID: number = 0, | ||
shardID: number = this.currentShard, | ||
) => { | ||
@@ -107,3 +108,2 @@ this.providerCheck(); | ||
const payload = this.JsonRpc.toPayload(rpcMethod, params); | ||
const provider = this.getShardProvider(shardID); | ||
@@ -198,3 +198,3 @@ this.setResMiddleware( | ||
rpcPrefix: string = this.chainPrefix, | ||
shardID: number = 0, | ||
shardID: number = this.currentShard, | ||
) => { | ||
@@ -245,3 +245,3 @@ let rpcMethod = method; | ||
rpcPrefix?: string, | ||
shardID: number = 0, | ||
shardID: number = this.currentShard, | ||
) => { | ||
@@ -311,3 +311,6 @@ let rpcMethod = method; | ||
} | ||
setDefaultShardID(shardID: number) { | ||
this.defaultShardID = shardID; | ||
} | ||
} | ||
export { Messenger }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
842578
10538