Comparing version 4.0.0-beta.3 to 4.0.0-beta.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "4.0.0-beta.3"; | ||
exports.version = "4.0.0-beta.4"; |
@@ -165,3 +165,3 @@ 'use strict'; | ||
//address = getAddress(address); | ||
if (contractInterface instanceof interface_1.Interface) { | ||
if (interface_1.Interface.isInterface(contractInterface)) { | ||
properties_1.defineReadOnly(this, 'interface', contractInterface); | ||
@@ -172,7 +172,7 @@ } | ||
} | ||
if (signerOrProvider instanceof types_1.Signer) { | ||
if (types_1.Signer.isSigner(signerOrProvider)) { | ||
properties_1.defineReadOnly(this, 'provider', signerOrProvider.provider); | ||
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); | ||
@@ -179,0 +179,0 @@ properties_1.defineReadOnly(this, 'signer', null); |
@@ -331,2 +331,3 @@ 'use strict'; | ||
} | ||
properties_1.setType(this, 'Interface'); | ||
} | ||
@@ -376,4 +377,7 @@ Interface.prototype.parseTransaction = function (tx) { | ||
}; | ||
Interface.isInterface = function (value) { | ||
return properties_1.isType(value, 'Interface'); | ||
}; | ||
return Interface; | ||
}()); | ||
exports.Interface = Interface; |
@@ -27,2 +27,3 @@ // Generated by dts-bundle v0.7.3 | ||
WeiPerEther: utils.types.BigNumber; | ||
ConstantMaxUint256: utils.types.BigNumber; | ||
}; | ||
@@ -86,2 +87,3 @@ export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version }; | ||
WeiPerEther: types.BigNumber; | ||
ConstantMaxUint256: types.BigNumber; | ||
}; | ||
@@ -113,49 +115,51 @@ 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 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; | ||
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; | ||
constructor(); | ||
static isBigNumber(value: any): value is BigNumber; | ||
} | ||
export type BigNumberish = BigNumber | string | number | Arrayish; | ||
export type ConnectionInfo = { | ||
url: string; | ||
user?: string; | ||
password?: string; | ||
allowInsecure?: boolean; | ||
url: string; | ||
user?: string; | ||
password?: string; | ||
allowInsecure?: boolean; | ||
}; | ||
export interface OnceBlockable { | ||
once(eventName: "block", handler: () => void): void; | ||
once(eventName: "block", handler: () => void): void; | ||
} | ||
export type PollOptions = { | ||
timeout?: number; | ||
floor?: number; | ||
ceiling?: number; | ||
interval?: number; | ||
onceBlock?: OnceBlockable; | ||
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; | ||
r: string; | ||
s: string; | ||
recoveryParam?: number; | ||
v?: number; | ||
} | ||
export type Network = { | ||
name: string; | ||
chainId: number; | ||
ensAddress?: string; | ||
name: string; | ||
chainId: number; | ||
ensAddress?: string; | ||
}; | ||
@@ -165,248 +169,244 @@ export type Networkish = Network | string | number; | ||
export type ParamType = { | ||
name?: string; | ||
type: string; | ||
indexed?: boolean; | ||
components?: Array<any>; | ||
name?: string; | ||
type: string; | ||
indexed?: boolean; | ||
components?: Array<any>; | ||
}; | ||
export type EventFragment = { | ||
type: string; | ||
name: string; | ||
anonymous: boolean; | ||
inputs: Array<ParamType>; | ||
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; | ||
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; | ||
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; | ||
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>; | ||
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>>; | ||
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; | ||
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; | ||
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>; | ||
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>; | ||
blockNumber?: number; | ||
blockHash?: string; | ||
timestamp?: number; | ||
from: string; | ||
raw?: string; | ||
wait: (timeout?: number) => Promise<TransactionReceipt>; | ||
} | ||
export abstract class Indexed { | ||
readonly hash: string; | ||
readonly hash: string; | ||
constructor(); | ||
static isIndexed(value: any): value is Indexed; | ||
} | ||
export interface DeployDescription { | ||
readonly inputs: Array<ParamType>; | ||
readonly payable: boolean; | ||
encode(bytecode: string, params: Array<any>): string; | ||
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; | ||
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; | ||
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>; | ||
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; | ||
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>; | ||
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>; | ||
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>; | ||
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>; | ||
constructor(); | ||
static isProvider(value: any): value is MinimalProvider; | ||
} | ||
export type AsyncProvider = { | ||
isMetaMask?: boolean; | ||
host?: string; | ||
path?: string; | ||
sendAsync: (request: any, callback: (error: any, response: any) => void) => void; | ||
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; | ||
}; | ||
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>; | ||
provider?: MinimalProvider; | ||
abstract getAddress(): Promise<string>; | ||
abstract signMessage(message: Arrayish | string): Promise<string>; | ||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; | ||
constructor(); | ||
static isSigner(value: any): value is Signer; | ||
} | ||
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; | ||
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; | ||
constructor(); | ||
static isHDNode(value: any): value is HDNode; | ||
} | ||
export interface Wordlist { | ||
locale: string; | ||
getWord(index: number): string; | ||
getWordIndex(word: string): number; | ||
split(mnemonic: string): Array<string>; | ||
join(words: Array<string>): string; | ||
locale: string; | ||
getWord(index: number): string; | ||
getWordIndex(word: string): number; | ||
split(mnemonic: string): Array<string>; | ||
join(words: Array<string>): string; | ||
} | ||
@@ -432,3 +432,3 @@ } | ||
declare module 'ethers/_version' { | ||
export const version = "4.0.0-beta.3"; | ||
export const version = "4.0.0-beta.4"; | ||
} | ||
@@ -491,2 +491,3 @@ | ||
}): _LogDescription; | ||
static isInterface(value: any): value is Interface; | ||
} | ||
@@ -670,2 +671,3 @@ } | ||
export const ConstantWeiPerEther: _BigNumber; | ||
export const ConstantMaxUint256: _BigNumber; | ||
} | ||
@@ -744,2 +746,4 @@ | ||
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>; | ||
@@ -857,2 +861,3 @@ export function shallowCopy(object: any): any; | ||
signDigest(digest: Arrayish): Signature; | ||
static isSigningKey(value: any): value is SigningKey; | ||
} | ||
@@ -859,0 +864,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const version = "4.0.0-beta.3"; | ||
export declare const version = "4.0.0-beta.4"; | ||
//# sourceMappingURL=_version.d.ts.map |
@@ -20,3 +20,4 @@ import { BigNumberish, DeployDescription as _DeployDescription, EventDescription as _EventDescription, FunctionDescription as _FunctionDescription, LogDescription as _LogDescription, TransactionDescription as _TransactionDescription, EventFragment, FunctionFragment, ParamType } from '../utils/types'; | ||
}): _LogDescription; | ||
static isInterface(value: any): value is Interface; | ||
} | ||
//# sourceMappingURL=interface.d.ts.map |
@@ -18,4 +18,5 @@ import { platform } from './utils/shims'; | ||
WeiPerEther: utils.types.BigNumber; | ||
ConstantMaxUint256: utils.types.BigNumber; | ||
}; | ||
export { Wallet, HDNode, SigningKey, Contract, Interface, providers, types, errors, constants, utils, wordlists, platform, version }; | ||
//# sourceMappingURL=ethers.d.ts.map |
@@ -8,2 +8,3 @@ import { BigNumber as _BigNumber, BigNumberish } from './types'; | ||
export declare const ConstantWeiPerEther: _BigNumber; | ||
export declare const ConstantMaxUint256: _BigNumber; | ||
//# sourceMappingURL=bignumber.d.ts.map |
@@ -31,4 +31,5 @@ import { getAddress, getContractAddress, getIcapAddress } from './address'; | ||
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 }; | ||
//# sourceMappingURL=index.d.ts.map |
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 setType(object: any, type: string): void; | ||
export declare function isType(object: any, type: string): boolean; | ||
export declare function resolveProperties(object: any): Promise<any>; | ||
@@ -4,0 +6,0 @@ export declare function shallowCopy(object: any): any; |
@@ -21,2 +21,4 @@ export declare type Arrayish = string | ArrayLike<number>; | ||
abstract toHexString(): string; | ||
constructor(); | ||
static isBigNumber(value: any): value is BigNumber; | ||
} | ||
@@ -164,2 +166,4 @@ export declare type BigNumberish = BigNumber | string | number | Arrayish; | ||
readonly hash: string; | ||
constructor(); | ||
static isIndexed(value: any): value is Indexed; | ||
} | ||
@@ -222,8 +226,2 @@ export interface DeployDescription { | ||
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 { | ||
@@ -253,2 +251,4 @@ abstract getNetwork(): Promise<Network>; | ||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>; | ||
constructor(); | ||
static isProvider(value: any): value is MinimalProvider; | ||
} | ||
@@ -276,8 +276,2 @@ export declare type AsyncProvider = { | ||
}; | ||
/** | ||
* 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 { | ||
@@ -288,2 +282,4 @@ provider?: MinimalProvider; | ||
abstract sendTransaction(transaction: TransactionRequest): Promise<TransactionResponse>; | ||
constructor(); | ||
static isSigner(value: any): value is Signer; | ||
} | ||
@@ -299,2 +295,4 @@ export declare abstract class HDNode { | ||
abstract derivePath(path: string): HDNode; | ||
constructor(); | ||
static isHDNode(value: any): value is HDNode; | ||
} | ||
@@ -301,0 +299,0 @@ export interface Wordlist { |
@@ -11,3 +11,4 @@ import { Arrayish, HDNode, Signature } from '../utils/types'; | ||
signDigest(digest: Arrayish): Signature; | ||
static isSigningKey(value: any): value is SigningKey; | ||
} | ||
//# sourceMappingURL=signing-key.d.ts.map |
{ | ||
"name": "ethers", | ||
"version": "4.0.0-beta.3", | ||
"version": "4.0.0-beta.4", | ||
"description": "Ethereum wallet library.", | ||
@@ -16,4 +16,4 @@ "main": "./index.js", | ||
"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-phantomjs": "gulp minified tests && phantomjs --web-security=false ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js ./tests/test.html", | ||
"test-node": "npm run dist && mocha tests/test-*.js", | ||
"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" | ||
@@ -20,0 +20,0 @@ }, |
@@ -345,4 +345,16 @@ 'use strict'; | ||
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); | ||
//value = value.toTwos(size * 8).maskn(size * 8); | ||
if (this.signed) { | ||
@@ -428,4 +440,4 @@ v = v.fromTwos(this.size * 8).toTwos(256); | ||
var data = bytes_1.arrayify(value); | ||
if (data.length > 32) { | ||
throw new Error(); | ||
if (data.length !== this.length) { | ||
throw new Error('incorrect data length'); | ||
} | ||
@@ -432,0 +444,0 @@ result.set(data); |
@@ -182,3 +182,3 @@ 'use strict'; | ||
function bigNumberify(value) { | ||
if (value instanceof BigNumber) { | ||
if (BigNumber.isBigNumber(value)) { | ||
return value; | ||
@@ -194,1 +194,2 @@ } | ||
exports.ConstantWeiPerEther = bigNumberify('1000000000000000000'); | ||
exports.ConstantMaxUint256 = bigNumberify('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); |
@@ -11,5 +11,2 @@ "use strict"; | ||
exports.HashZero = '0x0000000000000000000000000000000000000000000000000000000000000000'; | ||
function isBigNumber(value) { | ||
return (value instanceof types_1.BigNumber); | ||
} | ||
function addSlice(array) { | ||
@@ -42,3 +39,3 @@ if (array.slice) { | ||
} | ||
if (isBigNumber(value)) { | ||
if (types_1.BigNumber.isBigNumber(value)) { | ||
value = value.toHexString(); | ||
@@ -129,3 +126,3 @@ } | ||
function hexlify(value) { | ||
if (isBigNumber(value)) { | ||
if (types_1.BigNumber.isBigNumber(value)) { | ||
return value.toHexString(); | ||
@@ -132,0 +129,0 @@ } |
@@ -96,4 +96,5 @@ 'use strict'; | ||
Two: bignumber_1.ConstantTwo, | ||
WeiPerEther: bignumber_1.ConstantWeiPerEther | ||
WeiPerEther: bignumber_1.ConstantWeiPerEther, | ||
ConstantMaxUint256: bignumber_1.ConstantMaxUint256 | ||
}; | ||
exports.constants = constants; |
@@ -19,2 +19,12 @@ 'use strict'; | ||
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) { | ||
@@ -21,0 +31,0 @@ var result = {}; |
@@ -5,2 +5,8 @@ "use strict"; | ||
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); | ||
} | ||
/////////////////////////////// | ||
@@ -10,3 +16,7 @@ // BigNumber | ||
function BigNumber() { | ||
setType(this, 'BigNumber'); | ||
} | ||
BigNumber.isBigNumber = function (value) { | ||
return isType(value, 'BigNumber'); | ||
}; | ||
return BigNumber; | ||
@@ -22,27 +32,27 @@ }()); | ||
function Indexed() { | ||
setType(this, 'Indexed'); | ||
} | ||
Indexed.isIndexed = function (value) { | ||
return isType(value, 'Indexed'); | ||
}; | ||
return 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 () { | ||
function MinimalProvider() { | ||
setType(this, 'Provider'); | ||
} | ||
MinimalProvider.isProvider = function (value) { | ||
return isType(value, 'Provider'); | ||
}; | ||
return 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 () { | ||
function Signer() { | ||
setType(this, 'Signer'); | ||
} | ||
Signer.isSigner = function (value) { | ||
return isType(value, 'Signer'); | ||
}; | ||
return Signer; | ||
@@ -55,5 +65,9 @@ }()); | ||
function HDNode() { | ||
setType(this, 'HDNode'); | ||
} | ||
HDNode.isHDNode = function (value) { | ||
return isType(value, 'HDNode'); | ||
}; | ||
return HDNode; | ||
}()); | ||
exports.HDNode = HDNode; |
@@ -244,3 +244,3 @@ 'use strict'; | ||
var privateKeyBytes = null; | ||
if (privateKey instanceof signing_key_1.SigningKey) { | ||
if (signing_key_1.SigningKey.isSigningKey(privateKey)) { | ||
privateKeyBytes = bytes_1.arrayify(privateKey.privateKey); | ||
@@ -247,0 +247,0 @@ } |
@@ -17,3 +17,3 @@ 'use strict'; | ||
var privateKeyBytes = null; | ||
if (privateKey instanceof types_1.HDNode) { | ||
if (types_1.HDNode.isHDNode(privateKey)) { | ||
properties_1.defineReadOnly(this, 'mnemonic', privateKey.mnemonic); | ||
@@ -49,2 +49,3 @@ properties_1.defineReadOnly(this, 'path', privateKey.path); | ||
properties_1.defineReadOnly(this, 'address', secp256k1_1.computeAddress(this.keyPair.publicKey)); | ||
properties_1.setType(this, 'SigningKey'); | ||
} | ||
@@ -54,4 +55,7 @@ SigningKey.prototype.signDigest = function (digest) { | ||
}; | ||
SigningKey.isSigningKey = function (value) { | ||
return properties_1.isType(value, 'SigningKey'); | ||
}; | ||
return SigningKey; | ||
}()); | ||
exports.SigningKey = SigningKey; |
@@ -38,3 +38,3 @@ 'use strict'; | ||
// 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); | ||
@@ -72,3 +72,3 @@ } | ||
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 }); | ||
@@ -75,0 +75,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2289695
24584