Skip to content

Commit

Permalink
assignment to function.call (#4918) (#4938)
Browse files Browse the repository at this point in the history
* fix: assignment to function.call (#4918)

* fix: assignment to call

* docs: add changelog

* Update CHANGELOG.md

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Jack Works <jackworks@protonmail.com>
  • Loading branch information
jdevcs and Jack-Works committed Apr 12, 2022
1 parent 1b8d022 commit fab97f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ Released with 1.0.0-beta.37 code base.

### Removes

- Removing the underscore package
- Removing the underscore package

## [1.5.0]

Expand Down Expand Up @@ -463,7 +463,7 @@ Released with 1.0.0-beta.37 code base.
### Changed

- Not considering `tx.chainId` if `tx.common.customChain.chainId` is provided for `web3.eth.accounts.signTransaction` function (#4293)
- Added missing PromiEvent handler types (#4194)
- Added missing PromiEvent handler types (#4194)
- Updated README to include Webpack 5 angular support instructions (#4174)
- Updated the documentation for the `Web3.utils`, removed context for `_` (underscore lib) (#4403)
- Emit subscription id with connect event when creating a subscription (#4300)
Expand Down Expand Up @@ -544,3 +544,4 @@ Released with 1.0.0-beta.37 code base.

### Fixed
- Fix dead link in web3-eth.rst (#4916)
- Fix web3-core-method throws on `f.call = this.call` when intrinsic is frozen (#4918) (#4938)
14 changes: 7 additions & 7 deletions packages/web3-core-method/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Method.prototype.setRequestManager = function (requestManager, accounts) {

Method.prototype.createFunction = function (requestManager, accounts) {
var func = this.buildCall();
func.call = this.call;
Object.defineProperty(func, 'call', { configurable: true, writable: true, value: this.call });

this.setRequestManager(requestManager || this.requestManager, accounts || this.accounts);

Expand All @@ -85,7 +85,7 @@ Method.prototype.createFunction = function (requestManager, accounts) {

Method.prototype.attachToObject = function (obj) {
var func = this.buildCall();
func.call = this.call;
Object.defineProperty(func, 'call', { configurable: true, writable: true, value: this.call });
var name = this.name.split('.');
if (name.length > 1) {
obj[name[0]] = obj[name[0]] || {};
Expand Down Expand Up @@ -181,7 +181,7 @@ Method.prototype.formatOutput = function (result) {
Method.prototype.toPayload = function (args) {
var call = this.getCall(args);
var callback = this.extractCallback(args);

var params = this.formatInput(args);
this.validateArgs(params);

Expand Down Expand Up @@ -551,20 +551,20 @@ Method.prototype._confirmTransaction = function (defer, result, payload) {

// start watching for confirmation depending on the support features of the provider
var startWatching = function (existingReceipt) {
let blockHeaderArrived = false;
let blockHeaderArrived = false;

const startInterval = () => {
intervalId = setInterval(checkConfirmation.bind(null, existingReceipt, true), method.transactionPollingInterval);
};

// If provider do not support event subscription use polling
if(!this.requestManager.provider.on) {
return startInterval();
return startInterval();
}

// Subscribe to new block headers to look for tx receipt
_ethereumCall.subscribe('newBlockHeaders', function (err, blockHeader, sub) {
blockHeaderArrived = true;
blockHeaderArrived = true;

if (err || !blockHeader) {
// fall back to polling
Expand Down Expand Up @@ -706,7 +706,7 @@ Method.prototype.buildCall = function () {
// SENDS the SIGNED SIGNATURE
var sendSignedTx = function (sign) {

var signedPayload = { ... payload,
var signedPayload = { ... payload,
method: 'eth_sendRawTransaction',
params: [sign.rawTransaction]
};
Expand Down

0 comments on commit fab97f7

Please sign in to comment.