Updated dist files.

This commit is contained in:
Richard Moore 2020-06-01 05:04:12 -04:00
parent cd7a0b36cd
commit 86d50bc9b6
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
86 changed files with 2555 additions and 793 deletions

View File

@ -3,6 +3,13 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated. This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.190 (2020-06-01 05:02)
-----------------------------------------
- Re-enable tests removed to fix slow CI. ([cd7a0b3](https://github.com/ethers-io/ethers.js/commit/cd7a0b36cd77df5d5951a97cdb6b6be1c9387f51))
- Major Contract refactor for overrides. ([#819](https://github.com/ethers-io/ethers.js/issues/819), [#845](https://github.com/ethers-io/ethers.js/issues/845), [#847](https://github.com/ethers-io/ethers.js/issues/847), [#860](https://github.com/ethers-io/ethers.js/issues/860); [42dee67](https://github.com/ethers-io/ethers.js/commit/42dee67187adb04d0b88f420b24cb3e73301d609))
- Remove legacy Circle CI tasks. ([c445232](https://github.com/ethers-io/ethers.js/commit/c445232980007d3474bc036ff59fb37638f93820))
- Fixing GitHub actions. ([#853](https://github.com/ethers-io/ethers.js/issues/853); [6b8f0f3](https://github.com/ethers-io/ethers.js/commit/6b8f0f3cb38295cd5d693f9b71f629b591206f1e))
ethers/v5.0.0-beta.189 (2020-05-29 21:25) ethers/v5.0.0-beta.189 (2020-05-29 21:25)
----------------------------------------- -----------------------------------------

View File

@ -18,11 +18,11 @@ encrypted encrypting entries euro exceeded existing expected
expired failed fetches formatted formatting funding generated expired failed fetches formatted formatting funding generated
has ignoring implemented implementer imported including instantiate has ignoring implemented implementer imported including instantiate
keyword labelled larger lookup matches mined modified modifies multi keyword labelled larger lookup matches mined modified modifies multi
named nested neutered numeric offline optimizer owned packed named needed nested neutered numeric offline optimizer overriding owned packed
padded parsed parsing passed placeholder processing reached padded parsed parsing passed placeholder processing reached
recommended recovered redacted remaining replaced required recommended recovered redacted remaining replaced required
serializes shared signed signing stored supported tagging targetted serializes shared signed signing skipped stored supported tagging targetted
transactions uninstall unsubscribe using verifies website transactions uninstall unstake unsubscribe using verifies website
// Overly Specific Words // Overly Specific Words
BIP BIP39 BIP44 crypto eip hashes hmac icap BIP BIP39 BIP44 crypto eip hashes hmac icap

1694
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
export declare const version = "abstract-provider/5.0.0-beta.141"; export declare const version = "abstract-provider/5.0.0-beta.142";

View File

@ -1 +1 @@
export const version = "abstract-provider/5.0.0-beta.141"; export const version = "abstract-provider/5.0.0-beta.142";

View File

@ -1,18 +1,18 @@
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BytesLike } from "@ethersproject/bytes"; import { BytesLike } from "@ethersproject/bytes";
import { Network } from "@ethersproject/networks"; import { Network } from "@ethersproject/networks";
import { Description } from "@ethersproject/properties"; import { Deferrable, Description } from "@ethersproject/properties";
import { Transaction } from "@ethersproject/transactions"; import { Transaction } from "@ethersproject/transactions";
import { OnceBlockable } from "@ethersproject/web"; import { OnceBlockable } from "@ethersproject/web";
export declare type TransactionRequest = { export declare type TransactionRequest = {
to?: string | Promise<string>; to?: string;
from?: string | Promise<string>; from?: string;
nonce?: BigNumberish | Promise<BigNumberish>; nonce?: BigNumberish;
gasLimit?: BigNumberish | Promise<BigNumberish>; gasLimit?: BigNumberish;
gasPrice?: BigNumberish | Promise<BigNumberish>; gasPrice?: BigNumberish;
data?: BytesLike | Promise<BytesLike>; data?: BytesLike;
value?: BigNumberish | Promise<BigNumberish>; value?: BigNumberish;
chainId?: number | Promise<number>; chainId?: number;
}; };
export interface TransactionResponse extends Transaction { export interface TransactionResponse extends Transaction {
hash: string; hash: string;
@ -113,8 +113,8 @@ export declare abstract class Provider implements OnceBlockable {
abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>; abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
abstract call(transaction: TransactionRequest, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>; abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>; abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>; abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>; abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;

View File

@ -1 +1 @@
export declare const version = "abstract-provider/5.0.0-beta.141"; export declare const version = "abstract-provider/5.0.0-beta.142";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-provider/5.0.0-beta.141"; exports.version = "abstract-provider/5.0.0-beta.142";

View File

@ -1,18 +1,18 @@
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BytesLike } from "@ethersproject/bytes"; import { BytesLike } from "@ethersproject/bytes";
import { Network } from "@ethersproject/networks"; import { Network } from "@ethersproject/networks";
import { Description } from "@ethersproject/properties"; import { Deferrable, Description } from "@ethersproject/properties";
import { Transaction } from "@ethersproject/transactions"; import { Transaction } from "@ethersproject/transactions";
import { OnceBlockable } from "@ethersproject/web"; import { OnceBlockable } from "@ethersproject/web";
export declare type TransactionRequest = { export declare type TransactionRequest = {
to?: string | Promise<string>; to?: string;
from?: string | Promise<string>; from?: string;
nonce?: BigNumberish | Promise<BigNumberish>; nonce?: BigNumberish;
gasLimit?: BigNumberish | Promise<BigNumberish>; gasLimit?: BigNumberish;
gasPrice?: BigNumberish | Promise<BigNumberish>; gasPrice?: BigNumberish;
data?: BytesLike | Promise<BytesLike>; data?: BytesLike;
value?: BigNumberish | Promise<BigNumberish>; value?: BigNumberish;
chainId?: number | Promise<number>; chainId?: number;
}; };
export interface TransactionResponse extends Transaction { export interface TransactionResponse extends Transaction {
hash: string; hash: string;
@ -113,8 +113,8 @@ export declare abstract class Provider implements OnceBlockable {
abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>; abstract sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
abstract call(transaction: TransactionRequest, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; abstract call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>; abstract estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>; abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>; abstract getBlockWithTransactions(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<BlockWithTransactions>;
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>; abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;

View File

@ -29,7 +29,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0x91f928d7dba2271945abf1fb31aa1c715a6046b3a17bdb0ea77a9a7cf5855896", "tarballHash": "0xad8f4ccc09a03c47de713409293aed56225df32705cb364ece02ad8f10429b72",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.141" "version": "5.0.0-beta.142"
} }

View File

@ -1 +1 @@
export const version = "abstract-provider/5.0.0-beta.141"; export const version = "abstract-provider/5.0.0-beta.142";

View File

@ -1 +1 @@
export declare const version = "abstract-signer/5.0.0-beta.144"; export declare const version = "abstract-signer/5.0.0-beta.145";

View File

@ -1 +1 @@
export const version = "abstract-signer/5.0.0-beta.144"; export const version = "abstract-signer/5.0.0-beta.145";

View File

@ -1,6 +1,7 @@
import { BlockTag, Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; import { BlockTag, Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { BigNumber } from "@ethersproject/bignumber"; import { BigNumber } from "@ethersproject/bignumber";
import { Bytes } from "@ethersproject/bytes"; import { Bytes } from "@ethersproject/bytes";
import { Deferrable } from "@ethersproject/properties";
export interface ExternallyOwnedAccount { export interface ExternallyOwnedAccount {
readonly address: string; readonly address: string;
readonly privateKey: string; readonly privateKey: string;
@ -9,20 +10,20 @@ export declare abstract class Signer {
readonly provider?: Provider; readonly provider?: Provider;
abstract getAddress(): Promise<string>; abstract getAddress(): Promise<string>;
abstract signMessage(message: Bytes | string): Promise<string>; abstract signMessage(message: Bytes | string): Promise<string>;
abstract signTransaction(transaction: TransactionRequest): Promise<string>; abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
abstract connect(provider: Provider): Signer; abstract connect(provider: Provider): Signer;
readonly _isSigner: boolean; readonly _isSigner: boolean;
constructor(); constructor();
getBalance(blockTag?: BlockTag): Promise<BigNumber>; getBalance(blockTag?: BlockTag): Promise<BigNumber>;
getTransactionCount(blockTag?: BlockTag): Promise<number>; getTransactionCount(blockTag?: BlockTag): Promise<number>;
estimateGas(transaction: TransactionRequest): Promise<BigNumber>; estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>; call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
getChainId(): Promise<number>; getChainId(): Promise<number>;
getGasPrice(): Promise<BigNumber>; getGasPrice(): Promise<BigNumber>;
resolveName(name: string): Promise<string>; resolveName(name: string): Promise<string>;
checkTransaction(transaction: TransactionRequest): TransactionRequest; checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
populateTransaction(transaction: TransactionRequest): Promise<TransactionRequest>; populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
_checkProvider(operation?: string): void; _checkProvider(operation?: string): void;
static isSigner(value: any): value is Signer; static isSigner(value: any): value is Signer;
} }
@ -32,6 +33,6 @@ export declare class VoidSigner extends Signer {
getAddress(): Promise<string>; getAddress(): Promise<string>;
_fail(message: string, operation: string): Promise<any>; _fail(message: string, operation: string): Promise<any>;
signMessage(message: Bytes | string): Promise<string>; signMessage(message: Bytes | string): Promise<string>;
signTransaction(transaction: TransactionRequest): Promise<string>; signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
connect(provider: Provider): VoidSigner; connect(provider: Provider): VoidSigner;
} }

View File

@ -1 +1 @@
export declare const version = "abstract-signer/5.0.0-beta.144"; export declare const version = "abstract-signer/5.0.0-beta.145";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-signer/5.0.0-beta.144"; exports.version = "abstract-signer/5.0.0-beta.145";

View File

@ -1,6 +1,7 @@
import { BlockTag, Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; import { BlockTag, Provider, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { BigNumber } from "@ethersproject/bignumber"; import { BigNumber } from "@ethersproject/bignumber";
import { Bytes } from "@ethersproject/bytes"; import { Bytes } from "@ethersproject/bytes";
import { Deferrable } from "@ethersproject/properties";
export interface ExternallyOwnedAccount { export interface ExternallyOwnedAccount {
readonly address: string; readonly address: string;
readonly privateKey: string; readonly privateKey: string;
@ -9,20 +10,20 @@ export declare abstract class Signer {
readonly provider?: Provider; readonly provider?: Provider;
abstract getAddress(): Promise<string>; abstract getAddress(): Promise<string>;
abstract signMessage(message: Bytes | string): Promise<string>; abstract signMessage(message: Bytes | string): Promise<string>;
abstract signTransaction(transaction: TransactionRequest): Promise<string>; abstract signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
abstract connect(provider: Provider): Signer; abstract connect(provider: Provider): Signer;
readonly _isSigner: boolean; readonly _isSigner: boolean;
constructor(); constructor();
getBalance(blockTag?: BlockTag): Promise<BigNumber>; getBalance(blockTag?: BlockTag): Promise<BigNumber>;
getTransactionCount(blockTag?: BlockTag): Promise<number>; getTransactionCount(blockTag?: BlockTag): Promise<number>;
estimateGas(transaction: TransactionRequest): Promise<BigNumber>; estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>; call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag): Promise<string>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
getChainId(): Promise<number>; getChainId(): Promise<number>;
getGasPrice(): Promise<BigNumber>; getGasPrice(): Promise<BigNumber>;
resolveName(name: string): Promise<string>; resolveName(name: string): Promise<string>;
checkTransaction(transaction: TransactionRequest): TransactionRequest; checkTransaction(transaction: Deferrable<TransactionRequest>): Deferrable<TransactionRequest>;
populateTransaction(transaction: TransactionRequest): Promise<TransactionRequest>; populateTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionRequest>;
_checkProvider(operation?: string): void; _checkProvider(operation?: string): void;
static isSigner(value: any): value is Signer; static isSigner(value: any): value is Signer;
} }
@ -32,6 +33,6 @@ export declare class VoidSigner extends Signer {
getAddress(): Promise<string>; getAddress(): Promise<string>;
_fail(message: string, operation: string): Promise<any>; _fail(message: string, operation: string): Promise<any>;
signMessage(message: Bytes | string): Promise<string>; signMessage(message: Bytes | string): Promise<string>;
signTransaction(transaction: TransactionRequest): Promise<string>; signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
connect(provider: Provider): VoidSigner; connect(provider: Provider): VoidSigner;
} }

View File

@ -27,7 +27,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0xc2024c958e464989f0f14e2362cb0b7fe915c4b56862f55a398434138f4901aa", "tarballHash": "0x9bcb28b416731620f3e970b8a5fee9f888951781d4c6a1239a1020f55317d811",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.144" "version": "5.0.0-beta.145"
} }

View File

@ -1 +1 @@
export const version = "abstract-signer/5.0.0-beta.144"; export const version = "abstract-signer/5.0.0-beta.145";

View File

@ -1 +1 @@
export declare const version = "contracts/5.0.0-beta.154"; export declare const version = "contracts/5.0.0-beta.155";

View File

@ -1 +1 @@
export const version = "contracts/5.0.0-beta.154"; export const version = "contracts/5.0.0-beta.155";

View File

@ -3,7 +3,6 @@ import { Block, BlockTag, Listener, Log, Provider, TransactionReceipt, Transacti
import { Signer } from "@ethersproject/abstract-signer"; import { Signer } from "@ethersproject/abstract-signer";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BytesLike } from "@ethersproject/bytes"; import { BytesLike } from "@ethersproject/bytes";
import { UnsignedTransaction } from "@ethersproject/transactions";
export interface Overrides { export interface Overrides {
gasLimit?: BigNumberish | Promise<BigNumberish>; gasLimit?: BigNumberish | Promise<BigNumberish>;
gasPrice?: BigNumberish | Promise<BigNumberish>; gasPrice?: BigNumberish | Promise<BigNumberish>;
@ -16,6 +15,16 @@ export interface CallOverrides extends PayableOverrides {
blockTag?: BlockTag | Promise<BlockTag>; blockTag?: BlockTag | Promise<BlockTag>;
from?: string | Promise<string>; from?: string | Promise<string>;
} }
export interface PopulatedTransaction {
to?: string;
from?: string;
nonce?: number;
gasLimit?: BigNumber;
gasPrice?: BigNumber;
data?: string;
value?: BigNumber;
chainId?: number;
}
export declare type EventFilter = { export declare type EventFilter = {
address?: string; address?: string;
topics?: Array<string | Array<string>>; topics?: Array<string | Array<string>>;
@ -68,7 +77,7 @@ export declare class Contract {
[name: string]: ContractFunction<BigNumber>; [name: string]: ContractFunction<BigNumber>;
}; };
readonly populateTransaction: { readonly populateTransaction: {
[name: string]: ContractFunction<UnsignedTransaction>; [name: string]: ContractFunction<PopulatedTransaction>;
}; };
readonly filters: { readonly filters: {
[name: string]: (...args: Array<any>) => EventFilter; [name: string]: (...args: Array<any>) => EventFilter;
@ -83,7 +92,7 @@ export declare class Contract {
_wrappedEmits: { _wrappedEmits: {
[eventTag: string]: (...args: Array<any>) => void; [eventTag: string]: (...args: Array<any>) => void;
}; };
constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: Signer | Provider); constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider?: Signer | Provider);
static getContractAddress(transaction: { static getContractAddress(transaction: {
from: string; from: string;
nonce: BigNumberish; nonce: BigNumberish;
@ -117,7 +126,7 @@ export declare class ContractFactory {
constructor(contractInterface: ContractInterface, bytecode: BytesLike | { constructor(contractInterface: ContractInterface, bytecode: BytesLike | {
object: string; object: string;
}, signer?: Signer); }, signer?: Signer);
getDeployTransaction(...args: Array<any>): UnsignedTransaction; getDeployTransaction(...args: Array<any>): TransactionRequest;
deploy(...args: Array<any>): Promise<Contract>; deploy(...args: Array<any>): Promise<Contract>;
attach(address: string): Contract; attach(address: string): Contract;
connect(signer: Signer): ContractFactory; connect(signer: Signer): ContractFactory;

View File

@ -11,42 +11,96 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
import { checkResultErrors, Indexed, Interface } from "@ethersproject/abi"; import { checkResultErrors, Indexed, Interface } from "@ethersproject/abi";
import { Provider } from "@ethersproject/abstract-provider"; import { Provider } from "@ethersproject/abstract-provider";
import { Signer, VoidSigner } from "@ethersproject/abstract-signer"; import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
import { getContractAddress } from "@ethersproject/address"; import { getAddress, getContractAddress } from "@ethersproject/address";
import { BigNumber } from "@ethersproject/bignumber"; import { BigNumber } from "@ethersproject/bignumber";
import { concat, hexlify, isBytes, isHexString } from "@ethersproject/bytes"; import { concat, hexlify, isBytes, isHexString } from "@ethersproject/bytes";
//import { AddressZero } from "@ethersproject/constants";
import { defineReadOnly, deepCopy, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties"; import { defineReadOnly, deepCopy, getStatic, resolveProperties, shallowCopy } from "@ethersproject/properties";
// @TOOD remove dependences transactions
import { Logger } from "@ethersproject/logger"; import { Logger } from "@ethersproject/logger";
import { version } from "./_version"; import { version } from "./_version";
const logger = new Logger(version); const logger = new Logger(version);
;
;
/////////////////////////////// ///////////////////////////////
const allowedTransactionKeys = { const allowedTransactionKeys = {
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
}; };
function resolveName(resolver, nameOrPromise) {
return __awaiter(this, void 0, void 0, function* () {
const name = yield nameOrPromise;
// If it is already an address, just use it (after adding checksum)
try {
return getAddress(name);
}
catch (error) { }
if (!resolver) {
logger.throwError("a provider or signer is needed to resolve ENS names", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return yield resolver.resolveName(name);
});
}
// Recursively replaces ENS names with promises to resolve the name and resolves all properties // Recursively replaces ENS names with promises to resolve the name and resolves all properties
function resolveAddresses(signerOrProvider, value, paramType) { function resolveAddresses(resolver, value, paramType) {
if (Array.isArray(paramType)) { if (Array.isArray(paramType)) {
return Promise.all(paramType.map((paramType, index) => { return Promise.all(paramType.map((paramType, index) => {
return resolveAddresses(signerOrProvider, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType); return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
})); }));
} }
if (paramType.type === "address") { if (paramType.type === "address") {
return signerOrProvider.resolveName(value); return resolveName(resolver, value);
} }
if (paramType.type === "tuple") { if (paramType.type === "tuple") {
return resolveAddresses(signerOrProvider, value, paramType.components); return resolveAddresses(resolver, value, paramType.components);
} }
if (paramType.baseType === "array") { if (paramType.baseType === "array") {
if (!Array.isArray(value)) { if (!Array.isArray(value)) {
throw new Error("invalid value for array"); throw new Error("invalid value for array");
} }
return Promise.all(value.map((v) => resolveAddresses(signerOrProvider, v, paramType.arrayChildren))); return Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren)));
} }
return Promise.resolve(value); return Promise.resolve(value);
} }
function _populateTransaction(contract, fragment, args, overrides) { function populateTransaction(contract, fragment, args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides); // If an extra argument is given, it is overrides
// Wait for all dependency addresses to be resolved (prefer the signer over the provider) let overrides = {};
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = shallowCopy(args.pop());
}
// Make sure the parameter count matches
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
// Populate "from" override (allow promises)
if (contract.signer) {
if (overrides.from) {
// Contracts with a Signer are from the Signer's frame-of-reference;
// but we allow overriding "from" if it matches the signer
overrides.from = resolveProperties({
override: resolveName(contract.signer, overrides.from),
signer: contract.signer.getAddress()
}).then((check) => __awaiter(this, void 0, void 0, function* () {
if (getAddress(check.signer) !== check.override) {
logger.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.from"
});
}
return check.override;
}));
}
else {
overrides.from = contract.signer.getAddress();
}
}
else if (overrides.from) {
overrides.from = resolveName(contract.provider, overrides.from);
//} else {
// Contracts without a signer can override "from", and if
// unspecified the zero address is used
//overrides.from = AddressZero;
}
// Wait for all dependencies to be resolved (prefer the signer over the provider)
const resolved = yield resolveProperties({ const resolved = yield resolveProperties({
args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs),
address: contract.resolvedAddress, address: contract.resolvedAddress,
@ -59,6 +113,7 @@ function _populateTransaction(contract, fragment, args, overrides) {
}; };
// Resolved Overrides // Resolved Overrides
const ro = resolved.overrides; const ro = resolved.overrides;
// Populate simple overrides
if (ro.nonce != null) { if (ro.nonce != null) {
tx.nonce = BigNumber.from(ro.nonce).toNumber(); tx.nonce = BigNumber.from(ro.nonce).toNumber();
} }
@ -68,128 +123,90 @@ function _populateTransaction(contract, fragment, args, overrides) {
if (ro.gasPrice != null) { if (ro.gasPrice != null) {
tx.gasPrice = BigNumber.from(ro.gasPrice); tx.gasPrice = BigNumber.from(ro.gasPrice);
} }
// If there was no gasLimit override, but the ABI specifies one use it if (ro.from != null) {
tx.from = ro.from;
}
// If there was no "gasLimit" override, but the ABI specifies a default, use it
if (tx.gasLimit == null && fragment.gas != null) { if (tx.gasLimit == null && fragment.gas != null) {
tx.gasLimit = BigNumber.from(fragment.gas).add(21000); tx.gasLimit = BigNumber.from(fragment.gas).add(21000);
} }
// Populate "value" override
if (ro.value) {
const roValue = BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: overrides.value
});
}
tx.value = roValue;
}
// Remvoe the overrides // Remvoe the overrides
delete overrides.nonce; delete overrides.nonce;
delete overrides.gasLimit; delete overrides.gasLimit;
delete overrides.gasPrice; delete overrides.gasPrice;
// @TODO: Maybe move all tx property validation to the Signer and Provider? delete overrides.from;
delete overrides.value;
// Make sure there are no stray overrides, which may indicate a // Make sure there are no stray overrides, which may indicate a
// typo or using an unsupported key. // typo or using an unsupported key.
const leftovers = Object.keys(overrides); const leftovers = Object.keys(overrides);
if (leftovers.length) { if (leftovers.length) {
logger.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, { logger.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides", operation: "overrides",
keys: leftovers overrides: leftovers
}); });
} }
return tx; return tx;
}); });
} }
function populateTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides);
// If the contract was just deployed, wait until it is minded
if (contract.deployTransaction != null) {
yield contract._deployed();
}
// Resolved Overrides (keep value for errors)
const ro = yield resolveProperties(overrides);
const value = overrides.value;
delete overrides.value;
const tx = yield _populateTransaction(contract, fragment, args, overrides);
if (ro.value) {
const roValue = BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: value
});
}
tx.value = roValue;
}
return tx;
});
}
function populateCallTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides);
// If the contract was just deployed, wait until it is minded
if (contract.deployTransaction != null) {
let blockTag = undefined;
if (overrides.blockTag) {
blockTag = yield overrides.blockTag;
}
yield contract._deployed(blockTag);
}
// Resolved Overrides
delete overrides.blockTag;
const ro = yield resolveProperties(overrides);
delete overrides.from;
const tx = yield populateTransaction(contract, fragment, args, overrides);
if (ro.from) {
tx.from = this.interface.constructor.getAddress(ro.from);
}
return tx;
});
}
function buildPopulate(contract, fragment) { function buildPopulate(contract, fragment) {
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let overrides = null; return populateTransaction(contract, fragment, args);
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return populate(contract, fragment, args, overrides);
}); });
}; };
} }
function buildEstimate(contract, fragment) { function buildEstimate(contract, fragment) {
const signerOrProvider = (contract.signer || contract.provider); const signerOrProvider = (contract.signer || contract.provider);
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let overrides = null;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
if (!signerOrProvider) { if (!signerOrProvider) {
logger.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); logger.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "estimateGas"
});
} }
const tx = yield populate(contract, fragment, args, overrides); const tx = yield populateTransaction(contract, fragment, args);
return yield signerOrProvider.estimateGas(tx); return yield signerOrProvider.estimateGas(tx);
}); });
}; };
} }
function buildCall(contract, fragment, collapseSimple) { function buildCall(contract, fragment, collapseSimple) {
const signerOrProvider = (contract.signer || contract.provider); const signerOrProvider = (contract.signer || contract.provider);
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let overrides = null; // Extract the "blockTag" override if present
let blockTag = undefined; let blockTag = undefined;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = shallowCopy(args.pop()); const overrides = shallowCopy(args.pop());
if (overrides.blockTag) { if (overrides.blockTag) {
blockTag = yield overrides.blockTag; blockTag = yield overrides.blockTag;
delete overrides.blockTag; delete overrides.blockTag;
} }
args.push(overrides);
} }
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // If the contract was just deployed, wait until it is mined
const tx = yield populate(contract, fragment, args, overrides); if (contract.deployTransaction != null) {
const value = yield signerOrProvider.call(tx, blockTag); yield contract._deployed(blockTag);
}
// Call a node and get the result
const tx = yield populateTransaction(contract, fragment, args);
const result = yield signerOrProvider.call(tx, blockTag);
try { try {
let result = contract.interface.decodeFunctionResult(fragment, value); let value = contract.interface.decodeFunctionResult(fragment, result);
if (collapseSimple && fragment.outputs.length === 1) { if (collapseSimple && fragment.outputs.length === 1) {
result = result[0]; value = value[0];
} }
return result; return value;
} }
catch (error) { catch (error) {
if (error.code === Logger.errors.CALL_EXCEPTION) { if (error.code === Logger.errors.CALL_EXCEPTION) {
@ -206,18 +223,15 @@ function buildSend(contract, fragment) {
return function (...args) { return function (...args) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (!contract.signer) { if (!contract.signer) {
logger.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); logger.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "sendTransaction"
});
} }
// We allow CallOverrides, since the Signer can accept from // If the contract was just deployed, wait until it is minded
let overrides = null; if (contract.deployTransaction != null) {
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { yield contract._deployed();
overrides = shallowCopy(args.pop());
if (overrides.blockTag != null) {
logger.throwArgumentError(`cannot override "blockTag" in transaction`, "overrides", overrides);
}
} }
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); const txRequest = yield populateTransaction(contract, fragment, args);
const txRequest = yield populateCallTransaction(contract, fragment, args, overrides);
const tx = yield contract.signer.sendTransaction(txRequest); const tx = yield contract.signer.sendTransaction(txRequest);
// Tweak the tw.wait so the receipt has extra properties // Tweak the tw.wait so the receipt has extra properties
const wait = tx.wait.bind(tx); const wait = tx.wait.bind(tx);
@ -412,7 +426,11 @@ export class Contract {
// @TODO: Maybe still check the addressOrName looks like a valid address or name? // @TODO: Maybe still check the addressOrName looks like a valid address or name?
//address = getAddress(address); //address = getAddress(address);
defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface)); defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface));
if (Signer.isSigner(signerOrProvider)) { if (signerOrProvider == null) {
defineReadOnly(this, "provider", null);
defineReadOnly(this, "signer", null);
}
else if (Signer.isSigner(signerOrProvider)) {
defineReadOnly(this, "provider", signerOrProvider.provider || null); defineReadOnly(this, "provider", signerOrProvider.provider || null);
defineReadOnly(this, "signer", signerOrProvider); defineReadOnly(this, "signer", signerOrProvider);
} }
@ -469,11 +487,13 @@ export class Contract {
} }
else { else {
try { try {
defineReadOnly(this, "resolvedAddress", Promise.resolve((this.interface.constructor).getAddress(addressOrName))); defineReadOnly(this, "resolvedAddress", Promise.resolve(getAddress(addressOrName)));
} }
catch (error) { catch (error) {
// Without a provider, we cannot use ENS names // Without a provider, we cannot use ENS names
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName); logger.throwError("provider is required to use ENS name as contract address", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Contract"
});
} }
} }
const uniqueNames = {}; const uniqueNames = {};

View File

@ -1 +1 @@
export declare const version = "contracts/5.0.0-beta.154"; export declare const version = "contracts/5.0.0-beta.155";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "contracts/5.0.0-beta.154"; exports.version = "contracts/5.0.0-beta.155";

View File

@ -3,7 +3,6 @@ import { Block, BlockTag, Listener, Log, Provider, TransactionReceipt, Transacti
import { Signer } from "@ethersproject/abstract-signer"; import { Signer } from "@ethersproject/abstract-signer";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { BytesLike } from "@ethersproject/bytes"; import { BytesLike } from "@ethersproject/bytes";
import { UnsignedTransaction } from "@ethersproject/transactions";
export interface Overrides { export interface Overrides {
gasLimit?: BigNumberish | Promise<BigNumberish>; gasLimit?: BigNumberish | Promise<BigNumberish>;
gasPrice?: BigNumberish | Promise<BigNumberish>; gasPrice?: BigNumberish | Promise<BigNumberish>;
@ -16,6 +15,16 @@ export interface CallOverrides extends PayableOverrides {
blockTag?: BlockTag | Promise<BlockTag>; blockTag?: BlockTag | Promise<BlockTag>;
from?: string | Promise<string>; from?: string | Promise<string>;
} }
export interface PopulatedTransaction {
to?: string;
from?: string;
nonce?: number;
gasLimit?: BigNumber;
gasPrice?: BigNumber;
data?: string;
value?: BigNumber;
chainId?: number;
}
export declare type EventFilter = { export declare type EventFilter = {
address?: string; address?: string;
topics?: Array<string | Array<string>>; topics?: Array<string | Array<string>>;
@ -68,7 +77,7 @@ export declare class Contract {
[name: string]: ContractFunction<BigNumber>; [name: string]: ContractFunction<BigNumber>;
}; };
readonly populateTransaction: { readonly populateTransaction: {
[name: string]: ContractFunction<UnsignedTransaction>; [name: string]: ContractFunction<PopulatedTransaction>;
}; };
readonly filters: { readonly filters: {
[name: string]: (...args: Array<any>) => EventFilter; [name: string]: (...args: Array<any>) => EventFilter;
@ -83,7 +92,7 @@ export declare class Contract {
_wrappedEmits: { _wrappedEmits: {
[eventTag: string]: (...args: Array<any>) => void; [eventTag: string]: (...args: Array<any>) => void;
}; };
constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: Signer | Provider); constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider?: Signer | Provider);
static getContractAddress(transaction: { static getContractAddress(transaction: {
from: string; from: string;
nonce: BigNumberish; nonce: BigNumberish;
@ -117,7 +126,7 @@ export declare class ContractFactory {
constructor(contractInterface: ContractInterface, bytecode: BytesLike | { constructor(contractInterface: ContractInterface, bytecode: BytesLike | {
object: string; object: string;
}, signer?: Signer); }, signer?: Signer);
getDeployTransaction(...args: Array<any>): UnsignedTransaction; getDeployTransaction(...args: Array<any>): TransactionRequest;
deploy(...args: Array<any>): Promise<Contract>; deploy(...args: Array<any>): Promise<Contract>;
attach(address: string): Contract; attach(address: string): Contract;
connect(signer: Signer): ContractFactory; connect(signer: Signer): ContractFactory;

View File

@ -62,42 +62,106 @@ var abstract_signer_1 = require("@ethersproject/abstract-signer");
var address_1 = require("@ethersproject/address"); var address_1 = require("@ethersproject/address");
var bignumber_1 = require("@ethersproject/bignumber"); var bignumber_1 = require("@ethersproject/bignumber");
var bytes_1 = require("@ethersproject/bytes"); var bytes_1 = require("@ethersproject/bytes");
//import { AddressZero } from "@ethersproject/constants";
var properties_1 = require("@ethersproject/properties"); var properties_1 = require("@ethersproject/properties");
// @TOOD remove dependences transactions
var logger_1 = require("@ethersproject/logger"); var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version"); var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version); var logger = new logger_1.Logger(_version_1.version);
;
;
/////////////////////////////// ///////////////////////////////
var allowedTransactionKeys = { var allowedTransactionKeys = {
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
}; };
function resolveName(resolver, nameOrPromise) {
return __awaiter(this, void 0, void 0, function () {
var name;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, nameOrPromise];
case 1:
name = _a.sent();
// If it is already an address, just use it (after adding checksum)
try {
return [2 /*return*/, address_1.getAddress(name)];
}
catch (error) { }
if (!resolver) {
logger.throwError("a provider or signer is needed to resolve ENS names", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return [4 /*yield*/, resolver.resolveName(name)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
}
// Recursively replaces ENS names with promises to resolve the name and resolves all properties // Recursively replaces ENS names with promises to resolve the name and resolves all properties
function resolveAddresses(signerOrProvider, value, paramType) { function resolveAddresses(resolver, value, paramType) {
if (Array.isArray(paramType)) { if (Array.isArray(paramType)) {
return Promise.all(paramType.map(function (paramType, index) { return Promise.all(paramType.map(function (paramType, index) {
return resolveAddresses(signerOrProvider, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType); return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
})); }));
} }
if (paramType.type === "address") { if (paramType.type === "address") {
return signerOrProvider.resolveName(value); return resolveName(resolver, value);
} }
if (paramType.type === "tuple") { if (paramType.type === "tuple") {
return resolveAddresses(signerOrProvider, value, paramType.components); return resolveAddresses(resolver, value, paramType.components);
} }
if (paramType.baseType === "array") { if (paramType.baseType === "array") {
if (!Array.isArray(value)) { if (!Array.isArray(value)) {
throw new Error("invalid value for array"); throw new Error("invalid value for array");
} }
return Promise.all(value.map(function (v) { return resolveAddresses(signerOrProvider, v, paramType.arrayChildren); })); return Promise.all(value.map(function (v) { return resolveAddresses(resolver, v, paramType.arrayChildren); }));
} }
return Promise.resolve(value); return Promise.resolve(value);
} }
function _populateTransaction(contract, fragment, args, overrides) { function populateTransaction(contract, fragment, args) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var resolved, tx, ro, leftovers; var overrides, resolved, tx, ro, roValue, leftovers;
var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = properties_1.shallowCopy(overrides); overrides = {};
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = properties_1.shallowCopy(args.pop());
}
// Make sure the parameter count matches
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
// Populate "from" override (allow promises)
if (contract.signer) {
if (overrides.from) {
// Contracts with a Signer are from the Signer's frame-of-reference;
// but we allow overriding "from" if it matches the signer
overrides.from = properties_1.resolveProperties({
override: resolveName(contract.signer, overrides.from),
signer: contract.signer.getAddress()
}).then(function (check) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (address_1.getAddress(check.signer) !== check.override) {
logger.throwError("Contract with a Signer cannot override from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.from"
});
}
return [2 /*return*/, check.override];
});
}); });
}
else {
overrides.from = contract.signer.getAddress();
}
}
else if (overrides.from) {
overrides.from = resolveName(contract.provider, overrides.from);
//} else {
// Contracts without a signer can override "from", and if
// unspecified the zero address is used
//overrides.from = AddressZero;
}
return [4 /*yield*/, properties_1.resolveProperties({ return [4 /*yield*/, properties_1.resolveProperties({
args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs),
address: contract.resolvedAddress, address: contract.resolvedAddress,
@ -110,6 +174,7 @@ function _populateTransaction(contract, fragment, args, overrides) {
to: resolved.address to: resolved.address
}; };
ro = resolved.overrides; ro = resolved.overrides;
// Populate simple overrides
if (ro.nonce != null) { if (ro.nonce != null) {
tx.nonce = bignumber_1.BigNumber.from(ro.nonce).toNumber(); tx.nonce = bignumber_1.BigNumber.from(ro.nonce).toNumber();
} }
@ -119,19 +184,35 @@ function _populateTransaction(contract, fragment, args, overrides) {
if (ro.gasPrice != null) { if (ro.gasPrice != null) {
tx.gasPrice = bignumber_1.BigNumber.from(ro.gasPrice); tx.gasPrice = bignumber_1.BigNumber.from(ro.gasPrice);
} }
// If there was no gasLimit override, but the ABI specifies one use it if (ro.from != null) {
tx.from = ro.from;
}
// If there was no "gasLimit" override, but the ABI specifies a default, use it
if (tx.gasLimit == null && fragment.gas != null) { if (tx.gasLimit == null && fragment.gas != null) {
tx.gasLimit = bignumber_1.BigNumber.from(fragment.gas).add(21000); tx.gasLimit = bignumber_1.BigNumber.from(fragment.gas).add(21000);
} }
// Populate "value" override
if (ro.value) {
roValue = bignumber_1.BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: overrides.value
});
}
tx.value = roValue;
}
// Remvoe the overrides // Remvoe the overrides
delete overrides.nonce; delete overrides.nonce;
delete overrides.gasLimit; delete overrides.gasLimit;
delete overrides.gasPrice; delete overrides.gasPrice;
delete overrides.from;
delete overrides.value;
leftovers = Object.keys(overrides); leftovers = Object.keys(overrides);
if (leftovers.length) { if (leftovers.length) {
logger.throwError("cannot override " + leftovers.map(function (l) { return JSON.stringify(l); }).join(","), logger_1.Logger.errors.UNSUPPORTED_OPERATION, { logger.throwError("cannot override " + leftovers.map(function (l) { return JSON.stringify(l); }).join(","), logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides", operation: "overrides",
keys: leftovers overrides: leftovers
}); });
} }
return [2 /*return*/, tx]; return [2 /*return*/, tx];
@ -139,119 +220,37 @@ function _populateTransaction(contract, fragment, args, overrides) {
}); });
}); });
} }
function populateTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function () {
var ro, value, tx, roValue;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
overrides = properties_1.shallowCopy(overrides);
if (!(contract.deployTransaction != null)) return [3 /*break*/, 2];
return [4 /*yield*/, contract._deployed()];
case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, properties_1.resolveProperties(overrides)];
case 3:
ro = _a.sent();
value = overrides.value;
delete overrides.value;
return [4 /*yield*/, _populateTransaction(contract, fragment, args, overrides)];
case 4:
tx = _a.sent();
if (ro.value) {
roValue = bignumber_1.BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: value
});
}
tx.value = roValue;
}
return [2 /*return*/, tx];
}
});
});
}
function populateCallTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function () {
var blockTag, ro, tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
overrides = properties_1.shallowCopy(overrides);
if (!(contract.deployTransaction != null)) return [3 /*break*/, 4];
blockTag = undefined;
if (!overrides.blockTag) return [3 /*break*/, 2];
return [4 /*yield*/, overrides.blockTag];
case 1:
blockTag = _a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, contract._deployed(blockTag)];
case 3:
_a.sent();
_a.label = 4;
case 4:
// Resolved Overrides
delete overrides.blockTag;
return [4 /*yield*/, properties_1.resolveProperties(overrides)];
case 5:
ro = _a.sent();
delete overrides.from;
return [4 /*yield*/, populateTransaction(contract, fragment, args, overrides)];
case 6:
tx = _a.sent();
if (ro.from) {
tx.from = this.interface.constructor.getAddress(ro.from);
}
return [2 /*return*/, tx];
}
});
});
}
function buildPopulate(contract, fragment) { function buildPopulate(contract, fragment) {
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides;
return __generator(this, function (_a) { return __generator(this, function (_a) {
overrides = null; return [2 /*return*/, populateTransaction(contract, fragment, args)];
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return [2 /*return*/, populate(contract, fragment, args, overrides)];
}); });
}); });
}; };
} }
function buildEstimate(contract, fragment) { function buildEstimate(contract, fragment) {
var signerOrProvider = (contract.signer || contract.provider); var signerOrProvider = (contract.signer || contract.provider);
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, tx; var tx;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = null;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
if (!signerOrProvider) { if (!signerOrProvider) {
logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "estimateGas"
});
} }
return [4 /*yield*/, populate(contract, fragment, args, overrides)]; return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 1: case 1:
tx = _a.sent(); tx = _a.sent();
return [4 /*yield*/, signerOrProvider.estimateGas(tx)]; return [4 /*yield*/, signerOrProvider.estimateGas(tx)];
@ -263,20 +262,18 @@ function buildEstimate(contract, fragment) {
} }
function buildCall(contract, fragment, collapseSimple) { function buildCall(contract, fragment, collapseSimple) {
var signerOrProvider = (contract.signer || contract.provider); var signerOrProvider = (contract.signer || contract.provider);
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, blockTag, tx, value, result; var blockTag, overrides, tx, result, value;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = null;
blockTag = undefined; blockTag = undefined;
if (!(args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object")) return [3 /*break*/, 2]; if (!(args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object")) return [3 /*break*/, 3];
overrides = properties_1.shallowCopy(args.pop()); overrides = properties_1.shallowCopy(args.pop());
if (!overrides.blockTag) return [3 /*break*/, 2]; if (!overrides.blockTag) return [3 /*break*/, 2];
return [4 /*yield*/, overrides.blockTag]; return [4 /*yield*/, overrides.blockTag];
@ -285,19 +282,26 @@ function buildCall(contract, fragment, collapseSimple) {
delete overrides.blockTag; delete overrides.blockTag;
_a.label = 2; _a.label = 2;
case 2: case 2:
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); args.push(overrides);
return [4 /*yield*/, populate(contract, fragment, args, overrides)]; _a.label = 3;
case 3: case 3:
if (!(contract.deployTransaction != null)) return [3 /*break*/, 5];
return [4 /*yield*/, contract._deployed(blockTag)];
case 4:
_a.sent();
_a.label = 5;
case 5: return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 6:
tx = _a.sent(); tx = _a.sent();
return [4 /*yield*/, signerOrProvider.call(tx, blockTag)]; return [4 /*yield*/, signerOrProvider.call(tx, blockTag)];
case 4: case 7:
value = _a.sent(); result = _a.sent();
try { try {
result = contract.interface.decodeFunctionResult(fragment, value); value = contract.interface.decodeFunctionResult(fragment, result);
if (collapseSimple && fragment.outputs.length === 1) { if (collapseSimple && fragment.outputs.length === 1) {
result = result[0]; value = value[0];
} }
return [2 /*return*/, result]; return [2 /*return*/, value];
} }
catch (error) { catch (error) {
if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) { if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) {
@ -320,27 +324,26 @@ function buildSend(contract, fragment) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, txRequest, tx, wait; var txRequest, tx, wait;
var _this = this; var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
if (!contract.signer) { if (!contract.signer) {
logger.throwError("sending a transaction requires a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); logger.throwError("sending a transaction requires a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "sendTransaction"
});
} }
overrides = null; if (!(contract.deployTransaction != null)) return [3 /*break*/, 2];
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { return [4 /*yield*/, contract._deployed()];
overrides = properties_1.shallowCopy(args.pop());
if (overrides.blockTag != null) {
logger.throwArgumentError("cannot override \"blockTag\" in transaction", "overrides", overrides);
}
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return [4 /*yield*/, populateCallTransaction(contract, fragment, args, overrides)];
case 1: case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 3:
txRequest = _a.sent(); txRequest = _a.sent();
return [4 /*yield*/, contract.signer.sendTransaction(txRequest)]; return [4 /*yield*/, contract.signer.sendTransaction(txRequest)];
case 2: case 4:
tx = _a.sent(); tx = _a.sent();
wait = tx.wait.bind(tx); wait = tx.wait.bind(tx);
tx.wait = function (confirmations) { tx.wait = function (confirmations) {
@ -551,7 +554,11 @@ var Contract = /** @class */ (function () {
// @TODO: Maybe still check the addressOrName looks like a valid address or name? // @TODO: Maybe still check the addressOrName looks like a valid address or name?
//address = getAddress(address); //address = getAddress(address);
properties_1.defineReadOnly(this, "interface", properties_1.getStatic((_newTarget), "getInterface")(contractInterface)); properties_1.defineReadOnly(this, "interface", properties_1.getStatic((_newTarget), "getInterface")(contractInterface));
if (abstract_signer_1.Signer.isSigner(signerOrProvider)) { if (signerOrProvider == null) {
properties_1.defineReadOnly(this, "provider", null);
properties_1.defineReadOnly(this, "signer", null);
}
else if (abstract_signer_1.Signer.isSigner(signerOrProvider)) {
properties_1.defineReadOnly(this, "provider", signerOrProvider.provider || null); properties_1.defineReadOnly(this, "provider", signerOrProvider.provider || null);
properties_1.defineReadOnly(this, "signer", signerOrProvider); properties_1.defineReadOnly(this, "signer", signerOrProvider);
} }
@ -612,11 +619,13 @@ var Contract = /** @class */ (function () {
} }
else { else {
try { try {
properties_1.defineReadOnly(this, "resolvedAddress", Promise.resolve((this.interface.constructor).getAddress(addressOrName))); properties_1.defineReadOnly(this, "resolvedAddress", Promise.resolve(address_1.getAddress(addressOrName)));
} }
catch (error) { catch (error) {
// Without a provider, we cannot use ENS names // Without a provider, we cannot use ENS names
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName); logger.throwError("provider is required to use ENS name as contract address", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Contract"
});
} }
} }
var uniqueNames = {}; var uniqueNames = {};

View File

@ -9,8 +9,7 @@
"@ethersproject/bytes": ">=5.0.0-beta.137", "@ethersproject/bytes": ">=5.0.0-beta.137",
"@ethersproject/constants": ">=5.0.0-beta.133", "@ethersproject/constants": ">=5.0.0-beta.133",
"@ethersproject/logger": ">=5.0.0-beta.137", "@ethersproject/logger": ">=5.0.0-beta.137",
"@ethersproject/properties": ">=5.0.0-beta.140", "@ethersproject/properties": ">=5.0.0-beta.140"
"@ethersproject/transactions": ">=5.0.0-beta.135"
}, },
"description": "Contract abstraction meta-class for ethers.", "description": "Contract abstraction meta-class for ethers.",
"ethereum": "donations.ethers.eth", "ethereum": "donations.ethers.eth",
@ -32,7 +31,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0xc7210dbd8a387e8ee1b090ba36f5393ab7167a7a5fbb2dea34fc938b2e5c67e6", "tarballHash": "0xccc2bced42f75b771c52745a7f9736b37b1adbb9d4e67c694c143422fe1e6ad4",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.154" "version": "5.0.0-beta.155"
} }

View File

@ -1 +1 @@
export const version = "contracts/5.0.0-beta.154"; export const version = "contracts/5.0.0-beta.155";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4689,7 +4689,7 @@ class FixedNumber {
} }
} }
const version$3 = "properties/5.0.0-beta.142"; const version$3 = "properties/5.0.0-beta.143";
"use strict"; "use strict";
var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@ -7915,7 +7915,7 @@ class Interface {
"use strict"; "use strict";
const version$9 = "abstract-provider/5.0.0-beta.141"; const version$9 = "abstract-provider/5.0.0-beta.142";
"use strict"; "use strict";
const logger$d = new Logger(version$9); const logger$d = new Logger(version$9);
@ -7992,7 +7992,7 @@ class Provider {
} }
} }
const version$a = "abstract-signer/5.0.0-beta.144"; const version$a = "abstract-signer/5.0.0-beta.145";
"use strict"; "use strict";
var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@ -8192,7 +8192,7 @@ class VoidSigner extends Signer {
} }
} }
const version$b = "contracts/5.0.0-beta.154"; const version$b = "contracts/5.0.0-beta.155";
"use strict"; "use strict";
var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@ -8205,35 +8205,87 @@ var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments,
}); });
}; };
const logger$f = new Logger(version$b); const logger$f = new Logger(version$b);
;
;
/////////////////////////////// ///////////////////////////////
const allowedTransactionKeys$1 = { const allowedTransactionKeys$1 = {
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
}; };
function resolveName(resolver, nameOrPromise) {
return __awaiter$2(this, void 0, void 0, function* () {
const name = yield nameOrPromise;
// If it is already an address, just use it (after adding checksum)
try {
return getAddress(name);
}
catch (error) { }
if (!resolver) {
logger$f.throwError("a provider or signer is needed to resolve ENS names", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return yield resolver.resolveName(name);
});
}
// Recursively replaces ENS names with promises to resolve the name and resolves all properties // Recursively replaces ENS names with promises to resolve the name and resolves all properties
function resolveAddresses(signerOrProvider, value, paramType) { function resolveAddresses(resolver, value, paramType) {
if (Array.isArray(paramType)) { if (Array.isArray(paramType)) {
return Promise.all(paramType.map((paramType, index) => { return Promise.all(paramType.map((paramType, index) => {
return resolveAddresses(signerOrProvider, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType); return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
})); }));
} }
if (paramType.type === "address") { if (paramType.type === "address") {
return signerOrProvider.resolveName(value); return resolveName(resolver, value);
} }
if (paramType.type === "tuple") { if (paramType.type === "tuple") {
return resolveAddresses(signerOrProvider, value, paramType.components); return resolveAddresses(resolver, value, paramType.components);
} }
if (paramType.baseType === "array") { if (paramType.baseType === "array") {
if (!Array.isArray(value)) { if (!Array.isArray(value)) {
throw new Error("invalid value for array"); throw new Error("invalid value for array");
} }
return Promise.all(value.map((v) => resolveAddresses(signerOrProvider, v, paramType.arrayChildren))); return Promise.all(value.map((v) => resolveAddresses(resolver, v, paramType.arrayChildren)));
} }
return Promise.resolve(value); return Promise.resolve(value);
} }
function _populateTransaction(contract, fragment, args, overrides) { function populateTransaction(contract, fragment, args) {
return __awaiter$2(this, void 0, void 0, function* () { return __awaiter$2(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides); // If an extra argument is given, it is overrides
// Wait for all dependency addresses to be resolved (prefer the signer over the provider) let overrides = {};
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = shallowCopy(args.pop());
}
// Make sure the parameter count matches
logger$f.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
// Populate "from" override (allow promises)
if (contract.signer) {
if (overrides.from) {
// Contracts with a Signer are from the Signer's frame-of-reference;
// but we allow overriding "from" if it matches the signer
overrides.from = resolveProperties({
override: resolveName(contract.signer, overrides.from),
signer: contract.signer.getAddress()
}).then((check) => __awaiter$2(this, void 0, void 0, function* () {
if (getAddress(check.signer) !== check.override) {
logger$f.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.from"
});
}
return check.override;
}));
}
else {
overrides.from = contract.signer.getAddress();
}
}
else if (overrides.from) {
overrides.from = resolveName(contract.provider, overrides.from);
//} else {
// Contracts without a signer can override "from", and if
// unspecified the zero address is used
//overrides.from = AddressZero;
}
// Wait for all dependencies to be resolved (prefer the signer over the provider)
const resolved = yield resolveProperties({ const resolved = yield resolveProperties({
args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs),
address: contract.resolvedAddress, address: contract.resolvedAddress,
@ -8246,6 +8298,7 @@ function _populateTransaction(contract, fragment, args, overrides) {
}; };
// Resolved Overrides // Resolved Overrides
const ro = resolved.overrides; const ro = resolved.overrides;
// Populate simple overrides
if (ro.nonce != null) { if (ro.nonce != null) {
tx.nonce = BigNumber.from(ro.nonce).toNumber(); tx.nonce = BigNumber.from(ro.nonce).toNumber();
} }
@ -8255,128 +8308,90 @@ function _populateTransaction(contract, fragment, args, overrides) {
if (ro.gasPrice != null) { if (ro.gasPrice != null) {
tx.gasPrice = BigNumber.from(ro.gasPrice); tx.gasPrice = BigNumber.from(ro.gasPrice);
} }
// If there was no gasLimit override, but the ABI specifies one use it if (ro.from != null) {
tx.from = ro.from;
}
// If there was no "gasLimit" override, but the ABI specifies a default, use it
if (tx.gasLimit == null && fragment.gas != null) { if (tx.gasLimit == null && fragment.gas != null) {
tx.gasLimit = BigNumber.from(fragment.gas).add(21000); tx.gasLimit = BigNumber.from(fragment.gas).add(21000);
} }
// Populate "value" override
if (ro.value) {
const roValue = BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger$f.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: overrides.value
});
}
tx.value = roValue;
}
// Remvoe the overrides // Remvoe the overrides
delete overrides.nonce; delete overrides.nonce;
delete overrides.gasLimit; delete overrides.gasLimit;
delete overrides.gasPrice; delete overrides.gasPrice;
// @TODO: Maybe move all tx property validation to the Signer and Provider? delete overrides.from;
delete overrides.value;
// Make sure there are no stray overrides, which may indicate a // Make sure there are no stray overrides, which may indicate a
// typo or using an unsupported key. // typo or using an unsupported key.
const leftovers = Object.keys(overrides); const leftovers = Object.keys(overrides);
if (leftovers.length) { if (leftovers.length) {
logger$f.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, { logger$f.throwError(`cannot override ${leftovers.map((l) => JSON.stringify(l)).join(",")}`, Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides", operation: "overrides",
keys: leftovers overrides: leftovers
}); });
} }
return tx; return tx;
}); });
} }
function populateTransaction(contract, fragment, args, overrides) {
return __awaiter$2(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides);
// If the contract was just deployed, wait until it is minded
if (contract.deployTransaction != null) {
yield contract._deployed();
}
// Resolved Overrides (keep value for errors)
const ro = yield resolveProperties(overrides);
const value = overrides.value;
delete overrides.value;
const tx = yield _populateTransaction(contract, fragment, args, overrides);
if (ro.value) {
const roValue = BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger$f.throwError("non-payable method cannot override value", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: value
});
}
tx.value = roValue;
}
return tx;
});
}
function populateCallTransaction(contract, fragment, args, overrides) {
return __awaiter$2(this, void 0, void 0, function* () {
overrides = shallowCopy(overrides);
// If the contract was just deployed, wait until it is minded
if (contract.deployTransaction != null) {
let blockTag = undefined;
if (overrides.blockTag) {
blockTag = yield overrides.blockTag;
}
yield contract._deployed(blockTag);
}
// Resolved Overrides
delete overrides.blockTag;
const ro = yield resolveProperties(overrides);
delete overrides.from;
const tx = yield populateTransaction(contract, fragment, args, overrides);
if (ro.from) {
tx.from = this.interface.constructor.getAddress(ro.from);
}
return tx;
});
}
function buildPopulate(contract, fragment) { function buildPopulate(contract, fragment) {
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter$2(this, void 0, void 0, function* () { return __awaiter$2(this, void 0, void 0, function* () {
let overrides = null; return populateTransaction(contract, fragment, args);
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger$f.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return populate(contract, fragment, args, overrides);
}); });
}; };
} }
function buildEstimate(contract, fragment) { function buildEstimate(contract, fragment) {
const signerOrProvider = (contract.signer || contract.provider); const signerOrProvider = (contract.signer || contract.provider);
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter$2(this, void 0, void 0, function* () { return __awaiter$2(this, void 0, void 0, function* () {
let overrides = null;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger$f.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
if (!signerOrProvider) { if (!signerOrProvider) {
logger$f.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); logger$f.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "estimateGas"
});
} }
const tx = yield populate(contract, fragment, args, overrides); const tx = yield populateTransaction(contract, fragment, args);
return yield signerOrProvider.estimateGas(tx); return yield signerOrProvider.estimateGas(tx);
}); });
}; };
} }
function buildCall(contract, fragment, collapseSimple) { function buildCall(contract, fragment, collapseSimple) {
const signerOrProvider = (contract.signer || contract.provider); const signerOrProvider = (contract.signer || contract.provider);
const populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function (...args) { return function (...args) {
return __awaiter$2(this, void 0, void 0, function* () { return __awaiter$2(this, void 0, void 0, function* () {
let overrides = null; // Extract the "blockTag" override if present
let blockTag = undefined; let blockTag = undefined;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = shallowCopy(args.pop()); const overrides = shallowCopy(args.pop());
if (overrides.blockTag) { if (overrides.blockTag) {
blockTag = yield overrides.blockTag; blockTag = yield overrides.blockTag;
delete overrides.blockTag; delete overrides.blockTag;
} }
args.push(overrides);
} }
logger$f.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // If the contract was just deployed, wait until it is mined
const tx = yield populate(contract, fragment, args, overrides); if (contract.deployTransaction != null) {
const value = yield signerOrProvider.call(tx, blockTag); yield contract._deployed(blockTag);
}
// Call a node and get the result
const tx = yield populateTransaction(contract, fragment, args);
const result = yield signerOrProvider.call(tx, blockTag);
try { try {
let result = contract.interface.decodeFunctionResult(fragment, value); let value = contract.interface.decodeFunctionResult(fragment, result);
if (collapseSimple && fragment.outputs.length === 1) { if (collapseSimple && fragment.outputs.length === 1) {
result = result[0]; value = value[0];
} }
return result; return value;
} }
catch (error) { catch (error) {
if (error.code === Logger.errors.CALL_EXCEPTION) { if (error.code === Logger.errors.CALL_EXCEPTION) {
@ -8393,18 +8408,15 @@ function buildSend(contract, fragment) {
return function (...args) { return function (...args) {
return __awaiter$2(this, void 0, void 0, function* () { return __awaiter$2(this, void 0, void 0, function* () {
if (!contract.signer) { if (!contract.signer) {
logger$f.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); logger$f.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "sendTransaction"
});
} }
// We allow CallOverrides, since the Signer can accept from // If the contract was just deployed, wait until it is minded
let overrides = null; if (contract.deployTransaction != null) {
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { yield contract._deployed();
overrides = shallowCopy(args.pop());
if (overrides.blockTag != null) {
logger$f.throwArgumentError(`cannot override "blockTag" in transaction`, "overrides", overrides);
}
} }
logger$f.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); const txRequest = yield populateTransaction(contract, fragment, args);
const txRequest = yield populateCallTransaction(contract, fragment, args, overrides);
const tx = yield contract.signer.sendTransaction(txRequest); const tx = yield contract.signer.sendTransaction(txRequest);
// Tweak the tw.wait so the receipt has extra properties // Tweak the tw.wait so the receipt has extra properties
const wait = tx.wait.bind(tx); const wait = tx.wait.bind(tx);
@ -8599,7 +8611,11 @@ class Contract {
// @TODO: Maybe still check the addressOrName looks like a valid address or name? // @TODO: Maybe still check the addressOrName looks like a valid address or name?
//address = getAddress(address); //address = getAddress(address);
defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface)); defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface));
if (Signer.isSigner(signerOrProvider)) { if (signerOrProvider == null) {
defineReadOnly(this, "provider", null);
defineReadOnly(this, "signer", null);
}
else if (Signer.isSigner(signerOrProvider)) {
defineReadOnly(this, "provider", signerOrProvider.provider || null); defineReadOnly(this, "provider", signerOrProvider.provider || null);
defineReadOnly(this, "signer", signerOrProvider); defineReadOnly(this, "signer", signerOrProvider);
} }
@ -8656,11 +8672,13 @@ class Contract {
} }
else { else {
try { try {
defineReadOnly(this, "resolvedAddress", Promise.resolve((this.interface.constructor).getAddress(addressOrName))); defineReadOnly(this, "resolvedAddress", Promise.resolve(getAddress(addressOrName)));
} }
catch (error) { catch (error) {
// Without a provider, we cannot use ENS names // Without a provider, we cannot use ENS names
logger$f.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName); logger$f.throwError("provider is required to use ENS name as contract address", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Contract"
});
} }
} }
const uniqueNames = {}; const uniqueNames = {};
@ -16123,7 +16141,7 @@ function poll(func, options) {
}); });
} }
const version$m = "providers/5.0.0-beta.169"; const version$m = "providers/5.0.0-beta.170";
"use strict"; "use strict";
const logger$q = new Logger(version$m); const logger$q = new Logger(version$m);
@ -18981,7 +18999,7 @@ var browserIpcProvider = {
var _version$2 = createCommonjsModule(function (module, exports) { var _version$2 = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.169"; exports.version = "providers/5.0.0-beta.170";
}); });
var _version$3 = unwrapExports(_version$2); var _version$3 = unwrapExports(_version$2);
@ -19755,7 +19773,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Indexed: Indexed Indexed: Indexed
}); });
const version$o = "ethers/5.0.0-beta.189"; const version$o = "ethers/5.0.0-beta.190";
"use strict"; "use strict";
const logger$E = new Logger(version$o); const logger$E = new Logger(version$o);

File diff suppressed because one or more lines are too long

View File

@ -4817,7 +4817,7 @@
var _version$6 = createCommonjsModule(function (module, exports) { var _version$6 = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "properties/5.0.0-beta.142"; exports.version = "properties/5.0.0-beta.143";
}); });
var _version$7 = unwrapExports(_version$6); var _version$7 = unwrapExports(_version$6);
@ -8767,7 +8767,7 @@
var _version$i = createCommonjsModule(function (module, exports) { var _version$i = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-provider/5.0.0-beta.141"; exports.version = "abstract-provider/5.0.0-beta.142";
}); });
var _version$j = unwrapExports(_version$i); var _version$j = unwrapExports(_version$i);
@ -8902,7 +8902,7 @@
var _version$k = createCommonjsModule(function (module, exports) { var _version$k = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-signer/5.0.0-beta.144"; exports.version = "abstract-signer/5.0.0-beta.145";
}); });
var _version$l = unwrapExports(_version$k); var _version$l = unwrapExports(_version$k);
@ -9228,7 +9228,7 @@
var _version$m = createCommonjsModule(function (module, exports) { var _version$m = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "contracts/5.0.0-beta.154"; exports.version = "contracts/5.0.0-beta.155";
}); });
var _version$n = unwrapExports(_version$m); var _version$n = unwrapExports(_version$m);
@ -9299,42 +9299,106 @@
//import { AddressZero } from "@ethersproject/constants";
// @TOOD remove dependences transactions
var logger = new lib.Logger(_version$m.version); var logger = new lib.Logger(_version$m.version);
;
;
/////////////////////////////// ///////////////////////////////
var allowedTransactionKeys = { var allowedTransactionKeys = {
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
}; };
function resolveName(resolver, nameOrPromise) {
return __awaiter(this, void 0, void 0, function () {
var name;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, nameOrPromise];
case 1:
name = _a.sent();
// If it is already an address, just use it (after adding checksum)
try {
return [2 /*return*/, lib$6.getAddress(name)];
}
catch (error) { }
if (!resolver) {
logger.throwError("a provider or signer is needed to resolve ENS names", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return [4 /*yield*/, resolver.resolveName(name)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
}
// Recursively replaces ENS names with promises to resolve the name and resolves all properties // Recursively replaces ENS names with promises to resolve the name and resolves all properties
function resolveAddresses(signerOrProvider, value, paramType) { function resolveAddresses(resolver, value, paramType) {
if (Array.isArray(paramType)) { if (Array.isArray(paramType)) {
return Promise.all(paramType.map(function (paramType, index) { return Promise.all(paramType.map(function (paramType, index) {
return resolveAddresses(signerOrProvider, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType); return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
})); }));
} }
if (paramType.type === "address") { if (paramType.type === "address") {
return signerOrProvider.resolveName(value); return resolveName(resolver, value);
} }
if (paramType.type === "tuple") { if (paramType.type === "tuple") {
return resolveAddresses(signerOrProvider, value, paramType.components); return resolveAddresses(resolver, value, paramType.components);
} }
if (paramType.baseType === "array") { if (paramType.baseType === "array") {
if (!Array.isArray(value)) { if (!Array.isArray(value)) {
throw new Error("invalid value for array"); throw new Error("invalid value for array");
} }
return Promise.all(value.map(function (v) { return resolveAddresses(signerOrProvider, v, paramType.arrayChildren); })); return Promise.all(value.map(function (v) { return resolveAddresses(resolver, v, paramType.arrayChildren); }));
} }
return Promise.resolve(value); return Promise.resolve(value);
} }
function _populateTransaction(contract, fragment, args, overrides) { function populateTransaction(contract, fragment, args) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var resolved, tx, ro, leftovers; var overrides, resolved, tx, ro, roValue, leftovers;
var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = lib$3.shallowCopy(overrides); overrides = {};
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = lib$3.shallowCopy(args.pop());
}
// Make sure the parameter count matches
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
// Populate "from" override (allow promises)
if (contract.signer) {
if (overrides.from) {
// Contracts with a Signer are from the Signer's frame-of-reference;
// but we allow overriding "from" if it matches the signer
overrides.from = lib$3.resolveProperties({
override: resolveName(contract.signer, overrides.from),
signer: contract.signer.getAddress()
}).then(function (check) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (lib$6.getAddress(check.signer) !== check.override) {
logger.throwError("Contract with a Signer cannot override from", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.from"
});
}
return [2 /*return*/, check.override];
});
}); });
}
else {
overrides.from = contract.signer.getAddress();
}
}
else if (overrides.from) {
overrides.from = resolveName(contract.provider, overrides.from);
//} else {
// Contracts without a signer can override "from", and if
// unspecified the zero address is used
//overrides.from = AddressZero;
}
return [4 /*yield*/, lib$3.resolveProperties({ return [4 /*yield*/, lib$3.resolveProperties({
args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs),
address: contract.resolvedAddress, address: contract.resolvedAddress,
@ -9347,6 +9411,7 @@
to: resolved.address to: resolved.address
}; };
ro = resolved.overrides; ro = resolved.overrides;
// Populate simple overrides
if (ro.nonce != null) { if (ro.nonce != null) {
tx.nonce = lib$2.BigNumber.from(ro.nonce).toNumber(); tx.nonce = lib$2.BigNumber.from(ro.nonce).toNumber();
} }
@ -9356,19 +9421,35 @@
if (ro.gasPrice != null) { if (ro.gasPrice != null) {
tx.gasPrice = lib$2.BigNumber.from(ro.gasPrice); tx.gasPrice = lib$2.BigNumber.from(ro.gasPrice);
} }
// If there was no gasLimit override, but the ABI specifies one use it if (ro.from != null) {
tx.from = ro.from;
}
// If there was no "gasLimit" override, but the ABI specifies a default, use it
if (tx.gasLimit == null && fragment.gas != null) { if (tx.gasLimit == null && fragment.gas != null) {
tx.gasLimit = lib$2.BigNumber.from(fragment.gas).add(21000); tx.gasLimit = lib$2.BigNumber.from(fragment.gas).add(21000);
} }
// Populate "value" override
if (ro.value) {
roValue = lib$2.BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: overrides.value
});
}
tx.value = roValue;
}
// Remvoe the overrides // Remvoe the overrides
delete overrides.nonce; delete overrides.nonce;
delete overrides.gasLimit; delete overrides.gasLimit;
delete overrides.gasPrice; delete overrides.gasPrice;
delete overrides.from;
delete overrides.value;
leftovers = Object.keys(overrides); leftovers = Object.keys(overrides);
if (leftovers.length) { if (leftovers.length) {
logger.throwError("cannot override " + leftovers.map(function (l) { return JSON.stringify(l); }).join(","), lib.Logger.errors.UNSUPPORTED_OPERATION, { logger.throwError("cannot override " + leftovers.map(function (l) { return JSON.stringify(l); }).join(","), lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides", operation: "overrides",
keys: leftovers overrides: leftovers
}); });
} }
return [2 /*return*/, tx]; return [2 /*return*/, tx];
@ -9376,119 +9457,37 @@
}); });
}); });
} }
function populateTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function () {
var ro, value, tx, roValue;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
overrides = lib$3.shallowCopy(overrides);
if (!(contract.deployTransaction != null)) return [3 /*break*/, 2];
return [4 /*yield*/, contract._deployed()];
case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, lib$3.resolveProperties(overrides)];
case 3:
ro = _a.sent();
value = overrides.value;
delete overrides.value;
return [4 /*yield*/, _populateTransaction(contract, fragment, args, overrides)];
case 4:
tx = _a.sent();
if (ro.value) {
roValue = lib$2.BigNumber.from(ro.value);
if (!roValue.isZero() && !fragment.payable) {
logger.throwError("non-payable method cannot override value", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "overrides.value",
value: value
});
}
tx.value = roValue;
}
return [2 /*return*/, tx];
}
});
});
}
function populateCallTransaction(contract, fragment, args, overrides) {
return __awaiter(this, void 0, void 0, function () {
var blockTag, ro, tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
overrides = lib$3.shallowCopy(overrides);
if (!(contract.deployTransaction != null)) return [3 /*break*/, 4];
blockTag = undefined;
if (!overrides.blockTag) return [3 /*break*/, 2];
return [4 /*yield*/, overrides.blockTag];
case 1:
blockTag = _a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, contract._deployed(blockTag)];
case 3:
_a.sent();
_a.label = 4;
case 4:
// Resolved Overrides
delete overrides.blockTag;
return [4 /*yield*/, lib$3.resolveProperties(overrides)];
case 5:
ro = _a.sent();
delete overrides.from;
return [4 /*yield*/, populateTransaction(contract, fragment, args, overrides)];
case 6:
tx = _a.sent();
if (ro.from) {
tx.from = this.interface.constructor.getAddress(ro.from);
}
return [2 /*return*/, tx];
}
});
});
}
function buildPopulate(contract, fragment) { function buildPopulate(contract, fragment) {
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides;
return __generator(this, function (_a) { return __generator(this, function (_a) {
overrides = null; return [2 /*return*/, populateTransaction(contract, fragment, args)];
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return [2 /*return*/, populate(contract, fragment, args, overrides)];
}); });
}); });
}; };
} }
function buildEstimate(contract, fragment) { function buildEstimate(contract, fragment) {
var signerOrProvider = (contract.signer || contract.provider); var signerOrProvider = (contract.signer || contract.provider);
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, tx; var tx;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = null;
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
overrides = args.pop();
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
if (!signerOrProvider) { if (!signerOrProvider) {
logger.throwError("estimate require a provider or signer", lib.Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); logger.throwError("estimate require a provider or signer", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "estimateGas"
});
} }
return [4 /*yield*/, populate(contract, fragment, args, overrides)]; return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 1: case 1:
tx = _a.sent(); tx = _a.sent();
return [4 /*yield*/, signerOrProvider.estimateGas(tx)]; return [4 /*yield*/, signerOrProvider.estimateGas(tx)];
@ -9500,20 +9499,18 @@
} }
function buildCall(contract, fragment, collapseSimple) { function buildCall(contract, fragment, collapseSimple) {
var signerOrProvider = (contract.signer || contract.provider); var signerOrProvider = (contract.signer || contract.provider);
var populate = (fragment.constant) ? populateCallTransaction : populateTransaction;
return function () { return function () {
var args = []; var args = [];
for (var _i = 0; _i < arguments.length; _i++) { for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, blockTag, tx, value, result; var blockTag, overrides, tx, result, value;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
overrides = null;
blockTag = undefined; blockTag = undefined;
if (!(args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object")) return [3 /*break*/, 2]; if (!(args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object")) return [3 /*break*/, 3];
overrides = lib$3.shallowCopy(args.pop()); overrides = lib$3.shallowCopy(args.pop());
if (!overrides.blockTag) return [3 /*break*/, 2]; if (!overrides.blockTag) return [3 /*break*/, 2];
return [4 /*yield*/, overrides.blockTag]; return [4 /*yield*/, overrides.blockTag];
@ -9522,19 +9519,26 @@
delete overrides.blockTag; delete overrides.blockTag;
_a.label = 2; _a.label = 2;
case 2: case 2:
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); args.push(overrides);
return [4 /*yield*/, populate(contract, fragment, args, overrides)]; _a.label = 3;
case 3: case 3:
if (!(contract.deployTransaction != null)) return [3 /*break*/, 5];
return [4 /*yield*/, contract._deployed(blockTag)];
case 4:
_a.sent();
_a.label = 5;
case 5: return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 6:
tx = _a.sent(); tx = _a.sent();
return [4 /*yield*/, signerOrProvider.call(tx, blockTag)]; return [4 /*yield*/, signerOrProvider.call(tx, blockTag)];
case 4: case 7:
value = _a.sent(); result = _a.sent();
try { try {
result = contract.interface.decodeFunctionResult(fragment, value); value = contract.interface.decodeFunctionResult(fragment, result);
if (collapseSimple && fragment.outputs.length === 1) { if (collapseSimple && fragment.outputs.length === 1) {
result = result[0]; value = value[0];
} }
return [2 /*return*/, result]; return [2 /*return*/, value];
} }
catch (error) { catch (error) {
if (error.code === lib.Logger.errors.CALL_EXCEPTION) { if (error.code === lib.Logger.errors.CALL_EXCEPTION) {
@ -9557,27 +9561,26 @@
args[_i] = arguments[_i]; args[_i] = arguments[_i];
} }
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var overrides, txRequest, tx, wait; var txRequest, tx, wait;
var _this = this; var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
if (!contract.signer) { if (!contract.signer) {
logger.throwError("sending a transaction requires a signer", lib.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); logger.throwError("sending a transaction requires a signer", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "sendTransaction"
});
} }
overrides = null; if (!(contract.deployTransaction != null)) return [3 /*break*/, 2];
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") { return [4 /*yield*/, contract._deployed()];
overrides = lib$3.shallowCopy(args.pop());
if (overrides.blockTag != null) {
logger.throwArgumentError("cannot override \"blockTag\" in transaction", "overrides", overrides);
}
}
logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract");
return [4 /*yield*/, populateCallTransaction(contract, fragment, args, overrides)];
case 1: case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, populateTransaction(contract, fragment, args)];
case 3:
txRequest = _a.sent(); txRequest = _a.sent();
return [4 /*yield*/, contract.signer.sendTransaction(txRequest)]; return [4 /*yield*/, contract.signer.sendTransaction(txRequest)];
case 2: case 4:
tx = _a.sent(); tx = _a.sent();
wait = tx.wait.bind(tx); wait = tx.wait.bind(tx);
tx.wait = function (confirmations) { tx.wait = function (confirmations) {
@ -9788,7 +9791,11 @@
// @TODO: Maybe still check the addressOrName looks like a valid address or name? // @TODO: Maybe still check the addressOrName looks like a valid address or name?
//address = getAddress(address); //address = getAddress(address);
lib$3.defineReadOnly(this, "interface", lib$3.getStatic((_newTarget), "getInterface")(contractInterface)); lib$3.defineReadOnly(this, "interface", lib$3.getStatic((_newTarget), "getInterface")(contractInterface));
if (lib$c.Signer.isSigner(signerOrProvider)) { if (signerOrProvider == null) {
lib$3.defineReadOnly(this, "provider", null);
lib$3.defineReadOnly(this, "signer", null);
}
else if (lib$c.Signer.isSigner(signerOrProvider)) {
lib$3.defineReadOnly(this, "provider", signerOrProvider.provider || null); lib$3.defineReadOnly(this, "provider", signerOrProvider.provider || null);
lib$3.defineReadOnly(this, "signer", signerOrProvider); lib$3.defineReadOnly(this, "signer", signerOrProvider);
} }
@ -9849,11 +9856,13 @@
} }
else { else {
try { try {
lib$3.defineReadOnly(this, "resolvedAddress", Promise.resolve((this.interface.constructor).getAddress(addressOrName))); lib$3.defineReadOnly(this, "resolvedAddress", Promise.resolve(lib$6.getAddress(addressOrName)));
} }
catch (error) { catch (error) {
// Without a provider, we cannot use ENS names // Without a provider, we cannot use ENS names
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName); logger.throwError("provider is required to use ENS name as contract address", lib.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Contract"
});
} }
} }
var uniqueNames = {}; var uniqueNames = {};
@ -17944,7 +17953,7 @@
var _version$I = createCommonjsModule(function (module, exports) { var _version$I = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.169"; exports.version = "providers/5.0.0-beta.170";
}); });
var _version$J = unwrapExports(_version$I); var _version$J = unwrapExports(_version$I);
@ -22837,7 +22846,7 @@
var _version$M = createCommonjsModule(function (module, exports) { var _version$M = createCommonjsModule(function (module, exports) {
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.189"; exports.version = "ethers/5.0.0-beta.190";
}); });
var _version$N = unwrapExports(_version$M); var _version$N = unwrapExports(_version$M);

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.189"; export declare const version = "ethers/5.0.0-beta.190";

View File

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.189"; export const version = "ethers/5.0.0-beta.190";

View File

@ -13,5 +13,5 @@ import { Bytes, BytesLike, Signature } from "@ethersproject/bytes";
import { Transaction, UnsignedTransaction } from "@ethersproject/transactions"; import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
import { version } from "./_version"; import { version } from "./_version";
declare const logger: utils.Logger; declare const logger: utils.Logger;
import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface } from "@ethersproject/contracts"; import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface } from "@ethersproject/contracts";
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist }; export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };

View File

@ -1,3 +1,3 @@
import * as ethers from "./ethers"; import * as ethers from "./ethers";
export { ethers }; export { ethers };
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist } from "./ethers"; export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist } from "./ethers";

View File

@ -25,6 +25,7 @@ import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes"; import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { Mnemonic } from "@ethersproject/hdnode"; import { Mnemonic } from "@ethersproject/hdnode";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets"; import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Deferrable } from "@ethersproject/properties";
import { Utf8ErrorFunc } from "@ethersproject/strings"; import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web"; import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback }; export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

View File

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.189"; export declare const version = "ethers/5.0.0-beta.190";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.189"; exports.version = "ethers/5.0.0-beta.190";

View File

@ -13,5 +13,5 @@ import { Bytes, BytesLike, Signature } from "@ethersproject/bytes";
import { Transaction, UnsignedTransaction } from "@ethersproject/transactions"; import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
import { version } from "./_version"; import { version } from "./_version";
declare const logger: utils.Logger; declare const logger: utils.Logger;
import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface } from "@ethersproject/contracts"; import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface } from "@ethersproject/contracts";
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist }; export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };

View File

@ -1,3 +1,3 @@
import * as ethers from "./ethers"; import * as ethers from "./ethers";
export { ethers }; export { ethers };
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist } from "./ethers"; export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, PopulatedTransaction, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist } from "./ethers";

View File

@ -25,6 +25,7 @@ import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes"; import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { Mnemonic } from "@ethersproject/hdnode"; import { Mnemonic } from "@ethersproject/hdnode";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets"; import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Deferrable } from "@ethersproject/properties";
import { Utf8ErrorFunc } from "@ethersproject/strings"; import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web"; import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback }; export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

View File

@ -52,7 +52,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0x8739796ac0fd3677ecf2f330f4526a9ae6c572b12a02f49044b271049efc2cec", "tarballHash": "0x3bc54c9421df3189104c1902b41f6f7966e48e38bc5e5469968758e231393931",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.189" "version": "5.0.0-beta.190"
} }

View File

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.189"; export const version = "ethers/5.0.0-beta.190";

View File

@ -1 +1 @@
export declare const version = "experimental/5.0.0-beta.142"; export declare const version = "experimental/5.0.0-beta.143";

View File

@ -1 +1 @@
export const version = "experimental/5.0.0-beta.142"; export const version = "experimental/5.0.0-beta.143";

View File

@ -11,6 +11,6 @@ export declare class NonceManager extends ethers.Signer {
setTransactionCount(transactionCount: ethers.BigNumberish | Promise<ethers.BigNumberish>): void; setTransactionCount(transactionCount: ethers.BigNumberish | Promise<ethers.BigNumberish>): void;
incrementTransactionCount(count?: number): void; incrementTransactionCount(count?: number): void;
signMessage(message: ethers.Bytes | string): Promise<string>; signMessage(message: ethers.Bytes | string): Promise<string>;
signTransaction(transaction: ethers.providers.TransactionRequest): Promise<string>; signTransaction(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>): Promise<string>;
sendTransaction(transaction: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>; sendTransaction(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>): Promise<ethers.providers.TransactionResponse>;
} }

View File

@ -1 +1 @@
export declare const version = "experimental/5.0.0-beta.142"; export declare const version = "experimental/5.0.0-beta.143";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "experimental/5.0.0-beta.142"; exports.version = "experimental/5.0.0-beta.143";

View File

@ -11,6 +11,6 @@ export declare class NonceManager extends ethers.Signer {
setTransactionCount(transactionCount: ethers.BigNumberish | Promise<ethers.BigNumberish>): void; setTransactionCount(transactionCount: ethers.BigNumberish | Promise<ethers.BigNumberish>): void;
incrementTransactionCount(count?: number): void; incrementTransactionCount(count?: number): void;
signMessage(message: ethers.Bytes | string): Promise<string>; signMessage(message: ethers.Bytes | string): Promise<string>;
signTransaction(transaction: ethers.providers.TransactionRequest): Promise<string>; signTransaction(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>): Promise<string>;
sendTransaction(transaction: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>; sendTransaction(transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>): Promise<ethers.providers.TransactionResponse>;
} }

View File

@ -26,7 +26,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0x6a4021f3ca22ef7efa4e741b28058c4eae8870dabc8ddb74c48ce6303323e354", "tarballHash": "0xd705aef61179553bb3de9144a978c200620a3a9bf8d1f7093d26bb9a541b112c",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.142" "version": "5.0.0-beta.143"
} }

View File

@ -1 +1 @@
export const version = "experimental/5.0.0-beta.142"; export const version = "experimental/5.0.0-beta.143";

View File

@ -1 +1 @@
export declare const version = "properties/5.0.0-beta.142"; export declare const version = "properties/5.0.0-beta.143";

View File

@ -1 +1 @@
export const version = "properties/5.0.0-beta.142"; export const version = "properties/5.0.0-beta.143";

View File

@ -1,9 +1,9 @@
export declare function defineReadOnly<T, K extends keyof T>(object: T, name: K, value: T[K]): void; export declare function defineReadOnly<T, K extends keyof T>(object: T, name: K, value: T[K]): void;
export declare function getStatic<T>(ctor: any, key: string): T; export declare function getStatic<T>(ctor: any, key: string): T;
export declare type Resolvable<T> = { export declare type Deferrable<T> = {
[P in keyof T]: T[P] | Promise<T[P]>; [K in keyof T]: T[K] | Promise<T[K]>;
}; };
export declare function resolveProperties<T>(object: Readonly<Resolvable<T>>): Promise<T>; export declare function resolveProperties<T>(object: Readonly<Deferrable<T>>): Promise<T>;
export declare function checkProperties(object: any, properties: { export declare function checkProperties(object: any, properties: {
[name: string]: boolean; [name: string]: boolean;
}): void; }): void;

View File

@ -1 +1 @@
export declare const version = "properties/5.0.0-beta.142"; export declare const version = "properties/5.0.0-beta.143";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "properties/5.0.0-beta.142"; exports.version = "properties/5.0.0-beta.143";

View File

@ -1,9 +1,9 @@
export declare function defineReadOnly<T, K extends keyof T>(object: T, name: K, value: T[K]): void; export declare function defineReadOnly<T, K extends keyof T>(object: T, name: K, value: T[K]): void;
export declare function getStatic<T>(ctor: any, key: string): T; export declare function getStatic<T>(ctor: any, key: string): T;
export declare type Resolvable<T> = { export declare type Deferrable<T> = {
[P in keyof T]: T[P] | Promise<T[P]>; [K in keyof T]: T[K] | Promise<T[K]>;
}; };
export declare function resolveProperties<T>(object: Readonly<Resolvable<T>>): Promise<T>; export declare function resolveProperties<T>(object: Readonly<Deferrable<T>>): Promise<T>;
export declare function checkProperties(object: any, properties: { export declare function checkProperties(object: any, properties: {
[name: string]: boolean; [name: string]: boolean;
}): void; }): void;

View File

@ -25,7 +25,7 @@
"build": "tsc -p ./tsconfig.json", "build": "tsc -p ./tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0x19edcc26454f25babba8c45ce913401053a93690beb2dc5a38788bc6b0a0315f", "tarballHash": "0x0ae2b3302a1c31c8a8643c0879bea73aa337ec394f0a10c6ab38037abaeeae6c",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.142" "version": "5.0.0-beta.143"
} }

View File

@ -1 +1 @@
export const version = "properties/5.0.0-beta.142"; export const version = "properties/5.0.0-beta.143";

View File

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.169"; export declare const version = "providers/5.0.0-beta.170";

View File

@ -1 +1 @@
export const version = "providers/5.0.0-beta.169"; export const version = "providers/5.0.0-beta.170";

View File

@ -2,6 +2,7 @@
import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { Network, Networkish } from "@ethersproject/networks"; import { Network, Networkish } from "@ethersproject/networks";
import { Deferrable } from "@ethersproject/properties";
import { Transaction } from "@ethersproject/transactions"; import { Transaction } from "@ethersproject/transactions";
import { Formatter } from "./formatter"; import { Formatter } from "./formatter";
/** /**
@ -82,10 +83,10 @@ export declare class BaseProvider extends Provider {
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse; _wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>; sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
_getTransactionRequest(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<Transaction>; _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction>;
_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>; _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
call(transaction: TransactionRequest | Promise<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
estimateGas(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<BigNumber>; estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
_getAddress(addressOrName: string | Promise<string>): Promise<string>; _getAddress(addressOrName: string | Promise<string>): Promise<string>;
_getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>; _getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>;
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>; getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;

View File

@ -2,6 +2,7 @@ import { Provider, TransactionRequest, TransactionResponse } from "@ethersprojec
import { Signer } from "@ethersproject/abstract-signer"; import { Signer } from "@ethersproject/abstract-signer";
import { Bytes } from "@ethersproject/bytes"; import { Bytes } from "@ethersproject/bytes";
import { Network, Networkish } from "@ethersproject/networks"; import { Network, Networkish } from "@ethersproject/networks";
import { Deferrable } from "@ethersproject/properties";
import { ConnectionInfo } from "@ethersproject/web"; import { ConnectionInfo } from "@ethersproject/web";
import { BaseProvider, Event } from "./base-provider"; import { BaseProvider, Event } from "./base-provider";
export declare class JsonRpcSigner extends Signer { export declare class JsonRpcSigner extends Signer {
@ -12,14 +13,14 @@ export declare class JsonRpcSigner extends Signer {
connect(provider: Provider): JsonRpcSigner; connect(provider: Provider): JsonRpcSigner;
connectUnchecked(): JsonRpcSigner; connectUnchecked(): JsonRpcSigner;
getAddress(): Promise<string>; getAddress(): Promise<string>;
sendUncheckedTransaction(transaction: TransactionRequest): Promise<string>; sendUncheckedTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
signTransaction(transaction: TransactionRequest): Promise<string>; signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
signMessage(message: Bytes | string): Promise<string>; signMessage(message: Bytes | string): Promise<string>;
unlock(password: string): Promise<boolean>; unlock(password: string): Promise<boolean>;
} }
declare class UncheckedJsonRpcSigner extends JsonRpcSigner { declare class UncheckedJsonRpcSigner extends JsonRpcSigner {
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
} }
export declare class JsonRpcProvider extends BaseProvider { export declare class JsonRpcProvider extends BaseProvider {
readonly connection: ConnectionInfo; readonly connection: ConnectionInfo;

View File

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.169"; export declare const version = "providers/5.0.0-beta.170";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.169"; exports.version = "providers/5.0.0-beta.170";

View File

@ -2,6 +2,7 @@
import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider"; import { Block, BlockTag, BlockWithTransactions, EventType, Filter, FilterByBlockHash, Listener, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
import { Network, Networkish } from "@ethersproject/networks"; import { Network, Networkish } from "@ethersproject/networks";
import { Deferrable } from "@ethersproject/properties";
import { Transaction } from "@ethersproject/transactions"; import { Transaction } from "@ethersproject/transactions";
import { Formatter } from "./formatter"; import { Formatter } from "./formatter";
/** /**
@ -82,10 +83,10 @@ export declare class BaseProvider extends Provider {
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse; _wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>; sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
_getTransactionRequest(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<Transaction>; _getTransactionRequest(transaction: Deferrable<TransactionRequest>): Promise<Transaction>;
_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>; _getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
call(transaction: TransactionRequest | Promise<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>; call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
estimateGas(transaction: TransactionRequest | Promise<TransactionRequest>): Promise<BigNumber>; estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;
_getAddress(addressOrName: string | Promise<string>): Promise<string>; _getAddress(addressOrName: string | Promise<string>): Promise<string>;
_getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>; _getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>, includeTransactions?: boolean): Promise<Block | BlockWithTransactions>;
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>; getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;

View File

@ -2,6 +2,7 @@ import { Provider, TransactionRequest, TransactionResponse } from "@ethersprojec
import { Signer } from "@ethersproject/abstract-signer"; import { Signer } from "@ethersproject/abstract-signer";
import { Bytes } from "@ethersproject/bytes"; import { Bytes } from "@ethersproject/bytes";
import { Network, Networkish } from "@ethersproject/networks"; import { Network, Networkish } from "@ethersproject/networks";
import { Deferrable } from "@ethersproject/properties";
import { ConnectionInfo } from "@ethersproject/web"; import { ConnectionInfo } from "@ethersproject/web";
import { BaseProvider, Event } from "./base-provider"; import { BaseProvider, Event } from "./base-provider";
export declare class JsonRpcSigner extends Signer { export declare class JsonRpcSigner extends Signer {
@ -12,14 +13,14 @@ export declare class JsonRpcSigner extends Signer {
connect(provider: Provider): JsonRpcSigner; connect(provider: Provider): JsonRpcSigner;
connectUnchecked(): JsonRpcSigner; connectUnchecked(): JsonRpcSigner;
getAddress(): Promise<string>; getAddress(): Promise<string>;
sendUncheckedTransaction(transaction: TransactionRequest): Promise<string>; sendUncheckedTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
signTransaction(transaction: TransactionRequest): Promise<string>; signTransaction(transaction: Deferrable<TransactionRequest>): Promise<string>;
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
signMessage(message: Bytes | string): Promise<string>; signMessage(message: Bytes | string): Promise<string>;
unlock(password: string): Promise<boolean>; unlock(password: string): Promise<boolean>;
} }
declare class UncheckedJsonRpcSigner extends JsonRpcSigner { declare class UncheckedJsonRpcSigner extends JsonRpcSigner {
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse>;
} }
export declare class JsonRpcProvider extends BaseProvider { export declare class JsonRpcProvider extends BaseProvider {
readonly connection: ConnectionInfo; readonly connection: ConnectionInfo;

View File

@ -56,7 +56,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"tarballHash": "0x2c7517b23e6eb918b668110c930001103934b54b78a357e775e232be9dfc7c25", "tarballHash": "0xb29152a4cc4705e1721fabf15e707a0cec56c3b86feb02756e5cd53a2b9fc230",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.169" "version": "5.0.0-beta.170"
} }

View File

@ -1 +1 @@
export const version = "providers/5.0.0-beta.169"; export const version = "providers/5.0.0-beta.170";

View File

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.160"; export declare const version = "tests/5.0.0-beta.161";

View File

@ -1 +1 @@
export const version = "tests/5.0.0-beta.160"; export const version = "tests/5.0.0-beta.161";

View File

@ -59,20 +59,29 @@ export function Reporter(runner) {
suite._t0 = getTime(); suite._t0 = getTime();
suite._countFail = 0; suite._countFail = 0;
suite._countPass = 0; suite._countPass = 0;
suite._countSkip = 0;
suite._countTotal = 0; suite._countTotal = 0;
}); });
runner.on('suite end', function () { runner.on('suite end', function () {
let suite = suites.pop(); let suite = suites.pop();
let failure = ''; let extras = [];
if (suite._countTotal > suite._countPass) { if (suite._countSkip) {
failure = ' (' + (suite._countTotal - suite._countPass) + ' failed) *****'; extras.push(suite._countSkip + " skipped");
} }
log(' Total Tests: ' + suite._countPass + '/' + suite._countTotal + ' passed ' + getDelta(suite._t0) + failure); if (suite._countTotal > suite._countPass) {
extras.push((suite._countTotal - suite._countPass) + " failed");
}
let extra = "";
if (extras.length) {
extra = " (" + extras.join(",") + ") ******** WARNING! ********";
}
log(` Total Tests: ${suite._countPass}/${suite._countTotal} passed ${getDelta(suite._t0)} ${extra} `);
log(); log();
if (suites.length > 0) { if (suites.length > 0) {
let currentSuite = suites[suites.length - 1]; let currentSuite = suites[suites.length - 1];
currentSuite._countFail += suite._countFail; currentSuite._countFail += suite._countFail;
currentSuite._countPass += suite._countPass; currentSuite._countPass += suite._countPass;
currentSuite._countSkip += suite._countSkip;
currentSuite._countTotal += suite._countTotal; currentSuite._countTotal += suite._countTotal;
} }
else { else {
@ -116,4 +125,8 @@ export function Reporter(runner) {
let currentSuite = suites[suites.length - 1]; let currentSuite = suites[suites.length - 1];
currentSuite._countPass++; currentSuite._countPass++;
}); });
runner.on('pending', function (test) {
let currentSuite = suites[suites.length - 1];
currentSuite._countSkip++;
});
} }

View File

@ -142,3 +142,129 @@ describe('Test Contract Objects', function () {
}); });
}); });
}); });
// @TODO: Exapnd this
describe("Test Contract Transaction Population", function () {
const abi = [
"function transfer(address to, uint amount)",
"function unstake() nonpayable",
"function mint() payable",
"function balanceOf(address owner) view returns (uint)"
];
const testAddress = "0xdeadbeef00deadbeef01deadbeef02deadbeef03";
const testAddressCheck = "0xDEAdbeeF00deAdbeEF01DeAdBEEF02DeADBEEF03";
const fireflyAddress = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
const contract = new ethers.Contract(testAddress, abi);
const contractConnected = contract.connect(ethers.getDefaultProvider());
it("standard population", function () {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield contract.populateTransaction.balanceOf(testAddress);
//console.log(tx);
assert.equal(Object.keys(tx).length, 2, "correct number of keys");
assert.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
});
});
it("allows 'from' overrides", function () {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield contract.populateTransaction.balanceOf(testAddress, {
from: testAddress
});
//console.log(tx);
assert.equal(Object.keys(tx).length, 3, "correct number of keys");
assert.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
assert.equal(tx.from, testAddressCheck, "from address matches");
});
});
it("allows ENS 'from' overrides", function () {
return __awaiter(this, void 0, void 0, function* () {
this.timeout(20000);
const tx = yield contractConnected.populateTransaction.balanceOf(testAddress, {
from: "ricmoo.firefly.eth"
});
//console.log(tx);
assert.equal(Object.keys(tx).length, 3, "correct number of keys");
assert.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
assert.equal(tx.from, fireflyAddress, "from address matches");
});
});
it("allows send overrides", function () {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield contract.populateTransaction.mint({
gasLimit: 150000,
gasPrice: 1900000000,
nonce: 5,
value: 1234,
from: testAddress
});
//console.log(tx);
assert.equal(Object.keys(tx).length, 7, "correct number of keys");
assert.equal(tx.data, "0x1249c58b", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
assert.equal(tx.nonce, 5, "nonce address matches");
assert.ok(tx.gasLimit.eq(150000), "gasLimit matches");
assert.ok(tx.gasPrice.eq(1900000000), "gasPrice matches");
assert.ok(tx.value.eq(1234), "value matches");
assert.equal(tx.from, testAddressCheck, "from address matches");
});
});
it("allows zero 'value' to non-payable", function () {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield contract.populateTransaction.unstake({
from: testAddress,
value: 0
});
//console.log(tx);
assert.equal(Object.keys(tx).length, 3, "correct number of keys");
assert.equal(tx.data, "0x2def6620", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
assert.equal(tx.from, testAddressCheck, "from address matches");
});
});
// @TODO: Add test cases to check for fault cases
// - cannot send non-zero value to non-payable
// - using the wrong from for a Signer-connected contract
it("forbids non-zero 'value' to non-payable", function () {
return __awaiter(this, void 0, void 0, function* () {
try {
const tx = yield contract.populateTransaction.unstake({
value: 1
});
console.log("Tx", tx);
assert.ok(false, "throws on non-zero value to non-payable");
}
catch (error) {
assert.ok(error.operation === "overrides.value");
}
});
});
it("allows overriding same 'from' with a Signer", function () {
return __awaiter(this, void 0, void 0, function* () {
const contractSigner = contract.connect(testAddress);
const tx = yield contractSigner.populateTransaction.unstake({
from: testAddress
});
//console.log(tx);
assert.equal(Object.keys(tx).length, 3, "correct number of keys");
assert.equal(tx.data, "0x2def6620", "data matches");
assert.equal(tx.to, testAddressCheck, "to address matches");
assert.equal(tx.from, testAddressCheck, "from address matches");
});
});
it("forbids overriding 'from' with a Signer", function () {
return __awaiter(this, void 0, void 0, function* () {
const contractSigner = contract.connect(testAddress);
try {
const tx = yield contractSigner.populateTransaction.unstake({
from: fireflyAddress
});
console.log("Tx", tx);
assert.ok(false, "throws on non-zero value to non-payable");
}
catch (error) {
assert.ok(error.operation === "overrides.from");
}
});
});
});

View File

@ -13,9 +13,11 @@ function randomCase(seed, text) {
// Too many test cases are caussing issues for the CI // Too many test cases are caussing issues for the CI
// Only run random cases under random-128 // Only run random cases under random-128
function checkRandom(name) { function checkRandom(name) {
/*
if (name.substring(0, 7) === "random-") { if (name.substring(0, 7) === "random-") {
return (parseInt(name.substring(7)) <= 128); return (parseInt(name.substring(7)) <= 128);
} }
*/
return true; return true;
} }
describe('Test HD Node Derivation is Case Agnostic', function () { describe('Test HD Node Derivation is Case Agnostic', function () {

View File

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.160"; export declare const version = "tests/5.0.0-beta.161";

View File

@ -1,3 +1,3 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "tests/5.0.0-beta.160"; exports.version = "tests/5.0.0-beta.161";

View File

@ -60,20 +60,29 @@ function Reporter(runner) {
suite._t0 = getTime(); suite._t0 = getTime();
suite._countFail = 0; suite._countFail = 0;
suite._countPass = 0; suite._countPass = 0;
suite._countSkip = 0;
suite._countTotal = 0; suite._countTotal = 0;
}); });
runner.on('suite end', function () { runner.on('suite end', function () {
var suite = suites.pop(); var suite = suites.pop();
var failure = ''; var extras = [];
if (suite._countTotal > suite._countPass) { if (suite._countSkip) {
failure = ' (' + (suite._countTotal - suite._countPass) + ' failed) *****'; extras.push(suite._countSkip + " skipped");
} }
log(' Total Tests: ' + suite._countPass + '/' + suite._countTotal + ' passed ' + getDelta(suite._t0) + failure); if (suite._countTotal > suite._countPass) {
extras.push((suite._countTotal - suite._countPass) + " failed");
}
var extra = "";
if (extras.length) {
extra = " (" + extras.join(",") + ") ******** WARNING! ********";
}
log(" Total Tests: " + suite._countPass + "/" + suite._countTotal + " passed " + getDelta(suite._t0) + " " + extra + " ");
log(); log();
if (suites.length > 0) { if (suites.length > 0) {
var currentSuite = suites[suites.length - 1]; var currentSuite = suites[suites.length - 1];
currentSuite._countFail += suite._countFail; currentSuite._countFail += suite._countFail;
currentSuite._countPass += suite._countPass; currentSuite._countPass += suite._countPass;
currentSuite._countSkip += suite._countSkip;
currentSuite._countTotal += suite._countTotal; currentSuite._countTotal += suite._countTotal;
} }
else { else {
@ -117,5 +126,9 @@ function Reporter(runner) {
var currentSuite = suites[suites.length - 1]; var currentSuite = suites[suites.length - 1];
currentSuite._countPass++; currentSuite._countPass++;
}); });
runner.on('pending', function (test) {
var currentSuite = suites[suites.length - 1];
currentSuite._countSkip++;
});
} }
exports.Reporter = Reporter; exports.Reporter = Reporter;

View File

@ -180,3 +180,201 @@ describe('Test Contract Objects', function () {
}); });
}); });
}); });
// @TODO: Exapnd this
describe("Test Contract Transaction Population", function () {
var abi = [
"function transfer(address to, uint amount)",
"function unstake() nonpayable",
"function mint() payable",
"function balanceOf(address owner) view returns (uint)"
];
var testAddress = "0xdeadbeef00deadbeef01deadbeef02deadbeef03";
var testAddressCheck = "0xDEAdbeeF00deAdbeEF01DeAdBEEF02DeADBEEF03";
var fireflyAddress = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
var contract = new ethers_1.ethers.Contract(testAddress, abi);
var contractConnected = contract.connect(ethers_1.ethers.getDefaultProvider());
it("standard population", function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, contract.populateTransaction.balanceOf(testAddress)];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 2, "correct number of keys");
assert_1.default.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
return [2 /*return*/];
}
});
});
});
it("allows 'from' overrides", function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, contract.populateTransaction.balanceOf(testAddress, {
from: testAddress
})];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 3, "correct number of keys");
assert_1.default.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
assert_1.default.equal(tx.from, testAddressCheck, "from address matches");
return [2 /*return*/];
}
});
});
});
it("allows ENS 'from' overrides", function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.timeout(20000);
return [4 /*yield*/, contractConnected.populateTransaction.balanceOf(testAddress, {
from: "ricmoo.firefly.eth"
})];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 3, "correct number of keys");
assert_1.default.equal(tx.data, "0x70a08231000000000000000000000000deadbeef00deadbeef01deadbeef02deadbeef03", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
assert_1.default.equal(tx.from, fireflyAddress, "from address matches");
return [2 /*return*/];
}
});
});
});
it("allows send overrides", function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, contract.populateTransaction.mint({
gasLimit: 150000,
gasPrice: 1900000000,
nonce: 5,
value: 1234,
from: testAddress
})];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 7, "correct number of keys");
assert_1.default.equal(tx.data, "0x1249c58b", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
assert_1.default.equal(tx.nonce, 5, "nonce address matches");
assert_1.default.ok(tx.gasLimit.eq(150000), "gasLimit matches");
assert_1.default.ok(tx.gasPrice.eq(1900000000), "gasPrice matches");
assert_1.default.ok(tx.value.eq(1234), "value matches");
assert_1.default.equal(tx.from, testAddressCheck, "from address matches");
return [2 /*return*/];
}
});
});
});
it("allows zero 'value' to non-payable", function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, contract.populateTransaction.unstake({
from: testAddress,
value: 0
})];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 3, "correct number of keys");
assert_1.default.equal(tx.data, "0x2def6620", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
assert_1.default.equal(tx.from, testAddressCheck, "from address matches");
return [2 /*return*/];
}
});
});
});
// @TODO: Add test cases to check for fault cases
// - cannot send non-zero value to non-payable
// - using the wrong from for a Signer-connected contract
it("forbids non-zero 'value' to non-payable", function () {
return __awaiter(this, void 0, void 0, function () {
var tx, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, contract.populateTransaction.unstake({
value: 1
})];
case 1:
tx = _a.sent();
console.log("Tx", tx);
assert_1.default.ok(false, "throws on non-zero value to non-payable");
return [3 /*break*/, 3];
case 2:
error_1 = _a.sent();
assert_1.default.ok(error_1.operation === "overrides.value");
return [3 /*break*/, 3];
case 3: return [2 /*return*/];
}
});
});
});
it("allows overriding same 'from' with a Signer", function () {
return __awaiter(this, void 0, void 0, function () {
var contractSigner, tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
contractSigner = contract.connect(testAddress);
return [4 /*yield*/, contractSigner.populateTransaction.unstake({
from: testAddress
})];
case 1:
tx = _a.sent();
//console.log(tx);
assert_1.default.equal(Object.keys(tx).length, 3, "correct number of keys");
assert_1.default.equal(tx.data, "0x2def6620", "data matches");
assert_1.default.equal(tx.to, testAddressCheck, "to address matches");
assert_1.default.equal(tx.from, testAddressCheck, "from address matches");
return [2 /*return*/];
}
});
});
});
it("forbids overriding 'from' with a Signer", function () {
return __awaiter(this, void 0, void 0, function () {
var contractSigner, tx, error_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
contractSigner = contract.connect(testAddress);
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, contractSigner.populateTransaction.unstake({
from: fireflyAddress
})];
case 2:
tx = _a.sent();
console.log("Tx", tx);
assert_1.default.ok(false, "throws on non-zero value to non-payable");
return [3 /*break*/, 4];
case 3:
error_2 = _a.sent();
assert_1.default.ok(error_2.operation === "overrides.from");
return [3 /*break*/, 4];
case 4: return [2 /*return*/];
}
});
});
});
});

View File

@ -17,9 +17,11 @@ function randomCase(seed, text) {
// Too many test cases are caussing issues for the CI // Too many test cases are caussing issues for the CI
// Only run random cases under random-128 // Only run random cases under random-128
function checkRandom(name) { function checkRandom(name) {
/*
if (name.substring(0, 7) === "random-") { if (name.substring(0, 7) === "random-") {
return (parseInt(name.substring(7)) <= 128); return (parseInt(name.substring(7)) <= 128);
} }
*/
return true; return true;
} }
describe('Test HD Node Derivation is Case Agnostic', function () { describe('Test HD Node Derivation is Case Agnostic', function () {

View File

@ -39,7 +39,7 @@
"scripts": { "scripts": {
"test": "exit 1" "test": "exit 1"
}, },
"tarballHash": "0x96e252ef0592ddafc518f20b7bd084b92a91f83cd4be8bebc1434d8c73700913", "tarballHash": "0xae7bf1faa5e6862fca833a04adb8844c354d3c56964483c684b69bea57dede01",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",
"version": "5.0.0-beta.160" "version": "5.0.0-beta.161"
} }

View File

@ -1 +1 @@
export const version = "tests/5.0.0-beta.160"; export const version = "tests/5.0.0-beta.161";

View File

@ -169,7 +169,7 @@ describe("Test Contract Transaction Population", function() {
const contract = new ethers.Contract(testAddress, abi); const contract = new ethers.Contract(testAddress, abi);
const contractConnected = contract.connect(ethers.getDefaultProvider()); const contractConnected = contract.connect(ethers.getDefaultProvider());
it("standard populatation", async function() { it("standard population", async function() {
const tx = await contract.populateTransaction.balanceOf(testAddress); const tx = await contract.populateTransaction.balanceOf(testAddress);
//console.log(tx); //console.log(tx);
assert.equal(Object.keys(tx).length, 2, "correct number of keys"); assert.equal(Object.keys(tx).length, 2, "correct number of keys");