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

abitype

Package Overview
Dependencies
Maintainers
2
Versions
182
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.7.0-canary.20230307T162852 to 0.7.0-canary.20230307T235025

dist/abi-4dfce13f.d.ts

2

dist/config.d.ts

@@ -1,1 +0,1 @@

export { C as Config, D as DefaultConfig, R as ResolvedConfig } from './config-8b48968c.js';
export { C as Config, D as DefaultConfig, R as ResolvedConfig } from './config-edd78478.js';

@@ -1,5 +0,5 @@

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-aefa4da7.js';
export { l as Abi, p as AbiError, q as AbiEvent, r as AbiFunction, s as AbiInternalType, t as AbiItemType, i as AbiParameter, a as AbiParameterKind, m as AbiStateMutability, A as AbiType, u as Address, S as SolidityAddress, h as SolidityArray, w as SolidityArrayWithTuple, v 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, x as TypedDataDomain, o as TypedDataParameter, n as TypedDataType } from './abi-aefa4da7.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';
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-4dfce13f.js';
export { l as Abi, p as AbiConstructor, q as AbiError, r as AbiEvent, s as AbiFallback, t as AbiFunction, u as AbiInternalType, v as AbiItemType, i as AbiParameter, a as AbiParameterKind, w as AbiReceive, m as AbiStateMutability, A as AbiType, x as Address, S as SolidityAddress, h as SolidityArray, z as SolidityArrayWithTuple, y 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, B as TypedDataDomain, o as TypedDataParameter, n as TypedDataType } from './abi-4dfce13f.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-edd78478.js';
export { C as Config, D as DefaultConfig, R as ResolvedConfig } from './config-edd78478.js';

@@ -6,0 +6,0 @@ type BaseErrorArgs = {

@@ -13,3 +13,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }

var name = "abitype";
var version = "0.6.7";
var version = "0.6.8";

@@ -16,0 +16,0 @@ // src/errors.ts

import { z } from 'zod';
import { i as AbiParameter$1 } from '../abi-aefa4da7.js';
import '../config-8b48968c.js';
import { i as AbiParameter$1 } from '../abi-4dfce13f.js';
import '../config-edd78478.js';

@@ -17,3 +17,4 @@ declare const SolidityAddress: z.ZodLiteral<"address">;

declare const AbiStateMutability: z.ZodUnion<[z.ZodLiteral<"pure">, z.ZodLiteral<"view">, z.ZodLiteral<"nonpayable">, z.ZodLiteral<"payable">]>;
declare const AbiFunction: z.ZodEffects<z.ZodIntersection<z.ZodObject<{
declare const AbiFunction: z.ZodEffects<z.ZodObject<{
type: z.ZodLiteral<"function">;
/**

@@ -29,2 +30,5 @@ * @deprecated use `pure` or `view` from {@link AbiStateMutability} instead

gas: z.ZodOptional<z.ZodNumber>;
inputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
name: z.ZodString;
outputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
/**

@@ -40,2 +44,6 @@ * @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead

gas?: number | undefined;
inputs: AbiParameter$1[];
outputs: AbiParameter$1[];
type: "function";
name: string;
stateMutability: "pure" | "view" | "nonpayable" | "payable";

@@ -46,9 +54,2 @@ }, {

gas?: number | undefined;
stateMutability: "pure" | "view" | "nonpayable" | "payable";
}>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"function">;
inputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
name: z.ZodString;
outputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
}, "strip", z.ZodTypeAny, {
inputs: AbiParameter$1[];

@@ -58,3 +59,7 @@ outputs: AbiParameter$1[];

name: string;
}, {
stateMutability: "pure" | "view" | "nonpayable" | "payable";
}>, {
payable?: boolean | undefined;
constant?: boolean | undefined;
gas?: number | undefined;
inputs: AbiParameter$1[];

@@ -64,21 +69,63 @@ outputs: AbiParameter$1[];

name: string;
}>, z.ZodObject<{
stateMutability: "pure" | "view" | "nonpayable" | "payable";
}, unknown>;
declare const AbiConstructor: z.ZodEffects<z.ZodObject<{
type: z.ZodLiteral<"constructor">;
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
inputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: z.ZodOptional<z.ZodBoolean>;
stateMutability: z.ZodUnion<[z.ZodLiteral<"nonpayable">, z.ZodLiteral<"payable">]>;
}, "strip", z.ZodTypeAny, {
payable?: boolean | undefined;
inputs: AbiParameter$1[];
type: "constructor";
stateMutability: "nonpayable" | "payable";
}, {
payable?: boolean | undefined;
inputs: AbiParameter$1[];
type: "constructor";
}>, z.ZodObject<{
stateMutability: "nonpayable" | "payable";
}>, {
payable?: boolean | undefined;
inputs: AbiParameter$1[];
type: "constructor";
stateMutability: "nonpayable" | "payable";
}, unknown>;
declare const AbiFallback: z.ZodEffects<z.ZodObject<{
type: z.ZodLiteral<"fallback">;
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
inputs: z.ZodOptional<z.ZodTuple<[], null>>;
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: z.ZodOptional<z.ZodBoolean>;
stateMutability: z.ZodUnion<[z.ZodLiteral<"nonpayable">, z.ZodLiteral<"payable">]>;
}, "strip", z.ZodTypeAny, {
payable?: boolean | undefined;
inputs?: [] | undefined;
type: "fallback";
stateMutability: "nonpayable" | "payable";
}, {
payable?: boolean | undefined;
inputs?: [] | undefined;
type: "fallback";
}>, z.ZodObject<{
stateMutability: "nonpayable" | "payable";
}>, {
payable?: boolean | undefined;
inputs?: [] | undefined;
type: "fallback";
stateMutability: "nonpayable" | "payable";
}, unknown>;
declare const AbiReceive: z.ZodObject<{
type: z.ZodLiteral<"receive">;

@@ -92,22 +139,3 @@ stateMutability: z.ZodLiteral<"payable">;

stateMutability: "payable";
}>]>>, {
payable?: boolean | undefined;
constant?: boolean | undefined;
gas?: number | undefined;
stateMutability: "pure" | "view" | "nonpayable" | "payable";
} & ({
inputs: AbiParameter$1[];
outputs: AbiParameter$1[];
type: "function";
name: string;
} | {
inputs: AbiParameter$1[];
type: "constructor";
} | {
inputs?: [] | undefined;
type: "fallback";
} | {
type: "receive";
stateMutability: "payable";
}), unknown>;
}>;
declare const AbiEvent: z.ZodObject<{

@@ -152,2 +180,3 @@ type: z.ZodLiteral<"event">;

}>;
declare const AbiItemType: z.ZodUnion<[z.ZodLiteral<"constructor">, z.ZodLiteral<"event">, z.ZodLiteral<"error">, z.ZodLiteral<"fallback">, z.ZodLiteral<"function">, z.ZodLiteral<"receive">]>;
/**

@@ -159,3 +188,40 @@ * Zod Schema for Contract [ABI Specification](https://docs.soliditylang.org/en/latest/abi-spec.html#json)

*/
declare const Abi: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodIntersection<z.ZodObject<{
declare const Abi: z.ZodArray<z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"error">;
inputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
inputs: AbiParameter$1[];
type: "error";
name: string;
}, {
inputs: AbiParameter$1[];
type: "error";
name: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"event">;
anonymous: z.ZodOptional<z.ZodBoolean>;
inputs: z.ZodArray<z.ZodIntersection<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, z.ZodObject<{
indexed: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
indexed?: boolean | undefined;
}, {
indexed?: boolean | undefined;
}>>, "many">;
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
anonymous?: boolean | undefined;
inputs: (AbiParameter$1 & {
indexed?: boolean | undefined;
})[];
type: "event";
name: string;
}, {
anonymous?: boolean | undefined;
inputs: (AbiParameter$1 & {
indexed?: boolean | undefined;
})[];
type: "event";
name: string;
}>, z.ZodEffects<z.ZodIntersection<z.ZodObject<{
/**

@@ -248,41 +314,4 @@ * @deprecated use `pure` or `view` from {@link AbiStateMutability} instead

stateMutability: "payable";
}), unknown>, z.ZodObject<{
type: z.ZodLiteral<"event">;
anonymous: z.ZodOptional<z.ZodBoolean>;
inputs: z.ZodArray<z.ZodIntersection<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, z.ZodObject<{
indexed: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
indexed?: boolean | undefined;
}, {
indexed?: boolean | undefined;
}>>, "many">;
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
anonymous?: boolean | undefined;
inputs: (AbiParameter$1 & {
indexed?: boolean | undefined;
})[];
type: "event";
name: string;
}, {
anonymous?: boolean | undefined;
inputs: (AbiParameter$1 & {
indexed?: boolean | undefined;
})[];
type: "event";
name: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"error">;
inputs: z.ZodArray<z.ZodType<AbiParameter$1, z.ZodTypeDef, AbiParameter$1>, "many">;
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
inputs: AbiParameter$1[];
type: "error";
name: string;
}, {
inputs: AbiParameter$1[];
type: "error";
name: string;
}>]>, "many">;
}), unknown>]>, "many">;
export { Abi, AbiError, AbiEvent, AbiFunction, AbiParameter, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithTuple, SolidityArrayWithoutTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple };
export { Abi, AbiConstructor, AbiError, AbiEvent, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithTuple, SolidityArrayWithoutTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple };

@@ -59,4 +59,2 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

const abiFunction = val;
if (abiFunction.type === "constructor" || abiFunction.type === "fallback" || abiFunction.type === "receive")
return abiFunction;
if (abiFunction.stateMutability === void 0) {

@@ -72,43 +70,81 @@ if (abiFunction.constant)

},
_zod.z.intersection(
_zod.z.object({
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
constant: _zod.z.boolean().optional(),
/**
* @deprecated Vyper used to provide gas estimates
* https://github.com/vyperlang/vyper/issues/2151
*/
gas: _zod.z.number().optional(),
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: _zod.z.boolean().optional(),
stateMutability: AbiStateMutability
}),
_zod.z.discriminatedUnion("type", [
_zod.z.object({
type: _zod.z.literal("function"),
inputs: _zod.z.array(AbiParameter),
name: _zod.z.string(),
outputs: _zod.z.array(AbiParameter)
}),
_zod.z.object({
type: _zod.z.literal("constructor"),
inputs: _zod.z.array(AbiParameter)
}),
_zod.z.object({
type: _zod.z.literal("fallback"),
inputs: _zod.z.tuple([]).optional()
}),
_zod.z.object({
type: _zod.z.literal("receive"),
stateMutability: _zod.z.literal("payable")
})
])
)
_zod.z.object({
type: _zod.z.literal("function"),
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
constant: _zod.z.boolean().optional(),
/**
* @deprecated Vyper used to provide gas estimates
* https://github.com/vyperlang/vyper/issues/2151
*/
gas: _zod.z.number().optional(),
inputs: _zod.z.array(AbiParameter),
name: _zod.z.string(),
outputs: _zod.z.array(AbiParameter),
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: _zod.z.boolean().optional(),
stateMutability: AbiStateMutability
})
);
var AbiConstructor = _zod.z.preprocess(
(val) => {
const abiFunction = val;
if (abiFunction.stateMutability === void 0) {
if (abiFunction.payable)
abiFunction.stateMutability = "payable";
else
abiFunction.stateMutability = "nonpayable";
}
return val;
},
_zod.z.object({
type: _zod.z.literal("constructor"),
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
inputs: _zod.z.array(AbiParameter),
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: _zod.z.boolean().optional(),
stateMutability: _zod.z.union([_zod.z.literal("nonpayable"), _zod.z.literal("payable")])
})
);
var AbiFallback = _zod.z.preprocess(
(val) => {
const abiFunction = val;
if (abiFunction.stateMutability === void 0) {
if (abiFunction.payable)
abiFunction.stateMutability = "payable";
else
abiFunction.stateMutability = "nonpayable";
}
return val;
},
_zod.z.object({
type: _zod.z.literal("fallback"),
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
inputs: _zod.z.tuple([]).optional(),
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: _zod.z.boolean().optional(),
stateMutability: _zod.z.union([_zod.z.literal("nonpayable"), _zod.z.literal("payable")])
})
);
var AbiReceive = _zod.z.object({
type: _zod.z.literal("receive"),
stateMutability: _zod.z.literal("payable")
});
var AbiEvent = _zod.z.object({

@@ -127,3 +163,75 @@ type: _zod.z.literal("event"),

});
var Abi = _zod.z.array(_zod.z.union([AbiFunction, AbiEvent, AbiError]));
var AbiItemType = _zod.z.union([
_zod.z.literal("constructor"),
_zod.z.literal("event"),
_zod.z.literal("error"),
_zod.z.literal("fallback"),
_zod.z.literal("function"),
_zod.z.literal("receive")
]);
var Abi = _zod.z.array(
_zod.z.union([
AbiError,
AbiEvent,
// TODO: Replace code below to `z.switch` (https://github.com/colinhacks/zod/issues/2106)
// Need to redefine `AbiFunction | AbiConstructor | AbiFallback | AbiReceive` since `z.discriminate` doesn't support `z.preprocess` on `options`
// https://github.com/colinhacks/zod/issues/1490
_zod.z.preprocess(
(val) => {
const abiItem = val;
if (abiItem.type === "receive")
return abiItem;
if (val.stateMutability === void 0) {
if (abiItem.type === "function" && abiItem.constant)
abiItem.stateMutability = "view";
else if (abiItem.payable)
abiItem.stateMutability = "payable";
else
abiItem.stateMutability = "nonpayable";
}
return val;
},
_zod.z.intersection(
_zod.z.object({
/**
* @deprecated use `pure` or `view` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
constant: _zod.z.boolean().optional(),
/**
* @deprecated Vyper used to provide gas estimates
* https://github.com/vyperlang/vyper/issues/2151
*/
gas: _zod.z.number().optional(),
/**
* @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead
* https://github.com/ethereum/solidity/issues/992
*/
payable: _zod.z.boolean().optional(),
stateMutability: AbiStateMutability
}),
_zod.z.discriminatedUnion("type", [
_zod.z.object({
type: _zod.z.literal("function"),
inputs: _zod.z.array(AbiParameter),
name: _zod.z.string(),
outputs: _zod.z.array(AbiParameter)
}),
_zod.z.object({
type: _zod.z.literal("constructor"),
inputs: _zod.z.array(AbiParameter)
}),
_zod.z.object({
type: _zod.z.literal("fallback"),
inputs: _zod.z.tuple([]).optional()
}),
_zod.z.object({
type: _zod.z.literal("receive"),
stateMutability: _zod.z.literal("payable")
})
])
)
)
])
);

@@ -146,2 +254,6 @@

exports.Abi = Abi; exports.AbiError = AbiError; exports.AbiEvent = AbiEvent; exports.AbiFunction = AbiFunction; exports.AbiParameter = AbiParameter; exports.AbiStateMutability = AbiStateMutability; exports.SolidityAddress = SolidityAddress; exports.SolidityArray = SolidityArray; exports.SolidityArrayWithTuple = SolidityArrayWithTuple; exports.SolidityArrayWithoutTuple = SolidityArrayWithoutTuple; exports.SolidityBool = SolidityBool; exports.SolidityBytes = SolidityBytes; exports.SolidityFunction = SolidityFunction; exports.SolidityInt = SolidityInt; exports.SolidityString = SolidityString; exports.SolidityTuple = SolidityTuple;
exports.Abi = Abi; exports.AbiConstructor = AbiConstructor; exports.AbiError = AbiError; exports.AbiEvent = AbiEvent; exports.AbiFallback = AbiFallback; exports.AbiFunction = AbiFunction; exports.AbiItemType = AbiItemType; exports.AbiParameter = AbiParameter; exports.AbiReceive = AbiReceive; exports.AbiStateMutability = AbiStateMutability; exports.SolidityAddress = SolidityAddress; exports.SolidityArray = SolidityArray; exports.SolidityArrayWithTuple = SolidityArrayWithTuple; exports.SolidityArrayWithoutTuple = SolidityArrayWithoutTuple; exports.SolidityBool = SolidityBool; exports.SolidityBytes = SolidityBytes; exports.SolidityFunction = SolidityFunction; exports.SolidityInt = SolidityInt; exports.SolidityString = SolidityString; exports.SolidityTuple = SolidityTuple;

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

"license": "MIT",
"version": "0.7.0-canary.20230307T162852",
"version": "0.7.0-canary.20230307T235025",
"repository": {

@@ -47,3 +47,3 @@ "type": "git",

"typescript": ">=4.9.4",
"zod": ">=3.19.1"
"zod": "^3 >=3.19.1"
},

@@ -50,0 +50,0 @@ "peerDependenciesMeta": {

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