Socket
Socket
Sign inDemoInstall

web3-core-method

Package Overview
Dependencies
68
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.6.1-rc.0

31

lib/index.js

@@ -50,2 +50,3 @@ /*

this.transactionPollingTimeout = options.transactionPollingTimeout || 750;
this.blockHeaderTimeout = options.blockHeaderTimeout || 10; // 10 seconds
this.defaultCommon = options.defaultCommon;

@@ -440,19 +441,25 @@ this.defaultChain = options.defaultChain;

var startWatching = function (existingReceipt) {
let blockHeaderArrived = false;
const startInterval = () => {
intervalId = setInterval(checkConfirmation.bind(null, existingReceipt, true), 1000);
};
// If provider do not support event subscription use polling
if (!this.requestManager.provider.on) {
startInterval();
return startInterval();
}
else {
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
if (err || !blockHeader) {
// fall back to polling
startInterval();
}
else {
checkConfirmation(existingReceipt, false, err, blockHeader, sub);
}
});
}
// Subscribe to new block headers to look for tx receipt
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
blockHeaderArrived = true;
if (err || !blockHeader) {
// fall back to polling
return startInterval();
}
checkConfirmation(existingReceipt, false, err, blockHeader, sub);
});
// Fallback to polling if tx receipt didn't arrived in "blockHeaderTimeout" [10 seconds]
setTimeout(() => {
if (!blockHeaderArrived) {
startInterval();
}
}, this.blockHeaderTimeout * 1000);
}.bind(this);

@@ -459,0 +466,0 @@ // first check if we already have a confirmed transaction

{
"name": "web3-core-method",
"version": "1.6.0",
"version": "1.6.1-rc.0",
"description": "Creates the methods on the web3 modules. This is an internal package.",

@@ -19,6 +19,6 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-core-method",

"@ethersproject/transactions": "^5.0.0-beta.135",
"web3-core-helpers": "1.6.0",
"web3-core-promievent": "1.6.0",
"web3-core-subscriptions": "1.6.0",
"web3-utils": "1.6.0"
"web3-core-helpers": "1.6.1-rc.0",
"web3-core-promievent": "1.6.1-rc.0",
"web3-core-subscriptions": "1.6.1-rc.0",
"web3-utils": "1.6.1-rc.0"
},

@@ -29,3 +29,3 @@ "devDependencies": {

},
"gitHead": "a34afae56647615d7cbdfa227af8a1389476e2d6"
"gitHead": "0dd79a2caeb406fa1fc3093bd836ade930d8cd38"
}

@@ -59,2 +59,3 @@ /*

this.transactionPollingTimeout = options.transactionPollingTimeout || 750;
this.blockHeaderTimeout = options.blockHeaderTimeout || 10; // 10 seconds
this.defaultCommon = options.defaultCommon;

@@ -551,2 +552,4 @@ this.defaultChain = options.defaultChain;

var startWatching = function (existingReceipt) {
let blockHeaderArrived = false;
const startInterval = () => {

@@ -556,14 +559,25 @@ intervalId = setInterval(checkConfirmation.bind(null, existingReceipt, true), 1000);

if (!this.requestManager.provider.on) {
startInterval();
} else {
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
if (err || !blockHeader) {
// fall back to polling
startInterval();
} else {
checkConfirmation(existingReceipt, false, err, blockHeader, sub);
}
});
// If provider do not support event subscription use polling
if(!this.requestManager.provider.on) {
return startInterval();
}
// Subscribe to new block headers to look for tx receipt
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
blockHeaderArrived = true;
if (err || !blockHeader) {
// fall back to polling
return startInterval();
}
checkConfirmation(existingReceipt, false, err, blockHeader, sub);
});
// Fallback to polling if tx receipt didn't arrived in "blockHeaderTimeout" [10 seconds]
setTimeout(() => {
if(!blockHeaderArrived) {
startInterval();
}
}, this.blockHeaderTimeout * 1000);
}.bind(this);

@@ -570,0 +584,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc