Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: assignment to function.call #4918

Merged
merged 6 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -534,3 +534,4 @@ Released with 1.0.0-beta.37 code base.
### Fixed
- Fix jsonrpc payload and response types (#4743) (#4761)
- Allowed more flexibility in typing the overly constrained `provider.disconnect` function (#4833)
- Fix web3-core-method throws on `f.call = this.call` when intrinsic is frozen (#4918)
Jack-Works marked this conversation as resolved.
Show resolved Hide resolved
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