Updated dist files.
This commit is contained in:
parent
88f2f51266
commit
24757f1064
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@ -1 +1 @@
|
|||||||
export declare const version = "4.0.10";
|
export declare const version = "4.0.11";
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.10";
|
exports.version = "4.0.11";
|
||||||
|
@ -655,7 +655,7 @@ var ContractFactory = /** @class */ (function () {
|
|||||||
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||||
});
|
});
|
||||||
// Make sure the call matches the constructor signature
|
// Make sure the call matches the constructor signature
|
||||||
errors.checkArgumentCount(args.length, this.interface.deployFunction.inputs.length, 'in Contract constructor');
|
errors.checkArgumentCount(args.length, this.interface.deployFunction.inputs.length, ' in Contract constructor');
|
||||||
// Set the data to the bytecode + the encoded constructor arguments
|
// Set the data to the bytecode + the encoded constructor arguments
|
||||||
tx.data = this.interface.deployFunction.encode(this.bytecode, args);
|
tx.data = this.interface.deployFunction.encode(this.bytecode, args);
|
||||||
return tx;
|
return tx;
|
||||||
|
103
dist/ethers.js
vendored
103
dist/ethers.js
vendored
@ -1,7 +1,7 @@
|
|||||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.10";
|
exports.version = "4.0.11";
|
||||||
|
|
||||||
},{}],2:[function(require,module,exports){
|
},{}],2:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -703,7 +703,7 @@ var ContractFactory = /** @class */ (function () {
|
|||||||
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||||
});
|
});
|
||||||
// Make sure the call matches the constructor signature
|
// Make sure the call matches the constructor signature
|
||||||
errors.checkArgumentCount(args.length, this.interface.deployFunction.inputs.length, 'in Contract constructor');
|
errors.checkArgumentCount(args.length, this.interface.deployFunction.inputs.length, ' in Contract constructor');
|
||||||
// Set the data to the bytecode + the encoded constructor arguments
|
// Set the data to the bytecode + the encoded constructor arguments
|
||||||
tx.data = this.interface.deployFunction.encode(this.bytecode, args);
|
tx.data = this.interface.deployFunction.encode(this.bytecode, args);
|
||||||
return tx;
|
return tx;
|
||||||
@ -10276,11 +10276,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
// Events being listened to
|
// Events being listened to
|
||||||
_this._events = [];
|
_this._events = [];
|
||||||
_this._pollingInterval = 4000;
|
_this._pollingInterval = 4000;
|
||||||
// We use this to track recent emitted events; for example, if we emit a "block" of 100
|
_this._emitted = { block: -2 };
|
||||||
// and we get a `getBlock(100)` request which would result in null, we should retry
|
|
||||||
// until we get a response. This provides devs with a consistent view. Similarly for
|
|
||||||
// transaction hashes.
|
|
||||||
_this._emitted = { block: _this._lastBlockNumber };
|
|
||||||
_this._fastQueryDate = 0;
|
_this._fastQueryDate = 0;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -10292,28 +10288,40 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
if (blockNumber === _this._lastBlockNumber) {
|
if (blockNumber === _this._lastBlockNumber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_this._lastBlockNumber === -2) {
|
// First polling cycle, trigger a "block" events
|
||||||
_this._lastBlockNumber = blockNumber - 1;
|
if (_this._emitted.block === -2) {
|
||||||
|
_this._emitted.block = blockNumber - 1;
|
||||||
}
|
}
|
||||||
var _loop_1 = function (i) {
|
// Notify all listener for each block that has passed
|
||||||
if (_this._emitted.block < i) {
|
for (var i = _this._emitted.block + 1; i <= blockNumber; i++) {
|
||||||
_this._emitted.block = i;
|
_this.emit('block', i);
|
||||||
|
}
|
||||||
|
// The emitted block was updated, check for obsolete events
|
||||||
|
if (_this._emitted.block !== blockNumber) {
|
||||||
|
_this._emitted.block = blockNumber;
|
||||||
|
Object.keys(_this._emitted).forEach(function (key) {
|
||||||
|
// The block event does not expire
|
||||||
|
if (key === 'block') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// The block we were at when we emitted this event
|
||||||
|
var eventBlockNumber = _this._emitted[key];
|
||||||
|
// We cannot garbage collect pending transactions or blocks here
|
||||||
|
// They should be garbage collected by the Provider when setting
|
||||||
|
// "pending" events
|
||||||
|
if (eventBlockNumber === 'pending') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Evict any transaction hashes or block hashes over 12 blocks
|
// Evict any transaction hashes or block hashes over 12 blocks
|
||||||
// old, since they should not return null anyways
|
// old, since they should not return null anyways
|
||||||
Object.keys(_this._emitted).forEach(function (key) {
|
if (blockNumber - eventBlockNumber > 12) {
|
||||||
if (key === 'block') {
|
delete _this._emitted[key];
|
||||||
return;
|
}
|
||||||
}
|
});
|
||||||
if (_this._emitted[key] > i + 12) {
|
}
|
||||||
delete _this._emitted[key];
|
// First polling cycle
|
||||||
}
|
if (_this._lastBlockNumber === -2) {
|
||||||
});
|
_this._lastBlockNumber = blockNumber - 1;
|
||||||
}
|
|
||||||
_this.emit('block', i);
|
|
||||||
};
|
|
||||||
// Notify all listener for each block that has passed
|
|
||||||
for (var i = _this._lastBlockNumber + 1; i <= blockNumber; i++) {
|
|
||||||
_loop_1(i);
|
|
||||||
}
|
}
|
||||||
// Sweep balances and remove addresses we no longer have events for
|
// Sweep balances and remove addresses we no longer have events for
|
||||||
var newBalances = {};
|
var newBalances = {};
|
||||||
@ -10339,12 +10347,12 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
newBalances[address_2] = _this._balances[address_2];
|
newBalances[address_2] = _this._balances[address_2];
|
||||||
}
|
}
|
||||||
_this.getBalance(address_2, 'latest').then(function (balance) {
|
_this.getBalance(address_2, 'latest').then(function (balance) {
|
||||||
var lastBalance = this._balances[address_2];
|
var lastBalance = _this._balances[address_2];
|
||||||
if (lastBalance && balance.eq(lastBalance)) {
|
if (lastBalance && balance.eq(lastBalance)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._balances[address_2] = balance;
|
_this._balances[address_2] = balance;
|
||||||
this.emit(address_2, balance);
|
_this.emit(address_2, balance);
|
||||||
return null;
|
return null;
|
||||||
}).catch(function (error) { _this.emit('error', error); });
|
}).catch(function (error) { _this.emit('error', error); });
|
||||||
break;
|
break;
|
||||||
@ -10382,8 +10390,10 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
this.doPoll();
|
this.doPoll();
|
||||||
};
|
};
|
||||||
BaseProvider.prototype.resetEventsBlock = function (blockNumber) {
|
BaseProvider.prototype.resetEventsBlock = function (blockNumber) {
|
||||||
this._lastBlockNumber = blockNumber;
|
this._lastBlockNumber = blockNumber - 1;
|
||||||
this._doPoll();
|
if (this.polling) {
|
||||||
|
this._doPoll();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Object.defineProperty(BaseProvider.prototype, "network", {
|
Object.defineProperty(BaseProvider.prototype, "network", {
|
||||||
get: function () {
|
get: function () {
|
||||||
@ -10397,10 +10407,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(BaseProvider.prototype, "blockNumber", {
|
Object.defineProperty(BaseProvider.prototype, "blockNumber", {
|
||||||
get: function () {
|
get: function () {
|
||||||
if (this._lastBlockNumber < 0) {
|
return this._fastBlockNumber;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this._lastBlockNumber;
|
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
@ -10474,13 +10481,15 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
// this will be used once we move to the WebSocket or other alternatives to polling
|
// this will be used once we move to the WebSocket or other alternatives to polling
|
||||||
BaseProvider.prototype.waitForTransaction = function (transactionHash, confirmations) {
|
BaseProvider.prototype.waitForTransaction = function (transactionHash, confirmations) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (!confirmations) {
|
if (confirmations == null) {
|
||||||
confirmations = 1;
|
confirmations = 1;
|
||||||
}
|
}
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||||
if (receipt == null || receipt.confirmations < confirmations) {
|
if (receipt == null && confirmations !== 0) {
|
||||||
return undefined;
|
if (receipt.confirmations < confirmations) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return receipt;
|
return receipt;
|
||||||
});
|
});
|
||||||
@ -10596,10 +10605,17 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
if (hash != null && tx.hash !== hash) {
|
if (hash != null && tx.hash !== hash) {
|
||||||
errors.throwError('Transaction hash mismatch from Provider.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
errors.throwError('Transaction hash mismatch from Provider.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
||||||
}
|
}
|
||||||
this._emitted['t:' + tx.hash] = 'pending';
|
|
||||||
// @TODO: (confirmations? number, timeout? number)
|
// @TODO: (confirmations? number, timeout? number)
|
||||||
result.wait = function (confirmations) {
|
result.wait = function (confirmations) {
|
||||||
|
// We know this transaction *must* exist (whether it gets mined is
|
||||||
|
// another story), so setting an emitted value forces us to
|
||||||
|
// wait even if the node returns null for the receipt
|
||||||
|
if (confirmations !== 0) {
|
||||||
|
_this._emitted['t:' + tx.hash] = 'pending';
|
||||||
|
}
|
||||||
return _this.waitForTransaction(tx.hash, confirmations).then(function (receipt) {
|
return _this.waitForTransaction(tx.hash, confirmations).then(function (receipt) {
|
||||||
|
// No longer pending, allow the polling loop to garbage collect this
|
||||||
|
_this._emitted['t:' + tx.hash] = receipt.blockNumber;
|
||||||
if (receipt.status === 0) {
|
if (receipt.status === 0) {
|
||||||
errors.throwError('transaction failed', errors.CALL_EXCEPTION, {
|
errors.throwError('transaction failed', errors.CALL_EXCEPTION, {
|
||||||
transactionHash: tx.hash,
|
transactionHash: tx.hash,
|
||||||
@ -10677,7 +10693,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (blockNumber_1 > _this._emitted.block) {
|
if (blockNumber_1 <= _this._emitted.block) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -11864,6 +11880,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
var seq = Promise.resolve();
|
var seq = Promise.resolve();
|
||||||
hashes.forEach(function (hash) {
|
hashes.forEach(function (hash) {
|
||||||
|
// @TODO: This should be garbage collected at some point... How? When?
|
||||||
self._emitted['t:' + hash.toLowerCase()] = 'pending';
|
self._emitted['t:' + hash.toLowerCase()] = 'pending';
|
||||||
seq = seq.then(function () {
|
seq = seq.then(function () {
|
||||||
return self.getTransaction(hash).then(function (tx) {
|
return self.getTransaction(hash).then(function (tx) {
|
||||||
@ -12755,7 +12772,7 @@ var CoderArray = /** @class */ (function (_super) {
|
|||||||
count = value.length;
|
count = value.length;
|
||||||
result = uint256Coder.encode(count);
|
result = uint256Coder.encode(count);
|
||||||
}
|
}
|
||||||
errors.checkArgumentCount(count, value.length, 'in coder array' + (this.localName ? (" " + this.localName) : ""));
|
errors.checkArgumentCount(count, value.length, ' in coder array' + (this.localName ? (" " + this.localName) : ""));
|
||||||
var coders = [];
|
var coders = [];
|
||||||
for (var i = 0; i < value.length; i++) {
|
for (var i = 0; i < value.length; i++) {
|
||||||
coders.push(this.coder);
|
coders.push(this.coder);
|
||||||
@ -14056,7 +14073,7 @@ var _DeployDescription = /** @class */ (function (_super) {
|
|||||||
value: bytecode
|
value: bytecode
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
errors.checkArgumentCount(params.length, this.inputs.length, 'in Interface constructor');
|
errors.checkArgumentCount(params.length, this.inputs.length, ' in Interface constructor');
|
||||||
try {
|
try {
|
||||||
return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));
|
return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));
|
||||||
}
|
}
|
||||||
@ -14077,7 +14094,7 @@ var _FunctionDescription = /** @class */ (function (_super) {
|
|||||||
return _super !== null && _super.apply(this, arguments) || this;
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
}
|
}
|
||||||
_FunctionDescription.prototype.encode = function (params) {
|
_FunctionDescription.prototype.encode = function (params) {
|
||||||
errors.checkArgumentCount(params.length, this.inputs.length, 'in interface function ' + this.name);
|
errors.checkArgumentCount(params.length, this.inputs.length, ' in interface function ' + this.name);
|
||||||
try {
|
try {
|
||||||
return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);
|
return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);
|
||||||
}
|
}
|
||||||
|
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/ethers.types.txt
vendored
6
dist/ethers.types.txt
vendored
@ -262,7 +262,7 @@ declare module 'ethers/utils/shims' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/_version' {
|
declare module 'ethers/_version' {
|
||||||
export const version = "4.0.10";
|
export const version = "4.0.11";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/utils/bignumber' {
|
declare module 'ethers/utils/bignumber' {
|
||||||
@ -716,7 +716,9 @@ declare module 'ethers/providers/base-provider' {
|
|||||||
import { Transaction } from 'ethers/utils/transaction';
|
import { Transaction } from 'ethers/utils/transaction';
|
||||||
import { Network, Networkish } from 'ethers/utils/networks';
|
import { Network, Networkish } from 'ethers/utils/networks';
|
||||||
export class BaseProvider extends Provider {
|
export class BaseProvider extends Provider {
|
||||||
protected _emitted: any;
|
protected _emitted: {
|
||||||
|
[eventName: string]: number | 'pending';
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* ready
|
* ready
|
||||||
*
|
*
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "4.0.10",
|
"version": "4.0.11",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "4.0.10",
|
"version": "4.0.11",
|
||||||
"description": "Ethereum wallet library.",
|
"description": "Ethereum wallet library.",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
|
4
providers/base-provider.d.ts
vendored
4
providers/base-provider.d.ts
vendored
@ -7,7 +7,9 @@ import { Network, Networkish } from '../utils/networks';
|
|||||||
export declare class BaseProvider extends Provider {
|
export declare class BaseProvider extends Provider {
|
||||||
private _network;
|
private _network;
|
||||||
private _events;
|
private _events;
|
||||||
protected _emitted: any;
|
protected _emitted: {
|
||||||
|
[eventName: string]: number | 'pending';
|
||||||
|
};
|
||||||
private _pollingInterval;
|
private _pollingInterval;
|
||||||
private _poller;
|
private _poller;
|
||||||
private _lastBlockNumber;
|
private _lastBlockNumber;
|
||||||
|
@ -422,11 +422,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
// Events being listened to
|
// Events being listened to
|
||||||
_this._events = [];
|
_this._events = [];
|
||||||
_this._pollingInterval = 4000;
|
_this._pollingInterval = 4000;
|
||||||
// We use this to track recent emitted events; for example, if we emit a "block" of 100
|
_this._emitted = { block: -2 };
|
||||||
// and we get a `getBlock(100)` request which would result in null, we should retry
|
|
||||||
// until we get a response. This provides devs with a consistent view. Similarly for
|
|
||||||
// transaction hashes.
|
|
||||||
_this._emitted = { block: _this._lastBlockNumber };
|
|
||||||
_this._fastQueryDate = 0;
|
_this._fastQueryDate = 0;
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
@ -438,28 +434,40 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
if (blockNumber === _this._lastBlockNumber) {
|
if (blockNumber === _this._lastBlockNumber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_this._lastBlockNumber === -2) {
|
// First polling cycle, trigger a "block" events
|
||||||
_this._lastBlockNumber = blockNumber - 1;
|
if (_this._emitted.block === -2) {
|
||||||
|
_this._emitted.block = blockNumber - 1;
|
||||||
}
|
}
|
||||||
var _loop_1 = function (i) {
|
// Notify all listener for each block that has passed
|
||||||
if (_this._emitted.block < i) {
|
for (var i = _this._emitted.block + 1; i <= blockNumber; i++) {
|
||||||
_this._emitted.block = i;
|
_this.emit('block', i);
|
||||||
|
}
|
||||||
|
// The emitted block was updated, check for obsolete events
|
||||||
|
if (_this._emitted.block !== blockNumber) {
|
||||||
|
_this._emitted.block = blockNumber;
|
||||||
|
Object.keys(_this._emitted).forEach(function (key) {
|
||||||
|
// The block event does not expire
|
||||||
|
if (key === 'block') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// The block we were at when we emitted this event
|
||||||
|
var eventBlockNumber = _this._emitted[key];
|
||||||
|
// We cannot garbage collect pending transactions or blocks here
|
||||||
|
// They should be garbage collected by the Provider when setting
|
||||||
|
// "pending" events
|
||||||
|
if (eventBlockNumber === 'pending') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Evict any transaction hashes or block hashes over 12 blocks
|
// Evict any transaction hashes or block hashes over 12 blocks
|
||||||
// old, since they should not return null anyways
|
// old, since they should not return null anyways
|
||||||
Object.keys(_this._emitted).forEach(function (key) {
|
if (blockNumber - eventBlockNumber > 12) {
|
||||||
if (key === 'block') {
|
delete _this._emitted[key];
|
||||||
return;
|
}
|
||||||
}
|
});
|
||||||
if (_this._emitted[key] > i + 12) {
|
}
|
||||||
delete _this._emitted[key];
|
// First polling cycle
|
||||||
}
|
if (_this._lastBlockNumber === -2) {
|
||||||
});
|
_this._lastBlockNumber = blockNumber - 1;
|
||||||
}
|
|
||||||
_this.emit('block', i);
|
|
||||||
};
|
|
||||||
// Notify all listener for each block that has passed
|
|
||||||
for (var i = _this._lastBlockNumber + 1; i <= blockNumber; i++) {
|
|
||||||
_loop_1(i);
|
|
||||||
}
|
}
|
||||||
// Sweep balances and remove addresses we no longer have events for
|
// Sweep balances and remove addresses we no longer have events for
|
||||||
var newBalances = {};
|
var newBalances = {};
|
||||||
@ -485,12 +493,12 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
newBalances[address_2] = _this._balances[address_2];
|
newBalances[address_2] = _this._balances[address_2];
|
||||||
}
|
}
|
||||||
_this.getBalance(address_2, 'latest').then(function (balance) {
|
_this.getBalance(address_2, 'latest').then(function (balance) {
|
||||||
var lastBalance = this._balances[address_2];
|
var lastBalance = _this._balances[address_2];
|
||||||
if (lastBalance && balance.eq(lastBalance)) {
|
if (lastBalance && balance.eq(lastBalance)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._balances[address_2] = balance;
|
_this._balances[address_2] = balance;
|
||||||
this.emit(address_2, balance);
|
_this.emit(address_2, balance);
|
||||||
return null;
|
return null;
|
||||||
}).catch(function (error) { _this.emit('error', error); });
|
}).catch(function (error) { _this.emit('error', error); });
|
||||||
break;
|
break;
|
||||||
@ -528,8 +536,10 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
this.doPoll();
|
this.doPoll();
|
||||||
};
|
};
|
||||||
BaseProvider.prototype.resetEventsBlock = function (blockNumber) {
|
BaseProvider.prototype.resetEventsBlock = function (blockNumber) {
|
||||||
this._lastBlockNumber = blockNumber;
|
this._lastBlockNumber = blockNumber - 1;
|
||||||
this._doPoll();
|
if (this.polling) {
|
||||||
|
this._doPoll();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Object.defineProperty(BaseProvider.prototype, "network", {
|
Object.defineProperty(BaseProvider.prototype, "network", {
|
||||||
get: function () {
|
get: function () {
|
||||||
@ -543,10 +553,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(BaseProvider.prototype, "blockNumber", {
|
Object.defineProperty(BaseProvider.prototype, "blockNumber", {
|
||||||
get: function () {
|
get: function () {
|
||||||
if (this._lastBlockNumber < 0) {
|
return this._fastBlockNumber;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this._lastBlockNumber;
|
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
@ -620,13 +627,15 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
// this will be used once we move to the WebSocket or other alternatives to polling
|
// this will be used once we move to the WebSocket or other alternatives to polling
|
||||||
BaseProvider.prototype.waitForTransaction = function (transactionHash, confirmations) {
|
BaseProvider.prototype.waitForTransaction = function (transactionHash, confirmations) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (!confirmations) {
|
if (confirmations == null) {
|
||||||
confirmations = 1;
|
confirmations = 1;
|
||||||
}
|
}
|
||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
|
||||||
if (receipt == null || receipt.confirmations < confirmations) {
|
if (receipt == null && confirmations !== 0) {
|
||||||
return undefined;
|
if (receipt.confirmations < confirmations) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return receipt;
|
return receipt;
|
||||||
});
|
});
|
||||||
@ -742,10 +751,17 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
if (hash != null && tx.hash !== hash) {
|
if (hash != null && tx.hash !== hash) {
|
||||||
errors.throwError('Transaction hash mismatch from Provider.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
errors.throwError('Transaction hash mismatch from Provider.sendTransaction.', errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
||||||
}
|
}
|
||||||
this._emitted['t:' + tx.hash] = 'pending';
|
|
||||||
// @TODO: (confirmations? number, timeout? number)
|
// @TODO: (confirmations? number, timeout? number)
|
||||||
result.wait = function (confirmations) {
|
result.wait = function (confirmations) {
|
||||||
|
// We know this transaction *must* exist (whether it gets mined is
|
||||||
|
// another story), so setting an emitted value forces us to
|
||||||
|
// wait even if the node returns null for the receipt
|
||||||
|
if (confirmations !== 0) {
|
||||||
|
_this._emitted['t:' + tx.hash] = 'pending';
|
||||||
|
}
|
||||||
return _this.waitForTransaction(tx.hash, confirmations).then(function (receipt) {
|
return _this.waitForTransaction(tx.hash, confirmations).then(function (receipt) {
|
||||||
|
// No longer pending, allow the polling loop to garbage collect this
|
||||||
|
_this._emitted['t:' + tx.hash] = receipt.blockNumber;
|
||||||
if (receipt.status === 0) {
|
if (receipt.status === 0) {
|
||||||
errors.throwError('transaction failed', errors.CALL_EXCEPTION, {
|
errors.throwError('transaction failed', errors.CALL_EXCEPTION, {
|
||||||
transactionHash: tx.hash,
|
transactionHash: tx.hash,
|
||||||
@ -823,7 +839,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
|||||||
return web_1.poll(function () {
|
return web_1.poll(function () {
|
||||||
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
return _this.perform('getBlock', { blockTag: blockTag_1, includeTransactions: !!includeTransactions }).then(function (block) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (blockNumber_1 > _this._emitted.block) {
|
if (blockNumber_1 <= _this._emitted.block) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -308,6 +308,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
var seq = Promise.resolve();
|
var seq = Promise.resolve();
|
||||||
hashes.forEach(function (hash) {
|
hashes.forEach(function (hash) {
|
||||||
|
// @TODO: This should be garbage collected at some point... How? When?
|
||||||
self._emitted['t:' + hash.toLowerCase()] = 'pending';
|
self._emitted['t:' + hash.toLowerCase()] = 'pending';
|
||||||
seq = seq.then(function () {
|
seq = seq.then(function () {
|
||||||
return self.getTransaction(hash).then(function (tx) {
|
return self.getTransaction(hash).then(function (tx) {
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = "4.0.10";
|
export const version = "4.0.11";
|
||||||
|
@ -733,7 +733,7 @@ var CoderArray = /** @class */ (function (_super) {
|
|||||||
count = value.length;
|
count = value.length;
|
||||||
result = uint256Coder.encode(count);
|
result = uint256Coder.encode(count);
|
||||||
}
|
}
|
||||||
errors.checkArgumentCount(count, value.length, 'in coder array' + (this.localName ? (" " + this.localName) : ""));
|
errors.checkArgumentCount(count, value.length, ' in coder array' + (this.localName ? (" " + this.localName) : ""));
|
||||||
var coders = [];
|
var coders = [];
|
||||||
for (var i = 0; i < value.length; i++) {
|
for (var i = 0; i < value.length; i++) {
|
||||||
coders.push(this.coder);
|
coders.push(this.coder);
|
||||||
|
@ -56,7 +56,7 @@ var _DeployDescription = /** @class */ (function (_super) {
|
|||||||
value: bytecode
|
value: bytecode
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
errors.checkArgumentCount(params.length, this.inputs.length, 'in Interface constructor');
|
errors.checkArgumentCount(params.length, this.inputs.length, ' in Interface constructor');
|
||||||
try {
|
try {
|
||||||
return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));
|
return (bytecode + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2));
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ var _FunctionDescription = /** @class */ (function (_super) {
|
|||||||
return _super !== null && _super.apply(this, arguments) || this;
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
}
|
}
|
||||||
_FunctionDescription.prototype.encode = function (params) {
|
_FunctionDescription.prototype.encode = function (params) {
|
||||||
errors.checkArgumentCount(params.length, this.inputs.length, 'in interface function ' + this.name);
|
errors.checkArgumentCount(params.length, this.inputs.length, ' in interface function ' + this.name);
|
||||||
try {
|
try {
|
||||||
return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);
|
return this.sighash + abi_coder_1.defaultAbiCoder.encode(this.inputs, params).substring(2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user