web3-core-method
Advanced tools
Comparing version 1.6.0 to 1.6.1-rc.0
@@ -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 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
76790
1678
2
+ Added@types/bn.js@4.11.6(transitive)
+ Addedweb3-core-helpers@1.6.1-rc.0(transitive)
+ Addedweb3-core-promievent@1.6.1-rc.0(transitive)
+ Addedweb3-core-subscriptions@1.6.1-rc.0(transitive)
+ Addedweb3-eth-iban@1.6.1-rc.0(transitive)
+ Addedweb3-utils@1.6.1-rc.0(transitive)
- Removedweb3-core-helpers@1.6.0(transitive)
- Removedweb3-core-promievent@1.6.0(transitive)
- Removedweb3-core-subscriptions@1.6.0(transitive)
- Removedweb3-eth-iban@1.6.0(transitive)
- Removedweb3-utils@1.6.0(transitive)
Updatedweb3-core-helpers@1.6.1-rc.0
Updatedweb3-utils@1.6.1-rc.0