Compare commits

..

5 Commits

Author SHA1 Message Date
Richard Moore
b288ad9ba7 Updated dist files. 2020-01-10 21:14:46 -05:00
Richard Moore
6da5c53120 Fixed Contract and Interface constructor abi paramter type; should be a Fragment not a ParamType (#602). 2020-01-10 21:12:58 -05:00
Richard Moore
26d3271643 Add missing chainId to transaction responses (#700). 2020-01-10 20:59:28 -05:00
Richard Moore
12da07579a Updated dist files. 2020-01-07 20:06:25 -05:00
Richard Moore
bd066b8542 Fix resolveName when name is an address with an invalid checksum (#694). 2020-01-07 20:04:58 -05:00
17 changed files with 50 additions and 27 deletions

2
_version.d.ts vendored
View File

@@ -1 +1 @@
export declare const version = "4.0.42";
export declare const version = "4.0.43";

View File

@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "4.0.42";
exports.version = "4.0.43";

6
contract.d.ts vendored
View File

@@ -4,7 +4,7 @@ import { UnsignedTransaction } from './utils/transaction';
import { BlockTag, Provider } from './providers/abstract-provider';
import { Signer } from './abstract-signer';
import { Arrayish } from './utils/bytes';
import { ParamType } from './utils/abi-coder';
import { EventFragment, FunctionFragment } from './utils/abi-coder';
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './providers/abstract-provider';
export declare type ContractFunction = (...params: Array<any>) => Promise<any>;
export declare type EventFilter = {
@@ -51,7 +51,7 @@ export declare class Contract {
readonly addressPromise: Promise<string>;
readonly deployTransaction: TransactionResponse;
private _deployedPromise;
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider);
deployed(): Promise<Contract>;
_deployed(blockTag?: BlockTag): Promise<Contract>;
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
@@ -74,7 +74,7 @@ export declare class ContractFactory {
readonly interface: Interface;
readonly bytecode: string;
readonly signer: Signer;
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | {
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | {
object: string;
}, signer?: Signer);
getDeployTransaction(...args: Array<any>): UnsignedTransaction;

12
dist/ethers.js vendored
View File

@@ -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.42";
exports.version = "4.0.43";
},{}],2:[function(require,module,exports){
"use strict";
@@ -10295,6 +10295,9 @@ function checkTransactionResponse(transaction) {
networkId = 0;
}
result.networkId = networkId;
if (result.chainId == null && networkId != null) {
result.chainId = networkId;
}
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {
result.blockHash = null;
@@ -11115,7 +11118,12 @@ var BaseProvider = /** @class */ (function (_super) {
try {
return Promise.resolve(address_1.getAddress(name));
}
catch (error) { }
catch (error) {
// See #694
if (bytes_1.isHexString(name)) {
throw error;
}
}
var self = this;
var nodeHash = hash_1.namehash(name);
// Get the addr from the resovler

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12
dist/ethers.types.txt vendored
View File

@@ -29,7 +29,7 @@ declare module 'ethers/contract' {
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';
import { EventFragment, FunctionFragment } from 'ethers/utils/abi-coder';
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/abstract-provider';
export type ContractFunction = (...params: Array<any>) => Promise<any>;
export type EventFilter = {
@@ -75,7 +75,7 @@ declare module 'ethers/contract' {
readonly [name: string]: ContractFunction | any;
readonly addressPromise: Promise<string>;
readonly deployTransaction: TransactionResponse;
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider);
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider);
deployed(): Promise<Contract>;
_deployed(blockTag?: BlockTag): Promise<Contract>;
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
@@ -95,7 +95,7 @@ declare module 'ethers/contract' {
readonly interface: Interface;
readonly bytecode: string;
readonly signer: Signer;
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | {
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | {
object: string;
}, signer?: Signer);
getDeployTransaction(...args: Array<any>): UnsignedTransaction;
@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
}
declare module 'ethers/_version' {
export const version = "4.0.42";
export const version = "4.0.43";
}
declare module 'ethers/utils/bignumber' {
@@ -400,7 +400,7 @@ declare module 'ethers/utils/interface' {
[name: string]: _EventDescription;
};
readonly deployFunction: _DeployDescription;
constructor(abi: Array<string | ParamType> | string);
constructor(abi: Array<string | FunctionFragment | EventFragment> | string);
parseTransaction(tx: {
data: string;
value?: BigNumberish;
@@ -614,7 +614,7 @@ declare module 'ethers/utils/abi-coder' {
outputs: Array<ParamType>;
payable: boolean;
stateMutability: string;
gas: BigNumber;
gas?: BigNumber;
};
export const defaultCoerceFunc: CoerceFunc;
export function parseParamType(type: string): ParamType;

View File

@@ -1,6 +1,6 @@
{
"name": "ethers",
"version": "4.0.42",
"version": "4.0.43",
"description": "Ethereum wallet library.",
"main": "./index.js",
"types": "./index.d.ts",

View File

@@ -227,6 +227,9 @@ function checkTransactionResponse(transaction) {
networkId = 0;
}
result.networkId = networkId;
if (result.chainId == null && networkId != null) {
result.chainId = networkId;
}
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {
result.blockHash = null;
@@ -1047,7 +1050,12 @@ var BaseProvider = /** @class */ (function (_super) {
try {
return Promise.resolve(address_1.getAddress(name));
}
catch (error) { }
catch (error) {
// See #694
if (bytes_1.isHexString(name)) {
throw error;
}
}
var self = this;
var nodeHash = hash_1.namehash(name);
// Get the addr from the resovler

View File

@@ -1 +1 @@
export const version = "4.0.42";
export const version = "4.0.43";

View File

@@ -24,7 +24,7 @@ import { Signer } from './abstract-signer';
import { Arrayish } from './utils/bytes';
import { EventDescription } from './utils/interface';
import { ParamType } from './utils/abi-coder';
import { EventFragment, FunctionFragment, ParamType } from './utils/abi-coder';
import { Block, Listener, Log, TransactionReceipt, TransactionRequest, TransactionResponse } from './providers/abstract-provider';
///////////////////////////////
@@ -364,7 +364,7 @@ export class Contract {
// Once this issue is resolved (there are open PR) we can do this nicer
// by making addressOrName default to null for 2 operand calls. :)
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | Provider) {
constructor(addressOrName: string, contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, signerOrProvider: Signer | Provider) {
errors.checkNew(this, Contract);
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
@@ -744,7 +744,7 @@ export class ContractFactory {
readonly bytecode: string;
readonly signer: Signer;
constructor(contractInterface: Array<string | ParamType> | string | Interface, bytecode: Arrayish | string | { object: string }, signer?: Signer) {
constructor(contractInterface: Array<string | FunctionFragment | EventFragment> | string | Interface, bytecode: Arrayish | string | { object: string }, signer?: Signer) {
let bytecodeHex: string = null;

View File

@@ -247,6 +247,9 @@ function checkTransactionResponse(transaction: any): TransactionResponse {
if (typeof(networkId) !== 'number') { networkId = 0; }
result.networkId = networkId;
if (result.chainId == null && networkId != null) {
result.chainId = networkId;
}
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, '') === 'x') {
@@ -1178,7 +1181,10 @@ export class BaseProvider extends Provider {
// If it is already an address, nothing to resolve
try {
return Promise.resolve(getAddress(name));
} catch (error) { }
} catch (error) {
// See #694
if (isHexString(name)) { throw error; }
}
let self = this;

View File

@@ -54,7 +54,7 @@ export type FunctionFragment = {
payable: boolean,
stateMutability: string,
gas: BigNumber
gas?: BigNumber
};
///////////////////////////////

View File

@@ -390,7 +390,7 @@ export class Interface {
readonly events: { [ name: string ]: _EventDescription };
readonly deployFunction: _DeployDescription;
constructor(abi: Array<string | ParamType> | string) {
constructor(abi: Array<string | FunctionFragment | EventFragment> | string) {
errors.checkNew(this, Interface);
if (typeof(abi) === 'string') {

View File

@@ -46,7 +46,8 @@ var blockchainData = {
v: 38,
creates: null,
raw: '0xf8d2808504a817c8008303d090946fc21092da55b392b045ed78f4732bff3c580e2c880186cc6acd4b0000b864f2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f000000000000000000000000000000000000000000000000000026a01e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265a0269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54',
networkId: 1
networkId: 1,
chainId: 1
},
transactionReceipt: {
blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566",

View File

@@ -21,7 +21,7 @@ export declare type FunctionFragment = {
outputs: Array<ParamType>;
payable: boolean;
stateMutability: string;
gas: BigNumber;
gas?: BigNumber;
};
export declare const defaultCoerceFunc: CoerceFunc;
export declare function parseParamType(type: string): ParamType;

View File

@@ -98,7 +98,7 @@ export declare class Interface {
[name: string]: _EventDescription;
};
readonly deployFunction: _DeployDescription;
constructor(abi: Array<string | ParamType> | string);
constructor(abi: Array<string | FunctionFragment | EventFragment> | string);
parseTransaction(tx: {
data: string;
value?: BigNumberish;