Updated dist files.
This commit is contained in:
parent
5aefb4303d
commit
427a78b258
@ -3,6 +3,15 @@ Changelog
|
||||
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.184 (2020-04-25 03:51)
|
||||
-----------------------------------------
|
||||
|
||||
- Minor typing-detected fixes. ([d1f3a42](https://github.com/ethers-io/ethers.js/commit/d1f3a42c119d5588eab667ec7bb6e71042cfb656))
|
||||
- Added initial support for recoverable coding erros. ([#800](https://github.com/ethers-io/ethers.js/issues/800); [bda6623](https://github.com/ethers-io/ethers.js/commit/bda66230916e58e25a522e8430ce4de25091eb6b))
|
||||
- More draconian Typing. ([14e6811](https://github.com/ethers-io/ethers.js/commit/14e6811bf7d7c38a3b5714dededcc883c185d814))
|
||||
- Omit HID libraries for hardware-wallets package on unsupported environments. ([#798](https://github.com/ethers-io/ethers.js/issues/798); [2e24920](https://github.com/ethers-io/ethers.js/commit/2e24920d028d42908d0764ad4ca0b56b55f852d1), [5aefb43](https://github.com/ethers-io/ethers.js/commit/5aefb4303d2fdda62e7e5ddb644919f613d6016a))
|
||||
- Make default constructor non-payable. ([#684](https://github.com/ethers-io/ethers.js/issues/684); [017ea0d](https://github.com/ethers-io/ethers.js/commit/017ea0d6bd22833e9d399ae6b818443786f17884))
|
||||
|
||||
ethers/v5.0.0-beta.183 (2020-04-23 23:28)
|
||||
-----------------------------------------
|
||||
|
||||
|
@ -10,18 +10,19 @@ const Words = fs.readFileSync("/usr/share/dict/words").toString().split("\n").re
|
||||
|
||||
`
|
||||
// Words missing from the dictionary
|
||||
addresses aligned autofill called cancelled censored compiled
|
||||
computed configured consumed creating decoded
|
||||
decoding decrypt decrypted decrypting deployed deploying deprecated
|
||||
accessing addresses aligned autofill called cancelled censored
|
||||
compiled computed configured consumed creating decoded decoding
|
||||
decrypt decrypted decrypting deployed deploying deprecated
|
||||
discontinued earliest email enabled encoded encoding encrypt
|
||||
encrypted encrypting entries euro exceeded existing expected expired
|
||||
failed fetches formatted formatting funding generated
|
||||
encrypted encrypting entries euro exceeded existing expected
|
||||
expired failed fetches formatted formatting funding generated
|
||||
has ignoring implemented implementer imported including instantiate
|
||||
keyword labelled larger lookup matches mined modified modifies multi
|
||||
named nested neutered numeric offline optimizer owned packed padded parsed parsing
|
||||
passed placeholder processing reached recommended recovered redacted remaining replaced
|
||||
required serializes shared signed signing stored supported
|
||||
tagging targetted transactions uninstall unsubscribe using verifies website
|
||||
named nested neutered numeric offline optimizer owned packed
|
||||
padded parsed parsing passed placeholder processing reached
|
||||
recommended recovered redacted remaining replaced required
|
||||
serializes shared signed signing stored supported tagging targetted
|
||||
transactions uninstall unsubscribe using verifies website
|
||||
|
||||
// Overly Specific Words
|
||||
BIP BIP39 BIP44 crypto eip hashes hmac icap
|
||||
@ -41,19 +42,15 @@ jumpdest mstore shr shl xor
|
||||
ABIEncoder testcase numberish Wordlist
|
||||
|
||||
// Common Code Strings
|
||||
abi addr api app arg arrayify asm basex
|
||||
bigint bn byte bytecode callback
|
||||
calldata checksum ciphertext cli codepoint
|
||||
config contenthash ctr ctrl debug dklen eexist encseed
|
||||
eof ethaddr ethseed ethers eval exec filename func
|
||||
gz hid http https hw iv info init ipc
|
||||
json kdf kdfparams labelhash lang lib
|
||||
multihash nfc nfkc
|
||||
nfd nfkd nodehash oob opcode pbkdf pc plugin
|
||||
pragma pre prf repl rpc sighash topichash solc
|
||||
stdin stdout subclasses subnode timeout todo txt
|
||||
ufixed utc utf util url uuid
|
||||
vm vs websocket wikipedia wx xe zlib
|
||||
abi addr api app arg arrayify asm basex bigint bn byte bytecode
|
||||
callback calldata checksum ciphertext cli codepoint config
|
||||
contenthash ctr ctrl debug dklen eexist encseed eof ethaddr
|
||||
ethseed ethers eval exec filename func gz hid http https hw iv
|
||||
info init ipc json kdf kdfparams labelhash lang lib multihash nfc
|
||||
nfkc nfd nfkd nodehash oob opcode pbkdf pc plugin pragma pre prf
|
||||
repl rpc sighash topichash solc stdin stdout subclasses subnode
|
||||
timeout todo txt ufixed utc utf util url uuid vm vs websocket
|
||||
wikipedia wx xe zlib
|
||||
|
||||
// AbiV2
|
||||
abiv
|
||||
@ -61,7 +58,7 @@ abiv
|
||||
// Query parameters
|
||||
apikey asc endblock startblock
|
||||
|
||||
Cloudflare Etherscan INFURA IPFS Nodesmith Trezor ledgerhq
|
||||
Cloudflare Etherscan INFURA IPFS Nodesmith Trezor ledgerhq
|
||||
axic bitcoinjs browserify easyseed ethereumjs
|
||||
goerli homestead kotti kovan mainnet morden mordor rinkeby ropsten testnet
|
||||
|
||||
|
2
packages/abi/lib.esm/_version.d.ts
vendored
2
packages/abi/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "abi/5.0.0-beta.151";
|
||||
export declare const version = "abi/5.0.0-beta.152";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abi/5.0.0-beta.151";
|
||||
export const version = "abi/5.0.0-beta.152";
|
||||
|
@ -60,7 +60,7 @@ export class AbiCoder {
|
||||
}
|
||||
return new FixedBytesCoder(size, param.name);
|
||||
}
|
||||
return logger.throwError("invalid type", "type", param.type);
|
||||
return logger.throwArgumentError("invalid type", "type", param.type);
|
||||
}
|
||||
_getWordSize() { return 32; }
|
||||
_getReader(data) {
|
||||
|
@ -3,6 +3,10 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
||||
export interface Result extends ReadonlyArray<any> {
|
||||
readonly [key: string]: any;
|
||||
}
|
||||
export declare function checkResultErrors(result: Result): Array<{
|
||||
path: Array<string | number>;
|
||||
error: Error;
|
||||
}>;
|
||||
export declare type CoerceFunc = (type: string, value: any) => any;
|
||||
export declare abstract class Coder {
|
||||
readonly name: string;
|
||||
|
@ -5,8 +5,30 @@ import { defineReadOnly } from "@ethersproject/properties";
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
import { version } from "../_version";
|
||||
const logger = new Logger(version);
|
||||
export function checkResultErrors(result) {
|
||||
// Find the first error (if any)
|
||||
const errors = [];
|
||||
const checkErrors = function (path, object) {
|
||||
if (!Array.isArray(object)) {
|
||||
return;
|
||||
}
|
||||
for (let key in object) {
|
||||
const childPath = path.slice();
|
||||
childPath.push(key);
|
||||
try {
|
||||
checkErrors(childPath, object[key]);
|
||||
}
|
||||
catch (error) {
|
||||
errors.push({ path: childPath, error: error });
|
||||
}
|
||||
}
|
||||
};
|
||||
checkErrors([], result);
|
||||
return errors;
|
||||
}
|
||||
export class Coder {
|
||||
constructor(name, type, localName, dynamic) {
|
||||
// @TODO: defineReadOnly these
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.localName = localName;
|
||||
|
@ -58,11 +58,35 @@ export function unpack(reader, coders) {
|
||||
if (coder.dynamic) {
|
||||
let offset = reader.readValue();
|
||||
let offsetReader = baseReader.subReader(offset.toNumber());
|
||||
value = coder.decode(offsetReader);
|
||||
try {
|
||||
value = coder.decode(offsetReader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
dynamicLength += offsetReader.consumed;
|
||||
}
|
||||
else {
|
||||
value = coder.decode(reader);
|
||||
try {
|
||||
value = coder.decode(reader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
}
|
||||
if (value != undefined) {
|
||||
values.push(value);
|
||||
@ -83,8 +107,24 @@ export function unpack(reader, coders) {
|
||||
if (values[name] != null) {
|
||||
return;
|
||||
}
|
||||
values[name] = values[index];
|
||||
const value = values[index];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, name, {
|
||||
get: () => { throw value; }
|
||||
});
|
||||
}
|
||||
else {
|
||||
values[name] = value;
|
||||
}
|
||||
});
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
const value = values[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, i, {
|
||||
get: () => { throw value; }
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.freeze(values);
|
||||
}
|
||||
export class ArrayCoder extends Coder {
|
||||
@ -100,7 +140,6 @@ export class ArrayCoder extends Coder {
|
||||
this._throwError("expected array value", value);
|
||||
}
|
||||
let count = this.length;
|
||||
//let result = new Uint8Array(0);
|
||||
if (count === -1) {
|
||||
count = value.length;
|
||||
writer.writeValue(value.length);
|
||||
|
@ -4,14 +4,14 @@ import { pack, unpack } from "./array";
|
||||
export class TupleCoder extends Coder {
|
||||
constructor(coders, localName) {
|
||||
let dynamic = false;
|
||||
let types = [];
|
||||
const types = [];
|
||||
coders.forEach((coder) => {
|
||||
if (coder.dynamic) {
|
||||
dynamic = true;
|
||||
}
|
||||
types.push(coder.type);
|
||||
});
|
||||
let type = ("tuple(" + types.join(",") + ")");
|
||||
const type = ("tuple(" + types.join(",") + ")");
|
||||
super("tuple", type, localName, dynamic);
|
||||
this.coders = coders;
|
||||
}
|
||||
|
@ -416,12 +416,13 @@ export class EventFragment extends Fragment {
|
||||
if (value.type !== "event") {
|
||||
logger.throwArgumentError("invalid event object", "value", value);
|
||||
}
|
||||
return new EventFragment(_constructorGuard, {
|
||||
const params = {
|
||||
name: verifyIdentifier(value.name),
|
||||
anonymous: value.anonymous,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
type: "event"
|
||||
});
|
||||
};
|
||||
return new EventFragment(_constructorGuard, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let match = value.match(regexParen);
|
||||
@ -591,13 +592,15 @@ export class ConstructorFragment extends Fragment {
|
||||
if (state.constant) {
|
||||
logger.throwArgumentError("constructor cannot be constant", "value", value);
|
||||
}
|
||||
return new ConstructorFragment(_constructorGuard, {
|
||||
const params = {
|
||||
name: null,
|
||||
type: value.type,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new ConstructorFragment(_constructorGuard, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "constructor" };
|
||||
@ -671,7 +674,7 @@ export class FunctionFragment extends ConstructorFragment {
|
||||
logger.throwArgumentError("invalid function object", "value", value);
|
||||
}
|
||||
let state = verifyState(value);
|
||||
return new FunctionFragment(_constructorGuard, {
|
||||
const params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
constant: state.constant,
|
||||
@ -680,7 +683,8 @@ export class FunctionFragment extends ConstructorFragment {
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new FunctionFragment(_constructorGuard, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "function" };
|
||||
|
4
packages/abi/lib.esm/index.d.ts
vendored
4
packages/abi/lib.esm/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
import { Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, LogDescription, TransactionDescription };
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { AbiCoder, defaultAbiCoder } from "./abi-coder";
|
||||
import { Indexed, Interface, LogDescription, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, LogDescription, TransactionDescription };
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
|
||||
|
8
packages/abi/lib.esm/interface.d.ts
vendored
8
packages/abi/lib.esm/interface.d.ts
vendored
@ -2,9 +2,9 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
||||
import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { Result } from "./coders/abstract-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { Result };
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
readonly name: string;
|
||||
@ -60,6 +60,10 @@ export declare class Interface {
|
||||
decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): Result;
|
||||
encodeFunctionResult(functionFragment: FunctionFragment | string, values?: Array<any>): string;
|
||||
encodeFilterTopics(eventFragment: EventFragment, values: Array<any>): Array<string | Array<string>>;
|
||||
encodeEventLog(eventFragment: EventFragment, values: Array<any>): {
|
||||
data: string;
|
||||
topics: Array<string>;
|
||||
};
|
||||
decodeEventLog(eventFragment: EventFragment | string, data: BytesLike, topics?: Array<string>): Result;
|
||||
parseTransaction(tx: {
|
||||
data: string;
|
||||
|
@ -6,10 +6,12 @@ import { id } from "@ethersproject/hash";
|
||||
import { keccak256 } from "@ethersproject/keccak256";
|
||||
import { defineReadOnly, Description, getStatic } from "@ethersproject/properties";
|
||||
import { defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
import { version } from "./_version";
|
||||
const logger = new Logger(version);
|
||||
export { checkResultErrors };
|
||||
export class LogDescription extends Description {
|
||||
}
|
||||
export class TransactionDescription extends Description {
|
||||
@ -19,6 +21,22 @@ export class Indexed extends Description {
|
||||
return !!(value && value._isIndexed);
|
||||
}
|
||||
}
|
||||
function wrapAccessError(property, error) {
|
||||
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
||||
wrap.error = error;
|
||||
return wrap;
|
||||
}
|
||||
function checkNames(fragment, type, params) {
|
||||
params.reduce((accum, param) => {
|
||||
if (param.name) {
|
||||
if (accum[param.name]) {
|
||||
logger.throwArgumentError(`duplicate ${type} parameter ${JSON.stringify(param.name)} in ${fragment.format("full")}`, "fragment", fragment);
|
||||
}
|
||||
accum[param.name] = true;
|
||||
}
|
||||
return accum;
|
||||
}, {});
|
||||
}
|
||||
export class Interface {
|
||||
constructor(fragments) {
|
||||
logger.checkNew(new.target, Interface);
|
||||
@ -46,12 +64,16 @@ export class Interface {
|
||||
logger.warn("duplicate definition - constructor");
|
||||
return;
|
||||
}
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
defineReadOnly(this, "deploy", fragment);
|
||||
return;
|
||||
case "function":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
checkNames(fragment, "output", fragment.outputs);
|
||||
bucket = this.functions;
|
||||
break;
|
||||
case "event":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = this.events;
|
||||
break;
|
||||
default:
|
||||
@ -64,9 +86,12 @@ export class Interface {
|
||||
}
|
||||
bucket[signature] = fragment;
|
||||
});
|
||||
// If we do not have a constructor use the default "constructor() payable"
|
||||
// If we do not have a constructor add a default
|
||||
if (!this.deploy) {
|
||||
defineReadOnly(this, "deploy", ConstructorFragment.from({ type: "constructor" }));
|
||||
defineReadOnly(this, "deploy", ConstructorFragment.from({
|
||||
payable: false,
|
||||
type: "constructor"
|
||||
}));
|
||||
}
|
||||
defineReadOnly(this, "_isInterface", true);
|
||||
}
|
||||
@ -285,6 +310,46 @@ export class Interface {
|
||||
}
|
||||
return topics;
|
||||
}
|
||||
encodeEventLog(eventFragment, values) {
|
||||
if (typeof (eventFragment) === "string") {
|
||||
eventFragment = this.getEvent(eventFragment);
|
||||
}
|
||||
const topics = [];
|
||||
const dataTypes = [];
|
||||
const dataValues = [];
|
||||
if (!eventFragment.anonymous) {
|
||||
topics.push(this.getEventTopic(eventFragment));
|
||||
}
|
||||
if (values.length !== eventFragment.inputs.length) {
|
||||
logger.throwArgumentError("event arguments/values mismatch", "values", values);
|
||||
}
|
||||
eventFragment.inputs.forEach((param, index) => {
|
||||
const value = values[index];
|
||||
if (param.indexed) {
|
||||
if (param.type === "string") {
|
||||
topics.push(id(value));
|
||||
}
|
||||
else if (param.type === "bytes") {
|
||||
topics.push(keccak256(value));
|
||||
}
|
||||
else if (param.baseType === "tuple" || param.baseType === "array") {
|
||||
// @TOOD
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
else {
|
||||
topics.push(this._abiCoder.encode([param.type], [value]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
dataTypes.push(param);
|
||||
dataValues.push(value);
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: this._abiCoder.encode(dataTypes, dataValues),
|
||||
topics: topics
|
||||
};
|
||||
}
|
||||
// Decode a filter for the event and the search criteria
|
||||
decodeEventLog(eventFragment, data, topics) {
|
||||
if (typeof (eventFragment) === "string") {
|
||||
@ -329,16 +394,45 @@ export class Interface {
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
||||
}
|
||||
else {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
try {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
try {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
// Add the keyword argument if named and safe
|
||||
if (param.name && result[param.name] == null) {
|
||||
result[param.name] = result[index];
|
||||
const value = result[index];
|
||||
// Make error named values throw on access
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(result, param.name, {
|
||||
get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
|
||||
});
|
||||
}
|
||||
else {
|
||||
result[param.name] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
// Make all error indexed values throw on access
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
const value = result[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(result, i, {
|
||||
get: () => { throw wrapAccessError(`index ${i}`, value); }
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.freeze(result);
|
||||
}
|
||||
// Given a transaction, find the matching function fragment (if any) and
|
||||
|
2
packages/abi/lib/_version.d.ts
vendored
2
packages/abi/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "abi/5.0.0-beta.151";
|
||||
export declare const version = "abi/5.0.0-beta.152";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "abi/5.0.0-beta.151";
|
||||
exports.version = "abi/5.0.0-beta.152";
|
||||
|
@ -63,7 +63,7 @@ var AbiCoder = /** @class */ (function () {
|
||||
}
|
||||
return new fixed_bytes_1.FixedBytesCoder(size, param.name);
|
||||
}
|
||||
return logger.throwError("invalid type", "type", param.type);
|
||||
return logger.throwArgumentError("invalid type", "type", param.type);
|
||||
};
|
||||
AbiCoder.prototype._getWordSize = function () { return 32; };
|
||||
AbiCoder.prototype._getReader = function (data) {
|
||||
|
4
packages/abi/lib/coders/abstract-coder.d.ts
vendored
4
packages/abi/lib/coders/abstract-coder.d.ts
vendored
@ -3,6 +3,10 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
||||
export interface Result extends ReadonlyArray<any> {
|
||||
readonly [key: string]: any;
|
||||
}
|
||||
export declare function checkResultErrors(result: Result): Array<{
|
||||
path: Array<string | number>;
|
||||
error: Error;
|
||||
}>;
|
||||
export declare type CoerceFunc = (type: string, value: any) => any;
|
||||
export declare abstract class Coder {
|
||||
readonly name: string;
|
||||
|
@ -6,8 +6,31 @@ var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("../_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
function checkResultErrors(result) {
|
||||
// Find the first error (if any)
|
||||
var errors = [];
|
||||
var checkErrors = function (path, object) {
|
||||
if (!Array.isArray(object)) {
|
||||
return;
|
||||
}
|
||||
for (var key in object) {
|
||||
var childPath = path.slice();
|
||||
childPath.push(key);
|
||||
try {
|
||||
checkErrors(childPath, object[key]);
|
||||
}
|
||||
catch (error) {
|
||||
errors.push({ path: childPath, error: error });
|
||||
}
|
||||
}
|
||||
};
|
||||
checkErrors([], result);
|
||||
return errors;
|
||||
}
|
||||
exports.checkResultErrors = checkResultErrors;
|
||||
var Coder = /** @class */ (function () {
|
||||
function Coder(name, type, localName, dynamic) {
|
||||
// @TODO: defineReadOnly these
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.localName = localName;
|
||||
|
@ -73,11 +73,35 @@ function unpack(reader, coders) {
|
||||
if (coder.dynamic) {
|
||||
var offset = reader.readValue();
|
||||
var offsetReader = baseReader.subReader(offset.toNumber());
|
||||
value = coder.decode(offsetReader);
|
||||
try {
|
||||
value = coder.decode(offsetReader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
dynamicLength += offsetReader.consumed;
|
||||
}
|
||||
else {
|
||||
value = coder.decode(reader);
|
||||
try {
|
||||
value = coder.decode(reader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
}
|
||||
if (value != undefined) {
|
||||
values.push(value);
|
||||
@ -98,8 +122,27 @@ function unpack(reader, coders) {
|
||||
if (values[name] != null) {
|
||||
return;
|
||||
}
|
||||
values[name] = values[index];
|
||||
var value = values[index];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, name, {
|
||||
get: function () { throw value; }
|
||||
});
|
||||
}
|
||||
else {
|
||||
values[name] = value;
|
||||
}
|
||||
});
|
||||
var _loop_1 = function (i) {
|
||||
var value = values[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, i, {
|
||||
get: function () { throw value; }
|
||||
});
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
_loop_1(i);
|
||||
}
|
||||
return Object.freeze(values);
|
||||
}
|
||||
exports.unpack = unpack;
|
||||
@ -119,7 +162,6 @@ var ArrayCoder = /** @class */ (function (_super) {
|
||||
this._throwError("expected array value", value);
|
||||
}
|
||||
var count = this.length;
|
||||
//let result = new Uint8Array(0);
|
||||
if (count === -1) {
|
||||
count = value.length;
|
||||
writer.writeValue(value.length);
|
||||
|
@ -438,12 +438,13 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
if (value.type !== "event") {
|
||||
logger.throwArgumentError("invalid event object", "value", value);
|
||||
}
|
||||
return new EventFragment(_constructorGuard, {
|
||||
var params = {
|
||||
name: verifyIdentifier(value.name),
|
||||
anonymous: value.anonymous,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
type: "event"
|
||||
});
|
||||
};
|
||||
return new EventFragment(_constructorGuard, params);
|
||||
};
|
||||
EventFragment.fromString = function (value) {
|
||||
var match = value.match(regexParen);
|
||||
@ -619,13 +620,15 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
if (state.constant) {
|
||||
logger.throwArgumentError("constructor cannot be constant", "value", value);
|
||||
}
|
||||
return new ConstructorFragment(_constructorGuard, {
|
||||
var params = {
|
||||
name: null,
|
||||
type: value.type,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? bignumber_1.BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new ConstructorFragment(_constructorGuard, params);
|
||||
};
|
||||
ConstructorFragment.fromString = function (value) {
|
||||
var params = { type: "constructor" };
|
||||
@ -705,7 +708,7 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
logger.throwArgumentError("invalid function object", "value", value);
|
||||
}
|
||||
var state = verifyState(value);
|
||||
return new FunctionFragment(_constructorGuard, {
|
||||
var params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
constant: state.constant,
|
||||
@ -714,7 +717,8 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? bignumber_1.BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new FunctionFragment(_constructorGuard, params);
|
||||
};
|
||||
FunctionFragment.fromString = function (value) {
|
||||
var params = { type: "function" };
|
||||
|
4
packages/abi/lib/index.d.ts
vendored
4
packages/abi/lib/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
import { Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, LogDescription, TransactionDescription };
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
|
@ -11,6 +11,7 @@ var abi_coder_1 = require("./abi-coder");
|
||||
exports.AbiCoder = abi_coder_1.AbiCoder;
|
||||
exports.defaultAbiCoder = abi_coder_1.defaultAbiCoder;
|
||||
var interface_1 = require("./interface");
|
||||
exports.checkResultErrors = interface_1.checkResultErrors;
|
||||
exports.Indexed = interface_1.Indexed;
|
||||
exports.Interface = interface_1.Interface;
|
||||
exports.LogDescription = interface_1.LogDescription;
|
||||
|
8
packages/abi/lib/interface.d.ts
vendored
8
packages/abi/lib/interface.d.ts
vendored
@ -2,9 +2,9 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
||||
import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { Result } from "./coders/abstract-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { Result };
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
readonly name: string;
|
||||
@ -60,6 +60,10 @@ export declare class Interface {
|
||||
decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): Result;
|
||||
encodeFunctionResult(functionFragment: FunctionFragment | string, values?: Array<any>): string;
|
||||
encodeFilterTopics(eventFragment: EventFragment, values: Array<any>): Array<string | Array<string>>;
|
||||
encodeEventLog(eventFragment: EventFragment, values: Array<any>): {
|
||||
data: string;
|
||||
topics: Array<string>;
|
||||
};
|
||||
decodeEventLog(eventFragment: EventFragment | string, data: BytesLike, topics?: Array<string>): Result;
|
||||
parseTransaction(tx: {
|
||||
data: string;
|
||||
|
@ -20,6 +20,8 @@ var hash_1 = require("@ethersproject/hash");
|
||||
var keccak256_1 = require("@ethersproject/keccak256");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var abi_coder_1 = require("./abi-coder");
|
||||
var abstract_coder_1 = require("./coders/abstract-coder");
|
||||
exports.checkResultErrors = abstract_coder_1.checkResultErrors;
|
||||
var fragments_1 = require("./fragments");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
@ -51,6 +53,22 @@ var Indexed = /** @class */ (function (_super) {
|
||||
return Indexed;
|
||||
}(properties_1.Description));
|
||||
exports.Indexed = Indexed;
|
||||
function wrapAccessError(property, error) {
|
||||
var wrap = new Error("deferred error during ABI decoding triggered accessing " + property);
|
||||
wrap.error = error;
|
||||
return wrap;
|
||||
}
|
||||
function checkNames(fragment, type, params) {
|
||||
params.reduce(function (accum, param) {
|
||||
if (param.name) {
|
||||
if (accum[param.name]) {
|
||||
logger.throwArgumentError("duplicate " + type + " parameter " + JSON.stringify(param.name) + " in " + fragment.format("full"), "fragment", fragment);
|
||||
}
|
||||
accum[param.name] = true;
|
||||
}
|
||||
return accum;
|
||||
}, {});
|
||||
}
|
||||
var Interface = /** @class */ (function () {
|
||||
function Interface(fragments) {
|
||||
var _newTarget = this.constructor;
|
||||
@ -80,12 +98,16 @@ var Interface = /** @class */ (function () {
|
||||
logger.warn("duplicate definition - constructor");
|
||||
return;
|
||||
}
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
properties_1.defineReadOnly(_this, "deploy", fragment);
|
||||
return;
|
||||
case "function":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
checkNames(fragment, "output", fragment.outputs);
|
||||
bucket = _this.functions;
|
||||
break;
|
||||
case "event":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = _this.events;
|
||||
break;
|
||||
default:
|
||||
@ -98,9 +120,12 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
bucket[signature] = fragment;
|
||||
});
|
||||
// If we do not have a constructor use the default "constructor() payable"
|
||||
// If we do not have a constructor add a default
|
||||
if (!this.deploy) {
|
||||
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({ type: "constructor" }));
|
||||
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({
|
||||
payable: false,
|
||||
type: "constructor"
|
||||
}));
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_isInterface", true);
|
||||
}
|
||||
@ -320,6 +345,47 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
return topics;
|
||||
};
|
||||
Interface.prototype.encodeEventLog = function (eventFragment, values) {
|
||||
var _this = this;
|
||||
if (typeof (eventFragment) === "string") {
|
||||
eventFragment = this.getEvent(eventFragment);
|
||||
}
|
||||
var topics = [];
|
||||
var dataTypes = [];
|
||||
var dataValues = [];
|
||||
if (!eventFragment.anonymous) {
|
||||
topics.push(this.getEventTopic(eventFragment));
|
||||
}
|
||||
if (values.length !== eventFragment.inputs.length) {
|
||||
logger.throwArgumentError("event arguments/values mismatch", "values", values);
|
||||
}
|
||||
eventFragment.inputs.forEach(function (param, index) {
|
||||
var value = values[index];
|
||||
if (param.indexed) {
|
||||
if (param.type === "string") {
|
||||
topics.push(hash_1.id(value));
|
||||
}
|
||||
else if (param.type === "bytes") {
|
||||
topics.push(keccak256_1.keccak256(value));
|
||||
}
|
||||
else if (param.baseType === "tuple" || param.baseType === "array") {
|
||||
// @TOOD
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
else {
|
||||
topics.push(_this._abiCoder.encode([param.type], [value]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
dataTypes.push(param);
|
||||
dataValues.push(value);
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: this._abiCoder.encode(dataTypes, dataValues),
|
||||
topics: topics
|
||||
};
|
||||
};
|
||||
// Decode a filter for the event and the search criteria
|
||||
Interface.prototype.decodeEventLog = function (eventFragment, data, topics) {
|
||||
if (typeof (eventFragment) === "string") {
|
||||
@ -364,16 +430,48 @@ var Interface = /** @class */ (function () {
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
||||
}
|
||||
else {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
try {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
try {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
// Add the keyword argument if named and safe
|
||||
if (param.name && result[param.name] == null) {
|
||||
result[param.name] = result[index];
|
||||
var value_1 = result[index];
|
||||
// Make error named values throw on access
|
||||
if (value_1 instanceof Error) {
|
||||
Object.defineProperty(result, param.name, {
|
||||
get: function () { throw wrapAccessError("property " + JSON.stringify(param.name), value_1); }
|
||||
});
|
||||
}
|
||||
else {
|
||||
result[param.name] = value_1;
|
||||
}
|
||||
}
|
||||
});
|
||||
var _loop_1 = function (i) {
|
||||
var value = result[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(result, i, {
|
||||
get: function () { throw wrapAccessError("index " + i, value); }
|
||||
});
|
||||
}
|
||||
};
|
||||
// Make all error indexed values throw on access
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
_loop_1(i);
|
||||
}
|
||||
return Object.freeze(result);
|
||||
};
|
||||
// Given a transaction, find the matching function fragment (if any) and
|
||||
|
@ -31,7 +31,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x27055562994473b2784573277c107df883bc39663b9687488642478f49631d43",
|
||||
"tarballHash": "0x109653533bca166a77b4d0b473f2113fb87d8a40f5559cb935697fa04a73afb1",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.151"
|
||||
"version": "5.0.0-beta.152"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abi/5.0.0-beta.151";
|
||||
export const version = "abi/5.0.0-beta.152";
|
||||
|
2
packages/contracts/lib.esm/_version.d.ts
vendored
2
packages/contracts/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "contracts/5.0.0-beta.149";
|
||||
export declare const version = "contracts/5.0.0-beta.150";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "contracts/5.0.0-beta.149";
|
||||
export const version = "contracts/5.0.0-beta.150";
|
||||
|
@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import { Indexed, Interface } from "@ethersproject/abi";
|
||||
import { checkResultErrors, Indexed, Interface } from "@ethersproject/abi";
|
||||
import { Provider } from "@ethersproject/abstract-provider";
|
||||
import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
|
||||
import { getContractAddress } from "@ethersproject/address";
|
||||
@ -68,7 +68,7 @@ function runMethod(contract, functionName, options) {
|
||||
// Check for unexpected keys (e.g. using "gas" instead of "gasLimit")
|
||||
for (let key in tx) {
|
||||
if (!allowedTransactionKeys[key]) {
|
||||
logger.throwError(("unknown transaction override - " + key), "overrides", tx);
|
||||
logger.throwArgumentError(("unknown transaction override - " + key), "overrides", tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,10 +280,13 @@ class FragmentRunningEvent extends RunningEvent {
|
||||
catch (error) {
|
||||
event.args = null;
|
||||
event.decodeError = error;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
getEmit(event) {
|
||||
const errors = checkResultErrors(event.args);
|
||||
if (errors.length) {
|
||||
throw errors[0].error;
|
||||
}
|
||||
const args = (event.args || []).slice();
|
||||
args.push(event);
|
||||
return args;
|
||||
@ -516,6 +519,10 @@ export class Contract {
|
||||
if (eventName === "error") {
|
||||
return this._normalizeRunningEvent(new ErrorRunningEvent());
|
||||
}
|
||||
// Listen for any event that is registered
|
||||
if (eventName === "event") {
|
||||
return this._normalizeRunningEvent(new RunningEvent("event", null));
|
||||
}
|
||||
// Listen for any event
|
||||
if (eventName === "*") {
|
||||
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
|
||||
@ -580,17 +587,25 @@ export class Contract {
|
||||
// If we are not polling the provider, start polling
|
||||
if (!this._wrappedEmits[runningEvent.tag]) {
|
||||
const wrappedEmit = (log) => {
|
||||
let event = null;
|
||||
try {
|
||||
event = this._wrapEvent(runningEvent, log, listener);
|
||||
let event = this._wrapEvent(runningEvent, log, listener);
|
||||
// Try to emit the result for the parameterized event...
|
||||
if (event.decodeError == null) {
|
||||
try {
|
||||
const args = runningEvent.getEmit(event);
|
||||
this.emit(runningEvent.filter, ...args);
|
||||
}
|
||||
catch (error) {
|
||||
event.decodeError = error.error;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
// There was an error decoding the data and topics
|
||||
this.emit("error", error, event);
|
||||
return;
|
||||
// Always emit "event" for fragment-base events
|
||||
if (runningEvent.filter != null) {
|
||||
this.emit("event", event);
|
||||
}
|
||||
// Emit "error" if there was an error
|
||||
if (event.decodeError != null) {
|
||||
this.emit("error", event.decodeError, event);
|
||||
}
|
||||
const args = runningEvent.getEmit(event);
|
||||
this.emit(runningEvent.filter, ...args);
|
||||
};
|
||||
this._wrappedEmits[runningEvent.tag] = wrappedEmit;
|
||||
// Special events, like "error" do not have a filter
|
||||
|
2
packages/contracts/lib/_version.d.ts
vendored
2
packages/contracts/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "contracts/5.0.0-beta.149";
|
||||
export declare const version = "contracts/5.0.0-beta.150";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "contracts/5.0.0-beta.149";
|
||||
exports.version = "contracts/5.0.0-beta.150";
|
||||
|
@ -121,7 +121,7 @@ function runMethod(contract, functionName, options) {
|
||||
// Check for unexpected keys (e.g. using "gas" instead of "gasLimit")
|
||||
for (var key in tx) {
|
||||
if (!allowedTransactionKeys[key]) {
|
||||
logger.throwError(("unknown transaction override - " + key), "overrides", tx);
|
||||
logger.throwArgumentError(("unknown transaction override - " + key), "overrides", tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,10 +341,13 @@ var FragmentRunningEvent = /** @class */ (function (_super) {
|
||||
catch (error) {
|
||||
event.args = null;
|
||||
event.decodeError = error;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
FragmentRunningEvent.prototype.getEmit = function (event) {
|
||||
var errors = abi_1.checkResultErrors(event.args);
|
||||
if (errors.length) {
|
||||
throw errors[0].error;
|
||||
}
|
||||
var args = (event.args || []).slice();
|
||||
args.push(event);
|
||||
return args;
|
||||
@ -590,6 +593,10 @@ var Contract = /** @class */ (function () {
|
||||
if (eventName === "error") {
|
||||
return this._normalizeRunningEvent(new ErrorRunningEvent());
|
||||
}
|
||||
// Listen for any event that is registered
|
||||
if (eventName === "event") {
|
||||
return this._normalizeRunningEvent(new RunningEvent("event", null));
|
||||
}
|
||||
// Listen for any event
|
||||
if (eventName === "*") {
|
||||
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
|
||||
@ -656,17 +663,25 @@ var Contract = /** @class */ (function () {
|
||||
// If we are not polling the provider, start polling
|
||||
if (!this._wrappedEmits[runningEvent.tag]) {
|
||||
var wrappedEmit = function (log) {
|
||||
var event = null;
|
||||
try {
|
||||
event = _this._wrapEvent(runningEvent, log, listener);
|
||||
var event = _this._wrapEvent(runningEvent, log, listener);
|
||||
// Try to emit the result for the parameterized event...
|
||||
if (event.decodeError == null) {
|
||||
try {
|
||||
var args = runningEvent.getEmit(event);
|
||||
_this.emit.apply(_this, __spreadArrays([runningEvent.filter], args));
|
||||
}
|
||||
catch (error) {
|
||||
event.decodeError = error.error;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
// There was an error decoding the data and topics
|
||||
_this.emit("error", error, event);
|
||||
return;
|
||||
// Always emit "event" for fragment-base events
|
||||
if (runningEvent.filter != null) {
|
||||
_this.emit("event", event);
|
||||
}
|
||||
// Emit "error" if there was an error
|
||||
if (event.decodeError != null) {
|
||||
_this.emit("error", event.decodeError, event);
|
||||
}
|
||||
var args = runningEvent.getEmit(event);
|
||||
_this.emit.apply(_this, __spreadArrays([runningEvent.filter], args));
|
||||
};
|
||||
this._wrappedEmits[runningEvent.tag] = wrappedEmit;
|
||||
// Special events, like "error" do not have a filter
|
||||
|
@ -32,7 +32,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x0831bbcb34338804b94a0f9a4d177f00308651b2e40e6648e8d6678299c2f0eb",
|
||||
"tarballHash": "0x5030e873ef0ebc78913b3a1344a86cd92873b60418a342048ad165f751c342e5",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.149"
|
||||
"version": "5.0.0-beta.150"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "contracts/5.0.0-beta.149";
|
||||
export const version = "contracts/5.0.0-beta.150";
|
||||
|
4
packages/ethers/dist/ethers-all.esm.min.js
vendored
4
packages/ethers/dist/ethers-all.esm.min.js
vendored
File diff suppressed because one or more lines are too long
4
packages/ethers/dist/ethers-all.umd.min.js
vendored
4
packages/ethers/dist/ethers-all.umd.min.js
vendored
File diff suppressed because one or more lines are too long
409
packages/ethers/dist/ethers.esm.js
vendored
409
packages/ethers/dist/ethers.esm.js
vendored
@ -3455,13 +3455,13 @@ var bn = createCommonjsModule(function (module) {
|
||||
});
|
||||
var bn_1 = bn.BN;
|
||||
|
||||
const version = "logger/5.0.0-beta.136";
|
||||
const version = "logger/5.0.0-beta.137";
|
||||
|
||||
"use strict";
|
||||
let _permanentCensorErrors = false;
|
||||
let _censorErrors = false;
|
||||
const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
|
||||
let LogLevel = LogLevels["default"];
|
||||
let _logLevel = LogLevels["default"];
|
||||
let _globalLogger = null;
|
||||
function _checkNormalize() {
|
||||
try {
|
||||
@ -3491,6 +3491,81 @@ function _checkNormalize() {
|
||||
return null;
|
||||
}
|
||||
const _normalizeError = _checkNormalize();
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
LogLevel["DEBUG"] = "DEBUG";
|
||||
LogLevel["INFO"] = "INFO";
|
||||
LogLevel["WARNING"] = "WARNING";
|
||||
LogLevel["ERROR"] = "ERROR";
|
||||
LogLevel["OFF"] = "OFF";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
var ErrorCode;
|
||||
(function (ErrorCode) {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
||||
// Not Implemented
|
||||
ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
||||
// Some sort of bad response from the server
|
||||
ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
|
||||
// Timeout
|
||||
ErrorCode["TIMEOUT"] = "TIMEOUT";
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
ErrorCode["MISSING_NEW"] = "MISSING_NEW";
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
|
||||
})(ErrorCode || (ErrorCode = {}));
|
||||
;
|
||||
class Logger {
|
||||
constructor(version) {
|
||||
Object.defineProperty(this, "version", {
|
||||
@ -3504,7 +3579,7 @@ class Logger {
|
||||
if (LogLevels[level] == null) {
|
||||
this.throwArgumentError("invalid log level name", "logLevel", logLevel);
|
||||
}
|
||||
if (LogLevel > LogLevels[level]) {
|
||||
if (_logLevel > LogLevels[level]) {
|
||||
return;
|
||||
}
|
||||
console.log.apply(console, args);
|
||||
@ -3656,83 +3731,15 @@ class Logger {
|
||||
Logger.globalLogger().warn("invalid log level - " + logLevel);
|
||||
return;
|
||||
}
|
||||
LogLevel = level;
|
||||
_logLevel = level;
|
||||
}
|
||||
}
|
||||
Logger.errors = {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
||||
// Not Implemented
|
||||
NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION",
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
NETWORK_ERROR: "NETWORK_ERROR",
|
||||
// Some sort of bad response from the server
|
||||
SERVER_ERROR: "SERVER_ERROR",
|
||||
// Timeout
|
||||
TIMEOUT: "TIMEOUT",
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
BUFFER_OVERRUN: "BUFFER_OVERRUN",
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
NUMERIC_FAULT: "NUMERIC_FAULT",
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
MISSING_NEW: "MISSING_NEW",
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
INVALID_ARGUMENT: "INVALID_ARGUMENT",
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
MISSING_ARGUMENT: "MISSING_ARGUMENT",
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
UNEXPECTED_ARGUMENT: "UNEXPECTED_ARGUMENT",
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
CALL_EXCEPTION: "CALL_EXCEPTION",
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS",
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
NONCE_EXPIRED: "NONCE_EXPIRED",
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
REPLACEMENT_UNDERPRICED: "REPLACEMENT_UNDERPRICED",
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
UNPREDICTABLE_GAS_LIMIT: "UNPREDICTABLE_GAS_LIMIT",
|
||||
};
|
||||
Logger.levels = {
|
||||
DEBUG: "DEBUG",
|
||||
INFO: "INFO",
|
||||
WARNING: "WARNING",
|
||||
ERROR: "ERROR",
|
||||
OFF: "OFF"
|
||||
};
|
||||
Logger.errors = ErrorCode;
|
||||
Logger.levels = LogLevel;
|
||||
|
||||
var lib_esm = /*#__PURE__*/Object.freeze({
|
||||
get LogLevel () { return LogLevel; },
|
||||
get ErrorCode () { return ErrorCode; },
|
||||
Logger: Logger
|
||||
});
|
||||
|
||||
@ -4682,7 +4689,7 @@ class FixedNumber {
|
||||
}
|
||||
}
|
||||
|
||||
const version$3 = "properties/5.0.0-beta.138";
|
||||
const version$3 = "properties/5.0.0-beta.139";
|
||||
|
||||
"use strict";
|
||||
const logger$3 = new Logger(version$3);
|
||||
@ -4795,7 +4802,7 @@ class Description {
|
||||
}
|
||||
}
|
||||
|
||||
const version$4 = "abi/5.0.0-beta.151";
|
||||
const version$4 = "abi/5.0.0-beta.152";
|
||||
|
||||
"use strict";
|
||||
const logger$4 = new Logger(version$4);
|
||||
@ -5211,12 +5218,13 @@ class EventFragment extends Fragment {
|
||||
if (value.type !== "event") {
|
||||
logger$4.throwArgumentError("invalid event object", "value", value);
|
||||
}
|
||||
return new EventFragment(_constructorGuard$2, {
|
||||
const params = {
|
||||
name: verifyIdentifier(value.name),
|
||||
anonymous: value.anonymous,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
type: "event"
|
||||
});
|
||||
};
|
||||
return new EventFragment(_constructorGuard$2, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let match = value.match(regexParen);
|
||||
@ -5386,13 +5394,15 @@ class ConstructorFragment extends Fragment {
|
||||
if (state.constant) {
|
||||
logger$4.throwArgumentError("constructor cannot be constant", "value", value);
|
||||
}
|
||||
return new ConstructorFragment(_constructorGuard$2, {
|
||||
const params = {
|
||||
name: null,
|
||||
type: value.type,
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new ConstructorFragment(_constructorGuard$2, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "constructor" };
|
||||
@ -5466,7 +5476,7 @@ class FunctionFragment extends ConstructorFragment {
|
||||
logger$4.throwArgumentError("invalid function object", "value", value);
|
||||
}
|
||||
let state = verifyState(value);
|
||||
return new FunctionFragment(_constructorGuard$2, {
|
||||
const params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
constant: state.constant,
|
||||
@ -5475,7 +5485,8 @@ class FunctionFragment extends ConstructorFragment {
|
||||
payable: state.payable,
|
||||
stateMutability: state.stateMutability,
|
||||
gas: (value.gas ? BigNumber.from(value.gas) : null)
|
||||
});
|
||||
};
|
||||
return new FunctionFragment(_constructorGuard$2, params);
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "function" };
|
||||
@ -5566,8 +5577,30 @@ function splitNesting(value) {
|
||||
|
||||
"use strict";
|
||||
const logger$5 = new Logger(version$4);
|
||||
function checkResultErrors(result) {
|
||||
// Find the first error (if any)
|
||||
const errors = [];
|
||||
const checkErrors = function (path, object) {
|
||||
if (!Array.isArray(object)) {
|
||||
return;
|
||||
}
|
||||
for (let key in object) {
|
||||
const childPath = path.slice();
|
||||
childPath.push(key);
|
||||
try {
|
||||
checkErrors(childPath, object[key]);
|
||||
}
|
||||
catch (error) {
|
||||
errors.push({ path: childPath, error: error });
|
||||
}
|
||||
}
|
||||
};
|
||||
checkErrors([], result);
|
||||
return errors;
|
||||
}
|
||||
class Coder {
|
||||
constructor(name, type, localName, dynamic) {
|
||||
// @TODO: defineReadOnly these
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.localName = localName;
|
||||
@ -6495,11 +6528,35 @@ function unpack(reader, coders) {
|
||||
if (coder.dynamic) {
|
||||
let offset = reader.readValue();
|
||||
let offsetReader = baseReader.subReader(offset.toNumber());
|
||||
value = coder.decode(offsetReader);
|
||||
try {
|
||||
value = coder.decode(offsetReader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
dynamicLength += offsetReader.consumed;
|
||||
}
|
||||
else {
|
||||
value = coder.decode(reader);
|
||||
try {
|
||||
value = coder.decode(reader);
|
||||
}
|
||||
catch (error) {
|
||||
// Cannot recover from this
|
||||
if (error.code === Logger.errors.BUFFER_OVERRUN) {
|
||||
throw error;
|
||||
}
|
||||
value = error;
|
||||
value.baseType = coder.name;
|
||||
value.name = coder.localName;
|
||||
value.type = coder.type;
|
||||
}
|
||||
}
|
||||
if (value != undefined) {
|
||||
values.push(value);
|
||||
@ -6520,8 +6577,24 @@ function unpack(reader, coders) {
|
||||
if (values[name] != null) {
|
||||
return;
|
||||
}
|
||||
values[name] = values[index];
|
||||
const value = values[index];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, name, {
|
||||
get: () => { throw value; }
|
||||
});
|
||||
}
|
||||
else {
|
||||
values[name] = value;
|
||||
}
|
||||
});
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
const value = values[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(values, i, {
|
||||
get: () => { throw value; }
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.freeze(values);
|
||||
}
|
||||
class ArrayCoder extends Coder {
|
||||
@ -6537,7 +6610,6 @@ class ArrayCoder extends Coder {
|
||||
this._throwError("expected array value", value);
|
||||
}
|
||||
let count = this.length;
|
||||
//let result = new Uint8Array(0);
|
||||
if (count === -1) {
|
||||
count = value.length;
|
||||
writer.writeValue(value.length);
|
||||
@ -7178,14 +7250,14 @@ class StringCoder extends DynamicBytesCoder {
|
||||
class TupleCoder extends Coder {
|
||||
constructor(coders, localName) {
|
||||
let dynamic = false;
|
||||
let types = [];
|
||||
const types = [];
|
||||
coders.forEach((coder) => {
|
||||
if (coder.dynamic) {
|
||||
dynamic = true;
|
||||
}
|
||||
types.push(coder.type);
|
||||
});
|
||||
let type = ("tuple(" + types.join(",") + ")");
|
||||
const type = ("tuple(" + types.join(",") + ")");
|
||||
super("tuple", type, localName, dynamic);
|
||||
this.coders = coders;
|
||||
}
|
||||
@ -7243,7 +7315,7 @@ class AbiCoder {
|
||||
}
|
||||
return new FixedBytesCoder(size, param.name);
|
||||
}
|
||||
return logger$a.throwError("invalid type", "type", param.type);
|
||||
return logger$a.throwArgumentError("invalid type", "type", param.type);
|
||||
}
|
||||
_getWordSize() { return 32; }
|
||||
_getReader(data) {
|
||||
@ -7332,6 +7404,22 @@ class Indexed extends Description {
|
||||
return !!(value && value._isIndexed);
|
||||
}
|
||||
}
|
||||
function wrapAccessError(property, error) {
|
||||
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
||||
wrap.error = error;
|
||||
return wrap;
|
||||
}
|
||||
function checkNames(fragment, type, params) {
|
||||
params.reduce((accum, param) => {
|
||||
if (param.name) {
|
||||
if (accum[param.name]) {
|
||||
logger$c.throwArgumentError(`duplicate ${type} parameter ${JSON.stringify(param.name)} in ${fragment.format("full")}`, "fragment", fragment);
|
||||
}
|
||||
accum[param.name] = true;
|
||||
}
|
||||
return accum;
|
||||
}, {});
|
||||
}
|
||||
class Interface {
|
||||
constructor(fragments) {
|
||||
logger$c.checkNew(new.target, Interface);
|
||||
@ -7359,12 +7447,16 @@ class Interface {
|
||||
logger$c.warn("duplicate definition - constructor");
|
||||
return;
|
||||
}
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
defineReadOnly(this, "deploy", fragment);
|
||||
return;
|
||||
case "function":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
checkNames(fragment, "output", fragment.outputs);
|
||||
bucket = this.functions;
|
||||
break;
|
||||
case "event":
|
||||
checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = this.events;
|
||||
break;
|
||||
default:
|
||||
@ -7377,9 +7469,12 @@ class Interface {
|
||||
}
|
||||
bucket[signature] = fragment;
|
||||
});
|
||||
// If we do not have a constructor use the default "constructor() payable"
|
||||
// If we do not have a constructor add a default
|
||||
if (!this.deploy) {
|
||||
defineReadOnly(this, "deploy", ConstructorFragment.from({ type: "constructor" }));
|
||||
defineReadOnly(this, "deploy", ConstructorFragment.from({
|
||||
payable: false,
|
||||
type: "constructor"
|
||||
}));
|
||||
}
|
||||
defineReadOnly(this, "_isInterface", true);
|
||||
}
|
||||
@ -7598,6 +7693,46 @@ class Interface {
|
||||
}
|
||||
return topics;
|
||||
}
|
||||
encodeEventLog(eventFragment, values) {
|
||||
if (typeof (eventFragment) === "string") {
|
||||
eventFragment = this.getEvent(eventFragment);
|
||||
}
|
||||
const topics = [];
|
||||
const dataTypes = [];
|
||||
const dataValues = [];
|
||||
if (!eventFragment.anonymous) {
|
||||
topics.push(this.getEventTopic(eventFragment));
|
||||
}
|
||||
if (values.length !== eventFragment.inputs.length) {
|
||||
logger$c.throwArgumentError("event arguments/values mismatch", "values", values);
|
||||
}
|
||||
eventFragment.inputs.forEach((param, index) => {
|
||||
const value = values[index];
|
||||
if (param.indexed) {
|
||||
if (param.type === "string") {
|
||||
topics.push(id(value));
|
||||
}
|
||||
else if (param.type === "bytes") {
|
||||
topics.push(keccak256(value));
|
||||
}
|
||||
else if (param.baseType === "tuple" || param.baseType === "array") {
|
||||
// @TOOD
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
else {
|
||||
topics.push(this._abiCoder.encode([param.type], [value]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
dataTypes.push(param);
|
||||
dataValues.push(value);
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: this._abiCoder.encode(dataTypes, dataValues),
|
||||
topics: topics
|
||||
};
|
||||
}
|
||||
// Decode a filter for the event and the search criteria
|
||||
decodeEventLog(eventFragment, data, topics) {
|
||||
if (typeof (eventFragment) === "string") {
|
||||
@ -7642,16 +7777,45 @@ class Interface {
|
||||
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
|
||||
}
|
||||
else {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
try {
|
||||
result[index] = resultIndexed[indexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
try {
|
||||
result[index] = resultNonIndexed[nonIndexedIndex++];
|
||||
}
|
||||
catch (error) {
|
||||
result[index] = error;
|
||||
}
|
||||
}
|
||||
// Add the keyword argument if named and safe
|
||||
if (param.name && result[param.name] == null) {
|
||||
result[param.name] = result[index];
|
||||
const value = result[index];
|
||||
// Make error named values throw on access
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(result, param.name, {
|
||||
get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
|
||||
});
|
||||
}
|
||||
else {
|
||||
result[param.name] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
// Make all error indexed values throw on access
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
const value = result[i];
|
||||
if (value instanceof Error) {
|
||||
Object.defineProperty(result, i, {
|
||||
get: () => { throw wrapAccessError(`index ${i}`, value); }
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.freeze(result);
|
||||
}
|
||||
// Given a transaction, find the matching function fragment (if any) and
|
||||
@ -7969,7 +8133,7 @@ class VoidSigner extends Signer {
|
||||
}
|
||||
}
|
||||
|
||||
const version$b = "contracts/5.0.0-beta.149";
|
||||
const version$b = "contracts/5.0.0-beta.150";
|
||||
|
||||
"use strict";
|
||||
var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
@ -8031,7 +8195,7 @@ function runMethod(contract, functionName, options) {
|
||||
// Check for unexpected keys (e.g. using "gas" instead of "gasLimit")
|
||||
for (let key in tx) {
|
||||
if (!allowedTransactionKeys$1[key]) {
|
||||
logger$f.throwError(("unknown transaction override - " + key), "overrides", tx);
|
||||
logger$f.throwArgumentError(("unknown transaction override - " + key), "overrides", tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8243,10 +8407,13 @@ class FragmentRunningEvent extends RunningEvent {
|
||||
catch (error) {
|
||||
event.args = null;
|
||||
event.decodeError = error;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
getEmit(event) {
|
||||
const errors = checkResultErrors(event.args);
|
||||
if (errors.length) {
|
||||
throw errors[0].error;
|
||||
}
|
||||
const args = (event.args || []).slice();
|
||||
args.push(event);
|
||||
return args;
|
||||
@ -8479,6 +8646,10 @@ class Contract {
|
||||
if (eventName === "error") {
|
||||
return this._normalizeRunningEvent(new ErrorRunningEvent());
|
||||
}
|
||||
// Listen for any event that is registered
|
||||
if (eventName === "event") {
|
||||
return this._normalizeRunningEvent(new RunningEvent("event", null));
|
||||
}
|
||||
// Listen for any event
|
||||
if (eventName === "*") {
|
||||
return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface));
|
||||
@ -8543,17 +8714,25 @@ class Contract {
|
||||
// If we are not polling the provider, start polling
|
||||
if (!this._wrappedEmits[runningEvent.tag]) {
|
||||
const wrappedEmit = (log) => {
|
||||
let event = null;
|
||||
try {
|
||||
event = this._wrapEvent(runningEvent, log, listener);
|
||||
let event = this._wrapEvent(runningEvent, log, listener);
|
||||
// Try to emit the result for the parameterized event...
|
||||
if (event.decodeError == null) {
|
||||
try {
|
||||
const args = runningEvent.getEmit(event);
|
||||
this.emit(runningEvent.filter, ...args);
|
||||
}
|
||||
catch (error) {
|
||||
event.decodeError = error.error;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
// There was an error decoding the data and topics
|
||||
this.emit("error", error, event);
|
||||
return;
|
||||
// Always emit "event" for fragment-base events
|
||||
if (runningEvent.filter != null) {
|
||||
this.emit("event", event);
|
||||
}
|
||||
// Emit "error" if there was an error
|
||||
if (event.decodeError != null) {
|
||||
this.emit("error", event.decodeError, event);
|
||||
}
|
||||
const args = runningEvent.getEmit(event);
|
||||
this.emit(runningEvent.filter, ...args);
|
||||
};
|
||||
this._wrappedEmits[runningEvent.tag] = wrappedEmit;
|
||||
// Special events, like "error" do not have a filter
|
||||
@ -12826,7 +13005,7 @@ Wordlist.register(langEn);
|
||||
"use strict";
|
||||
const wordlists = { en: langEn };
|
||||
|
||||
const version$g = "hdnode/5.0.0-beta.138";
|
||||
const version$g = "hdnode/5.0.0-beta.139";
|
||||
|
||||
"use strict";
|
||||
const logger$j = new Logger(version$g);
|
||||
@ -13059,7 +13238,7 @@ class HDNode {
|
||||
}
|
||||
return new HDNode(_constructorGuard$3, hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null);
|
||||
}
|
||||
return logger$j.throwError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
return logger$j.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
}
|
||||
}
|
||||
function mnemonicToSeed(mnemonic, password) {
|
||||
@ -13996,7 +14175,7 @@ var aesJs = createCommonjsModule(function (module, exports) {
|
||||
})(commonjsGlobal);
|
||||
});
|
||||
|
||||
const version$i = "json-wallets/5.0.0-beta.137";
|
||||
const version$i = "json-wallets/5.0.0-beta.138";
|
||||
|
||||
"use strict";
|
||||
function looseArrayify(hexString) {
|
||||
@ -19072,6 +19251,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
|
||||
FunctionFragment: FunctionFragment,
|
||||
ParamType: ParamType,
|
||||
FormatTypes: FormatTypes,
|
||||
checkResultErrors: checkResultErrors,
|
||||
Logger: Logger,
|
||||
RLP: index,
|
||||
fetchJson: fetchJson,
|
||||
@ -19152,10 +19332,9 @@ var utils$1 = /*#__PURE__*/Object.freeze({
|
||||
Indexed: Indexed
|
||||
});
|
||||
|
||||
const version$o = "ethers/5.0.0-beta.183";
|
||||
const version$o = "ethers/5.0.0-beta.184";
|
||||
|
||||
"use strict";
|
||||
const errors = Logger.errors;
|
||||
const logger$E = new Logger(version$o);
|
||||
|
||||
var ethers = /*#__PURE__*/Object.freeze({
|
||||
@ -19169,7 +19348,7 @@ var ethers = /*#__PURE__*/Object.freeze({
|
||||
BigNumber: BigNumber,
|
||||
FixedNumber: FixedNumber,
|
||||
constants: index$1,
|
||||
errors: errors,
|
||||
get errors () { return ErrorCode; },
|
||||
logger: logger$E,
|
||||
utils: utils$1,
|
||||
wordlists: wordlists,
|
||||
@ -19186,4 +19365,4 @@ try {
|
||||
}
|
||||
catch (error) { }
|
||||
|
||||
export { BigNumber, Contract, ContractFactory, FixedNumber, Signer, VoidSigner, Wallet, Wordlist, index$1 as constants, errors, ethers, getDefaultProvider, logger$E as logger, index$2 as providers, utils$1 as utils, version$o as version, wordlists };
|
||||
export { BigNumber, Contract, ContractFactory, FixedNumber, Signer, VoidSigner, Wallet, Wordlist, index$1 as constants, ErrorCode as errors, ethers, getDefaultProvider, logger$E as logger, index$2 as providers, utils$1 as utils, version$o as version, wordlists };
|
||||
|
4
packages/ethers/dist/ethers.esm.min.js
vendored
4
packages/ethers/dist/ethers.esm.min.js
vendored
File diff suppressed because one or more lines are too long
702
packages/ethers/dist/ethers.umd.js
vendored
702
packages/ethers/dist/ethers.umd.js
vendored
File diff suppressed because it is too large
Load Diff
4
packages/ethers/dist/ethers.umd.min.js
vendored
4
packages/ethers/dist/ethers.umd.min.js
vendored
File diff suppressed because one or more lines are too long
2
packages/ethers/lib.esm/_version.d.ts
vendored
2
packages/ethers/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.0-beta.183";
|
||||
export declare const version = "ethers/5.0.0-beta.184";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.0-beta.183";
|
||||
export const version = "ethers/5.0.0-beta.184";
|
||||
|
4
packages/ethers/lib.esm/ethers.d.ts
vendored
4
packages/ethers/lib.esm/ethers.d.ts
vendored
@ -7,9 +7,7 @@ import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
declare const errors: {
|
||||
[name: string]: string;
|
||||
};
|
||||
import { ErrorCode as errors } from "@ethersproject/logger";
|
||||
import { BigNumberish } from "@ethersproject/bignumber";
|
||||
import { Bytes, BytesLike, Signature } from "@ethersproject/bytes";
|
||||
import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
|
||||
|
@ -8,8 +8,7 @@ import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
const errors = Logger.errors;
|
||||
import { ErrorCode as errors, Logger } from "@ethersproject/logger";
|
||||
////////////////////////
|
||||
// Compile-Time Constants
|
||||
// This is generated by "npm run dist"
|
||||
|
4
packages/ethers/lib.esm/utils.d.ts
vendored
4
packages/ethers/lib.esm/utils.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { AbiCoder, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType } from "@ethersproject/abi";
|
||||
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType, Result } from "@ethersproject/abi";
|
||||
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
|
||||
import * as base64 from "@ethersproject/base64";
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
|
||||
@ -27,4 +27,4 @@ import { Mnemonic } from "@ethersproject/hdnode";
|
||||
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
|
||||
import { Utf8ErrorFunc } from "@ethersproject/strings";
|
||||
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, PollOptions } from "@ethersproject/web";
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
import { AbiCoder, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType } from "@ethersproject/abi";
|
||||
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType } from "@ethersproject/abi";
|
||||
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
|
||||
import * as base64 from "@ethersproject/base64";
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
|
||||
@ -25,7 +25,7 @@ import { SupportedAlgorithm } from "@ethersproject/sha2";
|
||||
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
|
||||
////////////////////////
|
||||
// Exports
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
|
||||
////////////////////////
|
||||
// Enums
|
||||
SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Indexed };
|
||||
|
2
packages/ethers/lib/_version.d.ts
vendored
2
packages/ethers/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.0-beta.183";
|
||||
export declare const version = "ethers/5.0.0-beta.184";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "ethers/5.0.0-beta.183";
|
||||
exports.version = "ethers/5.0.0-beta.184";
|
||||
|
4
packages/ethers/lib/ethers.d.ts
vendored
4
packages/ethers/lib/ethers.d.ts
vendored
@ -7,9 +7,7 @@ import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
declare const errors: {
|
||||
[name: string]: string;
|
||||
};
|
||||
import { ErrorCode as errors } from "@ethersproject/logger";
|
||||
import { BigNumberish } from "@ethersproject/bignumber";
|
||||
import { Bytes, BytesLike, Signature } from "@ethersproject/bytes";
|
||||
import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
|
||||
|
@ -30,8 +30,7 @@ exports.wordlists = wordlists_1.wordlists;
|
||||
var utils = __importStar(require("./utils"));
|
||||
exports.utils = utils;
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var errors = logger_1.Logger.errors;
|
||||
exports.errors = errors;
|
||||
exports.errors = logger_1.ErrorCode;
|
||||
////////////////////////
|
||||
// Compile-Time Constants
|
||||
// This is generated by "npm run dist"
|
||||
|
4
packages/ethers/lib/utils.d.ts
vendored
4
packages/ethers/lib/utils.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { AbiCoder, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType } from "@ethersproject/abi";
|
||||
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, ParamType, Result } from "@ethersproject/abi";
|
||||
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
|
||||
import * as base64 from "@ethersproject/base64";
|
||||
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
|
||||
@ -27,4 +27,4 @@ import { Mnemonic } from "@ethersproject/hdnode";
|
||||
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
|
||||
import { Utf8ErrorFunc } from "@ethersproject/strings";
|
||||
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, PollOptions } from "@ethersproject/web";
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
|
||||
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
|
||||
|
@ -9,6 +9,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var abi_1 = require("@ethersproject/abi");
|
||||
exports.AbiCoder = abi_1.AbiCoder;
|
||||
exports.checkResultErrors = abi_1.checkResultErrors;
|
||||
exports.defaultAbiCoder = abi_1.defaultAbiCoder;
|
||||
exports.EventFragment = abi_1.EventFragment;
|
||||
exports.FormatTypes = abi_1.FormatTypes;
|
||||
|
@ -52,7 +52,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x3933d6c571e157630b196b1b19aa7e6e8cd39449d6d49a34dd7a43620e82d6d6",
|
||||
"tarballHash": "0xe7fde79b90741bba88d2695afab4ea68500ca252c005a1d68af983003f04f134",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.183"
|
||||
"version": "5.0.0-beta.184"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.0-beta.183";
|
||||
export const version = "ethers/5.0.0-beta.184";
|
||||
|
@ -8,7 +8,7 @@ else {
|
||||
ethers = w._ethers;
|
||||
}
|
||||
|
||||
const version = "hardware-wallets/5.0.0-beta.5";
|
||||
const version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
||||
var global$1 = (typeof global !== "undefined" ? global :
|
||||
typeof self !== "undefined" ? self :
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
export declare const version = "hardware-wallets/5.0.0-beta.5";
|
||||
export declare const version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "hardware-wallets/5.0.0-beta.5";
|
||||
export const version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
@ -1,6 +1,35 @@
|
||||
"use strict";
|
||||
import hid from "@ledgerhq/hw-transport-node-hid";
|
||||
export const transports = {
|
||||
"hid": hid,
|
||||
"default": hid
|
||||
};
|
||||
let hidCache = null;
|
||||
const hidWrapper = Object.freeze({
|
||||
create: function () {
|
||||
// Load the library if not loaded
|
||||
if (hidCache == null) {
|
||||
hidCache = new Promise((resolve, reject) => {
|
||||
try {
|
||||
let hid = require("@ledgerhq/hw-transport-node-hid");
|
||||
if (hid.create == null) {
|
||||
resolve(hid["default"]);
|
||||
}
|
||||
resolve(hid);
|
||||
}
|
||||
catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
/*
|
||||
hidCache = import("@ledgerhq/hw-transport-node-hid").then((hid) => {
|
||||
if (hid.create == null) { return hid["default"]; }
|
||||
return hid;
|
||||
});
|
||||
*/
|
||||
}
|
||||
return hidCache.then((hid) => {
|
||||
console.log(hid, hid.create);
|
||||
return hid.create();
|
||||
});
|
||||
}
|
||||
});
|
||||
export const transports = Object.freeze({
|
||||
"hid": hidWrapper,
|
||||
"default": hidWrapper
|
||||
});
|
||||
|
2
packages/hardware-wallets/lib/_version.d.ts
vendored
2
packages/hardware-wallets/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "hardware-wallets/5.0.0-beta.5";
|
||||
export declare const version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "hardware-wallets/5.0.0-beta.5";
|
||||
exports.version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
@ -1,10 +1,36 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var hw_transport_node_hid_1 = __importDefault(require("@ledgerhq/hw-transport-node-hid"));
|
||||
exports.transports = {
|
||||
"hid": hw_transport_node_hid_1.default,
|
||||
"default": hw_transport_node_hid_1.default
|
||||
};
|
||||
var hidCache = null;
|
||||
var hidWrapper = Object.freeze({
|
||||
create: function () {
|
||||
// Load the library if not loaded
|
||||
if (hidCache == null) {
|
||||
hidCache = new Promise(function (resolve, reject) {
|
||||
try {
|
||||
var hid = require("@ledgerhq/hw-transport-node-hid");
|
||||
if (hid.create == null) {
|
||||
resolve(hid["default"]);
|
||||
}
|
||||
resolve(hid);
|
||||
}
|
||||
catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
/*
|
||||
hidCache = import("@ledgerhq/hw-transport-node-hid").then((hid) => {
|
||||
if (hid.create == null) { return hid["default"]; }
|
||||
return hid;
|
||||
});
|
||||
*/
|
||||
}
|
||||
return hidCache.then(function (hid) {
|
||||
console.log(hid, hid.create);
|
||||
return hid.create();
|
||||
});
|
||||
}
|
||||
});
|
||||
exports.transports = Object.freeze({
|
||||
"hid": hidWrapper,
|
||||
"default": hidWrapper
|
||||
});
|
||||
|
@ -45,7 +45,7 @@
|
||||
"scripts": {
|
||||
"test": "exit 1"
|
||||
},
|
||||
"tarballHash": "0x1b67e58e1190281f2ec7f3534b77c3070b9e82f3f125ef96763b8038acb23f92",
|
||||
"tarballHash": "0xc5f556e1622d0e26ef0cdfe749ea01afdd5327238178bf352cfe5b889e7ec91d",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.5"
|
||||
"version": "5.0.0-beta.6"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "hardware-wallets/5.0.0-beta.5";
|
||||
export const version = "hardware-wallets/5.0.0-beta.6";
|
||||
|
2
packages/hdnode/lib.esm/_version.d.ts
vendored
2
packages/hdnode/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "hdnode/5.0.0-beta.138";
|
||||
export declare const version = "hdnode/5.0.0-beta.139";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "hdnode/5.0.0-beta.138";
|
||||
export const version = "hdnode/5.0.0-beta.139";
|
||||
|
@ -241,7 +241,7 @@ export class HDNode {
|
||||
}
|
||||
return new HDNode(_constructorGuard, hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null);
|
||||
}
|
||||
return logger.throwError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
}
|
||||
}
|
||||
export function mnemonicToSeed(mnemonic, password) {
|
||||
|
2
packages/hdnode/lib/_version.d.ts
vendored
2
packages/hdnode/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "hdnode/5.0.0-beta.138";
|
||||
export declare const version = "hdnode/5.0.0-beta.139";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "hdnode/5.0.0-beta.138";
|
||||
exports.version = "hdnode/5.0.0-beta.139";
|
||||
|
@ -247,7 +247,7 @@ var HDNode = /** @class */ (function () {
|
||||
}
|
||||
return new HDNode(_constructorGuard, bytes_1.hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null);
|
||||
}
|
||||
return logger.throwError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
};
|
||||
return HDNode;
|
||||
}());
|
||||
|
@ -34,7 +34,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x1ccea694966b7c00d395ae5225c7cdb0f53b4ca47694e72ae2712c347f66d08e",
|
||||
"tarballHash": "0xc4007b5f6a015f9f5942d6437a8497403202f732a428274a9b310a2bb68a0ad5",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.138"
|
||||
"version": "5.0.0-beta.139"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "hdnode/5.0.0-beta.138";
|
||||
export const version = "hdnode/5.0.0-beta.139";
|
||||
|
2
packages/json-wallets/lib.esm/_version.d.ts
vendored
2
packages/json-wallets/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "json-wallets/5.0.0-beta.137";
|
||||
export declare const version = "json-wallets/5.0.0-beta.138";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "json-wallets/5.0.0-beta.137";
|
||||
export const version = "json-wallets/5.0.0-beta.138";
|
||||
|
3
packages/json-wallets/lib.esm/crowdsale.d.ts
vendored
3
packages/json-wallets/lib.esm/crowdsale.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
import { ExternallyOwnedAccount } from "@ethersproject/abstract-signer";
|
||||
import { Bytes } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
interface _CrowdsaleAccount {
|
||||
export interface _CrowdsaleAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
_isCrowdsaleAccount: boolean;
|
||||
@ -15,4 +15,3 @@ export declare class CrowdsaleAccount extends Description<_CrowdsaleAccount> imp
|
||||
isCrowdsaleAccount(value: any): value is CrowdsaleAccount;
|
||||
}
|
||||
export declare function decrypt(json: string, password: Bytes | string): ExternallyOwnedAccount;
|
||||
export {};
|
||||
|
3
packages/json-wallets/lib.esm/keystore.d.ts
vendored
3
packages/json-wallets/lib.esm/keystore.d.ts
vendored
@ -2,7 +2,7 @@ import { ExternallyOwnedAccount } from "@ethersproject/abstract-signer";
|
||||
import { Bytes, BytesLike } from "@ethersproject/bytes";
|
||||
import { Mnemonic } from "@ethersproject/hdnode";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
interface _KeystoreAccount {
|
||||
export interface _KeystoreAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
mnemonic?: Mnemonic;
|
||||
@ -31,4 +31,3 @@ export declare type EncryptOptions = {
|
||||
export declare function decryptSync(json: string, password: Bytes | string): KeystoreAccount;
|
||||
export declare function decrypt(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<KeystoreAccount>;
|
||||
export declare function encrypt(account: ExternallyOwnedAccount, password: Bytes | string, options?: EncryptOptions, progressCallback?: ProgressCallback): Promise<string>;
|
||||
export {};
|
||||
|
2
packages/json-wallets/lib/_version.d.ts
vendored
2
packages/json-wallets/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "json-wallets/5.0.0-beta.137";
|
||||
export declare const version = "json-wallets/5.0.0-beta.138";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "json-wallets/5.0.0-beta.137";
|
||||
exports.version = "json-wallets/5.0.0-beta.138";
|
||||
|
3
packages/json-wallets/lib/crowdsale.d.ts
vendored
3
packages/json-wallets/lib/crowdsale.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
import { ExternallyOwnedAccount } from "@ethersproject/abstract-signer";
|
||||
import { Bytes } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
interface _CrowdsaleAccount {
|
||||
export interface _CrowdsaleAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
_isCrowdsaleAccount: boolean;
|
||||
@ -15,4 +15,3 @@ export declare class CrowdsaleAccount extends Description<_CrowdsaleAccount> imp
|
||||
isCrowdsaleAccount(value: any): value is CrowdsaleAccount;
|
||||
}
|
||||
export declare function decrypt(json: string, password: Bytes | string): ExternallyOwnedAccount;
|
||||
export {};
|
||||
|
3
packages/json-wallets/lib/keystore.d.ts
vendored
3
packages/json-wallets/lib/keystore.d.ts
vendored
@ -2,7 +2,7 @@ import { ExternallyOwnedAccount } from "@ethersproject/abstract-signer";
|
||||
import { Bytes, BytesLike } from "@ethersproject/bytes";
|
||||
import { Mnemonic } from "@ethersproject/hdnode";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
interface _KeystoreAccount {
|
||||
export interface _KeystoreAccount {
|
||||
address: string;
|
||||
privateKey: string;
|
||||
mnemonic?: Mnemonic;
|
||||
@ -31,4 +31,3 @@ export declare type EncryptOptions = {
|
||||
export declare function decryptSync(json: string, password: Bytes | string): KeystoreAccount;
|
||||
export declare function decrypt(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise<KeystoreAccount>;
|
||||
export declare function encrypt(account: ExternallyOwnedAccount, password: Bytes | string, options?: EncryptOptions, progressCallback?: ProgressCallback): Promise<string>;
|
||||
export {};
|
||||
|
@ -36,7 +36,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x444f5beaea128ad7f3894689177e2b70875b2ddd08fcae32a0dd09d499f6bf81",
|
||||
"tarballHash": "0x1b8de5f813685d657c1fc20d0a7bd90d2d297e03341a9a93c5d65d594bdb7862",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.137"
|
||||
"version": "5.0.0-beta.138"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "json-wallets/5.0.0-beta.137";
|
||||
export const version = "json-wallets/5.0.0-beta.138";
|
||||
|
2
packages/logger/lib.esm/_version.d.ts
vendored
2
packages/logger/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "logger/5.0.0-beta.136";
|
||||
export declare const version = "logger/5.0.0-beta.137";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "logger/5.0.0-beta.136";
|
||||
export const version = "logger/5.0.0-beta.137";
|
||||
|
55
packages/logger/lib.esm/index.d.ts
vendored
55
packages/logger/lib.esm/index.d.ts
vendored
@ -1,35 +1,40 @@
|
||||
export declare type LogLevel = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "OFF";
|
||||
export declare enum LogLevel {
|
||||
DEBUG = "DEBUG",
|
||||
INFO = "INFO",
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
OFF = "OFF"
|
||||
}
|
||||
export declare enum ErrorCode {
|
||||
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
||||
NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
|
||||
UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
|
||||
NETWORK_ERROR = "NETWORK_ERROR",
|
||||
SERVER_ERROR = "SERVER_ERROR",
|
||||
TIMEOUT = "TIMEOUT",
|
||||
BUFFER_OVERRUN = "BUFFER_OVERRUN",
|
||||
NUMERIC_FAULT = "NUMERIC_FAULT",
|
||||
MISSING_NEW = "MISSING_NEW",
|
||||
INVALID_ARGUMENT = "INVALID_ARGUMENT",
|
||||
MISSING_ARGUMENT = "MISSING_ARGUMENT",
|
||||
UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT",
|
||||
CALL_EXCEPTION = "CALL_EXCEPTION",
|
||||
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
||||
NONCE_EXPIRED = "NONCE_EXPIRED",
|
||||
REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED",
|
||||
UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT"
|
||||
}
|
||||
export declare class Logger {
|
||||
readonly version: string;
|
||||
static errors: {
|
||||
UNKNOWN_ERROR: string;
|
||||
NOT_IMPLEMENTED: string;
|
||||
UNSUPPORTED_OPERATION: string;
|
||||
NETWORK_ERROR: string;
|
||||
SERVER_ERROR: string;
|
||||
TIMEOUT: string;
|
||||
BUFFER_OVERRUN: string;
|
||||
NUMERIC_FAULT: string;
|
||||
MISSING_NEW: string;
|
||||
INVALID_ARGUMENT: string;
|
||||
MISSING_ARGUMENT: string;
|
||||
UNEXPECTED_ARGUMENT: string;
|
||||
CALL_EXCEPTION: string;
|
||||
INSUFFICIENT_FUNDS: string;
|
||||
NONCE_EXPIRED: string;
|
||||
REPLACEMENT_UNDERPRICED: string;
|
||||
UNPREDICTABLE_GAS_LIMIT: string;
|
||||
};
|
||||
static levels: {
|
||||
[name: string]: LogLevel;
|
||||
};
|
||||
static errors: typeof ErrorCode;
|
||||
static levels: typeof LogLevel;
|
||||
constructor(version: string);
|
||||
_log(logLevel: LogLevel, args: Array<any>): void;
|
||||
debug(...args: Array<any>): void;
|
||||
info(...args: Array<any>): void;
|
||||
warn(...args: Array<any>): void;
|
||||
makeError(message: string, code?: string, params?: any): Error;
|
||||
throwError(message: string, code?: string, params?: any): never;
|
||||
makeError(message: string, code?: ErrorCode, params?: any): Error;
|
||||
throwError(message: string, code?: ErrorCode, params?: any): never;
|
||||
throwArgumentError(message: string, name: string, value: any): never;
|
||||
checkNormalize(message?: string): void;
|
||||
checkSafeUint53(value: number, message?: string): void;
|
||||
|
@ -2,7 +2,7 @@
|
||||
let _permanentCensorErrors = false;
|
||||
let _censorErrors = false;
|
||||
const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
|
||||
let LogLevel = LogLevels["default"];
|
||||
let _logLevel = LogLevels["default"];
|
||||
import { version } from "./_version";
|
||||
let _globalLogger = null;
|
||||
function _checkNormalize() {
|
||||
@ -33,6 +33,81 @@ function _checkNormalize() {
|
||||
return null;
|
||||
}
|
||||
const _normalizeError = _checkNormalize();
|
||||
export var LogLevel;
|
||||
(function (LogLevel) {
|
||||
LogLevel["DEBUG"] = "DEBUG";
|
||||
LogLevel["INFO"] = "INFO";
|
||||
LogLevel["WARNING"] = "WARNING";
|
||||
LogLevel["ERROR"] = "ERROR";
|
||||
LogLevel["OFF"] = "OFF";
|
||||
})(LogLevel || (LogLevel = {}));
|
||||
export var ErrorCode;
|
||||
(function (ErrorCode) {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
||||
// Not Implemented
|
||||
ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
||||
// Some sort of bad response from the server
|
||||
ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
|
||||
// Timeout
|
||||
ErrorCode["TIMEOUT"] = "TIMEOUT";
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
ErrorCode["MISSING_NEW"] = "MISSING_NEW";
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
|
||||
})(ErrorCode || (ErrorCode = {}));
|
||||
;
|
||||
export class Logger {
|
||||
constructor(version) {
|
||||
Object.defineProperty(this, "version", {
|
||||
@ -46,7 +121,7 @@ export class Logger {
|
||||
if (LogLevels[level] == null) {
|
||||
this.throwArgumentError("invalid log level name", "logLevel", logLevel);
|
||||
}
|
||||
if (LogLevel > LogLevels[level]) {
|
||||
if (_logLevel > LogLevels[level]) {
|
||||
return;
|
||||
}
|
||||
console.log.apply(console, args);
|
||||
@ -198,78 +273,8 @@ export class Logger {
|
||||
Logger.globalLogger().warn("invalid log level - " + logLevel);
|
||||
return;
|
||||
}
|
||||
LogLevel = level;
|
||||
_logLevel = level;
|
||||
}
|
||||
}
|
||||
Logger.errors = {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
||||
// Not Implemented
|
||||
NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION",
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
NETWORK_ERROR: "NETWORK_ERROR",
|
||||
// Some sort of bad response from the server
|
||||
SERVER_ERROR: "SERVER_ERROR",
|
||||
// Timeout
|
||||
TIMEOUT: "TIMEOUT",
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
BUFFER_OVERRUN: "BUFFER_OVERRUN",
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
NUMERIC_FAULT: "NUMERIC_FAULT",
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
MISSING_NEW: "MISSING_NEW",
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
INVALID_ARGUMENT: "INVALID_ARGUMENT",
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
MISSING_ARGUMENT: "MISSING_ARGUMENT",
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
UNEXPECTED_ARGUMENT: "UNEXPECTED_ARGUMENT",
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
CALL_EXCEPTION: "CALL_EXCEPTION",
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS",
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
NONCE_EXPIRED: "NONCE_EXPIRED",
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
REPLACEMENT_UNDERPRICED: "REPLACEMENT_UNDERPRICED",
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
UNPREDICTABLE_GAS_LIMIT: "UNPREDICTABLE_GAS_LIMIT",
|
||||
};
|
||||
Logger.levels = {
|
||||
DEBUG: "DEBUG",
|
||||
INFO: "INFO",
|
||||
WARNING: "WARNING",
|
||||
ERROR: "ERROR",
|
||||
OFF: "OFF"
|
||||
};
|
||||
Logger.errors = ErrorCode;
|
||||
Logger.levels = LogLevel;
|
||||
|
2
packages/logger/lib/_version.d.ts
vendored
2
packages/logger/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "logger/5.0.0-beta.136";
|
||||
export declare const version = "logger/5.0.0-beta.137";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "logger/5.0.0-beta.136";
|
||||
exports.version = "logger/5.0.0-beta.137";
|
||||
|
55
packages/logger/lib/index.d.ts
vendored
55
packages/logger/lib/index.d.ts
vendored
@ -1,35 +1,40 @@
|
||||
export declare type LogLevel = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "OFF";
|
||||
export declare enum LogLevel {
|
||||
DEBUG = "DEBUG",
|
||||
INFO = "INFO",
|
||||
WARNING = "WARNING",
|
||||
ERROR = "ERROR",
|
||||
OFF = "OFF"
|
||||
}
|
||||
export declare enum ErrorCode {
|
||||
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
||||
NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
|
||||
UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
|
||||
NETWORK_ERROR = "NETWORK_ERROR",
|
||||
SERVER_ERROR = "SERVER_ERROR",
|
||||
TIMEOUT = "TIMEOUT",
|
||||
BUFFER_OVERRUN = "BUFFER_OVERRUN",
|
||||
NUMERIC_FAULT = "NUMERIC_FAULT",
|
||||
MISSING_NEW = "MISSING_NEW",
|
||||
INVALID_ARGUMENT = "INVALID_ARGUMENT",
|
||||
MISSING_ARGUMENT = "MISSING_ARGUMENT",
|
||||
UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT",
|
||||
CALL_EXCEPTION = "CALL_EXCEPTION",
|
||||
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
||||
NONCE_EXPIRED = "NONCE_EXPIRED",
|
||||
REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED",
|
||||
UNPREDICTABLE_GAS_LIMIT = "UNPREDICTABLE_GAS_LIMIT"
|
||||
}
|
||||
export declare class Logger {
|
||||
readonly version: string;
|
||||
static errors: {
|
||||
UNKNOWN_ERROR: string;
|
||||
NOT_IMPLEMENTED: string;
|
||||
UNSUPPORTED_OPERATION: string;
|
||||
NETWORK_ERROR: string;
|
||||
SERVER_ERROR: string;
|
||||
TIMEOUT: string;
|
||||
BUFFER_OVERRUN: string;
|
||||
NUMERIC_FAULT: string;
|
||||
MISSING_NEW: string;
|
||||
INVALID_ARGUMENT: string;
|
||||
MISSING_ARGUMENT: string;
|
||||
UNEXPECTED_ARGUMENT: string;
|
||||
CALL_EXCEPTION: string;
|
||||
INSUFFICIENT_FUNDS: string;
|
||||
NONCE_EXPIRED: string;
|
||||
REPLACEMENT_UNDERPRICED: string;
|
||||
UNPREDICTABLE_GAS_LIMIT: string;
|
||||
};
|
||||
static levels: {
|
||||
[name: string]: LogLevel;
|
||||
};
|
||||
static errors: typeof ErrorCode;
|
||||
static levels: typeof LogLevel;
|
||||
constructor(version: string);
|
||||
_log(logLevel: LogLevel, args: Array<any>): void;
|
||||
debug(...args: Array<any>): void;
|
||||
info(...args: Array<any>): void;
|
||||
warn(...args: Array<any>): void;
|
||||
makeError(message: string, code?: string, params?: any): Error;
|
||||
throwError(message: string, code?: string, params?: any): never;
|
||||
makeError(message: string, code?: ErrorCode, params?: any): Error;
|
||||
throwError(message: string, code?: ErrorCode, params?: any): never;
|
||||
throwArgumentError(message: string, name: string, value: any): never;
|
||||
checkNormalize(message?: string): void;
|
||||
checkSafeUint53(value: number, message?: string): void;
|
||||
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var _permanentCensorErrors = false;
|
||||
var _censorErrors = false;
|
||||
var LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
|
||||
var LogLevel = LogLevels["default"];
|
||||
var _logLevel = LogLevels["default"];
|
||||
var _version_1 = require("./_version");
|
||||
var _globalLogger = null;
|
||||
function _checkNormalize() {
|
||||
@ -34,6 +34,81 @@ function _checkNormalize() {
|
||||
return null;
|
||||
}
|
||||
var _normalizeError = _checkNormalize();
|
||||
var LogLevel;
|
||||
(function (LogLevel) {
|
||||
LogLevel["DEBUG"] = "DEBUG";
|
||||
LogLevel["INFO"] = "INFO";
|
||||
LogLevel["WARNING"] = "WARNING";
|
||||
LogLevel["ERROR"] = "ERROR";
|
||||
LogLevel["OFF"] = "OFF";
|
||||
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
|
||||
var ErrorCode;
|
||||
(function (ErrorCode) {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
||||
// Not Implemented
|
||||
ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
|
||||
// Some sort of bad response from the server
|
||||
ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
|
||||
// Timeout
|
||||
ErrorCode["TIMEOUT"] = "TIMEOUT";
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
ErrorCode["MISSING_NEW"] = "MISSING_NEW";
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
|
||||
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
||||
;
|
||||
var Logger = /** @class */ (function () {
|
||||
function Logger(version) {
|
||||
Object.defineProperty(this, "version", {
|
||||
@ -47,7 +122,7 @@ var Logger = /** @class */ (function () {
|
||||
if (LogLevels[level] == null) {
|
||||
this.throwArgumentError("invalid log level name", "logLevel", logLevel);
|
||||
}
|
||||
if (LogLevel > LogLevels[level]) {
|
||||
if (_logLevel > LogLevels[level]) {
|
||||
return;
|
||||
}
|
||||
console.log.apply(console, args);
|
||||
@ -211,80 +286,10 @@ var Logger = /** @class */ (function () {
|
||||
Logger.globalLogger().warn("invalid log level - " + logLevel);
|
||||
return;
|
||||
}
|
||||
LogLevel = level;
|
||||
};
|
||||
Logger.errors = {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
||||
// Not Implemented
|
||||
NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION",
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
NETWORK_ERROR: "NETWORK_ERROR",
|
||||
// Some sort of bad response from the server
|
||||
SERVER_ERROR: "SERVER_ERROR",
|
||||
// Timeout
|
||||
TIMEOUT: "TIMEOUT",
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
BUFFER_OVERRUN: "BUFFER_OVERRUN",
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
NUMERIC_FAULT: "NUMERIC_FAULT",
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
MISSING_NEW: "MISSING_NEW",
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
INVALID_ARGUMENT: "INVALID_ARGUMENT",
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
MISSING_ARGUMENT: "MISSING_ARGUMENT",
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
UNEXPECTED_ARGUMENT: "UNEXPECTED_ARGUMENT",
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
CALL_EXCEPTION: "CALL_EXCEPTION",
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS",
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
NONCE_EXPIRED: "NONCE_EXPIRED",
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
REPLACEMENT_UNDERPRICED: "REPLACEMENT_UNDERPRICED",
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
UNPREDICTABLE_GAS_LIMIT: "UNPREDICTABLE_GAS_LIMIT",
|
||||
};
|
||||
Logger.levels = {
|
||||
DEBUG: "DEBUG",
|
||||
INFO: "INFO",
|
||||
WARNING: "WARNING",
|
||||
ERROR: "ERROR",
|
||||
OFF: "OFF"
|
||||
_logLevel = level;
|
||||
};
|
||||
Logger.errors = ErrorCode;
|
||||
Logger.levels = LogLevel;
|
||||
return Logger;
|
||||
}());
|
||||
exports.Logger = Logger;
|
||||
|
@ -20,7 +20,7 @@
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x7dcdd3660d324cf630afc8448c159140e7a32c258876eed2347f80087c4014ab",
|
||||
"tarballHash": "0x59eb4972c0c657d104172e9e5fd6533142a058cf85d0dc22fa8bba04249a5948",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.136"
|
||||
"version": "5.0.0-beta.137"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "logger/5.0.0-beta.136";
|
||||
export const version = "logger/5.0.0-beta.137";
|
||||
|
2
packages/properties/lib.esm/_version.d.ts
vendored
2
packages/properties/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "properties/5.0.0-beta.138";
|
||||
export declare const version = "properties/5.0.0-beta.139";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "properties/5.0.0-beta.138";
|
||||
export const version = "properties/5.0.0-beta.139";
|
||||
|
4
packages/properties/lib.esm/index.d.ts
vendored
4
packages/properties/lib.esm/index.d.ts
vendored
@ -13,5 +13,7 @@ export declare function checkProperties(object: any, properties: {
|
||||
export declare function shallowCopy<T>(object: T): Similar<T>;
|
||||
export declare function deepCopy<T>(object: T): Similar<T>;
|
||||
export declare class Description<T = any> {
|
||||
constructor(info: T);
|
||||
constructor(info: {
|
||||
[K in keyof T]: T[K];
|
||||
});
|
||||
}
|
||||
|
2
packages/properties/lib/_version.d.ts
vendored
2
packages/properties/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "properties/5.0.0-beta.138";
|
||||
export declare const version = "properties/5.0.0-beta.139";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "properties/5.0.0-beta.138";
|
||||
exports.version = "properties/5.0.0-beta.139";
|
||||
|
4
packages/properties/lib/index.d.ts
vendored
4
packages/properties/lib/index.d.ts
vendored
@ -13,5 +13,7 @@ export declare function checkProperties(object: any, properties: {
|
||||
export declare function shallowCopy<T>(object: T): Similar<T>;
|
||||
export declare function deepCopy<T>(object: T): Similar<T>;
|
||||
export declare class Description<T = any> {
|
||||
constructor(info: T);
|
||||
constructor(info: {
|
||||
[K in keyof T]: T[K];
|
||||
});
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
"build": "tsc -p ./tsconfig.json",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0xc868f786ee8b824aeda94ee2ec87d4d11785bfbfd29d723e374a2daebed1a72b",
|
||||
"tarballHash": "0x932455e8db6cb491d012ad22776efd4ad25b1e688981cada4a39277aec2182ac",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.0-beta.138"
|
||||
"version": "5.0.0-beta.139"
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user