Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abitype

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abitype - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

45

dist/index.d.ts
import { A as AbiType, a as AbiParameterKind, S as SolidityAddress, b as SolidityBool, c as SolidityBytes, d as SolidityFunction, e as SolidityInt, f as SolidityString, g as SolidityTuple, h as SolidityArray, i as AbiParameter, j as SolidityFixedArrayRange, k as SolidityFixedArraySizeLookup, l as Abi, m as AbiStateMutability, T as TypedData, n as TypedDataType, o as TypedDataParameter, M as MBits } from './abi-6b6a2f3b.js';
export { l as Abi, p as AbiError, q as AbiEvent, r as AbiFunction, s as AbiInternalType, i as AbiParameter, a as AbiParameterKind, m as AbiStateMutability, A as AbiType, t as Address, S as SolidityAddress, h as SolidityArray, v as SolidityArrayWithTuple, u as SolidityArrayWithoutTuple, b as SolidityBool, c as SolidityBytes, j as SolidityFixedArrayRange, k as SolidityFixedArraySizeLookup, d as SolidityFunction, e as SolidityInt, f as SolidityString, g as SolidityTuple, T as TypedData, w as TypedDataDomain, o as TypedDataParameter, n as TypedDataType } from './abi-6b6a2f3b.js';
import { R as ResolvedConfig, E as Error, T as Tuple, M as Merge, a as Trim, P as Prettify, I as IsUnknown, F as Filter } from './config-8b48968c.js';
import { R as ResolvedConfig, E as Error$1, T as Tuple, M as Merge, a as Trim, P as Prettify, I as IsUnknown, F as Filter } from './config-8b48968c.js';
export { C as Config, D as DefaultConfig, R as ResolvedConfig } from './config-8b48968c.js';
type BaseErrorArgs = {
docsPath?: string;
metaMessages?: string[];
} & ({
cause?: never;
details?: string;
} | {
cause: BaseError | Error;
details?: never;
});
declare class BaseError extends Error {
details: string;
docsPath?: string;
metaMessages?: string[];
shortMessage: string;
name: string;
constructor(shortMessage: string, args?: BaseErrorArgs);
}
/**

@@ -49,3 +68,3 @@ * Infers embedded primitive type of any type

} & {
[_ in SolidityInt]: TAbiType extends `${'u' | ''}int${infer TBits}` ? TBits extends keyof BitsTypeLookup ? BitsTypeLookup[TBits] : Error<'Unknown bits value.'> : Error<`Unknown 'SolidityInt' format.`>;
[_ in SolidityInt]: TAbiType extends `${'u' | ''}int${infer TBits}` ? TBits extends keyof BitsTypeLookup ? BitsTypeLookup[TBits] : Error$1<'Unknown bits value.'> : Error$1<`Unknown 'SolidityInt' format.`>;
} & {

@@ -102,3 +121,3 @@ [_ in SolidityString]: string;

type: Head;
}>, TAbiParameterKind>[] : never : ResolvedConfig['StrictAbiType'] extends true ? TAbiParameter['type'] extends infer TAbiType extends string ? Error<`Unknown type '${TAbiType}'.`> : never : unknown;
}>, TAbiParameterKind>[] : never : ResolvedConfig['StrictAbiType'] extends true ? TAbiParameter['type'] extends infer TAbiType extends string ? Error$1<`Unknown type '${TAbiType}'.`> : never : unknown;
type _HasUnnamedAbiParameter<TAbiParameters extends readonly AbiParameter[]> = TAbiParameters extends readonly [

@@ -232,3 +251,3 @@ infer Head extends AbiParameter,

[K in keyof TTypedData]: {
[K2 in TTypedData[K][number] as K2['name']]: K2['type'] extends K ? Error<`Cannot convert self-referencing struct '${K2['type']}' to primitive type.`> : K2['type'] extends keyof TTypedData ? K2['type'] extends keyof TKeyReferences ? Error<`Circular reference detected. '${K2['type']}' is a circular reference.`> : TypedDataToPrimitiveTypes<Exclude<TTypedData, K>, TAbiParameterKind, TKeyReferences & {
[K2 in TTypedData[K][number] as K2['name']]: K2['type'] extends K ? Error$1<`Cannot convert self-referencing struct '${K2['type']}' to primitive type.`> : K2['type'] extends keyof TTypedData ? K2['type'] extends keyof TKeyReferences ? Error$1<`Circular reference detected. '${K2['type']}' is a circular reference.`> : TypedDataToPrimitiveTypes<Exclude<TTypedData, K>, TAbiParameterKind, TKeyReferences & {
[_ in K2['type']]: true;

@@ -238,3 +257,3 @@ }>[K2['type']] : K2['type'] extends `${infer TType extends keyof TTypedData & string}[${infer Tail}]` ? AbiParameterToPrimitiveType<Merge<K2, {

components: _TypedDataParametersToAbiParameters<TTypedData[TType], TTypedData>;
}>, TAbiParameterKind> : K2['type'] extends TypedDataType ? AbiParameterToPrimitiveType<K2, TAbiParameterKind> : Error<`Cannot convert unknown type '${K2['type']}' to primitive type.`>;
}>, TAbiParameterKind> : K2['type'] extends TypedDataType ? AbiParameterToPrimitiveType<K2, TAbiParameterKind> : Error$1<`Cannot convert unknown type '${K2['type']}' to primitive type.`>;
};

@@ -271,3 +290,3 @@ };

type IsSignature<T extends string> = (IsErrorSignature<T> extends true ? true : never) | (IsEventSignature<T> extends true ? true : never) | (IsFunctionSignature<T> extends true ? true : never) | (IsStructSignature<T> extends true ? true : never) | (T extends ConstructorSignature ? true : never) | (T extends FallbackSignature ? true : never) | (T extends ReceiveSignature ? true : never) extends infer Condition ? [Condition] extends [never] ? false : true : false;
type Signature<T extends string, K extends string | unknown = unknown> = IsSignature<T> extends true ? T : Error<`Signature "${T}" is invalid${K extends string ? ` at position ${K}` : ''}.`>;
type Signature<T extends string, K extends string | unknown = unknown> = IsSignature<T> extends true ? T : Error$1<`Signature "${T}" is invalid${K extends string ? ` at position ${K}` : ''}.`>;
type Signatures<T extends readonly string[]> = {

@@ -426,3 +445,3 @@ [K in keyof T]: Signature<T[K], K>;

...{
[K in keyof TAbiParameters]: TAbiParameters[K]['type'] extends `${infer Head extends string & keyof TStructs}[${infer Tail}]` ? Head extends keyof TKeyReferences ? Error<`Circular reference detected. Struct "${TAbiParameters[K]['type']}" is a circular reference.`> : {
[K in keyof TAbiParameters]: TAbiParameters[K]['type'] extends `${infer Head extends string & keyof TStructs}[${infer Tail}]` ? Head extends keyof TKeyReferences ? Error$1<`Circular reference detected. Struct "${TAbiParameters[K]['type']}" is a circular reference.`> : {
readonly name: TAbiParameters[K]['name'];

@@ -433,3 +452,3 @@ readonly type: `tuple[${Tail}]`;

}>;
} : TAbiParameters[K]['type'] extends keyof TStructs ? TAbiParameters[K]['type'] extends keyof TKeyReferences ? Error<`Circular reference detected. Struct "${TAbiParameters[K]['type']}" is a circular reference.`> : {
} : TAbiParameters[K]['type'] extends keyof TStructs ? TAbiParameters[K]['type'] extends keyof TKeyReferences ? Error$1<`Circular reference detected. Struct "${TAbiParameters[K]['type']}" is a circular reference.`> : {
readonly name: TAbiParameters[K]['name'];

@@ -481,3 +500,3 @@ readonly type: 'tuple';

*/
declare function parseAbi<TSignatures extends readonly string[] | readonly unknown[]>(signatures: Narrow<TSignatures> & (TSignatures extends readonly string[] ? TSignatures extends readonly [] ? Error<'At least one signature required.'> : string[] extends TSignatures ? unknown : Signatures<TSignatures> : never)): ParseAbi<TSignatures>;
declare function parseAbi<TSignatures extends readonly string[] | readonly unknown[]>(signatures: Narrow<TSignatures> & (TSignatures extends readonly string[] ? TSignatures extends readonly [] ? Error$1<'At least one signature required.'> : string[] extends TSignatures ? unknown : Signatures<TSignatures> : never)): ParseAbi<TSignatures>;

@@ -520,3 +539,3 @@ /**

*/
declare function parseAbiItem<TSignature extends string | readonly string[] | readonly unknown[]>(signature: Narrow<TSignature> & ((TSignature extends string ? string extends TSignature ? unknown : Signature<TSignature> : never) | (TSignature extends readonly string[] ? TSignature extends readonly [] ? Error<'At least one signature required.'> : string[] extends TSignature ? unknown : Signatures<TSignature> : never))): ParseAbiItem<TSignature>;
declare function parseAbiItem<TSignature extends string | readonly string[] | readonly unknown[]>(signature: Narrow<TSignature> & ((TSignature extends string ? string extends TSignature ? unknown : Signature<TSignature> : never) | (TSignature extends readonly string[] ? TSignature extends readonly [] ? Error$1<'At least one signature required.'> : string[] extends TSignature ? unknown : Signatures<TSignature> : never))): ParseAbiItem<TSignature>;

@@ -564,3 +583,3 @@ /**

*/
declare function parseAbiParameter<TParam extends string | readonly string[] | readonly unknown[]>(param: Narrow<TParam> & ((TParam extends string ? TParam extends '' ? Error<'Empty string is not allowed.'> : unknown : never) | (TParam extends readonly string[] ? TParam extends readonly [] ? Error<'At least one parameter required.'> : string[] extends TParam ? unknown : unknown : never))): ParseAbiParameter<TParam>;
declare function parseAbiParameter<TParam extends string | readonly string[] | readonly unknown[]>(param: Narrow<TParam> & ((TParam extends string ? TParam extends '' ? Error$1<'Empty string is not allowed.'> : unknown : never) | (TParam extends readonly string[] ? TParam extends readonly [] ? Error$1<'At least one parameter required.'> : string[] extends TParam ? unknown : unknown : never))): ParseAbiParameter<TParam>;

@@ -608,4 +627,4 @@ /**

*/
declare function parseAbiParameters<TParams extends string | readonly string[] | readonly unknown[]>(params: Narrow<TParams> & ((TParams extends string ? TParams extends '' ? Error<'Empty string is not allowed.'> : unknown : never) | (TParams extends readonly string[] ? TParams extends readonly [] ? Error<'At least one parameter required.'> : string[] extends TParams ? unknown : unknown : never))): ParseAbiParameters<TParams>;
declare function parseAbiParameters<TParams extends string | readonly string[] | readonly unknown[]>(params: Narrow<TParams> & ((TParams extends string ? TParams extends '' ? Error$1<'Empty string is not allowed.'> : unknown : never) | (TParams extends readonly string[] ? TParams extends readonly [] ? Error$1<'At least one parameter required.'> : string[] extends TParams ? unknown : unknown : never))): ParseAbiParameters<TParams>;
export { AbiParameterToPrimitiveType, AbiParametersToPrimitiveTypes, AbiTypeToPrimitiveType, ExtractAbiError, ExtractAbiErrorNames, ExtractAbiErrors, ExtractAbiEvent, ExtractAbiEventNames, ExtractAbiEvents, ExtractAbiFunction, ExtractAbiFunctionNames, ExtractAbiFunctions, IsAbi, IsTypedData, Narrow, ParseAbi, ParseAbiItem, ParseAbiParameter, ParseAbiParameters, TypedDataToPrimitiveTypes, narrow, parseAbi, parseAbiItem, parseAbiParameter, parseAbiParameters };
export { AbiParameterToPrimitiveType, AbiParametersToPrimitiveTypes, AbiTypeToPrimitiveType, BaseError, ExtractAbiError, ExtractAbiErrorNames, ExtractAbiErrors, ExtractAbiEvent, ExtractAbiEventNames, ExtractAbiEvents, ExtractAbiFunction, ExtractAbiFunctionNames, ExtractAbiFunctions, IsAbi, IsTypedData, Narrow, ParseAbi, ParseAbiItem, ParseAbiParameter, ParseAbiParameters, TypedDataToPrimitiveTypes, narrow, parseAbi, parseAbiItem, parseAbiParameter, parseAbiParameters };

@@ -12,2 +12,34 @@ import {

// package.json
var name = "abitype";
var version = "0.6.5";
// src/errors.ts
var BaseError = class extends Error {
constructor(shortMessage, args = {}) {
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
const docsPath = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
const message = [
shortMessage || "An error occurred.",
"",
...args.metaMessages ? [...args.metaMessages, ""] : [],
...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
...details ? [`Details: ${details}`] : [],
`Version: ${name}@${version}`
].join("\n");
super(message);
__publicField(this, "details");
__publicField(this, "docsPath");
__publicField(this, "metaMessages");
__publicField(this, "shortMessage");
__publicField(this, "name", "AbiTypeError");
if (args.cause)
this.cause = args.cause;
this.details = details;
this.docsPath = docsPath;
this.metaMessages = args.metaMessages;
this.shortMessage = shortMessage;
}
};
// src/narrow.ts

@@ -72,34 +104,2 @@ function narrow(value) {

// package.json
var name = "abitype";
var version = "0.6.4";
// src/human-readable/errors.ts
var BaseError = class extends Error {
constructor(shortMessage, args = {}) {
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
const docsPath = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
const message = [
shortMessage || "An error occurred.",
"",
...args.metaMessages ? [...args.metaMessages, ""] : [],
...docsPath ? [`Docs: https://abitype.dev${docsPath}`] : [],
...details ? [`Details: ${details}`] : [],
`Version: ${name}@${version}`
].join("\n");
super(message);
__publicField(this, "details");
__publicField(this, "docsPath");
__publicField(this, "metaMessages");
__publicField(this, "shortMessage");
__publicField(this, "name", "AbiTypeError");
if (args.cause)
this.cause = args.cause;
this.details = details;
this.docsPath = docsPath;
this.metaMessages = args.metaMessages;
this.shortMessage = shortMessage;
}
};
// src/human-readable/runtime/cache.ts

@@ -537,2 +537,3 @@ function getParameterCacheKey(param, type) {

export {
BaseError,
narrow,

@@ -539,0 +540,0 @@ parseAbi,

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "0.6.4",
"version": "0.6.5",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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