import type { ResolvedConfig } from './config.js'; import type { Prettify, Range } from './types.js'; export type Address = ResolvedConfig['AddressType']; export type MBytes = '' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32; export type MBits = '' | 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | 208 | 216 | 224 | 232 | 240 | 248 | 256; export type SolidityAddress = 'address'; export type SolidityBool = 'bool'; export type SolidityBytes = `bytes${MBytes}`; export type SolidityFunction = 'function'; export type SolidityString = 'string'; export type SolidityTuple = 'tuple'; export type SolidityInt = `${'u' | ''}int${MBits}`; export type SolidityFixedArrayRange = Range[number]; export type SolidityFixedArraySizeLookup = { [Prop in SolidityFixedArrayRange as `${Prop}`]: Prop; }; /** * Recursively build arrays up to maximum depth * or use a more broad type when maximum depth is switched "off" */ type _BuildArrayTypes = ResolvedConfig['ArrayMaxDepth'] extends false ? `${T}[${string}]` : Depth['length'] extends ResolvedConfig['ArrayMaxDepth'] ? T : T extends `${any}[${SolidityFixedArrayRange | ''}]` ? _BuildArrayTypes : _BuildArrayTypes<`${T}[${SolidityFixedArrayRange | ''}]`, [...Depth, 1]>; export type SolidityArrayWithoutTuple = _BuildArrayTypes; export type SolidityArrayWithTuple = _BuildArrayTypes; export type SolidityArray = SolidityArrayWithoutTuple | SolidityArrayWithTuple; export type AbiType = SolidityArray | SolidityAddress | SolidityBool | SolidityBytes | SolidityFunction | SolidityInt | SolidityString | SolidityTuple; type ResolvedAbiType = ResolvedConfig['StrictAbiType'] extends true ? AbiType : string; export type AbiInternalType = ResolvedAbiType | `address ${string}` | `contract ${string}` | `enum ${string}` | `struct ${string}`; export type AbiParameter = Prettify<{ type: ResolvedAbiType; name?: string | undefined; /** Representation used by Solidity compiler */ internalType?: AbiInternalType | undefined; } & ({ type: Exclude; } | { type: SolidityTuple | SolidityArrayWithTuple; components: readonly AbiParameter[]; })>; export type AbiEventParameter = Prettify; /** * State mutability for {@link AbiFunction} * * @see https://docs.soliditylang.org/en/latest/contracts.html#state-mutability */ export type AbiStateMutability = 'pure' | 'view' | 'nonpayable' | 'payable'; /** Kind of {@link AbiParameter} */ export type AbiParameterKind = 'inputs' | 'outputs'; /** ABI ["function"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */ export type AbiFunction = { type: 'function'; /** * @deprecated use `pure` or `view` from {@link AbiStateMutability} instead * @see https://github.com/ethereum/solidity/issues/992 */ constant?: boolean | undefined; /** * @deprecated Vyper used to provide gas estimates * @see https://github.com/vyperlang/vyper/issues/2151 */ gas?: number | undefined; inputs: readonly AbiParameter[]; name: string; outputs: readonly AbiParameter[]; /** * @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead * @see https://github.com/ethereum/solidity/issues/992 */ payable?: boolean | undefined; stateMutability: AbiStateMutability; }; /** ABI ["constructor"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */ export type AbiConstructor = { type: 'constructor'; inputs: readonly AbiParameter[]; /** * @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead * @see https://github.com/ethereum/solidity/issues/992 */ payable?: boolean | undefined; stateMutability: Extract; }; /** ABI ["fallback"](https://docs.soliditylang.org/en/latest/abi-spec.html#json) type */ export type AbiFallback = { type: 'fallback'; inputs?: readonly [] | undefined; /** * @deprecated use `payable` or `nonpayable` from {@link AbiStateMutability} instead * @see https://github.com/ethereum/solidity/issues/992 */ payable?: boolean | undefined; stateMutability: Extract; }; /** ABI ["receive"](https://docs.soliditylang.org/en/latest/contracts.html#receive-ether-function) type */ export type AbiReceive = { type: 'receive'; stateMutability: Extract; }; /** ABI ["event"](https://docs.soliditylang.org/en/latest/abi-spec.html#events) type */ export type AbiEvent = { type: 'event'; anonymous?: boolean | undefined; inputs: readonly AbiEventParameter[]; name: string; }; /** ABI ["error"](https://docs.soliditylang.org/en/latest/abi-spec.html#errors) type */ export type AbiError = { type: 'error'; inputs: readonly AbiParameter[]; name: string; }; /** `"type"` name for {@link Abi} items. */ export type AbiItemType = 'constructor' | 'error' | 'event' | 'fallback' | 'function' | 'receive'; /** * Contract [ABI Specification](https://docs.soliditylang.org/en/latest/abi-spec.html#json) */ export type Abi = readonly (AbiConstructor | AbiError | AbiEvent | AbiFallback | AbiFunction | AbiReceive)[]; export type TypedDataDomain = { chainId?: number | undefined; name?: string | undefined; salt?: ResolvedConfig['BytesType']['outputs'] | undefined; verifyingContract?: Address | undefined; version?: string | undefined; }; export type TypedDataType = Exclude; export type TypedDataParameter = { name: string; type: TypedDataType | keyof TypedData | `${keyof TypedData}[${string | ''}]`; }; /** * [EIP-712](https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A) Typed Data Specification */ export type TypedData = Prettify<{ [key: string]: readonly TypedDataParameter[]; } & { [_ in TypedDataType]?: never | undefined; }>; export {}; //# sourceMappingURL=abi.d.ts.map