Updated dist files.
This commit is contained in:
parent
de4d683f6d
commit
dad3829c2e
@ -3,7 +3,7 @@ Changelog
|
||||
|
||||
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.2.0 (2021-05-13 23:44)
|
||||
ethers/v5.2.0 (2021-05-17 16:18)
|
||||
--------------------------------
|
||||
|
||||
- More aggresively check for mempool transactions sent from JsonRpcSigner. ([3316468](https://github.com/ethers-io/ethers.js/commit/3316468e3e0a5925cbecad85d894cc7d622394e7))
|
||||
|
1084
package-lock.json
generated
1084
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
2
packages/abi/lib.esm/_version.d.ts
vendored
2
packages/abi/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "abi/5.1.2";
|
||||
export declare const version = "abi/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "abi/5.1.2";
|
||||
export const version = "abi/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
7
packages/abi/lib.esm/fragments.d.ts
vendored
7
packages/abi/lib.esm/fragments.d.ts
vendored
@ -74,4 +74,11 @@ export declare class FunctionFragment extends ConstructorFragment {
|
||||
static fromString(value: string): FunctionFragment;
|
||||
static isFunctionFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
export declare class ErrorFragment extends Fragment {
|
||||
format(format?: string): string;
|
||||
static from(value: ErrorFragment | JsonFragment | string): ErrorFragment;
|
||||
static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment;
|
||||
static fromString(value: string): ErrorFragment;
|
||||
static isErrorFragment(value: any): value is ErrorFragment;
|
||||
}
|
||||
//# sourceMappingURL=fragments.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../src.ts/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAOrD,MAAM,WAAW,gBAAgB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C,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAoD/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,MAAM,GAAG,gBAAgB;IAO9E,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,gBAAgB;IAuB3E,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAmClD,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGnE;AAaD,qBAAa,aAAc,SAAQ,QAAQ;IAEvC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IA2B/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,aAAa;IAOxE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,aAAa;IAgBrE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAgB/C,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa;CAG7D"}
|
@ -355,6 +355,7 @@ export class Fragment {
|
||||
case "constructor":
|
||||
return ConstructorFragment.fromObject(value);
|
||||
case "error":
|
||||
return ErrorFragment.fromObject(value);
|
||||
case "fallback":
|
||||
case "receive":
|
||||
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
||||
@ -376,6 +377,9 @@ export class Fragment {
|
||||
else if (value.split("(")[0].trim() === "constructor") {
|
||||
return ConstructorFragment.fromString(value.trim());
|
||||
}
|
||||
else if (value.split(" ")[0] === "error") {
|
||||
return ErrorFragment.fromString(value.substring(5).trim());
|
||||
}
|
||||
return logger.throwArgumentError("unsupported fragment", "value", value);
|
||||
}
|
||||
static isFragment(value) {
|
||||
@ -731,10 +735,74 @@ export class FunctionFragment extends ConstructorFragment {
|
||||
return (value && value._isFragment && value.type === "function");
|
||||
}
|
||||
}
|
||||
//export class ErrorFragment extends Fragment {
|
||||
//}
|
||||
//export class StructFragment extends Fragment {
|
||||
//}
|
||||
function checkForbidden(fragment) {
|
||||
const sig = fragment.format();
|
||||
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
||||
logger.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
export class ErrorFragment extends Fragment {
|
||||
format(format) {
|
||||
if (!format) {
|
||||
format = FormatTypes.sighash;
|
||||
}
|
||||
if (!FormatTypes[format]) {
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
name: this.name,
|
||||
inputs: this.inputs.map((input) => JSON.parse(input.format(format))),
|
||||
});
|
||||
}
|
||||
let result = "";
|
||||
if (format !== FormatTypes.sighash) {
|
||||
result += "error ";
|
||||
}
|
||||
result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") ";
|
||||
return result.trim();
|
||||
}
|
||||
static from(value) {
|
||||
if (typeof (value) === "string") {
|
||||
return ErrorFragment.fromString(value);
|
||||
}
|
||||
return ErrorFragment.fromObject(value);
|
||||
}
|
||||
static fromObject(value) {
|
||||
if (ErrorFragment.isErrorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "error") {
|
||||
logger.throwArgumentError("invalid error object", "value", value);
|
||||
}
|
||||
const params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : [])
|
||||
};
|
||||
return checkForbidden(new ErrorFragment(_constructorGuard, params));
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "error" };
|
||||
let parens = value.match(regexParen);
|
||||
if (!parens) {
|
||||
logger.throwArgumentError("invalid error signature", "value", value);
|
||||
}
|
||||
params.name = parens[1].trim();
|
||||
if (params.name) {
|
||||
verifyIdentifier(params.name);
|
||||
}
|
||||
params.inputs = parseParams(parens[2], false);
|
||||
return checkForbidden(ErrorFragment.fromObject(params));
|
||||
}
|
||||
static isErrorFragment(value) {
|
||||
return (value && value._isFragment && value.type === "error");
|
||||
}
|
||||
}
|
||||
function verifyType(type) {
|
||||
// These need to be transformed to their full description
|
||||
if (type.match(/^uint($|[^1-9])/)) {
|
||||
|
File diff suppressed because one or more lines are too long
4
packages/abi/lib.esm/index.d.ts
vendored
4
packages/abi/lib.esm/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
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 };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpK,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { AbiCoder, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAU,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAUP,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AACpK,OAAO,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAU,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAUP,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
7
packages/abi/lib.esm/interface.d.ts
vendored
7
packages/abi/lib.esm/interface.d.ts
vendored
@ -3,7 +3,7 @@ import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
@ -28,7 +28,7 @@ export declare class Indexed extends Description<Indexed> {
|
||||
export declare class Interface {
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
readonly errors: {
|
||||
[name: string]: any;
|
||||
[name: string]: ErrorFragment;
|
||||
};
|
||||
readonly events: {
|
||||
[name: string]: EventFragment;
|
||||
@ -46,10 +46,11 @@ export declare class Interface {
|
||||
format(format?: string): string | Array<string>;
|
||||
static getAbiCoder(): AbiCoder;
|
||||
static getAddress(address: string): string;
|
||||
static getSighash(functionFragment: FunctionFragment): string;
|
||||
static getSighash(fragment: ErrorFragment | FunctionFragment): string;
|
||||
static getEventTopic(eventFragment: EventFragment): string;
|
||||
getFunction(nameOrSignatureOrSighash: string): FunctionFragment;
|
||||
getEvent(nameOrSignatureOrTopic: string): EventFragment;
|
||||
getError(nameOrSignatureOrSighash: string): ErrorFragment;
|
||||
getSighash(functionFragment: FunctionFragment | string): string;
|
||||
getEventTopic(eventFragment: EventFragment | string): string;
|
||||
_decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src.ts/interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAY,SAAS,EAA0D,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAkB,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAe,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMnI,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC3D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB;AAED,qBAAa,sBAAuB,SAAQ,WAAW,CAAC,sBAAsB,CAAC;IAC3E,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAA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,EAAE,gBAAgB,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM;IA+C1F,oBAAoB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM;IAStG,kBAAkB,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAyD3G,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAAE;IA4CjH,cAAc,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM;IA0F9G,gBAAgB,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,sBAAsB;IAoBpF,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,cAAc;IAgCrE,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD"}
|
@ -21,6 +21,10 @@ export class Indexed extends Description {
|
||||
return !!(value && value._isIndexed);
|
||||
}
|
||||
}
|
||||
const BuiltinErrors = {
|
||||
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
||||
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
||||
};
|
||||
function wrapAccessError(property, error) {
|
||||
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
||||
wrap.error = error;
|
||||
@ -78,6 +82,9 @@ export class Interface {
|
||||
//checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = this.events;
|
||||
break;
|
||||
case "error":
|
||||
bucket = this.errors;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -118,8 +125,8 @@ export class Interface {
|
||||
static getAddress(address) {
|
||||
return getAddress(address);
|
||||
}
|
||||
static getSighash(functionFragment) {
|
||||
return hexDataSlice(id(functionFragment.format()), 0, 4);
|
||||
static getSighash(fragment) {
|
||||
return hexDataSlice(id(fragment.format()), 0, 4);
|
||||
}
|
||||
static getEventTopic(eventFragment) {
|
||||
return id(eventFragment.format());
|
||||
@ -183,6 +190,37 @@ export class Interface {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
getError(nameOrSignatureOrSighash) {
|
||||
if (isHexString(nameOrSignatureOrSighash)) {
|
||||
const getSighash = getStatic(this.constructor, "getSighash");
|
||||
for (const name in this.errors) {
|
||||
const error = this.errors[name];
|
||||
if (nameOrSignatureOrSighash === getSighash(error)) {
|
||||
return this.errors[name];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
const name = nameOrSignatureOrSighash.trim();
|
||||
const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching error", "name", name);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching errors", "name", name);
|
||||
}
|
||||
return this.errors[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
||||
getSighash(functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@ -234,6 +272,8 @@ export class Interface {
|
||||
}
|
||||
let bytes = arrayify(data);
|
||||
let reason = null;
|
||||
let errorArgs = null;
|
||||
let errorName = null;
|
||||
let errorSignature = null;
|
||||
switch (bytes.length % this._abiCoder._getWordSize()) {
|
||||
case 0:
|
||||
@ -242,18 +282,34 @@ export class Interface {
|
||||
}
|
||||
catch (error) { }
|
||||
break;
|
||||
case 4:
|
||||
if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
errorSignature = "Error(string)";
|
||||
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
case 4: {
|
||||
const selector = hexlify(bytes.slice(0, 4));
|
||||
const builtin = BuiltinErrors[selector];
|
||||
if (builtin) {
|
||||
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
||||
errorName = builtin.name;
|
||||
errorSignature = builtin.signature;
|
||||
if (builtin.reason) {
|
||||
reason = errorArgs[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
const error = this.getError(selector);
|
||||
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
||||
errorName = error.name;
|
||||
errorSignature = error.format();
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logger.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [reason],
|
||||
reason: reason
|
||||
errorArgs, errorName, errorSignature, reason
|
||||
});
|
||||
}
|
||||
// Encode the result for a function call (e.g. for eth_call)
|
||||
@ -459,6 +515,8 @@ export class Interface {
|
||||
value: BigNumber.from(tx.value || "0"),
|
||||
});
|
||||
}
|
||||
// @TODO
|
||||
//parseCallResult(data: BytesLike): ??
|
||||
// Given an event log, find the matching event fragment (if any) and
|
||||
// determine all its properties and values
|
||||
parseLog(log) {
|
||||
|
File diff suppressed because one or more lines are too long
2
packages/abi/lib/_version.d.ts
vendored
2
packages/abi/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "abi/5.1.2";
|
||||
export declare const version = "abi/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abi/5.1.2";
|
||||
exports.version = "abi/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
7
packages/abi/lib/fragments.d.ts
vendored
7
packages/abi/lib/fragments.d.ts
vendored
@ -74,4 +74,11 @@ export declare class FunctionFragment extends ConstructorFragment {
|
||||
static fromString(value: string): FunctionFragment;
|
||||
static isFunctionFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
export declare class ErrorFragment extends Fragment {
|
||||
format(format?: string): string;
|
||||
static from(value: ErrorFragment | JsonFragment | string): ErrorFragment;
|
||||
static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment;
|
||||
static fromString(value: string): ErrorFragment;
|
||||
static isErrorFragment(value: any): value is ErrorFragment;
|
||||
}
|
||||
//# sourceMappingURL=fragments.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../src.ts/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAOrD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC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GAAG,YAAY,GAAG,gBAAgB;IAuB3E,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAmClD,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGnE;AAaD,qBAAa,aAAc,SAAQ,QAAQ;IAEvC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IA2B/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,aAAa;IAOxE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,aAAa;IAgBrE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAgB/C,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa;CAG7D"}
|
@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FunctionFragment = exports.ConstructorFragment = exports.EventFragment = exports.Fragment = exports.ParamType = exports.FormatTypes = void 0;
|
||||
exports.ErrorFragment = exports.FunctionFragment = exports.ConstructorFragment = exports.EventFragment = exports.Fragment = exports.ParamType = exports.FormatTypes = void 0;
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
@ -374,6 +374,7 @@ var Fragment = /** @class */ (function () {
|
||||
case "constructor":
|
||||
return ConstructorFragment.fromObject(value);
|
||||
case "error":
|
||||
return ErrorFragment.fromObject(value);
|
||||
case "fallback":
|
||||
case "receive":
|
||||
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
||||
@ -395,6 +396,9 @@ var Fragment = /** @class */ (function () {
|
||||
else if (value.split("(")[0].trim() === "constructor") {
|
||||
return ConstructorFragment.fromString(value.trim());
|
||||
}
|
||||
else if (value.split(" ")[0] === "error") {
|
||||
return ErrorFragment.fromString(value.substring(5).trim());
|
||||
}
|
||||
return logger.throwArgumentError("unsupported fragment", "value", value);
|
||||
};
|
||||
Fragment.isFragment = function (value) {
|
||||
@ -770,10 +774,80 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
return FunctionFragment;
|
||||
}(ConstructorFragment));
|
||||
exports.FunctionFragment = FunctionFragment;
|
||||
//export class ErrorFragment extends Fragment {
|
||||
//}
|
||||
//export class StructFragment extends Fragment {
|
||||
//}
|
||||
function checkForbidden(fragment) {
|
||||
var sig = fragment.format();
|
||||
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
||||
logger.throwArgumentError("cannot specify user defined " + sig + " error", "fragment", fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
var ErrorFragment = /** @class */ (function (_super) {
|
||||
__extends(ErrorFragment, _super);
|
||||
function ErrorFragment() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ErrorFragment.prototype.format = function (format) {
|
||||
if (!format) {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
name: this.name,
|
||||
inputs: this.inputs.map(function (input) { return JSON.parse(input.format(format)); }),
|
||||
});
|
||||
}
|
||||
var result = "";
|
||||
if (format !== exports.FormatTypes.sighash) {
|
||||
result += "error ";
|
||||
}
|
||||
result += this.name + "(" + this.inputs.map(function (input) { return input.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ") ";
|
||||
return result.trim();
|
||||
};
|
||||
ErrorFragment.from = function (value) {
|
||||
if (typeof (value) === "string") {
|
||||
return ErrorFragment.fromString(value);
|
||||
}
|
||||
return ErrorFragment.fromObject(value);
|
||||
};
|
||||
ErrorFragment.fromObject = function (value) {
|
||||
if (ErrorFragment.isErrorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "error") {
|
||||
logger.throwArgumentError("invalid error object", "value", value);
|
||||
}
|
||||
var params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : [])
|
||||
};
|
||||
return checkForbidden(new ErrorFragment(_constructorGuard, params));
|
||||
};
|
||||
ErrorFragment.fromString = function (value) {
|
||||
var params = { type: "error" };
|
||||
var parens = value.match(regexParen);
|
||||
if (!parens) {
|
||||
logger.throwArgumentError("invalid error signature", "value", value);
|
||||
}
|
||||
params.name = parens[1].trim();
|
||||
if (params.name) {
|
||||
verifyIdentifier(params.name);
|
||||
}
|
||||
params.inputs = parseParams(parens[2], false);
|
||||
return checkForbidden(ErrorFragment.fromObject(params));
|
||||
};
|
||||
ErrorFragment.isErrorFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "error");
|
||||
};
|
||||
return ErrorFragment;
|
||||
}(Fragment));
|
||||
exports.ErrorFragment = ErrorFragment;
|
||||
function verifyType(type) {
|
||||
// These need to be transformed to their full description
|
||||
if (type.match(/^uint($|[^1-9])/)) {
|
||||
|
File diff suppressed because one or more lines are too long
4
packages/abi/lib/index.d.ts
vendored
4
packages/abi/lib/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
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 };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpK,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
@ -1,8 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TransactionDescription = exports.LogDescription = exports.checkResultErrors = exports.Indexed = exports.Interface = exports.defaultAbiCoder = exports.AbiCoder = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ConstructorFragment = void 0;
|
||||
exports.TransactionDescription = exports.LogDescription = exports.checkResultErrors = exports.Indexed = exports.Interface = exports.defaultAbiCoder = exports.AbiCoder = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = void 0;
|
||||
var fragments_1 = require("./fragments");
|
||||
Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_1.ConstructorFragment; } });
|
||||
Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_1.ErrorFragment; } });
|
||||
Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return fragments_1.EventFragment; } });
|
||||
Object.defineProperty(exports, "FormatTypes", { enumerable: true, get: function () { return fragments_1.FormatTypes; } });
|
||||
Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return fragments_1.Fragment; } });
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yCAAqJ;AAKjJ,oGALK,+BAAmB,OAKL;AACnB,8FAN0B,yBAAa,OAM1B;AAIb,4FAVyC,uBAAW,OAUzC;AAHX,yFAPsD,oBAAQ,OAOtD;AACR,iGARgE,4BAAgB,OAQhE;AAChB,0FATkH,qBAAS,OASlH;AARb,yCAAoE;AAWhE,yFAXK,oBAAQ,OAWL;AACR,gGAZ2B,2BAAe,OAY3B;AAXnB,yCAAoH;AAwBhH,kGAxBK,6BAAiB,OAwBL;AAVjB,wFAdwB,mBAAO,OAcxB;AADP,0FAbiC,qBAAS,OAajC;AAaT,+FA1B4C,0BAAc,OA0B5C;AACd,uGA3BoE,kCAAsB,OA2BpE"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yCAAoK;AAKhK,oGALK,+BAAmB,OAKL;AACnB,8FAN0B,yBAAa,OAM1B;AACb,8FAPyC,yBAAa,OAOzC;AAIb,4FAXwD,uBAAW,OAWxD;AAHX,yFARqE,oBAAQ,OAQrE;AACR,iGAT+E,4BAAgB,OAS/E;AAChB,0FAViI,qBAAS,OAUjI;AATb,yCAAoE;AAYhE,yFAZK,oBAAQ,OAYL;AACR,gGAb2B,2BAAe,OAa3B;AAZnB,yCAAoH;AAyBhH,kGAzBK,6BAAiB,OAyBL;AAVjB,wFAfwB,mBAAO,OAexB;AADP,0FAdiC,qBAAS,OAcjC;AAaT,+FA3B4C,0BAAc,OA2B5C;AACd,uGA5BoE,kCAAsB,OA4BpE"}
|
7
packages/abi/lib/interface.d.ts
vendored
7
packages/abi/lib/interface.d.ts
vendored
@ -3,7 +3,7 @@ import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
@ -28,7 +28,7 @@ export declare class Indexed extends Description<Indexed> {
|
||||
export declare class Interface {
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
readonly errors: {
|
||||
[name: string]: any;
|
||||
[name: string]: ErrorFragment;
|
||||
};
|
||||
readonly events: {
|
||||
[name: string]: EventFragment;
|
||||
@ -46,10 +46,11 @@ export declare class Interface {
|
||||
format(format?: string): string | Array<string>;
|
||||
static getAbiCoder(): AbiCoder;
|
||||
static getAddress(address: string): string;
|
||||
static getSighash(functionFragment: FunctionFragment): string;
|
||||
static getSighash(fragment: ErrorFragment | FunctionFragment): string;
|
||||
static getEventTopic(eventFragment: EventFragment): string;
|
||||
getFunction(nameOrSignatureOrSighash: string): FunctionFragment;
|
||||
getEvent(nameOrSignatureOrTopic: string): EventFragment;
|
||||
getError(nameOrSignatureOrSighash: string): ErrorFragment;
|
||||
getSighash(functionFragment: FunctionFragment | string): string;
|
||||
getEventTopic(eventFragment: EventFragment | string): string;
|
||||
_decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src.ts/interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAY,SAAS,EAA0D,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAkB,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAe,QAAQ,EAAE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C,MAAM,CAAC,GAAG,MAAM;IA0F9G,gBAAgB,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,sBAAsB;IAoBpF,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,cAAc;IAgCrE,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD"}
|
@ -56,6 +56,10 @@ var Indexed = /** @class */ (function (_super) {
|
||||
return Indexed;
|
||||
}(properties_1.Description));
|
||||
exports.Indexed = Indexed;
|
||||
var BuiltinErrors = {
|
||||
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
||||
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
||||
};
|
||||
function wrapAccessError(property, error) {
|
||||
var wrap = new Error("deferred error during ABI decoding triggered accessing " + property);
|
||||
wrap.error = error;
|
||||
@ -115,6 +119,9 @@ var Interface = /** @class */ (function () {
|
||||
//checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = _this.events;
|
||||
break;
|
||||
case "error":
|
||||
bucket = _this.errors;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -155,8 +162,8 @@ var Interface = /** @class */ (function () {
|
||||
Interface.getAddress = function (address) {
|
||||
return address_1.getAddress(address);
|
||||
};
|
||||
Interface.getSighash = function (functionFragment) {
|
||||
return bytes_1.hexDataSlice(hash_1.id(functionFragment.format()), 0, 4);
|
||||
Interface.getSighash = function (fragment) {
|
||||
return bytes_1.hexDataSlice(hash_1.id(fragment.format()), 0, 4);
|
||||
};
|
||||
Interface.getEventTopic = function (eventFragment) {
|
||||
return hash_1.id(eventFragment.format());
|
||||
@ -220,6 +227,37 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
Interface.prototype.getError = function (nameOrSignatureOrSighash) {
|
||||
if (bytes_1.isHexString(nameOrSignatureOrSighash)) {
|
||||
var getSighash = properties_1.getStatic(this.constructor, "getSighash");
|
||||
for (var name_5 in this.errors) {
|
||||
var error = this.errors[name_5];
|
||||
if (nameOrSignatureOrSighash === getSighash(error)) {
|
||||
return this.errors[name_5];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
var name_6 = nameOrSignatureOrSighash.trim();
|
||||
var matching = Object.keys(this.errors).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_6); });
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching error", "name", name_6);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching errors", "name", name_6);
|
||||
}
|
||||
return this.errors[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
var result = this.errors[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
||||
Interface.prototype.getSighash = function (functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@ -271,6 +309,8 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
var bytes = bytes_1.arrayify(data);
|
||||
var reason = null;
|
||||
var errorArgs = null;
|
||||
var errorName = null;
|
||||
var errorSignature = null;
|
||||
switch (bytes.length % this._abiCoder._getWordSize()) {
|
||||
case 0:
|
||||
@ -279,18 +319,34 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
catch (error) { }
|
||||
break;
|
||||
case 4:
|
||||
if (bytes_1.hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
errorSignature = "Error(string)";
|
||||
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
case 4: {
|
||||
var selector = bytes_1.hexlify(bytes.slice(0, 4));
|
||||
var builtin = BuiltinErrors[selector];
|
||||
if (builtin) {
|
||||
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
||||
errorName = builtin.name;
|
||||
errorSignature = builtin.signature;
|
||||
if (builtin.reason) {
|
||||
reason = errorArgs[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
var error = this.getError(selector);
|
||||
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
||||
errorName = error.name;
|
||||
errorSignature = error.format();
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [reason],
|
||||
reason: reason
|
||||
errorArgs: errorArgs, errorName: errorName, errorSignature: errorSignature, reason: reason
|
||||
});
|
||||
};
|
||||
// Encode the result for a function call (e.g. for eth_call)
|
||||
@ -501,6 +557,8 @@ var Interface = /** @class */ (function () {
|
||||
value: bignumber_1.BigNumber.from(tx.value || "0"),
|
||||
});
|
||||
};
|
||||
// @TODO
|
||||
//parseCallResult(data: BytesLike): ??
|
||||
// Given an event log, find the matching event fragment (if any) and
|
||||
// determine all its properties and values
|
||||
Interface.prototype.parseLog = function (log) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -43,7 +43,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0xe459a5af8cab842a836bac973a3c504dbe8e128cf500aa4067f886d6c1067c8a",
|
||||
"tarballHash": "0xe6a078fafe9b871044b84c2f528321d6f35a175220d2d0cd29b5f7b75b7c3752",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abi/5.1.2";
|
||||
export const version = "abi/5.2.0";
|
||||
|
@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-provider/5.1.0";
|
||||
export declare const version = "abstract-provider/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "abstract-provider/5.1.0";
|
||||
export const version = "abstract-provider/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -75,7 +75,7 @@ export interface TransactionReceipt {
|
||||
}
|
||||
export interface EventFilter {
|
||||
address?: string;
|
||||
topics?: Array<string | Array<string>>;
|
||||
topics?: Array<string | Array<string> | null>;
|
||||
}
|
||||
export interface Filter extends EventFilter {
|
||||
fromBlock?: BlockTag;
|
||||
|
File diff suppressed because one or more lines are too long
2
packages/abstract-provider/lib/_version.d.ts
vendored
2
packages/abstract-provider/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-provider/5.1.0";
|
||||
export declare const version = "abstract-provider/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abstract-provider/5.1.0";
|
||||
exports.version = "abstract-provider/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/abstract-provider/lib/index.d.ts
vendored
2
packages/abstract-provider/lib/index.d.ts
vendored
@ -75,7 +75,7 @@ export interface TransactionReceipt {
|
||||
}
|
||||
export interface EventFilter {
|
||||
address?: string;
|
||||
topics?: Array<string | Array<string>>;
|
||||
topics?: Array<string | Array<string> | null>;
|
||||
}
|
||||
export interface Filter extends EventFilter {
|
||||
fromBlock?: BlockTag;
|
||||
|
File diff suppressed because one or more lines are too long
@ -41,7 +41,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x9a2ee9005c813b52689b7d87a01f6ce29010ef3f899c5fc500e6ae3ea0f03ea2",
|
||||
"tarballHash": "0x7b9f83b84726a18491bd1665ff4d856364aba22521e78572353d1d9995ac1c4e",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abstract-provider/5.1.0";
|
||||
export const version = "abstract-provider/5.2.0";
|
||||
|
@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-signer/5.1.0";
|
||||
export declare const version = "abstract-signer/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "abstract-signer/5.1.0";
|
||||
export const version = "abstract-signer/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/abstract-signer/lib/_version.d.ts
vendored
2
packages/abstract-signer/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-signer/5.1.0";
|
||||
export declare const version = "abstract-signer/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abstract-signer/5.1.0";
|
||||
exports.version = "abstract-signer/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -39,7 +39,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x56d53f21cca4bb8b1b1f7c25edf66e7633dbe56c90164546110f4702c6d0650e",
|
||||
"tarballHash": "0x6a009bacd601b395a4cf53b290b3f3eb6e624fdaabf4b24940ecb1cf0836d096",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abstract-signer/5.1.0";
|
||||
export const version = "abstract-signer/5.2.0";
|
||||
|
2
packages/address/lib.esm/_version.d.ts
vendored
2
packages/address/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "address/5.1.0";
|
||||
export declare const version = "address/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "address/5.1.0";
|
||||
export const version = "address/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/address/lib/_version.d.ts
vendored
2
packages/address/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "address/5.1.0";
|
||||
export declare const version = "address/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "address/5.1.0";
|
||||
exports.version = "address/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -39,7 +39,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0xaa6a2ab1b7c3cad7bd17a3b20fc759b79d7ea911f01963a082af5385c46a14c6",
|
||||
"tarballHash": "0x6396accbb490919f6a66877226d5e82ed911aa84c4041464b0d1e0237da69a2e",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "address/5.1.0";
|
||||
export const version = "address/5.2.0";
|
||||
|
2
packages/asm/lib.esm/_version.d.ts
vendored
2
packages/asm/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "asm/5.1.0";
|
||||
export declare const version = "asm/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "asm/5.1.0";
|
||||
export const version = "asm/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/asm/lib/_version.d.ts
vendored
2
packages/asm/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "asm/5.1.0";
|
||||
export declare const version = "asm/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "asm/5.1.0";
|
||||
exports.version = "asm/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -36,7 +36,7 @@
|
||||
"generate": "node ./generate.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x08e35b51e252b8780fdd4fb88d2df605fc0ba2731a106f73738660fb263a2827",
|
||||
"tarballHash": "0xf903345c132095391c2259543c97dcac983d1ba94f75c60adb9e0026ce031086",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "asm/5.1.0";
|
||||
export const version = "asm/5.2.0";
|
||||
|
2
packages/base64/lib.esm/_version.d.ts
vendored
2
packages/base64/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "base64/5.1.0";
|
||||
export declare const version = "base64/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "base64/5.1.0";
|
||||
export const version = "base64/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/base64/lib/_version.d.ts
vendored
2
packages/base64/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "base64/5.1.0";
|
||||
export declare const version = "base64/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "base64/5.1.0";
|
||||
exports.version = "base64/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -41,7 +41,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x2f08f73bfb5244fcf334f2e461e7645a74e2b2fa08b034bb9258025827a3ec31",
|
||||
"tarballHash": "0x74c5fce00eedf475f74d4890e6e1a83c281898964b9055d5645d1f3074dc87bf",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "base64/5.1.0";
|
||||
export const version = "base64/5.2.0";
|
||||
|
2
packages/basex/lib.esm/_version.d.ts
vendored
2
packages/basex/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "basex/5.1.0";
|
||||
export declare const version = "basex/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "basex/5.1.0";
|
||||
export const version = "basex/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/basex/lib/_version.d.ts
vendored
2
packages/basex/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "basex/5.1.0";
|
||||
export declare const version = "basex/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "basex/5.1.0";
|
||||
exports.version = "basex/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -36,7 +36,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x4d21807d9f84a69f71bf50315cbce419936d0fe374c60f7cdda02aa5a254f1c5",
|
||||
"tarballHash": "0x13fff325a30baa5b8ba04f9fb8e9d1964843c445831d13a3d6e4eba849353900",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "basex/5.1.0";
|
||||
export const version = "basex/5.2.0";
|
||||
|
2
packages/bignumber/lib.esm/_version.d.ts
vendored
2
packages/bignumber/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "bignumber/5.1.1";
|
||||
export declare const version = "bignumber/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "bignumber/5.1.1";
|
||||
export const version = "bignumber/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/bignumber/lib.esm/bignumber.d.ts
vendored
2
packages/bignumber/lib.esm/bignumber.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { Bytes, Hexable } from "@ethersproject/bytes";
|
||||
export declare type BigNumberish = BigNumber | Bytes | string | number;
|
||||
export declare type BigNumberish = BigNumber | Bytes | bigint | string | number;
|
||||
export declare function isBigNumberish(value: any): value is BigNumberish;
|
||||
export declare class BigNumber implements Hexable {
|
||||
readonly _hex: string;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"bignumber.d.ts","sourceRoot":"","sources":["../src.ts/bignumber.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAiC,MAAM,sBAAsB,CAAC;AAWrF,oBAAY,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAShE;AAKD,qBAAa,SAAU,YAAW,OAAO;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAEnB,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAe9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG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AAE,MAAM,GAAG,SAAS;IAO9B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO7B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO7B,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIjC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIhC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAIjC,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,OAAO;IAIjB,QAAQ,IAAI,MAAM;IASlB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAiBlB,WAAW,IAAI,MAAM;IAIrB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;IAIzB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS;IAkElC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD;AAiED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
8
packages/bignumber/lib.esm/fixednumber.d.ts
vendored
8
packages/bignumber/lib.esm/fixednumber.d.ts
vendored
@ -31,10 +31,10 @@ export declare class FixedNumber {
|
||||
toHexString(width?: number): string;
|
||||
toUnsafeFloat(): number;
|
||||
toFormat(format: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string | number): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string | number): FixedNumber;
|
||||
static isFixedNumber(value: any): value is FixedNumber;
|
||||
}
|
||||
//# sourceMappingURL=fixednumber.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../src.ts/fixednumber.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,SAAS,EAAuB,MAAM,sBAAsB,CAAC;AAMhF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAiCtE,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,CAuBzF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,SAAS,CA8C5E;AAED,qBAAa,WAAW;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBAEjB,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAkBnF,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW;CA0CvC;AAED,qBAAa,WAAW;IACpB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAA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AO1C,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAO1C,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAO1C,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW;IAO1C,KAAK,IAAI,WAAW;IAcpB,OAAO,IAAI,WAAW;IAetB,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW;IAiBrC,MAAM,IAAI,OAAO;IAIjB,UAAU,IAAI,OAAO;IAIrB,QAAQ,IAAI,MAAM;IAElB,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAOnC,aAAa,IAAI,MAAM;IAEvB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW;IAKnD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAchH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAwBrF,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAkBvF,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM;IAqB9D,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW;CAGzD"}
|
@ -50,7 +50,12 @@ export function formatFixed(value, decimals) {
|
||||
// Strip training 0
|
||||
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
||||
const whole = value.div(multiplier).toString();
|
||||
if (multiplier.length === 1) {
|
||||
value = whole;
|
||||
}
|
||||
else {
|
||||
value = whole + "." + fraction;
|
||||
}
|
||||
if (negative) {
|
||||
value = "-" + value;
|
||||
}
|
||||
@ -64,9 +69,6 @@ export function parseFixed(value, decimals) {
|
||||
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
||||
logger.throwArgumentError("invalid decimal value", "value", value);
|
||||
}
|
||||
if (multiplier.length - 1 === 0) {
|
||||
return BigNumber.from(value);
|
||||
}
|
||||
// Is it negative?
|
||||
const negative = (value.substring(0, 1) === "-");
|
||||
if (negative) {
|
||||
@ -87,10 +89,13 @@ export function parseFixed(value, decimals) {
|
||||
if (!fraction) {
|
||||
fraction = "0";
|
||||
}
|
||||
// Prevent underflow
|
||||
if (fraction.length > multiplier.length - 1) {
|
||||
// Get significant digits to check truncation for underflow
|
||||
{
|
||||
const sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, (all, sig, zeros) => (sig));
|
||||
if (sigFraction.length > multiplier.length - 1) {
|
||||
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
||||
}
|
||||
}
|
||||
// Fully pad the string with zeros to get to wei
|
||||
while (fraction.length < multiplier.length - 1) {
|
||||
fraction += "0";
|
||||
@ -121,6 +126,9 @@ export class FixedFormat {
|
||||
if (value instanceof FixedFormat) {
|
||||
return value;
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
value = `fixed128x${value}`;
|
||||
}
|
||||
let signed = true;
|
||||
let width = 128;
|
||||
let decimals = 18;
|
||||
@ -131,7 +139,7 @@ export class FixedFormat {
|
||||
else if (value === "ufixed") {
|
||||
signed = false;
|
||||
}
|
||||
else if (value != null) {
|
||||
else {
|
||||
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
||||
if (!match) {
|
||||
logger.throwArgumentError("invalid fixed format", "format", value);
|
||||
@ -208,7 +216,10 @@ export class FixedNumber {
|
||||
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
||||
}
|
||||
floor() {
|
||||
let comps = this.toString().split(".");
|
||||
const comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
let result = FixedNumber.from(comps[0], this.format);
|
||||
const hasFraction = !comps[1].match(/^(0*)$/);
|
||||
if (this.isNegative() && hasFraction) {
|
||||
@ -217,7 +228,10 @@ export class FixedNumber {
|
||||
return result;
|
||||
}
|
||||
ceiling() {
|
||||
let comps = this.toString().split(".");
|
||||
const comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
let result = FixedNumber.from(comps[0], this.format);
|
||||
const hasFraction = !comps[1].match(/^(0*)$/);
|
||||
if (!this.isNegative() && hasFraction) {
|
||||
@ -231,7 +245,10 @@ export class FixedNumber {
|
||||
decimals = 0;
|
||||
}
|
||||
// If we are already in range, we're done
|
||||
let comps = this.toString().split(".");
|
||||
const comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
||||
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
|
||||
}
|
||||
@ -242,7 +259,7 @@ export class FixedNumber {
|
||||
return this.mulUnsafe(factor).addUnsafe(BUMP).floor().divUnsafe(factor);
|
||||
}
|
||||
isZero() {
|
||||
return (this._value === "0.0");
|
||||
return (this._value === "0.0" || this._value === "0");
|
||||
}
|
||||
isNegative() {
|
||||
return (this._value[0] === "-");
|
||||
|
File diff suppressed because one or more lines are too long
2
packages/bignumber/lib/_version.d.ts
vendored
2
packages/bignumber/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "bignumber/5.1.1";
|
||||
export declare const version = "bignumber/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "bignumber/5.1.1";
|
||||
exports.version = "bignumber/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
2
packages/bignumber/lib/bignumber.d.ts
vendored
2
packages/bignumber/lib/bignumber.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { Bytes, Hexable } from "@ethersproject/bytes";
|
||||
export declare type BigNumberish = BigNumber | Bytes | string | number;
|
||||
export declare type BigNumberish = BigNumber | Bytes | bigint | string | number;
|
||||
export declare function isBigNumberish(value: any): value is BigNumberish;
|
||||
export declare class BigNumber implements Hexable {
|
||||
readonly _hex: string;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"bignumber.d.ts","sourceRoot":"","sources":["../src.ts/bignumber.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAiC,MAAM,sBAAsB,CAAC;AAWrF,oBAAY,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAShE;AAKD,qBAAa,SAAU,YAAW,OAAO;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAEnB,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAe9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIhC,GAAG,IAAI,SAAS;IAOhB,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,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IAIrB,MAAM,IAAI,OAAO;IAIjB,QAAQ,IAAI,MAAM;IASlB,QAAQ,IAAI,MAAM;IAUlB,QAAQ,IAAI,MAAM;IAiBlB,WAAW,IAAI,MAAM;IAIrB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG;IAIzB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS;IAkElC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD;AAiED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
8
packages/bignumber/lib/fixednumber.d.ts
vendored
8
packages/bignumber/lib/fixednumber.d.ts
vendored
@ -31,10 +31,10 @@ export declare class FixedNumber {
|
||||
toHexString(width?: number): string;
|
||||
toUnsafeFloat(): number;
|
||||
toFormat(format: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string | number): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string | number): FixedNumber;
|
||||
static isFixedNumber(value: any): value is FixedNumber;
|
||||
}
|
||||
//# sourceMappingURL=fixednumber.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../src.ts/fixednumber.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,SAAS,EAAuB,MA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AI,MAAM;IAEvB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW;IAKnD,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAchH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAwBrF,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW;IAkBvF,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM;IAqB9D,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW;CAGzD"}
|
@ -52,7 +52,12 @@ function formatFixed(value, decimals) {
|
||||
// Strip training 0
|
||||
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
||||
var whole = value.div(multiplier).toString();
|
||||
if (multiplier.length === 1) {
|
||||
value = whole;
|
||||
}
|
||||
else {
|
||||
value = whole + "." + fraction;
|
||||
}
|
||||
if (negative) {
|
||||
value = "-" + value;
|
||||
}
|
||||
@ -67,9 +72,6 @@ function parseFixed(value, decimals) {
|
||||
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
||||
logger.throwArgumentError("invalid decimal value", "value", value);
|
||||
}
|
||||
if (multiplier.length - 1 === 0) {
|
||||
return bignumber_1.BigNumber.from(value);
|
||||
}
|
||||
// Is it negative?
|
||||
var negative = (value.substring(0, 1) === "-");
|
||||
if (negative) {
|
||||
@ -90,10 +92,13 @@ function parseFixed(value, decimals) {
|
||||
if (!fraction) {
|
||||
fraction = "0";
|
||||
}
|
||||
// Prevent underflow
|
||||
if (fraction.length > multiplier.length - 1) {
|
||||
// Get significant digits to check truncation for underflow
|
||||
{
|
||||
var sigFraction = fraction.replace(/^([0-9]*?)(0*)$/, function (all, sig, zeros) { return (sig); });
|
||||
if (sigFraction.length > multiplier.length - 1) {
|
||||
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
|
||||
}
|
||||
}
|
||||
// Fully pad the string with zeros to get to wei
|
||||
while (fraction.length < multiplier.length - 1) {
|
||||
fraction += "0";
|
||||
@ -125,6 +130,9 @@ var FixedFormat = /** @class */ (function () {
|
||||
if (value instanceof FixedFormat) {
|
||||
return value;
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
value = "fixed128x" + value;
|
||||
}
|
||||
var signed = true;
|
||||
var width = 128;
|
||||
var decimals = 18;
|
||||
@ -135,7 +143,7 @@ var FixedFormat = /** @class */ (function () {
|
||||
else if (value === "ufixed") {
|
||||
signed = false;
|
||||
}
|
||||
else if (value != null) {
|
||||
else {
|
||||
var match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
||||
if (!match) {
|
||||
logger.throwArgumentError("invalid fixed format", "format", value);
|
||||
@ -216,6 +224,9 @@ var FixedNumber = /** @class */ (function () {
|
||||
};
|
||||
FixedNumber.prototype.floor = function () {
|
||||
var comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
var result = FixedNumber.from(comps[0], this.format);
|
||||
var hasFraction = !comps[1].match(/^(0*)$/);
|
||||
if (this.isNegative() && hasFraction) {
|
||||
@ -225,6 +236,9 @@ var FixedNumber = /** @class */ (function () {
|
||||
};
|
||||
FixedNumber.prototype.ceiling = function () {
|
||||
var comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
var result = FixedNumber.from(comps[0], this.format);
|
||||
var hasFraction = !comps[1].match(/^(0*)$/);
|
||||
if (!this.isNegative() && hasFraction) {
|
||||
@ -239,6 +253,9 @@ var FixedNumber = /** @class */ (function () {
|
||||
}
|
||||
// If we are already in range, we're done
|
||||
var comps = this.toString().split(".");
|
||||
if (comps.length === 1) {
|
||||
comps.push("0");
|
||||
}
|
||||
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
||||
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
|
||||
}
|
||||
@ -249,7 +266,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
return this.mulUnsafe(factor).addUnsafe(BUMP).floor().divUnsafe(factor);
|
||||
};
|
||||
FixedNumber.prototype.isZero = function () {
|
||||
return (this._value === "0.0");
|
||||
return (this._value === "0.0" || this._value === "0");
|
||||
};
|
||||
FixedNumber.prototype.isNegative = function () {
|
||||
return (this._value[0] === "-");
|
||||
|
File diff suppressed because one or more lines are too long
@ -38,7 +38,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x3e0d0e0c51ff62d1611ec52119f7549d3e6f35973a4b489185a70b63ed3178e9",
|
||||
"tarballHash": "0xf541fda3d586d4a9bef45fda1cffa2ef3be324945925e16d0dc04470b59dce11",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.2.0"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bignumber/5.1.1";
|
||||
export const version = "bignumber/5.2.0";
|
||||
|
2
packages/bytes/lib.esm/_version.d.ts
vendored
2
packages/bytes/lib.esm/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "bytes/5.1.0";
|
||||
export declare const version = "bytes/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,2 +1,2 @@
|
||||
export const version = "bytes/5.1.0";
|
||||
export const version = "bytes/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
4
packages/bytes/lib.esm/index.d.ts
vendored
4
packages/bytes/lib.esm/index.d.ts
vendored
@ -28,11 +28,11 @@ export declare function concat(items: ReadonlyArray<BytesLike>): Uint8Array;
|
||||
export declare function stripZeros(value: BytesLike): Uint8Array;
|
||||
export declare function zeroPad(value: BytesLike, length: number): Uint8Array;
|
||||
export declare function isHexString(value: any, length?: number): boolean;
|
||||
export declare function hexlify(value: BytesLike | Hexable | number, options?: DataOptions): string;
|
||||
export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
|
||||
export declare function hexDataLength(data: BytesLike): number;
|
||||
export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string;
|
||||
export declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
|
||||
export declare function hexValue(value: BytesLike | Hexable | number): string;
|
||||
export declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
|
||||
export declare function hexStripZeros(value: BytesLike): string;
|
||||
export declare function hexZeroPad(value: BytesLike, length: number): string;
|
||||
export declare function splitSignature(signature: SignatureLike): Signature;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AASA,oBAAY,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEtC,oBAAY,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,WAAW,OAAO;IACpB,WAAW,IAAI,MAAM,CAAC;CACzB;AAYD,oBAAY,aAAa,GAAI;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,SAAS;IACtB,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EA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AG,UAAU,CA+C/F;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,UAAU,CAYlE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAevD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUpE;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAMhE;AAID,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAuDnG;AAUD,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,UAQ5C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAcxF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAMjE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAI7E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAUtD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBnE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,CAuHlE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CAQ9D"}
|
@ -139,7 +139,7 @@ export function hexlify(value, options) {
|
||||
logger.checkSafeUint53(value, "invalid hexlify value");
|
||||
let hex = "";
|
||||
while (value) {
|
||||
hex = HexCharacters[value & 0x0f] + hex;
|
||||
hex = HexCharacters[value & 0xf] + hex;
|
||||
value = Math.floor(value / 16);
|
||||
}
|
||||
if (hex.length) {
|
||||
@ -150,6 +150,13 @@ export function hexlify(value, options) {
|
||||
}
|
||||
return "0x00";
|
||||
}
|
||||
if (typeof (value) === "bigint") {
|
||||
value = value.toString(16);
|
||||
if (value.length % 2) {
|
||||
return ("0x0" + value);
|
||||
}
|
||||
return "0x" + value;
|
||||
}
|
||||
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
|
||||
value = "0x" + value;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
2
packages/bytes/lib/_version.d.ts
vendored
2
packages/bytes/lib/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "bytes/5.1.0";
|
||||
export declare const version = "bytes/5.2.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "bytes/5.1.0";
|
||||
exports.version = "bytes/5.2.0";
|
||||
//# sourceMappingURL=_version.js.map
|
4
packages/bytes/lib/index.d.ts
vendored
4
packages/bytes/lib/index.d.ts
vendored
@ -28,11 +28,11 @@ export declare function concat(items: ReadonlyArray<BytesLike>): Uint8Array;
|
||||
export declare function stripZeros(value: BytesLike): Uint8Array;
|
||||
export declare function zeroPad(value: BytesLike, length: number): Uint8Array;
|
||||
export declare function isHexString(value: any, length?: number): boolean;
|
||||
export declare function hexlify(value: BytesLike | Hexable | number, options?: DataOptions): string;
|
||||
export declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
|
||||
export declare function hexDataLength(data: BytesLike): number;
|
||||
export declare function hexDataSlice(data: BytesLike, offset: number, endOffset?: number): string;
|
||||
export declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
|
||||
export declare function hexValue(value: BytesLike | Hexable | number): string;
|
||||
export declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
|
||||
export declare function hexStripZeros(value: BytesLike): string;
|
||||
export declare function hexZeroPad(value: BytesLike, length: number): string;
|
||||
export declare function splitSignature(signature: SignatureLike): Signature;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AASA,oBAAY,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEtC,oBAAY,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC,oBAAY,WAAW,GAAG;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,WAAW,OAAO;IACpB,WAAW,IAAI,MAAM,CAAC;CACzB;AAYD,oBAAY,aAAa,GAAI;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,SAAS;IACtB,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IAEZ,aAAa,EAAE,MAAM,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;CACb;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE1D;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAclD;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CA+C/F;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAA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