Updated dist files.

This commit is contained in:
Richard Moore 2018-07-12 20:14:04 -04:00
parent d6260ae11a
commit 3f9f0e02e5
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
13 changed files with 614 additions and 549 deletions

763
dist/ethers.d.ts vendored

@ -1,22 +1,22 @@
// Generated by dts-bundle v0.7.3
declare module 'ethers' {
import utils from 'ethers/utils';
import { Contract, Interface } from 'ethers/contracts';
import * as providers from 'ethers/providers';
import providers from 'ethers/providers';
import * as errors from 'ethers/utils/errors';
import { getNetwork } from 'ethers/providers/networks';
import * as utils from 'ethers/utils';
import { HDNode, SigningKey, Wallet } from 'ethers/wallet';
import * as wordlists from 'ethers/wordlists';
import { version } from 'ethers/_version';
const constants: {
AddressZero: string;
HashZero: string;
NegativeOne: utils.BigNumber;
Zero: utils.BigNumber;
One: utils.BigNumber;
Two: utils.BigNumber;
WeiPerEther: utils.BigNumber;
NegativeOne: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Zero: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
One: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Two: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
WeiPerEther: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
};
export { Wallet, HDNode, SigningKey, Contract, Interface, getNetwork, providers, errors, constants, utils, wordlists, version };
const _default: {
@ -26,24 +26,176 @@ declare module 'ethers' {
Contract: typeof Contract;
Interface: typeof Interface;
getNetwork: typeof getNetwork;
providers: typeof providers;
providers: {
Provider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/provider").Provider;
getDefaultProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers").getDefaultProvider;
FallbackProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/fallback-provider").FallbackProvider;
EtherscanProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/etherscan-provider").EtherscanProvider;
InfuraProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/infura-provider").InfuraProvider;
JsonRpcProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/json-rpc-provider").JsonRpcProvider;
Web3Provider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/web3-provider").Web3Provider;
IpcProvider: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/providers/ipc-provider").IpcProvider;
};
errors: typeof errors;
constants: {
AddressZero: string;
HashZero: string;
NegativeOne: utils.BigNumber;
Zero: utils.BigNumber;
One: utils.BigNumber;
Two: utils.BigNumber;
WeiPerEther: utils.BigNumber;
NegativeOne: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Zero: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
One: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Two: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
WeiPerEther: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
};
utils: {
AbiCoder: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/abi-coder").AbiCoder;
defaultAbiCoder: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/abi-coder").AbiCoder;
parseSignature: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/abi-coder").parseSignature;
parseParamType: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/abi-coder").parseParamType;
constants: {
AddressZero: string;
HashZero: string;
NegativeOne: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Zero: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
One: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
Two: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
WeiPerEther: import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").BigNumber;
};
RLP: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/rlp");
fetchJson: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/web").fetchJson;
defineReadOnly: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/properties").defineReadOnly;
defineFrozen: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/properties").defineFrozen;
resolveProperties: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/properties").resolveProperties;
shallowCopy: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/properties").shallowCopy;
etherSymbol: string;
arrayify: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").arrayify;
concat: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").concat;
padZeros: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").padZeros;
stripZeros: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").stripZeros;
base64: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/base64");
bigNumberify: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bignumber").bigNumberify;
hexlify: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").hexlify;
hexStripZeros: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").hexStripZeros;
hexZeroPad: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").hexZeroPad;
hexDataLength: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").hexDataLength;
hexDataSlice: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").hexDataSlice;
toUtf8Bytes: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/utf8").toUtf8Bytes;
toUtf8String: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/utf8").toUtf8String;
hashMessage: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/hash").hashMessage;
namehash: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/hash").namehash;
id: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/hash").id;
getAddress: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/address").getAddress;
getIcapAddress: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/address").getIcapAddress;
getContractAddress: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/address").getContractAddress;
formatEther: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/units").formatEther;
parseEther: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/units").parseEther;
formatUnits: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/units").formatUnits;
parseUnits: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/units").parseUnits;
keccak256: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/keccak256").keccak256;
sha256: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/sha2").sha256;
randomBytes: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/random-bytes").randomBytes;
solidityPack: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/solidity").pack;
solidityKeccak256: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/solidity").keccak256;
soliditySha256: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/solidity").sha256;
splitSignature: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").splitSignature;
joinSignature: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/bytes").joinSignature;
parseTransaction: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/transaction").parse;
serializeTransaction: typeof import("../../../../../../../Users/ricmoo/Development/ethers/ethers.ts/ethers.js/src.ts/utils/transaction").serialize;
errors: typeof errors;
};
utils: typeof utils;
wordlists: typeof wordlists;
version: string;
};
export default _default;
}
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 { BigNumber, 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 { 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 { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from 'ethers/utils/properties';
import * as RLP from 'ethers/utils/rlp';
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 errors from 'ethers/utils/errors';
const etherSymbol = "\u039E";
const constants: {
AddressZero: string;
HashZero: string;
NegativeOne: BigNumber;
Zero: BigNumber;
One: BigNumber;
Two: BigNumber;
WeiPerEther: BigNumber;
};
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, RLP, fetchJson, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, BigNumber, 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, errors };
const _default: {
AbiCoder: typeof AbiCoder;
defaultAbiCoder: AbiCoder;
parseSignature: typeof parseSignature;
parseParamType: typeof parseParamType;
constants: {
AddressZero: string;
HashZero: string;
NegativeOne: BigNumber;
Zero: BigNumber;
One: BigNumber;
Two: BigNumber;
WeiPerEther: BigNumber;
};
RLP: typeof RLP;
fetchJson: typeof fetchJson;
defineReadOnly: typeof defineReadOnly;
defineFrozen: typeof defineFrozen;
resolveProperties: typeof resolveProperties;
shallowCopy: typeof shallowCopy;
etherSymbol: string;
arrayify: typeof arrayify;
concat: typeof concat;
padZeros: typeof padZeros;
stripZeros: typeof stripZeros;
base64: typeof base64;
bigNumberify: typeof bigNumberify;
hexlify: typeof hexlify;
hexStripZeros: typeof hexStripZeros;
hexZeroPad: typeof hexZeroPad;
hexDataLength: typeof hexDataLength;
hexDataSlice: typeof hexDataSlice;
toUtf8Bytes: typeof toUtf8Bytes;
toUtf8String: typeof toUtf8String;
hashMessage: typeof hashMessage;
namehash: typeof namehash;
id: typeof id;
getAddress: typeof getAddress;
getIcapAddress: typeof getIcapAddress;
getContractAddress: typeof getContractAddress;
formatEther: typeof formatEther;
parseEther: typeof parseEther;
formatUnits: typeof formatUnits;
parseUnits: typeof parseUnits;
keccak256: typeof keccak256;
sha256: typeof sha256;
randomBytes: typeof randomBytes;
solidityPack: typeof solidityPack;
solidityKeccak256: typeof solidityKeccak256;
soliditySha256: typeof soliditySha256;
splitSignature: typeof splitSignature;
joinSignature: typeof joinSignature;
parseTransaction: typeof parseTransaction;
serializeTransaction: typeof serializeTransaction;
errors: typeof errors;
};
export default _default;
}
declare module 'ethers/contracts' {
import { Contract } from 'ethers/contracts/contract';
import { Interface } from 'ethers/contracts/interface';
@ -111,95 +263,6 @@ declare module 'ethers/providers/networks' {
export function getNetwork(network: Networkish): Network;
}
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 { BigNumber, 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 { 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 { defineFrozen, defineReadOnly, resolveProperties, shallowCopy } from 'ethers/utils/properties';
import * as RLP from 'ethers/utils/rlp';
import { toUtf8Bytes, toUtf8String } from 'ethers/utils/utf8';
import { formatEther, parseEther, formatUnits, parseUnits } from 'ethers/utils/units';
import { fetchJson } from 'ethers/utils/web';
import { parse as parseTransaction, serialize as serializeTransaction } from 'ethers/utils/transaction';
import * as errors from 'ethers/utils/errors';
const etherSymbol = "\u039E";
const constants: {
AddressZero: string;
HashZero: string;
NegativeOne: BigNumber;
Zero: BigNumber;
One: BigNumber;
Two: BigNumber;
WeiPerEther: BigNumber;
};
export { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType, constants, RLP, fetchJson, defineReadOnly, defineFrozen, resolveProperties, shallowCopy, etherSymbol, arrayify, concat, padZeros, stripZeros, base64, bigNumberify, BigNumber, 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, errors };
const _default: {
AbiCoder: typeof AbiCoder;
defaultAbiCoder: AbiCoder;
parseSignature: typeof parseSignature;
parseParamType: typeof parseParamType;
constants: {
AddressZero: string;
HashZero: string;
NegativeOne: BigNumber;
Zero: BigNumber;
One: BigNumber;
Two: BigNumber;
WeiPerEther: BigNumber;
};
RLP: typeof RLP;
fetchJson: typeof fetchJson;
defineReadOnly: typeof defineReadOnly;
defineFrozen: typeof defineFrozen;
resolveProperties: typeof resolveProperties;
shallowCopy: typeof shallowCopy;
etherSymbol: string;
arrayify: typeof arrayify;
concat: typeof concat;
padZeros: typeof padZeros;
stripZeros: typeof stripZeros;
base64: typeof base64;
bigNumberify: typeof bigNumberify;
BigNumber: typeof BigNumber;
hexlify: typeof hexlify;
hexStripZeros: typeof hexStripZeros;
hexZeroPad: typeof hexZeroPad;
hexDataLength: typeof hexDataLength;
hexDataSlice: typeof hexDataSlice;
toUtf8Bytes: typeof toUtf8Bytes;
toUtf8String: typeof toUtf8String;
hashMessage: typeof hashMessage;
namehash: typeof namehash;
id: typeof id;
getAddress: typeof getAddress;
getIcapAddress: typeof getIcapAddress;
getContractAddress: typeof getContractAddress;
formatEther: typeof formatEther;
parseEther: typeof parseEther;
formatUnits: typeof formatUnits;
parseUnits: typeof parseUnits;
keccak256: typeof keccak256;
sha256: typeof sha256;
randomBytes: typeof randomBytes;
solidityPack: typeof solidityPack;
solidityKeccak256: typeof solidityKeccak256;
soliditySha256: typeof soliditySha256;
splitSignature: typeof splitSignature;
joinSignature: typeof joinSignature;
parseTransaction: typeof parseTransaction;
serializeTransaction: typeof serializeTransaction;
errors: typeof errors;
};
export default _default;
}
declare module 'ethers/wallet' {
import { Wallet } from 'ethers/wallet/wallet';
import * as HDNode from 'ethers/wallet/hdnode';
@ -239,6 +302,238 @@ declare module 'ethers/_version' {
export const version = "4.0.0";
}
declare module 'ethers/utils/address' {
import { BigNumber } from 'ethers/utils/bignumber';
import { Arrayish } from 'ethers/utils/bytes';
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 } from 'ethers/utils/bytes';
export type CoerceFunc = (type: string, value: any) => any;
export type ParamType = {
name?: string;
type: string;
indexed?: boolean;
components?: Array<any>;
};
export const defaultCoerceFunc: CoerceFunc;
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 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/bytes';
export function decode(textData: string): Uint8Array;
export function encode(data: Arrayish): string;
}
declare module 'ethers/utils/bignumber' {
import { Arrayish } from 'ethers/utils/bytes';
export type BigNumberish = BigNumber | string | number | Arrayish;
export interface BigNumber {
fromTwos(value: number): BigNumber;
toTwos(value: number): BigNumber;
add(other: BigNumberish): BigNumber;
sub(other: BigNumberish): BigNumber;
div(other: BigNumberish): BigNumber;
mul(other: BigNumberish): BigNumber;
mod(other: BigNumberish): BigNumber;
pow(other: BigNumberish): BigNumber;
maskn(value: number): BigNumber;
eq(other: BigNumberish): boolean;
lt(other: BigNumberish): boolean;
lte(other: BigNumberish): boolean;
gt(other: BigNumberish): boolean;
gte(other: BigNumberish): boolean;
isZero(): boolean;
toNumber(): number;
toString(): string;
toHexString(): string;
}
export function isBigNumber(value: any): boolean;
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 { BigNumber } from 'ethers/utils/bignumber';
export const AddressZero = "0x0000000000000000000000000000000000000000";
export const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
export type Arrayish = string | ArrayLike<number>;
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 interface Signature {
r: string;
s: string;
recoveryParam: number;
v?: number;
}
export function splitSignature(signature: Arrayish | Signature): Signature;
export function joinSignature(signature: Signature): string;
}
declare module 'ethers/utils/hash' {
import { Arrayish } from 'ethers/utils/bytes';
export function namehash(name: string): string;
export function id(text: string): string;
export function hashMessage(message: Arrayish | string): string;
}
declare module 'ethers/utils/keccak256' {
import { Arrayish } from 'ethers/utils/bytes';
export function keccak256(data: Arrayish): string;
}
declare module 'ethers/utils/sha2' {
import { Arrayish } from 'ethers/utils/bytes';
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/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/bytes';
export function encode(object: any): string;
export function decode(data: Arrayish): any;
}
declare module 'ethers/utils/transaction' {
import { BigNumber, BigNumberish } from 'ethers/utils/bignumber';
import { Arrayish, Signature } from 'ethers/utils/bytes';
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 function serialize(transaction: UnsignedTransaction, signature?: Arrayish | Signature): string;
export function parse(rawTransaction: Arrayish): Transaction;
}
declare module 'ethers/utils/utf8' {
import { Arrayish } from 'ethers/utils/bytes';
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/bignumber';
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' {
export type ConnectionInfo = {
url: string;
user?: string;
password?: string;
allowInsecure?: boolean;
};
export type ProcessFunc = (value: any) => any;
export function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: ProcessFunc): Promise<any>;
export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}
export type PollOptions = {
timeout?: number;
floor?: number;
ceiling?: number;
interval?: number;
onceBlock?: OnceBlockable;
};
export function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
}
declare module 'ethers/contracts/contract' {
import { EventDescription, Interface } from 'ethers/contracts/interface';
import { Block, Log, Provider, TransactionReceipt, TransactionRequest, TransactionResponse } from 'ethers/providers/provider';
@ -605,235 +900,6 @@ declare module 'ethers/providers/web3-provider' {
}
}
declare module 'ethers/utils/address' {
import { BigNumber } from 'ethers/utils/bignumber';
import { Arrayish } from 'ethers/utils/bytes';
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 } from 'ethers/utils/bytes';
export type CoerceFunc = (type: string, value: any) => any;
export type ParamType = {
name?: string;
type: string;
indexed?: boolean;
components?: Array<any>;
};
export const defaultCoerceFunc: CoerceFunc;
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 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/bytes';
export function decode(textData: string): Uint8Array;
export function encode(data: Arrayish): string;
}
declare module 'ethers/utils/bignumber' {
import { Arrayish } from 'ethers/utils/bytes';
export type BigNumberish = BigNumber | string | number | Arrayish;
export class BigNumber {
constructor(value: BigNumberish);
fromTwos(value: number): BigNumber;
toTwos(value: number): BigNumber;
add(other: BigNumberish): BigNumber;
sub(other: BigNumberish): BigNumber;
div(other: BigNumberish): BigNumber;
mul(other: BigNumberish): BigNumber;
mod(other: BigNumberish): BigNumber;
pow(other: BigNumberish): BigNumber;
maskn(value: number): BigNumber;
eq(other: BigNumberish): boolean;
lt(other: BigNumberish): boolean;
lte(other: BigNumberish): boolean;
gt(other: BigNumberish): boolean;
gte(other: BigNumberish): boolean;
isZero(): boolean;
toNumber(): number;
toString(): string;
toHexString(): string;
}
export function isBigNumber(value: any): boolean;
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 { BigNumber } from 'ethers/utils/bignumber';
import { Signature } from 'ethers/utils/secp256k1';
export const AddressZero = "0x0000000000000000000000000000000000000000";
export const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
export type Arrayish = string | ArrayLike<number>;
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/bytes';
export function namehash(name: string): string;
export function id(text: string): string;
export function hashMessage(message: Arrayish | string): string;
}
declare module 'ethers/utils/keccak256' {
import { Arrayish } from 'ethers/utils/bytes';
export function keccak256(data: Arrayish): string;
}
declare module 'ethers/utils/sha2' {
import { Arrayish } from 'ethers/utils/bytes';
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/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/bytes';
export function encode(object: any): string;
export function decode(data: Arrayish): any;
}
declare module 'ethers/utils/utf8' {
import { Arrayish } from 'ethers/utils/bytes';
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/bignumber';
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' {
export type ConnectionInfo = {
url: string;
user?: string;
password?: string;
allowInsecure?: boolean;
};
export type ProcessFunc = (value: any) => any;
export function fetchJson(connection: string | ConnectionInfo, json: string, processFunc: ProcessFunc): Promise<any>;
export interface OnceBlockable {
once(eventName: "block", handler: () => void): void;
}
export type PollOptions = {
timeout?: number;
floor?: number;
ceiling?: number;
interval?: number;
onceBlock?: OnceBlockable;
};
export function poll(func: () => Promise<any>, options?: PollOptions): Promise<any>;
}
declare module 'ethers/utils/transaction' {
import { BigNumber, BigNumberish } from 'ethers/utils/bignumber';
import { Arrayish } from 'ethers/utils/bytes';
import { Signature } from 'ethers/utils/secp256k1';
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 function serialize(transaction: UnsignedTransaction, signature?: Arrayish | Signature): string;
export function parse(rawTransaction: Arrayish): Transaction;
}
declare module 'ethers/wallet/wallet' {
import { HDNode } from 'ethers/wallet/hdnode';
import { ProgressCallback } from 'ethers/wallet/secret-storage';
@ -914,9 +980,13 @@ declare module 'ethers/wallet/hdnode' {
}
declare module 'ethers/wallet/signing-key' {
import { Arrayish } from 'ethers/utils/bytes';
/**
* SigningKey
*
*
*/
import { Arrayish, Signature } from 'ethers/utils/bytes';
import { HDNode } from 'ethers/wallet/hdnode';
import { Signature } from 'ethers/utils/secp256k1';
export class SigningKey {
readonly privateKey: string;
readonly publicKey: string;
@ -926,8 +996,6 @@ declare module 'ethers/wallet/signing-key' {
constructor(privateKey: Arrayish | HDNode);
signDigest(digest: Arrayish): Signature;
}
export function recoverAddress(digest: Arrayish, signature: Signature): string;
export function computeAddress(key: string): string;
}
declare module 'ethers/wordlists/wordlist' {
@ -942,29 +1010,6 @@ declare module 'ethers/wordlists/wordlist' {
export function register(lang: Wordlist): void;
}
declare module 'ethers/utils/secp256k1' {
import { Arrayish } from 'ethers/utils/bytes';
export const N: string;
export interface Signature {
r: string;
s: string;
recoveryParam: number;
v?: number;
}
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;
}
declare module 'ethers/wallet/secret-storage' {
import { Arrayish } from 'ethers/utils/bytes';
import { SigningKey } from 'ethers/wallet/signing-key';

197
dist/ethers.js vendored

@ -12879,35 +12879,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
var bn_js_1 = __importDefault(require("bn.js"));
var bytes_1 = require("./bytes");
var properties_1 = require("./properties");
var errors = __importStar(require("../utils/errors"));
function _isBigNumber(value) {
return isBigNumber(value);
}
function fromBN(bn) {
var errors = __importStar(require("./errors"));
var BN_1 = new bn_js_1.default.BN(-1);
function toHex(bn) {
var value = bn.toString(16);
if (value[0] === '-') {
return new BigNumber("-0x" + value.substring(1));
if ((value.length % 2) === 0) {
return '-0x0' + value.substring(1);
}
return "-0x" + value.substring(1);
}
return new BigNumber('0x' + value);
if ((value.length % 2) === 1) {
return '0x0' + value;
}
return '0x' + value;
}
var BigNumber = /** @class */ (function () {
function BigNumber(value) {
errors.checkNew(this, BigNumber);
function toBN(value) {
return bigNumberify(value)._bn;
}
function toBigNumber(bn) {
return new _BigNumber(toHex(bn));
}
;
var _BigNumber = /** @class */ (function () {
function _BigNumber(value) {
errors.checkNew(this, _BigNumber);
if (typeof (value) === 'string') {
if (bytes_1.isHexString(value)) {
if (value == '0x') {
value = '0x0';
}
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value.substring(2), 16));
properties_1.defineReadOnly(this, '_hex', value);
}
else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {
properties_1.defineReadOnly(this, '_bn', (new bn_js_1.default.BN(value.substring(3), 16)).mul(exports.ConstantNegativeOne._bn));
properties_1.defineReadOnly(this, '_hex', value);
}
else if (value.match(/^-?[0-9]*$/)) {
if (value == '') {
value = '0';
}
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));
}
else {
errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
@ -12918,72 +12929,85 @@ var BigNumber = /** @class */ (function () {
errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: parseInt(String(value)) });
}
try {
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));
}
catch (error) {
errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });
}
}
else if (_isBigNumber(value)) {
properties_1.defineReadOnly(this, '_bn', value._bn);
else if (value instanceof _BigNumber) {
properties_1.defineReadOnly(this, '_hex', value.toHexString());
}
else if (value.toHexString) {
properties_1.defineReadOnly(this, '_hex', toHex(toBN(value.toHexString())));
}
else if (bytes_1.isArrayish(value)) {
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16)));
}
else {
errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
}
}
BigNumber.prototype.fromTwos = function (value) {
return fromBN(this._bn.fromTwos(value));
Object.defineProperty(_BigNumber.prototype, "_bn", {
get: function () {
if (this._hex[0] === '-') {
return (new bn_js_1.default.BN(this._hex.substring(3), 16)).mul(BN_1);
}
return new bn_js_1.default.BN(this._hex.substring(2), 16);
},
enumerable: true,
configurable: true
});
_BigNumber.prototype.fromTwos = function (value) {
return toBigNumber(this._bn.fromTwos(value));
};
BigNumber.prototype.toTwos = function (value) {
return fromBN(this._bn.toTwos(value));
_BigNumber.prototype.toTwos = function (value) {
return toBigNumber(this._bn.toTwos(value));
};
BigNumber.prototype.add = function (other) {
return fromBN(this._bn.add(bigNumberify(other)._bn));
_BigNumber.prototype.add = function (other) {
return toBigNumber(this._bn.add(toBN(other)));
};
BigNumber.prototype.sub = function (other) {
return fromBN(this._bn.sub(bigNumberify(other)._bn));
_BigNumber.prototype.sub = function (other) {
return toBigNumber(this._bn.sub(toBN(other)));
};
BigNumber.prototype.div = function (other) {
_BigNumber.prototype.div = function (other) {
var o = bigNumberify(other);
if (o.isZero()) {
errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });
}
return fromBN(this._bn.div(o._bn));
return toBigNumber(this._bn.div(toBN(other)));
};
BigNumber.prototype.mul = function (other) {
return fromBN(this._bn.mul(bigNumberify(other)._bn));
_BigNumber.prototype.mul = function (other) {
return toBigNumber(this._bn.mul(toBN(other)));
};
BigNumber.prototype.mod = function (other) {
return fromBN(this._bn.mod(bigNumberify(other)._bn));
_BigNumber.prototype.mod = function (other) {
return toBigNumber(this._bn.mod(toBN(other)));
};
BigNumber.prototype.pow = function (other) {
return fromBN(this._bn.pow(bigNumberify(other)._bn));
_BigNumber.prototype.pow = function (other) {
return toBigNumber(this._bn.pow(toBN(other)));
};
BigNumber.prototype.maskn = function (value) {
return fromBN(this._bn.maskn(value));
_BigNumber.prototype.maskn = function (value) {
return toBigNumber(this._bn.maskn(value));
};
BigNumber.prototype.eq = function (other) {
return this._bn.eq(bigNumberify(other)._bn);
_BigNumber.prototype.eq = function (other) {
return this._bn.eq(toBN(other));
};
BigNumber.prototype.lt = function (other) {
return this._bn.lt(bigNumberify(other)._bn);
_BigNumber.prototype.lt = function (other) {
return this._bn.lt(toBN(other));
};
BigNumber.prototype.lte = function (other) {
return this._bn.lte(bigNumberify(other)._bn);
_BigNumber.prototype.lte = function (other) {
return this._bn.lte(toBN(other));
};
BigNumber.prototype.gt = function (other) {
return this._bn.gt(bigNumberify(other)._bn);
_BigNumber.prototype.gt = function (other) {
return this._bn.gt(toBN(other));
};
BigNumber.prototype.gte = function (other) {
return this._bn.gte(bigNumberify(other)._bn);
_BigNumber.prototype.gte = function (other) {
return this._bn.gte(toBN(other));
};
BigNumber.prototype.isZero = function () {
_BigNumber.prototype.isZero = function () {
return this._bn.isZero();
};
BigNumber.prototype.toNumber = function () {
_BigNumber.prototype.toNumber = function () {
try {
return this._bn.toNumber();
}
@ -12992,28 +13016,23 @@ var BigNumber = /** @class */ (function () {
}
return null;
};
BigNumber.prototype.toString = function () {
_BigNumber.prototype.toString = function () {
return this._bn.toString(10);
};
BigNumber.prototype.toHexString = function () {
var hex = this._bn.toString(16);
if (hex.length % 2) {
hex = '0' + hex;
}
return '0x' + hex;
_BigNumber.prototype.toHexString = function () {
return this._hex;
};
return BigNumber;
return _BigNumber;
}());
exports.BigNumber = BigNumber;
function isBigNumber(value) {
return (value._bn && value._bn.mod);
return (value instanceof _BigNumber);
}
exports.isBigNumber = isBigNumber;
function bigNumberify(value) {
if (_isBigNumber(value)) {
if (value instanceof _BigNumber) {
return value;
}
return new BigNumber(value);
return new _BigNumber(value);
}
exports.bigNumberify = bigNumberify;
exports.ConstantNegativeOne = bigNumberify(-1);
@ -13022,7 +13041,7 @@ exports.ConstantOne = bigNumberify(1);
exports.ConstantTwo = bigNumberify(2);
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000');
},{"../utils/errors":62,"./bytes":61,"./properties":66,"bn.js":2}],61:[function(require,module,exports){
},{"./bytes":61,"./errors":62,"./properties":66,"bn.js":2}],61:[function(require,module,exports){
"use strict";
/**
* Conversion Utilities
@ -13243,9 +13262,13 @@ function splitSignature(signature) {
if (isSignature(signature)) {
r = hexZeroPad(signature.r, 32);
s = hexZeroPad(signature.s, 32);
v = signature.v;
if (typeof (v) === 'string') {
v = parseInt(v, 16);
}
var recoveryParam = signature.recoveryParam;
if (recoveryParam == null && signature.v != null) {
recoveryParam = 1 - (signature.v % 2);
recoveryParam = 1 - (v % 2);
}
v = 27 + recoveryParam;
}
@ -13451,7 +13474,6 @@ exports.parseParamType = abi_coder_1.parseParamType;
var base64 = __importStar(require("./base64"));
exports.base64 = base64;
var bignumber_1 = require("./bignumber");
exports.BigNumber = bignumber_1.BigNumber;
exports.bigNumberify = bignumber_1.bigNumberify;
var bytes_1 = require("./bytes");
exports.arrayify = bytes_1.arrayify;
@ -13486,6 +13508,9 @@ exports.resolveProperties = properties_1.resolveProperties;
exports.shallowCopy = properties_1.shallowCopy;
var RLP = __importStar(require("./rlp"));
exports.RLP = RLP;
var transaction_1 = require("./transaction");
exports.parseTransaction = transaction_1.parse;
exports.serializeTransaction = transaction_1.serialize;
var utf8_1 = require("./utf8");
exports.toUtf8Bytes = utf8_1.toUtf8Bytes;
exports.toUtf8String = utf8_1.toUtf8String;
@ -13496,9 +13521,6 @@ exports.formatUnits = units_1.formatUnits;
exports.parseUnits = units_1.parseUnits;
var web_1 = require("./web");
exports.fetchJson = web_1.fetchJson;
var transaction_1 = require("./transaction");
exports.parseTransaction = transaction_1.parse;
exports.serializeTransaction = transaction_1.serialize;
var errors = __importStar(require("./errors"));
exports.errors = errors;
// NFKD (decomposed)
@ -13535,7 +13557,6 @@ exports.default = {
stripZeros: bytes_1.stripZeros,
base64: base64,
bigNumberify: bignumber_1.bigNumberify,
BigNumber: bignumber_1.BigNumber,
hexlify: bytes_1.hexlify,
hexStripZeros: bytes_1.hexStripZeros,
hexZeroPad: bytes_1.hexZeroPad,
@ -13756,8 +13777,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var elliptic = __importStar(require("elliptic"));
var curve = new elliptic.ec('secp256k1');
var elliptic_1 = require("elliptic");
var curve = new elliptic_1.ec('secp256k1');
var address_1 = require("./address");
var bytes_1 = require("./bytes");
var keccak256_1 = require("./keccak256");
@ -13953,7 +13974,6 @@ var address_1 = require("./address");
var bignumber_1 = require("./bignumber");
var bytes_1 = require("./bytes");
var keccak256_1 = require("./keccak256");
var secp256k1_1 = require("./secp256k1");
var RLP = __importStar(require("./rlp"));
var errors = __importStar(require("./errors"));
function handleAddress(value) {
@ -14079,6 +14099,7 @@ function parse(rawTransaction) {
return tx;
}
exports.parse = parse;
var secp256k1_1 = require("./secp256k1");
},{"./address":59,"./bignumber":60,"./bytes":61,"./errors":62,"./keccak256":65,"./rlp":67,"./secp256k1":68}],72:[function(require,module,exports){
'use strict';
@ -15206,10 +15227,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
*
*
*/
var address_1 = require("../utils/address");
var bytes_1 = require("../utils/bytes");
var hdnode_1 = require("./hdnode");
var keccak256_1 = require("../utils/keccak256");
var properties_1 = require("../utils/properties");
var secp256k1_1 = require("../utils/secp256k1");
var errors = require("../utils/errors");
@ -15247,7 +15266,7 @@ var SigningKey = /** @class */ (function () {
properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(privateKeyBytes));
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
properties_1.defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
}
SigningKey.prototype.signDigest = function (digest) {
return this.keyPair.sign(digest);
@ -15255,18 +15274,8 @@ var SigningKey = /** @class */ (function () {
return SigningKey;
}());
exports.SigningKey = SigningKey;
function recoverAddress(digest, signature) {
return computeAddress(secp256k1_1.recoverPublicKey(digest, signature));
}
exports.recoverAddress = recoverAddress;
function computeAddress(key) {
// Strip off the leading "0x04"
var publicKey = '0x' + secp256k1_1.computePublicKey(key).slice(4);
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
}
exports.computeAddress = computeAddress;
},{"../utils/address":59,"../utils/bytes":61,"../utils/errors":62,"../utils/keccak256":65,"../utils/properties":66,"../utils/secp256k1":68,"./hdnode":75}],79:[function(require,module,exports){
},{"../utils/bytes":61,"../utils/errors":62,"../utils/properties":66,"../utils/secp256k1":68,"./hdnode":75}],79:[function(require,module,exports){
'use strict';
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
@ -15294,6 +15303,7 @@ var hash_1 = require("../utils/hash");
var keccak256_1 = require("../utils/keccak256");
var properties_1 = require("../utils/properties");
var random_bytes_1 = require("../utils/random-bytes");
var secp256k1_1 = require("../utils/secp256k1");
var transaction_1 = require("../utils/transaction");
var errors = __importStar(require("../utils/errors"));
var Signer = /** @class */ (function () {
@ -15478,7 +15488,7 @@ var Wallet = /** @class */ (function (_super) {
if (recoveryParam < 0) {
throw new Error('invalid signature');
}
return signing_key_1.recoverAddress(digest, {
return secp256k1_1.recoverAddress(digest, {
r: signature.substring(0, 66),
s: '0x' + signature.substring(66, 130),
recoveryParam: recoveryParam
@ -15488,7 +15498,7 @@ var Wallet = /** @class */ (function (_super) {
}(Signer));
exports.Wallet = Wallet;
},{"../utils/bytes":61,"../utils/errors":62,"../utils/hash":63,"../utils/keccak256":65,"../utils/properties":66,"../utils/random-bytes":44,"../utils/transaction":71,"./hdnode":75,"./secret-storage":77,"./signing-key":78}],80:[function(require,module,exports){
},{"../utils/bytes":61,"../utils/errors":62,"../utils/hash":63,"../utils/keccak256":65,"../utils/properties":66,"../utils/random-bytes":44,"../utils/secp256k1":68,"../utils/transaction":71,"./hdnode":75,"./secret-storage":77,"./signing-key":78}],80:[function(require,module,exports){
module.exports = { }
},{}],81:[function(require,module,exports){
'use strict';
@ -15568,6 +15578,9 @@ exportWordlist = true;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../utils/properties":66}],83:[function(require,module,exports){
'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
@ -15576,17 +15589,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = __importDefault(require("./utils"));
exports.utils = utils_1.default;
var contracts_1 = require("./contracts");
exports.Contract = contracts_1.Contract;
exports.Interface = contracts_1.Interface;
var providers = __importStar(require("./providers"));
exports.providers = providers;
var providers_1 = __importDefault(require("./providers"));
exports.providers = providers_1.default;
var errors = __importStar(require("./utils/errors"));
exports.errors = errors;
var networks_1 = require("./providers/networks");
exports.getNetwork = networks_1.getNetwork;
var utils = __importStar(require("./utils"));
exports.utils = utils;
var wallet_1 = require("./wallet");
exports.HDNode = wallet_1.HDNode;
exports.SigningKey = wallet_1.SigningKey;
@ -15595,7 +15608,7 @@ var wordlists = __importStar(require("./wordlists"));
exports.wordlists = wordlists;
var _version_1 = require("./_version");
exports.version = _version_1.version;
var constants = utils.constants;
var constants = utils_1.default.constants;
exports.constants = constants;
exports.default = {
Wallet: wallet_1.Wallet,
@ -15604,10 +15617,10 @@ exports.default = {
Contract: contracts_1.Contract,
Interface: contracts_1.Interface,
getNetwork: networks_1.getNetwork,
providers: providers,
providers: providers_1.default,
errors: errors,
constants: constants,
utils: utils,
utils: utils_1.default,
wordlists: wordlists,
version: _version_1.version
};

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,4 +1,7 @@
'use strict';
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
@ -10,14 +13,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
var contracts_1 = require("./contracts");
exports.Contract = contracts_1.Contract;
exports.Interface = contracts_1.Interface;
var providers = __importStar(require("./providers"));
exports.providers = providers;
var providers_1 = __importDefault(require("./providers"));
exports.providers = providers_1.default;
var errors = __importStar(require("./utils/errors"));
exports.errors = errors;
var networks_1 = require("./providers/networks");
exports.getNetwork = networks_1.getNetwork;
var utils = __importStar(require("./utils"));
exports.utils = utils;
var utils_1 = __importDefault(require("./utils"));
exports.utils = utils_1.default;
var wallet_1 = require("./wallet");
exports.HDNode = wallet_1.HDNode;
exports.SigningKey = wallet_1.SigningKey;
@ -26,7 +29,7 @@ var wordlists = __importStar(require("./wordlists"));
exports.wordlists = wordlists;
var _version_1 = require("./_version");
exports.version = _version_1.version;
var constants = utils.constants;
var constants = utils_1.default.constants;
exports.constants = constants;
exports.default = {
Wallet: wallet_1.Wallet,
@ -35,10 +38,10 @@ exports.default = {
Contract: contracts_1.Contract,
Interface: contracts_1.Interface,
getNetwork: networks_1.getNetwork,
providers: providers,
providers: providers_1.default,
errors: errors,
constants: constants,
utils: utils,
utils: utils_1.default,
wordlists: wordlists,
version: _version_1.version
};

@ -37,12 +37,6 @@
}
}
if (!Math.tunc) {
Math.trunc = function(v) {
return parseInt(v);
}
}
// nextTick
if (!window.nextTick) {
window.nextTick = function (callback) { setTimeout(callback, 0); }
@ -67,7 +61,7 @@
<!-- Run the test cases! -->
<script type="text/javascript">
// Use this to focus on specific test cases
//mocha.grep(new RegExp('easyseed')).run();
//mocha.grep(new RegExp('Test Transaction Signing and Parsing parses and signs transaction - random-999')).run();
mocha.run();
</script>
</body>

@ -20,35 +20,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
var bn_js_1 = __importDefault(require("bn.js"));
var bytes_1 = require("./bytes");
var properties_1 = require("./properties");
var errors = __importStar(require("../utils/errors"));
function _isBigNumber(value) {
return isBigNumber(value);
}
function fromBN(bn) {
var errors = __importStar(require("./errors"));
var BN_1 = new bn_js_1.default.BN(-1);
function toHex(bn) {
var value = bn.toString(16);
if (value[0] === '-') {
return new BigNumber("-0x" + value.substring(1));
if ((value.length % 2) === 0) {
return '-0x0' + value.substring(1);
}
return "-0x" + value.substring(1);
}
return new BigNumber('0x' + value);
if ((value.length % 2) === 1) {
return '0x0' + value;
}
return '0x' + value;
}
var BigNumber = /** @class */ (function () {
function BigNumber(value) {
errors.checkNew(this, BigNumber);
function toBN(value) {
return bigNumberify(value)._bn;
}
function toBigNumber(bn) {
return new _BigNumber(toHex(bn));
}
;
var _BigNumber = /** @class */ (function () {
function _BigNumber(value) {
errors.checkNew(this, _BigNumber);
if (typeof (value) === 'string') {
if (bytes_1.isHexString(value)) {
if (value == '0x') {
value = '0x0';
}
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value.substring(2), 16));
properties_1.defineReadOnly(this, '_hex', value);
}
else if (value[0] === '-' && bytes_1.isHexString(value.substring(1))) {
properties_1.defineReadOnly(this, '_bn', (new bn_js_1.default.BN(value.substring(3), 16)).mul(exports.ConstantNegativeOne._bn));
properties_1.defineReadOnly(this, '_hex', value);
}
else if (value.match(/^-?[0-9]*$/)) {
if (value == '') {
value = '0';
}
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));
}
else {
errors.throwError('invalid BigNumber string value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
@ -59,72 +70,85 @@ var BigNumber = /** @class */ (function () {
errors.throwError('underflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'underflow', value: value, outputValue: parseInt(String(value)) });
}
try {
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(value));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(value)));
}
catch (error) {
errors.throwError('overflow', errors.NUMERIC_FAULT, { operation: 'setValue', fault: 'overflow', details: error.message });
}
}
else if (_isBigNumber(value)) {
properties_1.defineReadOnly(this, '_bn', value._bn);
else if (value instanceof _BigNumber) {
properties_1.defineReadOnly(this, '_hex', value.toHexString());
}
else if (value.toHexString) {
properties_1.defineReadOnly(this, '_hex', toHex(toBN(value.toHexString())));
}
else if (bytes_1.isArrayish(value)) {
properties_1.defineReadOnly(this, '_bn', new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16));
properties_1.defineReadOnly(this, '_hex', toHex(new bn_js_1.default.BN(bytes_1.hexlify(value).substring(2), 16)));
}
else {
errors.throwError('invalid BigNumber value', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
}
}
BigNumber.prototype.fromTwos = function (value) {
return fromBN(this._bn.fromTwos(value));
Object.defineProperty(_BigNumber.prototype, "_bn", {
get: function () {
if (this._hex[0] === '-') {
return (new bn_js_1.default.BN(this._hex.substring(3), 16)).mul(BN_1);
}
return new bn_js_1.default.BN(this._hex.substring(2), 16);
},
enumerable: true,
configurable: true
});
_BigNumber.prototype.fromTwos = function (value) {
return toBigNumber(this._bn.fromTwos(value));
};
BigNumber.prototype.toTwos = function (value) {
return fromBN(this._bn.toTwos(value));
_BigNumber.prototype.toTwos = function (value) {
return toBigNumber(this._bn.toTwos(value));
};
BigNumber.prototype.add = function (other) {
return fromBN(this._bn.add(bigNumberify(other)._bn));
_BigNumber.prototype.add = function (other) {
return toBigNumber(this._bn.add(toBN(other)));
};
BigNumber.prototype.sub = function (other) {
return fromBN(this._bn.sub(bigNumberify(other)._bn));
_BigNumber.prototype.sub = function (other) {
return toBigNumber(this._bn.sub(toBN(other)));
};
BigNumber.prototype.div = function (other) {
_BigNumber.prototype.div = function (other) {
var o = bigNumberify(other);
if (o.isZero()) {
errors.throwError('division by zero', errors.NUMERIC_FAULT, { operation: 'divide', fault: 'division by zero' });
}
return fromBN(this._bn.div(o._bn));
return toBigNumber(this._bn.div(toBN(other)));
};
BigNumber.prototype.mul = function (other) {
return fromBN(this._bn.mul(bigNumberify(other)._bn));
_BigNumber.prototype.mul = function (other) {
return toBigNumber(this._bn.mul(toBN(other)));
};
BigNumber.prototype.mod = function (other) {
return fromBN(this._bn.mod(bigNumberify(other)._bn));
_BigNumber.prototype.mod = function (other) {
return toBigNumber(this._bn.mod(toBN(other)));
};
BigNumber.prototype.pow = function (other) {
return fromBN(this._bn.pow(bigNumberify(other)._bn));
_BigNumber.prototype.pow = function (other) {
return toBigNumber(this._bn.pow(toBN(other)));
};
BigNumber.prototype.maskn = function (value) {
return fromBN(this._bn.maskn(value));
_BigNumber.prototype.maskn = function (value) {
return toBigNumber(this._bn.maskn(value));
};
BigNumber.prototype.eq = function (other) {
return this._bn.eq(bigNumberify(other)._bn);
_BigNumber.prototype.eq = function (other) {
return this._bn.eq(toBN(other));
};
BigNumber.prototype.lt = function (other) {
return this._bn.lt(bigNumberify(other)._bn);
_BigNumber.prototype.lt = function (other) {
return this._bn.lt(toBN(other));
};
BigNumber.prototype.lte = function (other) {
return this._bn.lte(bigNumberify(other)._bn);
_BigNumber.prototype.lte = function (other) {
return this._bn.lte(toBN(other));
};
BigNumber.prototype.gt = function (other) {
return this._bn.gt(bigNumberify(other)._bn);
_BigNumber.prototype.gt = function (other) {
return this._bn.gt(toBN(other));
};
BigNumber.prototype.gte = function (other) {
return this._bn.gte(bigNumberify(other)._bn);
_BigNumber.prototype.gte = function (other) {
return this._bn.gte(toBN(other));
};
BigNumber.prototype.isZero = function () {
_BigNumber.prototype.isZero = function () {
return this._bn.isZero();
};
BigNumber.prototype.toNumber = function () {
_BigNumber.prototype.toNumber = function () {
try {
return this._bn.toNumber();
}
@ -133,28 +157,23 @@ var BigNumber = /** @class */ (function () {
}
return null;
};
BigNumber.prototype.toString = function () {
_BigNumber.prototype.toString = function () {
return this._bn.toString(10);
};
BigNumber.prototype.toHexString = function () {
var hex = this._bn.toString(16);
if (hex.length % 2) {
hex = '0' + hex;
}
return '0x' + hex;
_BigNumber.prototype.toHexString = function () {
return this._hex;
};
return BigNumber;
return _BigNumber;
}());
exports.BigNumber = BigNumber;
function isBigNumber(value) {
return (value._bn && value._bn.mod);
return (value instanceof _BigNumber);
}
exports.isBigNumber = isBigNumber;
function bigNumberify(value) {
if (_isBigNumber(value)) {
if (value instanceof _BigNumber) {
return value;
}
return new BigNumber(value);
return new _BigNumber(value);
}
exports.bigNumberify = bigNumberify;
exports.ConstantNegativeOne = bigNumberify(-1);

@ -218,9 +218,13 @@ function splitSignature(signature) {
if (isSignature(signature)) {
r = hexZeroPad(signature.r, 32);
s = hexZeroPad(signature.s, 32);
v = signature.v;
if (typeof (v) === 'string') {
v = parseInt(v, 16);
}
var recoveryParam = signature.recoveryParam;
if (recoveryParam == null && signature.v != null) {
recoveryParam = 1 - (signature.v % 2);
recoveryParam = 1 - (v % 2);
}
v = 27 + recoveryParam;
}

@ -23,7 +23,6 @@ exports.parseParamType = abi_coder_1.parseParamType;
var base64 = __importStar(require("./base64"));
exports.base64 = base64;
var bignumber_1 = require("./bignumber");
exports.BigNumber = bignumber_1.BigNumber;
exports.bigNumberify = bignumber_1.bigNumberify;
var bytes_1 = require("./bytes");
exports.arrayify = bytes_1.arrayify;
@ -58,6 +57,9 @@ exports.resolveProperties = properties_1.resolveProperties;
exports.shallowCopy = properties_1.shallowCopy;
var RLP = __importStar(require("./rlp"));
exports.RLP = RLP;
var transaction_1 = require("./transaction");
exports.parseTransaction = transaction_1.parse;
exports.serializeTransaction = transaction_1.serialize;
var utf8_1 = require("./utf8");
exports.toUtf8Bytes = utf8_1.toUtf8Bytes;
exports.toUtf8String = utf8_1.toUtf8String;
@ -68,9 +70,6 @@ exports.formatUnits = units_1.formatUnits;
exports.parseUnits = units_1.parseUnits;
var web_1 = require("./web");
exports.fetchJson = web_1.fetchJson;
var transaction_1 = require("./transaction");
exports.parseTransaction = transaction_1.parse;
exports.serializeTransaction = transaction_1.serialize;
var errors = __importStar(require("./errors"));
exports.errors = errors;
// NFKD (decomposed)
@ -107,7 +106,6 @@ exports.default = {
stripZeros: bytes_1.stripZeros,
base64: base64,
bigNumberify: bignumber_1.bigNumberify,
BigNumber: bignumber_1.BigNumber,
hexlify: bytes_1.hexlify,
hexStripZeros: bytes_1.hexStripZeros,
hexZeroPad: bytes_1.hexZeroPad,

@ -7,8 +7,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var elliptic = __importStar(require("elliptic"));
var curve = new elliptic.ec('secp256k1');
var elliptic_1 = require("elliptic");
var curve = new elliptic_1.ec('secp256k1');
var address_1 = require("./address");
var bytes_1 = require("./bytes");
var keccak256_1 = require("./keccak256");

@ -11,7 +11,6 @@ var address_1 = require("./address");
var bignumber_1 = require("./bignumber");
var bytes_1 = require("./bytes");
var keccak256_1 = require("./keccak256");
var secp256k1_1 = require("./secp256k1");
var RLP = __importStar(require("./rlp"));
var errors = __importStar(require("./errors"));
function handleAddress(value) {
@ -137,3 +136,4 @@ function parse(rawTransaction) {
return tx;
}
exports.parse = parse;
var secp256k1_1 = require("./secp256k1");

@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
*
*
*/
var address_1 = require("../utils/address");
var bytes_1 = require("../utils/bytes");
var hdnode_1 = require("./hdnode");
var keccak256_1 = require("../utils/keccak256");
var properties_1 = require("../utils/properties");
var secp256k1_1 = require("../utils/secp256k1");
var errors = require("../utils/errors");
@ -46,7 +44,7 @@ var SigningKey = /** @class */ (function () {
properties_1.defineReadOnly(this, 'privateKey', bytes_1.hexlify(privateKeyBytes));
properties_1.defineReadOnly(this, 'keyPair', new secp256k1_1.KeyPair(privateKeyBytes));
properties_1.defineReadOnly(this, 'publicKey', this.keyPair.publicKey);
properties_1.defineReadOnly(this, 'address', computeAddress(this.keyPair.publicKey));
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey));
}
SigningKey.prototype.signDigest = function (digest) {
return this.keyPair.sign(digest);
@ -54,13 +52,3 @@ var SigningKey = /** @class */ (function () {
return SigningKey;
}());
exports.SigningKey = SigningKey;
function recoverAddress(digest, signature) {
return computeAddress(secp256k1_1.recoverPublicKey(digest, signature));
}
exports.recoverAddress = recoverAddress;
function computeAddress(key) {
// Strip off the leading "0x04"
var publicKey = '0x' + secp256k1_1.computePublicKey(key).slice(4);
return address_1.getAddress('0x' + keccak256_1.keccak256(publicKey).substring(26));
}
exports.computeAddress = computeAddress;

@ -25,6 +25,7 @@ var hash_1 = require("../utils/hash");
var keccak256_1 = require("../utils/keccak256");
var properties_1 = require("../utils/properties");
var random_bytes_1 = require("../utils/random-bytes");
var secp256k1_1 = require("../utils/secp256k1");
var transaction_1 = require("../utils/transaction");
var errors = __importStar(require("../utils/errors"));
var Signer = /** @class */ (function () {
@ -209,7 +210,7 @@ var Wallet = /** @class */ (function (_super) {
if (recoveryParam < 0) {
throw new Error('invalid signature');
}
return signing_key_1.recoverAddress(digest, {
return secp256k1_1.recoverAddress(digest, {
r: signature.substring(0, 66),
s: '0x' + signature.substring(66, 130),
recoveryParam: recoveryParam