Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 12, 2019
1 parent 0ed983a commit c6d7b31
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion _version.d.ts
@@ -1 +1 @@
export declare const version = "4.0.24";
export declare const version = "4.0.25";
2 changes: 1 addition & 1 deletion _version.js
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.24";
exports.version = "4.0.25";
5 changes: 3 additions & 2 deletions contract.d.ts
@@ -1,7 +1,7 @@
import { BigNumber } from './utils/bignumber';
import { Indexed, Interface } from './utils/interface';
import { UnsignedTransaction } from './utils/transaction';
import { Provider } from './providers/abstract-provider';
import { BlockTag, Provider } from './providers/abstract-provider';
import { Signer } from './abstract-signer';
import { Arrayish } from './utils/bytes';
import { ParamType } from './utils/abi-coder';
Expand Down Expand Up @@ -50,9 +50,10 @@ export declare class Contract {
readonly [name: string]: ContractFunction | any;
readonly addressPromise: Promise<string>;
readonly deployTransaction: TransactionResponse;
private _deployed;
private _deployedPromise;
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
deployed(): Promise<Contract>;
_deployed(blockTag?: BlockTag): Promise<Contract>;
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
connect(signerOrProvider: Signer | Provider | string): Contract;
attach(addressOrName: string): Contract;
Expand Down
14 changes: 8 additions & 6 deletions contract.js
Expand Up @@ -135,8 +135,7 @@ function runMethod(contract, functionName, estimateOnly) {
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
}
});
// Send to the contract address (after checking the contract is deployed)
tx.to = contract.deployed().then(function () {
tx.to = contract._deployed(blockTag).then(function () {
return contract.addressPromise;
});
return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {
Expand Down Expand Up @@ -332,19 +331,22 @@ var Contract = /** @class */ (function () {
}
// @TODO: Allow timeout?
Contract.prototype.deployed = function () {
return this._deployed();
};
Contract.prototype._deployed = function (blockTag) {
var _this = this;
if (!this._deployed) {
if (!this._deployedPromise) {
// If we were just deployed, we know the transaction we should occur in
if (this.deployTransaction) {
this._deployed = this.deployTransaction.wait().then(function () {
this._deployedPromise = this.deployTransaction.wait().then(function () {
return _this;
});
}
else {
// @TODO: Once we allow a timeout to be passed in, we will wait
// up to that many blocks for getCode
// Otherwise, poll for our code to be deployed
this._deployed = this.provider.getCode(this.address).then(function (code) {
this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) {
if (code === '0x') {
errors.throwError('contract not deployed', errors.UNSUPPORTED_OPERATION, {
contractAddress: _this.address,
Expand All @@ -355,7 +357,7 @@ var Contract = /** @class */ (function () {
});
}
}
return this._deployed;
return this._deployedPromise;
};
// @TODO:
// estimateFallback(overrides?: TransactionRequest): Promise<BigNumber>
Expand Down
16 changes: 9 additions & 7 deletions dist/ethers.js
@@ -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){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.24";
exports.version = "4.0.25";

},{}],2:[function(require,module,exports){
"use strict";
Expand Down Expand Up @@ -183,8 +183,7 @@ function runMethod(contract, functionName, estimateOnly) {
errors.throwError('cannot override ' + key, errors.UNSUPPORTED_OPERATION, { operation: key });
}
});
// Send to the contract address (after checking the contract is deployed)
tx.to = contract.deployed().then(function () {
tx.to = contract._deployed(blockTag).then(function () {
return contract.addressPromise;
});
return resolveAddresses(contract.provider, params, method.inputs).then(function (params) {
Expand Down Expand Up @@ -380,19 +379,22 @@ var Contract = /** @class */ (function () {
}
// @TODO: Allow timeout?
Contract.prototype.deployed = function () {
return this._deployed();
};
Contract.prototype._deployed = function (blockTag) {
var _this = this;
if (!this._deployed) {
if (!this._deployedPromise) {
// If we were just deployed, we know the transaction we should occur in
if (this.deployTransaction) {
this._deployed = this.deployTransaction.wait().then(function () {
this._deployedPromise = this.deployTransaction.wait().then(function () {
return _this;
});
}
else {
// @TODO: Once we allow a timeout to be passed in, we will wait
// up to that many blocks for getCode
// Otherwise, poll for our code to be deployed
this._deployed = this.provider.getCode(this.address).then(function (code) {
this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) {
if (code === '0x') {
errors.throwError('contract not deployed', errors.UNSUPPORTED_OPERATION, {
contractAddress: _this.address,
Expand All @@ -403,7 +405,7 @@ var Contract = /** @class */ (function () {
});
}
}
return this._deployed;
return this._deployedPromise;
};
// @TODO:
// estimateFallback(overrides?: TransactionRequest): Promise<BigNumber>
Expand Down
2 changes: 1 addition & 1 deletion dist/ethers.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ethers.min.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/ethers.types.txt
Expand Up @@ -26,7 +26,7 @@ declare module 'ethers/contract' {
import { BigNumber } from 'ethers/utils/bignumber';
import { Indexed, Interface } from 'ethers/utils/interface';
import { UnsignedTransaction } from 'ethers/utils/transaction';
import { Provider } from 'ethers/providers/abstract-provider';
import { BlockTag, Provider } from 'ethers/providers/abstract-provider';
import { Signer } from 'ethers/abstract-signer';
import { Arrayish } from 'ethers/utils/bytes';
import { ParamType } from 'ethers/utils/abi-coder';
Expand Down Expand Up @@ -77,6 +77,7 @@ declare module 'ethers/contract' {
readonly deployTransaction: TransactionResponse;
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
deployed(): Promise<Contract>;
_deployed(blockTag?: BlockTag): Promise<Contract>;
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
connect(signerOrProvider: Signer | Provider | string): Contract;
attach(addressOrName: string): Contract;
Expand Down Expand Up @@ -265,7 +266,7 @@ declare module 'ethers/utils/shims' {
}

declare module 'ethers/_version' {
export const version = "4.0.24";
export const version = "4.0.25";
}

declare module 'ethers/utils/bignumber' {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.24",
"version": "4.0.25",
"description": "Ethereum wallet library.",
"main": "./index.js",
"types": "./index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src.ts/_version.ts
@@ -1 +1 @@
export const version = "4.0.24";
export const version = "4.0.25";

0 comments on commit c6d7b31

Please sign in to comment.