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

@harmony-js/transaction

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harmony-js/transaction - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

63

dist/index.cjs.js

@@ -341,15 +341,9 @@ /**

this.value =
params && params.value
? new utils.Unit(params.value).asWei().toWei()
: new utils.Unit(0).asWei().toWei();
params && params.value ? new utils.Unit(params.value).asWei().toWei() : new utils.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
// chainid should change with different network settings
this.chainId =
params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.chainId = params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -373,5 +367,3 @@ params && params.signature

// temp setting to be compatible with eth
var fields = this.messenger.chainType === "hmy" /* Harmony */
? transactionFields
: transactionFieldsETH;
var fields = this.messenger.chainType === "hmy" /* Harmony */ ? transactionFields : transactionFieldsETH;
fields.forEach(function (field) {

@@ -381,6 +373,3 @@ var value = _this.txParams[field.name] || [];

// Fixed-width field
if (field.fix === true &&
field.length &&
value.length !== field.length &&
value.length > 0) {
if (field.fix === true && field.length && value.length !== field.length && value.length > 0) {
throw new Error("invalid length for " + field.name);

@@ -440,5 +429,3 @@ }

gas: this.txParams.gasLimit ? utils.numberToHex(this.txParams.gasLimit) : '0x',
gasPrice: this.txParams.gasPrice
? utils.numberToHex(this.txParams.gasPrice)
: '0x',
gasPrice: this.txParams.gasPrice ? utils.numberToHex(this.txParams.gasPrice) : '0x',
value: this.txParams.value ? utils.numberToHex(this.txParams.value) : '0x',

@@ -490,13 +477,8 @@ data: this.txParams.data || '0x',

this.value =
params && params.value
? new utils.Unit(params.value).asWei().toWei()
: new utils.Unit(0).asWei().toWei();
params && params.value ? new utils.Unit(params.value).asWei().toWei() : new utils.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
this.chainId = params && params.chainId ? params.chainId : 0;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -588,3 +570,3 @@ params && params.signature

return __awaiter(this, void 0, void 0, function () {
var res, currentBlock;
var res, currentBlock, currentBlock;
return __generator(this, function (_a) {

@@ -626,5 +608,12 @@ switch (_a.label) {

return [2 /*return*/, false];
case 4: return [3 /*break*/, 6];
case 5: return [2 /*return*/, false];
case 6: return [2 /*return*/];
case 4: return [3 /*break*/, 7];
case 5:
this.txStatus = "PENDING" /* PENDING */;
return [4 /*yield*/, this.getBlockNumber()];
case 6:
currentBlock = _a.sent();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;
return [2 /*return*/, false];
case 7: return [2 /*return*/];
}

@@ -708,4 +697,3 @@ });

this.emitConfirm(this.txStatus);
throw new Error("The transaction is still not confirmed after " + maxAttempts *
interval + " mil seconds.");
throw new Error("The transaction is still not confirmed after " + maxAttempts * interval + " mil seconds.");
case 19: return [2 /*return*/];

@@ -726,3 +714,3 @@ }

case 0:
if (!!this.blockNumbers.includes(data.number)) return [3 /*break*/, 5];
if (!!this.blockNumbers.includes(data.params.result.number)) return [3 /*break*/, 5];
return [4 /*yield*/, this.trackTx(txHash)];

@@ -808,6 +796,3 @@ case 1:

_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [
blockNumber,
true,
])];
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, true])];
case 1:

@@ -814,0 +799,0 @@ block = _a.sent();

@@ -338,15 +338,9 @@ /**

this.value =
params && params.value
? new Unit(params.value).asWei().toWei()
: new Unit(0).asWei().toWei();
params && params.value ? new Unit(params.value).asWei().toWei() : new Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
// chainid should change with different network settings
this.chainId =
params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.chainId = params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -370,5 +364,3 @@ params && params.signature

// temp setting to be compatible with eth
var fields = this.messenger.chainType === "hmy" /* Harmony */
? transactionFields
: transactionFieldsETH;
var fields = this.messenger.chainType === "hmy" /* Harmony */ ? transactionFields : transactionFieldsETH;
fields.forEach(function (field) {

@@ -378,6 +370,3 @@ var value = _this.txParams[field.name] || [];

// Fixed-width field
if (field.fix === true &&
field.length &&
value.length !== field.length &&
value.length > 0) {
if (field.fix === true && field.length && value.length !== field.length && value.length > 0) {
throw new Error("invalid length for " + field.name);

@@ -437,5 +426,3 @@ }

gas: this.txParams.gasLimit ? numberToHex(this.txParams.gasLimit) : '0x',
gasPrice: this.txParams.gasPrice
? numberToHex(this.txParams.gasPrice)
: '0x',
gasPrice: this.txParams.gasPrice ? numberToHex(this.txParams.gasPrice) : '0x',
value: this.txParams.value ? numberToHex(this.txParams.value) : '0x',

@@ -487,13 +474,8 @@ data: this.txParams.data || '0x',

this.value =
params && params.value
? new Unit(params.value).asWei().toWei()
: new Unit(0).asWei().toWei();
params && params.value ? new Unit(params.value).asWei().toWei() : new Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
this.chainId = params && params.chainId ? params.chainId : 0;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -585,3 +567,3 @@ params && params.signature

return __awaiter(this, void 0, void 0, function () {
var res, currentBlock;
var res, currentBlock, currentBlock;
return __generator(this, function (_a) {

@@ -623,5 +605,12 @@ switch (_a.label) {

return [2 /*return*/, false];
case 4: return [3 /*break*/, 6];
case 5: return [2 /*return*/, false];
case 6: return [2 /*return*/];
case 4: return [3 /*break*/, 7];
case 5:
this.txStatus = "PENDING" /* PENDING */;
return [4 /*yield*/, this.getBlockNumber()];
case 6:
currentBlock = _a.sent();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;
return [2 /*return*/, false];
case 7: return [2 /*return*/];
}

@@ -705,4 +694,3 @@ });

this.emitConfirm(this.txStatus);
throw new Error("The transaction is still not confirmed after " + maxAttempts *
interval + " mil seconds.");
throw new Error("The transaction is still not confirmed after " + maxAttempts * interval + " mil seconds.");
case 19: return [2 /*return*/];

@@ -723,3 +711,3 @@ }

case 0:
if (!!this.blockNumbers.includes(data.number)) return [3 /*break*/, 5];
if (!!this.blockNumbers.includes(data.params.result.number)) return [3 /*break*/, 5];
return [4 /*yield*/, this.trackTx(txHash)];

@@ -805,6 +793,3 @@ case 1:

_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [
blockNumber,
true,
])];
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, true])];
case 1:

@@ -811,0 +796,0 @@ block = _a.sent();

@@ -339,15 +339,9 @@ /**

this.value =
params && params.value
? new utils.Unit(params.value).asWei().toWei()
: new utils.Unit(0).asWei().toWei();
params && params.value ? new utils.Unit(params.value).asWei().toWei() : new utils.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
// chainid should change with different network settings
this.chainId =
params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.chainId = params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -371,5 +365,3 @@ params && params.signature

// temp setting to be compatible with eth
var fields = this.messenger.chainType === "hmy" /* Harmony */
? transactionFields
: transactionFieldsETH;
var fields = this.messenger.chainType === "hmy" /* Harmony */ ? transactionFields : transactionFieldsETH;
fields.forEach(function (field) {

@@ -379,6 +371,3 @@ var value = _this.txParams[field.name] || [];

// Fixed-width field
if (field.fix === true &&
field.length &&
value.length !== field.length &&
value.length > 0) {
if (field.fix === true && field.length && value.length !== field.length && value.length > 0) {
throw new Error("invalid length for " + field.name);

@@ -438,5 +427,3 @@ }

gas: this.txParams.gasLimit ? utils.numberToHex(this.txParams.gasLimit) : '0x',
gasPrice: this.txParams.gasPrice
? utils.numberToHex(this.txParams.gasPrice)
: '0x',
gasPrice: this.txParams.gasPrice ? utils.numberToHex(this.txParams.gasPrice) : '0x',
value: this.txParams.value ? utils.numberToHex(this.txParams.value) : '0x',

@@ -488,13 +475,8 @@ data: this.txParams.data || '0x',

this.value =
params && params.value
? new utils.Unit(params.value).asWei().toWei()
: new utils.Unit(0).asWei().toWei();
params && params.value ? new utils.Unit(params.value).asWei().toWei() : new utils.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
this.chainId = params && params.chainId ? params.chainId : 0;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -586,3 +568,3 @@ params && params.signature

return __awaiter(this, void 0, void 0, function () {
var res, currentBlock;
var res, currentBlock, currentBlock;
return __generator(this, function (_a) {

@@ -624,5 +606,12 @@ switch (_a.label) {

return [2 /*return*/, false];
case 4: return [3 /*break*/, 6];
case 5: return [2 /*return*/, false];
case 6: return [2 /*return*/];
case 4: return [3 /*break*/, 7];
case 5:
this.txStatus = "PENDING" /* PENDING */;
return [4 /*yield*/, this.getBlockNumber()];
case 6:
currentBlock = _a.sent();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;
return [2 /*return*/, false];
case 7: return [2 /*return*/];
}

@@ -706,4 +695,3 @@ });

this.emitConfirm(this.txStatus);
throw new Error("The transaction is still not confirmed after " + maxAttempts *
interval + " mil seconds.");
throw new Error("The transaction is still not confirmed after " + maxAttempts * interval + " mil seconds.");
case 19: return [2 /*return*/];

@@ -724,3 +712,3 @@ }

case 0:
if (!!this.blockNumbers.includes(data.number)) return [3 /*break*/, 5];
if (!!this.blockNumbers.includes(data.params.result.number)) return [3 /*break*/, 5];
return [4 /*yield*/, this.trackTx(txHash)];

@@ -806,6 +794,3 @@ case 1:

_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [
blockNumber,
true,
])];
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, true])];
case 1:

@@ -812,0 +797,0 @@ block = _a.sent();

@@ -35,15 +35,9 @@ "use strict";

this.value =
params && params.value
? new utils_1.Unit(params.value).asWei().toWei()
: new utils_1.Unit(0).asWei().toWei();
params && params.value ? new utils_1.Unit(params.value).asWei().toWei() : new utils_1.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
// chainid should change with different network settings
this.chainId =
params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.chainId = params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -67,5 +61,3 @@ params && params.signature

// temp setting to be compatible with eth
var fields = this.messenger.chainType === "hmy" /* Harmony */
? utils_2.transactionFields
: utils_2.transactionFieldsETH;
var fields = this.messenger.chainType === "hmy" /* Harmony */ ? utils_2.transactionFields : utils_2.transactionFieldsETH;
fields.forEach(function (field) {

@@ -75,6 +67,3 @@ var value = _this.txParams[field.name] || [];

// Fixed-width field
if (field.fix === true &&
field.length &&
value.length !== field.length &&
value.length > 0) {
if (field.fix === true && field.length && value.length !== field.length && value.length > 0) {
throw new Error("invalid length for " + field.name);

@@ -134,5 +123,3 @@ }

gas: this.txParams.gasLimit ? utils_1.numberToHex(this.txParams.gasLimit) : '0x',
gasPrice: this.txParams.gasPrice
? utils_1.numberToHex(this.txParams.gasPrice)
: '0x',
gasPrice: this.txParams.gasPrice ? utils_1.numberToHex(this.txParams.gasPrice) : '0x',
value: this.txParams.value ? utils_1.numberToHex(this.txParams.value) : '0x',

@@ -184,13 +171,8 @@ data: this.txParams.data || '0x',

this.value =
params && params.value
? new utils_1.Unit(params.value).asWei().toWei()
: new utils_1.Unit(0).asWei().toWei();
params && params.value ? new utils_1.Unit(params.value).asWei().toWei() : new utils_1.Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
this.chainId = params && params.chainId ? params.chainId : 0;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -282,3 +264,3 @@ params && params.signature

return tslib_1.__awaiter(this, void 0, void 0, function () {
var res, currentBlock;
var res, currentBlock, currentBlock;
return tslib_1.__generator(this, function (_a) {

@@ -320,5 +302,12 @@ switch (_a.label) {

return [2 /*return*/, false];
case 4: return [3 /*break*/, 6];
case 5: return [2 /*return*/, false];
case 6: return [2 /*return*/];
case 4: return [3 /*break*/, 7];
case 5:
this.txStatus = "PENDING" /* PENDING */;
return [4 /*yield*/, this.getBlockNumber()];
case 6:
currentBlock = _a.sent();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;
return [2 /*return*/, false];
case 7: return [2 /*return*/];
}

@@ -402,4 +391,3 @@ });

this.emitConfirm(this.txStatus);
throw new Error("The transaction is still not confirmed after " + maxAttempts *
interval + " mil seconds.");
throw new Error("The transaction is still not confirmed after " + maxAttempts * interval + " mil seconds.");
case 19: return [2 /*return*/];

@@ -420,3 +408,3 @@ }

case 0:
if (!!this.blockNumbers.includes(data.number)) return [3 /*break*/, 5];
if (!!this.blockNumbers.includes(data.params.result.number)) return [3 /*break*/, 5];
return [4 /*yield*/, this.trackTx(txHash)];

@@ -502,6 +490,3 @@ case 1:

_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [
blockNumber,
true,
])];
return [4 /*yield*/, this.messenger.send("hmy_getBlockByNumber" /* GetBlockByNumber */, [blockNumber, true])];
case 1:

@@ -508,0 +493,0 @@ block = _a.sent();

{
"name": "@harmony-js/transaction",
"version": "0.1.6",
"version": "0.1.7",
"description": "transaction package for harmony",

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

"dependencies": {
"@harmony-js/crypto": "0.1.6",
"@harmony-js/network": "0.1.6",
"@harmony-js/crypto": "0.1.7",
"@harmony-js/network": "0.1.7",
"@harmony-js/utils": "0.1.6"
},
"gitHead": "f3c50b210d7f83f4c9aa92d7eca8fe73c988a114"
"gitHead": "b2300964739641778b379b575fdaf45bff34740b"
}

@@ -12,3 +12,3 @@ import {

} from '@harmony-js/crypto';
import {add0xToString, numberToHex, ChainType, Unit} from '@harmony-js/utils';
import { add0xToString, numberToHex, ChainType, Unit } from '@harmony-js/utils';
import {

@@ -23,3 +23,3 @@ Messenger,

} from '@harmony-js/network';
import {TxParams, TxStatus, TransasctionReceipt} from './types';
import { TxParams, TxStatus, TransasctionReceipt } from './types';
import {

@@ -85,15 +85,9 @@ recover,

this.value =
params && params.value
? new Unit(params.value).asWei().toWei()
: new Unit(0).asWei().toWei();
params && params.value ? new Unit(params.value).asWei().toWei() : new Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
// chainid should change with different network settings
this.chainId =
params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.chainId = params && params.chainId ? params.chainId : this.messenger.chainId;
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -120,5 +114,3 @@ params && params.signature

const fields =
this.messenger.chainType === ChainType.Harmony
? transactionFields
: transactionFieldsETH;
this.messenger.chainType === ChainType.Harmony ? transactionFields : transactionFieldsETH;

@@ -128,13 +120,6 @@ fields.forEach((field: any) => {

value = arrayify(
hexlify(
field.transform === 'hex' ? add0xToString(value.toString(16)) : value,
),
hexlify(field.transform === 'hex' ? add0xToString(value.toString(16)) : value),
);
// Fixed-width field
if (
field.fix === true &&
field.length &&
value.length !== field.length &&
value.length > 0
) {
if (field.fix === true && field.length && value.length !== field.length && value.length > 0) {
throw new Error(`invalid length for ${field.name}`);

@@ -204,5 +189,3 @@ }

gas: this.txParams.gasLimit ? numberToHex(this.txParams.gasLimit) : '0x',
gasPrice: this.txParams.gasPrice
? numberToHex(this.txParams.gasPrice)
: '0x',
gasPrice: this.txParams.gasPrice ? numberToHex(this.txParams.gasPrice) : '0x',
value: this.txParams.value ? numberToHex(this.txParams.value) : '0x',

@@ -248,13 +231,8 @@ data: this.txParams.data || '0x',

this.value =
params && params.value
? new Unit(params.value).asWei().toWei()
: new Unit(0).asWei().toWei();
params && params.value ? new Unit(params.value).asWei().toWei() : new Unit(0).asWei().toWei();
this.data = params && params.data ? params.data : '0x';
this.chainId = params && params.chainId ? params.chainId : 0;
this.rawTransaction =
params && params.rawTransaction ? params.rawTransaction : '0x';
this.rawTransaction = params && params.rawTransaction ? params.rawTransaction : '0x';
this.unsignedRawTransaction =
params && params.unsignedRawTransaction
? params.unsignedRawTransaction
: '0x';
params && params.unsignedRawTransaction ? params.unsignedRawTransaction : '0x';
this.signature =

@@ -320,6 +298,3 @@ params && params.signature

}
const res = await this.messenger.send(
RPCMethod.SendRawTransaction,
this.rawTransaction,
);
const res = await this.messenger.send(RPCMethod.SendRawTransaction, this.rawTransaction);

@@ -348,6 +323,3 @@ // temporarilly hard coded

// TODO: regex validation for txHash so we don't get garbage
const res = await this.messenger.send(
RPCMethod.GetTransactionReceipt,
txHash,
);
const res = await this.messenger.send(RPCMethod.GetTransactionReceipt, txHash);

@@ -375,3 +347,5 @@ if (res.isResult() && res.result !== null) {

const currentBlock = await this.getBlockNumber();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;

@@ -381,2 +355,6 @@ return false;

} else {
this.txStatus = TxStatus.PENDING;
const currentBlock = await this.getBlockNumber();
this.blockNumbers.push('0x' + currentBlock.toString('hex'));
this.confirmationCheck += 1;
return false;

@@ -386,7 +364,3 @@ }

async confirm(
txHash: string,
maxAttempts: number = 20,
interval: number = 1000,
) {
async confirm(txHash: string, maxAttempts: number = 20, interval: number = 1000) {
if (this.messenger.provider instanceof HttpProvider) {

@@ -405,2 +379,3 @@ this.txStatus = TxStatus.PENDING;

checkBlock = newBlock;
if (await this.trackTx(txHash)) {

@@ -426,5 +401,3 @@ this.emitConfirm(this.txStatus);

this.emitConfirm(this.txStatus);
throw new Error(
`The transaction is still not confirmed after ${maxAttempts} attempts.`,
);
throw new Error(`The transaction is still not confirmed after ${maxAttempts} attempts.`);
} else {

@@ -443,4 +416,3 @@ try {

throw new Error(
`The transaction is still not confirmed after ${maxAttempts *
interval} mil seconds.`,
`The transaction is still not confirmed after ${maxAttempts * interval} mil seconds.`,
);

@@ -451,6 +423,3 @@ }

socketConfirm(
txHash: string,
maxAttempts: number = 20,
): Promise<Transaction> {
socketConfirm(txHash: string, maxAttempts: number = 20): Promise<Transaction> {
return new Promise((resolve, reject) => {

@@ -460,3 +429,3 @@ const newHeads = Promise.resolve(new NewHeaders(this.messenger));

p.onData(async (data: any) => {
if (!this.blockNumbers.includes(data.number)) {
if (!this.blockNumbers.includes(data.params.result.number)) {
if (await this.trackTx(txHash)) {

@@ -512,6 +481,3 @@ this.emitConfirm(this.txStatus);

try {
const block = await this.messenger.send(RPCMethod.GetBlockByNumber, [
blockNumber,
true,
]);
const block = await this.messenger.send(RPCMethod.GetBlockByNumber, [blockNumber, true]);
if (block.isError()) {

@@ -540,2 +506,2 @@ throw block.message;

}
export {Transaction};
export { Transaction };

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