Updated dist files.
This commit is contained in:
parent
deb2281af2
commit
6c1902544c
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,7 +1,15 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
This change log is managed by `scripts/cmd/update-versions` but may be manually updated.
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.139 (2019-06-11 17:55)
|
||||
-----------------------------------------
|
||||
|
||||
- Removed freeze option from deepCopy; all properties are read-only and only objects may have new properties added. ([1bc792d](https://github.com/ethers-io/ethers.js/commit/1bc792d9dcc6a06a1be4fc5e5b9a538a3f6b7ada))
|
||||
- Moved away from isNamedInstance which breaks after Browserify name mangling. ([257d67c](https://github.com/ethers-io/ethers.js/commit/257d67c9625fa237bcfb3d651c49aa3b79175cae))
|
||||
- Expose poll function in utils. ([#512](https://github.com/ethers-io/ethers.js/issues/512); [e6f6383](https://github.com/ethers-io/ethers.js/commit/e6f6383346818fa67423f1f20450e011242eb554))
|
||||
- Make TransactionResponse hash required. ([#537](https://github.com/ethers-io/ethers.js/issues/537); [095c1fe](https://github.com/ethers-io/ethers.js/commit/095c1fe579068a3204ea0d1bc1893f293f61e719))
|
||||
|
||||
ethers/v5.0.0-beta.138 (2019-06-04 16:05)
|
||||
-----------------------------------------
|
||||
@ -17,7 +25,7 @@ ethers/v5.0.0-beta.137 (2019-06-01 14:06)
|
||||
- Added changelog management to update-versions. ([4a3f719](https://github.com/ethers-io/ethers.js/commit/4a3f7190dc04275030d313289e1ba6a2b31407ec))
|
||||
|
||||
ethers/v5.0.0-beta.136
|
||||
---------------------
|
||||
----------------------
|
||||
|
||||
- Added queryFilter to Contracts. ([#463](https://github.com/ethers-io/ethers.js/issues/463); [eea53bb](https://github.com/ethers-io/ethers.js/commit/eea53bb1be29ad2bd1b229a13c85b12be264b019))
|
||||
- Allow storage class in Human-Readable ABI. ([#476](https://github.com/ethers-io/ethers.js/issues/476); [cf39adb](https://github.com/ethers-io/ethers.js/commit/cf39adb09020ca0393e028b330bfd07fb4869236))
|
||||
|
2
packages/abi/_version.d.ts
vendored
2
packages/abi/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.131";
|
||||
export declare const version = "5.0.0-beta.132";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.131";
|
||||
exports.version = "5.0.0-beta.132";
|
||||
|
7
packages/abi/fragments.d.ts
vendored
7
packages/abi/fragments.d.ts
vendored
@ -24,27 +24,32 @@ export declare class ParamType {
|
||||
readonly components: Array<ParamType>;
|
||||
readonly arrayLength: number;
|
||||
readonly arrayChildren: ParamType;
|
||||
readonly _isParamType: boolean;
|
||||
constructor(constructorGuard: any, params: any);
|
||||
format(expanded?: boolean): string;
|
||||
static from(value: string | JsonFragmentType | ParamType, allowIndexed?: boolean): ParamType;
|
||||
static fromObject(value: JsonFragmentType | ParamType): ParamType;
|
||||
static fromString(value: string, allowIndexed?: boolean): ParamType;
|
||||
static isParamType(value: any): value is ParamType;
|
||||
}
|
||||
export declare abstract class Fragment {
|
||||
readonly type: string;
|
||||
readonly name: string;
|
||||
readonly inputs: Array<ParamType>;
|
||||
readonly _isFragment: boolean;
|
||||
constructor(constructorGuard: any, params: any);
|
||||
format(expanded?: boolean): string;
|
||||
static from(value: Fragment | JsonFragment | string): Fragment;
|
||||
static fromObject(value: Fragment | JsonFragment): Fragment;
|
||||
static fromString(value: string): Fragment;
|
||||
static isFragment(value: any): value is Fragment;
|
||||
}
|
||||
export declare class EventFragment extends Fragment {
|
||||
readonly anonymous: boolean;
|
||||
static from(value: EventFragment | JsonFragment | string): EventFragment;
|
||||
static fromObject(value: JsonFragment | EventFragment): EventFragment;
|
||||
static fromString(value: string): EventFragment;
|
||||
static isEventFragment(value: any): value is EventFragment;
|
||||
}
|
||||
export declare class ConstructorFragment extends Fragment {
|
||||
stateMutability: string;
|
||||
@ -53,6 +58,7 @@ export declare class ConstructorFragment extends Fragment {
|
||||
static from(value: ConstructorFragment | JsonFragment | string): ConstructorFragment;
|
||||
static fromObject(value: ConstructorFragment | JsonFragment): ConstructorFragment;
|
||||
static fromString(value: string): ConstructorFragment;
|
||||
static isConstructorFragment(value: any): value is ConstructorFragment;
|
||||
}
|
||||
export declare class FunctionFragment extends ConstructorFragment {
|
||||
constant: boolean;
|
||||
@ -60,4 +66,5 @@ export declare class FunctionFragment extends ConstructorFragment {
|
||||
static from(value: FunctionFragment | JsonFragment | string): FunctionFragment;
|
||||
static fromObject(value: FunctionFragment | JsonFragment): FunctionFragment;
|
||||
static fromString(value: string): FunctionFragment;
|
||||
static isFunctionFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
|
@ -215,6 +215,8 @@ var ParamType = /** @class */ (function () {
|
||||
baseType: ((this.components != null) ? "tuple" : this.type)
|
||||
});
|
||||
}
|
||||
this._isParamType = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
// Format the parameter fragment
|
||||
// - non-expanded: "(uint256,address)"
|
||||
@ -254,7 +256,7 @@ var ParamType = /** @class */ (function () {
|
||||
return ParamType.fromObject(value);
|
||||
};
|
||||
ParamType.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(ParamType, value)) {
|
||||
if (ParamType.isParamType(value)) {
|
||||
return value;
|
||||
}
|
||||
return new ParamType(_constructorGuard, {
|
||||
@ -275,6 +277,9 @@ var ParamType = /** @class */ (function () {
|
||||
}
|
||||
return ParamTypify(parseParamType(value, !!allowIndexed));
|
||||
};
|
||||
ParamType.isParamType = function (value) {
|
||||
return !!(value != null && value._isParamType);
|
||||
};
|
||||
return ParamType;
|
||||
}());
|
||||
exports.ParamType = ParamType;
|
||||
@ -288,6 +293,8 @@ var Fragment = /** @class */ (function () {
|
||||
throw new Error("use a static from method");
|
||||
}
|
||||
populate(this, params);
|
||||
this._isFragment = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
// @TOOD: move logic to sub-classes; make this abstract
|
||||
Fragment.prototype.format = function (expanded) {
|
||||
@ -318,13 +325,16 @@ var Fragment = /** @class */ (function () {
|
||||
return result.trim();
|
||||
};
|
||||
Fragment.from = function (value) {
|
||||
if (Fragment.isFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (typeof (value) === "string") {
|
||||
return Fragment.fromString(value);
|
||||
}
|
||||
return Fragment.fromObject(value);
|
||||
};
|
||||
Fragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(Fragment, value)) {
|
||||
if (Fragment.isFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type === "function") {
|
||||
@ -361,6 +371,9 @@ var Fragment = /** @class */ (function () {
|
||||
}
|
||||
throw new Error("unknown fragment");
|
||||
};
|
||||
Fragment.isFragment = function (value) {
|
||||
return !!(value && value._isFragment);
|
||||
};
|
||||
return Fragment;
|
||||
}());
|
||||
exports.Fragment = Fragment;
|
||||
@ -376,7 +389,7 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
return EventFragment.fromObject(value);
|
||||
};
|
||||
EventFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(EventFragment, value)) {
|
||||
if (EventFragment.isEventFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "event") {
|
||||
@ -413,6 +426,9 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
type: "event"
|
||||
});
|
||||
};
|
||||
EventFragment.isEventFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "event");
|
||||
};
|
||||
return EventFragment;
|
||||
}(Fragment));
|
||||
exports.EventFragment = EventFragment;
|
||||
@ -474,7 +490,7 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
return ConstructorFragment.fromObject(value);
|
||||
};
|
||||
ConstructorFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(ConstructorFragment, value)) {
|
||||
if (ConstructorFragment.isConstructorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "constructor") {
|
||||
@ -501,6 +517,9 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
parseModifiers(parens[3].trim(), params);
|
||||
return ConstructorFragment.fromObject(params);
|
||||
};
|
||||
ConstructorFragment.isConstructorFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "constructor");
|
||||
};
|
||||
return ConstructorFragment;
|
||||
}(Fragment));
|
||||
exports.ConstructorFragment = ConstructorFragment;
|
||||
@ -516,7 +535,7 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
return FunctionFragment.fromObject(value);
|
||||
};
|
||||
FunctionFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(FunctionFragment, value)) {
|
||||
if (FunctionFragment.isFunctionFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "function") {
|
||||
@ -563,6 +582,9 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
}
|
||||
return FunctionFragment.fromObject(params);
|
||||
};
|
||||
FunctionFragment.isFunctionFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "function");
|
||||
};
|
||||
return FunctionFragment;
|
||||
}(ConstructorFragment));
|
||||
exports.FunctionFragment = FunctionFragment;
|
||||
|
3
packages/abi/interface.d.ts
vendored
3
packages/abi/interface.d.ts
vendored
@ -20,6 +20,7 @@ export declare class TransactionDescription extends Description {
|
||||
}
|
||||
export declare class Indexed extends Description {
|
||||
readonly hash: string;
|
||||
static isIndexed(value: any): value is Indexed;
|
||||
}
|
||||
export declare class Result {
|
||||
[key: string]: any;
|
||||
@ -41,6 +42,7 @@ export declare class Interface {
|
||||
};
|
||||
readonly deploy: ConstructorFragment;
|
||||
readonly _abiCoder: AbiCoder;
|
||||
static _isInterface: boolean;
|
||||
constructor(fragments: string | Array<Fragment | JsonFragment | string>);
|
||||
static getAbiCoder(): AbiCoder;
|
||||
static getAddress(address: string): string;
|
||||
@ -64,4 +66,5 @@ export declare class Interface {
|
||||
topics: Array<string>;
|
||||
data: string;
|
||||
}): LogDescription;
|
||||
static isInterface(value: any): value is Interface;
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ var Indexed = /** @class */ (function (_super) {
|
||||
function Indexed() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Indexed.isIndexed = function (value) {
|
||||
return !!(value && value._isIndexed);
|
||||
};
|
||||
return Indexed;
|
||||
}(properties_1.Description));
|
||||
exports.Indexed = Indexed;
|
||||
@ -72,9 +75,6 @@ var Interface = /** @class */ (function () {
|
||||
abi = fragments;
|
||||
}
|
||||
properties_1.defineReadOnly(this, "fragments", abi.map(function (fragment) {
|
||||
if (properties_1.isNamedInstance(fragments_1.Fragment, fragment)) {
|
||||
return fragment;
|
||||
}
|
||||
return fragments_1.Fragment.from(fragment);
|
||||
}).filter(function (fragment) { return (fragment != null); }));
|
||||
properties_1.defineReadOnly(this, "_abiCoder", _newTarget.getAbiCoder());
|
||||
@ -125,6 +125,7 @@ var Interface = /** @class */ (function () {
|
||||
if (!this.deploy) {
|
||||
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({ type: "constructor" }));
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_isInterface", true);
|
||||
}
|
||||
Interface.getAbiCoder = function () {
|
||||
return abi_coder_1.defaultAbiCoder;
|
||||
@ -300,10 +301,10 @@ var Interface = /** @class */ (function () {
|
||||
eventFragment.inputs.forEach(function (param, index) {
|
||||
if (param.indexed) {
|
||||
if (resultIndexed == null) {
|
||||
result[index] = new Indexed({ hash: null });
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: null });
|
||||
}
|
||||
else if (dynamic[index]) {
|
||||
result[index] = new Indexed({ hash: resultIndexed[indexedIndex++] });
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
||||
}
|
||||
else {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
@ -344,6 +345,20 @@ var Interface = /** @class */ (function () {
|
||||
values: this.decodeEventLog(fragment, log.data, log.topics)
|
||||
});
|
||||
};
|
||||
/*
|
||||
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
|
||||
if (Interface.isInterface(value)) {
|
||||
return value;
|
||||
}
|
||||
if (typeof(value) === "string") {
|
||||
return new Interface(JSON.parse(value));
|
||||
}
|
||||
return new Interface(value);
|
||||
}
|
||||
*/
|
||||
Interface.isInterface = function (value) {
|
||||
return !!(value && value._isInterface);
|
||||
};
|
||||
return Interface;
|
||||
}());
|
||||
exports.Interface = Interface;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abi",
|
||||
"version": "5.0.0-beta.131",
|
||||
"version": "5.0.0-beta.132",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -26,5 +26,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x01c9130b48add5e7f90719d23992716773073976b4f9c183858ecf3362ada3ec"
|
||||
"tarballHash": "0x74367d2ba9f1a43ad8f0f5e0c5f815afd8d655ebae1ed710cd9e5d331557c78a"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.131";
|
||||
export const version = "5.0.0-beta.132";
|
||||
|
2
packages/abstract-provider/_version.d.ts
vendored
2
packages/abstract-provider/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.126";
|
||||
exports.version = "5.0.0-beta.127";
|
||||
|
9
packages/abstract-provider/index.d.ts
vendored
9
packages/abstract-provider/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
||||
import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Network } from "@ethersproject/networks";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { Transaction } from "@ethersproject/transactions";
|
||||
import { OnceBlockable } from "@ethersproject/web";
|
||||
export declare type TransactionRequest = {
|
||||
@ -14,6 +15,7 @@ export declare type TransactionRequest = {
|
||||
chainId?: number | Promise<number>;
|
||||
};
|
||||
export interface TransactionResponse extends Transaction {
|
||||
hash: string;
|
||||
blockNumber?: number;
|
||||
blockHash?: string;
|
||||
timestamp?: number;
|
||||
@ -81,9 +83,10 @@ export interface Filter extends EventFilter {
|
||||
export interface FilterByBlockHash extends EventFilter {
|
||||
blockhash?: string;
|
||||
}
|
||||
export declare class ForkEvent {
|
||||
export declare abstract class ForkEvent extends Description {
|
||||
readonly expiry: number;
|
||||
constructor(expiry?: number);
|
||||
readonly _isForkEvent: boolean;
|
||||
static isForkEvent(value: any): value is ForkEvent;
|
||||
}
|
||||
export declare class BlockForkEvent extends ForkEvent {
|
||||
readonly blockhash: string;
|
||||
@ -128,6 +131,8 @@ export declare abstract class Provider implements OnceBlockable {
|
||||
addListener(eventName: EventType, listener: Listener): Provider;
|
||||
removeListener(eventName: EventType, listener: Listener): Provider;
|
||||
abstract waitForTransaction(transactionHash: string, timeout?: number): Promise<TransactionReceipt>;
|
||||
readonly _isProvider: boolean;
|
||||
constructor();
|
||||
static isProvider(value: any): value is Provider;
|
||||
}
|
||||
export {};
|
||||
|
@ -29,12 +29,16 @@ var properties_1 = require("@ethersproject/properties");
|
||||
//export type CallTransactionable = {
|
||||
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||
//};
|
||||
var ForkEvent = /** @class */ (function () {
|
||||
function ForkEvent(expiry) {
|
||||
properties_1.defineReadOnly(this, "expiry", expiry || 0);
|
||||
var ForkEvent = /** @class */ (function (_super) {
|
||||
__extends(ForkEvent, _super);
|
||||
function ForkEvent() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ForkEvent.isForkEvent = function (value) {
|
||||
return !!(value && value._isForkEvent);
|
||||
};
|
||||
return ForkEvent;
|
||||
}());
|
||||
}(properties_1.Description));
|
||||
exports.ForkEvent = ForkEvent;
|
||||
var BlockForkEvent = /** @class */ (function (_super) {
|
||||
__extends(BlockForkEvent, _super);
|
||||
@ -43,8 +47,12 @@ var BlockForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(blockhash, 32)) {
|
||||
errors.throwArgumentError("invalid blockhash", "blockhash", blockhash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "blockhash", blockhash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isBlockForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
blockHash: blockhash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return BlockForkEvent;
|
||||
@ -57,8 +65,12 @@ var TransactionForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(hash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "hash", hash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "hash", hash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isTransactionForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
hash: hash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return TransactionForkEvent;
|
||||
@ -74,9 +86,13 @@ var TransactionOrderForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(afterHash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "beforeHash", beforeHash);
|
||||
properties_1.defineReadOnly(_this, "afterHash", afterHash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isTransactionOrderForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
beforeHash: beforeHash,
|
||||
afterHash: afterHash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return TransactionOrderForkEvent;
|
||||
@ -88,6 +104,7 @@ var Provider = /** @class */ (function () {
|
||||
function Provider() {
|
||||
var _newTarget = this.constructor;
|
||||
errors_1.checkAbstract(_newTarget, Provider);
|
||||
properties_1.defineReadOnly(this, "_isProvider", true);
|
||||
}
|
||||
// Alias for "on"
|
||||
Provider.prototype.addListener = function (eventName, listener) {
|
||||
@ -97,6 +114,9 @@ var Provider = /** @class */ (function () {
|
||||
Provider.prototype.removeListener = function (eventName, listener) {
|
||||
return this.off(eventName, listener);
|
||||
};
|
||||
Provider.isProvider = function (value) {
|
||||
return !!(value && value._isProvider);
|
||||
};
|
||||
return Provider;
|
||||
}());
|
||||
exports.Provider = Provider;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abstract-provider",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"browser": {
|
||||
@ -28,5 +28,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x4424dfecaacd3e4d135d01136d92bcee22bb7a5d0ce5d2c5272bd02422135db7"
|
||||
"tarballHash": "0x600f6a57977cc87491325f019f663b18a783108c35ac4285250445afbc63eace"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
2
packages/abstract-signer/_version.d.ts
vendored
2
packages/abstract-signer/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.126";
|
||||
exports.version = "5.0.0-beta.127";
|
||||
|
2
packages/abstract-signer/index.d.ts
vendored
2
packages/abstract-signer/index.d.ts
vendored
@ -13,6 +13,7 @@ export declare abstract class Signer {
|
||||
abstract signMessage(message: Bytes | string): Promise<string>;
|
||||
abstract signTransaction(transaction: TransactionRequest): Promise<string>;
|
||||
abstract connect(provider: Provider): Signer;
|
||||
readonly _isSigner: boolean;
|
||||
constructor();
|
||||
getBalance(blockTag?: BlockTag): Promise<BigNumber>;
|
||||
getTransactionCount(blockTag?: BlockTag): Promise<number>;
|
||||
@ -25,6 +26,7 @@ export declare abstract class Signer {
|
||||
checkTransaction(transaction: TransactionRequest): TransactionRequest;
|
||||
populateTransaction(transaction: TransactionRequest): Promise<TransactionRequest>;
|
||||
_checkProvider(operation?: string): void;
|
||||
static isSigner(value: any): value is Signer;
|
||||
}
|
||||
export declare class VoidSigner extends Signer {
|
||||
readonly address: string;
|
||||
|
@ -37,6 +37,7 @@ var Signer = /** @class */ (function () {
|
||||
function Signer() {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkAbstract(_newTarget, Signer);
|
||||
properties_1.defineReadOnly(this, "_isSigner", true);
|
||||
}
|
||||
///////////////////
|
||||
// Sub-classes MAY override these
|
||||
@ -156,6 +157,9 @@ var Signer = /** @class */ (function () {
|
||||
});
|
||||
}
|
||||
};
|
||||
Signer.isSigner = function (value) {
|
||||
return !!(value && value._isSigner);
|
||||
};
|
||||
return Signer;
|
||||
}());
|
||||
exports.Signer = Signer;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abstract-signer",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -22,5 +22,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x3bc5ce92bedb99f4c15e3c399e4367eaa001bb72bf25a82f52e09c74f09f492f"
|
||||
"tarballHash": "0xd9b7bb0ec627b00472f857c47fae281eff630aa11696650a6b311693e8d4e965"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
2
packages/bignumber/_version.d.ts
vendored
2
packages/bignumber/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.126";
|
||||
exports.version = "5.0.0-beta.127";
|
||||
|
2
packages/bignumber/bignumber.d.ts
vendored
2
packages/bignumber/bignumber.d.ts
vendored
@ -1,7 +1,9 @@
|
||||
import { Bytes, Hexable } from "@ethersproject/bytes";
|
||||
export declare type BigNumberish = BigNumber | Bytes | string | number;
|
||||
export declare function isBigNumberish(value: any): value is BigNumberish;
|
||||
export declare class BigNumber implements Hexable {
|
||||
readonly _hex: string;
|
||||
readonly _isBigNumber: boolean;
|
||||
constructor(constructorGuard: any, hex: string);
|
||||
fromTwos(value: number): BigNumber;
|
||||
toTwos(value: number): BigNumber;
|
||||
|
@ -16,19 +16,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
*/
|
||||
var BN = __importStar(require("bn.js"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var _constructorGuard = {};
|
||||
var MAX_SAFE = 0x1fffffffffffff;
|
||||
/*
|
||||
export function isBigNumberLike(value: any): value is BigNumberish {
|
||||
return (BigNumber.isBigNumber(value) ||
|
||||
(!!((<any>value).toHexString)) ||
|
||||
isBytes(value) ||
|
||||
value.match(/^-?([0-9]+|0x[0-9a-f]+)$/i) ||
|
||||
typeof(value) === "number");
|
||||
function isBigNumberish(value) {
|
||||
return (value != null) && (BigNumber.isBigNumber(value) ||
|
||||
(typeof (value) === "number" && (value % 1) === 0) ||
|
||||
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
||||
bytes_1.isHexString(value) ||
|
||||
(typeof (value) === "bigint") ||
|
||||
bytes_1.isBytes(value));
|
||||
}
|
||||
*/
|
||||
exports.isBigNumberish = isBigNumberish;
|
||||
var BigNumber = /** @class */ (function () {
|
||||
function BigNumber(constructorGuard, hex) {
|
||||
var _newTarget = this.constructor;
|
||||
@ -38,7 +37,9 @@ var BigNumber = /** @class */ (function () {
|
||||
operation: "new (BigNumber)"
|
||||
});
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_hex", hex);
|
||||
this._hex = hex;
|
||||
this._isBigNumber = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
BigNumber.prototype.fromTwos = function (value) {
|
||||
return toBigNumber(toBN(this).fromTwos(value));
|
||||
@ -154,101 +155,11 @@ var BigNumber = /** @class */ (function () {
|
||||
return errors.throwArgumentError("invalid BigNumber value", "value", value);
|
||||
};
|
||||
BigNumber.isBigNumber = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
return !!(value && value._isBigNumber);
|
||||
};
|
||||
return BigNumber;
|
||||
}());
|
||||
exports.BigNumber = BigNumber;
|
||||
/*
|
||||
export function bigNumberify(value: BigNumberish): BigNumber {
|
||||
if (BigNumber.isBigNumber(value)) { return value; }
|
||||
return new BigNumber(value);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
function zeros(length) {
|
||||
let result = "";
|
||||
while (result.length < length) { tens += "0"; }
|
||||
return result;
|
||||
}
|
||||
export class FixedNumber {
|
||||
readonly value: BigNumber;
|
||||
readonly decimalPlaces: number;
|
||||
|
||||
constructor(value: BigNumberish, decimalPlaces: number) {
|
||||
defineReadOnly(this, "value", bigNumberify(value));
|
||||
defineReadOnly(this, "decimalPlaces", decimalPlaces);
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return formatUnits(this.value, this.decimalPlaces);
|
||||
}
|
||||
|
||||
static fromString(value: string): FixedNumber {
|
||||
let comps = value.split(".");
|
||||
let decimalPlaces = 0;
|
||||
if (comps.length === 2) { decimalPlaces = comps[1].length; }
|
||||
return new FixedNumber(parseUnits(value, decimalPlaces), decimalPlaces);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
||||
readonly negative: boolean;
|
||||
readonly whole: BigNumber;
|
||||
readonly fraction: BigNumber;
|
||||
constructor(whole: BigNumberish, fraction: BigNumberish, negative?: boolean) {
|
||||
if (whole.lt(constants.Zero)) {
|
||||
errors.throwError("whole component must be positive", errors.INVALID_ARGUMENT, {
|
||||
argument: whole,
|
||||
value: whole
|
||||
});
|
||||
}
|
||||
defineReadOnly(this, "whole", bigNumberify(whole));
|
||||
defineReadOnly(this, "fraction", bigNumberify(fraction));
|
||||
defineReadOnly(this, "negative", !!boolean);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
toHexString(bitWidth?: number, decimalPlaces?: number, signed?: boolean): string {
|
||||
if (bitWidth == null) { bitWidth = 128; }
|
||||
if (decimalPlaces == null) { decimalPlaces = 18; }
|
||||
if (signed == null) { signed = true; }
|
||||
return null;
|
||||
}
|
||||
static fromValue(value: BigNumberish, decimalPlaces: number): FixedNumber {
|
||||
let negative = false;
|
||||
if (value.lt(constants.Zero)) {
|
||||
negative = true;
|
||||
value = value.abs();
|
||||
}
|
||||
let tens = bigNumberify("1" + zeros(decimalPlaces));
|
||||
return new FixedNumber(value.divide(tens), value.mod(tens), negative);
|
||||
}
|
||||
let negative = false;
|
||||
if (value.substring(0, 1) === "-") {
|
||||
negative = true;
|
||||
value = value.substring(1);
|
||||
}
|
||||
|
||||
if (value !== "." && value !== "") {
|
||||
let comps = value.split(".");
|
||||
if (comps.length === 1) {
|
||||
return new FixedNumber(comps[0], 0, negative);
|
||||
} else if (comps.length === 2) {
|
||||
if (comps[0] === "") { comps[0] = "0"; }
|
||||
if (comps[1] === "") { comps[1] = "0"; }
|
||||
return new FixedNumber(comps[0], comps[1], negative);
|
||||
}
|
||||
}
|
||||
|
||||
errors.throwError("invalid fixed-point value", errors.INVALID_ARGUMENT, {
|
||||
argument: "value",
|
||||
value: value
|
||||
});
|
||||
|
||||
return null;
|
||||
*/
|
||||
//}
|
||||
// Normalize the hex string
|
||||
function toHex(value) {
|
||||
// For BN, call on the hex string
|
||||
|
4
packages/bignumber/fixednumber.d.ts
vendored
4
packages/bignumber/fixednumber.d.ts
vendored
@ -7,15 +7,15 @@ export declare class FixedFormat {
|
||||
readonly width: number;
|
||||
readonly decimals: number;
|
||||
readonly name: string;
|
||||
readonly _multiplier: BigNumber;
|
||||
readonly _multiplier: string;
|
||||
constructor(constructorGuard: any, signed: boolean, width: number, decimals: number);
|
||||
static from(value: any): FixedFormat;
|
||||
static isInstance(value: any): value is FixedFormat;
|
||||
}
|
||||
export declare class FixedNumber {
|
||||
readonly format: FixedFormat;
|
||||
readonly _hex: string;
|
||||
readonly _value: string;
|
||||
readonly _isFixedNumber: boolean;
|
||||
constructor(constructorGuard: any, hex: string, value: string, format?: FixedFormat);
|
||||
_checkFormat(other: FixedNumber): void;
|
||||
addUnsafe(other: FixedNumber): FixedNumber;
|
||||
|
@ -9,7 +9,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var bignumber_1 = require("./bignumber");
|
||||
var _constructorGuard = {};
|
||||
var Zero = bignumber_1.BigNumber.from(0);
|
||||
@ -114,12 +113,12 @@ function parseFixed(value, decimals) {
|
||||
exports.parseFixed = parseFixed;
|
||||
var FixedFormat = /** @class */ (function () {
|
||||
function FixedFormat(constructorGuard, signed, width, decimals) {
|
||||
properties_1.defineReadOnly(this, "signed", signed);
|
||||
properties_1.defineReadOnly(this, "width", width);
|
||||
properties_1.defineReadOnly(this, "decimals", decimals);
|
||||
var name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
||||
properties_1.defineReadOnly(this, "name", name);
|
||||
properties_1.defineReadOnly(this, "_multiplier", getMultiplier(decimals));
|
||||
this.signed = signed;
|
||||
this.width = width;
|
||||
this.decimals = decimals;
|
||||
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
||||
this._multiplier = getMultiplier(decimals);
|
||||
Object.freeze(this);
|
||||
}
|
||||
FixedFormat.from = function (value) {
|
||||
if (value instanceof FixedFormat) {
|
||||
@ -167,9 +166,6 @@ var FixedFormat = /** @class */ (function () {
|
||||
}
|
||||
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
||||
};
|
||||
FixedFormat.isInstance = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
};
|
||||
return FixedFormat;
|
||||
}());
|
||||
exports.FixedFormat = FixedFormat;
|
||||
@ -177,9 +173,11 @@ var FixedNumber = /** @class */ (function () {
|
||||
function FixedNumber(constructorGuard, hex, value, format) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, FixedNumber);
|
||||
properties_1.defineReadOnly(this, 'format', format);
|
||||
properties_1.defineReadOnly(this, '_hex', hex);
|
||||
properties_1.defineReadOnly(this, '_value', value);
|
||||
this.format = format;
|
||||
this._hex = hex;
|
||||
this._value = value;
|
||||
this._isFixedNumber = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
FixedNumber.prototype._checkFormat = function (other) {
|
||||
if (this.format.name !== other.format.name) {
|
||||
@ -246,7 +244,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
};
|
||||
FixedNumber.fromValue = function (value, decimals, format) {
|
||||
// If decimals looks more like a format, and there is no format, shift the parameters
|
||||
if (format == null && decimals != null && (FixedFormat.isInstance(decimals) || typeof (decimals) === "string")) {
|
||||
if (format == null && decimals != null && !bignumber_1.isBigNumberish(decimals)) {
|
||||
format = decimals;
|
||||
decimals = null;
|
||||
}
|
||||
@ -256,14 +254,13 @@ var FixedNumber = /** @class */ (function () {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
return FixedNumber.fromString(formatFixed(value, decimals), fixedFormat);
|
||||
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
||||
};
|
||||
FixedNumber.fromString = function (value, format) {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
var fixedFormat = FixedFormat.from(format);
|
||||
var numeric = parseFixed(value, fixedFormat.decimals);
|
||||
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
||||
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
||||
@ -283,7 +280,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
var fixedFormat = FixedFormat.from(format);
|
||||
if (bytes_1.arrayify(value).length > fixedFormat.width / 8) {
|
||||
throw new Error("overflow");
|
||||
}
|
||||
@ -314,7 +311,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
return errors.throwArgumentError("invalid FixedNumber value", "value", value);
|
||||
};
|
||||
FixedNumber.isFixedNumber = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
return !!(value && value._isFixedNumber);
|
||||
};
|
||||
return FixedNumber;
|
||||
}());
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/bignumber",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "BigNumber library used in ethers.js.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -22,5 +22,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xbb5426f664ba919d5668ddde9f13255ef77278a2e556f4d64f9be1089f5947c0"
|
||||
"tarballHash": "0x14d337214e2bbf81c9fcb5ac33573db3e26649e457324e63ec016acae5b681e6"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
2
packages/contracts/_version.d.ts
vendored
2
packages/contracts/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.129";
|
||||
export declare const version = "5.0.0-beta.130";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.129";
|
||||
exports.version = "5.0.0-beta.130";
|
||||
|
@ -305,11 +305,11 @@ var Contract = /** @class */ (function () {
|
||||
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
|
||||
//address = getAddress(address);
|
||||
properties_1.defineReadOnly(this, "interface", _newTarget.getInterface(contractInterface));
|
||||
if (properties_1.isNamedInstance(abstract_signer_1.Signer, signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider.provider);
|
||||
if (abstract_signer_1.Signer.isSigner(signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider.provider || null);
|
||||
properties_1.defineReadOnly(this, "signer", signerOrProvider);
|
||||
}
|
||||
else if (properties_1.isNamedInstance(abstract_provider_1.Provider, signerOrProvider)) {
|
||||
else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider);
|
||||
properties_1.defineReadOnly(this, "signer", null);
|
||||
}
|
||||
@ -380,7 +380,7 @@ var Contract = /** @class */ (function () {
|
||||
return address_1.getContractAddress(transaction);
|
||||
};
|
||||
Contract.getInterface = function (contractInterface) {
|
||||
if (properties_1.isNamedInstance(abi_1.Interface, contractInterface)) {
|
||||
if (abi_1.Interface.isInterface(contractInterface)) {
|
||||
return contractInterface;
|
||||
}
|
||||
return new abi_1.Interface(contractInterface);
|
||||
@ -452,7 +452,7 @@ var Contract = /** @class */ (function () {
|
||||
return new (this.constructor)(addressOrName, this.interface, this.signer || this.provider);
|
||||
};
|
||||
Contract.isIndexed = function (value) {
|
||||
return properties_1.isNamedInstance(abi_1.Indexed, value);
|
||||
return abi_1.Indexed.isIndexed(value);
|
||||
};
|
||||
Contract.prototype._normalizeRunningEvent = function (runningEvent) {
|
||||
// Already have an instance of this event running; we can re-use it
|
||||
@ -671,7 +671,7 @@ var ContractFactory = /** @class */ (function () {
|
||||
errors.throwArgumentError("invalid bytecode", "bytecode", bytecode);
|
||||
}
|
||||
// If we have a signer, make sure it is valid
|
||||
if (signer && !properties_1.isNamedInstance(abstract_signer_1.Signer, signer)) {
|
||||
if (signer && !abstract_signer_1.Signer.isSigner(signer)) {
|
||||
errors.throwArgumentError("invalid signer", "signer", signer);
|
||||
}
|
||||
properties_1.defineReadOnly(this, "bytecode", bytecodeHex);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/contracts",
|
||||
"version": "5.0.0-beta.129",
|
||||
"version": "5.0.0-beta.130",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -27,5 +27,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xfaeb83e9f09a5df78ce1c180a51b9f1f68b1755aa5c6e69def4aae8dcc21cba7"
|
||||
"tarballHash": "0x5939868ba342104ef0c61f44d620d31dd68666d54dbe4388ad44365ad13a9362"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.129";
|
||||
export const version = "5.0.0-beta.130";
|
||||
|
2
packages/ethers/_version.d.ts
vendored
2
packages/ethers/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.138";
|
||||
export declare const version = "5.0.0-beta.139";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.138";
|
||||
exports.version = "5.0.0-beta.139";
|
||||
|
365
packages/ethers/dist/ethers.js
vendored
365
packages/ethers/dist/ethers.js
vendored
@ -9855,6 +9855,8 @@ var ParamType = /** @class */ (function () {
|
||||
baseType: ((this.components != null) ? "tuple" : this.type)
|
||||
});
|
||||
}
|
||||
this._isParamType = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
// Format the parameter fragment
|
||||
// - non-expanded: "(uint256,address)"
|
||||
@ -9894,7 +9896,7 @@ var ParamType = /** @class */ (function () {
|
||||
return ParamType.fromObject(value);
|
||||
};
|
||||
ParamType.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(ParamType, value)) {
|
||||
if (ParamType.isParamType(value)) {
|
||||
return value;
|
||||
}
|
||||
return new ParamType(_constructorGuard, {
|
||||
@ -9915,6 +9917,9 @@ var ParamType = /** @class */ (function () {
|
||||
}
|
||||
return ParamTypify(parseParamType(value, !!allowIndexed));
|
||||
};
|
||||
ParamType.isParamType = function (value) {
|
||||
return !!(value != null && value._isParamType);
|
||||
};
|
||||
return ParamType;
|
||||
}());
|
||||
exports.ParamType = ParamType;
|
||||
@ -9928,6 +9933,8 @@ var Fragment = /** @class */ (function () {
|
||||
throw new Error("use a static from method");
|
||||
}
|
||||
populate(this, params);
|
||||
this._isFragment = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
// @TOOD: move logic to sub-classes; make this abstract
|
||||
Fragment.prototype.format = function (expanded) {
|
||||
@ -9958,13 +9965,16 @@ var Fragment = /** @class */ (function () {
|
||||
return result.trim();
|
||||
};
|
||||
Fragment.from = function (value) {
|
||||
if (Fragment.isFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (typeof (value) === "string") {
|
||||
return Fragment.fromString(value);
|
||||
}
|
||||
return Fragment.fromObject(value);
|
||||
};
|
||||
Fragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(Fragment, value)) {
|
||||
if (Fragment.isFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type === "function") {
|
||||
@ -10001,6 +10011,9 @@ var Fragment = /** @class */ (function () {
|
||||
}
|
||||
throw new Error("unknown fragment");
|
||||
};
|
||||
Fragment.isFragment = function (value) {
|
||||
return !!(value && value._isFragment);
|
||||
};
|
||||
return Fragment;
|
||||
}());
|
||||
exports.Fragment = Fragment;
|
||||
@ -10016,7 +10029,7 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
return EventFragment.fromObject(value);
|
||||
};
|
||||
EventFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(EventFragment, value)) {
|
||||
if (EventFragment.isEventFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "event") {
|
||||
@ -10053,6 +10066,9 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
type: "event"
|
||||
});
|
||||
};
|
||||
EventFragment.isEventFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "event");
|
||||
};
|
||||
return EventFragment;
|
||||
}(Fragment));
|
||||
exports.EventFragment = EventFragment;
|
||||
@ -10114,7 +10130,7 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
return ConstructorFragment.fromObject(value);
|
||||
};
|
||||
ConstructorFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(ConstructorFragment, value)) {
|
||||
if (ConstructorFragment.isConstructorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "constructor") {
|
||||
@ -10141,6 +10157,9 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
parseModifiers(parens[3].trim(), params);
|
||||
return ConstructorFragment.fromObject(params);
|
||||
};
|
||||
ConstructorFragment.isConstructorFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "constructor");
|
||||
};
|
||||
return ConstructorFragment;
|
||||
}(Fragment));
|
||||
exports.ConstructorFragment = ConstructorFragment;
|
||||
@ -10156,7 +10175,7 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
return FunctionFragment.fromObject(value);
|
||||
};
|
||||
FunctionFragment.fromObject = function (value) {
|
||||
if (properties_1.isNamedInstance(FunctionFragment, value)) {
|
||||
if (FunctionFragment.isFunctionFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "function") {
|
||||
@ -10203,6 +10222,9 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
}
|
||||
return FunctionFragment.fromObject(params);
|
||||
};
|
||||
FunctionFragment.isFunctionFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "function");
|
||||
};
|
||||
return FunctionFragment;
|
||||
}(ConstructorFragment));
|
||||
exports.FunctionFragment = FunctionFragment;
|
||||
@ -10334,6 +10356,9 @@ var Indexed = /** @class */ (function (_super) {
|
||||
function Indexed() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Indexed.isIndexed = function (value) {
|
||||
return !!(value && value._isIndexed);
|
||||
};
|
||||
return Indexed;
|
||||
}(properties_1.Description));
|
||||
exports.Indexed = Indexed;
|
||||
@ -10356,9 +10381,6 @@ var Interface = /** @class */ (function () {
|
||||
abi = fragments;
|
||||
}
|
||||
properties_1.defineReadOnly(this, "fragments", abi.map(function (fragment) {
|
||||
if (properties_1.isNamedInstance(fragments_1.Fragment, fragment)) {
|
||||
return fragment;
|
||||
}
|
||||
return fragments_1.Fragment.from(fragment);
|
||||
}).filter(function (fragment) { return (fragment != null); }));
|
||||
properties_1.defineReadOnly(this, "_abiCoder", _newTarget.getAbiCoder());
|
||||
@ -10409,6 +10431,7 @@ var Interface = /** @class */ (function () {
|
||||
if (!this.deploy) {
|
||||
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({ type: "constructor" }));
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_isInterface", true);
|
||||
}
|
||||
Interface.getAbiCoder = function () {
|
||||
return abi_coder_1.defaultAbiCoder;
|
||||
@ -10584,10 +10607,10 @@ var Interface = /** @class */ (function () {
|
||||
eventFragment.inputs.forEach(function (param, index) {
|
||||
if (param.indexed) {
|
||||
if (resultIndexed == null) {
|
||||
result[index] = new Indexed({ hash: null });
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: null });
|
||||
}
|
||||
else if (dynamic[index]) {
|
||||
result[index] = new Indexed({ hash: resultIndexed[indexedIndex++] });
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
||||
}
|
||||
else {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
@ -10628,6 +10651,20 @@ var Interface = /** @class */ (function () {
|
||||
values: this.decodeEventLog(fragment, log.data, log.topics)
|
||||
});
|
||||
};
|
||||
/*
|
||||
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
|
||||
if (Interface.isInterface(value)) {
|
||||
return value;
|
||||
}
|
||||
if (typeof(value) === "string") {
|
||||
return new Interface(JSON.parse(value));
|
||||
}
|
||||
return new Interface(value);
|
||||
}
|
||||
*/
|
||||
Interface.isInterface = function (value) {
|
||||
return !!(value && value._isInterface);
|
||||
};
|
||||
return Interface;
|
||||
}());
|
||||
exports.Interface = Interface;
|
||||
@ -10688,12 +10725,16 @@ var properties_1 = require("@ethersproject/properties");
|
||||
//export type CallTransactionable = {
|
||||
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
||||
//};
|
||||
var ForkEvent = /** @class */ (function () {
|
||||
function ForkEvent(expiry) {
|
||||
properties_1.defineReadOnly(this, "expiry", expiry || 0);
|
||||
var ForkEvent = /** @class */ (function (_super) {
|
||||
__extends(ForkEvent, _super);
|
||||
function ForkEvent() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ForkEvent.isForkEvent = function (value) {
|
||||
return !!(value && value._isForkEvent);
|
||||
};
|
||||
return ForkEvent;
|
||||
}());
|
||||
}(properties_1.Description));
|
||||
exports.ForkEvent = ForkEvent;
|
||||
var BlockForkEvent = /** @class */ (function (_super) {
|
||||
__extends(BlockForkEvent, _super);
|
||||
@ -10702,8 +10743,12 @@ var BlockForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(blockhash, 32)) {
|
||||
errors.throwArgumentError("invalid blockhash", "blockhash", blockhash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "blockhash", blockhash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isBlockForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
blockHash: blockhash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return BlockForkEvent;
|
||||
@ -10716,8 +10761,12 @@ var TransactionForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(hash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "hash", hash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "hash", hash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isTransactionForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
hash: hash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return TransactionForkEvent;
|
||||
@ -10733,9 +10782,13 @@ var TransactionOrderForkEvent = /** @class */ (function (_super) {
|
||||
if (!bytes_1.isHexString(afterHash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
||||
}
|
||||
_this = _super.call(this, expiry) || this;
|
||||
properties_1.defineReadOnly(_this, "beforeHash", beforeHash);
|
||||
properties_1.defineReadOnly(_this, "afterHash", afterHash);
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
_isTransactionOrderForkEvent: true,
|
||||
expiry: (expiry || 0),
|
||||
beforeHash: beforeHash,
|
||||
afterHash: afterHash
|
||||
}) || this;
|
||||
return _this;
|
||||
}
|
||||
return TransactionOrderForkEvent;
|
||||
@ -10747,6 +10800,7 @@ var Provider = /** @class */ (function () {
|
||||
function Provider() {
|
||||
var _newTarget = this.constructor;
|
||||
errors_1.checkAbstract(_newTarget, Provider);
|
||||
properties_1.defineReadOnly(this, "_isProvider", true);
|
||||
}
|
||||
// Alias for "on"
|
||||
Provider.prototype.addListener = function (eventName, listener) {
|
||||
@ -10756,6 +10810,9 @@ var Provider = /** @class */ (function () {
|
||||
Provider.prototype.removeListener = function (eventName, listener) {
|
||||
return this.off(eventName, listener);
|
||||
};
|
||||
Provider.isProvider = function (value) {
|
||||
return !!(value && value._isProvider);
|
||||
};
|
||||
return Provider;
|
||||
}());
|
||||
exports.Provider = Provider;
|
||||
@ -10800,6 +10857,7 @@ var Signer = /** @class */ (function () {
|
||||
function Signer() {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkAbstract(_newTarget, Signer);
|
||||
properties_1.defineReadOnly(this, "_isSigner", true);
|
||||
}
|
||||
///////////////////
|
||||
// Sub-classes MAY override these
|
||||
@ -10919,6 +10977,9 @@ var Signer = /** @class */ (function () {
|
||||
});
|
||||
}
|
||||
};
|
||||
Signer.isSigner = function (value) {
|
||||
return !!(value && value._isSigner);
|
||||
};
|
||||
return Signer;
|
||||
}());
|
||||
exports.Signer = Signer;
|
||||
@ -11261,19 +11322,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
*/
|
||||
var BN = __importStar(require("bn.js"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var _constructorGuard = {};
|
||||
var MAX_SAFE = 0x1fffffffffffff;
|
||||
/*
|
||||
export function isBigNumberLike(value: any): value is BigNumberish {
|
||||
return (BigNumber.isBigNumber(value) ||
|
||||
(!!((<any>value).toHexString)) ||
|
||||
isBytes(value) ||
|
||||
value.match(/^-?([0-9]+|0x[0-9a-f]+)$/i) ||
|
||||
typeof(value) === "number");
|
||||
function isBigNumberish(value) {
|
||||
return (value != null) && (BigNumber.isBigNumber(value) ||
|
||||
(typeof (value) === "number" && (value % 1) === 0) ||
|
||||
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
|
||||
bytes_1.isHexString(value) ||
|
||||
(typeof (value) === "bigint") ||
|
||||
bytes_1.isBytes(value));
|
||||
}
|
||||
*/
|
||||
exports.isBigNumberish = isBigNumberish;
|
||||
var BigNumber = /** @class */ (function () {
|
||||
function BigNumber(constructorGuard, hex) {
|
||||
var _newTarget = this.constructor;
|
||||
@ -11283,7 +11343,9 @@ var BigNumber = /** @class */ (function () {
|
||||
operation: "new (BigNumber)"
|
||||
});
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_hex", hex);
|
||||
this._hex = hex;
|
||||
this._isBigNumber = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
BigNumber.prototype.fromTwos = function (value) {
|
||||
return toBigNumber(toBN(this).fromTwos(value));
|
||||
@ -11399,101 +11461,11 @@ var BigNumber = /** @class */ (function () {
|
||||
return errors.throwArgumentError("invalid BigNumber value", "value", value);
|
||||
};
|
||||
BigNumber.isBigNumber = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
return !!(value && value._isBigNumber);
|
||||
};
|
||||
return BigNumber;
|
||||
}());
|
||||
exports.BigNumber = BigNumber;
|
||||
/*
|
||||
export function bigNumberify(value: BigNumberish): BigNumber {
|
||||
if (BigNumber.isBigNumber(value)) { return value; }
|
||||
return new BigNumber(value);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
function zeros(length) {
|
||||
let result = "";
|
||||
while (result.length < length) { tens += "0"; }
|
||||
return result;
|
||||
}
|
||||
export class FixedNumber {
|
||||
readonly value: BigNumber;
|
||||
readonly decimalPlaces: number;
|
||||
|
||||
constructor(value: BigNumberish, decimalPlaces: number) {
|
||||
defineReadOnly(this, "value", bigNumberify(value));
|
||||
defineReadOnly(this, "decimalPlaces", decimalPlaces);
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return formatUnits(this.value, this.decimalPlaces);
|
||||
}
|
||||
|
||||
static fromString(value: string): FixedNumber {
|
||||
let comps = value.split(".");
|
||||
let decimalPlaces = 0;
|
||||
if (comps.length === 2) { decimalPlaces = comps[1].length; }
|
||||
return new FixedNumber(parseUnits(value, decimalPlaces), decimalPlaces);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
||||
readonly negative: boolean;
|
||||
readonly whole: BigNumber;
|
||||
readonly fraction: BigNumber;
|
||||
constructor(whole: BigNumberish, fraction: BigNumberish, negative?: boolean) {
|
||||
if (whole.lt(constants.Zero)) {
|
||||
errors.throwError("whole component must be positive", errors.INVALID_ARGUMENT, {
|
||||
argument: whole,
|
||||
value: whole
|
||||
});
|
||||
}
|
||||
defineReadOnly(this, "whole", bigNumberify(whole));
|
||||
defineReadOnly(this, "fraction", bigNumberify(fraction));
|
||||
defineReadOnly(this, "negative", !!boolean);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
toHexString(bitWidth?: number, decimalPlaces?: number, signed?: boolean): string {
|
||||
if (bitWidth == null) { bitWidth = 128; }
|
||||
if (decimalPlaces == null) { decimalPlaces = 18; }
|
||||
if (signed == null) { signed = true; }
|
||||
return null;
|
||||
}
|
||||
static fromValue(value: BigNumberish, decimalPlaces: number): FixedNumber {
|
||||
let negative = false;
|
||||
if (value.lt(constants.Zero)) {
|
||||
negative = true;
|
||||
value = value.abs();
|
||||
}
|
||||
let tens = bigNumberify("1" + zeros(decimalPlaces));
|
||||
return new FixedNumber(value.divide(tens), value.mod(tens), negative);
|
||||
}
|
||||
let negative = false;
|
||||
if (value.substring(0, 1) === "-") {
|
||||
negative = true;
|
||||
value = value.substring(1);
|
||||
}
|
||||
|
||||
if (value !== "." && value !== "") {
|
||||
let comps = value.split(".");
|
||||
if (comps.length === 1) {
|
||||
return new FixedNumber(comps[0], 0, negative);
|
||||
} else if (comps.length === 2) {
|
||||
if (comps[0] === "") { comps[0] = "0"; }
|
||||
if (comps[1] === "") { comps[1] = "0"; }
|
||||
return new FixedNumber(comps[0], comps[1], negative);
|
||||
}
|
||||
}
|
||||
|
||||
errors.throwError("invalid fixed-point value", errors.INVALID_ARGUMENT, {
|
||||
argument: "value",
|
||||
value: value
|
||||
});
|
||||
|
||||
return null;
|
||||
*/
|
||||
//}
|
||||
// Normalize the hex string
|
||||
function toHex(value) {
|
||||
// For BN, call on the hex string
|
||||
@ -11553,7 +11525,7 @@ function throwFault(fault, operation, value) {
|
||||
return errors.throwError(fault, errors.NUMERIC_FAULT, params);
|
||||
}
|
||||
|
||||
},{"@ethersproject/bytes":63,"@ethersproject/errors":66,"@ethersproject/properties":82,"bn.js":2}],61:[function(require,module,exports){
|
||||
},{"@ethersproject/bytes":63,"@ethersproject/errors":66,"bn.js":2}],61:[function(require,module,exports){
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
@ -11565,7 +11537,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var bignumber_1 = require("./bignumber");
|
||||
var _constructorGuard = {};
|
||||
var Zero = bignumber_1.BigNumber.from(0);
|
||||
@ -11670,12 +11641,12 @@ function parseFixed(value, decimals) {
|
||||
exports.parseFixed = parseFixed;
|
||||
var FixedFormat = /** @class */ (function () {
|
||||
function FixedFormat(constructorGuard, signed, width, decimals) {
|
||||
properties_1.defineReadOnly(this, "signed", signed);
|
||||
properties_1.defineReadOnly(this, "width", width);
|
||||
properties_1.defineReadOnly(this, "decimals", decimals);
|
||||
var name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
||||
properties_1.defineReadOnly(this, "name", name);
|
||||
properties_1.defineReadOnly(this, "_multiplier", getMultiplier(decimals));
|
||||
this.signed = signed;
|
||||
this.width = width;
|
||||
this.decimals = decimals;
|
||||
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
|
||||
this._multiplier = getMultiplier(decimals);
|
||||
Object.freeze(this);
|
||||
}
|
||||
FixedFormat.from = function (value) {
|
||||
if (value instanceof FixedFormat) {
|
||||
@ -11723,9 +11694,6 @@ var FixedFormat = /** @class */ (function () {
|
||||
}
|
||||
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
||||
};
|
||||
FixedFormat.isInstance = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
};
|
||||
return FixedFormat;
|
||||
}());
|
||||
exports.FixedFormat = FixedFormat;
|
||||
@ -11733,9 +11701,11 @@ var FixedNumber = /** @class */ (function () {
|
||||
function FixedNumber(constructorGuard, hex, value, format) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, FixedNumber);
|
||||
properties_1.defineReadOnly(this, 'format', format);
|
||||
properties_1.defineReadOnly(this, '_hex', hex);
|
||||
properties_1.defineReadOnly(this, '_value', value);
|
||||
this.format = format;
|
||||
this._hex = hex;
|
||||
this._value = value;
|
||||
this._isFixedNumber = true;
|
||||
Object.freeze(this);
|
||||
}
|
||||
FixedNumber.prototype._checkFormat = function (other) {
|
||||
if (this.format.name !== other.format.name) {
|
||||
@ -11802,7 +11772,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
};
|
||||
FixedNumber.fromValue = function (value, decimals, format) {
|
||||
// If decimals looks more like a format, and there is no format, shift the parameters
|
||||
if (format == null && decimals != null && (FixedFormat.isInstance(decimals) || typeof (decimals) === "string")) {
|
||||
if (format == null && decimals != null && !bignumber_1.isBigNumberish(decimals)) {
|
||||
format = decimals;
|
||||
decimals = null;
|
||||
}
|
||||
@ -11812,14 +11782,13 @@ var FixedNumber = /** @class */ (function () {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
return FixedNumber.fromString(formatFixed(value, decimals), fixedFormat);
|
||||
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
|
||||
};
|
||||
FixedNumber.fromString = function (value, format) {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
var fixedFormat = FixedFormat.from(format);
|
||||
var numeric = parseFixed(value, fixedFormat.decimals);
|
||||
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
||||
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
||||
@ -11839,7 +11808,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format));
|
||||
var fixedFormat = FixedFormat.from(format);
|
||||
if (bytes_1.arrayify(value).length > fixedFormat.width / 8) {
|
||||
throw new Error("overflow");
|
||||
}
|
||||
@ -11870,13 +11839,13 @@ var FixedNumber = /** @class */ (function () {
|
||||
return errors.throwArgumentError("invalid FixedNumber value", "value", value);
|
||||
};
|
||||
FixedNumber.isFixedNumber = function (value) {
|
||||
return properties_1.isNamedInstance(this, value);
|
||||
return !!(value && value._isFixedNumber);
|
||||
};
|
||||
return FixedNumber;
|
||||
}());
|
||||
exports.FixedNumber = FixedNumber;
|
||||
|
||||
},{"./bignumber":60,"@ethersproject/bytes":63,"@ethersproject/errors":66,"@ethersproject/properties":82}],62:[function(require,module,exports){
|
||||
},{"./bignumber":60,"@ethersproject/bytes":63,"@ethersproject/errors":66}],62:[function(require,module,exports){
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bignumber_1 = require("./bignumber");
|
||||
@ -12605,11 +12574,11 @@ var Contract = /** @class */ (function () {
|
||||
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
|
||||
//address = getAddress(address);
|
||||
properties_1.defineReadOnly(this, "interface", _newTarget.getInterface(contractInterface));
|
||||
if (properties_1.isNamedInstance(abstract_signer_1.Signer, signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider.provider);
|
||||
if (abstract_signer_1.Signer.isSigner(signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider.provider || null);
|
||||
properties_1.defineReadOnly(this, "signer", signerOrProvider);
|
||||
}
|
||||
else if (properties_1.isNamedInstance(abstract_provider_1.Provider, signerOrProvider)) {
|
||||
else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) {
|
||||
properties_1.defineReadOnly(this, "provider", signerOrProvider);
|
||||
properties_1.defineReadOnly(this, "signer", null);
|
||||
}
|
||||
@ -12680,7 +12649,7 @@ var Contract = /** @class */ (function () {
|
||||
return address_1.getContractAddress(transaction);
|
||||
};
|
||||
Contract.getInterface = function (contractInterface) {
|
||||
if (properties_1.isNamedInstance(abi_1.Interface, contractInterface)) {
|
||||
if (abi_1.Interface.isInterface(contractInterface)) {
|
||||
return contractInterface;
|
||||
}
|
||||
return new abi_1.Interface(contractInterface);
|
||||
@ -12752,7 +12721,7 @@ var Contract = /** @class */ (function () {
|
||||
return new (this.constructor)(addressOrName, this.interface, this.signer || this.provider);
|
||||
};
|
||||
Contract.isIndexed = function (value) {
|
||||
return properties_1.isNamedInstance(abi_1.Indexed, value);
|
||||
return abi_1.Indexed.isIndexed(value);
|
||||
};
|
||||
Contract.prototype._normalizeRunningEvent = function (runningEvent) {
|
||||
// Already have an instance of this event running; we can re-use it
|
||||
@ -12971,7 +12940,7 @@ var ContractFactory = /** @class */ (function () {
|
||||
errors.throwArgumentError("invalid bytecode", "bytecode", bytecode);
|
||||
}
|
||||
// If we have a signer, make sure it is valid
|
||||
if (signer && !properties_1.isNamedInstance(abstract_signer_1.Signer, signer)) {
|
||||
if (signer && !abstract_signer_1.Signer.isSigner(signer)) {
|
||||
errors.throwArgumentError("invalid signer", "signer", signer);
|
||||
}
|
||||
properties_1.defineReadOnly(this, "bytecode", bytecodeHex);
|
||||
@ -13328,7 +13297,7 @@ exports.info = info;
|
||||
},{}],67:[function(require,module,exports){
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.138";
|
||||
exports.version = "5.0.0-beta.139";
|
||||
|
||||
},{}],68:[function(require,module,exports){
|
||||
"use strict";
|
||||
@ -13503,6 +13472,7 @@ var wallet_1 = require("@ethersproject/wallet");
|
||||
exports.verifyMessage = wallet_1.verifyMessage;
|
||||
var web_1 = require("@ethersproject/web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var sha2_2 = require("@ethersproject/sha2");
|
||||
@ -13931,8 +13901,8 @@ var CrowdsaleAccount = /** @class */ (function (_super) {
|
||||
function CrowdsaleAccount() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
CrowdsaleAccount.prototype.isType = function (value) {
|
||||
return properties_1.Description.isType(value);
|
||||
CrowdsaleAccount.prototype.isCrowdsaleAccount = function (value) {
|
||||
return !!(value && value._isCrowdsaleAccount);
|
||||
};
|
||||
return CrowdsaleAccount;
|
||||
}(properties_1.Description));
|
||||
@ -13966,6 +13936,7 @@ function decrypt(json, password) {
|
||||
var seedHexBytes = strings_1.toUtf8Bytes(seedHex);
|
||||
var privateKey = keccak256_1.keccak256(seedHexBytes);
|
||||
return new CrowdsaleAccount({
|
||||
_isCrowdsaleAccount: true,
|
||||
address: ethaddr,
|
||||
privateKey: privateKey
|
||||
});
|
||||
@ -14093,8 +14064,8 @@ var KeystoreAccount = /** @class */ (function (_super) {
|
||||
function KeystoreAccount() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
KeystoreAccount.prototype.isType = function (value) {
|
||||
return properties_1.Description.isType(value);
|
||||
KeystoreAccount.prototype.isKeystoreAccount = function (value) {
|
||||
return !!(value && value._isKeystoreAccount);
|
||||
};
|
||||
return KeystoreAccount;
|
||||
}(properties_1.Description));
|
||||
@ -14140,6 +14111,7 @@ function decrypt(json, password, progressCallback) {
|
||||
}
|
||||
catch (e) { }
|
||||
var account = {
|
||||
_isKeystoreAccount: true,
|
||||
address: address,
|
||||
privateKey: bytes_1.hexlify(privateKey)
|
||||
};
|
||||
@ -14725,46 +14697,6 @@ function defineReadOnly(object, name, value) {
|
||||
});
|
||||
}
|
||||
exports.defineReadOnly = defineReadOnly;
|
||||
// There are some issues with instanceof with npm link, so we use this
|
||||
// to ensure types are what we expect. We use this for a little extra
|
||||
// protection to make sure the correct types are being passed around.
|
||||
function getType(object) {
|
||||
var type = typeof (object);
|
||||
if (type !== "function") {
|
||||
return null;
|
||||
}
|
||||
var types = [];
|
||||
var obj = object;
|
||||
while (true) {
|
||||
var type_1 = obj.name;
|
||||
if (!type_1) {
|
||||
break;
|
||||
}
|
||||
types.push(type_1);
|
||||
obj = Object.getPrototypeOf(obj);
|
||||
}
|
||||
return types.join(" ");
|
||||
}
|
||||
function hasSuffix(text, suffix) {
|
||||
return text.substring(text.length - suffix.length) === suffix;
|
||||
}
|
||||
function isNamedInstance(type, value) {
|
||||
var name = getType(type);
|
||||
if (!name) {
|
||||
return false;
|
||||
}
|
||||
// Not a string...
|
||||
if (typeof (value) !== "string") {
|
||||
// Not an instance...
|
||||
if (typeof (value) !== "object") {
|
||||
return false;
|
||||
}
|
||||
// Get the instance type
|
||||
value = getType(value.constructor);
|
||||
}
|
||||
return (name === value || hasSuffix(value, " " + name));
|
||||
}
|
||||
exports.isNamedInstance = isNamedInstance;
|
||||
function resolveProperties(object) {
|
||||
var result = {};
|
||||
var promises = [];
|
||||
@ -14811,29 +14743,21 @@ function shallowCopy(object) {
|
||||
return result;
|
||||
}
|
||||
exports.shallowCopy = shallowCopy;
|
||||
var opaque = { boolean: true, number: true, string: true };
|
||||
function deepCopy(object, frozen) {
|
||||
var opaque = { bigint: true, boolean: true, number: true, string: true };
|
||||
// Returns a new copy of object, such that no properties may be replaced.
|
||||
// New properties may be added only to objects.
|
||||
function deepCopy(object) {
|
||||
// Opaque objects are not mutable, so safe to copy by assignment
|
||||
if (object === undefined || object === null || opaque[typeof (object)]) {
|
||||
return object;
|
||||
}
|
||||
// Arrays are mutable, so we need to create a copy
|
||||
if (Array.isArray(object)) {
|
||||
var result = object.map(function (item) { return deepCopy(item, frozen); });
|
||||
if (frozen) {
|
||||
Object.freeze(result);
|
||||
}
|
||||
return result;
|
||||
return Object.freeze(object.map(function (item) { return deepCopy(item); }));
|
||||
}
|
||||
if (typeof (object) === "object") {
|
||||
// Some internal objects, which are already immutable
|
||||
if (isNamedInstance("BigNumber", object)) {
|
||||
return object;
|
||||
}
|
||||
if (isNamedInstance("Description", object)) {
|
||||
return object;
|
||||
}
|
||||
if (isNamedInstance("Indexed", object)) {
|
||||
// Immutable objects are safe to just use
|
||||
if (Object.isFrozen(object)) {
|
||||
return object;
|
||||
}
|
||||
var result = {};
|
||||
@ -14842,10 +14766,7 @@ function deepCopy(object, frozen) {
|
||||
if (value === undefined) {
|
||||
continue;
|
||||
}
|
||||
defineReadOnly(result, key, deepCopy(value, frozen));
|
||||
}
|
||||
if (frozen) {
|
||||
Object.freeze(result);
|
||||
defineReadOnly(result, key, deepCopy(value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -14859,13 +14780,10 @@ exports.deepCopy = deepCopy;
|
||||
var Description = /** @class */ (function () {
|
||||
function Description(info) {
|
||||
for (var key in info) {
|
||||
defineReadOnly(this, key, deepCopy(info[key], true));
|
||||
this[key] = deepCopy(info[key]);
|
||||
}
|
||||
Object.freeze(this);
|
||||
}
|
||||
Description.isType = function (value) {
|
||||
return isNamedInstance(this, value);
|
||||
};
|
||||
return Description;
|
||||
}());
|
||||
exports.Description = Description;
|
||||
@ -15022,7 +14940,7 @@ function getEventTag(eventName) {
|
||||
else if (Array.isArray(eventName)) {
|
||||
return "filter:*:" + serializeTopics(eventName);
|
||||
}
|
||||
else if (properties_1.isNamedInstance(abstract_provider_1.ForkEvent, eventName)) {
|
||||
else if (abstract_provider_1.ForkEvent.isForkEvent(eventName)) {
|
||||
errors.warn("not implemented");
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
@ -17828,6 +17746,7 @@ var SigningKey = /** @class */ (function () {
|
||||
var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));
|
||||
properties_1.defineReadOnly(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
||||
properties_1.defineReadOnly(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
||||
properties_1.defineReadOnly(this, "_isSigningKey", true);
|
||||
}
|
||||
SigningKey.prototype._addPoint = function (other) {
|
||||
var p0 = getCurve().keyFromPublic(bytes_1.arrayify(this.publicKey));
|
||||
@ -17848,6 +17767,9 @@ var SigningKey = /** @class */ (function () {
|
||||
var otherKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(computePublicKey(otherKey)));
|
||||
return bytes_1.hexZeroPad("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
||||
};
|
||||
SigningKey.isSigningKey = function (value) {
|
||||
return !!(value && value._isSigningKey);
|
||||
};
|
||||
return SigningKey;
|
||||
}());
|
||||
exports.SigningKey = SigningKey;
|
||||
@ -18480,7 +18402,10 @@ var Wallet = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (properties_1.isNamedInstance(signing_key_1.SigningKey, privateKey)) {
|
||||
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||
if (privateKey.curve !== "secp256k1") {
|
||||
errors.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]");
|
||||
}
|
||||
properties_1.defineReadOnly(_this, "_signingKey", function () { return privateKey; });
|
||||
}
|
||||
else {
|
||||
@ -18491,7 +18416,7 @@ var Wallet = /** @class */ (function (_super) {
|
||||
properties_1.defineReadOnly(_this, "path", null);
|
||||
properties_1.defineReadOnly(_this, "address", transactions_1.computeAddress(_this.publicKey));
|
||||
}
|
||||
if (provider && !properties_1.isNamedInstance(abstract_provider_1.Provider, provider)) {
|
||||
if (provider && !abstract_provider_1.Provider.isProvider(provider)) {
|
||||
errors.throwError("invalid provider", errors.INVALID_ARGUMENT, {
|
||||
argument: "provider",
|
||||
value: provider
|
||||
|
2
packages/ethers/dist/ethers.min.js
vendored
2
packages/ethers/dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "5.0.0-beta.138",
|
||||
"version": "5.0.0-beta.139",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -56,5 +56,5 @@
|
||||
"publishConfig": {
|
||||
"tag": "next"
|
||||
},
|
||||
"tarballHash": "0xef52885515a9a06622a97875560ac417533a0a6584f580cfed7a2db0a8e4b1f6"
|
||||
"tarballHash": "0x2a6459106b3718a13c0e581398148a6b70d52141688b6e87ab072eca1c11131e"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.138";
|
||||
export const version = "5.0.0-beta.139";
|
||||
|
4
packages/ethers/utils.d.ts
vendored
4
packages/ethers/utils.d.ts
vendored
@ -16,11 +16,11 @@ import { formatBytes32String, parseBytes32String, toUtf8Bytes, toUtf8String } fr
|
||||
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
|
||||
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
|
||||
import { verifyMessage } from "@ethersproject/wallet";
|
||||
import { fetchJson } from "@ethersproject/web";
|
||||
import { fetchJson, poll } from "@ethersproject/web";
|
||||
import { SupportedAlgorithms } from "@ethersproject/sha2";
|
||||
import { UnicodeNormalizationForm } from "@ethersproject/strings";
|
||||
import { CoerceFunc } from "@ethersproject/abi";
|
||||
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
|
||||
import { ConnectionInfo, OnceBlockable, PollOptions } from "@ethersproject/web";
|
||||
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, RLP, fetchJson, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback };
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback };
|
||||
|
@ -91,6 +91,7 @@ var wallet_1 = require("@ethersproject/wallet");
|
||||
exports.verifyMessage = wallet_1.verifyMessage;
|
||||
var web_1 = require("@ethersproject/web");
|
||||
exports.fetchJson = web_1.fetchJson;
|
||||
exports.poll = web_1.poll;
|
||||
////////////////////////
|
||||
// Enums
|
||||
var sha2_2 = require("@ethersproject/sha2");
|
||||
|
2
packages/json-wallets/_version.d.ts
vendored
2
packages/json-wallets/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.124";
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.124";
|
||||
exports.version = "5.0.0-beta.125";
|
||||
|
3
packages/json-wallets/crowdsale.d.ts
vendored
3
packages/json-wallets/crowdsale.d.ts
vendored
@ -6,6 +6,7 @@ export declare class CrowdsaleAccount extends Description implements ExternallyO
|
||||
readonly privateKey: string;
|
||||
readonly mnemonic?: string;
|
||||
readonly path?: string;
|
||||
isType(value: any): value is CrowdsaleAccount;
|
||||
readonly _isCrowdsaleAccount: boolean;
|
||||
isCrowdsaleAccount(value: any): value is CrowdsaleAccount;
|
||||
}
|
||||
export declare function decrypt(json: string, password: Bytes | string): ExternallyOwnedAccount;
|
||||
|
@ -37,8 +37,8 @@ var CrowdsaleAccount = /** @class */ (function (_super) {
|
||||
function CrowdsaleAccount() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
CrowdsaleAccount.prototype.isType = function (value) {
|
||||
return properties_1.Description.isType(value);
|
||||
CrowdsaleAccount.prototype.isCrowdsaleAccount = function (value) {
|
||||
return !!(value && value._isCrowdsaleAccount);
|
||||
};
|
||||
return CrowdsaleAccount;
|
||||
}(properties_1.Description));
|
||||
@ -72,6 +72,7 @@ function decrypt(json, password) {
|
||||
var seedHexBytes = strings_1.toUtf8Bytes(seedHex);
|
||||
var privateKey = keccak256_1.keccak256(seedHexBytes);
|
||||
return new CrowdsaleAccount({
|
||||
_isCrowdsaleAccount: true,
|
||||
address: ethaddr,
|
||||
privateKey: privateKey
|
||||
});
|
||||
|
3
packages/json-wallets/keystore.d.ts
vendored
3
packages/json-wallets/keystore.d.ts
vendored
@ -6,7 +6,8 @@ export declare class KeystoreAccount extends Description implements ExternallyOw
|
||||
readonly privateKey: string;
|
||||
readonly mnemonic?: string;
|
||||
readonly path?: string;
|
||||
isType(value: any): value is KeystoreAccount;
|
||||
readonly _isKeystoreAccount: boolean;
|
||||
isKeystoreAccount(value: any): value is KeystoreAccount;
|
||||
}
|
||||
export declare type ProgressCallback = (percent: number) => void;
|
||||
export declare type EncryptOptions = {
|
||||
|
@ -34,8 +34,8 @@ var KeystoreAccount = /** @class */ (function (_super) {
|
||||
function KeystoreAccount() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
KeystoreAccount.prototype.isType = function (value) {
|
||||
return properties_1.Description.isType(value);
|
||||
KeystoreAccount.prototype.isKeystoreAccount = function (value) {
|
||||
return !!(value && value._isKeystoreAccount);
|
||||
};
|
||||
return KeystoreAccount;
|
||||
}(properties_1.Description));
|
||||
@ -81,6 +81,7 @@ function decrypt(json, password, progressCallback) {
|
||||
}
|
||||
catch (e) { }
|
||||
var account = {
|
||||
_isKeystoreAccount: true,
|
||||
address: address,
|
||||
privateKey: bytes_1.hexlify(privateKey)
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/json-wallets",
|
||||
"version": "5.0.0-beta.124",
|
||||
"version": "5.0.0-beta.125",
|
||||
"description": "Wallet management utilities for KeyStore and Crowdsale JSON wallets.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -31,5 +31,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x4d9580ee8583276571285078677d76242e93047965013975d7c335e5aa97a3ac"
|
||||
"tarballHash": "0x35570cafbf9fb9db5ec66349d16e14d327c98c60ae2ecf4d5a3c084c274a5dad"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.124";
|
||||
export const version = "5.0.0-beta.125";
|
||||
|
2
packages/properties/_version.d.ts
vendored
2
packages/properties/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
4
packages/properties/index.d.ts
vendored
4
packages/properties/index.d.ts
vendored
@ -1,12 +1,10 @@
|
||||
export declare function defineReadOnly(object: any, name: string, value: any): void;
|
||||
export declare function isNamedInstance<T>(type: Function | string, value: any): value is T;
|
||||
export declare function resolveProperties(object: any): Promise<any>;
|
||||
export declare function checkProperties(object: any, properties: {
|
||||
[name: string]: boolean;
|
||||
}): void;
|
||||
export declare function shallowCopy(object: any): any;
|
||||
export declare function deepCopy(object: any, frozen?: boolean): any;
|
||||
export declare function deepCopy(object: any): any;
|
||||
export declare class Description {
|
||||
constructor(info: any);
|
||||
static isType(value: any): boolean;
|
||||
}
|
||||
|
@ -16,46 +16,6 @@ function defineReadOnly(object, name, value) {
|
||||
});
|
||||
}
|
||||
exports.defineReadOnly = defineReadOnly;
|
||||
// There are some issues with instanceof with npm link, so we use this
|
||||
// to ensure types are what we expect. We use this for a little extra
|
||||
// protection to make sure the correct types are being passed around.
|
||||
function getType(object) {
|
||||
var type = typeof (object);
|
||||
if (type !== "function") {
|
||||
return null;
|
||||
}
|
||||
var types = [];
|
||||
var obj = object;
|
||||
while (true) {
|
||||
var type_1 = obj.name;
|
||||
if (!type_1) {
|
||||
break;
|
||||
}
|
||||
types.push(type_1);
|
||||
obj = Object.getPrototypeOf(obj);
|
||||
}
|
||||
return types.join(" ");
|
||||
}
|
||||
function hasSuffix(text, suffix) {
|
||||
return text.substring(text.length - suffix.length) === suffix;
|
||||
}
|
||||
function isNamedInstance(type, value) {
|
||||
var name = getType(type);
|
||||
if (!name) {
|
||||
return false;
|
||||
}
|
||||
// Not a string...
|
||||
if (typeof (value) !== "string") {
|
||||
// Not an instance...
|
||||
if (typeof (value) !== "object") {
|
||||
return false;
|
||||
}
|
||||
// Get the instance type
|
||||
value = getType(value.constructor);
|
||||
}
|
||||
return (name === value || hasSuffix(value, " " + name));
|
||||
}
|
||||
exports.isNamedInstance = isNamedInstance;
|
||||
function resolveProperties(object) {
|
||||
var result = {};
|
||||
var promises = [];
|
||||
@ -102,29 +62,21 @@ function shallowCopy(object) {
|
||||
return result;
|
||||
}
|
||||
exports.shallowCopy = shallowCopy;
|
||||
var opaque = { boolean: true, number: true, string: true };
|
||||
function deepCopy(object, frozen) {
|
||||
var opaque = { bigint: true, boolean: true, number: true, string: true };
|
||||
// Returns a new copy of object, such that no properties may be replaced.
|
||||
// New properties may be added only to objects.
|
||||
function deepCopy(object) {
|
||||
// Opaque objects are not mutable, so safe to copy by assignment
|
||||
if (object === undefined || object === null || opaque[typeof (object)]) {
|
||||
return object;
|
||||
}
|
||||
// Arrays are mutable, so we need to create a copy
|
||||
if (Array.isArray(object)) {
|
||||
var result = object.map(function (item) { return deepCopy(item, frozen); });
|
||||
if (frozen) {
|
||||
Object.freeze(result);
|
||||
}
|
||||
return result;
|
||||
return Object.freeze(object.map(function (item) { return deepCopy(item); }));
|
||||
}
|
||||
if (typeof (object) === "object") {
|
||||
// Some internal objects, which are already immutable
|
||||
if (isNamedInstance("BigNumber", object)) {
|
||||
return object;
|
||||
}
|
||||
if (isNamedInstance("Description", object)) {
|
||||
return object;
|
||||
}
|
||||
if (isNamedInstance("Indexed", object)) {
|
||||
// Immutable objects are safe to just use
|
||||
if (Object.isFrozen(object)) {
|
||||
return object;
|
||||
}
|
||||
var result = {};
|
||||
@ -133,10 +85,7 @@ function deepCopy(object, frozen) {
|
||||
if (value === undefined) {
|
||||
continue;
|
||||
}
|
||||
defineReadOnly(result, key, deepCopy(value, frozen));
|
||||
}
|
||||
if (frozen) {
|
||||
Object.freeze(result);
|
||||
defineReadOnly(result, key, deepCopy(value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -150,13 +99,10 @@ exports.deepCopy = deepCopy;
|
||||
var Description = /** @class */ (function () {
|
||||
function Description(info) {
|
||||
for (var key in info) {
|
||||
defineReadOnly(this, key, deepCopy(info[key], true));
|
||||
this[key] = deepCopy(info[key]);
|
||||
}
|
||||
Object.freeze(this);
|
||||
}
|
||||
Description.isType = function (value) {
|
||||
return isNamedInstance(this, value);
|
||||
};
|
||||
return Description;
|
||||
}());
|
||||
exports.Description = Description;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/properties",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Properties utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -20,5 +20,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xb8bb631ef71d25129b1ab6627a77368e262b366499c8088478bcd97eef8adca8"
|
||||
"tarballHash": "0xcee0c3183c655efc9e654fcc46289f3a80a967aa4eff2d295772ea55ce837d9b"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
2
packages/providers/_version.d.ts
vendored
2
packages/providers/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.133";
|
||||
export declare const version = "5.0.0-beta.134";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.133";
|
||||
exports.version = "5.0.0-beta.134";
|
||||
|
@ -84,7 +84,7 @@ function getEventTag(eventName) {
|
||||
else if (Array.isArray(eventName)) {
|
||||
return "filter:*:" + serializeTopics(eventName);
|
||||
}
|
||||
else if (properties_1.isNamedInstance(abstract_provider_1.ForkEvent, eventName)) {
|
||||
else if (abstract_provider_1.ForkEvent.isForkEvent(eventName)) {
|
||||
errors.warn("not implemented");
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/providers",
|
||||
"version": "5.0.0-beta.133",
|
||||
"version": "5.0.0-beta.134",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"browser": {
|
||||
@ -39,5 +39,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xf0a2a7f427f8113a474fd63f14d5720941f05530fbe98d383e55dfc9bae29286"
|
||||
"tarballHash": "0x2c6f5aa6d90887b48a28a828a5102ae32f65864b405e4e1ff5bc7f876c3237f4"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.133";
|
||||
export const version = "5.0.0-beta.134";
|
||||
|
2
packages/signing-key/_version.d.ts
vendored
2
packages/signing-key/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
3
packages/signing-key/index.d.ts
vendored
3
packages/signing-key/index.d.ts
vendored
@ -4,11 +4,12 @@ export declare class SigningKey {
|
||||
readonly privateKey: string;
|
||||
readonly publicKey: string;
|
||||
readonly compressedPublicKey: string;
|
||||
readonly address: string;
|
||||
readonly _isSigningKey: boolean;
|
||||
constructor(privateKey: BytesLike);
|
||||
_addPoint(other: BytesLike): string;
|
||||
signDigest(digest: BytesLike): Signature;
|
||||
computeSharedSecret(otherKey: BytesLike): string;
|
||||
static isSigningKey(value: any): value is SigningKey;
|
||||
}
|
||||
export declare function recoverPublicKey(digest: BytesLike, signature: SignatureLike): string;
|
||||
export declare function computePublicKey(key: BytesLike, compressed?: boolean): string;
|
||||
|
@ -25,6 +25,7 @@ var SigningKey = /** @class */ (function () {
|
||||
var keyPair = getCurve().keyFromPrivate(bytes_1.arrayify(this.privateKey));
|
||||
properties_1.defineReadOnly(this, "publicKey", "0x" + keyPair.getPublic(false, "hex"));
|
||||
properties_1.defineReadOnly(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex"));
|
||||
properties_1.defineReadOnly(this, "_isSigningKey", true);
|
||||
}
|
||||
SigningKey.prototype._addPoint = function (other) {
|
||||
var p0 = getCurve().keyFromPublic(bytes_1.arrayify(this.publicKey));
|
||||
@ -45,6 +46,9 @@ var SigningKey = /** @class */ (function () {
|
||||
var otherKeyPair = getCurve().keyFromPublic(bytes_1.arrayify(computePublicKey(otherKey)));
|
||||
return bytes_1.hexZeroPad("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32);
|
||||
};
|
||||
SigningKey.isSigningKey = function (value) {
|
||||
return !!(value && value._isSigningKey);
|
||||
};
|
||||
return SigningKey;
|
||||
}());
|
||||
exports.SigningKey = SigningKey;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/signing-key",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Elliptic curve library functions for the secp256k1 curve.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -21,5 +21,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x3f0419edaa2a79a0b62ab5221b243388c2600dec79cc169cb20b9c4ce906ce27"
|
||||
"tarballHash": "0x2e104e122d1da669aecf903aa959b76a035552c0c688c9211335d05e2aa3130e"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
2
packages/wallet/_version.d.ts
vendored
2
packages/wallet/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.126";
|
||||
exports.version = "5.0.0-beta.127";
|
||||
|
@ -66,7 +66,10 @@ var Wallet = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (properties_1.isNamedInstance(signing_key_1.SigningKey, privateKey)) {
|
||||
if (signing_key_1.SigningKey.isSigningKey(privateKey)) {
|
||||
if (privateKey.curve !== "secp256k1") {
|
||||
errors.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]");
|
||||
}
|
||||
properties_1.defineReadOnly(_this, "_signingKey", function () { return privateKey; });
|
||||
}
|
||||
else {
|
||||
@ -77,7 +80,7 @@ var Wallet = /** @class */ (function (_super) {
|
||||
properties_1.defineReadOnly(_this, "path", null);
|
||||
properties_1.defineReadOnly(_this, "address", transactions_1.computeAddress(_this.publicKey));
|
||||
}
|
||||
if (provider && !properties_1.isNamedInstance(abstract_provider_1.Provider, provider)) {
|
||||
if (provider && !abstract_provider_1.Provider.isProvider(provider)) {
|
||||
errors.throwError("invalid provider", errors.INVALID_ARGUMENT, {
|
||||
argument: "provider",
|
||||
value: provider
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/wallet",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -32,5 +32,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xd686eb36478b47f97c2355ddd7d6197ea7e78ef744b98f18054c1c9dbf3510d6"
|
||||
"tarballHash": "0x1e4e6ca3d0d51c9716917af30ddbb6c86859a571608ff0246a7bfef49963fa4d"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
Loading…
Reference in New Issue
Block a user