@harmony-js/core
Advanced tools
Comparing version 0.1.30 to 0.1.31
import { Messenger, NewPendingTransactions, NewHeaders, LogSub, Syncing } from '@harmony-js/network'; | ||
import { Transaction } from '@harmony-js/transaction'; | ||
import { StakingTransaction } from '@harmony-js/staking'; | ||
declare class Blockchain { | ||
@@ -95,2 +96,4 @@ messenger: Messenger; | ||
createObservedTransaction(transaction: Transaction): import("@harmony-js/network/dist/providers/emitter").Emitter; | ||
sendRawStakingTransaction(staking: StakingTransaction): Promise<string | undefined>; | ||
createObservedStakingTransaction(staking: StakingTransaction): import("@harmony-js/network/dist/providers/emitter").Emitter; | ||
estimateGas({ to, data, shardID, }: { | ||
@@ -97,0 +100,0 @@ to: string; |
@@ -322,3 +322,3 @@ "use strict"; | ||
_a = tslib_1.__read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending) { | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
@@ -345,2 +345,36 @@ } | ||
}; | ||
Blockchain.prototype.sendRawStakingTransaction = function (staking) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _a, txn, result; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!staking.isSigned() || !staking) { | ||
throw new Error('staking transaction is not signed or not exist'); | ||
} | ||
return [4 /*yield*/, staking.sendTransaction()]; | ||
case 1: | ||
_a = tslib_1.__read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Blockchain.prototype.createObservedStakingTransaction = function (staking) { | ||
try { | ||
staking.sendTransaction().then(function (response) { | ||
var _a = tslib_1.__read(response, 2), txReturned = _a[0], TranID = _a[1]; | ||
txReturned.confirm(TranID).then(function (txConfirmed) { | ||
staking.emitter.resolve(txConfirmed); | ||
}); | ||
}); | ||
return staking.emitter; | ||
} | ||
catch (err) { | ||
throw err; | ||
} | ||
}; | ||
Blockchain.prototype.estimateGas = function (_a) { | ||
@@ -347,0 +381,0 @@ var to = _a.to, data = _a.data, _b = _a.shardID, shardID = _b === void 0 ? this.messenger.currentShard : _b; |
import * as utils from '@harmony-js/utils'; | ||
import { HttpProvider, Messenger, WSProvider, ShardingItem } from '@harmony-js/network'; | ||
import { TransactionFactory, Transaction } from '@harmony-js/transaction'; | ||
import { StakingTransaction } from '@harmony-js/staking'; | ||
import { ContractFactory, Contract } from '@harmony-js/contract'; | ||
@@ -17,2 +18,3 @@ import { Wallet, Account } from '@harmony-js/account'; | ||
Transaction: typeof Transaction; | ||
StakingTransaction: typeof StakingTransaction; | ||
Account: typeof Account; | ||
@@ -19,0 +21,0 @@ Contract: typeof Contract; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var transaction_1 = require("@harmony-js/transaction"); | ||
var staking_1 = require("@harmony-js/staking"); | ||
var contract_1 = require("@harmony-js/contract"); | ||
@@ -28,2 +29,3 @@ var account_1 = require("@harmony-js/account"); | ||
Transaction: transaction_1.Transaction, | ||
StakingTransaction: staking_1.StakingTransaction, | ||
Account: account_1.Account, | ||
@@ -30,0 +32,0 @@ Contract: contract_1.Contract, |
@@ -13,2 +13,3 @@ /** | ||
var transaction = require('@harmony-js/transaction'); | ||
var staking = require('@harmony-js/staking'); | ||
var contract = require('@harmony-js/contract'); | ||
@@ -454,3 +455,3 @@ var account = require('@harmony-js/account'); | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending) { | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
@@ -477,2 +478,36 @@ } | ||
}; | ||
Blockchain.prototype.sendRawStakingTransaction = function (staking$$1) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, txn, result; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!staking$$1.isSigned() || !staking$$1) { | ||
throw new Error('staking transaction is not signed or not exist'); | ||
} | ||
return [4 /*yield*/, staking$$1.sendTransaction()]; | ||
case 1: | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Blockchain.prototype.createObservedStakingTransaction = function (staking$$1) { | ||
try { | ||
staking$$1.sendTransaction().then(function (response) { | ||
var _a = __read(response, 2), txReturned = _a[0], TranID = _a[1]; | ||
txReturned.confirm(TranID).then(function (txConfirmed) { | ||
staking$$1.emitter.resolve(txConfirmed); | ||
}); | ||
}); | ||
return staking$$1.emitter; | ||
} | ||
catch (err) { | ||
throw err; | ||
} | ||
}; | ||
Blockchain.prototype.estimateGas = function (_a) { | ||
@@ -711,2 +746,3 @@ var to = _a.to, data = _a.data, _b = _a.shardID, shardID = _b === void 0 ? this.messenger.currentShard : _b; | ||
Transaction: transaction.Transaction, | ||
StakingTransaction: staking.StakingTransaction, | ||
Account: account.Account, | ||
@@ -713,0 +749,0 @@ Contract: contract.Contract, |
@@ -11,2 +11,3 @@ /** | ||
import { TransactionFactory, Transaction } from '@harmony-js/transaction'; | ||
import { StakingTransaction } from '@harmony-js/staking'; | ||
import { ContractFactory, Contract } from '@harmony-js/contract'; | ||
@@ -452,3 +453,3 @@ import { Wallet, Account, HDNode } from '@harmony-js/account'; | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending) { | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
@@ -475,2 +476,36 @@ } | ||
}; | ||
Blockchain.prototype.sendRawStakingTransaction = function (staking) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, txn, result; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!staking.isSigned() || !staking) { | ||
throw new Error('staking transaction is not signed or not exist'); | ||
} | ||
return [4 /*yield*/, staking.sendTransaction()]; | ||
case 1: | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Blockchain.prototype.createObservedStakingTransaction = function (staking) { | ||
try { | ||
staking.sendTransaction().then(function (response) { | ||
var _a = __read(response, 2), txReturned = _a[0], TranID = _a[1]; | ||
txReturned.confirm(TranID).then(function (txConfirmed) { | ||
staking.emitter.resolve(txConfirmed); | ||
}); | ||
}); | ||
return staking.emitter; | ||
} | ||
catch (err) { | ||
throw err; | ||
} | ||
}; | ||
Blockchain.prototype.estimateGas = function (_a) { | ||
@@ -709,2 +744,3 @@ var to = _a.to, data = _a.data, _b = _a.shardID, shardID = _b === void 0 ? this.messenger.currentShard : _b; | ||
Transaction: Transaction, | ||
StakingTransaction: StakingTransaction, | ||
Account: Account, | ||
@@ -711,0 +747,0 @@ Contract: Contract, |
@@ -6,6 +6,6 @@ /** | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@harmony-js/network'), require('@harmony-js/utils'), require('@harmony-js/crypto'), require('@harmony-js/transaction'), require('@harmony-js/contract'), require('@harmony-js/account')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@harmony-js/network', '@harmony-js/utils', '@harmony-js/crypto', '@harmony-js/transaction', '@harmony-js/contract', '@harmony-js/account'], factory) : | ||
(factory((global.harmonyCore = {}),global['@harmony-js/network'],global['@harmony-js/utils'],global['@harmony-js/crypto'],global['@harmony-js/transaction'],global['@harmony-js/contract'],global['@harmony-js/account'])); | ||
}(this, (function (exports,network,utils,crypto,transaction,contract,account) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@harmony-js/network'), require('@harmony-js/utils'), require('@harmony-js/crypto'), require('@harmony-js/transaction'), require('@harmony-js/staking'), require('@harmony-js/contract'), require('@harmony-js/account')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@harmony-js/network', '@harmony-js/utils', '@harmony-js/crypto', '@harmony-js/transaction', '@harmony-js/staking', '@harmony-js/contract', '@harmony-js/account'], factory) : | ||
(factory((global.harmonyCore = {}),global['@harmony-js/network'],global['@harmony-js/utils'],global['@harmony-js/crypto'],global['@harmony-js/transaction'],global['@harmony-js/staking'],global['@harmony-js/contract'],global['@harmony-js/account'])); | ||
}(this, (function (exports,network,utils,crypto,transaction,staking,contract,account) { 'use strict'; | ||
@@ -449,3 +449,3 @@ /*! ***************************************************************************** | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending) { | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
@@ -472,2 +472,36 @@ } | ||
}; | ||
Blockchain.prototype.sendRawStakingTransaction = function (staking$$1) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, txn, result; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!staking$$1.isSigned() || !staking$$1) { | ||
throw new Error('staking transaction is not signed or not exist'); | ||
} | ||
return [4 /*yield*/, staking$$1.sendTransaction()]; | ||
case 1: | ||
_a = __read.apply(void 0, [_b.sent(), 2]), txn = _a[0], result = _a[1]; | ||
if (txn.isPending()) { | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Blockchain.prototype.createObservedStakingTransaction = function (staking$$1) { | ||
try { | ||
staking$$1.sendTransaction().then(function (response) { | ||
var _a = __read(response, 2), txReturned = _a[0], TranID = _a[1]; | ||
txReturned.confirm(TranID).then(function (txConfirmed) { | ||
staking$$1.emitter.resolve(txConfirmed); | ||
}); | ||
}); | ||
return staking$$1.emitter; | ||
} | ||
catch (err) { | ||
throw err; | ||
} | ||
}; | ||
Blockchain.prototype.estimateGas = function (_a) { | ||
@@ -706,2 +740,3 @@ var to = _a.to, data = _a.data, _b = _a.shardID, shardID = _b === void 0 ? this.messenger.currentShard : _b; | ||
Transaction: transaction.Transaction, | ||
StakingTransaction: staking.StakingTransaction, | ||
Account: account.Account, | ||
@@ -708,0 +743,0 @@ Contract: contract.Contract, |
{ | ||
"name": "@harmony-js/core", | ||
"version": "0.1.30", | ||
"version": "0.1.31", | ||
"description": "harmony core package", | ||
@@ -21,10 +21,11 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@harmony-js/account": "0.1.30", | ||
"@harmony-js/contract": "0.1.30", | ||
"@harmony-js/account": "0.1.31", | ||
"@harmony-js/contract": "0.1.31", | ||
"@harmony-js/crypto": "0.1.28", | ||
"@harmony-js/network": "0.1.29", | ||
"@harmony-js/transaction": "0.1.30", | ||
"@harmony-js/network": "0.1.31", | ||
"@harmony-js/staking": "0.1.31", | ||
"@harmony-js/transaction": "0.1.31", | ||
"@harmony-js/utils": "0.1.28" | ||
}, | ||
"gitHead": "60208454d7013bd74d613b8d31d07a9789144e77" | ||
"gitHead": "09a11f531083647905757788a54b6b9a618a29a6" | ||
} |
@@ -22,2 +22,3 @@ import { | ||
import { Transaction } from '@harmony-js/transaction'; | ||
import { StakingTransaction } from '@harmony-js/staking'; | ||
@@ -398,3 +399,3 @@ class Blockchain { | ||
const [txn, result] = await transaction.sendTransaction(); | ||
if (txn.isPending) { | ||
if (txn.isPending()) { | ||
return result; | ||
@@ -419,2 +420,26 @@ } | ||
async sendRawStakingTransaction(staking: StakingTransaction) { | ||
if (!staking.isSigned() || !staking) { | ||
throw new Error('staking transaction is not signed or not exist'); | ||
} | ||
const [txn, result] = await staking.sendTransaction(); | ||
if (txn.isPending()) { | ||
return result; | ||
} | ||
} | ||
createObservedStakingTransaction(staking: StakingTransaction) { | ||
try { | ||
staking.sendTransaction().then((response: any) => { | ||
const [txReturned, TranID] = response; | ||
txReturned.confirm(TranID).then((txConfirmed: StakingTransaction) => { | ||
staking.emitter.resolve(txConfirmed); | ||
}); | ||
}); | ||
return staking.emitter; | ||
} catch (err) { | ||
throw err; | ||
} | ||
} | ||
@assertObject({ | ||
@@ -421,0 +446,0 @@ to: ['isValidAddress', AssertType.optional], |
@@ -6,2 +6,3 @@ import * as crypto from '@harmony-js/crypto'; | ||
import { TransactionFactory, Transaction } from '@harmony-js/transaction'; | ||
import { StakingTransaction } from '@harmony-js/staking'; | ||
import { ContractFactory, Contract } from '@harmony-js/contract'; | ||
@@ -21,2 +22,3 @@ import { Wallet, Account } from '@harmony-js/account'; | ||
Transaction, | ||
StakingTransaction, | ||
Account, | ||
@@ -23,0 +25,0 @@ 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
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
520497
6092
7
+ Added@harmony-js/staking@0.1.31
+ Added@harmony-js/account@0.1.31(transitive)
+ Added@harmony-js/contract@0.1.31(transitive)
+ Added@harmony-js/network@0.1.31(transitive)
+ Added@harmony-js/staking@0.1.31(transitive)
+ Added@harmony-js/transaction@0.1.290.1.31(transitive)
+ Added@types/node@22.9.4(transitive)
+ Addedtext-encoding@0.7.0(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removed@harmony-js/account@0.1.30(transitive)
- Removed@harmony-js/contract@0.1.30(transitive)
- Removed@harmony-js/transaction@0.1.30(transitive)
- Removed@types/node@22.10.0(transitive)
- Removedundici-types@6.20.0(transitive)
Updated@harmony-js/account@0.1.31
Updated@harmony-js/contract@0.1.31
Updated@harmony-js/network@0.1.31