Updated dist files.
This commit is contained in:
parent
00bb20546b
commit
97b6d8a797
@ -1,3 +1,3 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.0-beta.3";
|
exports.version = "4.0.0-beta.4";
|
||||||
|
@ -162,17 +162,17 @@ var Contract = /** @class */ (function () {
|
|||||||
errors.checkNew(this, Contract);
|
errors.checkNew(this, 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);
|
||||||
if (contractInterface instanceof interface_1.Interface) {
|
if (interface_1.Interface.isInterface(contractInterface)) {
|
||||||
properties_1.defineReadOnly(this, 'interface', contractInterface);
|
properties_1.defineReadOnly(this, 'interface', contractInterface);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));
|
properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));
|
||||||
}
|
}
|
||||||
if (signerOrProvider instanceof types_1.Signer) {
|
if (types_1.Signer.isSigner(signerOrProvider)) {
|
||||||
properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);
|
properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);
|
||||||
properties_1.defineReadOnly(this, 'signer', signerOrProvider);
|
properties_1.defineReadOnly(this, 'signer', signerOrProvider);
|
||||||
}
|
}
|
||||||
else if (signerOrProvider instanceof types_1.MinimalProvider) {
|
else if (types_1.MinimalProvider.isProvider(signerOrProvider)) {
|
||||||
properties_1.defineReadOnly(this, 'provider', signerOrProvider);
|
properties_1.defineReadOnly(this, 'provider', signerOrProvider);
|
||||||
properties_1.defineReadOnly(this, 'signer', null);
|
properties_1.defineReadOnly(this, 'signer', null);
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,7 @@ var Interface = /** @class */ (function () {
|
|||||||
if (!this.deployFunction) {
|
if (!this.deployFunction) {
|
||||||
addMethod.call(this, { type: 'constructor', inputs: [] });
|
addMethod.call(this, { type: 'constructor', inputs: [] });
|
||||||
}
|
}
|
||||||
|
properties_1.setType(this, 'Interface');
|
||||||
}
|
}
|
||||||
Interface.prototype.parseTransaction = function (tx) {
|
Interface.prototype.parseTransaction = function (tx) {
|
||||||
var sighash = tx.data.substring(0, 10).toLowerCase();
|
var sighash = tx.data.substring(0, 10).toLowerCase();
|
||||||
@ -372,6 +373,9 @@ var Interface = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Interface.isInterface = function (value) {
|
||||||
|
return properties_1.isType(value, 'Interface');
|
||||||
|
};
|
||||||
return Interface;
|
return Interface;
|
||||||
}());
|
}());
|
||||||
exports.Interface = Interface;
|
exports.Interface = Interface;
|
||||||
|
865
dist/dist/ethers.types.txt
vendored
Normal file
865
dist/dist/ethers.types.txt
vendored
Normal file
@ -0,0 +1,865 @@
|
|||||||
|
// Generated by dts-bundle v0.7.3
|
||||||
|
|
||||||
|
declare module 'ethers' {
|
||||||
|
import * as ethers from 'ethers/ethers';
|
||||||
|
export { ethers };
|
||||||
|
export * from "ethers/ethers";
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/ethers' {
|
||||||
|
import { platform } from 'ethers/utils/shims';
|
||||||
|
import { Contract, Interface } from 'ethers/contracts';
|
||||||
|
import * as providers from 'ethers/providers';
|
||||||
|
import * as utils from 'ethers/utils';
|
||||||
|
import { HDNode, SigningKey, Wallet } from 'ethers/wallet';
|
||||||
|
import * as wordlists from 'ethers/wordlists';
|
||||||
|
import * as types from 'ethers/utils/types';
|
||||||
|
import * as errors from 'ethers/utils/errors';
|
||||||
|
import { version } from 'ethers/_version';
|
||||||
|
const constants: {
|
||||||
|
AddressZero: string;
|
||||||
|
HashZero: string;
|
||||||
|
NegativeOne: utils.types.BigNumber;
|
||||||
|
Zero: utils.types.BigNumber;
|
||||||
|
One: utils.types.BigNumber;
|
||||||
|
Two: utils.types.BigNumber;
|
||||||
|
WeiPerEther: utils.types.BigNumber;
|
||||||
|
};
|
||||||
|
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/shims' {
|
||||||
|
export const platform = "node";
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/contracts' {
|
||||||
|
import { Contract } from 'ethers/contracts/contract';
|
||||||
|
import { Interface } from 'ethers/contracts/interface';
|
||||||
|
export { Contract, Interface };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers' {
|
||||||
|
import { Provider } from 'ethers/providers/provider';
|
||||||
|
import { EtherscanProvider } from 'ethers/providers/etherscan-provider';
|
||||||
|
import { FallbackProvider } from 'ethers/providers/fallback-provider';
|
||||||
|
import { IpcProvider } from 'ethers/providers/ipc-provider';
|
||||||
|
import { InfuraProvider } from 'ethers/providers/infura-provider';
|
||||||
|
import { JsonRpcProvider, JsonRpcSigner } from 'ethers/providers/json-rpc-provider';
|
||||||
|
import { Web3Provider } from 'ethers/providers/web3-provider';
|
||||||
|
import { Network } from 'ethers/utils/types';
|
||||||
|
function getDefaultProvider(network?: Network | string): Provider;
|
||||||
|
export { Provider, getDefaultProvider, FallbackProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, Web3Provider, IpcProvider, JsonRpcSigner };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils' {
|
||||||
|
import { getAddress, getContractAddress, getIcapAddress } from 'ethers/utils/address';
|
||||||
|
import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from 'ethers/utils/abi-coder';
|
||||||
|
import * as base64 from 'ethers/utils/base64';
|
||||||
|
import { bigNumberify } from 'ethers/utils/bignumber';
|
||||||
|
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, joinSignature, padZeros, splitSignature, stripZeros } from 'ethers/utils/bytes';
|
||||||
|
import { hashMessage, id, namehash } from 'ethers/utils/hash';
|
||||||
|
import { getJsonWalletAddress } from 'ethers/utils/json-wallet';
|
||||||
|
import { keccak256 } from 'ethers/utils/keccak256';
|
||||||
|
import { sha256 } from 'ethers/utils/sha2';
|
||||||
|
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from 'ethers/utils/solidity';
|
||||||
|
import { randomBytes } from 'ethers/utils/random-bytes';
|
||||||
|
import { getNetwork } from 'ethers/utils/networks';
|
||||||
|
import { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from 'ethers/utils/properties';
|
||||||
|
import * as RLP from 'ethers/utils/rlp';
|
||||||
|
import { computePublicKey, verifyMessage } from 'ethers/utils/secp256k1';
|
||||||
|
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
|
||||||
|
import { toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
|
||||||
|
import { formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
|
||||||
|
import { fetchJson } from 'ethers/utils/web';
|
||||||
|
import * as types from 'ethers/utils/types';
|
||||||
|
import * as errors from 'ethers/utils/errors';
|
||||||
|
const etherSymbol = "\u039E";
|
||||||
|
const constants: {
|
||||||
|
AddressZero: string;
|
||||||
|
HashZero: string;
|
||||||
|
NegativeOne: types.BigNumber;
|
||||||
|
Zero: types.BigNumber;
|
||||||
|
One: types.BigNumber;
|
||||||
|
Two: types.BigNumber;
|
||||||
|
WeiPerEther: types.BigNumber;
|
||||||
|
};
|
||||||
|
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wallet' {
|
||||||
|
import { Wallet } from 'ethers/wallet/wallet';
|
||||||
|
import * as HDNode from 'ethers/wallet/hdnode';
|
||||||
|
import { SigningKey } from 'ethers/wallet/signing-key';
|
||||||
|
export { HDNode, SigningKey, Wallet };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wordlists' {
|
||||||
|
import { Wordlist } from 'ethers/wordlists/wordlist';
|
||||||
|
const en: Wordlist;
|
||||||
|
const ko: Wordlist;
|
||||||
|
const it: Wordlist;
|
||||||
|
const ja: Wordlist;
|
||||||
|
const zh: Wordlist;
|
||||||
|
const zh_cn: Wordlist;
|
||||||
|
const zh_tw: Wordlist;
|
||||||
|
export { en, it, ja, ko, zh, zh_cn, zh_tw };
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/types' {
|
||||||
|
export type Arrayish = string | ArrayLike<number>;
|
||||||
|
export abstract class BigNumber {
|
||||||
|
abstract fromTwos(value: number): BigNumber;
|
||||||
|
abstract toTwos(value: number): BigNumber;
|
||||||
|
abstract add(other: BigNumberish): BigNumber;
|
||||||
|
abstract sub(other: BigNumberish): BigNumber;
|
||||||
|
abstract div(other: BigNumberish): BigNumber;
|
||||||
|
abstract mul(other: BigNumberish): BigNumber;
|
||||||
|
abstract mod(other: BigNumberish): BigNumber;
|
||||||
|
abstract pow(other: BigNumberish): BigNumber;
|
||||||
|
abstract maskn(value: number): BigNumber;
|
||||||
|
abstract eq(other: BigNumberish): boolean;
|
||||||
|
abstract lt(other: BigNumberish): boolean;
|
||||||
|
abstract lte(other: BigNumberish): boolean;
|
||||||
|
abstract gt(other: BigNumberish): boolean;
|
||||||
|
abstract gte(other: BigNumberish): boolean;
|
||||||
|
abstract isZero(): boolean;
|
||||||
|
abstract toNumber(): number;
|
||||||
|
abstract toString(): string;
|
||||||
|
abstract toHexString(): string;
|
||||||
|
}
|
||||||
|
export type BigNumberish = BigNumber | string | number | Arrayish;
|
||||||
|
export type ConnectionInfo = {
|
||||||
|
url: string;
|
||||||
|
user?: string;
|
||||||
|
password?: string;
|
||||||
|
allowInsecure?: boolean;
|
||||||
|
};
|
||||||
|
export interface OnceBlockable {
|
||||||
|
once(eventName: "block", handler: () => void): void;
|
||||||
|
}
|
||||||
|
export type PollOptions = {
|
||||||
|
timeout?: number;
|
||||||
|
floor?: number;
|
||||||
|
ceiling?: number;
|
||||||
|
interval?: number;
|
||||||
|
onceBlock?: OnceBlockable;
|
||||||
|
};
|
||||||
|
export type SupportedAlgorithms = 'sha256' | 'sha512';
|
||||||
|
export interface Signature {
|
||||||
|
r: string;
|
||||||
|
s: string;
|
||||||
|
recoveryParam?: number;
|
||||||
|
v?: number;
|
||||||
|
}
|
||||||
|
export type Network = {
|
||||||
|
name: string;
|
||||||
|
chainId: number;
|
||||||
|
ensAddress?: string;
|
||||||
|
};
|
||||||
|
export type Networkish = Network | string | number;
|
||||||
|
export type CoerceFunc = (type: string, value: any) => any;
|
||||||
|
export type ParamType = {
|
||||||
|
name?: string;
|
||||||
|
type: string;
|
||||||
|
indexed?: boolean;
|
||||||
|
components?: Array<any>;
|
||||||
|
};
|
||||||
|
export type EventFragment = {
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
anonymous: boolean;
|
||||||
|
inputs: Array<ParamType>;
|
||||||
|
};
|
||||||
|
export type FunctionFragment = {
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
constant: boolean;
|
||||||
|
inputs: Array<ParamType>;
|
||||||
|
outputs: Array<ParamType>;
|
||||||
|
payable: boolean;
|
||||||
|
stateMutability: string;
|
||||||
|
};
|
||||||
|
export type UnsignedTransaction = {
|
||||||
|
to?: string;
|
||||||
|
nonce?: number;
|
||||||
|
gasLimit?: BigNumberish;
|
||||||
|
gasPrice?: BigNumberish;
|
||||||
|
data?: Arrayish;
|
||||||
|
value?: BigNumberish;
|
||||||
|
chainId?: number;
|
||||||
|
};
|
||||||
|
export interface Transaction {
|
||||||
|
hash?: string;
|
||||||
|
to?: string;
|
||||||
|
from?: string;
|
||||||
|
nonce: number;
|
||||||
|
gasLimit: BigNumber;
|
||||||
|
gasPrice: BigNumber;
|
||||||
|
data: string;
|
||||||
|
value: BigNumber;
|
||||||
|
chainId: number;
|
||||||
|
r?: string;
|
||||||
|
s?: string;
|
||||||
|
v?: number;
|
||||||
|
}
|
||||||
|
export type BlockTag = string | number;
|
||||||
|
export interface Block {
|
||||||
|
hash: string;
|
||||||
|
parentHash: string;
|
||||||
|
number: number;
|
||||||
|
timestamp: number;
|
||||||
|
nonce: string;
|
||||||
|
difficulty: number;
|
||||||
|
gasLimit: BigNumber;
|
||||||
|
gasUsed: BigNumber;
|
||||||
|
miner: string;
|
||||||
|
extraData: string;
|
||||||
|
transactions: Array<string>;
|
||||||
|
}
|
||||||
|
export type Filter = {
|
||||||
|
fromBlock?: BlockTag;
|
||||||
|
toBlock?: BlockTag;
|
||||||
|
address?: string;
|
||||||
|
topics?: Array<string | Array<string>>;
|
||||||
|
};
|
||||||
|
export interface Log {
|
||||||
|
blockNumber?: number;
|
||||||
|
blockHash?: string;
|
||||||
|
transactionIndex?: number;
|
||||||
|
removed?: boolean;
|
||||||
|
transactionLogIndex?: number;
|
||||||
|
address: string;
|
||||||
|
data: string;
|
||||||
|
topics: Array<string>;
|
||||||
|
transactionHash?: string;
|
||||||
|
logIndex?: number;
|
||||||
|
}
|
||||||
|
export interface TransactionReceipt {
|
||||||
|
contractAddress?: string;
|
||||||
|
transactionIndex?: number;
|
||||||
|
root?: string;
|
||||||
|
gasUsed?: BigNumber;
|
||||||
|
logsBloom?: string;
|
||||||
|
blockHash?: string;
|
||||||
|
transactionHash?: string;
|
||||||
|
logs?: Array<Log>;
|
||||||
|
blockNumber?: number;
|
||||||
|
cumulativeGasUsed?: BigNumber;
|
||||||
|
byzantium: boolean;
|
||||||
|
status?: number;
|
||||||
|
}
|
||||||
|
export type TransactionRequest = {
|
||||||
|
to?: string | Promise<string>;
|
||||||
|
from?: string | Promise<string>;
|
||||||
|
nonce?: number | string | Promise<number | string>;
|
||||||
|
gasLimit?: BigNumberish | Promise<BigNumberish>;
|
||||||
|
gasPrice?: BigNumberish | Promise<BigNumberish>;
|
||||||
|
data?: Arrayish | Promise<Arrayish>;
|
||||||
|
value?: BigNumberish | Promise<BigNumberish>;
|
||||||
|
chainId?: number | Promise<number>;
|
||||||
|
};
|
||||||
|
export interface TransactionResponse extends Transaction {
|
||||||
|
blockNumber?: number;
|
||||||
|
blockHash?: string;
|
||||||
|
timestamp?: number;
|
||||||
|
from: string;
|
||||||
|
raw?: string;
|
||||||
|
wait: (timeout?: number) => Promise<TransactionReceipt>;
|
||||||
|
}
|
||||||
|
export abstract class Indexed {
|
||||||
|
readonly hash: string;
|
||||||
|
}
|
||||||
|
export interface DeployDescription {
|
||||||
|
readonly inputs: Array<ParamType>;
|
||||||
|
readonly payable: boolean;
|
||||||
|
encode(bytecode: string, params: Array<any>): string;
|
||||||
|
}
|
||||||
|
export interface FunctionDescription {
|
||||||
|
readonly type: "call" | "transaction";
|
||||||
|
readonly name: string;
|
||||||
|
readonly signature: string;
|
||||||
|
readonly sighash: string;
|
||||||
|
readonly inputs: Array<ParamType>;
|
||||||
|
readonly outputs: Array<ParamType>;
|
||||||
|
readonly payable: boolean;
|
||||||
|
encode(params: Array<any>): string;
|
||||||
|
decode(data: string): any;
|
||||||
|
}
|
||||||
|
export interface EventDescription {
|
||||||
|
readonly name: string;
|
||||||
|
readonly signature: string;
|
||||||
|
readonly inputs: Array<ParamType>;
|
||||||
|
readonly anonymous: boolean;
|
||||||
|
readonly topic: string;
|
||||||
|
encodeTopics(params: Array<any>): Array<string>;
|
||||||
|
decode(data: string, topics?: Array<string>): any;
|
||||||
|
}
|
||||||
|
export interface LogDescription {
|
||||||
|
readonly name: string;
|
||||||
|
readonly signature: string;
|
||||||
|
readonly topic: string;
|
||||||
|
readonly values: Array<any>;
|
||||||
|
}
|
||||||
|
export interface TransactionDescription {
|
||||||
|
readonly name: string;
|
||||||
|
readonly args: Array<any>;
|
||||||
|
readonly signature: string;
|
||||||
|
readonly sighash: string;
|
||||||
|
readonly decode: (data: string) => any;
|
||||||
|
readonly value: BigNumber;
|
||||||
|
}
|
||||||
|
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||||
|
export type EventFilter = {
|
||||||
|
address?: string;
|
||||||
|
topics?: Array<string>;
|
||||||
|
};
|
||||||
|
export interface Event extends Log {
|
||||||
|
args: Array<any>;
|
||||||
|
decode: (data: string, topics?: Array<string>) => any;
|
||||||
|
event: string;
|
||||||
|
eventSignature: string;
|
||||||
|
removeListener: () => void;
|
||||||
|
getBlock: () => Promise<Block>;
|
||||||
|
getTransaction: () => Promise<TransactionResponse>;
|
||||||
|
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
||||||
|
}
|
||||||
|
export type EventType = string | Array<string> | Filter;
|
||||||
|
export type Listener = (...args: Array<any>) => void;
|
||||||
|
/**
|
||||||
|
* Provider
|
||||||
|
*
|
||||||
|
* Note: We use an abstract class so we can use instanceof to determine if an
|
||||||
|
* object is a Provider.
|
||||||
|
*/
|
||||||
|
export abstract class MinimalProvider implements OnceBlockable {
|
||||||
|
abstract getNetwork(): Promise<Network>;
|
||||||
|
abstract getBlockNumber(): Promise<number>;
|
||||||
|
abstract getGasPrice(): Promise<BigNumber>;
|
||||||
|
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
|
||||||
|
abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
|
||||||
|
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 sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
||||||
|
abstract call(transaction: TransactionRequest): Promise<string>;
|
||||||
|
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
|
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
||||||
|
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
|
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
|
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
|
abstract resolveName(name: string | Promise<string>): Promise<string>;
|
||||||
|
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
|
||||||
|
abstract on(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
|
abstract once(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
|
abstract listenerCount(eventName?: EventType): number;
|
||||||
|
abstract listeners(eventName: EventType): Array<Listener>;
|
||||||
|
abstract removeAllListeners(eventName: EventType): MinimalProvider;
|
||||||
|
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
|
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||||
|
}
|
||||||
|
export type AsyncProvider = {
|
||||||
|
isMetaMask?: boolean;
|
||||||
|
host?: string;
|
||||||
|
path?: string;
|
||||||
|
sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
|
||||||
|
};
|
||||||
|
export type ProgressCallback = (percent: number) => void;
|
||||||
|
export type EncryptOptions = {
|
||||||
|
iv?: Arrayish;
|
||||||
|
entropy?: Arrayish;
|
||||||
|
mnemonic?: string;
|
||||||
|
path?: string;
|
||||||
|
client?: string;
|
||||||
|
salt?: Arrayish;
|
||||||
|
uuid?: string;
|
||||||
|
scrypt?: {
|
||||||
|
N?: number;
|
||||||
|
r?: number;
|
||||||
|
p?: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Signer
|
||||||
|
*
|
||||||
|
* Note: We use an abstract class so we can use instanceof to determine if an
|
||||||
|
* object is a Signer.
|
||||||
|
*/
|
||||||
|
export abstract class Signer {
|
||||||
|
provider?: MinimalProvider;
|
||||||
|
abstract getAddress(): Promise<string>;
|
||||||
|
abstract signMessage(message: Arrayish | string): Promise<string>;
|
||||||
|
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
}
|
||||||
|
export abstract class HDNode {
|
||||||
|
readonly privateKey: string;
|
||||||
|
readonly publicKey: string;
|
||||||
|
readonly mnemonic: string;
|
||||||
|
readonly path: string;
|
||||||
|
readonly chainCode: string;
|
||||||
|
readonly index: number;
|
||||||
|
readonly depth: number;
|
||||||
|
abstract derivePath(path: string): HDNode;
|
||||||
|
}
|
||||||
|
export interface Wordlist {
|
||||||
|
locale: string;
|
||||||
|
getWord(index: number): string;
|
||||||
|
getWordIndex(word: string): number;
|
||||||
|
split(mnemonic: string): Array<string>;
|
||||||
|
join(words: Array<string>): string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/errors' {
|
||||||
|
export const UNKNOWN_ERROR = "UNKNOWN_ERROR";
|
||||||
|
export const NOT_IMPLEMENTED = "NOT_IMPLEMENTED";
|
||||||
|
export const MISSING_NEW = "MISSING_NEW";
|
||||||
|
export const CALL_EXCEPTION = "CALL_EXCEPTION";
|
||||||
|
export const INVALID_ARGUMENT = "INVALID_ARGUMENT";
|
||||||
|
export const MISSING_ARGUMENT = "MISSING_ARGUMENT";
|
||||||
|
export const UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT";
|
||||||
|
export const NUMERIC_FAULT = "NUMERIC_FAULT";
|
||||||
|
export const UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION";
|
||||||
|
export function throwError(message: string, code: string, params: any): never;
|
||||||
|
export function checkNew(self: any, kind: any): void;
|
||||||
|
export function checkArgumentCount(count: number, expectedCount: number, suffix?: string): void;
|
||||||
|
export function setCensorship(censorship: boolean, permanent?: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/_version' {
|
||||||
|
export const version = "4.0.0-beta.3";
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/contracts/contract' {
|
||||||
|
import { Interface } from 'ethers/contracts/interface';
|
||||||
|
import { Signer, MinimalProvider, BigNumber, ContractFunction, EventFilter, ParamType, Listener, TransactionRequest, TransactionResponse } from 'ethers/utils/types';
|
||||||
|
interface Bucket<T> {
|
||||||
|
[name: string]: T;
|
||||||
|
}
|
||||||
|
export class Contract {
|
||||||
|
readonly address: string;
|
||||||
|
readonly interface: Interface;
|
||||||
|
readonly signer: Signer;
|
||||||
|
readonly provider: MinimalProvider;
|
||||||
|
readonly estimate: Bucket<(...params: Array<any>) => Promise<BigNumber>>;
|
||||||
|
readonly functions: Bucket<ContractFunction>;
|
||||||
|
readonly filters: Bucket<(...params: Array<any>) => EventFilter>;
|
||||||
|
readonly [name: string]: ContractFunction | any;
|
||||||
|
readonly addressPromise: Promise<string>;
|
||||||
|
readonly deployTransaction: TransactionResponse;
|
||||||
|
constructor(addressOrName: string, contractInterface: Array<string | ParamType> | string | Interface, signerOrProvider: Signer | MinimalProvider);
|
||||||
|
deployed(): Promise<Contract>;
|
||||||
|
fallback(overrides?: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
connect(signerOrProvider: Signer | MinimalProvider): Contract;
|
||||||
|
attach(addressOrName: string): Contract;
|
||||||
|
deploy(bytecode: string, ...args: Array<any>): Promise<Contract>;
|
||||||
|
on(event: EventFilter | string, listener: Listener): Contract;
|
||||||
|
once(event: EventFilter | string, listener: Listener): Contract;
|
||||||
|
addEventLisener(eventName: EventFilter | string, listener: Listener): Contract;
|
||||||
|
emit(eventName: EventFilter | string, ...args: Array<any>): boolean;
|
||||||
|
listenerCount(eventName?: EventFilter | string): number;
|
||||||
|
listeners(eventName: EventFilter | string): Array<Listener>;
|
||||||
|
removeAllListeners(eventName: EventFilter | string): Contract;
|
||||||
|
removeListener(eventName: any, listener: Listener): Contract;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/contracts/interface' {
|
||||||
|
import { BigNumberish, DeployDescription as _DeployDescription, EventDescription as _EventDescription, FunctionDescription as _FunctionDescription, LogDescription as _LogDescription, TransactionDescription as _TransactionDescription, EventFragment, FunctionFragment, ParamType } from 'ethers/utils/types';
|
||||||
|
export class Interface {
|
||||||
|
readonly abi: Array<EventFragment | FunctionFragment>;
|
||||||
|
readonly functions: {
|
||||||
|
[name: string]: _FunctionDescription;
|
||||||
|
};
|
||||||
|
readonly events: {
|
||||||
|
[name: string]: _EventDescription;
|
||||||
|
};
|
||||||
|
readonly deployFunction: _DeployDescription;
|
||||||
|
constructor(abi: Array<string | ParamType> | string);
|
||||||
|
parseTransaction(tx: {
|
||||||
|
data: string;
|
||||||
|
value?: BigNumberish;
|
||||||
|
}): _TransactionDescription;
|
||||||
|
parseLog(log: {
|
||||||
|
topics: Array<string>;
|
||||||
|
data: string;
|
||||||
|
}): _LogDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/provider' {
|
||||||
|
import { BigNumber, BigNumberish, Block, BlockTag, EventType, Filter, Listener, Log, MinimalProvider, Network, Networkish, Transaction, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/utils/types';
|
||||||
|
export class Provider extends MinimalProvider {
|
||||||
|
protected _emitted: any;
|
||||||
|
/**
|
||||||
|
* ready
|
||||||
|
*
|
||||||
|
* A Promise<Network> that resolves only once the provider is ready.
|
||||||
|
*
|
||||||
|
* Sub-classes that call the super with a network without a chainId
|
||||||
|
* MUST set this. Standard named networks have a known chainId.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected ready: Promise<Network>;
|
||||||
|
constructor(network: Networkish | Promise<Network>);
|
||||||
|
resetEventsBlock(blockNumber: number): void;
|
||||||
|
readonly network: Network;
|
||||||
|
getNetwork(): Promise<Network>;
|
||||||
|
readonly blockNumber: number;
|
||||||
|
polling: boolean;
|
||||||
|
pollingInterval: number;
|
||||||
|
waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||||
|
getBlockNumber(): Promise<number>;
|
||||||
|
getGasPrice(): Promise<BigNumber>;
|
||||||
|
getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
|
||||||
|
getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
|
||||||
|
getCode(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
|
||||||
|
getStorageAt(addressOrName: string | Promise<string>, position: BigNumberish | Promise<BigNumberish>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;
|
||||||
|
sendTransaction(signedTransaction: string | Promise<string>): Promise<TransactionResponse>;
|
||||||
|
_wrapTransaction(tx: Transaction, hash?: string): TransactionResponse;
|
||||||
|
call(transaction: TransactionRequest): Promise<string>;
|
||||||
|
estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
|
getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
||||||
|
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
|
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
|
getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
|
getEtherPrice(): Promise<number>;
|
||||||
|
resolveName(name: string | Promise<string>): Promise<string>;
|
||||||
|
lookupAddress(address: string | Promise<string>): Promise<string>;
|
||||||
|
static checkTransactionResponse(transaction: any): TransactionResponse;
|
||||||
|
doPoll(): void;
|
||||||
|
perform(method: string, params: any): Promise<any>;
|
||||||
|
protected _startPending(): void;
|
||||||
|
protected _stopPending(): void;
|
||||||
|
on(eventName: EventType, listener: Listener): Provider;
|
||||||
|
once(eventName: EventType, listener: Listener): Provider;
|
||||||
|
addEventListener(eventName: EventType, listener: Listener): Provider;
|
||||||
|
emit(eventName: EventType, ...args: Array<any>): boolean;
|
||||||
|
listenerCount(eventName?: EventType): number;
|
||||||
|
listeners(eventName: EventType): Array<Listener>;
|
||||||
|
removeAllListeners(eventName: EventType): Provider;
|
||||||
|
removeListener(eventName: EventType, listener: Listener): Provider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/etherscan-provider' {
|
||||||
|
import { Provider } from 'ethers/providers/provider';
|
||||||
|
import { BlockTag, Networkish, TransactionResponse } from 'ethers/utils/types';
|
||||||
|
export class EtherscanProvider extends Provider {
|
||||||
|
readonly baseUrl: string;
|
||||||
|
readonly apiKey: string;
|
||||||
|
constructor(network?: Networkish, apiKey?: string);
|
||||||
|
perform(method: string, params: any): Promise<any>;
|
||||||
|
getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/fallback-provider' {
|
||||||
|
import { Provider } from 'ethers/providers/provider';
|
||||||
|
export class FallbackProvider extends Provider {
|
||||||
|
constructor(providers: Array<Provider>);
|
||||||
|
readonly providers: Array<Provider>;
|
||||||
|
perform(method: string, params: any): any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/ipc-provider' {
|
||||||
|
import { JsonRpcProvider } from 'ethers/providers/json-rpc-provider';
|
||||||
|
import { Networkish } from 'ethers/utils/types';
|
||||||
|
export class IpcProvider extends JsonRpcProvider {
|
||||||
|
readonly path: string;
|
||||||
|
constructor(path: string, network?: Networkish);
|
||||||
|
send(method: string, params: any): Promise<any>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/infura-provider' {
|
||||||
|
import { JsonRpcProvider, JsonRpcSigner } from 'ethers/providers/json-rpc-provider';
|
||||||
|
import { Networkish } from 'ethers/utils/types';
|
||||||
|
export class InfuraProvider extends JsonRpcProvider {
|
||||||
|
readonly apiAccessToken: string;
|
||||||
|
constructor(network?: Networkish, apiAccessToken?: string);
|
||||||
|
protected _startPending(): void;
|
||||||
|
getSigner(address?: string): JsonRpcSigner;
|
||||||
|
listAccounts(): Promise<Array<string>>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/json-rpc-provider' {
|
||||||
|
import { Provider } from 'ethers/providers/provider';
|
||||||
|
import { Arrayish, BigNumber, BlockTag, ConnectionInfo, Networkish, Signer, TransactionRequest, TransactionResponse } from 'ethers/utils/types';
|
||||||
|
export class JsonRpcSigner extends Signer {
|
||||||
|
readonly provider: JsonRpcProvider;
|
||||||
|
constructor(provider: JsonRpcProvider, address?: string);
|
||||||
|
readonly address: string;
|
||||||
|
getAddress(): Promise<string>;
|
||||||
|
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
|
||||||
|
getTransactionCount(blockTag?: BlockTag): Promise<number>;
|
||||||
|
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
signMessage(message: Arrayish | string): Promise<string>;
|
||||||
|
unlock(password: string): Promise<boolean>;
|
||||||
|
}
|
||||||
|
export class JsonRpcProvider extends Provider {
|
||||||
|
readonly connection: ConnectionInfo;
|
||||||
|
constructor(url?: ConnectionInfo | string, network?: Networkish);
|
||||||
|
getSigner(address?: string): JsonRpcSigner;
|
||||||
|
listAccounts(): Promise<Array<string>>;
|
||||||
|
send(method: string, params: any): Promise<any>;
|
||||||
|
perform(method: string, params: any): Promise<any>;
|
||||||
|
protected _startPending(): void;
|
||||||
|
protected _stopPending(): void;
|
||||||
|
static hexlifyTransaction(transaction: TransactionRequest): any;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/providers/web3-provider' {
|
||||||
|
import { JsonRpcProvider } from 'ethers/providers/json-rpc-provider';
|
||||||
|
import { AsyncProvider, Networkish } from 'ethers/utils/types';
|
||||||
|
export class Web3Provider extends JsonRpcProvider {
|
||||||
|
readonly _web3Provider: AsyncProvider;
|
||||||
|
constructor(web3Provider: AsyncProvider, network?: Networkish);
|
||||||
|
send(method: string, params: any): Promise<any>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/address' {
|
||||||
|
import { Arrayish, BigNumber } from 'ethers/utils/types';
|
||||||
|
export function getAddress(address: string): string;
|
||||||
|
export function getIcapAddress(address: string): string;
|
||||||
|
export function getContractAddress(transaction: {
|
||||||
|
from: string;
|
||||||
|
nonce: Arrayish | BigNumber | number;
|
||||||
|
}): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/abi-coder' {
|
||||||
|
import { Arrayish, CoerceFunc, EventFragment, FunctionFragment, ParamType } from 'ethers/utils/types';
|
||||||
|
export const defaultCoerceFunc: CoerceFunc;
|
||||||
|
export function parseParamType(type: string): ParamType;
|
||||||
|
export function formatParamType(paramType: ParamType): string;
|
||||||
|
export function formatSignature(fragment: EventFragment | FunctionFragment): string;
|
||||||
|
export function parseSignature(fragment: string): EventFragment | FunctionFragment;
|
||||||
|
export class AbiCoder {
|
||||||
|
readonly coerceFunc: CoerceFunc;
|
||||||
|
constructor(coerceFunc?: CoerceFunc);
|
||||||
|
encode(types: Array<string | ParamType>, values: Array<any>): string;
|
||||||
|
decode(types: Array<string | ParamType>, data: Arrayish): Array<any>;
|
||||||
|
}
|
||||||
|
export const defaultAbiCoder: AbiCoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/base64' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export function decode(textData: string): Uint8Array;
|
||||||
|
export function encode(data: Arrayish): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/bignumber' {
|
||||||
|
import { BigNumber as _BigNumber, BigNumberish } from 'ethers/utils/types';
|
||||||
|
export function bigNumberify(value: BigNumberish): _BigNumber;
|
||||||
|
export const ConstantNegativeOne: _BigNumber;
|
||||||
|
export const ConstantZero: _BigNumber;
|
||||||
|
export const ConstantOne: _BigNumber;
|
||||||
|
export const ConstantTwo: _BigNumber;
|
||||||
|
export const ConstantWeiPerEther: _BigNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/bytes' {
|
||||||
|
/**
|
||||||
|
* Conversion Utilities
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
import { Arrayish, BigNumber, Signature } from 'ethers/utils/types';
|
||||||
|
export const AddressZero = "0x0000000000000000000000000000000000000000";
|
||||||
|
export const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
||||||
|
export function isArrayish(value: any): boolean;
|
||||||
|
export function arrayify(value: Arrayish | BigNumber): Uint8Array;
|
||||||
|
export function concat(objects: Array<Arrayish>): Uint8Array;
|
||||||
|
export function stripZeros(value: Arrayish): Uint8Array;
|
||||||
|
export function padZeros(value: Arrayish, length: number): Uint8Array;
|
||||||
|
export function isHexString(value: any, length?: number): boolean;
|
||||||
|
export function hexlify(value: Arrayish | BigNumber | number): string;
|
||||||
|
export function hexDataLength(data: string): number;
|
||||||
|
export function hexDataSlice(data: string, offset: number, length?: number): string;
|
||||||
|
export function hexStripZeros(value: string): string;
|
||||||
|
export function hexZeroPad(value: string, length: number): string;
|
||||||
|
export function splitSignature(signature: Arrayish | Signature): Signature;
|
||||||
|
export function joinSignature(signature: Signature): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/hash' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export function namehash(name: string): string;
|
||||||
|
export function id(text: string): string;
|
||||||
|
export function hashMessage(message: Arrayish | string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/json-wallet' {
|
||||||
|
export function isCrowdsaleWallet(json: string): boolean;
|
||||||
|
export function isSecretStorageWallet(json: string): boolean;
|
||||||
|
export function getJsonWalletAddress(json: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/keccak256' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export function keccak256(data: Arrayish): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/sha2' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export function sha256(data: Arrayish): string;
|
||||||
|
export function sha512(data: Arrayish): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/solidity' {
|
||||||
|
export function pack(types: Array<string>, values: Array<any>): string;
|
||||||
|
export function keccak256(types: Array<string>, values: Array<any>): string;
|
||||||
|
export function sha256(types: Array<string>, values: Array<any>): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/random-bytes' {
|
||||||
|
export function randomBytes(length: number): Uint8Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/networks' {
|
||||||
|
import { Network, Networkish } from 'ethers/utils/types';
|
||||||
|
/**
|
||||||
|
* getNetwork
|
||||||
|
*
|
||||||
|
* Converts a named common networks or chain ID (network ID) to a Network
|
||||||
|
* and verifies a network is a valid Network..
|
||||||
|
*/
|
||||||
|
export function getNetwork(network: Networkish): Network;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/properties' {
|
||||||
|
export function defineReadOnly(object: any, name: string, value: any): void;
|
||||||
|
export function defineFrozen(object: any, name: string, value: any): void;
|
||||||
|
export function resolveProperties(object: any): Promise<any>;
|
||||||
|
export function shallowCopy(object: any): any;
|
||||||
|
export function jsonCopy(object: any): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/rlp' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export function encode(object: any): string;
|
||||||
|
export function decode(data: Arrayish): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/secp256k1' {
|
||||||
|
import { Arrayish, Signature } from 'ethers/utils/types';
|
||||||
|
export class KeyPair {
|
||||||
|
readonly privateKey: string;
|
||||||
|
readonly publicKey: string;
|
||||||
|
readonly compressedPublicKey: string;
|
||||||
|
readonly publicKeyBytes: Uint8Array;
|
||||||
|
constructor(privateKey: Arrayish);
|
||||||
|
sign(digest: Arrayish): Signature;
|
||||||
|
}
|
||||||
|
export function recoverPublicKey(digest: Arrayish, signature: Signature): string;
|
||||||
|
export function computePublicKey(key: Arrayish, compressed?: boolean): string;
|
||||||
|
export function recoverAddress(digest: Arrayish, signature: Signature): string;
|
||||||
|
export function computeAddress(key: string): string;
|
||||||
|
export function verifyMessage(message: Arrayish | string, signature: Signature | string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/transaction' {
|
||||||
|
import { Arrayish, Signature, Transaction, UnsignedTransaction } from 'ethers/utils/types';
|
||||||
|
export function serialize(transaction: UnsignedTransaction, signature?: Arrayish | Signature): string;
|
||||||
|
export function parse(rawTransaction: Arrayish): Transaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/utf8' {
|
||||||
|
import { Arrayish } from 'ethers/utils/types';
|
||||||
|
export enum UnicodeNormalizationForm {
|
||||||
|
current = "",
|
||||||
|
NFC = "NFC",
|
||||||
|
NFD = "NFD",
|
||||||
|
NFKC = "NFKC",
|
||||||
|
NFKD = "NFKD"
|
||||||
|
}
|
||||||
|
export function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array;
|
||||||
|
export function toUtf8String(bytes: Arrayish): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/units' {
|
||||||
|
import { BigNumber, BigNumberish } from 'ethers/utils/types';
|
||||||
|
export function formatUnits(value: BigNumberish, unitType?: string | number, options?: any): string;
|
||||||
|
export function parseUnits(value: string, unitType?: string | number): BigNumber;
|
||||||
|
export function formatEther(wei: BigNumberish, options?: any): string;
|
||||||
|
export function parseEther(ether: string): BigNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/utils/web' {
|
||||||
|
import { ConnectionInfo, PollOptions } from 'ethers/utils/types';
|
||||||
|
export function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: (value: any) => any): Promise<any>;
|
||||||
|
export function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wallet/wallet' {
|
||||||
|
import { SigningKey } from 'ethers/wallet/signing-key';
|
||||||
|
import { Arrayish, BigNumber, BlockTag, HDNode, MinimalProvider, ProgressCallback, Signer, TransactionRequest, TransactionResponse, Wordlist } from 'ethers/utils/types';
|
||||||
|
export class Wallet extends Signer {
|
||||||
|
readonly provider: MinimalProvider;
|
||||||
|
constructor(privateKey: SigningKey | HDNode | Arrayish, provider?: MinimalProvider);
|
||||||
|
readonly address: string;
|
||||||
|
readonly mnemonic: string;
|
||||||
|
readonly path: string;
|
||||||
|
readonly privateKey: string;
|
||||||
|
/**
|
||||||
|
* Create a new instance of this Wallet connected to provider.
|
||||||
|
*/
|
||||||
|
connect(provider: MinimalProvider): Wallet;
|
||||||
|
getAddress(): Promise<string>;
|
||||||
|
sign(transaction: TransactionRequest): Promise<string>;
|
||||||
|
signMessage(message: Arrayish | string): Promise<string>;
|
||||||
|
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
|
||||||
|
getTransactionCount(blockTag?: BlockTag): Promise<number>;
|
||||||
|
sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
encrypt(password: Arrayish | string, options: any, progressCallback: ProgressCallback): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Static methods to create Wallet instances.
|
||||||
|
*/
|
||||||
|
static createRandom(options?: any): Wallet;
|
||||||
|
static fromEncryptedJson(json: string, password: Arrayish, progressCallback: ProgressCallback): Promise<Wallet>;
|
||||||
|
static fromMnemonic(mnemonic: string, path?: string, wordlist?: Wordlist): Wallet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wallet/hdnode' {
|
||||||
|
import { Arrayish, HDNode as _HDNode, Wordlist } from 'ethers/utils/types';
|
||||||
|
export const defaultPath = "m/44'/60'/0'/0/0";
|
||||||
|
export function fromMnemonic(mnemonic: string, wordlist?: Wordlist): _HDNode;
|
||||||
|
export function fromSeed(seed: Arrayish): _HDNode;
|
||||||
|
export function mnemonicToSeed(mnemonic: string, password?: string): string;
|
||||||
|
export function mnemonicToEntropy(mnemonic: string, wordlist?: Wordlist): string;
|
||||||
|
export function entropyToMnemonic(entropy: Arrayish, wordlist?: Wordlist): string;
|
||||||
|
export function isValidMnemonic(mnemonic: string, wordlist?: Wordlist): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wallet/signing-key' {
|
||||||
|
import { Arrayish, HDNode, Signature } from 'ethers/utils/types';
|
||||||
|
export class SigningKey {
|
||||||
|
readonly privateKey: string;
|
||||||
|
readonly publicKey: string;
|
||||||
|
readonly address: string;
|
||||||
|
readonly mnemonic: string;
|
||||||
|
readonly path: string;
|
||||||
|
constructor(privateKey: Arrayish | HDNode);
|
||||||
|
signDigest(digest: Arrayish): Signature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'ethers/wordlists/wordlist' {
|
||||||
|
import { Wordlist as _Wordlist } from 'ethers/utils/types';
|
||||||
|
export function check(wordlist: _Wordlist): string;
|
||||||
|
export abstract class Wordlist implements _Wordlist {
|
||||||
|
locale: string;
|
||||||
|
constructor(locale: string);
|
||||||
|
abstract getWord(index: number): string;
|
||||||
|
abstract getWordIndex(word: string): number;
|
||||||
|
split(mnemonic: string): Array<string>;
|
||||||
|
join(words: Array<string>): string;
|
||||||
|
}
|
||||||
|
export function register(lang: Wordlist, name?: string): void;
|
||||||
|
}
|
||||||
|
|
103
dist/ethers.js
vendored
103
dist/ethers.js
vendored
@ -1,7 +1,7 @@
|
|||||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = "4.0.0-beta.3";
|
exports.version = "4.0.0-beta.4";
|
||||||
|
|
||||||
},{}],2:[function(require,module,exports){
|
},{}],2:[function(require,module,exports){
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -168,17 +168,17 @@ var Contract = /** @class */ (function () {
|
|||||||
errors.checkNew(this, Contract);
|
errors.checkNew(this, 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);
|
||||||
if (contractInterface instanceof interface_1.Interface) {
|
if (interface_1.Interface.isInterface(contractInterface)) {
|
||||||
properties_1.defineReadOnly(this, 'interface', contractInterface);
|
properties_1.defineReadOnly(this, 'interface', contractInterface);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));
|
properties_1.defineReadOnly(this, 'interface', new interface_1.Interface(contractInterface));
|
||||||
}
|
}
|
||||||
if (signerOrProvider instanceof types_1.Signer) {
|
if (types_1.Signer.isSigner(signerOrProvider)) {
|
||||||
properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);
|
properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider);
|
||||||
properties_1.defineReadOnly(this, 'signer', signerOrProvider);
|
properties_1.defineReadOnly(this, 'signer', signerOrProvider);
|
||||||
}
|
}
|
||||||
else if (signerOrProvider instanceof types_1.MinimalProvider) {
|
else if (types_1.MinimalProvider.isProvider(signerOrProvider)) {
|
||||||
properties_1.defineReadOnly(this, 'provider', signerOrProvider);
|
properties_1.defineReadOnly(this, 'provider', signerOrProvider);
|
||||||
properties_1.defineReadOnly(this, 'signer', null);
|
properties_1.defineReadOnly(this, 'signer', null);
|
||||||
}
|
}
|
||||||
@ -851,6 +851,7 @@ var Interface = /** @class */ (function () {
|
|||||||
if (!this.deployFunction) {
|
if (!this.deployFunction) {
|
||||||
addMethod.call(this, { type: 'constructor', inputs: [] });
|
addMethod.call(this, { type: 'constructor', inputs: [] });
|
||||||
}
|
}
|
||||||
|
properties_1.setType(this, 'Interface');
|
||||||
}
|
}
|
||||||
Interface.prototype.parseTransaction = function (tx) {
|
Interface.prototype.parseTransaction = function (tx) {
|
||||||
var sighash = tx.data.substring(0, 10).toLowerCase();
|
var sighash = tx.data.substring(0, 10).toLowerCase();
|
||||||
@ -895,6 +896,9 @@ var Interface = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
Interface.isInterface = function (value) {
|
||||||
|
return properties_1.isType(value, 'Interface');
|
||||||
|
};
|
||||||
return Interface;
|
return Interface;
|
||||||
}());
|
}());
|
||||||
exports.Interface = Interface;
|
exports.Interface = Interface;
|
||||||
@ -12159,8 +12163,20 @@ var CoderNumber = /** @class */ (function (_super) {
|
|||||||
CoderNumber.prototype.encode = function (value) {
|
CoderNumber.prototype.encode = function (value) {
|
||||||
try {
|
try {
|
||||||
var v = bignumber_1.bigNumberify(value);
|
var v = bignumber_1.bigNumberify(value);
|
||||||
|
if (this.signed) {
|
||||||
|
var bounds = bignumber_1.ConstantMaxUint256.maskn(this.size * 8 - 1);
|
||||||
|
if (v.gt(bounds)) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
|
bounds = bounds.add(bignumber_1.ConstantOne).mul(bignumber_1.ConstantNegativeOne);
|
||||||
|
if (v.lt(bounds)) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (v.lt(bignumber_1.ConstantZero) || v.gt(bignumber_1.ConstantMaxUint256.maskn(this.size * 8))) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
v = v.toTwos(this.size * 8).maskn(this.size * 8);
|
v = v.toTwos(this.size * 8).maskn(this.size * 8);
|
||||||
//value = value.toTwos(size * 8).maskn(size * 8);
|
|
||||||
if (this.signed) {
|
if (this.signed) {
|
||||||
v = v.fromTwos(this.size * 8).toTwos(256);
|
v = v.fromTwos(this.size * 8).toTwos(256);
|
||||||
}
|
}
|
||||||
@ -12241,8 +12257,8 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
|||||||
var result = new Uint8Array(32);
|
var result = new Uint8Array(32);
|
||||||
try {
|
try {
|
||||||
var data = bytes_1.arrayify(value);
|
var data = bytes_1.arrayify(value);
|
||||||
if (data.length > 32) {
|
if (data.length !== this.length) {
|
||||||
throw new Error();
|
throw new Error('incorrect data length');
|
||||||
}
|
}
|
||||||
result.set(data);
|
result.set(data);
|
||||||
}
|
}
|
||||||
@ -13064,7 +13080,7 @@ var BigNumber = /** @class */ (function (_super) {
|
|||||||
return BigNumber;
|
return BigNumber;
|
||||||
}(types_1.BigNumber));
|
}(types_1.BigNumber));
|
||||||
function bigNumberify(value) {
|
function bigNumberify(value) {
|
||||||
if (value instanceof BigNumber) {
|
if (BigNumber.isBigNumber(value)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return new BigNumber(value);
|
return new BigNumber(value);
|
||||||
@ -13075,6 +13091,7 @@ exports.ConstantZero = bigNumberify(0);
|
|||||||
exports.ConstantOne = bigNumberify(1);
|
exports.ConstantOne = bigNumberify(1);
|
||||||
exports.ConstantTwo = bigNumberify(2);
|
exports.ConstantTwo = bigNumberify(2);
|
||||||
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000');
|
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000');
|
||||||
|
exports.ConstantMaxUint256 = bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
|
||||||
|
|
||||||
},{"./bytes":60,"./errors":61,"./properties":69,"./types":77,"bn.js":8}],60:[function(require,module,exports){
|
},{"./bytes":60,"./errors":61,"./properties":69,"./types":77,"bn.js":8}],60:[function(require,module,exports){
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -13087,9 +13104,6 @@ var types_1 = require("./types");
|
|||||||
var errors = require("./errors");
|
var errors = require("./errors");
|
||||||
exports.AddressZero = '0x0000000000000000000000000000000000000000';
|
exports.AddressZero = '0x0000000000000000000000000000000000000000';
|
||||||
exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||||
function isBigNumber(value) {
|
|
||||||
return (value instanceof types_1.BigNumber);
|
|
||||||
}
|
|
||||||
function addSlice(array) {
|
function addSlice(array) {
|
||||||
if (array.slice) {
|
if (array.slice) {
|
||||||
return array;
|
return array;
|
||||||
@ -13117,7 +13131,7 @@ function arrayify(value) {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||||
}
|
}
|
||||||
if (isBigNumber(value)) {
|
if (types_1.BigNumber.isBigNumber(value)) {
|
||||||
value = value.toHexString();
|
value = value.toHexString();
|
||||||
}
|
}
|
||||||
if (typeof (value) === 'string') {
|
if (typeof (value) === 'string') {
|
||||||
@ -13203,7 +13217,7 @@ function isHexString(value, length) {
|
|||||||
exports.isHexString = isHexString;
|
exports.isHexString = isHexString;
|
||||||
var HexCharacters = '0123456789abcdef';
|
var HexCharacters = '0123456789abcdef';
|
||||||
function hexlify(value) {
|
function hexlify(value) {
|
||||||
if (isBigNumber(value)) {
|
if (types_1.BigNumber.isBigNumber(value)) {
|
||||||
return value.toHexString();
|
return value.toHexString();
|
||||||
}
|
}
|
||||||
if (typeof (value) === 'number') {
|
if (typeof (value) === 'number') {
|
||||||
@ -13605,7 +13619,8 @@ var constants = {
|
|||||||
Zero: bignumber_1.ConstantZero,
|
Zero: bignumber_1.ConstantZero,
|
||||||
One: bignumber_1.ConstantOne,
|
One: bignumber_1.ConstantOne,
|
||||||
Two: bignumber_1.ConstantTwo,
|
Two: bignumber_1.ConstantTwo,
|
||||||
WeiPerEther: bignumber_1.ConstantWeiPerEther
|
WeiPerEther: bignumber_1.ConstantWeiPerEther,
|
||||||
|
ConstantMaxUint256: bignumber_1.ConstantMaxUint256
|
||||||
};
|
};
|
||||||
exports.constants = constants;
|
exports.constants = constants;
|
||||||
|
|
||||||
@ -13839,6 +13854,16 @@ function defineFrozen(object, name, value) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.defineFrozen = defineFrozen;
|
exports.defineFrozen = defineFrozen;
|
||||||
|
// There are some issues with instanceof with npm link, so we use this
|
||||||
|
// to ensure types are what we expect.
|
||||||
|
function setType(object, type) {
|
||||||
|
Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });
|
||||||
|
}
|
||||||
|
exports.setType = setType;
|
||||||
|
function isType(object, type) {
|
||||||
|
return (object._ethersType === type);
|
||||||
|
}
|
||||||
|
exports.isType = isType;
|
||||||
function resolveProperties(object) {
|
function resolveProperties(object) {
|
||||||
var result = {};
|
var result = {};
|
||||||
var promises = [];
|
var promises = [];
|
||||||
@ -14408,11 +14433,21 @@ var secp256k1_1 = require("./secp256k1");
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Bytes
|
// Bytes
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
function setType(object, type) {
|
||||||
|
Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });
|
||||||
|
}
|
||||||
|
function isType(object, type) {
|
||||||
|
return (object._ethersType === type);
|
||||||
|
}
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// BigNumber
|
// BigNumber
|
||||||
var BigNumber = /** @class */ (function () {
|
var BigNumber = /** @class */ (function () {
|
||||||
function BigNumber() {
|
function BigNumber() {
|
||||||
|
setType(this, 'BigNumber');
|
||||||
}
|
}
|
||||||
|
BigNumber.isBigNumber = function (value) {
|
||||||
|
return isType(value, 'BigNumber');
|
||||||
|
};
|
||||||
return BigNumber;
|
return BigNumber;
|
||||||
}());
|
}());
|
||||||
exports.BigNumber = BigNumber;
|
exports.BigNumber = BigNumber;
|
||||||
@ -14423,31 +14458,31 @@ exports.BigNumber = BigNumber;
|
|||||||
// Interface
|
// Interface
|
||||||
var Indexed = /** @class */ (function () {
|
var Indexed = /** @class */ (function () {
|
||||||
function Indexed() {
|
function Indexed() {
|
||||||
|
setType(this, 'Indexed');
|
||||||
}
|
}
|
||||||
|
Indexed.isIndexed = function (value) {
|
||||||
|
return isType(value, 'Indexed');
|
||||||
|
};
|
||||||
return Indexed;
|
return Indexed;
|
||||||
}());
|
}());
|
||||||
exports.Indexed = Indexed;
|
exports.Indexed = Indexed;
|
||||||
/**
|
|
||||||
* Provider
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Provider.
|
|
||||||
*/
|
|
||||||
var MinimalProvider = /** @class */ (function () {
|
var MinimalProvider = /** @class */ (function () {
|
||||||
function MinimalProvider() {
|
function MinimalProvider() {
|
||||||
|
setType(this, 'Provider');
|
||||||
}
|
}
|
||||||
|
MinimalProvider.isProvider = function (value) {
|
||||||
|
return isType(value, 'Provider');
|
||||||
|
};
|
||||||
return MinimalProvider;
|
return MinimalProvider;
|
||||||
}());
|
}());
|
||||||
exports.MinimalProvider = MinimalProvider;
|
exports.MinimalProvider = MinimalProvider;
|
||||||
/**
|
|
||||||
* Signer
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Signer.
|
|
||||||
*/
|
|
||||||
var Signer = /** @class */ (function () {
|
var Signer = /** @class */ (function () {
|
||||||
function Signer() {
|
function Signer() {
|
||||||
|
setType(this, 'Signer');
|
||||||
}
|
}
|
||||||
|
Signer.isSigner = function (value) {
|
||||||
|
return isType(value, 'Signer');
|
||||||
|
};
|
||||||
return Signer;
|
return Signer;
|
||||||
}());
|
}());
|
||||||
exports.Signer = Signer;
|
exports.Signer = Signer;
|
||||||
@ -14455,7 +14490,11 @@ exports.Signer = Signer;
|
|||||||
// HDNode
|
// HDNode
|
||||||
var HDNode = /** @class */ (function () {
|
var HDNode = /** @class */ (function () {
|
||||||
function HDNode() {
|
function HDNode() {
|
||||||
|
setType(this, 'HDNode');
|
||||||
}
|
}
|
||||||
|
HDNode.isHDNode = function (value) {
|
||||||
|
return isType(value, 'HDNode');
|
||||||
|
};
|
||||||
return HDNode;
|
return HDNode;
|
||||||
}());
|
}());
|
||||||
exports.HDNode = HDNode;
|
exports.HDNode = HDNode;
|
||||||
@ -15420,7 +15459,7 @@ function encrypt(privateKey, password, options, progressCallback) {
|
|||||||
}
|
}
|
||||||
// Check the private key
|
// Check the private key
|
||||||
var privateKeyBytes = null;
|
var privateKeyBytes = null;
|
||||||
if (privateKey instanceof signing_key_1.SigningKey) {
|
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||||
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -15596,7 +15635,7 @@ var SigningKey = /** @class */ (function () {
|
|||||||
function SigningKey(privateKey) {
|
function SigningKey(privateKey) {
|
||||||
errors.checkNew(this, SigningKey);
|
errors.checkNew(this, SigningKey);
|
||||||
var privateKeyBytes = null;
|
var privateKeyBytes = null;
|
||||||
if (privateKey instanceof types_1.HDNode) {
|
if (types_1.HDNode.isHDNode(privateKey)) {
|
||||||
properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);
|
properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);
|
||||||
properties_1.defineReadOnly(this, 'path', privateKey.path);
|
properties_1.defineReadOnly(this, 'path', privateKey.path);
|
||||||
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
||||||
@ -15627,10 +15666,14 @@ var SigningKey = /** @class */ (function () {
|
|||||||
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
|
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
|
||||||
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
|
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
|
||||||
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
|
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
|
||||||
|
properties_1.setType(this, 'SigningKey');
|
||||||
}
|
}
|
||||||
SigningKey.prototype.signDigest = function (digest) {
|
SigningKey.prototype.signDigest = function (digest) {
|
||||||
return this.keyPair.sign(digest);
|
return this.keyPair.sign(digest);
|
||||||
};
|
};
|
||||||
|
SigningKey.isSigningKey = function (value) {
|
||||||
|
return properties_1.isType(value, 'SigningKey');
|
||||||
|
};
|
||||||
return SigningKey;
|
return SigningKey;
|
||||||
}());
|
}());
|
||||||
exports.SigningKey = SigningKey;
|
exports.SigningKey = SigningKey;
|
||||||
@ -15673,7 +15716,7 @@ var Wallet = /** @class */ (function (_super) {
|
|||||||
var _this = _super.call(this) || this;
|
var _this = _super.call(this) || this;
|
||||||
errors.checkNew(_this, Wallet);
|
errors.checkNew(_this, Wallet);
|
||||||
// Make sure we have a valid signing key
|
// Make sure we have a valid signing key
|
||||||
if (privateKey instanceof signing_key_1.SigningKey) {
|
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||||
properties_1.defineReadOnly(_this, 'signingKey', privateKey);
|
properties_1.defineReadOnly(_this, 'signingKey', privateKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -15706,7 +15749,7 @@ var Wallet = /** @class */ (function (_super) {
|
|||||||
* Create a new instance of this Wallet connected to provider.
|
* Create a new instance of this Wallet connected to provider.
|
||||||
*/
|
*/
|
||||||
Wallet.prototype.connect = function (provider) {
|
Wallet.prototype.connect = function (provider) {
|
||||||
if (!(provider instanceof types_1.MinimalProvider)) {
|
if (!(types_1.MinimalProvider.isProvider(provider))) {
|
||||||
errors.throwError('invalid provider', errors.INVALID_ARGUMENT, { argument: 'provider', value: provider });
|
errors.throwError('invalid provider', errors.INVALID_ARGUMENT, { argument: 'provider', value: provider });
|
||||||
}
|
}
|
||||||
return new Wallet(this.signingKey, provider);
|
return new Wallet(this.signingKey, provider);
|
||||||
|
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
463
dist/ethers.types.txt
vendored
463
dist/ethers.types.txt
vendored
@ -24,6 +24,7 @@ declare module 'ethers/ethers' {
|
|||||||
One: utils.types.BigNumber;
|
One: utils.types.BigNumber;
|
||||||
Two: utils.types.BigNumber;
|
Two: utils.types.BigNumber;
|
||||||
WeiPerEther: utils.types.BigNumber;
|
WeiPerEther: utils.types.BigNumber;
|
||||||
|
ConstantMaxUint256: utils.types.BigNumber;
|
||||||
};
|
};
|
||||||
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
|
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
|
||||||
}
|
}
|
||||||
@ -82,6 +83,7 @@ declare module 'ethers/utils' {
|
|||||||
One: types.BigNumber;
|
One: types.BigNumber;
|
||||||
Two: types.BigNumber;
|
Two: types.BigNumber;
|
||||||
WeiPerEther: types.BigNumber;
|
WeiPerEther: types.BigNumber;
|
||||||
|
ConstantMaxUint256: types.BigNumber;
|
||||||
};
|
};
|
||||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
|
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
|
||||||
}
|
}
|
||||||
@ -108,303 +110,301 @@ declare module 'ethers/wordlists' {
|
|||||||
declare module 'ethers/utils/types' {
|
declare module 'ethers/utils/types' {
|
||||||
export type Arrayish = string | ArrayLike<number>;
|
export type Arrayish = string | ArrayLike<number>;
|
||||||
export abstract class BigNumber {
|
export abstract class BigNumber {
|
||||||
abstract fromTwos(value: number): BigNumber;
|
abstract fromTwos(value: number): BigNumber;
|
||||||
abstract toTwos(value: number): BigNumber;
|
abstract toTwos(value: number): BigNumber;
|
||||||
abstract add(other: BigNumberish): BigNumber;
|
abstract add(other: BigNumberish): BigNumber;
|
||||||
abstract sub(other: BigNumberish): BigNumber;
|
abstract sub(other: BigNumberish): BigNumber;
|
||||||
abstract div(other: BigNumberish): BigNumber;
|
abstract div(other: BigNumberish): BigNumber;
|
||||||
abstract mul(other: BigNumberish): BigNumber;
|
abstract mul(other: BigNumberish): BigNumber;
|
||||||
abstract mod(other: BigNumberish): BigNumber;
|
abstract mod(other: BigNumberish): BigNumber;
|
||||||
abstract pow(other: BigNumberish): BigNumber;
|
abstract pow(other: BigNumberish): BigNumber;
|
||||||
abstract maskn(value: number): BigNumber;
|
abstract maskn(value: number): BigNumber;
|
||||||
abstract eq(other: BigNumberish): boolean;
|
abstract eq(other: BigNumberish): boolean;
|
||||||
abstract lt(other: BigNumberish): boolean;
|
abstract lt(other: BigNumberish): boolean;
|
||||||
abstract lte(other: BigNumberish): boolean;
|
abstract lte(other: BigNumberish): boolean;
|
||||||
abstract gt(other: BigNumberish): boolean;
|
abstract gt(other: BigNumberish): boolean;
|
||||||
abstract gte(other: BigNumberish): boolean;
|
abstract gte(other: BigNumberish): boolean;
|
||||||
abstract isZero(): boolean;
|
abstract isZero(): boolean;
|
||||||
abstract toNumber(): number;
|
abstract toNumber(): number;
|
||||||
abstract toString(): string;
|
abstract toString(): string;
|
||||||
abstract toHexString(): string;
|
abstract toHexString(): string;
|
||||||
|
constructor();
|
||||||
|
static isBigNumber(value: any): value is BigNumber;
|
||||||
}
|
}
|
||||||
export type BigNumberish = BigNumber | string | number | Arrayish;
|
export type BigNumberish = BigNumber | string | number | Arrayish;
|
||||||
export type ConnectionInfo = {
|
export type ConnectionInfo = {
|
||||||
url: string;
|
url: string;
|
||||||
user?: string;
|
user?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
allowInsecure?: boolean;
|
allowInsecure?: boolean;
|
||||||
};
|
};
|
||||||
export interface OnceBlockable {
|
export interface OnceBlockable {
|
||||||
once(eventName: "block", handler: () => void): void;
|
once(eventName: "block", handler: () => void): void;
|
||||||
}
|
}
|
||||||
export type PollOptions = {
|
export type PollOptions = {
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
floor?: number;
|
floor?: number;
|
||||||
ceiling?: number;
|
ceiling?: number;
|
||||||
interval?: number;
|
interval?: number;
|
||||||
onceBlock?: OnceBlockable;
|
onceBlock?: OnceBlockable;
|
||||||
};
|
};
|
||||||
export type SupportedAlgorithms = 'sha256' | 'sha512';
|
export type SupportedAlgorithms = 'sha256' | 'sha512';
|
||||||
export interface Signature {
|
export interface Signature {
|
||||||
r: string;
|
r: string;
|
||||||
s: string;
|
s: string;
|
||||||
recoveryParam?: number;
|
recoveryParam?: number;
|
||||||
v?: number;
|
v?: number;
|
||||||
}
|
}
|
||||||
export type Network = {
|
export type Network = {
|
||||||
name: string;
|
name: string;
|
||||||
chainId: number;
|
chainId: number;
|
||||||
ensAddress?: string;
|
ensAddress?: string;
|
||||||
};
|
};
|
||||||
export type Networkish = Network | string | number;
|
export type Networkish = Network | string | number;
|
||||||
export type CoerceFunc = (type: string, value: any) => any;
|
export type CoerceFunc = (type: string, value: any) => any;
|
||||||
export type ParamType = {
|
export type ParamType = {
|
||||||
name?: string;
|
name?: string;
|
||||||
type: string;
|
type: string;
|
||||||
indexed?: boolean;
|
indexed?: boolean;
|
||||||
components?: Array<any>;
|
components?: Array<any>;
|
||||||
};
|
};
|
||||||
export type EventFragment = {
|
export type EventFragment = {
|
||||||
type: string;
|
type: string;
|
||||||
name: string;
|
name: string;
|
||||||
anonymous: boolean;
|
anonymous: boolean;
|
||||||
inputs: Array<ParamType>;
|
inputs: Array<ParamType>;
|
||||||
};
|
};
|
||||||
export type FunctionFragment = {
|
export type FunctionFragment = {
|
||||||
type: string;
|
type: string;
|
||||||
name: string;
|
name: string;
|
||||||
constant: boolean;
|
constant: boolean;
|
||||||
inputs: Array<ParamType>;
|
inputs: Array<ParamType>;
|
||||||
outputs: Array<ParamType>;
|
outputs: Array<ParamType>;
|
||||||
payable: boolean;
|
payable: boolean;
|
||||||
stateMutability: string;
|
stateMutability: string;
|
||||||
};
|
};
|
||||||
export type UnsignedTransaction = {
|
export type UnsignedTransaction = {
|
||||||
to?: string;
|
to?: string;
|
||||||
nonce?: number;
|
nonce?: number;
|
||||||
gasLimit?: BigNumberish;
|
gasLimit?: BigNumberish;
|
||||||
gasPrice?: BigNumberish;
|
gasPrice?: BigNumberish;
|
||||||
data?: Arrayish;
|
data?: Arrayish;
|
||||||
value?: BigNumberish;
|
value?: BigNumberish;
|
||||||
chainId?: number;
|
chainId?: number;
|
||||||
};
|
};
|
||||||
export interface Transaction {
|
export interface Transaction {
|
||||||
hash?: string;
|
hash?: string;
|
||||||
to?: string;
|
to?: string;
|
||||||
from?: string;
|
from?: string;
|
||||||
nonce: number;
|
nonce: number;
|
||||||
gasLimit: BigNumber;
|
gasLimit: BigNumber;
|
||||||
gasPrice: BigNumber;
|
gasPrice: BigNumber;
|
||||||
data: string;
|
data: string;
|
||||||
value: BigNumber;
|
value: BigNumber;
|
||||||
chainId: number;
|
chainId: number;
|
||||||
r?: string;
|
r?: string;
|
||||||
s?: string;
|
s?: string;
|
||||||
v?: number;
|
v?: number;
|
||||||
}
|
}
|
||||||
export type BlockTag = string | number;
|
export type BlockTag = string | number;
|
||||||
export interface Block {
|
export interface Block {
|
||||||
hash: string;
|
hash: string;
|
||||||
parentHash: string;
|
parentHash: string;
|
||||||
number: number;
|
number: number;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
nonce: string;
|
nonce: string;
|
||||||
difficulty: number;
|
difficulty: number;
|
||||||
gasLimit: BigNumber;
|
gasLimit: BigNumber;
|
||||||
gasUsed: BigNumber;
|
gasUsed: BigNumber;
|
||||||
miner: string;
|
miner: string;
|
||||||
extraData: string;
|
extraData: string;
|
||||||
transactions: Array<string>;
|
transactions: Array<string>;
|
||||||
}
|
}
|
||||||
export type Filter = {
|
export type Filter = {
|
||||||
fromBlock?: BlockTag;
|
fromBlock?: BlockTag;
|
||||||
toBlock?: BlockTag;
|
toBlock?: BlockTag;
|
||||||
address?: string;
|
address?: string;
|
||||||
topics?: Array<string | Array<string>>;
|
topics?: Array<string | Array<string>>;
|
||||||
};
|
};
|
||||||
export interface Log {
|
export interface Log {
|
||||||
blockNumber?: number;
|
blockNumber?: number;
|
||||||
blockHash?: string;
|
blockHash?: string;
|
||||||
transactionIndex?: number;
|
transactionIndex?: number;
|
||||||
removed?: boolean;
|
removed?: boolean;
|
||||||
transactionLogIndex?: number;
|
transactionLogIndex?: number;
|
||||||
address: string;
|
address: string;
|
||||||
data: string;
|
data: string;
|
||||||
topics: Array<string>;
|
topics: Array<string>;
|
||||||
transactionHash?: string;
|
transactionHash?: string;
|
||||||
logIndex?: number;
|
logIndex?: number;
|
||||||
}
|
}
|
||||||
export interface TransactionReceipt {
|
export interface TransactionReceipt {
|
||||||
contractAddress?: string;
|
contractAddress?: string;
|
||||||
transactionIndex?: number;
|
transactionIndex?: number;
|
||||||
root?: string;
|
root?: string;
|
||||||
gasUsed?: BigNumber;
|
gasUsed?: BigNumber;
|
||||||
logsBloom?: string;
|
logsBloom?: string;
|
||||||
blockHash?: string;
|
blockHash?: string;
|
||||||
transactionHash?: string;
|
transactionHash?: string;
|
||||||
logs?: Array<Log>;
|
logs?: Array<Log>;
|
||||||
blockNumber?: number;
|
blockNumber?: number;
|
||||||
cumulativeGasUsed?: BigNumber;
|
cumulativeGasUsed?: BigNumber;
|
||||||
byzantium: boolean;
|
byzantium: boolean;
|
||||||
status?: number;
|
status?: number;
|
||||||
}
|
}
|
||||||
export type TransactionRequest = {
|
export type TransactionRequest = {
|
||||||
to?: string | Promise<string>;
|
to?: string | Promise<string>;
|
||||||
from?: string | Promise<string>;
|
from?: string | Promise<string>;
|
||||||
nonce?: number | string | Promise<number | string>;
|
nonce?: number | string | Promise<number | string>;
|
||||||
gasLimit?: BigNumberish | Promise<BigNumberish>;
|
gasLimit?: BigNumberish | Promise<BigNumberish>;
|
||||||
gasPrice?: BigNumberish | Promise<BigNumberish>;
|
gasPrice?: BigNumberish | Promise<BigNumberish>;
|
||||||
data?: Arrayish | Promise<Arrayish>;
|
data?: Arrayish | Promise<Arrayish>;
|
||||||
value?: BigNumberish | Promise<BigNumberish>;
|
value?: BigNumberish | Promise<BigNumberish>;
|
||||||
chainId?: number | Promise<number>;
|
chainId?: number | Promise<number>;
|
||||||
};
|
};
|
||||||
export interface TransactionResponse extends Transaction {
|
export interface TransactionResponse extends Transaction {
|
||||||
blockNumber?: number;
|
blockNumber?: number;
|
||||||
blockHash?: string;
|
blockHash?: string;
|
||||||
timestamp?: number;
|
timestamp?: number;
|
||||||
from: string;
|
from: string;
|
||||||
raw?: string;
|
raw?: string;
|
||||||
wait: (timeout?: number) => Promise<TransactionReceipt>;
|
wait: (timeout?: number) => Promise<TransactionReceipt>;
|
||||||
}
|
}
|
||||||
export abstract class Indexed {
|
export abstract class Indexed {
|
||||||
readonly hash: string;
|
readonly hash: string;
|
||||||
|
constructor();
|
||||||
|
static isIndexed(value: any): value is Indexed;
|
||||||
}
|
}
|
||||||
export interface DeployDescription {
|
export interface DeployDescription {
|
||||||
readonly inputs: Array<ParamType>;
|
readonly inputs: Array<ParamType>;
|
||||||
readonly payable: boolean;
|
readonly payable: boolean;
|
||||||
encode(bytecode: string, params: Array<any>): string;
|
encode(bytecode: string, params: Array<any>): string;
|
||||||
}
|
}
|
||||||
export interface FunctionDescription {
|
export interface FunctionDescription {
|
||||||
readonly type: "call" | "transaction";
|
readonly type: "call" | "transaction";
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
readonly sighash: string;
|
readonly sighash: string;
|
||||||
readonly inputs: Array<ParamType>;
|
readonly inputs: Array<ParamType>;
|
||||||
readonly outputs: Array<ParamType>;
|
readonly outputs: Array<ParamType>;
|
||||||
readonly payable: boolean;
|
readonly payable: boolean;
|
||||||
encode(params: Array<any>): string;
|
encode(params: Array<any>): string;
|
||||||
decode(data: string): any;
|
decode(data: string): any;
|
||||||
}
|
}
|
||||||
export interface EventDescription {
|
export interface EventDescription {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
readonly inputs: Array<ParamType>;
|
readonly inputs: Array<ParamType>;
|
||||||
readonly anonymous: boolean;
|
readonly anonymous: boolean;
|
||||||
readonly topic: string;
|
readonly topic: string;
|
||||||
encodeTopics(params: Array<any>): Array<string>;
|
encodeTopics(params: Array<any>): Array<string>;
|
||||||
decode(data: string, topics?: Array<string>): any;
|
decode(data: string, topics?: Array<string>): any;
|
||||||
}
|
}
|
||||||
export interface LogDescription {
|
export interface LogDescription {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
readonly topic: string;
|
readonly topic: string;
|
||||||
readonly values: Array<any>;
|
readonly values: Array<any>;
|
||||||
}
|
}
|
||||||
export interface TransactionDescription {
|
export interface TransactionDescription {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly args: Array<any>;
|
readonly args: Array<any>;
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
readonly sighash: string;
|
readonly sighash: string;
|
||||||
readonly decode: (data: string) => any;
|
readonly decode: (data: string) => any;
|
||||||
readonly value: BigNumber;
|
readonly value: BigNumber;
|
||||||
}
|
}
|
||||||
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
export type ContractFunction = (...params: Array<any>) => Promise<any>;
|
||||||
export type EventFilter = {
|
export type EventFilter = {
|
||||||
address?: string;
|
address?: string;
|
||||||
topics?: Array<string>;
|
topics?: Array<string>;
|
||||||
};
|
};
|
||||||
export interface Event extends Log {
|
export interface Event extends Log {
|
||||||
args: Array<any>;
|
args: Array<any>;
|
||||||
decode: (data: string, topics?: Array<string>) => any;
|
decode: (data: string, topics?: Array<string>) => any;
|
||||||
event: string;
|
event: string;
|
||||||
eventSignature: string;
|
eventSignature: string;
|
||||||
removeListener: () => void;
|
removeListener: () => void;
|
||||||
getBlock: () => Promise<Block>;
|
getBlock: () => Promise<Block>;
|
||||||
getTransaction: () => Promise<TransactionResponse>;
|
getTransaction: () => Promise<TransactionResponse>;
|
||||||
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
getTransactionReceipt: () => Promise<TransactionReceipt>;
|
||||||
}
|
}
|
||||||
export type EventType = string | Array<string> | Filter;
|
export type EventType = string | Array<string> | Filter;
|
||||||
export type Listener = (...args: Array<any>) => void;
|
export type Listener = (...args: Array<any>) => void;
|
||||||
/**
|
|
||||||
* Provider
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Provider.
|
|
||||||
*/
|
|
||||||
export abstract class MinimalProvider implements OnceBlockable {
|
export abstract class MinimalProvider implements OnceBlockable {
|
||||||
abstract getNetwork(): Promise<Network>;
|
abstract getNetwork(): Promise<Network>;
|
||||||
abstract getBlockNumber(): Promise<number>;
|
abstract getBlockNumber(): Promise<number>;
|
||||||
abstract getGasPrice(): Promise<BigNumber>;
|
abstract getGasPrice(): Promise<BigNumber>;
|
||||||
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
|
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;
|
||||||
abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
|
abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;
|
||||||
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): Promise<string>;
|
abstract call(transaction: TransactionRequest): Promise<string>;
|
||||||
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
abstract estimateGas(transaction: TransactionRequest): Promise<BigNumber>;
|
||||||
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
abstract getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>): Promise<Block>;
|
||||||
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
abstract getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
||||||
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
abstract getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
||||||
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
abstract getLogs(filter: Filter): Promise<Array<Log>>;
|
||||||
abstract resolveName(name: string | Promise<string>): Promise<string>;
|
abstract resolveName(name: string | Promise<string>): Promise<string>;
|
||||||
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
|
abstract lookupAddress(address: string | Promise<string>): Promise<string>;
|
||||||
abstract on(eventName: EventType, listener: Listener): MinimalProvider;
|
abstract on(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
abstract once(eventName: EventType, listener: Listener): MinimalProvider;
|
abstract once(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
abstract listenerCount(eventName?: EventType): number;
|
abstract listenerCount(eventName?: EventType): number;
|
||||||
abstract listeners(eventName: EventType): Array<Listener>;
|
abstract listeners(eventName: EventType): Array<Listener>;
|
||||||
abstract removeAllListeners(eventName: EventType): MinimalProvider;
|
abstract removeAllListeners(eventName: EventType): MinimalProvider;
|
||||||
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
|
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||||
|
constructor();
|
||||||
|
static isProvider(value: any): value is MinimalProvider;
|
||||||
}
|
}
|
||||||
export type AsyncProvider = {
|
export type AsyncProvider = {
|
||||||
isMetaMask?: boolean;
|
isMetaMask?: boolean;
|
||||||
host?: string;
|
host?: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
|
sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
|
||||||
};
|
};
|
||||||
export type ProgressCallback = (percent: number) => void;
|
export type ProgressCallback = (percent: number) => void;
|
||||||
export type EncryptOptions = {
|
export type EncryptOptions = {
|
||||||
iv?: Arrayish;
|
iv?: Arrayish;
|
||||||
entropy?: Arrayish;
|
entropy?: Arrayish;
|
||||||
mnemonic?: string;
|
mnemonic?: string;
|
||||||
path?: string;
|
path?: string;
|
||||||
client?: string;
|
client?: string;
|
||||||
salt?: Arrayish;
|
salt?: Arrayish;
|
||||||
uuid?: string;
|
uuid?: string;
|
||||||
scrypt?: {
|
scrypt?: {
|
||||||
N?: number;
|
N?: number;
|
||||||
r?: number;
|
r?: number;
|
||||||
p?: number;
|
p?: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* Signer
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Signer.
|
|
||||||
*/
|
|
||||||
export abstract class Signer {
|
export abstract class Signer {
|
||||||
provider?: MinimalProvider;
|
provider?: MinimalProvider;
|
||||||
abstract getAddress(): Promise<string>;
|
abstract getAddress(): Promise<string>;
|
||||||
abstract signMessage(message: Arrayish | string): Promise<string>;
|
abstract signMessage(message: Arrayish | string): Promise<string>;
|
||||||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
constructor();
|
||||||
|
static isSigner(value: any): value is Signer;
|
||||||
}
|
}
|
||||||
export abstract class HDNode {
|
export abstract class HDNode {
|
||||||
readonly privateKey: string;
|
readonly privateKey: string;
|
||||||
readonly publicKey: string;
|
readonly publicKey: string;
|
||||||
readonly mnemonic: string;
|
readonly mnemonic: string;
|
||||||
readonly path: string;
|
readonly path: string;
|
||||||
readonly chainCode: string;
|
readonly chainCode: string;
|
||||||
readonly index: number;
|
readonly index: number;
|
||||||
readonly depth: number;
|
readonly depth: number;
|
||||||
abstract derivePath(path: string): HDNode;
|
abstract derivePath(path: string): HDNode;
|
||||||
|
constructor();
|
||||||
|
static isHDNode(value: any): value is HDNode;
|
||||||
}
|
}
|
||||||
export interface Wordlist {
|
export interface Wordlist {
|
||||||
locale: string;
|
locale: string;
|
||||||
getWord(index: number): string;
|
getWord(index: number): string;
|
||||||
getWordIndex(word: string): number;
|
getWordIndex(word: string): number;
|
||||||
split(mnemonic: string): Array<string>;
|
split(mnemonic: string): Array<string>;
|
||||||
join(words: Array<string>): string;
|
join(words: Array<string>): string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ declare module 'ethers/utils/errors' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/_version' {
|
declare module 'ethers/_version' {
|
||||||
export const version = "4.0.0-beta.3";
|
export const version = "4.0.0-beta.4";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/contracts/contract' {
|
declare module 'ethers/contracts/contract' {
|
||||||
@ -483,6 +483,7 @@ declare module 'ethers/contracts/interface' {
|
|||||||
topics: Array<string>;
|
topics: Array<string>;
|
||||||
data: string;
|
data: string;
|
||||||
}): _LogDescription;
|
}): _LogDescription;
|
||||||
|
static isInterface(value: any): value is Interface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,6 +662,7 @@ declare module 'ethers/utils/bignumber' {
|
|||||||
export const ConstantOne: _BigNumber;
|
export const ConstantOne: _BigNumber;
|
||||||
export const ConstantTwo: _BigNumber;
|
export const ConstantTwo: _BigNumber;
|
||||||
export const ConstantWeiPerEther: _BigNumber;
|
export const ConstantWeiPerEther: _BigNumber;
|
||||||
|
export const ConstantMaxUint256: _BigNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'ethers/utils/bytes' {
|
declare module 'ethers/utils/bytes' {
|
||||||
@ -734,6 +736,8 @@ declare module 'ethers/utils/networks' {
|
|||||||
declare module 'ethers/utils/properties' {
|
declare module 'ethers/utils/properties' {
|
||||||
export function defineReadOnly(object: any, name: string, value: any): void;
|
export function defineReadOnly(object: any, name: string, value: any): void;
|
||||||
export function defineFrozen(object: any, name: string, value: any): void;
|
export function defineFrozen(object: any, name: string, value: any): void;
|
||||||
|
export function setType(object: any, type: string): void;
|
||||||
|
export function isType(object: any, type: string): boolean;
|
||||||
export function resolveProperties(object: any): Promise<any>;
|
export function resolveProperties(object: any): Promise<any>;
|
||||||
export function shallowCopy(object: any): any;
|
export function shallowCopy(object: any): any;
|
||||||
export function jsonCopy(object: any): any;
|
export function jsonCopy(object: any): any;
|
||||||
@ -846,6 +850,7 @@ declare module 'ethers/wallet/signing-key' {
|
|||||||
readonly path: string;
|
readonly path: string;
|
||||||
constructor(privateKey: Arrayish | HDNode);
|
constructor(privateKey: Arrayish | HDNode);
|
||||||
signDigest(digest: Arrayish): Signature;
|
signDigest(digest: Arrayish): Signature;
|
||||||
|
static isSigningKey(value: any): value is SigningKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
dist/types/_version.d.ts
vendored
2
dist/types/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
|||||||
export declare const version = "4.0.0-beta.3";
|
export declare const version = "4.0.0-beta.4";
|
||||||
//# sourceMappingURL=_version.d.ts.map
|
//# sourceMappingURL=_version.d.ts.map
|
17
dist/types/bin/cli.d.ts
vendored
Normal file
17
dist/types/bin/cli.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { ethers } from '../';
|
||||||
|
export interface Opts {
|
||||||
|
args: Array<string>;
|
||||||
|
accounts: Array<ethers.types.Signer>;
|
||||||
|
options: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
network: ethers.types.Network;
|
||||||
|
provider: ethers.providers.Provider;
|
||||||
|
}
|
||||||
|
export declare type OptionFunc = (value: string, opts: Opts) => any;
|
||||||
|
export declare type OptionType = OptionFunc | string | number | boolean;
|
||||||
|
export declare type Options = {
|
||||||
|
[key: string]: Array<OptionType> | OptionType;
|
||||||
|
};
|
||||||
|
export declare function getopts(options: Options, argv?: Array<string>): Promise<Opts>;
|
||||||
|
//# sourceMappingURL=cli.d.ts.map
|
2
dist/types/bin/ethers.d.ts
vendored
Normal file
2
dist/types/bin/ethers.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export {};
|
||||||
|
//# sourceMappingURL=ethers.d.ts.map
|
1
dist/types/contracts/interface.d.ts
vendored
1
dist/types/contracts/interface.d.ts
vendored
@ -17,5 +17,6 @@ export declare class Interface {
|
|||||||
topics: Array<string>;
|
topics: Array<string>;
|
||||||
data: string;
|
data: string;
|
||||||
}): _LogDescription;
|
}): _LogDescription;
|
||||||
|
static isInterface(value: any): value is Interface;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=interface.d.ts.map
|
//# sourceMappingURL=interface.d.ts.map
|
1
dist/types/ethers.d.ts
vendored
1
dist/types/ethers.d.ts
vendored
@ -15,6 +15,7 @@ declare const constants: {
|
|||||||
One: utils.types.BigNumber;
|
One: utils.types.BigNumber;
|
||||||
Two: utils.types.BigNumber;
|
Two: utils.types.BigNumber;
|
||||||
WeiPerEther: utils.types.BigNumber;
|
WeiPerEther: utils.types.BigNumber;
|
||||||
|
ConstantMaxUint256: utils.types.BigNumber;
|
||||||
};
|
};
|
||||||
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
|
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version };
|
||||||
//# sourceMappingURL=ethers.d.ts.map
|
//# sourceMappingURL=ethers.d.ts.map
|
1
dist/types/utils/bignumber.d.ts
vendored
1
dist/types/utils/bignumber.d.ts
vendored
@ -5,4 +5,5 @@ export declare const ConstantZero: _BigNumber;
|
|||||||
export declare const ConstantOne: _BigNumber;
|
export declare const ConstantOne: _BigNumber;
|
||||||
export declare const ConstantTwo: _BigNumber;
|
export declare const ConstantTwo: _BigNumber;
|
||||||
export declare const ConstantWeiPerEther: _BigNumber;
|
export declare const ConstantWeiPerEther: _BigNumber;
|
||||||
|
export declare const ConstantMaxUint256: _BigNumber;
|
||||||
//# sourceMappingURL=bignumber.d.ts.map
|
//# sourceMappingURL=bignumber.d.ts.map
|
1
dist/types/utils/index.d.ts
vendored
1
dist/types/utils/index.d.ts
vendored
@ -28,6 +28,7 @@ declare const constants: {
|
|||||||
One: types.BigNumber;
|
One: types.BigNumber;
|
||||||
Two: types.BigNumber;
|
Two: types.BigNumber;
|
||||||
WeiPerEther: types.BigNumber;
|
WeiPerEther: types.BigNumber;
|
||||||
|
ConstantMaxUint256: types.BigNumber;
|
||||||
};
|
};
|
||||||
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
|
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, types, RLP, fetchJson, getNetwork, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, hexlify, hexStripZeros, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, formatEther, parseEther, formatUnits, parseUnits, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computePublicKey, verifyMessage, errors };
|
||||||
//# sourceMappingURL=index.d.ts.map
|
//# sourceMappingURL=index.d.ts.map
|
2
dist/types/utils/properties.d.ts
vendored
2
dist/types/utils/properties.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
export declare function defineReadOnly(object: any, name: string, value: any): void;
|
export declare function defineReadOnly(object: any, name: string, value: any): void;
|
||||||
export declare function defineFrozen(object: any, name: string, value: any): void;
|
export declare function defineFrozen(object: any, name: string, value: any): void;
|
||||||
|
export declare function setType(object: any, type: string): void;
|
||||||
|
export declare function isType(object: any, type: string): boolean;
|
||||||
export declare function resolveProperties(object: any): Promise<any>;
|
export declare function resolveProperties(object: any): Promise<any>;
|
||||||
export declare function shallowCopy(object: any): any;
|
export declare function shallowCopy(object: any): any;
|
||||||
export declare function jsonCopy(object: any): any;
|
export declare function jsonCopy(object: any): any;
|
||||||
|
22
dist/types/utils/types.d.ts
vendored
22
dist/types/utils/types.d.ts
vendored
@ -18,6 +18,8 @@ export declare abstract class BigNumber {
|
|||||||
abstract toNumber(): number;
|
abstract toNumber(): number;
|
||||||
abstract toString(): string;
|
abstract toString(): string;
|
||||||
abstract toHexString(): string;
|
abstract toHexString(): string;
|
||||||
|
constructor();
|
||||||
|
static isBigNumber(value: any): value is BigNumber;
|
||||||
}
|
}
|
||||||
export declare type BigNumberish = BigNumber | string | number | Arrayish;
|
export declare type BigNumberish = BigNumber | string | number | Arrayish;
|
||||||
export declare type ConnectionInfo = {
|
export declare type ConnectionInfo = {
|
||||||
@ -160,6 +162,8 @@ export interface TransactionResponse extends Transaction {
|
|||||||
}
|
}
|
||||||
export declare abstract class Indexed {
|
export declare abstract class Indexed {
|
||||||
readonly hash: string;
|
readonly hash: string;
|
||||||
|
constructor();
|
||||||
|
static isIndexed(value: any): value is Indexed;
|
||||||
}
|
}
|
||||||
export interface DeployDescription {
|
export interface DeployDescription {
|
||||||
readonly inputs: Array<ParamType>;
|
readonly inputs: Array<ParamType>;
|
||||||
@ -217,12 +221,6 @@ export interface Event extends Log {
|
|||||||
}
|
}
|
||||||
export declare type EventType = string | Array<string> | Filter;
|
export declare type EventType = string | Array<string> | Filter;
|
||||||
export declare type Listener = (...args: Array<any>) => void;
|
export declare type Listener = (...args: Array<any>) => void;
|
||||||
/**
|
|
||||||
* Provider
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Provider.
|
|
||||||
*/
|
|
||||||
export declare abstract class MinimalProvider implements OnceBlockable {
|
export declare abstract class MinimalProvider implements OnceBlockable {
|
||||||
abstract getNetwork(): Promise<Network>;
|
abstract getNetwork(): Promise<Network>;
|
||||||
abstract getBlockNumber(): Promise<number>;
|
abstract getBlockNumber(): Promise<number>;
|
||||||
@ -247,6 +245,8 @@ export declare abstract class MinimalProvider implements OnceBlockable {
|
|||||||
abstract removeAllListeners(eventName: EventType): MinimalProvider;
|
abstract removeAllListeners(eventName: EventType): MinimalProvider;
|
||||||
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
|
abstract removeListener(eventName: EventType, listener: Listener): MinimalProvider;
|
||||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||||
|
constructor();
|
||||||
|
static isProvider(value: any): value is MinimalProvider;
|
||||||
}
|
}
|
||||||
export declare type AsyncProvider = {
|
export declare type AsyncProvider = {
|
||||||
isMetaMask?: boolean;
|
isMetaMask?: boolean;
|
||||||
@ -269,17 +269,13 @@ export declare type EncryptOptions = {
|
|||||||
p?: number;
|
p?: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/**
|
|
||||||
* Signer
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Signer.
|
|
||||||
*/
|
|
||||||
export declare abstract class Signer {
|
export declare abstract class Signer {
|
||||||
provider?: MinimalProvider;
|
provider?: MinimalProvider;
|
||||||
abstract getAddress(): Promise<string>;
|
abstract getAddress(): Promise<string>;
|
||||||
abstract signMessage(message: Arrayish | string): Promise<string>;
|
abstract signMessage(message: Arrayish | string): Promise<string>;
|
||||||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||||
|
constructor();
|
||||||
|
static isSigner(value: any): value is Signer;
|
||||||
}
|
}
|
||||||
export declare abstract class HDNode {
|
export declare abstract class HDNode {
|
||||||
readonly privateKey: string;
|
readonly privateKey: string;
|
||||||
@ -290,6 +286,8 @@ export declare abstract class HDNode {
|
|||||||
readonly index: number;
|
readonly index: number;
|
||||||
readonly depth: number;
|
readonly depth: number;
|
||||||
abstract derivePath(path: string): HDNode;
|
abstract derivePath(path: string): HDNode;
|
||||||
|
constructor();
|
||||||
|
static isHDNode(value: any): value is HDNode;
|
||||||
}
|
}
|
||||||
export interface Wordlist {
|
export interface Wordlist {
|
||||||
locale: string;
|
locale: string;
|
||||||
|
1
dist/types/wallet/signing-key.d.ts
vendored
1
dist/types/wallet/signing-key.d.ts
vendored
@ -8,5 +8,6 @@ export declare class SigningKey {
|
|||||||
private readonly keyPair;
|
private readonly keyPair;
|
||||||
constructor(privateKey: Arrayish | HDNode);
|
constructor(privateKey: Arrayish | HDNode);
|
||||||
signDigest(digest: Arrayish): Signature;
|
signDigest(digest: Arrayish): Signature;
|
||||||
|
static isSigningKey(value: any): value is SigningKey;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=signing-key.d.ts.map
|
//# sourceMappingURL=signing-key.d.ts.map
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "4.0.0-beta.3",
|
"version": "4.0.0-beta.4",
|
||||||
"description": "Ethereum wallet library.",
|
"description": "Ethereum wallet library.",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"types": "./dist/types/",
|
"types": "./dist/types/",
|
||||||
@ -13,8 +13,8 @@
|
|||||||
"dist-version": "node -e \"let v = require('./package.json').version; require('fs').writeFileSync('./src.ts/_version.ts', 'export const version = \\\"' + v +'\\\";\\n')\"",
|
"dist-version": "node -e \"let v = require('./package.json').version; require('fs').writeFileSync('./src.ts/_version.ts', 'export const version = \\\"' + v +'\\\";\\n')\"",
|
||||||
"eslint": "eslint index.js contracts/*.js providers/*.js utils/*.js wallet/*.js wordlists/*.js",
|
"eslint": "eslint index.js contracts/*.js providers/*.js utils/*.js wallet/*.js wordlists/*.js",
|
||||||
"test": "if [ \"$RUN_PHANTOMJS\" = \"1\" ]; then npm run-script test-phantomjs; else npm run-script test-node; fi",
|
"test": "if [ \"$RUN_PHANTOMJS\" = \"1\" ]; then npm run-script test-phantomjs; else npm run-script test-node; fi",
|
||||||
"test-node": "mocha tests/test-*.js",
|
"test-node": "npm run dist && mocha tests/test-*.js",
|
||||||
"test-phantomjs": "gulp minified tests && phantomjs --web-security=false ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js ./tests/test.html",
|
"test-phantomjs": "npm run dist && gulp tests && phantomjs --web-security=false ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js ./tests/test.html",
|
||||||
"version": "npm dist"
|
"version": "npm dist"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version = "4.0.0-beta.3";
|
export const version = "4.0.0-beta.4";
|
||||||
|
@ -342,8 +342,20 @@ var CoderNumber = /** @class */ (function (_super) {
|
|||||||
CoderNumber.prototype.encode = function (value) {
|
CoderNumber.prototype.encode = function (value) {
|
||||||
try {
|
try {
|
||||||
var v = bignumber_1.bigNumberify(value);
|
var v = bignumber_1.bigNumberify(value);
|
||||||
|
if (this.signed) {
|
||||||
|
var bounds = bignumber_1.ConstantMaxUint256.maskn(this.size * 8 - 1);
|
||||||
|
if (v.gt(bounds)) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
|
bounds = bounds.add(bignumber_1.ConstantOne).mul(bignumber_1.ConstantNegativeOne);
|
||||||
|
if (v.lt(bounds)) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (v.lt(bignumber_1.ConstantZero) || v.gt(bignumber_1.ConstantMaxUint256.maskn(this.size * 8))) {
|
||||||
|
throw new Error('out-of-bounds');
|
||||||
|
}
|
||||||
v = v.toTwos(this.size * 8).maskn(this.size * 8);
|
v = v.toTwos(this.size * 8).maskn(this.size * 8);
|
||||||
//value = value.toTwos(size * 8).maskn(size * 8);
|
|
||||||
if (this.signed) {
|
if (this.signed) {
|
||||||
v = v.fromTwos(this.size * 8).toTwos(256);
|
v = v.fromTwos(this.size * 8).toTwos(256);
|
||||||
}
|
}
|
||||||
@ -424,8 +436,8 @@ var CoderFixedBytes = /** @class */ (function (_super) {
|
|||||||
var result = new Uint8Array(32);
|
var result = new Uint8Array(32);
|
||||||
try {
|
try {
|
||||||
var data = bytes_1.arrayify(value);
|
var data = bytes_1.arrayify(value);
|
||||||
if (data.length > 32) {
|
if (data.length !== this.length) {
|
||||||
throw new Error();
|
throw new Error('incorrect data length');
|
||||||
}
|
}
|
||||||
result.set(data);
|
result.set(data);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ var BigNumber = /** @class */ (function (_super) {
|
|||||||
return BigNumber;
|
return BigNumber;
|
||||||
}(types_1.BigNumber));
|
}(types_1.BigNumber));
|
||||||
function bigNumberify(value) {
|
function bigNumberify(value) {
|
||||||
if (value instanceof BigNumber) {
|
if (BigNumber.isBigNumber(value)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return new BigNumber(value);
|
return new BigNumber(value);
|
||||||
@ -190,3 +190,4 @@ exports.ConstantZero = bigNumberify(0);
|
|||||||
exports.ConstantOne = bigNumberify(1);
|
exports.ConstantOne = bigNumberify(1);
|
||||||
exports.ConstantTwo = bigNumberify(2);
|
exports.ConstantTwo = bigNumberify(2);
|
||||||
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000');
|
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000');
|
||||||
|
exports.ConstantMaxUint256 = bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
|
||||||
|
@ -8,9 +8,6 @@ var types_1 = require("./types");
|
|||||||
var errors = require("./errors");
|
var errors = require("./errors");
|
||||||
exports.AddressZero = '0x0000000000000000000000000000000000000000';
|
exports.AddressZero = '0x0000000000000000000000000000000000000000';
|
||||||
exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||||
function isBigNumber(value) {
|
|
||||||
return (value instanceof types_1.BigNumber);
|
|
||||||
}
|
|
||||||
function addSlice(array) {
|
function addSlice(array) {
|
||||||
if (array.slice) {
|
if (array.slice) {
|
||||||
return array;
|
return array;
|
||||||
@ -38,7 +35,7 @@ function arrayify(value) {
|
|||||||
if (value == null) {
|
if (value == null) {
|
||||||
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||||
}
|
}
|
||||||
if (isBigNumber(value)) {
|
if (types_1.BigNumber.isBigNumber(value)) {
|
||||||
value = value.toHexString();
|
value = value.toHexString();
|
||||||
}
|
}
|
||||||
if (typeof (value) === 'string') {
|
if (typeof (value) === 'string') {
|
||||||
@ -124,7 +121,7 @@ function isHexString(value, length) {
|
|||||||
exports.isHexString = isHexString;
|
exports.isHexString = isHexString;
|
||||||
var HexCharacters = '0123456789abcdef';
|
var HexCharacters = '0123456789abcdef';
|
||||||
function hexlify(value) {
|
function hexlify(value) {
|
||||||
if (isBigNumber(value)) {
|
if (types_1.BigNumber.isBigNumber(value)) {
|
||||||
return value.toHexString();
|
return value.toHexString();
|
||||||
}
|
}
|
||||||
if (typeof (value) === 'number') {
|
if (typeof (value) === 'number') {
|
||||||
|
@ -93,6 +93,7 @@ var constants = {
|
|||||||
Zero: bignumber_1.ConstantZero,
|
Zero: bignumber_1.ConstantZero,
|
||||||
One: bignumber_1.ConstantOne,
|
One: bignumber_1.ConstantOne,
|
||||||
Two: bignumber_1.ConstantTwo,
|
Two: bignumber_1.ConstantTwo,
|
||||||
WeiPerEther: bignumber_1.ConstantWeiPerEther
|
WeiPerEther: bignumber_1.ConstantWeiPerEther,
|
||||||
|
ConstantMaxUint256: bignumber_1.ConstantMaxUint256
|
||||||
};
|
};
|
||||||
exports.constants = constants;
|
exports.constants = constants;
|
||||||
|
@ -16,6 +16,16 @@ function defineFrozen(object, name, value) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.defineFrozen = defineFrozen;
|
exports.defineFrozen = defineFrozen;
|
||||||
|
// There are some issues with instanceof with npm link, so we use this
|
||||||
|
// to ensure types are what we expect.
|
||||||
|
function setType(object, type) {
|
||||||
|
Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });
|
||||||
|
}
|
||||||
|
exports.setType = setType;
|
||||||
|
function isType(object, type) {
|
||||||
|
return (object._ethersType === type);
|
||||||
|
}
|
||||||
|
exports.isType = isType;
|
||||||
function resolveProperties(object) {
|
function resolveProperties(object) {
|
||||||
var result = {};
|
var result = {};
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
@ -2,11 +2,21 @@
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Bytes
|
// Bytes
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
function setType(object, type) {
|
||||||
|
Object.defineProperty(object, '_ethersType', { configurable: false, value: type, writable: false });
|
||||||
|
}
|
||||||
|
function isType(object, type) {
|
||||||
|
return (object._ethersType === type);
|
||||||
|
}
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// BigNumber
|
// BigNumber
|
||||||
var BigNumber = /** @class */ (function () {
|
var BigNumber = /** @class */ (function () {
|
||||||
function BigNumber() {
|
function BigNumber() {
|
||||||
|
setType(this, 'BigNumber');
|
||||||
}
|
}
|
||||||
|
BigNumber.isBigNumber = function (value) {
|
||||||
|
return isType(value, 'BigNumber');
|
||||||
|
};
|
||||||
return BigNumber;
|
return BigNumber;
|
||||||
}());
|
}());
|
||||||
exports.BigNumber = BigNumber;
|
exports.BigNumber = BigNumber;
|
||||||
@ -17,31 +27,31 @@ exports.BigNumber = BigNumber;
|
|||||||
// Interface
|
// Interface
|
||||||
var Indexed = /** @class */ (function () {
|
var Indexed = /** @class */ (function () {
|
||||||
function Indexed() {
|
function Indexed() {
|
||||||
|
setType(this, 'Indexed');
|
||||||
}
|
}
|
||||||
|
Indexed.isIndexed = function (value) {
|
||||||
|
return isType(value, 'Indexed');
|
||||||
|
};
|
||||||
return Indexed;
|
return Indexed;
|
||||||
}());
|
}());
|
||||||
exports.Indexed = Indexed;
|
exports.Indexed = Indexed;
|
||||||
/**
|
|
||||||
* Provider
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Provider.
|
|
||||||
*/
|
|
||||||
var MinimalProvider = /** @class */ (function () {
|
var MinimalProvider = /** @class */ (function () {
|
||||||
function MinimalProvider() {
|
function MinimalProvider() {
|
||||||
|
setType(this, 'Provider');
|
||||||
}
|
}
|
||||||
|
MinimalProvider.isProvider = function (value) {
|
||||||
|
return isType(value, 'Provider');
|
||||||
|
};
|
||||||
return MinimalProvider;
|
return MinimalProvider;
|
||||||
}());
|
}());
|
||||||
exports.MinimalProvider = MinimalProvider;
|
exports.MinimalProvider = MinimalProvider;
|
||||||
/**
|
|
||||||
* Signer
|
|
||||||
*
|
|
||||||
* Note: We use an abstract class so we can use instanceof to determine if an
|
|
||||||
* object is a Signer.
|
|
||||||
*/
|
|
||||||
var Signer = /** @class */ (function () {
|
var Signer = /** @class */ (function () {
|
||||||
function Signer() {
|
function Signer() {
|
||||||
|
setType(this, 'Signer');
|
||||||
}
|
}
|
||||||
|
Signer.isSigner = function (value) {
|
||||||
|
return isType(value, 'Signer');
|
||||||
|
};
|
||||||
return Signer;
|
return Signer;
|
||||||
}());
|
}());
|
||||||
exports.Signer = Signer;
|
exports.Signer = Signer;
|
||||||
@ -49,7 +59,11 @@ exports.Signer = Signer;
|
|||||||
// HDNode
|
// HDNode
|
||||||
var HDNode = /** @class */ (function () {
|
var HDNode = /** @class */ (function () {
|
||||||
function HDNode() {
|
function HDNode() {
|
||||||
|
setType(this, 'HDNode');
|
||||||
}
|
}
|
||||||
|
HDNode.isHDNode = function (value) {
|
||||||
|
return isType(value, 'HDNode');
|
||||||
|
};
|
||||||
return HDNode;
|
return HDNode;
|
||||||
}());
|
}());
|
||||||
exports.HDNode = HDNode;
|
exports.HDNode = HDNode;
|
||||||
|
@ -241,7 +241,7 @@ function encrypt(privateKey, password, options, progressCallback) {
|
|||||||
}
|
}
|
||||||
// Check the private key
|
// Check the private key
|
||||||
var privateKeyBytes = null;
|
var privateKeyBytes = null;
|
||||||
if (privateKey instanceof signing_key_1.SigningKey) {
|
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||||
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -14,7 +14,7 @@ var SigningKey = /** @class */ (function () {
|
|||||||
function SigningKey(privateKey) {
|
function SigningKey(privateKey) {
|
||||||
errors.checkNew(this, SigningKey);
|
errors.checkNew(this, SigningKey);
|
||||||
var privateKeyBytes = null;
|
var privateKeyBytes = null;
|
||||||
if (privateKey instanceof types_1.HDNode) {
|
if (types_1.HDNode.isHDNode(privateKey)) {
|
||||||
properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);
|
properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic);
|
||||||
properties_1.defineReadOnly(this, 'path', privateKey.path);
|
properties_1.defineReadOnly(this, 'path', privateKey.path);
|
||||||
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey);
|
||||||
@ -45,10 +45,14 @@ var SigningKey = /** @class */ (function () {
|
|||||||
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
|
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
|
||||||
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
|
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
|
||||||
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
|
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
|
||||||
|
properties_1.setType(this, 'SigningKey');
|
||||||
}
|
}
|
||||||
SigningKey.prototype.signDigest = function (digest) {
|
SigningKey.prototype.signDigest = function (digest) {
|
||||||
return this.keyPair.sign(digest);
|
return this.keyPair.sign(digest);
|
||||||
};
|
};
|
||||||
|
SigningKey.isSigningKey = function (value) {
|
||||||
|
return properties_1.isType(value, 'SigningKey');
|
||||||
|
};
|
||||||
return SigningKey;
|
return SigningKey;
|
||||||
}());
|
}());
|
||||||
exports.SigningKey = SigningKey;
|
exports.SigningKey = SigningKey;
|
||||||
|
@ -35,7 +35,7 @@ var Wallet = /** @class */ (function (_super) {
|
|||||||
var _this = _super.call(this) || this;
|
var _this = _super.call(this) || this;
|
||||||
errors.checkNew(_this, Wallet);
|
errors.checkNew(_this, Wallet);
|
||||||
// Make sure we have a valid signing key
|
// Make sure we have a valid signing key
|
||||||
if (privateKey instanceof signing_key_1.SigningKey) {
|
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||||
properties_1.defineReadOnly(_this, 'signingKey', privateKey);
|
properties_1.defineReadOnly(_this, 'signingKey', privateKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -68,7 +68,7 @@ var Wallet = /** @class */ (function (_super) {
|
|||||||
* Create a new instance of this Wallet connected to provider.
|
* Create a new instance of this Wallet connected to provider.
|
||||||
*/
|
*/
|
||||||
Wallet.prototype.connect = function (provider) {
|
Wallet.prototype.connect = function (provider) {
|
||||||
if (!(provider instanceof types_1.MinimalProvider)) {
|
if (!(types_1.MinimalProvider.isProvider(provider))) {
|
||||||
errors.throwError('invalid provider', errors.INVALID_ARGUMENT, { argument: 'provider', value: provider });
|
errors.throwError('invalid provider', errors.INVALID_ARGUMENT, { argument: 'provider', value: provider });
|
||||||
}
|
}
|
||||||
return new Wallet(this.signingKey, provider);
|
return new Wallet(this.signingKey, provider);
|
||||||
|
Loading…
Reference in New Issue
Block a user