Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@harmony-js/core

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harmony-js/core - npm Package Compare versions

Comparing version 0.0.60 to 0.1.0

3

dist/blockchain.d.ts
import { Messenger, NewPendingTransactions, NewHeaders, LogSub, Syncing } from '@harmony-js/network';
import { HarmonyCore } from '@harmony-js/utils';
import { Transaction } from '@harmony-js/transaction';
declare class Blockchain extends HarmonyCore {
declare class Blockchain {
messenger: Messenger;

@@ -6,0 +5,0 @@ constructor(messenger: Messenger);

@@ -7,8 +7,5 @@ "use strict";

var crypto_1 = require("@harmony-js/crypto");
var Blockchain = /** @class */ (function (_super) {
tslib_1.__extends(Blockchain, _super);
var Blockchain = /** @class */ (function () {
function Blockchain(messenger) {
var _this = _super.call(this, messenger.chainType) || this;
_this.messenger = messenger;
return _this;
this.messenger = messenger;
}

@@ -35,3 +32,3 @@ Blockchain.prototype.setMessenger = function (messenger) {

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto_1.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto_1.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -49,3 +46,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.messenger.chainPrefix)];
case 1:

@@ -67,3 +64,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -85,3 +82,3 @@ result = _c.sent();

switch (_d.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -100,3 +97,3 @@ result = _d.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.messenger.chainPrefix)];
case 1:

@@ -115,3 +112,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -133,3 +130,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.messenger.chainPrefix)];
case 1:

@@ -148,3 +145,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.messenger.chainPrefix)];
case 1:

@@ -163,3 +160,3 @@ result = _c.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -181,3 +178,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -199,3 +196,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto_1.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto_1.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -239,3 +236,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.messenger.chainPrefix)];
case 1:

@@ -254,3 +251,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto_1.getAddress(address).checksum, position, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto_1.getAddress(address).checksum, position, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -269,3 +266,3 @@ result = _c.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto_1.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto_1.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -287,3 +284,3 @@ result = _c.sent();

}
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction.txPayload], this.chainPrefix)];
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction.txPayload], this.messenger.chainPrefix)];
case 1:

@@ -336,3 +333,3 @@ result = _a.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto_1.getAddress(to).checksum, data: data }], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto_1.getAddress(to).checksum, data: data }], this.messenger.chainPrefix)];
case 1:

@@ -350,3 +347,3 @@ result = _b.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.messenger.chainPrefix)];
case 1:

@@ -365,3 +362,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -521,4 +518,4 @@ result = _c.sent();

return Blockchain;
}(utils_1.HarmonyCore));
}());
exports.Blockchain = Blockchain;
//# sourceMappingURL=blockchain.js.map

@@ -30,4 +30,6 @@ import * as utils from '@harmony-js/utils';

setProvider(provider: string | HttpProvider | WSProvider): void;
setChainId(chainId: utils.ChainID): void;
setChainType(chainType: utils.ChainType): void;
private onInitSetProvider;
}
//# sourceMappingURL=harmony.d.ts.map

@@ -61,2 +61,16 @@ "use strict";

};
Harmony.prototype.setChainId = function (chainId) {
this.chainId = chainId;
this.messenger.setChainId(this.chainId);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.setChainType = function (chainType) {
this.chainType = chainType;
this.messenger.setChainType(this.chainType);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.onInitSetProvider = function (providerUrl) {

@@ -63,0 +77,0 @@ return utils.isHttp(providerUrl)

@@ -110,8 +110,5 @@ /**

var Blockchain = /** @class */ (function (_super) {
__extends(Blockchain, _super);
var Blockchain = /** @class */ (function () {
function Blockchain(messenger) {
var _this = _super.call(this, messenger.chainType) || this;
_this.messenger = messenger;
return _this;
this.messenger = messenger;
}

@@ -138,3 +135,3 @@ Blockchain.prototype.setMessenger = function (messenger) {

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -152,3 +149,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.messenger.chainPrefix)];
case 1:

@@ -170,3 +167,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -188,3 +185,3 @@ result = _c.sent();

switch (_d.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -203,3 +200,3 @@ result = _d.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.messenger.chainPrefix)];
case 1:

@@ -218,3 +215,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -236,3 +233,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.messenger.chainPrefix)];
case 1:

@@ -251,3 +248,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.messenger.chainPrefix)];
case 1:

@@ -266,3 +263,3 @@ result = _c.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -284,3 +281,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -302,3 +299,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -342,3 +339,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.messenger.chainPrefix)];
case 1:

@@ -357,3 +354,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -372,3 +369,3 @@ result = _c.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -390,3 +387,3 @@ result = _c.sent();

}
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction$$1.txPayload], this.chainPrefix)];
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction$$1.txPayload], this.messenger.chainPrefix)];
case 1:

@@ -439,3 +436,3 @@ result = _a.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.messenger.chainPrefix)];
case 1:

@@ -453,3 +450,3 @@ result = _b.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.messenger.chainPrefix)];
case 1:

@@ -468,3 +465,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -624,3 +621,3 @@ result = _c.sent();

return Blockchain;
}(utils.HarmonyCore));
}());

@@ -677,2 +674,16 @@ var Harmony = /** @class */ (function (_super) {

};
Harmony.prototype.setChainId = function (chainId) {
this.chainId = chainId;
this.messenger.setChainId(this.chainId);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.setChainType = function (chainType) {
this.chainType = chainType;
this.messenger.setChainType(this.chainType);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.onInitSetProvider = function (providerUrl) {

@@ -679,0 +690,0 @@ return utils.isHttp(providerUrl)

@@ -7,3 +7,3 @@ /**

import * as utils from '@harmony-js/utils';
import { assertObject, HarmonyCore, defaultConfig, isHttp, isWs } from '@harmony-js/utils';
import { assertObject, defaultConfig, isHttp, isWs, HarmonyCore } from '@harmony-js/utils';
import * as crypto from '@harmony-js/crypto';

@@ -109,8 +109,5 @@ import { getAddress } from '@harmony-js/crypto';

var Blockchain = /** @class */ (function (_super) {
__extends(Blockchain, _super);
var Blockchain = /** @class */ (function () {
function Blockchain(messenger) {
var _this = _super.call(this, messenger.chainType) || this;
_this.messenger = messenger;
return _this;
this.messenger = messenger;
}

@@ -137,3 +134,3 @@ Blockchain.prototype.setMessenger = function (messenger) {

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -151,3 +148,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.messenger.chainPrefix)];
case 1:

@@ -169,3 +166,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -187,3 +184,3 @@ result = _c.sent();

switch (_d.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -202,3 +199,3 @@ result = _d.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.messenger.chainPrefix)];
case 1:

@@ -217,3 +214,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -235,3 +232,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.messenger.chainPrefix)];
case 1:

@@ -250,3 +247,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.messenger.chainPrefix)];
case 1:

@@ -265,3 +262,3 @@ result = _c.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -283,3 +280,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -301,3 +298,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -341,3 +338,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.messenger.chainPrefix)];
case 1:

@@ -356,3 +353,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [getAddress(address).checksum, position, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [getAddress(address).checksum, position, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -371,3 +368,3 @@ result = _c.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -389,3 +386,3 @@ result = _c.sent();

}
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction.txPayload], this.chainPrefix)];
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction.txPayload], this.messenger.chainPrefix)];
case 1:

@@ -438,3 +435,3 @@ result = _a.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: getAddress(to).checksum, data: data }], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: getAddress(to).checksum, data: data }], this.messenger.chainPrefix)];
case 1:

@@ -452,3 +449,3 @@ result = _b.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.messenger.chainPrefix)];
case 1:

@@ -467,3 +464,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -623,3 +620,3 @@ result = _c.sent();

return Blockchain;
}(HarmonyCore));
}());

@@ -676,2 +673,16 @@ var Harmony = /** @class */ (function (_super) {

};
Harmony.prototype.setChainId = function (chainId) {
this.chainId = chainId;
this.messenger.setChainId(this.chainId);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.setChainType = function (chainType) {
this.chainType = chainType;
this.messenger.setChainType(this.chainType);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.onInitSetProvider = function (providerUrl) {

@@ -678,0 +689,0 @@ return isHttp(providerUrl)

@@ -105,8 +105,5 @@ /**

var Blockchain = /** @class */ (function (_super) {
__extends(Blockchain, _super);
var Blockchain = /** @class */ (function () {
function Blockchain(messenger) {
var _this = _super.call(this, messenger.chainType) || this;
_this.messenger = messenger;
return _this;
this.messenger = messenger;
}

@@ -133,3 +130,3 @@ Blockchain.prototype.setMessenger = function (messenger) {

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBalance" /* GetBalance */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -147,3 +144,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_blockNumber" /* BlockNumber */, [], this.messenger.chainPrefix)];
case 1:

@@ -165,3 +162,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByHash" /* GetBlockByHash */, [blockHash, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -183,3 +180,3 @@ result = _c.sent();

switch (_d.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, returnObject], this.messenger.chainPrefix)];
case 1:

@@ -198,3 +195,3 @@ result = _d.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByHash" /* GetBlockTransactionCountByHash */, [blockHash], this.messenger.chainPrefix)];
case 1:

@@ -213,3 +210,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getBlockTransactionCountByNumber" /* GetBlockTransactionCountByNumber */, [blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -231,3 +228,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockHashAndIndex" /* GetTransactionByBlockHashAndIndex */, [blockHash, index], this.messenger.chainPrefix)];
case 1:

@@ -246,3 +243,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByBlockNumberAndIndex" /* GetTransactionByBlockNumberAndIndex */, [blockNumber, index], this.messenger.chainPrefix)];
case 1:

@@ -261,3 +258,3 @@ result = _c.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionByHash" /* GetTransactionByHash */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -279,3 +276,3 @@ result = _b.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionReceipt" /* GetTransactionReceipt */, [txnHash], this.messenger.chainPrefix)];
case 1:

@@ -297,3 +294,3 @@ result = _b.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getCode" /* GetCode */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -337,3 +334,3 @@ result = _c.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_protocolVersion" /* ProtocalVersion */, [], this.messenger.chainPrefix)];
case 1:

@@ -352,3 +349,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getStorageAt" /* GetStorageAt */, [crypto.getAddress(address).checksum, position, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -367,3 +364,3 @@ result = _c.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_getTransactionCount" /* GetTransactionCount */, [crypto.getAddress(address).checksum, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -385,3 +382,3 @@ result = _c.sent();

}
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction$$1.txPayload], this.chainPrefix)];
return [4 /*yield*/, this.messenger.send("hmy_sendTransaction" /* SendTransaction */, [transaction$$1.txPayload], this.messenger.chainPrefix)];
case 1:

@@ -434,3 +431,3 @@ result = _a.sent();

switch (_b.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_estimateGas" /* EstimateGas */, [{ to: crypto.getAddress(to).checksum, data: data }], this.messenger.chainPrefix)];
case 1:

@@ -448,3 +445,3 @@ result = _b.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_gasPrice" /* GasPrice */, [], this.messenger.chainPrefix)];
case 1:

@@ -463,3 +460,3 @@ result = _a.sent();

switch (_c.label) {
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.chainPrefix)];
case 0: return [4 /*yield*/, this.messenger.send("hmy_call" /* Call */, [payload, blockNumber], this.messenger.chainPrefix)];
case 1:

@@ -619,3 +616,3 @@ result = _c.sent();

return Blockchain;
}(utils.HarmonyCore));
}());

@@ -672,2 +669,16 @@ var Harmony = /** @class */ (function (_super) {

};
Harmony.prototype.setChainId = function (chainId) {
this.chainId = chainId;
this.messenger.setChainId(this.chainId);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.setChainType = function (chainType) {
this.chainType = chainType;
this.messenger.setChainType(this.chainType);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
};
Harmony.prototype.onInitSetProvider = function (providerUrl) {

@@ -674,0 +685,0 @@ return utils.isHttp(providerUrl)

{
"name": "@harmony-js/core",
"version": "0.0.60",
"version": "0.1.0",
"description": "harmony core package",

@@ -21,10 +21,10 @@ "main": "dist/index.js",

"dependencies": {
"@harmony-js/account": "0.0.60",
"@harmony-js/contract": "0.0.60",
"@harmony-js/crypto": "0.0.60",
"@harmony-js/network": "0.0.60",
"@harmony-js/transaction": "0.0.60",
"@harmony-js/utils": "0.0.60"
"@harmony-js/account": "0.1.0",
"@harmony-js/contract": "0.1.0",
"@harmony-js/crypto": "0.1.0",
"@harmony-js/network": "0.1.0",
"@harmony-js/transaction": "0.1.0",
"@harmony-js/utils": "0.1.0"
},
"gitHead": "dce1b4d29ea5261dea16799fccde857c8ae365eb"
"gitHead": "2c07e706979b3c891e927e3b97a222e47b8a2f55"
}

@@ -15,3 +15,3 @@ import {

AssertType,
HarmonyCore,
// HarmonyCore,
DefaultBlockParams,

@@ -24,7 +24,6 @@ } from '@harmony-js/utils';

class Blockchain extends HarmonyCore {
class Blockchain {
messenger: Messenger;
constructor(messenger: Messenger) {
super(messenger.chainType);
this.messenger = messenger;

@@ -60,3 +59,3 @@ }

[getAddress(address).checksum, blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -70,3 +69,3 @@ return this.getRpcResult(result);

[],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -92,3 +91,3 @@ return this.getRpcResult(result);

[blockHash, returnObject],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -115,3 +114,3 @@ return this.getRpcResult(result);

[blockNumber, returnObject],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -128,3 +127,3 @@ return this.getRpcResult(result);

[blockHash],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -141,3 +140,3 @@ return this.getRpcResult(result);

[blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -164,3 +163,3 @@ return this.getRpcResult(result);

[blockHash, index],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -184,3 +183,3 @@ return this.getRpcResult(result);

[blockNumber, index],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -197,3 +196,3 @@ return this.getRpcResult(result);

[txnHash],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -213,3 +212,3 @@ return this.getRpcResult(result);

[txnHash],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -235,3 +234,3 @@ return this.getRpcResult(result);

[getAddress(address).checksum, blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -256,3 +255,3 @@ return this.getRpcResult(result);

[],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -279,3 +278,3 @@ return this.getRpcResult(result);

[getAddress(address).checksum, position, blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -299,3 +298,3 @@ return this.getRpcResult(result);

[getAddress(address).checksum, blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -312,3 +311,3 @@ return this.getRpcResult(result);

[transaction.txPayload],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -351,3 +350,3 @@ return this.getRpcResult(result);

[{to: getAddress(to).checksum, data}],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -361,3 +360,3 @@ return this.getRpcResult(result);

[],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -377,3 +376,3 @@ return this.getRpcResult(result);

[payload, blockNumber],
this.chainPrefix,
this.messenger.chainPrefix,
);

@@ -380,0 +379,0 @@ return this.getRpcResult(result);

import * as crypto from '@harmony-js/crypto';
import * as utils from '@harmony-js/utils';
import { HttpProvider, Messenger, WSProvider } from '@harmony-js/network';
import { TransactionFactory, Transaction } from '@harmony-js/transaction';
import { ContractFactory, Contract } from '@harmony-js/contract';
import { Wallet, Account } from '@harmony-js/account';
import { Blockchain } from './blockchain';
import { HarmonyConfig } from './util';
import {HttpProvider, Messenger, WSProvider} from '@harmony-js/network';
import {TransactionFactory, Transaction} from '@harmony-js/transaction';
import {ContractFactory, Contract} from '@harmony-js/contract';
import {Wallet, Account} from '@harmony-js/account';
import {Blockchain} from './blockchain';
import {HarmonyConfig} from './util';

@@ -52,3 +52,3 @@ export class Harmony extends utils.HarmonyCore {

}
setProvider(provider: string | HttpProvider | WSProvider): void {
public setProvider(provider: string | HttpProvider | WSProvider): void {
if (utils.isHttp(provider) && typeof provider === 'string') {

@@ -68,2 +68,17 @@ this.provider = new HttpProvider(provider);

}
public setChainId(chainId: utils.ChainID) {
this.chainId = chainId;
this.messenger.setChainId(this.chainId);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
}
public setChainType(chainType: utils.ChainType) {
this.chainType = chainType;
this.messenger.setChainType(this.chainType);
this.blockchain.setMessenger(this.messenger);
this.wallet.setMessenger(this.messenger);
this.transactions.setMessenger(this.messenger);
}
private onInitSetProvider(providerUrl: string): HttpProvider | WSProvider {

@@ -70,0 +85,0 @@ return utils.isHttp(providerUrl)

{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"declarationDir": "dist"
"outDir": "dist"
},
"include": ["src", "../../typings/**/*.d.ts", "../harmony-utils/src/core.ts"],
"references": [
{ "path": "../harmony-account" },
{ "path": "../harmony-crypto" },
{ "path": "../harmony-utils" },
{ "path": "../harmony-network" },
{ "path": "../harmony-transaction" },
{ "path": "../harmony-contract" }
{"path": "../harmony-account"},
{"path": "../harmony-crypto"},
{"path": "../harmony-utils"},
{"path": "../harmony-network"},
{"path": "../harmony-transaction"},
{"path": "../harmony-contract"}
]
}

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

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