Socket
Socket
Sign inDemoInstall

@truffle/codec

Package Overview
Dependencies
Maintainers
7
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@truffle/codec - npm Package Compare versions

Comparing version 0.14.17 to 0.15.0

dist/docs/classes/_truffle_encoder.NoFunctionByThatNameError.html

12

dist/lib/abi-data/decode/index.js

@@ -269,3 +269,4 @@ "use strict";

kind: "value",
value: decodedChildren
value: decodedChildren,
interpretations: {}
};

@@ -327,3 +328,4 @@ case "struct":

kind: "value",
value: decodedChildren
value: decodedChildren,
interpretations: {}
};

@@ -378,3 +380,4 @@ case "struct":

kind: "value",
value: decodedMembers
value: decodedMembers,
interpretations: {}
};

@@ -407,5 +410,6 @@ }

kind: "value",
value: decodedMembers
value: decodedMembers,
interpretations: {}
};
}
//# sourceMappingURL=index.js.map

@@ -138,3 +138,4 @@ "use strict";

rawAsHex: coercedResult.value.rawAddress
}
},
interpretations: coercedResult.interpretations
};

@@ -185,3 +186,4 @@ case "error":

type: (abifyType(result.type, userDefinedTypes)),
value: abifiedMembers
value: abifiedMembers,
interpretations: coercedResult.interpretations
};

@@ -216,3 +218,4 @@ case "error":

asBN: coercedResult.value.numericAsBN.clone()
}
},
interpretations: coercedResult.interpretations
};

@@ -227,3 +230,4 @@ case "error":

asBN: coercedResult.error.rawAsBN.clone()
}
},
interpretations: {}
};

@@ -248,3 +252,4 @@ case "EnumPaddingError":

asBN: numericValue
}
},
interpretations: {}
};

@@ -283,3 +288,4 @@ }

type: (abifyType(result.type, userDefinedTypes)),
value: abifiedMembers
value: abifiedMembers,
interpretations: coercedResult.interpretations
};

@@ -286,0 +292,0 @@ case "error":

@@ -68,3 +68,4 @@ "use strict";

asHex: Conversion.toHexString(bytes, size, true) //padding in case of short string literal
}
},
interpretations: {}
}; //we'll skip including a raw value, as that would be meaningless

@@ -71,0 +72,0 @@ }

@@ -39,2 +39,3 @@ "use strict";

const allocate_1 = require("../allocate");
const decode_1 = require("../../bytes/decode");
function* decodeBasic(dataType, pointer, info, options = {}) {

@@ -83,3 +84,4 @@ const { state } = info;

kind: "value",
value: underlyingResult
value: underlyingResult,
interpretations: {}
};

@@ -129,3 +131,4 @@ case "error":

kind: "value",
value: { asBoolean: false }
value: { asBoolean: false },
interpretations: {}
};

@@ -137,3 +140,4 @@ }

kind: "value",
value: { asBoolean: true }
value: { asBoolean: true },
interpretations: {}
};

@@ -181,3 +185,4 @@ }

rawAsBN: Conversion.toBN(rawBytes)
}
},
interpretations: {}
};

@@ -209,5 +214,6 @@ case "int":

rawAsBN: Conversion.toSignedBN(rawBytes)
}
},
interpretations: {}
};
case "address":
case "address": {
if (!checkPadding(bytes, dataType, paddingMode)) {

@@ -229,11 +235,20 @@ let error = {

bytes = removePadding(bytes, dataType, paddingMode);
return {
const address = Evm.Utils.toAddress(bytes);
let decoded = {
type: dataType,
kind: "value",
value: {
asAddress: Evm.Utils.toAddress(bytes),
asAddress: address,
rawAsHex: Conversion.toHexString(rawBytes)
}
},
interpretations: {}
};
case "contract":
//now: attach interpretations
const ensName = yield* reverseEnsResolve(address);
if (ensName !== null) {
decoded.interpretations = { ensName };
}
return decoded;
}
case "contract": {
if (!checkPadding(bytes, dataType, paddingMode)) {

@@ -257,7 +272,15 @@ let error = {

const contractValueInfo = yield* decodeContract(bytes, info);
return {
let decoded = {
type: fullType,
kind: "value",
value: contractValueInfo
value: contractValueInfo,
interpretations: {}
};
//now: attach interpretations
const ensName = yield* reverseEnsResolve(contractValueInfo.address);
if (ensName !== null) {
decoded.interpretations = { ensName };
}
return decoded;
}
case "bytes":

@@ -292,3 +315,4 @@ //NOTE: we assume this is a *static* bytestring,

rawAsHex: Conversion.toHexString(rawBytes)
}
},
interpretations: {}
};

@@ -316,7 +340,15 @@ case "function":

const selector = bytes.slice(Evm.Utils.ADDRESS_SIZE, Evm.Utils.ADDRESS_SIZE + Evm.Utils.SELECTOR_SIZE);
return {
const valueInfo = yield* decodeExternalFunction(address, selector, info);
let decoded = {
type: dataType,
kind: "value",
value: yield* decodeExternalFunction(address, selector, info)
value: valueInfo,
interpretations: {}
};
//now: attach interpretations
const contractEnsName = yield* reverseEnsResolve(valueInfo.contract.address);
if (contractEnsName !== null) {
decoded.interpretations = { contractEnsName };
}
return decoded;
case "internal":

@@ -404,3 +436,4 @@ //note: we used to error if we hit this point with strict === true,

numericAsBN: numeric
}
},
interpretations: {}
};

@@ -463,3 +496,4 @@ }

rawAsBig
}
},
interpretations: {}
};

@@ -496,3 +530,4 @@ }

rawAsBig
}
},
interpretations: {}
};

@@ -583,3 +618,4 @@ }

constructorProgramCounter: constructorPc
}
},
interpretations: {}
};

@@ -597,3 +633,4 @@ }

constructorProgramCounter: constructorPc
}
},
interpretations: {}
};

@@ -664,3 +701,4 @@ }

constructorProgramCounter: constructorPc
}
},
interpretations: {}
};

@@ -684,3 +722,4 @@ }

mutability
}
},
interpretations: {}
};

@@ -780,2 +819,6 @@ }

}
function* reverseEnsResolve(address) {
const nameAsBytes = yield { type: "ens-primary-name", address };
return nameAsBytes !== null ? (0, decode_1.decodeString)(nameAsBytes) : null;
}
//# sourceMappingURL=index.js.map

@@ -59,3 +59,4 @@ "use strict";

asHex: Conversion.toHexString(bytes)
}
},
interpretations: {}
};

@@ -66,3 +67,4 @@ case "string":

kind: "value",
value: decodeString(bytes)
value: decodeString(bytes),
interpretations: {}
};

@@ -69,0 +71,0 @@ }

@@ -221,3 +221,4 @@ "use strict";

asBoolean: true
}
},
interpretations: {}
};

@@ -224,0 +225,0 @@ default:

@@ -5,4 +5,4 @@ /// <reference types="node" />

import type { CalldataDecoding, LogDecoding, ReturndataDecoding, AbiArgument } from "./types";
import { ResultInspector, unsafeNativize, unsafeNativizeVariables, InspectOptions, nativizeAccessList } from "./format/utils/inspect";
export { ResultInspector, unsafeNativize, unsafeNativizeVariables, nativizeAccessList };
import { ResultInspector, unsafeNativize, unsafeNativizeVariables, InspectOptions, ResultInspectorOptions, nativizeAccessList, stringValueInfoToStringLossy } from "./format/utils/inspect";
export { ResultInspector, ResultInspectorOptions, unsafeNativize, unsafeNativizeVariables, nativizeAccessList, stringValueInfoToStringLossy };
declare type NumberFormatter = (n: BigInt) => any;

@@ -84,3 +84,4 @@ /**

decoding: CalldataDecoding;
constructor(decoding: CalldataDecoding);
options: ResultInspectorOptions;
constructor(decoding: CalldataDecoding, options?: ResultInspectorOptions);
/**

@@ -100,3 +101,4 @@ * @dev non-standard alternative interface name used by browser-util-inspect

decoding: LogDecoding;
constructor(decoding: LogDecoding);
options: ResultInspectorOptions;
constructor(decoding: LogDecoding, options?: ResultInspectorOptions);
/**

@@ -115,3 +117,4 @@ * @dev non-standard alternative interface name used by browser-util-inspect

decoding: ReturndataDecoding;
constructor(decoding: ReturndataDecoding);
options: ResultInspectorOptions;
constructor(decoding: ReturndataDecoding, options?: ResultInspectorOptions);
/**

@@ -127,2 +130,3 @@ * @dev non-standard alternative interface name used by browser-util-inspect

*/
export declare function formatFunctionLike(header: string, values: AbiArgument[], options: InspectOptions, suppressType?: boolean, indent?: number): string;
export declare function formatFunctionLike(header: string, values: AbiArgument[], options: InspectOptions, suppressType?: boolean, indent?: number, //for use by debug-utils
inspectorOptions?: ResultInspectorOptions): string;

@@ -29,3 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.formatFunctionLike = exports.ReturndataDecodingInspector = exports.LogDecodingInspector = exports.containsDeliberateReadError = exports.CalldataDecodingInspector = exports.nativizeEventArgs = exports.nativizeReturn = exports.nativize = exports.nativizeAccessList = exports.unsafeNativizeVariables = exports.unsafeNativize = exports.ResultInspector = void 0;
exports.formatFunctionLike = exports.ReturndataDecodingInspector = exports.LogDecodingInspector = exports.containsDeliberateReadError = exports.CalldataDecodingInspector = exports.nativizeEventArgs = exports.nativizeReturn = exports.nativize = exports.stringValueInfoToStringLossy = exports.nativizeAccessList = exports.unsafeNativizeVariables = exports.unsafeNativize = exports.ResultInspector = void 0;
const debug_1 = __importDefault(require("debug"));

@@ -42,2 +42,3 @@ const debug = (0, debug_1.default)("codec:export");

Object.defineProperty(exports, "nativizeAccessList", { enumerable: true, get: function () { return inspect_1.nativizeAccessList; } });
Object.defineProperty(exports, "stringValueInfoToStringLossy", { enumerable: true, get: function () { return inspect_1.stringValueInfoToStringLossy; } });
/**

@@ -119,13 +120,4 @@ * This function is similar to

return result.value.address;
case "string": {
const coercedResult = result;
switch (coercedResult.value.kind) {
case "valid":
return coercedResult.value.asString;
case "malformed":
// this will turn malformed utf-8 into replacement characters (U+FFFD) (WARNING)
// note we need to cut off the 0x prefix
return Buffer.from(coercedResult.value.asHex.slice(2), "hex").toString();
}
}
case "string":
return (0, inspect_1.stringValueInfoToStringLossy)(result.value);
case "userDefinedValueType":

@@ -241,4 +233,5 @@ return ethersCompatibleNativize(result.value, numberFormatter);

class CalldataDecodingInspector {
constructor(decoding) {
constructor(decoding, options) {
this.decoding = decoding;
this.options = options || {};
}

@@ -288,3 +281,4 @@ /**

asHex: data
}
},
interpretations: {}
};

@@ -296,3 +290,3 @@ if (abi) {

else {
return `Sent raw data to ${this.decoding.class.typeName}: ${util_1.default.inspect(new inspect_1.ResultInspector(codecValue), options)}`;
return `Sent raw data to ${this.decoding.class.typeName}: ${util_1.default.inspect(new inspect_1.ResultInspector(codecValue, this.options), options)}`;
}

@@ -338,4 +332,5 @@ case "unknown":

class LogDecodingInspector {
constructor(decoding) {
constructor(decoding, options) {
this.decoding = decoding;
this.options = options || {};
}

@@ -369,4 +364,5 @@ /**

class ReturndataDecodingInspector {
constructor(decoding) {
constructor(decoding, options) {
this.decoding = decoding;
this.options = options || {};
}

@@ -395,5 +391,6 @@ /**

asHex: data
}
},
interpretations: {}
};
const dataString = util_1.default.inspect(new inspect_1.ResultInspector(codecValue), options);
const dataString = util_1.default.inspect(new inspect_1.ResultInspector(codecValue, this.options), options);
return `Returned raw data: ${dataString}`;

@@ -421,3 +418,3 @@ case "selfdestruct":

const prefix = paddedPrefixes[index];
const formatted = indentExcludingFirstLine(util_1.default.inspect(new inspect_1.ResultInspector(value.value), options), maxLength);
const formatted = indentExcludingFirstLine(util_1.default.inspect(new inspect_1.ResultInspector(value.value, this.options), options), maxLength);
return prefix + formatted;

@@ -462,4 +459,4 @@ });

*/
function formatFunctionLike(header, values, options, suppressType = false, indent = 2 //for use by debug-utils
) {
function formatFunctionLike(header, values, options, suppressType = false, indent = 2, //for use by debug-utils
inspectorOptions) {
if (values.length === 0) {

@@ -472,3 +469,3 @@ return `${header}()`;

const prefix = namePrefix + indexedPrefix;
const displayValue = util_1.default.inspect(new inspect_1.ResultInspector(value), options);
const displayValue = util_1.default.inspect(new inspect_1.ResultInspector(value, inspectorOptions), options);
const typeString = suppressType

@@ -485,3 +482,3 @@ ? ""

exports.formatFunctionLike = formatFunctionLike;
function formatMulticall(fullName, decodings, options, additionalParameterName, additionalParameterValue) {
function formatMulticall(fullName, decodings, options, additionalParameterName, additionalParameterValue, inspectorOptions) {
if (decodings.length === 0) {

@@ -494,3 +491,3 @@ return `${fullName}()`;

? "<decoding error>"
: util_1.default.inspect(new CalldataDecodingInspector(decoding), options);
: util_1.default.inspect(new CalldataDecodingInspector(decoding, inspectorOptions), options);
return formattedDecoding + (index < decodings.length - 1 ? "," : "");

@@ -503,3 +500,3 @@ });

}
function formatAggregate(fullName, calls, options, additionalParameterName, additionalParameterValue) {
function formatAggregate(fullName, calls, options, additionalParameterName, additionalParameterValue, inspectorOptions) {
if (calls.length === 0) {

@@ -513,3 +510,3 @@ return `${fullName}()`;

: util_1.default
.inspect(new CalldataDecodingInspector(decoding), options)
.inspect(new CalldataDecodingInspector(decoding, inspectorOptions), options)
.replace(".", `(${options.stylize(address, "number")}).`); //HACK: splice in the address

@@ -516,0 +513,0 @@ return formattedCall + (index < calls.length - 1 ? "," : "");

@@ -29,2 +29,3 @@ import type BN from "bn.js";

};
interpretations: {};
}

@@ -43,2 +44,3 @@ /**

};
interpretations: {};
}

@@ -56,2 +58,3 @@ /**

};
interpretations: {};
}

@@ -73,2 +76,3 @@ /**

};
interpretations: {};
}

@@ -89,2 +93,3 @@ /**

};
interpretations: {};
}

@@ -109,2 +114,5 @@ /**

};
interpretations: {
ensName?: StringValueInfo;
};
}

@@ -120,2 +128,3 @@ /**

value: StringValueInfo;
interpretations: {};
}

@@ -161,2 +170,3 @@ /**

};
interpretations: {};
}

@@ -175,2 +185,3 @@ /**

};
interpretations: {};
}

@@ -192,2 +203,3 @@ /**

};
interpretations: {};
}

@@ -203,2 +215,3 @@ /**

value: BuiltInValueValue;
interpretations: {};
}

@@ -214,2 +227,5 @@ /**

value: ContractValueInfo;
interpretations: {
ensName?: StringValueInfo;
};
}

@@ -216,0 +232,0 @@ /**

@@ -8,3 +8,3 @@ /**

* used in results provided by packages
* `@truffle/decoder@^4.0.0` and `@truffle/codec@^0.1.0`.
* `@truffle/decoder@>=4.0.0` and `@truffle/codec@>=0.1.0`.
*

@@ -41,4 +41,4 @@ * See below for complete listing or continue reading

* This format targets types and values understood by the
* [Solidity programming language](https://solidity.readthedocs.io) and
* the [Contract ABI specification](https://solidity.readthedocs.io/en/v0.5.3/abi-spec.html),
* [Solidity programming language](https://docs.soliditylang.org/) and
* the [Contract ABI specification](https://docs.soliditylang.org/en/v0.8.19/abi-spec.html),
* within the context of the [Ethereum Virtual Machine](https://ethereum.github.io/yellowpaper/paper.pdf)

@@ -85,3 +85,14 @@ * (EVM) and in raw data for transactions and logs according to the

*
* 5. `reference`: This field is a debugger-only feature and does not
* 5. `interpretations`: This field will also be present when `kind` is equal
* to `"value"`; it is an object that may contain additional information
* about the decoded value beyond what is found in `value`. (All fields in
* `interpretations` are always optional and will be included only when
* applicable.) You may wonder, what is the difference between `value`
* and `interpretations`? The answer is that the distinction is largely
* historical; `interpretations` was not originally part of the format, and
* it was added so that there would be a place to put new additional
* information we wanted to include without having to expand `value`. See
* [[Format.Values|`Format.Values`]] for more information.
*
* 6. `reference`: This field is a debugger-only feature and does not
* apply to results returned by @truffle/decoder, so it won't be documented here.

@@ -88,0 +99,0 @@ *

@@ -34,3 +34,3 @@ "use strict";

* used in results provided by packages
* `@truffle/decoder@^4.0.0` and `@truffle/codec@^0.1.0`.
* `@truffle/decoder@>=4.0.0` and `@truffle/codec@>=0.1.0`.
*

@@ -67,4 +67,4 @@ * See below for complete listing or continue reading

* This format targets types and values understood by the
* [Solidity programming language](https://solidity.readthedocs.io) and
* the [Contract ABI specification](https://solidity.readthedocs.io/en/v0.5.3/abi-spec.html),
* [Solidity programming language](https://docs.soliditylang.org/) and
* the [Contract ABI specification](https://docs.soliditylang.org/en/v0.8.19/abi-spec.html),
* within the context of the [Ethereum Virtual Machine](https://ethereum.github.io/yellowpaper/paper.pdf)

@@ -111,3 +111,14 @@ * (EVM) and in raw data for transactions and logs according to the

*
* 5. `reference`: This field is a debugger-only feature and does not
* 5. `interpretations`: This field will also be present when `kind` is equal
* to `"value"`; it is an object that may contain additional information
* about the decoded value beyond what is found in `value`. (All fields in
* `interpretations` are always optional and will be included only when
* applicable.) You may wonder, what is the difference between `value`
* and `interpretations`? The answer is that the distinction is largely
* historical; `interpretations` was not originally part of the format, and
* it was added so that there would be a place to put new additional
* information we wanted to include without having to expand `value`. See
* [[Format.Values|`Format.Values`]] for more information.
*
* 6. `reference`: This field is a debugger-only feature and does not
* apply to results returned by @truffle/decoder, so it won't be documented here.

@@ -114,0 +125,0 @@ *

@@ -10,2 +10,10 @@ /// <reference types="node" />

}
export interface ResultInspectorOptions {
/**
* This option causes the [[ResultInspector]] to display, for
* addresses with a reverse ENS record, both the ENS name and
* the address. (By default it displays only the ENS name.)
*/
noHideAddress?: boolean;
}
/**

@@ -42,3 +50,4 @@ * This class is meant to be used with Node's

result: Format.Values.Result;
constructor(result: Format.Values.Result);
options: ResultInspectorOptions;
constructor(result: Format.Values.Result, options?: ResultInspectorOptions);
/**

@@ -95,1 +104,2 @@ * @dev non-standard alternative interface name used by browser-util-inspect

export declare function nativizeAccessList(wrappedAccessList: Format.Values.ArrayValue): Common.AccessList;
export declare function stringValueInfoToStringLossy(info: Format.Values.StringValueInfo): string;

@@ -29,3 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.nativizeAccessList = exports.unsafeNativize = exports.unsafeNativizeVariables = exports.ResultInspector = void 0;
exports.stringValueInfoToStringLossy = exports.nativizeAccessList = exports.unsafeNativize = exports.unsafeNativizeVariables = exports.ResultInspector = void 0;
const debug_1 = __importDefault(require("debug"));

@@ -74,4 +74,5 @@ const debug = (0, debug_1.default)("codec:format:utils:inspect");

class ResultInspector {
constructor(result) {
constructor(result, options) {
this.result = result;
this.options = options || {};
}

@@ -107,15 +108,15 @@ /**

}
case "address":
return options.stylize(this.result.value.asAddress, "number");
case "string": {
let coercedResult = this.result;
switch (coercedResult.value.kind) {
case "valid":
return util_1.default.inspect(coercedResult.value.asString, options);
case "malformed":
//note: this will turn malformed utf-8 into replacement characters (U+FFFD)
//note we need to cut off the 0x prefix
return util_1.default.inspect(Buffer.from(coercedResult.value.asHex.slice(2), "hex").toString());
case "address": {
const coercedResult = this.result;
const addressString = options.stylize(coercedResult.value.asAddress, "number");
if (coercedResult.interpretations.ensName) {
const nameString = options.stylize(stringValueInfoToStringLossy(coercedResult.interpretations.ensName), "special");
return this.options.noHideAddress
? `${nameString} [${addressString}]`
: nameString;
}
return options.stylize(coercedResult.value.asAddress, "number");
}
case "string":
return util_1.default.inspect(stringValueInfoToStringLossy(this.result.value), options);
case "array": {

@@ -126,8 +127,8 @@ let coercedResult = this.result;

}
return util_1.default.inspect(coercedResult.value.map(element => new ResultInspector(element)), options);
return util_1.default.inspect(coercedResult.value.map(element => new ResultInspector(element, this.options)), options);
}
case "mapping":
return util_1.default.inspect(new Map(this.result.value.map(({ key, value }) => [
new ResultInspector(key),
new ResultInspector(value)
new ResultInspector(key, this.options),
new ResultInspector(value, this.options)
])), options);

@@ -140,3 +141,3 @@ case "struct": {

return util_1.default.inspect(Object.assign({}, ...coercedResult.value.map(({ name, value }) => ({
[name]: new ResultInspector(value)
[name]: new ResultInspector(value, this.options)
}))), options);

@@ -147,3 +148,3 @@ }

const coercedResult = (this.result);
const inspectOfUnderlying = util_1.default.inspect(new ResultInspector(coercedResult.value), options);
const inspectOfUnderlying = util_1.default.inspect(new ResultInspector(coercedResult.value, this.options), options);
return `${typeName}.wrap(${inspectOfUnderlying})`; //note only the underlying part is stylized

@@ -158,7 +159,7 @@ }

return util_1.default.inspect(Object.assign({}, ...coercedResult.value.map(({ name, value }) => ({
[name]: new ResultInspector(value)
[name]: new ResultInspector(value, this.options)
}))), options);
}
else {
return util_1.default.inspect(coercedResult.value.map(({ value }) => new ResultInspector(value)), options);
return util_1.default.inspect(coercedResult.value.map(({ value }) => new ResultInspector(value, this.options)), options);
}

@@ -171,3 +172,3 @@ }

return util_1.default.inspect(Object.assign({}, ...this.result.value.map(({ name, value }) => ({
[name]: new ResultInspector(value)
[name]: new ResultInspector(value, this.options)
}))), options);

@@ -180,3 +181,5 @@ case "enum": {

case "magic":
return util_1.default.inspect(Object.assign({}, ...Object.entries(this.result.value).map(([key, value]) => ({ [key]: new ResultInspector(value) }))), options);
return util_1.default.inspect(Object.assign({}, ...Object.entries(this.result.value).map(([key, value]) => ({
[key]: new ResultInspector(value, this.options)
}))), options);
case "enum": {

@@ -186,3 +189,4 @@ return enumFullName(this.result); //not stylized

case "contract": {
return util_1.default.inspect(new ContractInfoInspector(this.result.value), options);
const coercedValue = this.result;
return util_1.default.inspect(new ContractInfoInspector(coercedValue.value, coercedValue.interpretations.ensName, this.options), options);
}

@@ -192,4 +196,5 @@ case "function":

case "external": {
let coercedResult = (this.result);
let contractString = util_1.default.inspect(new ContractInfoInspector(coercedResult.value.contract), Object.assign(Object.assign({}, cleanStylize(options)), { colors: false }));
const coercedResult = this
.result;
const contractString = util_1.default.inspect(new ContractInfoInspector(coercedResult.value.contract, coercedResult.interpretations.contractEnsName, this.options), Object.assign(Object.assign({}, cleanStylize(options)), { colors: false }));
let firstLine;

@@ -244,3 +249,3 @@ switch (coercedResult.value.kind) {

case "WrappedError":
return util_1.default.inspect(new ResultInspector(errorResult.error.error), options);
return util_1.default.inspect(new ResultInspector(errorResult.error.error, this.options), options);
case "UintPaddingError":

@@ -312,4 +317,6 @@ return `Uint has incorrect padding (expected padding: ${errorResult.error.paddingType}) (raw value ${errorResult.error.raw})`;

class ContractInfoInspector {
constructor(value) {
constructor(value, ensName, options) {
this.value = value;
this.ensName = ensName;
this.options = options || {};
}

@@ -324,9 +331,28 @@ /**

[util_1.default.inspect.custom](depth, options) {
const { noHideAddress } = this.options;
const addressString = options.stylize(this.value.address, "number");
let mainIdentifier = addressString;
if (this.ensName) {
//replace address with name
mainIdentifier = options.stylize(stringValueInfoToStringLossy(this.ensName), "special");
}
let withClass;
switch (this.value.kind) {
case "known":
return (options.stylize(this.value.address, "number") +
` (${this.value.class.typeName})`);
withClass = `${mainIdentifier} (${this.value.class.typeName})`;
break;
case "unknown":
return (options.stylize(this.value.address, "number") + " of unknown class");
withClass = `${mainIdentifier} of unknown class`;
break;
}
if (this.ensName && noHideAddress) {
//this might get a bit long, so let's break it up if needed
const breakingSpace = withClass.length + addressString.length + 3 > options.breakLength
? "\n"
: " ";
return `${withClass}${breakingSpace}[${addressString}]`;
}
else {
return withClass;
}
}

@@ -422,13 +448,4 @@ }

return result.value.asAddress;
case "string": {
let coercedResult = result;
switch (coercedResult.value.kind) {
case "valid":
return coercedResult.value.asString;
case "malformed":
// this will turn malformed utf-8 into replacement characters (U+FFFD) (WARNING)
// note we need to cut off the 0x prefix
return Buffer.from(coercedResult.value.asHex.slice(2), "hex").toString();
}
}
case "string":
return stringValueInfoToStringLossy(result.value);
case "fixed":

@@ -564,2 +581,14 @@ case "ufixed":

exports.nativizeAccessList = nativizeAccessList;
//turns a StringValueInfo into a string in a lossy fashion,
//by turning malformed utf-8 into replacement characters (U+FFFD)
function stringValueInfoToStringLossy(info) {
switch (info.kind) {
case "valid":
return info.asString;
case "malformed":
return Buffer.from(info.asHex.slice(2), // note we need to cut off the 0x prefix
"hex").toString();
}
}
exports.stringValueInfoToStringLossy = stringValueInfoToStringLossy;
//# sourceMappingURL=inspect.js.map

@@ -9,3 +9,3 @@ /**

import type * as Errors from "./errors";
import type { ElementaryValue, UintValue, IntValue, BoolValue, BytesStaticValue, BytesDynamicValue, BytesValue, AddressValue, StringValue, FixedValue, UfixedValue, EnumValue, UserDefinedValueTypeValue, ContractValue, ContractValueInfoKnown, ContractValueInfoUnknown } from "./elementary";
import type { ElementaryValue, UintValue, IntValue, BoolValue, BytesStaticValue, BytesDynamicValue, BytesValue, AddressValue, StringValue, FixedValue, UfixedValue, EnumValue, UserDefinedValueTypeValue, ContractValue, ContractValueInfoKnown, ContractValueInfoUnknown, StringValueInfo } from "./elementary";
import type * as Common from "../common";

@@ -141,2 +141,3 @@ import type * as Abi from "@truffle/abi-utils";

value: Result[];
interpretations: {};
}

@@ -161,2 +162,3 @@ /**

value: KeyValuePair[];
interpretations: {};
}

@@ -191,2 +193,3 @@ export interface KeyValuePair {

value: NameValuePair[];
interpretations: {};
}

@@ -212,2 +215,3 @@ export interface NameValuePair {

value: OptionallyNamedValue[];
interpretations: {};
}

@@ -235,2 +239,3 @@ export interface OptionallyNamedValue {

};
interpretations: {};
}

@@ -265,2 +270,3 @@ /**

value: NameValuePair[];
interpretations: {};
}

@@ -279,2 +285,3 @@ /**

value: EnumValue[];
interpretations: {};
}

@@ -296,2 +303,5 @@ /**

value: FunctionExternalValueInfo;
interpretations: {
contractEnsName?: StringValueInfo;
};
}

@@ -362,2 +372,3 @@ /**

value: FunctionInternalValueInfo;
interpretations: {};
}

@@ -443,2 +454,3 @@ /**

value: Common.Options;
interpretations: {};
}

@@ -66,3 +66,4 @@ "use strict";

kind: "value",
value: []
value: [],
interpretations: {}
};

@@ -73,3 +74,4 @@ case "array":

kind: "value",
value: []
value: [],
interpretations: {}
};

@@ -156,3 +158,4 @@ //other cases should not arise!

reference: seenPreviously + 1,
value: [] //will be fixed later by the tie function
value: [],
interpretations: {}
};

@@ -206,3 +209,4 @@ }

kind: "value",
value: decodedChildren
value: decodedChildren,
interpretations: {}
};

@@ -218,3 +222,4 @@ }

reference: seenPreviously + 1,
value: [] //will be fixed later by the tie function
value: [],
interpretations: {}
};

@@ -259,3 +264,4 @@ }

kind: "value",
value: decodedMembers
value: decodedMembers,
interpretations: {}
};

@@ -262,0 +268,0 @@ }

@@ -76,3 +76,4 @@ "use strict";

}, { location: "special", special: "value" }, info)
}
},
interpretations: {}
};

@@ -89,3 +90,4 @@ case "tx":

}, { location: "special", special: "gasprice" }, info)
}
},
interpretations: {}
};

@@ -123,3 +125,4 @@ case "block":

kind: "value",
value: block
value: block,
interpretations: {}
};

@@ -126,0 +129,0 @@ }

@@ -116,3 +116,4 @@ "use strict";

kind: "value",
value: yield* Basic.Decode.decodeExternalFunction(address, selector, info)
value: yield* Basic.Decode.decodeExternalFunction(address, selector, info),
interpretations: {}
};

@@ -119,0 +120,0 @@ }

@@ -225,3 +225,4 @@ "use strict";

kind: "value",
value: decodedChildren
value: decodedChildren,
interpretations: {}
};

@@ -344,3 +345,4 @@ }

kind: "value",
value: decodedMembers
value: decodedMembers,
interpretations: {}
};

@@ -419,3 +421,4 @@ }

kind: "value",
value: decodedEntries
value: decodedEntries,
interpretations: {}
};

@@ -422,0 +425,0 @@ }

@@ -632,3 +632,3 @@ import type BN from "bn.js";

*/
export declare type DecoderRequest = StorageRequest | CodeRequest;
export declare type DecoderRequest = StorageRequest | CodeRequest | EnsPrimaryNameRequest;
/**

@@ -652,2 +652,11 @@ * A request for storage

}
/**
* A request for a (primary) ENS name
*
* @Category Requests
*/
export interface EnsPrimaryNameRequest {
type: "ens-primary-name";
address: string;
}
export interface DecoderOptions {

@@ -654,0 +663,0 @@ paddingMode?: PaddingMode;

@@ -175,3 +175,4 @@ "use strict";

asAddress
}
},
interpretations: {}
};

@@ -185,3 +186,4 @@ case "contract":

address: asAddress
}
},
interpretations: {}
};

@@ -188,0 +190,0 @@ }

@@ -56,3 +56,4 @@ "use strict";

asBoolean: input
}
},
interpretations: {}
};

@@ -76,3 +77,4 @@ }

asBoolean
}
},
interpretations: {}
};

@@ -104,3 +106,4 @@ }

asBoolean
}
},
interpretations: {}
};

@@ -128,3 +131,4 @@ }

asBoolean: true
}
},
interpretations: {}
};

@@ -194,5 +198,6 @@ }

asBoolean
}
},
interpretations: {}
};
}
//# sourceMappingURL=bool.js.map

@@ -66,3 +66,4 @@ "use strict";

selector
}
},
interpretations: {}
};

@@ -95,3 +96,4 @@ }

selector
}
},
interpretations: {}
};

@@ -129,3 +131,4 @@ }

selector
}
},
interpretations: {}
};

@@ -132,0 +135,0 @@ }

@@ -120,8 +120,8 @@ "use strict";

"": 0,
wei: 0,
gwei: 9,
shannon: 9,
szabo: 12,
finney: 15,
ether: 18
"wei": 0,
"gwei": 9,
"shannon": 9,
"szabo": 12,
"finney": 15,
"ether": 18
};

@@ -232,3 +232,4 @@ let quantity;

name: finalComponent //we know it matches!
}
},
interpretations: {}
};

@@ -458,3 +459,4 @@ }

asBN
}
},
interpretations: {}
};

@@ -473,3 +475,4 @@ case "int":

asBN
}
},
interpretations: {}
};

@@ -487,3 +490,4 @@ case "enum":

name: fullType.options[asBN.toNumber()]
}
},
interpretations: {}
};

@@ -490,0 +494,0 @@ }

@@ -59,3 +59,4 @@ "use strict";

asString: input
}
},
interpretations: {}
};

@@ -86,3 +87,4 @@ }

kind: "value",
value: input.value
value: input.value,
interpretations: {}
};

@@ -100,3 +102,4 @@ }

kind: "value",
value: info
value: info,
interpretations: {}
};

@@ -103,0 +106,0 @@ }

@@ -136,3 +136,4 @@ "use strict";

kind: "value",
value
value,
interpretations: {}
};

@@ -225,3 +226,4 @@ }

kind: "value",
value
value,
interpretations: {}
};

@@ -347,3 +349,4 @@ }

kind: "value",
value: value
value: value,
interpretations: {}
};

@@ -510,3 +513,4 @@ }

kind: "value",
value
value,
interpretations: {}
};

@@ -531,3 +535,4 @@ }

kind: "value",
value
value,
interpretations: {}
};

@@ -534,0 +539,0 @@ }

@@ -15,3 +15,3 @@ {

},
"version": "0.14.17",
"version": "0.15.0",
"main": "dist/lib/index.js",

@@ -29,3 +29,3 @@ "files": [

"dependencies": {
"@truffle/abi-utils": "^0.3.9",
"@truffle/abi-utils": "^0.3.10",
"@truffle/compile-common": "^0.9.4",

@@ -39,3 +39,3 @@ "big.js": "^6.0.3",

"utf8": "^3.0.0",
"web3-utils": "1.8.2"
"web3-utils": "1.10.0"
},

@@ -69,3 +69,3 @@ "devDependencies": {

},
"gitHead": "2c3ec3c44eaa2f791d429e85ef181ac918679233"
"gitHead": "97a11771e65ca8929182cccd4afcbcde2852be3b"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc