@harmony-js/core
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -0,0 +0,0 @@ import { Messenger, NewPendingTransactions, NewHeaders, LogSub, Syncing } from '@harmony-js/network'; |
@@ -27,4 +27,3 @@ import * as utils from '@harmony-js/utils'; | ||
private provider; | ||
constructor(url: string, { chainUrl, chainType, chainId, }: { | ||
chainUrl: string; | ||
constructor(url: string | undefined, { chainType, chainId, }: { | ||
chainType: utils.ChainType; | ||
@@ -31,0 +30,0 @@ chainId: utils.ChainID; |
@@ -15,3 +15,4 @@ "use strict"; | ||
function Harmony(url, _a) { | ||
var _b = _a.chainUrl, chainUrl = _b === void 0 ? defaultUrl : _b, _c = _a.chainType, chainType = _c === void 0 ? "hmy" /* Harmony */ : _c, _d = _a.chainId, chainId = _d === void 0 ? 0 /* Default */ : _d; | ||
if (url === void 0) { url = defaultUrl; } | ||
var _b = _a.chainType, chainType = _b === void 0 ? "hmy" /* Harmony */ : _b, _c = _a.chainId, chainId = _c === void 0 ? 0 /* Default */ : _c; | ||
var _this = _super.call(this, chainType, chainId) || this; | ||
@@ -29,3 +30,3 @@ _this.Modules = { | ||
}; | ||
var providerUrl = url || chainUrl; | ||
var providerUrl = url; | ||
_this.provider = utils.isHttp(providerUrl) | ||
@@ -32,0 +33,0 @@ ? new network_1.HttpProvider(providerUrl) |
@@ -137,3 +137,3 @@ /** | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -279,3 +279,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -307,3 +307,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [address, position, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -322,3 +322,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -390,3 +390,3 @@ result = _c.sent(); | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: to, data: data }], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.chainPrefix)]; | ||
case 1: | ||
@@ -446,3 +446,3 @@ result = _b.sent(); | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -524,3 +524,3 @@ }), | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -534,3 +534,3 @@ }), | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
position: ['isHex', "required" /* required */], | ||
@@ -545,3 +545,3 @@ blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -555,3 +555,3 @@ }), | ||
utils.assertObject({ | ||
to: ['isAddress', "optional" /* optional */], | ||
to: ['isValidAddress', "optional" /* optional */], | ||
data: ['isHex', "optional" /* optional */], | ||
@@ -570,3 +570,4 @@ }), | ||
function Harmony(url, _a) { | ||
var _b = _a.chainUrl, chainUrl = _b === void 0 ? defaultUrl : _b, _c = _a.chainType, chainType = _c === void 0 ? "hmy" /* Harmony */ : _c, _d = _a.chainId, chainId = _d === void 0 ? 0 /* Default */ : _d; | ||
if (url === void 0) { url = defaultUrl; } | ||
var _b = _a.chainType, chainType = _b === void 0 ? "hmy" /* Harmony */ : _b, _c = _a.chainId, chainId = _c === void 0 ? 0 /* Default */ : _c; | ||
var _this = _super.call(this, chainType, chainId) || this; | ||
@@ -584,3 +585,3 @@ _this.Modules = { | ||
}; | ||
var providerUrl = url || chainUrl; | ||
var providerUrl = url; | ||
_this.provider = utils.isHttp(providerUrl) | ||
@@ -587,0 +588,0 @@ ? new network.HttpProvider(providerUrl) |
@@ -0,0 +0,0 @@ export * from './harmony'; |
@@ -9,2 +9,3 @@ /** | ||
import * as crypto from '@harmony-js/crypto'; | ||
import { getAddress } from '@harmony-js/crypto'; | ||
import { TransactionFactory, Transaction } from '@harmony-js/transaction'; | ||
@@ -135,3 +136,3 @@ import { ContractFactory, Contract } from '@harmony-js/contract'; | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -277,3 +278,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -305,3 +306,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [address, position, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [getAddress(address).checksum, position, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -320,3 +321,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -388,3 +389,3 @@ result = _c.sent(); | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: to, data: data }], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: getAddress(to).checksum, data: data }], this.chainPrefix)]; | ||
case 1: | ||
@@ -444,3 +445,3 @@ result = _b.sent(); | ||
assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -522,3 +523,3 @@ }), | ||
assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -532,3 +533,3 @@ }), | ||
assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
position: ['isHex', "required" /* required */], | ||
@@ -543,3 +544,3 @@ blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -553,3 +554,3 @@ }), | ||
assertObject({ | ||
to: ['isAddress', "optional" /* optional */], | ||
to: ['isValidAddress', "optional" /* optional */], | ||
data: ['isHex', "optional" /* optional */], | ||
@@ -568,3 +569,4 @@ }), | ||
function Harmony(url, _a) { | ||
var _b = _a.chainUrl, chainUrl = _b === void 0 ? defaultUrl : _b, _c = _a.chainType, chainType = _c === void 0 ? "hmy" /* Harmony */ : _c, _d = _a.chainId, chainId = _d === void 0 ? 0 /* Default */ : _d; | ||
if (url === void 0) { url = defaultUrl; } | ||
var _b = _a.chainType, chainType = _b === void 0 ? "hmy" /* Harmony */ : _b, _c = _a.chainId, chainId = _c === void 0 ? 0 /* Default */ : _c; | ||
var _this = _super.call(this, chainType, chainId) || this; | ||
@@ -582,3 +584,3 @@ _this.Modules = { | ||
}; | ||
var providerUrl = url || chainUrl; | ||
var providerUrl = url; | ||
_this.provider = isHttp(providerUrl) | ||
@@ -585,0 +587,0 @@ ? new HttpProvider(providerUrl) |
@@ -132,3 +132,3 @@ /** | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -274,3 +274,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -302,3 +302,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [address, position, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -317,3 +317,3 @@ result = _c.sent(); | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [address, blockNumber], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)]; | ||
case 1: | ||
@@ -385,3 +385,3 @@ result = _c.sent(); | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: to, data: data }], this.chainPrefix)]; | ||
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.chainPrefix)]; | ||
case 1: | ||
@@ -441,3 +441,3 @@ result = _b.sent(); | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -519,3 +519,3 @@ }), | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -529,3 +529,3 @@ }), | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
position: ['isHex', "required" /* required */], | ||
@@ -540,3 +540,3 @@ blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
utils.assertObject({ | ||
address: ['isAddress', "required" /* required */], | ||
address: ['isValidAddress', "required" /* required */], | ||
blockNumber: ['isBlockNumber', "optional" /* optional */], | ||
@@ -550,3 +550,3 @@ }), | ||
utils.assertObject({ | ||
to: ['isAddress', "optional" /* optional */], | ||
to: ['isValidAddress', "optional" /* optional */], | ||
data: ['isHex', "optional" /* optional */], | ||
@@ -565,3 +565,4 @@ }), | ||
function Harmony(url, _a) { | ||
var _b = _a.chainUrl, chainUrl = _b === void 0 ? defaultUrl : _b, _c = _a.chainType, chainType = _c === void 0 ? "hmy" /* Harmony */ : _c, _d = _a.chainId, chainId = _d === void 0 ? 0 /* Default */ : _d; | ||
if (url === void 0) { url = defaultUrl; } | ||
var _b = _a.chainType, chainType = _b === void 0 ? "hmy" /* Harmony */ : _b, _c = _a.chainId, chainId = _c === void 0 ? 0 /* Default */ : _c; | ||
var _this = _super.call(this, chainType, chainId) || this; | ||
@@ -579,3 +580,3 @@ _this.Modules = { | ||
}; | ||
var providerUrl = url || chainUrl; | ||
var providerUrl = url; | ||
_this.provider = utils.isHttp(providerUrl) | ||
@@ -582,0 +583,0 @@ ? new network.HttpProvider(providerUrl) |
@@ -0,0 +0,0 @@ import { HttpProvider, Messenger } from '@harmony-js/network'; |
{ | ||
"name": "@harmony-js/core", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "harmony core package", | ||
@@ -21,10 +21,10 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/account": "0.0.22", | ||
"@harmony-js/contract": "0.0.22", | ||
"@harmony-js/crypto": "0.0.22", | ||
"@harmony-js/network": "0.0.22", | ||
"@harmony-js/transaction": "0.0.22", | ||
"@harmony-js/utils": "0.0.22" | ||
"@harmony-js/account": "0.0.23", | ||
"@harmony-js/contract": "0.0.23", | ||
"@harmony-js/crypto": "0.0.23", | ||
"@harmony-js/network": "0.0.23", | ||
"@harmony-js/transaction": "0.0.23", | ||
"@harmony-js/utils": "0.0.23" | ||
}, | ||
"gitHead": "5c53415c333ab12d727fc1808be2e603d40489e0" | ||
"gitHead": "2b54d4deba2169372508da8f0a1816575e25a47c" | ||
} |
@@ -33,12 +33,11 @@ import * as crypto from '@harmony-js/crypto'; | ||
constructor( | ||
url: string, | ||
url: string = defaultUrl, | ||
{ | ||
chainUrl = defaultUrl, | ||
chainType = utils.ChainType.Harmony, | ||
chainId = utils.ChainID.Default, | ||
}: { chainUrl: string; chainType: utils.ChainType; chainId: utils.ChainID }, | ||
}: { chainType: utils.ChainType; chainId: utils.ChainID }, | ||
) { | ||
super(chainType, chainId); | ||
const providerUrl = url || chainUrl; | ||
const providerUrl = url; | ||
@@ -45,0 +44,0 @@ this.provider = utils.isHttp(providerUrl) |
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
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
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
272976
3197
+ Added@harmony-js/account@0.0.23(transitive)
+ Added@harmony-js/contract@0.0.23(transitive)
+ Added@harmony-js/crypto@0.0.23(transitive)
+ Added@harmony-js/network@0.0.23(transitive)
+ Added@harmony-js/transaction@0.0.23(transitive)
+ Added@harmony-js/utils@0.0.23(transitive)
- Removed@harmony-js/account@0.0.22(transitive)
- Removed@harmony-js/contract@0.0.22(transitive)
- Removed@harmony-js/crypto@0.0.22(transitive)
- Removed@harmony-js/network@0.0.22(transitive)
- Removed@harmony-js/transaction@0.0.22(transitive)
- Removed@harmony-js/utils@0.0.22(transitive)
Updated@harmony-js/account@0.0.23
Updated@harmony-js/contract@0.0.23
Updated@harmony-js/crypto@0.0.23
Updated@harmony-js/network@0.0.23
Updated@harmony-js/utils@0.0.23