web3-types
Advanced tools
Comparing version 1.9.1-dev.098ee6d.0 to 1.9.1-dev.0cbc23d.0
@@ -61,5 +61,5 @@ import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types.js'; | ||
} | ||
export declare type TransactionUnsignedAPI = Transaction1559UnsignedAPI | Transaction2930UnsignedAPI | TransactionLegacyUnsignedAPI; | ||
export declare type TransactionSignedAPI = Transaction1559SignedAPI | Transaction2930SignedAPI | TransactionLegacySignedAPI; | ||
export declare type TransactionInfoAPI = TransactionSignedAPI & { | ||
export type TransactionUnsignedAPI = Transaction1559UnsignedAPI | Transaction2930UnsignedAPI | TransactionLegacyUnsignedAPI; | ||
export type TransactionSignedAPI = Transaction1559SignedAPI | Transaction2930SignedAPI | TransactionLegacySignedAPI; | ||
export type TransactionInfoAPI = TransactionSignedAPI & { | ||
readonly blockHash?: HexString32Bytes; | ||
@@ -75,9 +75,9 @@ readonly blockNumber?: Uint; | ||
} | ||
export declare type TransactionWithSenderAPI = TransactionUnsignedAPI & { | ||
export type TransactionWithSenderAPI = TransactionUnsignedAPI & { | ||
from: Address; | ||
}; | ||
export declare type BlockAPI = BlockBase<HexString32Bytes, HexString, Uint, HexStringBytes, TransactionHash[] | TransactionInfoAPI[], HexString256Bytes>; | ||
export declare type LogAPI = LogBase<Uint, HexString32Bytes>; | ||
export declare type TransactionReceiptAPI = TransactionReceiptBase<Uint, HexString32Bytes, HexString256Bytes, LogAPI>; | ||
export declare type SyncingStatusAPI = { | ||
export type BlockAPI = BlockBase<HexString32Bytes, HexString, Uint, HexStringBytes, TransactionHash[] | TransactionInfoAPI[], HexString256Bytes>; | ||
export type LogAPI = LogBase<Uint, HexString32Bytes>; | ||
export type TransactionReceiptAPI = TransactionReceiptBase<Uint, HexString32Bytes, HexString256Bytes, LogAPI>; | ||
export type SyncingStatusAPI = { | ||
startingBlock: Uint; | ||
@@ -87,4 +87,4 @@ currentBlock: Uint; | ||
} | boolean; | ||
export declare type FeeHistoryResultAPI = FeeHistoryBase<Uint>; | ||
export declare type FilterResultsAPI = HexString32Bytes[] | LogAPI[]; | ||
export type FeeHistoryResultAPI = FeeHistoryBase<Uint>; | ||
export type FilterResultsAPI = HexString32Bytes[] | LogAPI[]; | ||
export interface CompileResultAPI { | ||
@@ -106,3 +106,3 @@ readonly code: HexStringBytes; | ||
} | ||
export declare type EthExecutionAPI = { | ||
export type EthExecutionAPI = { | ||
eth_getBlockByHash: (blockHash: HexString32Bytes, hydrated: boolean) => BlockAPI; | ||
@@ -109,0 +109,0 @@ eth_getBlockByNumber: (blockNumber: BlockNumberOrTag, hydrated: boolean) => BlockAPI; |
import { Address, Transaction } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type EthPersonalAPI = { | ||
export type EthPersonalAPI = { | ||
personal_listAccounts: () => Address[]; | ||
@@ -5,0 +5,0 @@ personal_newAccount: (password: string) => Address; |
import { EthExecutionAPI } from './eth_execution_api.js'; | ||
import { AccountObject, Address, BlockNumberOrTag, Eip712TypedData, HexString256Bytes, HexString32Bytes, TransactionInfo, Uint } from '../eth_types.js'; | ||
export declare type Web3EthExecutionAPI = EthExecutionAPI & { | ||
export type Web3EthExecutionAPI = EthExecutionAPI & { | ||
eth_pendingTransactions: () => TransactionInfo[]; | ||
@@ -5,0 +5,0 @@ eth_requestAccounts: () => Address[]; |
import { HexString } from '../primitives_types.js'; | ||
export declare type Web3NetAPI = { | ||
export type Web3NetAPI = { | ||
net_version: () => string; | ||
@@ -4,0 +4,0 @@ net_peerCount: () => HexString; |
@@ -8,3 +8,3 @@ import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
} | ||
export declare type NumberTypes = { | ||
export type NumberTypes = { | ||
[FMT_NUMBER.NUMBER]: number; | ||
@@ -19,3 +19,3 @@ [FMT_NUMBER.HEX]: HexString; | ||
} | ||
export declare type ByteTypes = { | ||
export type ByteTypes = { | ||
[FMT_BYTES.HEX]: HexString; | ||
@@ -29,3 +29,3 @@ [FMT_BYTES.UINT8ARRAY]: Uint8Array; | ||
*/ | ||
export declare type DataFormat = { | ||
export type DataFormat = { | ||
readonly number: FMT_NUMBER; | ||
@@ -42,4 +42,4 @@ readonly bytes: FMT_BYTES; | ||
}; | ||
export declare type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Uint8Array extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
export type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Uint8Array extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
[P in keyof T]: FormatType<T[P], F>; | ||
} : T; |
@@ -26,3 +26,3 @@ "use strict"; | ||
FMT_NUMBER["BIGINT"] = "NUMBER_BIGINT"; | ||
})(FMT_NUMBER = exports.FMT_NUMBER || (exports.FMT_NUMBER = {})); | ||
})(FMT_NUMBER || (exports.FMT_NUMBER = FMT_NUMBER = {})); | ||
var FMT_BYTES; | ||
@@ -32,3 +32,3 @@ (function (FMT_BYTES) { | ||
FMT_BYTES["UINT8ARRAY"] = "BYTES_UINT8ARRAY"; | ||
})(FMT_BYTES = exports.FMT_BYTES || (exports.FMT_BYTES = {})); | ||
})(FMT_BYTES || (exports.FMT_BYTES = FMT_BYTES = {})); | ||
exports.DEFAULT_RETURN_FORMAT = { | ||
@@ -35,0 +35,0 @@ number: FMT_NUMBER.BIGINT, |
@@ -6,3 +6,3 @@ export interface Web3Error extends Error { | ||
} | ||
export declare type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
export type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
keyword: K; | ||
@@ -9,0 +9,0 @@ instancePath: string; |
import { Address } from './eth_types.js'; | ||
import { Bytes, Numbers } from './primitives_types.js'; | ||
import { FixedSizeArray } from './utility_types.js'; | ||
declare type _SolidityIndexRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30; | ||
export declare type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
export declare type Components = { | ||
type _SolidityIndexRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30; | ||
export type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
export type Components = { | ||
name: string; | ||
@@ -21,3 +21,3 @@ type: string; | ||
} | ||
export declare type AbiParameter = { | ||
export type AbiParameter = { | ||
readonly name: string; | ||
@@ -32,7 +32,7 @@ readonly type: string; | ||
}; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export declare type AbiBaseFragment = { | ||
type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export type AbiBaseFragment = { | ||
readonly type: string | FragmentTypes; | ||
}; | ||
export declare type AbiConstructorFragment = AbiBaseFragment & { | ||
export type AbiConstructorFragment = AbiBaseFragment & { | ||
readonly type: string | 'constructor'; | ||
@@ -42,3 +42,3 @@ readonly stateMutability: string | 'nonpayable' | 'payable'; | ||
}; | ||
export declare type AbiFunctionFragment = AbiBaseFragment & { | ||
export type AbiFunctionFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -54,3 +54,3 @@ readonly type: string | 'function'; | ||
}; | ||
export declare type AbiFallbackFragment = AbiBaseFragment & { | ||
export type AbiFallbackFragment = AbiBaseFragment & { | ||
readonly name: never; | ||
@@ -64,3 +64,3 @@ readonly type: string | 'fallback'; | ||
}; | ||
export declare type AbiEventFragment = AbiBaseFragment & { | ||
export type AbiEventFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -71,3 +71,3 @@ readonly type: string | 'event'; | ||
}; | ||
export declare type AbiErrorFragment = AbiBaseFragment & { | ||
export type AbiErrorFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -77,3 +77,3 @@ readonly type: string | 'error'; | ||
}; | ||
export declare type AbiInput = string | AbiParameter | { | ||
export type AbiInput = string | AbiParameter | { | ||
name: string; | ||
@@ -93,6 +93,6 @@ type: string; | ||
} | ||
export declare type AbiFragment = AbiConstructorFragment | AbiFunctionFragment | AbiEventFragment | AbiErrorFragment | AbiFallbackFragment; | ||
export declare type AbiItem = AbiFragment; | ||
export declare type ContractAbi = ReadonlyArray<AbiFragment> | ReadonlyArray<AbiItem>; | ||
export declare type JsonFunctionInterface = { | ||
export type AbiFragment = AbiConstructorFragment | AbiFunctionFragment | AbiEventFragment | AbiErrorFragment | AbiFallbackFragment; | ||
export type AbiItem = AbiFragment; | ||
export type ContractAbi = ReadonlyArray<AbiFragment> | ReadonlyArray<AbiItem>; | ||
export type JsonFunctionInterface = { | ||
type: 'function'; | ||
@@ -104,3 +104,3 @@ name: string; | ||
}; | ||
export declare type JsonEventInterface = { | ||
export type JsonEventInterface = { | ||
type: 'event'; | ||
@@ -112,10 +112,10 @@ name: string; | ||
}; | ||
export declare type FilterAbis<Abis extends ContractAbi, Filter, Abi = Abis[number]> = Abi extends Filter ? Abi : never; | ||
declare type _TypedArray<Type, Size extends string> = Size extends '' ? Type[] : FixedSizeArray<Type, ConvertToNumber<Size>>; | ||
export declare type PrimitiveAddressType<Type extends string> = Type extends `address[${infer Size}]` ? _TypedArray<Address, Size> : Type extends 'address' ? Address : never; | ||
export declare type PrimitiveStringType<Type extends string> = Type extends `string${string}[${infer Size}]` ? _TypedArray<string, Size> : Type extends 'string' | `string${string}` ? string : never; | ||
export declare type PrimitiveBooleanType<Type extends string> = Type extends `bool[${infer Size}]` ? _TypedArray<boolean, Size> : Type extends 'bool' ? boolean : never; | ||
export declare type PrimitiveIntegerType<Type extends string> = Type extends `uint${string}[${infer Size}]` | `int${string}[${infer Size}]` ? _TypedArray<Numbers, Size> : Type extends 'uint' | 'int' | `int${string}` | `uint${string}` ? Numbers : never; | ||
export declare type PrimitiveBytesType<Type extends string> = Type extends `bytes${string}[${infer Size}]` ? _TypedArray<Bytes, Size> : Type extends 'bytes' | `bytes${string}` ? Bytes : never; | ||
export declare type PrimitiveTupleType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
export type FilterAbis<Abis extends ContractAbi, Filter, Abi = Abis[number]> = Abi extends Filter ? Abi : never; | ||
type _TypedArray<Type, Size extends string> = Size extends '' ? Type[] : FixedSizeArray<Type, ConvertToNumber<Size>>; | ||
export type PrimitiveAddressType<Type extends string> = Type extends `address[${infer Size}]` ? _TypedArray<Address, Size> : Type extends 'address' ? Address : never; | ||
export type PrimitiveStringType<Type extends string> = Type extends `string${string}[${infer Size}]` ? _TypedArray<string, Size> : Type extends 'string' | `string${string}` ? string : never; | ||
export type PrimitiveBooleanType<Type extends string> = Type extends `bool[${infer Size}]` ? _TypedArray<boolean, Size> : Type extends 'bool' ? boolean : never; | ||
export type PrimitiveIntegerType<Type extends string> = Type extends `uint${string}[${infer Size}]` | `int${string}[${infer Size}]` ? _TypedArray<Numbers, Size> : Type extends 'uint' | 'int' | `int${string}` | `uint${string}` ? Numbers : never; | ||
export type PrimitiveBytesType<Type extends string> = Type extends `bytes${string}[${infer Size}]` ? _TypedArray<Bytes, Size> : Type extends 'bytes' | `bytes${string}` ? Bytes : never; | ||
export type PrimitiveTupleType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
[Param in TypeComponents[number] as Param['name']]: MatchPrimitiveType<Param['type'], Param['components']>; | ||
@@ -125,18 +125,18 @@ } : Type extends `tuple[${infer Size}]` ? _TypedArray<{ | ||
}, Size> : never : never; | ||
declare type ObjectToArray<T extends unknown[]> = T extends [...infer R, infer A] ? Record<R['length'], A> & ObjectToArray<R> : T; | ||
declare type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export declare type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
declare type ContractMethodOutputParametersRecursiveArray<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
type ObjectToArray<T extends unknown[]> = T extends [...infer R, infer A] ? Record<R['length'], A> & ObjectToArray<R> : T; | ||
type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
type ContractMethodOutputParametersRecursiveArray<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
MatchPrimitiveType<H['type'], H['components']>, | ||
...ContractMethodOutputParametersRecursiveArray<R> | ||
] : [] : []; | ||
declare type ContractMethodOutputParametersRecursiveRecord<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? H['name'] extends '' ? ContractMethodOutputParametersRecursiveRecord<R> : Record<H['name'], MatchPrimitiveType<H['type'], H['components']>> & // sets key-value pair of output param name and type | ||
type ContractMethodOutputParametersRecursiveRecord<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? H['name'] extends '' ? ContractMethodOutputParametersRecursiveRecord<R> : Record<H['name'], MatchPrimitiveType<H['type'], H['components']>> & // sets key-value pair of output param name and type | ||
ContractMethodOutputParametersRecursiveRecord<R> : ContractMethodOutputParametersRecursiveRecord<R> : Params extends undefined | unknown ? [] : Params; | ||
export declare type ContractMethodOutputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? void : Params extends readonly [infer H, ...infer R] ? R extends readonly [] ? H extends AbiParameter ? MatchPrimitiveType<H['type'], H['components']> : [] : // if more than one output | ||
export type ContractMethodOutputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? void : Params extends readonly [infer H, ...infer R] ? R extends readonly [] ? H extends AbiParameter ? MatchPrimitiveType<H['type'], H['components']> : [] : // if more than one output | ||
ArrToObjectWithFunctions<[...ContractMethodOutputParametersRecursiveArray<Params>]> & ContractMethodOutputParametersRecursiveRecord<Params> : []; | ||
export declare type ContractMethodInputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends undefined ? any[] : Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
export type ContractMethodInputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends undefined ? any[] : Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
MatchPrimitiveType<H['type'], H['components']>, | ||
...ContractMethodInputParameters<R> | ||
] : ContractMethodInputParameters<R> : Params extends undefined | unknown ? [] : Params; | ||
export declare type ContractConstructor<Abis extends ContractAbi> = { | ||
export type ContractConstructor<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiConstructorFragment & { | ||
@@ -149,3 +149,3 @@ type: 'constructor'; | ||
}['constructor']; | ||
export declare type ContractConstructorArgs<Abis extends ContractAbi> = FilterAbis<Abis, AbiConstructorFragment & { | ||
export type ContractConstructorArgs<Abis extends ContractAbi> = FilterAbis<Abis, AbiConstructorFragment & { | ||
type: 'constructor'; | ||
@@ -157,3 +157,3 @@ }> extends never ? any : { | ||
}['constructor']; | ||
export declare type ContractMethod<Abi extends AbiFunctionFragment> = { | ||
export type ContractMethod<Abi extends AbiFunctionFragment> = { | ||
readonly Abi: Abi; | ||
@@ -163,3 +163,3 @@ readonly Inputs: ContractMethodInputParameters<Abi['inputs']>; | ||
}; | ||
export declare type ContractMethods<Abis extends ContractAbi> = { | ||
export type ContractMethods<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiFunctionFragment & { | ||
@@ -169,7 +169,7 @@ type: 'function'; | ||
}; | ||
export declare type ContractEvent<Abi extends AbiEventFragment> = { | ||
export type ContractEvent<Abi extends AbiEventFragment> = { | ||
readonly Abi: Abi; | ||
readonly Inputs: ContractMethodInputParameters<Abi['inputs']>; | ||
}; | ||
export declare type ContractEvents<Abis extends ContractAbi> = { | ||
export type ContractEvents<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiEventFragment & { | ||
@@ -176,0 +176,0 @@ type: 'event'; |
@@ -59,3 +59,3 @@ import { Address, Uint } from './eth_types.js'; | ||
} | ||
export declare type ContractAbiWithSignature = ReadonlyArray<AbiFragment & { | ||
export type ContractAbiWithSignature = ReadonlyArray<AbiFragment & { | ||
signature: HexString; | ||
@@ -62,0 +62,0 @@ }>; |
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
export declare type HexString32Bytes = HexString; | ||
export declare type HexString16Bytes = HexString; | ||
export declare type HexString8Bytes = HexString; | ||
export declare type HexStringSingleByte = HexString; | ||
export declare type HexStringBytes = HexString; | ||
export declare type HexString256Bytes = HexString; | ||
export declare type Uint = HexString; | ||
export declare type Uint256 = HexString; | ||
export declare type Address = HexString; | ||
export declare type Topic = HexString32Bytes; | ||
export declare type TransactionHash = HexString; | ||
export declare type Uncles = HexString32Bytes[]; | ||
export type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
export type HexString32Bytes = HexString; | ||
export type HexString16Bytes = HexString; | ||
export type HexString8Bytes = HexString; | ||
export type HexStringSingleByte = HexString; | ||
export type HexStringBytes = HexString; | ||
export type HexString256Bytes = HexString; | ||
export type Uint = HexString; | ||
export type Uint256 = HexString; | ||
export type Address = HexString; | ||
export type Topic = HexString32Bytes; | ||
export type TransactionHash = HexString; | ||
export type Uncles = HexString32Bytes[]; | ||
export declare enum BlockTags { | ||
@@ -23,4 +23,4 @@ EARLIEST = "earliest", | ||
} | ||
export declare type BlockTag = `${BlockTags}`; | ||
export declare type BlockNumberOrTag = Numbers | BlockTag; | ||
export type BlockTag = `${BlockTags}`; | ||
export type BlockNumberOrTag = Numbers | BlockTag; | ||
export interface Proof { | ||
@@ -49,3 +49,3 @@ readonly address: HexString; | ||
} | ||
export declare type TransactionOutput = { | ||
export type TransactionOutput = { | ||
readonly [key: string]: unknown; | ||
@@ -222,4 +222,4 @@ readonly to?: HexString; | ||
} | ||
export declare type Receipt = Record<string, unknown>; | ||
declare type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export type Receipt = Record<string, unknown>; | ||
type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export interface Filter { | ||
@@ -233,3 +233,3 @@ readonly fromBlock?: BlockNumberOrTag; | ||
} | ||
export declare type FilterParams = Omit<Filter, 'blockHash' | 'filter'>; | ||
export type FilterParams = Omit<Filter, 'blockHash' | 'filter'>; | ||
export interface AccessListEntry { | ||
@@ -239,8 +239,8 @@ readonly address?: Address; | ||
} | ||
export declare type AccessList = AccessListEntry[]; | ||
export declare type AccessListResult = { | ||
export type AccessList = AccessListEntry[]; | ||
export type AccessListResult = { | ||
readonly accessList?: AccessList; | ||
readonly gasUsed?: Numbers; | ||
}; | ||
export declare type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export declare enum HardforksOrdered { | ||
@@ -268,3 +268,3 @@ chainstart = "chainstart", | ||
} | ||
export declare type Hardfork = `${HardforksOrdered}`; | ||
export type Hardfork = `${HardforksOrdered}`; | ||
export interface LogBase<NumberType, ByteType> { | ||
@@ -323,3 +323,3 @@ readonly removed?: boolean; | ||
} | ||
export declare type TransactionReceipt = TransactionReceiptBase<Numbers, Bytes, Bytes, Log>; | ||
export type TransactionReceipt = TransactionReceiptBase<Numbers, Bytes, Bytes, Log>; | ||
export interface CustomChain { | ||
@@ -409,3 +409,3 @@ name?: string; | ||
} | ||
export declare type PopulatedUnsignedTransaction = PopulatedUnsignedBaseTransaction | PopulatedUnsignedEip2930Transaction | PopulatedUnsignedEip1559Transaction; | ||
export type PopulatedUnsignedTransaction = PopulatedUnsignedBaseTransaction | PopulatedUnsignedEip2930Transaction | PopulatedUnsignedEip1559Transaction; | ||
export interface BlockBase<ByteType, HexStringType, NumberType, extraDataType, TransactionTypes, logsBloomType> { | ||
@@ -434,3 +434,3 @@ readonly parentHash: ByteType; | ||
} | ||
export declare type Block = BlockBase<Bytes, Bytes, Numbers, Bytes, TransactionHash[] | TransactionInfo[], Bytes>; | ||
export type Block = BlockBase<Bytes, Bytes, Numbers, Bytes, TransactionHash[] | TransactionInfo[], Bytes>; | ||
export interface FeeHistoryBase<NumberType> { | ||
@@ -442,3 +442,3 @@ readonly oldestBlock: NumberType; | ||
} | ||
export declare type FeeHistory = FeeHistoryBase<Numbers>; | ||
export type FeeHistory = FeeHistoryBase<Numbers>; | ||
export interface StorageProof { | ||
@@ -445,0 +445,0 @@ readonly key: Bytes; |
@@ -12,3 +12,3 @@ "use strict"; | ||
BlockTags["COMMITTED"] = "committed"; | ||
})(BlockTags = exports.BlockTags || (exports.BlockTags = {})); | ||
})(BlockTags || (exports.BlockTags = BlockTags = {})); | ||
// This list of hardforks is expected to be in order | ||
@@ -38,3 +38,3 @@ // keep this in mind when making changes to it | ||
HardforksOrdered["shanghai"] = "shanghai"; | ||
})(HardforksOrdered = exports.HardforksOrdered || (exports.HardforksOrdered = {})); | ||
})(HardforksOrdered || (exports.HardforksOrdered = HardforksOrdered = {})); | ||
//# sourceMappingURL=eth_types.js.map |
@@ -1,4 +0,4 @@ | ||
export declare type JsonRpcId = string | number | undefined; | ||
export declare type JsonRpcResult = string | number | boolean | Record<string, unknown>; | ||
export declare type JsonRpcIdentifier = string & ('2.0' | '1.0'); | ||
export type JsonRpcId = string | number | undefined; | ||
export type JsonRpcResult = string | number | boolean | Record<string, unknown>; | ||
export type JsonRpcIdentifier = string & ('2.0' | '1.0'); | ||
export interface JsonRpcError<T = JsonRpcResult> { | ||
@@ -58,5 +58,5 @@ readonly code: number; | ||
} | ||
export declare type JsonRpcBatchRequest = JsonRpcRequest[]; | ||
export declare type JsonRpcPayload<Param = unknown[]> = JsonRpcRequest<Param> | JsonRpcBatchRequest; | ||
export declare type JsonRpcBatchResponse<Result = JsonRpcResult, Error = JsonRpcResult> = (JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result>)[]; | ||
export declare type JsonRpcResponse<Result = JsonRpcResult, Error = JsonRpcResult> = JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result> | JsonRpcBatchResponse<Result, Error> | JsonRpcNotification<Result>; | ||
export type JsonRpcBatchRequest = JsonRpcRequest[]; | ||
export type JsonRpcPayload<Param = unknown[]> = JsonRpcRequest<Param> | JsonRpcBatchRequest; | ||
export type JsonRpcBatchResponse<Result = JsonRpcResult, Error = JsonRpcResult> = (JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result>)[]; | ||
export type JsonRpcResponse<Result = JsonRpcResult, Error = JsonRpcResult> = JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result> | JsonRpcBatchResponse<Result, Error> | JsonRpcNotification<Result>; |
@@ -1,4 +0,4 @@ | ||
export declare type HexString = string; | ||
export declare type Bytes = Uint8Array | HexString; | ||
export declare type Numbers = number | bigint | string | HexString; | ||
export type HexString = string; | ||
export type Bytes = Uint8Array | HexString; | ||
export type Numbers = number | bigint | string | HexString; | ||
export declare const TypedArray: any; |
import { Numbers } from './primitives_types.js'; | ||
export declare type Mutable<T> = { | ||
export type Mutable<T> = { | ||
-readonly [P in keyof T]: T[P]; | ||
}; | ||
export declare type ConnectionEvent = { | ||
export type ConnectionEvent = { | ||
code: number; | ||
@@ -10,23 +10,23 @@ reason: string; | ||
}; | ||
export declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; | ||
export declare type EncodingTypes = Numbers | boolean | Numbers[] | boolean[]; | ||
export declare type TypedObject = { | ||
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; | ||
export type EncodingTypes = Numbers | boolean | Numbers[] | boolean[]; | ||
export type TypedObject = { | ||
type: string; | ||
value: EncodingTypes; | ||
}; | ||
export declare type TypedObjectAbbreviated = { | ||
export type TypedObjectAbbreviated = { | ||
t: string; | ||
v: EncodingTypes; | ||
}; | ||
export declare type Sha3Input = TypedObject | TypedObjectAbbreviated | Numbers | boolean | object; | ||
export declare type IndexKeysForArray<A extends readonly unknown[]> = Exclude<keyof A, keyof []>; | ||
export declare type ArrayToIndexObject<T extends ReadonlyArray<unknown>> = { | ||
export type Sha3Input = TypedObject | TypedObjectAbbreviated | Numbers | boolean | object; | ||
export type IndexKeysForArray<A extends readonly unknown[]> = Exclude<keyof A, keyof []>; | ||
export type ArrayToIndexObject<T extends ReadonlyArray<unknown>> = { | ||
[K in IndexKeysForArray<T>]: T[K]; | ||
}; | ||
declare type _Grow<T, A extends Array<T>> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void ? X : never; | ||
export declare type GrowToSize<T, A extends Array<T>, N extends number> = { | ||
type _Grow<T, A extends Array<T>> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void ? X : never; | ||
export type GrowToSize<T, A extends Array<T>, N extends number> = { | ||
0: A; | ||
1: GrowToSize<T, _Grow<T, A>, N>; | ||
}[A['length'] extends N ? 0 : 1]; | ||
export declare type FixedSizeArray<T, N extends number> = GrowToSize<T, [], N>; | ||
export type FixedSizeArray<T, N extends number> = GrowToSize<T, [], N>; | ||
export {}; |
@@ -20,5 +20,5 @@ import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types.js'; | ||
} | ||
export declare type Web3APISpec = Record<string, (...params: any) => any> | unknown; | ||
export declare type Web3APIMethod<T extends Web3APISpec> = string & keyof Exclude<T, unknown>; | ||
export declare type Web3APIParams<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Exclude<Web3APISpec, unknown> ? Parameters<API[Method]> : unknown; | ||
export type Web3APISpec = Record<string, (...params: any) => any> | unknown; | ||
export type Web3APIMethod<T extends Web3APISpec> = string & keyof Exclude<T, unknown>; | ||
export type Web3APIParams<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Exclude<Web3APISpec, unknown> ? Parameters<API[Method]> : unknown; | ||
export interface Web3APIRequest<API extends Web3APISpec, Method extends Web3APIMethod<API>> { | ||
@@ -33,2 +33,2 @@ method: Method | string; | ||
} | ||
export declare type Web3APIReturnType<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Record<string, (...params: any) => any> ? ReturnType<API[Method]> : any; | ||
export type Web3APIReturnType<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Record<string, (...params: any) => any> ? ReturnType<API[Method]> : any; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Socket } from 'net'; | ||
@@ -14,7 +13,7 @@ import { Web3Error } from './error_types.js'; | ||
} | ||
export declare type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected'; | ||
export declare type Web3ProviderEventCallback<T = JsonRpcResult> = (error: Error | ProviderRpcError | undefined, result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export declare type Web3ProviderMessageEventCallback<T = JsonRpcResult> = (result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export declare type Web3Eip1193ProviderEventCallback<T> = (data: T) => void; | ||
export declare type Web3ProviderRequestCallback<ResultType = unknown> = (err?: Error | Web3Error | null | JsonRpcResponseWithError<Error>, response?: JsonRpcResponseWithResult<ResultType>) => void; | ||
export type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected'; | ||
export type Web3ProviderEventCallback<T = JsonRpcResult> = (error: Error | ProviderRpcError | undefined, result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export type Web3ProviderMessageEventCallback<T = JsonRpcResult> = (result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export type Web3Eip1193ProviderEventCallback<T> = (data: T) => void; | ||
export type Web3ProviderRequestCallback<ResultType = unknown> = (err?: Error | Web3Error | null | JsonRpcResponseWithError<Error>, response?: JsonRpcResponseWithResult<ResultType>) => void; | ||
export interface LegacySendProvider { | ||
@@ -35,5 +34,5 @@ send<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>, callback: (err: Error | null, response?: JsonRpcResponse<R>) => void): void; | ||
} | ||
export declare type ProviderChainId = string; | ||
export declare type ProviderAccounts = string[]; | ||
export declare type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export type ProviderChainId = string; | ||
export type ProviderAccounts = string[]; | ||
export type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export interface EIP1193Provider<API extends Web3APISpec> extends SimpleProvider<API> { | ||
@@ -64,3 +63,3 @@ on(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
} | ||
export declare type Eip1193Compatible<API extends Web3APISpec = EthExecutionAPI> = Omit<Omit<Web3BaseProvider, 'request'>, 'asEIP1193Provider'> & { | ||
export type Eip1193Compatible<API extends Web3APISpec = EthExecutionAPI> = Omit<Omit<Web3BaseProvider, 'request'>, 'asEIP1193Provider'> & { | ||
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method> | unknown>(request: Web3APIPayload<API, Method>): Promise<ResultType>; | ||
@@ -83,3 +82,3 @@ }; | ||
*/ | ||
sendAsync<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>): Promise<JsonRpcResponse<R, JsonRpcResult>>; | ||
sendAsync<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>): Promise<JsonRpcResponse<R>>; | ||
/** | ||
@@ -124,4 +123,4 @@ * Modify the return type of the request method to be fully compatible with EIP-1193 | ||
} | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API> | MetaMaskProvider<API>; | ||
export declare type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API> | MetaMaskProvider<API>; | ||
export type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export {}; |
import { Transaction } from './eth_types.js'; | ||
import { HexString } from './primitives_types.js'; | ||
export declare type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export declare type CipherOptions = { | ||
export type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export type CipherOptions = { | ||
salt?: Uint8Array | string; | ||
@@ -14,3 +14,3 @@ iv?: Uint8Array | string; | ||
}; | ||
export declare type ScryptParams = { | ||
export type ScryptParams = { | ||
dklen: number; | ||
@@ -22,3 +22,3 @@ n: number; | ||
}; | ||
export declare type PBKDF2SHA256Params = { | ||
export type PBKDF2SHA256Params = { | ||
c: number; | ||
@@ -29,3 +29,3 @@ dklen: number; | ||
}; | ||
export declare type KeyStore = { | ||
export type KeyStore = { | ||
crypto: { | ||
@@ -45,2 +45,16 @@ cipher: Cipher; | ||
}; | ||
export type SignatureObject = { | ||
messageHash: string; | ||
r: string; | ||
s: string; | ||
v: string; | ||
}; | ||
export type SignTransactionResult = SignatureObject & { | ||
rawTransaction: string; | ||
transactionHash: string; | ||
}; | ||
export type SignResult = SignatureObject & { | ||
message?: string; | ||
signature: string; | ||
}; | ||
export interface Web3BaseWalletAccount { | ||
@@ -50,18 +64,4 @@ [key: string]: unknown; | ||
readonly privateKey: string; | ||
readonly signTransaction: (tx: Transaction) => Promise<{ | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly rawTransaction: HexString; | ||
readonly transactionHash: HexString; | ||
}>; | ||
readonly sign: (data: Record<string, unknown> | string) => { | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly message?: string; | ||
readonly signature: HexString; | ||
}; | ||
readonly signTransaction: (tx: Transaction) => Promise<SignTransactionResult>; | ||
readonly sign: (data: Record<string, unknown> | string) => SignResult; | ||
readonly encrypt: (password: string, options?: Record<string, unknown>) => Promise<KeyStore>; | ||
@@ -68,0 +68,0 @@ } |
@@ -61,5 +61,5 @@ import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types.js'; | ||
} | ||
export declare type TransactionUnsignedAPI = Transaction1559UnsignedAPI | Transaction2930UnsignedAPI | TransactionLegacyUnsignedAPI; | ||
export declare type TransactionSignedAPI = Transaction1559SignedAPI | Transaction2930SignedAPI | TransactionLegacySignedAPI; | ||
export declare type TransactionInfoAPI = TransactionSignedAPI & { | ||
export type TransactionUnsignedAPI = Transaction1559UnsignedAPI | Transaction2930UnsignedAPI | TransactionLegacyUnsignedAPI; | ||
export type TransactionSignedAPI = Transaction1559SignedAPI | Transaction2930SignedAPI | TransactionLegacySignedAPI; | ||
export type TransactionInfoAPI = TransactionSignedAPI & { | ||
readonly blockHash?: HexString32Bytes; | ||
@@ -75,9 +75,9 @@ readonly blockNumber?: Uint; | ||
} | ||
export declare type TransactionWithSenderAPI = TransactionUnsignedAPI & { | ||
export type TransactionWithSenderAPI = TransactionUnsignedAPI & { | ||
from: Address; | ||
}; | ||
export declare type BlockAPI = BlockBase<HexString32Bytes, HexString, Uint, HexStringBytes, TransactionHash[] | TransactionInfoAPI[], HexString256Bytes>; | ||
export declare type LogAPI = LogBase<Uint, HexString32Bytes>; | ||
export declare type TransactionReceiptAPI = TransactionReceiptBase<Uint, HexString32Bytes, HexString256Bytes, LogAPI>; | ||
export declare type SyncingStatusAPI = { | ||
export type BlockAPI = BlockBase<HexString32Bytes, HexString, Uint, HexStringBytes, TransactionHash[] | TransactionInfoAPI[], HexString256Bytes>; | ||
export type LogAPI = LogBase<Uint, HexString32Bytes>; | ||
export type TransactionReceiptAPI = TransactionReceiptBase<Uint, HexString32Bytes, HexString256Bytes, LogAPI>; | ||
export type SyncingStatusAPI = { | ||
startingBlock: Uint; | ||
@@ -87,4 +87,4 @@ currentBlock: Uint; | ||
} | boolean; | ||
export declare type FeeHistoryResultAPI = FeeHistoryBase<Uint>; | ||
export declare type FilterResultsAPI = HexString32Bytes[] | LogAPI[]; | ||
export type FeeHistoryResultAPI = FeeHistoryBase<Uint>; | ||
export type FilterResultsAPI = HexString32Bytes[] | LogAPI[]; | ||
export interface CompileResultAPI { | ||
@@ -106,3 +106,3 @@ readonly code: HexStringBytes; | ||
} | ||
export declare type EthExecutionAPI = { | ||
export type EthExecutionAPI = { | ||
eth_getBlockByHash: (blockHash: HexString32Bytes, hydrated: boolean) => BlockAPI; | ||
@@ -109,0 +109,0 @@ eth_getBlockByNumber: (blockNumber: BlockNumberOrTag, hydrated: boolean) => BlockAPI; |
import { Address, Transaction } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type EthPersonalAPI = { | ||
export type EthPersonalAPI = { | ||
personal_listAccounts: () => Address[]; | ||
@@ -5,0 +5,0 @@ personal_newAccount: (password: string) => Address; |
import { EthExecutionAPI } from './eth_execution_api.js'; | ||
import { AccountObject, Address, BlockNumberOrTag, Eip712TypedData, HexString256Bytes, HexString32Bytes, TransactionInfo, Uint } from '../eth_types.js'; | ||
export declare type Web3EthExecutionAPI = EthExecutionAPI & { | ||
export type Web3EthExecutionAPI = EthExecutionAPI & { | ||
eth_pendingTransactions: () => TransactionInfo[]; | ||
@@ -5,0 +5,0 @@ eth_requestAccounts: () => Address[]; |
import { HexString } from '../primitives_types.js'; | ||
export declare type Web3NetAPI = { | ||
export type Web3NetAPI = { | ||
net_version: () => string; | ||
@@ -4,0 +4,0 @@ net_peerCount: () => HexString; |
@@ -8,3 +8,3 @@ import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
} | ||
export declare type NumberTypes = { | ||
export type NumberTypes = { | ||
[FMT_NUMBER.NUMBER]: number; | ||
@@ -19,3 +19,3 @@ [FMT_NUMBER.HEX]: HexString; | ||
} | ||
export declare type ByteTypes = { | ||
export type ByteTypes = { | ||
[FMT_BYTES.HEX]: HexString; | ||
@@ -29,3 +29,3 @@ [FMT_BYTES.UINT8ARRAY]: Uint8Array; | ||
*/ | ||
export declare type DataFormat = { | ||
export type DataFormat = { | ||
readonly number: FMT_NUMBER; | ||
@@ -42,5 +42,5 @@ readonly bytes: FMT_BYTES; | ||
}; | ||
export declare type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Uint8Array extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
export type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Uint8Array extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
[P in keyof T]: FormatType<T[P], F>; | ||
} : T; | ||
//# sourceMappingURL=data_format_types.d.ts.map |
@@ -6,3 +6,3 @@ export interface Web3Error extends Error { | ||
} | ||
export declare type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
export type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
keyword: K; | ||
@@ -9,0 +9,0 @@ instancePath: string; |
import { Address } from './eth_types.js'; | ||
import { Bytes, Numbers } from './primitives_types.js'; | ||
import { FixedSizeArray } from './utility_types.js'; | ||
declare type _SolidityIndexRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30; | ||
export declare type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
export declare type Components = { | ||
type _SolidityIndexRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30; | ||
export type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
export type Components = { | ||
name: string; | ||
@@ -21,3 +21,3 @@ type: string; | ||
} | ||
export declare type AbiParameter = { | ||
export type AbiParameter = { | ||
readonly name: string; | ||
@@ -32,7 +32,7 @@ readonly type: string; | ||
}; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export declare type AbiBaseFragment = { | ||
type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export type AbiBaseFragment = { | ||
readonly type: string | FragmentTypes; | ||
}; | ||
export declare type AbiConstructorFragment = AbiBaseFragment & { | ||
export type AbiConstructorFragment = AbiBaseFragment & { | ||
readonly type: string | 'constructor'; | ||
@@ -42,3 +42,3 @@ readonly stateMutability: string | 'nonpayable' | 'payable'; | ||
}; | ||
export declare type AbiFunctionFragment = AbiBaseFragment & { | ||
export type AbiFunctionFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -54,3 +54,3 @@ readonly type: string | 'function'; | ||
}; | ||
export declare type AbiFallbackFragment = AbiBaseFragment & { | ||
export type AbiFallbackFragment = AbiBaseFragment & { | ||
readonly name: never; | ||
@@ -64,3 +64,3 @@ readonly type: string | 'fallback'; | ||
}; | ||
export declare type AbiEventFragment = AbiBaseFragment & { | ||
export type AbiEventFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -71,3 +71,3 @@ readonly type: string | 'event'; | ||
}; | ||
export declare type AbiErrorFragment = AbiBaseFragment & { | ||
export type AbiErrorFragment = AbiBaseFragment & { | ||
readonly name: string; | ||
@@ -77,3 +77,3 @@ readonly type: string | 'error'; | ||
}; | ||
export declare type AbiInput = string | AbiParameter | { | ||
export type AbiInput = string | AbiParameter | { | ||
name: string; | ||
@@ -93,6 +93,6 @@ type: string; | ||
} | ||
export declare type AbiFragment = AbiConstructorFragment | AbiFunctionFragment | AbiEventFragment | AbiErrorFragment | AbiFallbackFragment; | ||
export declare type AbiItem = AbiFragment; | ||
export declare type ContractAbi = ReadonlyArray<AbiFragment> | ReadonlyArray<AbiItem>; | ||
export declare type JsonFunctionInterface = { | ||
export type AbiFragment = AbiConstructorFragment | AbiFunctionFragment | AbiEventFragment | AbiErrorFragment | AbiFallbackFragment; | ||
export type AbiItem = AbiFragment; | ||
export type ContractAbi = ReadonlyArray<AbiFragment> | ReadonlyArray<AbiItem>; | ||
export type JsonFunctionInterface = { | ||
type: 'function'; | ||
@@ -104,3 +104,3 @@ name: string; | ||
}; | ||
export declare type JsonEventInterface = { | ||
export type JsonEventInterface = { | ||
type: 'event'; | ||
@@ -112,10 +112,10 @@ name: string; | ||
}; | ||
export declare type FilterAbis<Abis extends ContractAbi, Filter, Abi = Abis[number]> = Abi extends Filter ? Abi : never; | ||
declare type _TypedArray<Type, Size extends string> = Size extends '' ? Type[] : FixedSizeArray<Type, ConvertToNumber<Size>>; | ||
export declare type PrimitiveAddressType<Type extends string> = Type extends `address[${infer Size}]` ? _TypedArray<Address, Size> : Type extends 'address' ? Address : never; | ||
export declare type PrimitiveStringType<Type extends string> = Type extends `string${string}[${infer Size}]` ? _TypedArray<string, Size> : Type extends 'string' | `string${string}` ? string : never; | ||
export declare type PrimitiveBooleanType<Type extends string> = Type extends `bool[${infer Size}]` ? _TypedArray<boolean, Size> : Type extends 'bool' ? boolean : never; | ||
export declare type PrimitiveIntegerType<Type extends string> = Type extends `uint${string}[${infer Size}]` | `int${string}[${infer Size}]` ? _TypedArray<Numbers, Size> : Type extends 'uint' | 'int' | `int${string}` | `uint${string}` ? Numbers : never; | ||
export declare type PrimitiveBytesType<Type extends string> = Type extends `bytes${string}[${infer Size}]` ? _TypedArray<Bytes, Size> : Type extends 'bytes' | `bytes${string}` ? Bytes : never; | ||
export declare type PrimitiveTupleType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
export type FilterAbis<Abis extends ContractAbi, Filter, Abi = Abis[number]> = Abi extends Filter ? Abi : never; | ||
type _TypedArray<Type, Size extends string> = Size extends '' ? Type[] : FixedSizeArray<Type, ConvertToNumber<Size>>; | ||
export type PrimitiveAddressType<Type extends string> = Type extends `address[${infer Size}]` ? _TypedArray<Address, Size> : Type extends 'address' ? Address : never; | ||
export type PrimitiveStringType<Type extends string> = Type extends `string${string}[${infer Size}]` ? _TypedArray<string, Size> : Type extends 'string' | `string${string}` ? string : never; | ||
export type PrimitiveBooleanType<Type extends string> = Type extends `bool[${infer Size}]` ? _TypedArray<boolean, Size> : Type extends 'bool' ? boolean : never; | ||
export type PrimitiveIntegerType<Type extends string> = Type extends `uint${string}[${infer Size}]` | `int${string}[${infer Size}]` ? _TypedArray<Numbers, Size> : Type extends 'uint' | 'int' | `int${string}` | `uint${string}` ? Numbers : never; | ||
export type PrimitiveBytesType<Type extends string> = Type extends `bytes${string}[${infer Size}]` ? _TypedArray<Bytes, Size> : Type extends 'bytes' | `bytes${string}` ? Bytes : never; | ||
export type PrimitiveTupleType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
[Param in TypeComponents[number] as Param['name']]: MatchPrimitiveType<Param['type'], Param['components']>; | ||
@@ -125,18 +125,18 @@ } : Type extends `tuple[${infer Size}]` ? _TypedArray<{ | ||
}, Size> : never : never; | ||
declare type ObjectToArray<T extends unknown[]> = T extends [...infer R, infer A] ? Record<R['length'], A> & ObjectToArray<R> : T; | ||
declare type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export declare type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
declare type ContractMethodOutputParametersRecursiveArray<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
type ObjectToArray<T extends unknown[]> = T extends [...infer R, infer A] ? Record<R['length'], A> & ObjectToArray<R> : T; | ||
type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
type ContractMethodOutputParametersRecursiveArray<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
MatchPrimitiveType<H['type'], H['components']>, | ||
...ContractMethodOutputParametersRecursiveArray<R> | ||
] : [] : []; | ||
declare type ContractMethodOutputParametersRecursiveRecord<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? H['name'] extends '' ? ContractMethodOutputParametersRecursiveRecord<R> : Record<H['name'], MatchPrimitiveType<H['type'], H['components']>> & // sets key-value pair of output param name and type | ||
type ContractMethodOutputParametersRecursiveRecord<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? H['name'] extends '' ? ContractMethodOutputParametersRecursiveRecord<R> : Record<H['name'], MatchPrimitiveType<H['type'], H['components']>> & // sets key-value pair of output param name and type | ||
ContractMethodOutputParametersRecursiveRecord<R> : ContractMethodOutputParametersRecursiveRecord<R> : Params extends undefined | unknown ? [] : Params; | ||
export declare type ContractMethodOutputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? void : Params extends readonly [infer H, ...infer R] ? R extends readonly [] ? H extends AbiParameter ? MatchPrimitiveType<H['type'], H['components']> : [] : // if more than one output | ||
export type ContractMethodOutputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends readonly [] ? void : Params extends readonly [infer H, ...infer R] ? R extends readonly [] ? H extends AbiParameter ? MatchPrimitiveType<H['type'], H['components']> : [] : // if more than one output | ||
ArrToObjectWithFunctions<[...ContractMethodOutputParametersRecursiveArray<Params>]> & ContractMethodOutputParametersRecursiveRecord<Params> : []; | ||
export declare type ContractMethodInputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends undefined ? any[] : Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
export type ContractMethodInputParameters<Params extends ReadonlyArray<unknown> | undefined> = Params extends undefined ? any[] : Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [ | ||
MatchPrimitiveType<H['type'], H['components']>, | ||
...ContractMethodInputParameters<R> | ||
] : ContractMethodInputParameters<R> : Params extends undefined | unknown ? [] : Params; | ||
export declare type ContractConstructor<Abis extends ContractAbi> = { | ||
export type ContractConstructor<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiConstructorFragment & { | ||
@@ -149,3 +149,3 @@ type: 'constructor'; | ||
}['constructor']; | ||
export declare type ContractConstructorArgs<Abis extends ContractAbi> = FilterAbis<Abis, AbiConstructorFragment & { | ||
export type ContractConstructorArgs<Abis extends ContractAbi> = FilterAbis<Abis, AbiConstructorFragment & { | ||
type: 'constructor'; | ||
@@ -157,3 +157,3 @@ }> extends never ? any : { | ||
}['constructor']; | ||
export declare type ContractMethod<Abi extends AbiFunctionFragment> = { | ||
export type ContractMethod<Abi extends AbiFunctionFragment> = { | ||
readonly Abi: Abi; | ||
@@ -163,3 +163,3 @@ readonly Inputs: ContractMethodInputParameters<Abi['inputs']>; | ||
}; | ||
export declare type ContractMethods<Abis extends ContractAbi> = { | ||
export type ContractMethods<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiFunctionFragment & { | ||
@@ -169,7 +169,7 @@ type: 'function'; | ||
}; | ||
export declare type ContractEvent<Abi extends AbiEventFragment> = { | ||
export type ContractEvent<Abi extends AbiEventFragment> = { | ||
readonly Abi: Abi; | ||
readonly Inputs: ContractMethodInputParameters<Abi['inputs']>; | ||
}; | ||
export declare type ContractEvents<Abis extends ContractAbi> = { | ||
export type ContractEvents<Abis extends ContractAbi> = { | ||
[Abi in FilterAbis<Abis, AbiEventFragment & { | ||
@@ -176,0 +176,0 @@ type: 'event'; |
@@ -59,3 +59,3 @@ import { Address, Uint } from './eth_types.js'; | ||
} | ||
export declare type ContractAbiWithSignature = ReadonlyArray<AbiFragment & { | ||
export type ContractAbiWithSignature = ReadonlyArray<AbiFragment & { | ||
signature: HexString; | ||
@@ -62,0 +62,0 @@ }>; |
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
export declare type HexString32Bytes = HexString; | ||
export declare type HexString16Bytes = HexString; | ||
export declare type HexString8Bytes = HexString; | ||
export declare type HexStringSingleByte = HexString; | ||
export declare type HexStringBytes = HexString; | ||
export declare type HexString256Bytes = HexString; | ||
export declare type Uint = HexString; | ||
export declare type Uint256 = HexString; | ||
export declare type Address = HexString; | ||
export declare type Topic = HexString32Bytes; | ||
export declare type TransactionHash = HexString; | ||
export declare type Uncles = HexString32Bytes[]; | ||
export type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
export type HexString32Bytes = HexString; | ||
export type HexString16Bytes = HexString; | ||
export type HexString8Bytes = HexString; | ||
export type HexStringSingleByte = HexString; | ||
export type HexStringBytes = HexString; | ||
export type HexString256Bytes = HexString; | ||
export type Uint = HexString; | ||
export type Uint256 = HexString; | ||
export type Address = HexString; | ||
export type Topic = HexString32Bytes; | ||
export type TransactionHash = HexString; | ||
export type Uncles = HexString32Bytes[]; | ||
export declare enum BlockTags { | ||
@@ -23,4 +23,4 @@ EARLIEST = "earliest", | ||
} | ||
export declare type BlockTag = `${BlockTags}`; | ||
export declare type BlockNumberOrTag = Numbers | BlockTag; | ||
export type BlockTag = `${BlockTags}`; | ||
export type BlockNumberOrTag = Numbers | BlockTag; | ||
export interface Proof { | ||
@@ -49,3 +49,3 @@ readonly address: HexString; | ||
} | ||
export declare type TransactionOutput = { | ||
export type TransactionOutput = { | ||
readonly [key: string]: unknown; | ||
@@ -222,4 +222,4 @@ readonly to?: HexString; | ||
} | ||
export declare type Receipt = Record<string, unknown>; | ||
declare type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export type Receipt = Record<string, unknown>; | ||
type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export interface Filter { | ||
@@ -233,3 +233,3 @@ readonly fromBlock?: BlockNumberOrTag; | ||
} | ||
export declare type FilterParams = Omit<Filter, 'blockHash' | 'filter'>; | ||
export type FilterParams = Omit<Filter, 'blockHash' | 'filter'>; | ||
export interface AccessListEntry { | ||
@@ -239,8 +239,8 @@ readonly address?: Address; | ||
} | ||
export declare type AccessList = AccessListEntry[]; | ||
export declare type AccessListResult = { | ||
export type AccessList = AccessListEntry[]; | ||
export type AccessListResult = { | ||
readonly accessList?: AccessList; | ||
readonly gasUsed?: Numbers; | ||
}; | ||
export declare type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export declare enum HardforksOrdered { | ||
@@ -268,3 +268,3 @@ chainstart = "chainstart", | ||
} | ||
export declare type Hardfork = `${HardforksOrdered}`; | ||
export type Hardfork = `${HardforksOrdered}`; | ||
export interface LogBase<NumberType, ByteType> { | ||
@@ -323,3 +323,3 @@ readonly removed?: boolean; | ||
} | ||
export declare type TransactionReceipt = TransactionReceiptBase<Numbers, Bytes, Bytes, Log>; | ||
export type TransactionReceipt = TransactionReceiptBase<Numbers, Bytes, Bytes, Log>; | ||
export interface CustomChain { | ||
@@ -409,3 +409,3 @@ name?: string; | ||
} | ||
export declare type PopulatedUnsignedTransaction = PopulatedUnsignedBaseTransaction | PopulatedUnsignedEip2930Transaction | PopulatedUnsignedEip1559Transaction; | ||
export type PopulatedUnsignedTransaction = PopulatedUnsignedBaseTransaction | PopulatedUnsignedEip2930Transaction | PopulatedUnsignedEip1559Transaction; | ||
export interface BlockBase<ByteType, HexStringType, NumberType, extraDataType, TransactionTypes, logsBloomType> { | ||
@@ -434,3 +434,3 @@ readonly parentHash: ByteType; | ||
} | ||
export declare type Block = BlockBase<Bytes, Bytes, Numbers, Bytes, TransactionHash[] | TransactionInfo[], Bytes>; | ||
export type Block = BlockBase<Bytes, Bytes, Numbers, Bytes, TransactionHash[] | TransactionInfo[], Bytes>; | ||
export interface FeeHistoryBase<NumberType> { | ||
@@ -442,3 +442,3 @@ readonly oldestBlock: NumberType; | ||
} | ||
export declare type FeeHistory = FeeHistoryBase<Numbers>; | ||
export type FeeHistory = FeeHistoryBase<Numbers>; | ||
export interface StorageProof { | ||
@@ -445,0 +445,0 @@ readonly key: Bytes; |
@@ -1,4 +0,4 @@ | ||
export declare type JsonRpcId = string | number | undefined; | ||
export declare type JsonRpcResult = string | number | boolean | Record<string, unknown>; | ||
export declare type JsonRpcIdentifier = string & ('2.0' | '1.0'); | ||
export type JsonRpcId = string | number | undefined; | ||
export type JsonRpcResult = string | number | boolean | Record<string, unknown>; | ||
export type JsonRpcIdentifier = string & ('2.0' | '1.0'); | ||
export interface JsonRpcError<T = JsonRpcResult> { | ||
@@ -58,6 +58,6 @@ readonly code: number; | ||
} | ||
export declare type JsonRpcBatchRequest = JsonRpcRequest[]; | ||
export declare type JsonRpcPayload<Param = unknown[]> = JsonRpcRequest<Param> | JsonRpcBatchRequest; | ||
export declare type JsonRpcBatchResponse<Result = JsonRpcResult, Error = JsonRpcResult> = (JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result>)[]; | ||
export declare type JsonRpcResponse<Result = JsonRpcResult, Error = JsonRpcResult> = JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result> | JsonRpcBatchResponse<Result, Error> | JsonRpcNotification<Result>; | ||
export type JsonRpcBatchRequest = JsonRpcRequest[]; | ||
export type JsonRpcPayload<Param = unknown[]> = JsonRpcRequest<Param> | JsonRpcBatchRequest; | ||
export type JsonRpcBatchResponse<Result = JsonRpcResult, Error = JsonRpcResult> = (JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result>)[]; | ||
export type JsonRpcResponse<Result = JsonRpcResult, Error = JsonRpcResult> = JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result> | JsonRpcBatchResponse<Result, Error> | JsonRpcNotification<Result>; | ||
//# sourceMappingURL=json_rpc_types.d.ts.map |
@@ -1,5 +0,5 @@ | ||
export declare type HexString = string; | ||
export declare type Bytes = Uint8Array | HexString; | ||
export declare type Numbers = number | bigint | string | HexString; | ||
export type HexString = string; | ||
export type Bytes = Uint8Array | HexString; | ||
export type Numbers = number | bigint | string | HexString; | ||
export declare const TypedArray: any; | ||
//# sourceMappingURL=primitives_types.d.ts.map |
import { Numbers } from './primitives_types.js'; | ||
export declare type Mutable<T> = { | ||
export type Mutable<T> = { | ||
-readonly [P in keyof T]: T[P]; | ||
}; | ||
export declare type ConnectionEvent = { | ||
export type ConnectionEvent = { | ||
code: number; | ||
@@ -10,24 +10,24 @@ reason: string; | ||
}; | ||
export declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; | ||
export declare type EncodingTypes = Numbers | boolean | Numbers[] | boolean[]; | ||
export declare type TypedObject = { | ||
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; | ||
export type EncodingTypes = Numbers | boolean | Numbers[] | boolean[]; | ||
export type TypedObject = { | ||
type: string; | ||
value: EncodingTypes; | ||
}; | ||
export declare type TypedObjectAbbreviated = { | ||
export type TypedObjectAbbreviated = { | ||
t: string; | ||
v: EncodingTypes; | ||
}; | ||
export declare type Sha3Input = TypedObject | TypedObjectAbbreviated | Numbers | boolean | object; | ||
export declare type IndexKeysForArray<A extends readonly unknown[]> = Exclude<keyof A, keyof []>; | ||
export declare type ArrayToIndexObject<T extends ReadonlyArray<unknown>> = { | ||
export type Sha3Input = TypedObject | TypedObjectAbbreviated | Numbers | boolean | object; | ||
export type IndexKeysForArray<A extends readonly unknown[]> = Exclude<keyof A, keyof []>; | ||
export type ArrayToIndexObject<T extends ReadonlyArray<unknown>> = { | ||
[K in IndexKeysForArray<T>]: T[K]; | ||
}; | ||
declare type _Grow<T, A extends Array<T>> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void ? X : never; | ||
export declare type GrowToSize<T, A extends Array<T>, N extends number> = { | ||
type _Grow<T, A extends Array<T>> = ((x: T, ...xs: A) => void) extends (...a: infer X) => void ? X : never; | ||
export type GrowToSize<T, A extends Array<T>, N extends number> = { | ||
0: A; | ||
1: GrowToSize<T, _Grow<T, A>, N>; | ||
}[A['length'] extends N ? 0 : 1]; | ||
export declare type FixedSizeArray<T, N extends number> = GrowToSize<T, [], N>; | ||
export type FixedSizeArray<T, N extends number> = GrowToSize<T, [], N>; | ||
export {}; | ||
//# sourceMappingURL=utility_types.d.ts.map |
@@ -20,5 +20,5 @@ import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types.js'; | ||
} | ||
export declare type Web3APISpec = Record<string, (...params: any) => any> | unknown; | ||
export declare type Web3APIMethod<T extends Web3APISpec> = string & keyof Exclude<T, unknown>; | ||
export declare type Web3APIParams<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Exclude<Web3APISpec, unknown> ? Parameters<API[Method]> : unknown; | ||
export type Web3APISpec = Record<string, (...params: any) => any> | unknown; | ||
export type Web3APIMethod<T extends Web3APISpec> = string & keyof Exclude<T, unknown>; | ||
export type Web3APIParams<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Exclude<Web3APISpec, unknown> ? Parameters<API[Method]> : unknown; | ||
export interface Web3APIRequest<API extends Web3APISpec, Method extends Web3APIMethod<API>> { | ||
@@ -33,3 +33,3 @@ method: Method | string; | ||
} | ||
export declare type Web3APIReturnType<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Record<string, (...params: any) => any> ? ReturnType<API[Method]> : any; | ||
export type Web3APIReturnType<API extends Web3APISpec, Method extends Web3APIMethod<API>> = API extends Record<string, (...params: any) => any> ? ReturnType<API[Method]> : any; | ||
//# sourceMappingURL=web3_api_types.d.ts.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Socket } from 'net'; | ||
@@ -14,7 +13,7 @@ import { Web3Error } from './error_types.js'; | ||
} | ||
export declare type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected'; | ||
export declare type Web3ProviderEventCallback<T = JsonRpcResult> = (error: Error | ProviderRpcError | undefined, result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export declare type Web3ProviderMessageEventCallback<T = JsonRpcResult> = (result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export declare type Web3Eip1193ProviderEventCallback<T> = (data: T) => void; | ||
export declare type Web3ProviderRequestCallback<ResultType = unknown> = (err?: Error | Web3Error | null | JsonRpcResponseWithError<Error>, response?: JsonRpcResponseWithResult<ResultType>) => void; | ||
export type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected'; | ||
export type Web3ProviderEventCallback<T = JsonRpcResult> = (error: Error | ProviderRpcError | undefined, result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export type Web3ProviderMessageEventCallback<T = JsonRpcResult> = (result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void; | ||
export type Web3Eip1193ProviderEventCallback<T> = (data: T) => void; | ||
export type Web3ProviderRequestCallback<ResultType = unknown> = (err?: Error | Web3Error | null | JsonRpcResponseWithError<Error>, response?: JsonRpcResponseWithResult<ResultType>) => void; | ||
export interface LegacySendProvider { | ||
@@ -35,5 +34,5 @@ send<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>, callback: (err: Error | null, response?: JsonRpcResponse<R>) => void): void; | ||
} | ||
export declare type ProviderChainId = string; | ||
export declare type ProviderAccounts = string[]; | ||
export declare type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export type ProviderChainId = string; | ||
export type ProviderAccounts = string[]; | ||
export type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export interface EIP1193Provider<API extends Web3APISpec> extends SimpleProvider<API> { | ||
@@ -64,3 +63,3 @@ on(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
} | ||
export declare type Eip1193Compatible<API extends Web3APISpec = EthExecutionAPI> = Omit<Omit<Web3BaseProvider, 'request'>, 'asEIP1193Provider'> & { | ||
export type Eip1193Compatible<API extends Web3APISpec = EthExecutionAPI> = Omit<Omit<Web3BaseProvider, 'request'>, 'asEIP1193Provider'> & { | ||
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method> | unknown>(request: Web3APIPayload<API, Method>): Promise<ResultType>; | ||
@@ -83,3 +82,3 @@ }; | ||
*/ | ||
sendAsync<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>): Promise<JsonRpcResponse<R, JsonRpcResult>>; | ||
sendAsync<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>): Promise<JsonRpcResponse<R>>; | ||
/** | ||
@@ -124,5 +123,5 @@ * Modify the return type of the request method to be fully compatible with EIP-1193 | ||
} | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API> | MetaMaskProvider<API>; | ||
export declare type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API> | MetaMaskProvider<API>; | ||
export type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export {}; | ||
//# sourceMappingURL=web3_base_provider.d.ts.map |
import { Transaction } from './eth_types.js'; | ||
import { HexString } from './primitives_types.js'; | ||
export declare type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export declare type CipherOptions = { | ||
export type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export type CipherOptions = { | ||
salt?: Uint8Array | string; | ||
@@ -14,3 +14,3 @@ iv?: Uint8Array | string; | ||
}; | ||
export declare type ScryptParams = { | ||
export type ScryptParams = { | ||
dklen: number; | ||
@@ -22,3 +22,3 @@ n: number; | ||
}; | ||
export declare type PBKDF2SHA256Params = { | ||
export type PBKDF2SHA256Params = { | ||
c: number; | ||
@@ -29,3 +29,3 @@ dklen: number; | ||
}; | ||
export declare type KeyStore = { | ||
export type KeyStore = { | ||
crypto: { | ||
@@ -45,2 +45,16 @@ cipher: Cipher; | ||
}; | ||
export type SignatureObject = { | ||
messageHash: string; | ||
r: string; | ||
s: string; | ||
v: string; | ||
}; | ||
export type SignTransactionResult = SignatureObject & { | ||
rawTransaction: string; | ||
transactionHash: string; | ||
}; | ||
export type SignResult = SignatureObject & { | ||
message?: string; | ||
signature: string; | ||
}; | ||
export interface Web3BaseWalletAccount { | ||
@@ -50,18 +64,4 @@ [key: string]: unknown; | ||
readonly privateKey: string; | ||
readonly signTransaction: (tx: Transaction) => Promise<{ | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly rawTransaction: HexString; | ||
readonly transactionHash: HexString; | ||
}>; | ||
readonly sign: (data: Record<string, unknown> | string) => { | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly message?: string; | ||
readonly signature: HexString; | ||
}; | ||
readonly signTransaction: (tx: Transaction) => Promise<SignTransactionResult>; | ||
readonly sign: (data: Record<string, unknown> | string) => SignResult; | ||
readonly encrypt: (password: string, options?: Record<string, unknown>) => Promise<KeyStore>; | ||
@@ -68,0 +68,0 @@ } |
{ | ||
"name": "web3-types", | ||
"version": "1.9.1-dev.098ee6d.0+098ee6d", | ||
"version": "1.9.1-dev.0cbc23d.0+0cbc23d", | ||
"description": "Provide the common data structures and interfaces for web3 modules.", | ||
@@ -57,5 +57,5 @@ "main": "./lib/commonjs/index.js", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^4.7.4" | ||
"typescript": "^5.5.4" | ||
}, | ||
"gitHead": "098ee6d30f76082f9cfef16cb256d3f1682ee956" | ||
"gitHead": "0cbc23d25e811cfb30add0bca85e41cc095e8f95" | ||
} |
@@ -18,2 +18,3 @@ /* | ||
// TODO: consider using `0x${string}` instead of `string` for HexString | ||
export type HexString = string; | ||
@@ -20,0 +21,0 @@ export type Bytes = Uint8Array | HexString; |
@@ -63,2 +63,19 @@ /* | ||
export type SignatureObject = { | ||
messageHash: string; | ||
r: string; | ||
s: string; | ||
v: string; | ||
}; | ||
export type SignTransactionResult = SignatureObject & { | ||
rawTransaction: string; | ||
transactionHash: string; | ||
}; | ||
export type SignResult = SignatureObject & { | ||
message?: string; | ||
signature: string; | ||
}; | ||
export interface Web3BaseWalletAccount { | ||
@@ -68,18 +85,4 @@ [key: string]: unknown; | ||
readonly privateKey: string; | ||
readonly signTransaction: (tx: Transaction) => Promise<{ | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly rawTransaction: HexString; | ||
readonly transactionHash: HexString; | ||
}>; | ||
readonly sign: (data: Record<string, unknown> | string) => { | ||
readonly messageHash: HexString; | ||
readonly r: HexString; | ||
readonly s: HexString; | ||
readonly v: HexString; | ||
readonly message?: string; | ||
readonly signature: HexString; | ||
}; | ||
readonly signTransaction: (tx: Transaction) => Promise<SignTransactionResult>; | ||
readonly sign: (data: Record<string, unknown> | string) => SignResult; | ||
readonly encrypt: (password: string, options?: Record<string, unknown>) => Promise<KeyStore>; | ||
@@ -86,0 +89,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
143
300208
5571