web3-types
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
@@ -1,3 +0,3 @@ | ||
import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export interface TransactionCallAPI { | ||
@@ -4,0 +4,0 @@ readonly from?: Address; |
@@ -1,3 +0,3 @@ | ||
import { Address, Transaction } from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
import { Address, Transaction } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type EthPersonalAPI = { | ||
@@ -4,0 +4,0 @@ personal_listAccounts: () => Address[]; |
@@ -1,3 +0,3 @@ | ||
import { EthExecutionAPI } from './eth_execution_api'; | ||
import { AccountObject, Address, BlockNumberOrTag, HexString32Bytes, TransactionInfo, Uint } from '../eth_types'; | ||
import { EthExecutionAPI } from './eth_execution_api.js'; | ||
import { AccountObject, Address, BlockNumberOrTag, HexString32Bytes, TransactionInfo, Uint } from '../eth_types.js'; | ||
export declare type Web3EthExecutionAPI = EthExecutionAPI & { | ||
@@ -4,0 +4,0 @@ eth_pendingTransactions: () => TransactionInfo[]; |
@@ -1,2 +0,2 @@ | ||
import { HexString } from '../primitives_types'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type Web3NetAPI = { | ||
@@ -3,0 +3,0 @@ net_version: () => string; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare enum FMT_NUMBER { | ||
@@ -17,3 +16,2 @@ NUMBER = "NUMBER_NUMBER", | ||
HEX = "BYTES_HEX", | ||
BUFFER = "BYTES_BUFFER", | ||
UINT8ARRAY = "BYTES_UINT8ARRAY" | ||
@@ -23,3 +21,2 @@ } | ||
[FMT_BYTES.HEX]: HexString; | ||
[FMT_BYTES.BUFFER]: Buffer; | ||
[FMT_BYTES.UINT8ARRAY]: Uint8Array; | ||
@@ -39,4 +36,4 @@ }; | ||
}; | ||
export declare type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Buffer extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
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 ? { | ||
[P in keyof T]: FormatType<T[P], F>; | ||
} : T; |
@@ -30,3 +30,2 @@ "use strict"; | ||
FMT_BYTES["HEX"] = "BYTES_HEX"; | ||
FMT_BYTES["BUFFER"] = "BYTES_BUFFER"; | ||
FMT_BYTES["UINT8ARRAY"] = "BYTES_UINT8ARRAY"; | ||
@@ -33,0 +32,0 @@ })(FMT_BYTES = exports.FMT_BYTES || (exports.FMT_BYTES = {})); |
@@ -6,1 +6,11 @@ export interface Web3Error extends Error { | ||
} | ||
export declare type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
keyword: K; | ||
instancePath: string; | ||
schemaPath: string; | ||
params: P; | ||
propertyName?: string; | ||
message?: string; | ||
schema?: S; | ||
data?: unknown; | ||
}; |
@@ -1,4 +0,4 @@ | ||
import { Address } from './eth_types'; | ||
import { Bytes, Numbers } from './primitives_types'; | ||
import { FixedSizeArray } from './utility_types'; | ||
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; | ||
@@ -29,2 +29,3 @@ export declare type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
readonly arrayChildren?: ReadonlyArray<AbiParameter>; | ||
readonly internalType?: string; | ||
}; | ||
@@ -31,0 +32,0 @@ declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback'; |
@@ -1,5 +0,5 @@ | ||
import { Address, Uint } from './eth_types'; | ||
import { SupportedProviders } from './web3_base_provider'; | ||
import { Bytes, HexString } from './primitives_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Address, Uint } from './eth_types.js'; | ||
import { SupportedProviders } from './web3_base_provider.js'; | ||
import { Bytes, HexString } from './primitives_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
export interface ContractInitOptions { | ||
@@ -32,13 +32,9 @@ /** | ||
nonce?: HexString; | ||
chainId?: HexString; | ||
/** | ||
* The address the call `transaction` should be made from. For calls the `from` property is optional however it is | ||
* The address which is the call (the transaction) should be made from. For calls the `from` property is optional however it is | ||
* highly recommended to explicitly set it or it may default to address(0) depending on your node or provider. | ||
*/ | ||
from?: Address; | ||
to?: Address; | ||
data?: HexString; | ||
input?: HexString; | ||
/** | ||
* The maximum gas provided for this call “transaction” (gas limit) | ||
* The maximum gas (gas limit) provided for this call (this transaction) | ||
*/ | ||
@@ -45,0 +41,0 @@ gas?: string; |
@@ -1,2 +0,2 @@ | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
@@ -181,2 +181,4 @@ export declare type HexString32Bytes = HexString; | ||
} | ||
export declare type Receipt = Record<string, unknown>; | ||
declare type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export interface Filter { | ||
@@ -187,2 +189,3 @@ readonly fromBlock?: BlockNumberOrTag; | ||
readonly topics?: (null | Topic | Topic[])[]; | ||
readonly filter?: FilterOption; | ||
} | ||
@@ -199,3 +202,25 @@ export interface AccessListEntry { | ||
export declare type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export declare type Hardfork = 'arrowGlacier' | 'berlin' | 'byzantium' | 'chainstart' | 'constantinople' | 'dao' | 'homestead' | 'istanbul' | 'london' | 'merge' | 'muirGlacier' | 'petersburg' | 'shanghai' | 'spuriousDragon' | 'tangerineWhistle'; | ||
export declare enum HardforksOrdered { | ||
chainstart = "chainstart", | ||
frontier = "frontier", | ||
homestead = "homestead", | ||
dao = "dao", | ||
tangerineWhistle = "tangerineWhistle", | ||
spuriousDragon = "spuriousDragon", | ||
byzantium = "byzantium", | ||
constantinople = "constantinople", | ||
petersburg = "petersburg", | ||
istanbul = "istanbul", | ||
muirGlacier = "muirGlacier", | ||
berlin = "berlin", | ||
london = "london", | ||
altair = "altair", | ||
arrowGlacier = "arrowGlacier", | ||
grayGlacier = "grayGlacier", | ||
bellatrix = "bellatrix", | ||
merge = "merge", | ||
capella = "capella", | ||
shanghai = "shanghai" | ||
} | ||
export declare type Hardfork = `${HardforksOrdered}`; | ||
export interface LogBase<NumberType, ByteType> { | ||
@@ -202,0 +227,0 @@ readonly removed?: boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BlockTags = void 0; | ||
exports.HardforksOrdered = exports.BlockTags = void 0; | ||
var BlockTags; | ||
@@ -12,2 +12,27 @@ (function (BlockTags) { | ||
})(BlockTags = exports.BlockTags || (exports.BlockTags = {})); | ||
// This list of hardforks is expected to be in order | ||
// keep this in mind when making changes to it | ||
var HardforksOrdered; | ||
(function (HardforksOrdered) { | ||
HardforksOrdered["chainstart"] = "chainstart"; | ||
HardforksOrdered["frontier"] = "frontier"; | ||
HardforksOrdered["homestead"] = "homestead"; | ||
HardforksOrdered["dao"] = "dao"; | ||
HardforksOrdered["tangerineWhistle"] = "tangerineWhistle"; | ||
HardforksOrdered["spuriousDragon"] = "spuriousDragon"; | ||
HardforksOrdered["byzantium"] = "byzantium"; | ||
HardforksOrdered["constantinople"] = "constantinople"; | ||
HardforksOrdered["petersburg"] = "petersburg"; | ||
HardforksOrdered["istanbul"] = "istanbul"; | ||
HardforksOrdered["muirGlacier"] = "muirGlacier"; | ||
HardforksOrdered["berlin"] = "berlin"; | ||
HardforksOrdered["london"] = "london"; | ||
HardforksOrdered["altair"] = "altair"; | ||
HardforksOrdered["arrowGlacier"] = "arrowGlacier"; | ||
HardforksOrdered["grayGlacier"] = "grayGlacier"; | ||
HardforksOrdered["bellatrix"] = "bellatrix"; | ||
HardforksOrdered["merge"] = "merge"; | ||
HardforksOrdered["capella"] = "capella"; | ||
HardforksOrdered["shanghai"] = "shanghai"; | ||
})(HardforksOrdered = exports.HardforksOrdered || (exports.HardforksOrdered = {})); | ||
//# sourceMappingURL=eth_types.js.map |
@@ -1,16 +0,16 @@ | ||
export * from './error_types'; | ||
export * from './apis/eth_execution_api'; | ||
export * from './apis/web3_eth_execution_api'; | ||
export * from './apis/web3_net_api'; | ||
export * from './apis/eth_personal_api'; | ||
export * from './data_format_types'; | ||
export * from './eth_types'; | ||
export * from './eth_abi_types'; | ||
export * from './eth_contract_types'; | ||
export * from './json_rpc_types'; | ||
export * from './primitives_types'; | ||
export * from './utility_types'; | ||
export * from './web3_api_types'; | ||
export * from './web3_base_provider'; | ||
export * from './web3_base_wallet'; | ||
export * from './web3_deferred_promise_type'; | ||
export * from './error_types.js'; | ||
export * from './apis/eth_execution_api.js'; | ||
export * from './apis/web3_eth_execution_api.js'; | ||
export * from './apis/web3_net_api.js'; | ||
export * from './apis/eth_personal_api.js'; | ||
export * from './data_format_types.js'; | ||
export * from './eth_types.js'; | ||
export * from './eth_abi_types.js'; | ||
export * from './eth_contract_types.js'; | ||
export * from './json_rpc_types.js'; | ||
export * from './primitives_types.js'; | ||
export * from './utility_types.js'; | ||
export * from './web3_api_types.js'; | ||
export * from './web3_base_provider.js'; | ||
export * from './web3_base_wallet.js'; | ||
export * from './web3_deferred_promise_type.js'; |
@@ -33,18 +33,18 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./error_types"), exports); | ||
__exportStar(require("./apis/eth_execution_api"), exports); | ||
__exportStar(require("./apis/web3_eth_execution_api"), exports); | ||
__exportStar(require("./apis/web3_net_api"), exports); | ||
__exportStar(require("./apis/eth_personal_api"), exports); | ||
__exportStar(require("./data_format_types"), exports); | ||
__exportStar(require("./eth_types"), exports); | ||
__exportStar(require("./eth_abi_types"), exports); | ||
__exportStar(require("./eth_contract_types"), exports); | ||
__exportStar(require("./json_rpc_types"), exports); | ||
__exportStar(require("./primitives_types"), exports); | ||
__exportStar(require("./utility_types"), exports); | ||
__exportStar(require("./web3_api_types"), exports); | ||
__exportStar(require("./web3_base_provider"), exports); | ||
__exportStar(require("./web3_base_wallet"), exports); | ||
__exportStar(require("./web3_deferred_promise_type"), exports); | ||
__exportStar(require("./error_types.js"), exports); | ||
__exportStar(require("./apis/eth_execution_api.js"), exports); | ||
__exportStar(require("./apis/web3_eth_execution_api.js"), exports); | ||
__exportStar(require("./apis/web3_net_api.js"), exports); | ||
__exportStar(require("./apis/eth_personal_api.js"), exports); | ||
__exportStar(require("./data_format_types.js"), exports); | ||
__exportStar(require("./eth_types.js"), exports); | ||
__exportStar(require("./eth_abi_types.js"), exports); | ||
__exportStar(require("./eth_contract_types.js"), exports); | ||
__exportStar(require("./json_rpc_types.js"), exports); | ||
__exportStar(require("./primitives_types.js"), exports); | ||
__exportStar(require("./utility_types.js"), exports); | ||
__exportStar(require("./web3_api_types.js"), exports); | ||
__exportStar(require("./web3_base_provider.js"), exports); | ||
__exportStar(require("./web3_base_wallet.js"), exports); | ||
__exportStar(require("./web3_deferred_promise_type.js"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -25,2 +25,8 @@ export declare type JsonRpcId = string | number | undefined; | ||
} | ||
export interface JsonRpcSubscriptionResultOld<T = JsonRpcResult> { | ||
readonly error?: never; | ||
readonly params?: never; | ||
readonly type: string; | ||
readonly data: SubscriptionParams<T>; | ||
} | ||
export interface JsonRpcNotification<T = JsonRpcResult> { | ||
@@ -32,2 +38,3 @@ readonly id?: JsonRpcId; | ||
readonly result: never; | ||
readonly data?: never; | ||
} | ||
@@ -40,2 +47,3 @@ export interface JsonRpcSubscriptionResult { | ||
readonly params: never; | ||
readonly data?: never; | ||
} | ||
@@ -42,0 +50,0 @@ export interface JsonRpcRequest<T = unknown[]> { |
@@ -1,5 +0,4 @@ | ||
/// <reference types="node" /> | ||
export declare type HexString = string; | ||
export declare type Bytes = Buffer | Uint8Array | ArrayBuffer | HexString; | ||
export declare type Bytes = Uint8Array | HexString; | ||
export declare type Numbers = number | bigint | string | HexString; | ||
export declare const TypedArray: any; |
@@ -1,2 +0,2 @@ | ||
import { Numbers } from './primitives_types'; | ||
import { Numbers } from './primitives_types.js'; | ||
export declare type Mutable<T> = { | ||
@@ -3,0 +3,0 @@ -readonly [P in keyof T]: T[P]; |
@@ -1,2 +0,2 @@ | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types'; | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types.js'; | ||
export interface ProviderMessage { | ||
@@ -3,0 +3,0 @@ readonly type: string; |
/// <reference types="node" /> | ||
import { Socket } from 'net'; | ||
import { Web3Error } from './error_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Web3Error } from './error_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
import { JsonRpcNotification, JsonRpcPayload, JsonRpcResponse, JsonRpcResponseWithError, JsonRpcResponseWithResult, JsonRpcResult, JsonRpcSubscriptionResult } from './json_rpc_types'; | ||
import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload, ProviderConnectInfo, ProviderRpcError } from './web3_api_types'; | ||
import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload, ProviderConnectInfo, ProviderRpcError, ProviderMessage } from './web3_api_types'; | ||
import { Web3EthExecutionAPI } from './apis/web3_eth_execution_api'; | ||
@@ -16,2 +16,4 @@ import { Web3DeferredPromiseInterface } from './web3_deferred_promise_type'; | ||
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; | ||
@@ -47,10 +49,18 @@ export interface LegacySendProvider { | ||
abstract request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method> | unknown>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResultType>>; | ||
abstract on(type: 'disconnect', callback: Web3ProviderEventCallback<ProviderRpcError>): void; | ||
abstract on<T = JsonRpcResult>(type: 'message' | string, callback: Web3ProviderEventCallback<T>): void; | ||
abstract on(type: 'connect' | 'chainChanged', callback: Web3ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract on(type: 'accountsChanged', callback: Web3ProviderEventCallback<{ | ||
readonly accounts: string[]; | ||
}>): void; | ||
abstract removeListener(type: string, callback: Web3ProviderEventCallback): void; | ||
abstract once?<T = JsonRpcResult>(type: string, callback: Web3ProviderEventCallback<T>): void; | ||
abstract on(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract on<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderMessageEventCallback<T>): void; | ||
abstract on<T = JsonRpcResult>(type: 'data' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderMessageEventCallback<T>): void; | ||
abstract on(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract on(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract on(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract removeListener(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract removeListener<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>): void; | ||
abstract removeListener(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract removeListener(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract removeListener(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract once(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract once<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>): void; | ||
abstract once(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract once(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract once(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract removeAllListeners?(type: string): void; | ||
@@ -57,0 +67,0 @@ abstract connect(): void; |
@@ -1,8 +0,7 @@ | ||
/// <reference types="node" /> | ||
import { Transaction } from './eth_types'; | ||
import { HexString } from './primitives_types'; | ||
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 = { | ||
salt?: Buffer | string; | ||
iv?: Buffer | string; | ||
salt?: Uint8Array | string; | ||
iv?: Uint8Array | string; | ||
kdf?: 'scrypt' | 'pbkdf2'; | ||
@@ -20,3 +19,3 @@ dklen?: number; | ||
r: number; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -27,3 +26,3 @@ export declare type PBKDF2SHA256Params = { | ||
prf: 'hmac-sha256'; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -30,0 +29,0 @@ export declare type KeyStore = { |
@@ -27,3 +27,2 @@ /* | ||
FMT_BYTES["HEX"] = "BYTES_HEX"; | ||
FMT_BYTES["BUFFER"] = "BYTES_BUFFER"; | ||
FMT_BYTES["UINT8ARRAY"] = "BYTES_UINT8ARRAY"; | ||
@@ -30,0 +29,0 @@ })(FMT_BYTES || (FMT_BYTES = {})); |
@@ -9,2 +9,27 @@ export var BlockTags; | ||
})(BlockTags || (BlockTags = {})); | ||
// This list of hardforks is expected to be in order | ||
// keep this in mind when making changes to it | ||
export var HardforksOrdered; | ||
(function (HardforksOrdered) { | ||
HardforksOrdered["chainstart"] = "chainstart"; | ||
HardforksOrdered["frontier"] = "frontier"; | ||
HardforksOrdered["homestead"] = "homestead"; | ||
HardforksOrdered["dao"] = "dao"; | ||
HardforksOrdered["tangerineWhistle"] = "tangerineWhistle"; | ||
HardforksOrdered["spuriousDragon"] = "spuriousDragon"; | ||
HardforksOrdered["byzantium"] = "byzantium"; | ||
HardforksOrdered["constantinople"] = "constantinople"; | ||
HardforksOrdered["petersburg"] = "petersburg"; | ||
HardforksOrdered["istanbul"] = "istanbul"; | ||
HardforksOrdered["muirGlacier"] = "muirGlacier"; | ||
HardforksOrdered["berlin"] = "berlin"; | ||
HardforksOrdered["london"] = "london"; | ||
HardforksOrdered["altair"] = "altair"; | ||
HardforksOrdered["arrowGlacier"] = "arrowGlacier"; | ||
HardforksOrdered["grayGlacier"] = "grayGlacier"; | ||
HardforksOrdered["bellatrix"] = "bellatrix"; | ||
HardforksOrdered["merge"] = "merge"; | ||
HardforksOrdered["capella"] = "capella"; | ||
HardforksOrdered["shanghai"] = "shanghai"; | ||
})(HardforksOrdered || (HardforksOrdered = {})); | ||
//# sourceMappingURL=eth_types.js.map |
@@ -17,18 +17,18 @@ /* | ||
*/ | ||
export * from './error_types'; | ||
export * from './apis/eth_execution_api'; | ||
export * from './apis/web3_eth_execution_api'; | ||
export * from './apis/web3_net_api'; | ||
export * from './apis/eth_personal_api'; | ||
export * from './data_format_types'; | ||
export * from './eth_types'; | ||
export * from './eth_abi_types'; | ||
export * from './eth_contract_types'; | ||
export * from './json_rpc_types'; | ||
export * from './primitives_types'; | ||
export * from './utility_types'; | ||
export * from './web3_api_types'; | ||
export * from './web3_base_provider'; | ||
export * from './web3_base_wallet'; | ||
export * from './web3_deferred_promise_type'; | ||
export * from './error_types.js'; | ||
export * from './apis/eth_execution_api.js'; | ||
export * from './apis/web3_eth_execution_api.js'; | ||
export * from './apis/web3_net_api.js'; | ||
export * from './apis/eth_personal_api.js'; | ||
export * from './data_format_types.js'; | ||
export * from './eth_types.js'; | ||
export * from './eth_abi_types.js'; | ||
export * from './eth_contract_types.js'; | ||
export * from './json_rpc_types.js'; | ||
export * from './primitives_types.js'; | ||
export * from './utility_types.js'; | ||
export * from './web3_api_types.js'; | ||
export * from './web3_base_provider.js'; | ||
export * from './web3_base_wallet.js'; | ||
export * from './web3_deferred_promise_type.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
import { Address, HexString32Bytes, Uint, HexStringBytes, HexStringSingleByte, HexString256Bytes, FeeHistoryBase, HexString8Bytes, Uint256, BlockNumberOrTag, Filter, AccessList, TransactionHash, TransactionReceiptBase, BlockBase, LogBase } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export interface TransactionCallAPI { | ||
@@ -4,0 +4,0 @@ readonly from?: Address; |
@@ -1,3 +0,3 @@ | ||
import { Address, Transaction } from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
import { Address, Transaction } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type EthPersonalAPI = { | ||
@@ -4,0 +4,0 @@ personal_listAccounts: () => Address[]; |
@@ -1,3 +0,3 @@ | ||
import { EthExecutionAPI } from './eth_execution_api'; | ||
import { AccountObject, Address, BlockNumberOrTag, HexString32Bytes, TransactionInfo, Uint } from '../eth_types'; | ||
import { EthExecutionAPI } from './eth_execution_api.js'; | ||
import { AccountObject, Address, BlockNumberOrTag, HexString32Bytes, TransactionInfo, Uint } from '../eth_types.js'; | ||
export declare type Web3EthExecutionAPI = EthExecutionAPI & { | ||
@@ -4,0 +4,0 @@ eth_pendingTransactions: () => TransactionInfo[]; |
@@ -1,2 +0,2 @@ | ||
import { HexString } from '../primitives_types'; | ||
import { HexString } from '../primitives_types.js'; | ||
export declare type Web3NetAPI = { | ||
@@ -3,0 +3,0 @@ net_version: () => string; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare enum FMT_NUMBER { | ||
@@ -17,3 +16,2 @@ NUMBER = "NUMBER_NUMBER", | ||
HEX = "BYTES_HEX", | ||
BUFFER = "BYTES_BUFFER", | ||
UINT8ARRAY = "BYTES_UINT8ARRAY" | ||
@@ -23,3 +21,2 @@ } | ||
[FMT_BYTES.HEX]: HexString; | ||
[FMT_BYTES.BUFFER]: Buffer; | ||
[FMT_BYTES.UINT8ARRAY]: Uint8Array; | ||
@@ -39,5 +36,5 @@ }; | ||
}; | ||
export declare type FormatType<T, F extends DataFormat> = number extends Extract<T, Numbers> ? NumberTypes[F['number']] | Exclude<T, Numbers> : Buffer extends Extract<T, Bytes> ? ByteTypes[F['bytes']] | Exclude<T, Bytes> : T extends object | undefined ? { | ||
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 ? { | ||
[P in keyof T]: FormatType<T[P], F>; | ||
} : T; | ||
//# sourceMappingURL=data_format_types.d.ts.map |
@@ -6,2 +6,12 @@ export interface Web3Error extends Error { | ||
} | ||
export declare type Web3ValidationErrorObject<K extends string = string, P = Record<string, any>, S = unknown> = { | ||
keyword: K; | ||
instancePath: string; | ||
schemaPath: string; | ||
params: P; | ||
propertyName?: string; | ||
message?: string; | ||
schema?: S; | ||
data?: unknown; | ||
}; | ||
//# sourceMappingURL=error_types.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { Address } from './eth_types'; | ||
import { Bytes, Numbers } from './primitives_types'; | ||
import { FixedSizeArray } from './utility_types'; | ||
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; | ||
@@ -29,2 +29,3 @@ export declare type ConvertToNumber<T extends string, Range extends number = _SolidityIndexRange> = Range extends unknown ? (`${Range}` extends T ? Range : never) : never; | ||
readonly arrayChildren?: ReadonlyArray<AbiParameter>; | ||
readonly internalType?: string; | ||
}; | ||
@@ -31,0 +32,0 @@ declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback'; |
@@ -1,5 +0,5 @@ | ||
import { Address, Uint } from './eth_types'; | ||
import { SupportedProviders } from './web3_base_provider'; | ||
import { Bytes, HexString } from './primitives_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Address, Uint } from './eth_types.js'; | ||
import { SupportedProviders } from './web3_base_provider.js'; | ||
import { Bytes, HexString } from './primitives_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
export interface ContractInitOptions { | ||
@@ -32,13 +32,9 @@ /** | ||
nonce?: HexString; | ||
chainId?: HexString; | ||
/** | ||
* The address the call `transaction` should be made from. For calls the `from` property is optional however it is | ||
* The address which is the call (the transaction) should be made from. For calls the `from` property is optional however it is | ||
* highly recommended to explicitly set it or it may default to address(0) depending on your node or provider. | ||
*/ | ||
from?: Address; | ||
to?: Address; | ||
data?: HexString; | ||
input?: HexString; | ||
/** | ||
* The maximum gas provided for this call “transaction” (gas limit) | ||
* The maximum gas (gas limit) provided for this call (this transaction) | ||
*/ | ||
@@ -45,0 +41,0 @@ gas?: string; |
@@ -1,2 +0,2 @@ | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
export declare type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
@@ -181,2 +181,4 @@ export declare type HexString32Bytes = HexString; | ||
} | ||
export declare type Receipt = Record<string, unknown>; | ||
declare type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
export interface Filter { | ||
@@ -187,2 +189,3 @@ readonly fromBlock?: BlockNumberOrTag; | ||
readonly topics?: (null | Topic | Topic[])[]; | ||
readonly filter?: FilterOption; | ||
} | ||
@@ -199,3 +202,25 @@ export interface AccessListEntry { | ||
export declare type ValidChains = 'goerli' | 'kovan' | 'mainnet' | 'rinkeby' | 'ropsten' | 'sepolia'; | ||
export declare type Hardfork = 'arrowGlacier' | 'berlin' | 'byzantium' | 'chainstart' | 'constantinople' | 'dao' | 'homestead' | 'istanbul' | 'london' | 'merge' | 'muirGlacier' | 'petersburg' | 'shanghai' | 'spuriousDragon' | 'tangerineWhistle'; | ||
export declare enum HardforksOrdered { | ||
chainstart = "chainstart", | ||
frontier = "frontier", | ||
homestead = "homestead", | ||
dao = "dao", | ||
tangerineWhistle = "tangerineWhistle", | ||
spuriousDragon = "spuriousDragon", | ||
byzantium = "byzantium", | ||
constantinople = "constantinople", | ||
petersburg = "petersburg", | ||
istanbul = "istanbul", | ||
muirGlacier = "muirGlacier", | ||
berlin = "berlin", | ||
london = "london", | ||
altair = "altair", | ||
arrowGlacier = "arrowGlacier", | ||
grayGlacier = "grayGlacier", | ||
bellatrix = "bellatrix", | ||
merge = "merge", | ||
capella = "capella", | ||
shanghai = "shanghai" | ||
} | ||
export declare type Hardfork = `${HardforksOrdered}`; | ||
export interface LogBase<NumberType, ByteType> { | ||
@@ -202,0 +227,0 @@ readonly removed?: boolean; |
@@ -1,17 +0,17 @@ | ||
export * from './error_types'; | ||
export * from './apis/eth_execution_api'; | ||
export * from './apis/web3_eth_execution_api'; | ||
export * from './apis/web3_net_api'; | ||
export * from './apis/eth_personal_api'; | ||
export * from './data_format_types'; | ||
export * from './eth_types'; | ||
export * from './eth_abi_types'; | ||
export * from './eth_contract_types'; | ||
export * from './json_rpc_types'; | ||
export * from './primitives_types'; | ||
export * from './utility_types'; | ||
export * from './web3_api_types'; | ||
export * from './web3_base_provider'; | ||
export * from './web3_base_wallet'; | ||
export * from './web3_deferred_promise_type'; | ||
export * from './error_types.js'; | ||
export * from './apis/eth_execution_api.js'; | ||
export * from './apis/web3_eth_execution_api.js'; | ||
export * from './apis/web3_net_api.js'; | ||
export * from './apis/eth_personal_api.js'; | ||
export * from './data_format_types.js'; | ||
export * from './eth_types.js'; | ||
export * from './eth_abi_types.js'; | ||
export * from './eth_contract_types.js'; | ||
export * from './json_rpc_types.js'; | ||
export * from './primitives_types.js'; | ||
export * from './utility_types.js'; | ||
export * from './web3_api_types.js'; | ||
export * from './web3_base_provider.js'; | ||
export * from './web3_base_wallet.js'; | ||
export * from './web3_deferred_promise_type.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -25,2 +25,8 @@ export declare type JsonRpcId = string | number | undefined; | ||
} | ||
export interface JsonRpcSubscriptionResultOld<T = JsonRpcResult> { | ||
readonly error?: never; | ||
readonly params?: never; | ||
readonly type: string; | ||
readonly data: SubscriptionParams<T>; | ||
} | ||
export interface JsonRpcNotification<T = JsonRpcResult> { | ||
@@ -32,2 +38,3 @@ readonly id?: JsonRpcId; | ||
readonly result: never; | ||
readonly data?: never; | ||
} | ||
@@ -40,2 +47,3 @@ export interface JsonRpcSubscriptionResult { | ||
readonly params: never; | ||
readonly data?: never; | ||
} | ||
@@ -42,0 +50,0 @@ export interface JsonRpcRequest<T = unknown[]> { |
@@ -1,6 +0,5 @@ | ||
/// <reference types="node" /> | ||
export declare type HexString = string; | ||
export declare type Bytes = Buffer | Uint8Array | ArrayBuffer | HexString; | ||
export declare type Bytes = Uint8Array | HexString; | ||
export declare type Numbers = number | bigint | string | HexString; | ||
export declare const TypedArray: any; | ||
//# sourceMappingURL=primitives_types.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { Numbers } from './primitives_types'; | ||
import { Numbers } from './primitives_types.js'; | ||
export declare type Mutable<T> = { | ||
@@ -3,0 +3,0 @@ -readonly [P in keyof T]: T[P]; |
@@ -1,2 +0,2 @@ | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types'; | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types.js'; | ||
export interface ProviderMessage { | ||
@@ -3,0 +3,0 @@ readonly type: string; |
/// <reference types="node" /> | ||
import { Socket } from 'net'; | ||
import { Web3Error } from './error_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Web3Error } from './error_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
import { JsonRpcNotification, JsonRpcPayload, JsonRpcResponse, JsonRpcResponseWithError, JsonRpcResponseWithResult, JsonRpcResult, JsonRpcSubscriptionResult } from './json_rpc_types'; | ||
import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload, ProviderConnectInfo, ProviderRpcError } from './web3_api_types'; | ||
import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload, ProviderConnectInfo, ProviderRpcError, ProviderMessage } from './web3_api_types'; | ||
import { Web3EthExecutionAPI } from './apis/web3_eth_execution_api'; | ||
@@ -16,2 +16,4 @@ import { Web3DeferredPromiseInterface } from './web3_deferred_promise_type'; | ||
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; | ||
@@ -47,10 +49,18 @@ export interface LegacySendProvider { | ||
abstract request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method> | unknown>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResultType>>; | ||
abstract on(type: 'disconnect', callback: Web3ProviderEventCallback<ProviderRpcError>): void; | ||
abstract on<T = JsonRpcResult>(type: 'message' | string, callback: Web3ProviderEventCallback<T>): void; | ||
abstract on(type: 'connect' | 'chainChanged', callback: Web3ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract on(type: 'accountsChanged', callback: Web3ProviderEventCallback<{ | ||
readonly accounts: string[]; | ||
}>): void; | ||
abstract removeListener(type: string, callback: Web3ProviderEventCallback): void; | ||
abstract once?<T = JsonRpcResult>(type: string, callback: Web3ProviderEventCallback<T>): void; | ||
abstract on(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract on<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderMessageEventCallback<T>): void; | ||
abstract on<T = JsonRpcResult>(type: 'data' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderMessageEventCallback<T>): void; | ||
abstract on(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract on(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract on(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract removeListener(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract removeListener<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>): void; | ||
abstract removeListener(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract removeListener(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract removeListener(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract once(type: 'disconnect', listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>): void; | ||
abstract once<T = JsonRpcResult>(type: 'message' | string, listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>): void; | ||
abstract once(type: 'connect', listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>): void; | ||
abstract once(type: 'chainChanged', listener: Web3Eip1193ProviderEventCallback<string>): void; | ||
abstract once(type: 'accountsChanged', listener: Web3Eip1193ProviderEventCallback<string[]>): void; | ||
abstract removeAllListeners?(type: string): void; | ||
@@ -57,0 +67,0 @@ abstract connect(): void; |
@@ -1,8 +0,7 @@ | ||
/// <reference types="node" /> | ||
import { Transaction } from './eth_types'; | ||
import { HexString } from './primitives_types'; | ||
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 = { | ||
salt?: Buffer | string; | ||
iv?: Buffer | string; | ||
salt?: Uint8Array | string; | ||
iv?: Uint8Array | string; | ||
kdf?: 'scrypt' | 'pbkdf2'; | ||
@@ -20,3 +19,3 @@ dklen?: number; | ||
r: number; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -27,3 +26,3 @@ export declare type PBKDF2SHA256Params = { | ||
prf: 'hmac-sha256'; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -30,0 +29,0 @@ export declare type KeyStore = { |
{ | ||
"name": "web3-types", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "Provide the common data structures and interfaces for web3 modules.", | ||
@@ -59,3 +59,3 @@ "main": "./lib/commonjs/index.js", | ||
}, | ||
"gitHead": "8bd3de3f1dece95a0f026aa226a7dfe0dad55541" | ||
"gitHead": "e0c1aaca24b51ee6ac5975291170d97229f26910" | ||
} |
@@ -34,4 +34,4 @@ /* | ||
LogBase, | ||
} from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
} from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
@@ -38,0 +38,0 @@ // The types are generated manually by referring to following doc |
@@ -17,4 +17,4 @@ /* | ||
*/ | ||
import { Address, Transaction } from '../eth_types'; | ||
import { HexString } from '../primitives_types'; | ||
import { Address, Transaction } from '../eth_types.js'; | ||
import { HexString } from '../primitives_types.js'; | ||
@@ -21,0 +21,0 @@ export type EthPersonalAPI = { |
@@ -17,3 +17,3 @@ /* | ||
*/ | ||
import { EthExecutionAPI } from './eth_execution_api'; | ||
import { EthExecutionAPI } from './eth_execution_api.js'; | ||
import { | ||
@@ -26,3 +26,3 @@ AccountObject, | ||
Uint, | ||
} from '../eth_types'; | ||
} from '../eth_types.js'; | ||
@@ -29,0 +29,0 @@ export type Web3EthExecutionAPI = EthExecutionAPI & { |
@@ -17,3 +17,3 @@ /* | ||
*/ | ||
import { HexString } from '../primitives_types'; | ||
import { HexString } from '../primitives_types.js'; | ||
@@ -20,0 +20,0 @@ export type Web3NetAPI = { |
@@ -18,3 +18,3 @@ /* | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
@@ -37,3 +37,2 @@ export enum FMT_NUMBER { | ||
HEX = 'BYTES_HEX', | ||
BUFFER = 'BYTES_BUFFER', | ||
UINT8ARRAY = 'BYTES_UINT8ARRAY', | ||
@@ -44,3 +43,2 @@ } | ||
[FMT_BYTES.HEX]: HexString; | ||
[FMT_BYTES.BUFFER]: Buffer; | ||
[FMT_BYTES.UINT8ARRAY]: Uint8Array; | ||
@@ -59,3 +57,3 @@ }; | ||
? NumberTypes[F['number']] | Exclude<T, Numbers> | ||
: Buffer extends Extract<T, Bytes> | ||
: Uint8Array extends Extract<T, Bytes> | ||
? ByteTypes[F['bytes']] | Exclude<T, Bytes> | ||
@@ -62,0 +60,0 @@ : T extends object | undefined |
@@ -23,1 +23,18 @@ /* | ||
} | ||
export type Web3ValidationErrorObject< | ||
K extends string = string, | ||
P = Record<string, any>, | ||
S = unknown, | ||
> = { | ||
keyword: K; | ||
instancePath: string; | ||
schemaPath: string; | ||
params: P; | ||
// Added to validation errors of "propertyNames" keyword schema | ||
propertyName?: string; | ||
// Excluded if option `messages` set to false. | ||
message?: string; | ||
schema?: S; | ||
data?: unknown; | ||
}; |
@@ -18,5 +18,5 @@ /* | ||
import { Address } from './eth_types'; | ||
import { Bytes, Numbers } from './primitives_types'; | ||
import { FixedSizeArray } from './utility_types'; | ||
import { Address } from './eth_types.js'; | ||
import { Bytes, Numbers } from './primitives_types.js'; | ||
import { FixedSizeArray } from './utility_types.js'; | ||
@@ -85,2 +85,3 @@ type _SolidityIndexRange = | ||
readonly arrayChildren?: ReadonlyArray<AbiParameter>; | ||
readonly internalType?: string; | ||
}; | ||
@@ -87,0 +88,0 @@ |
@@ -18,6 +18,6 @@ /* | ||
import { Address, Uint } from './eth_types'; | ||
import { SupportedProviders } from './web3_base_provider'; | ||
import { Bytes, HexString } from './primitives_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Address, Uint } from './eth_types.js'; | ||
import { SupportedProviders } from './web3_base_provider.js'; | ||
import { Bytes, HexString } from './primitives_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
@@ -53,13 +53,9 @@ export interface ContractInitOptions { | ||
nonce?: HexString; | ||
chainId?: HexString; | ||
/** | ||
* The address the call `transaction` should be made from. For calls the `from` property is optional however it is | ||
* The address which is the call (the transaction) should be made from. For calls the `from` property is optional however it is | ||
* highly recommended to explicitly set it or it may default to address(0) depending on your node or provider. | ||
*/ | ||
from?: Address; | ||
to?: Address; | ||
data?: HexString; | ||
input?: HexString; | ||
/** | ||
* The maximum gas provided for this call “transaction” (gas limit) | ||
* The maximum gas (gas limit) provided for this call (this transaction) | ||
*/ | ||
@@ -66,0 +62,0 @@ gas?: string; |
@@ -17,3 +17,3 @@ /* | ||
*/ | ||
import { Bytes, HexString, Numbers } from './primitives_types'; | ||
import { Bytes, HexString, Numbers } from './primitives_types.js'; | ||
@@ -221,2 +221,6 @@ export type ValueTypes = 'address' | 'bool' | 'string' | 'int256' | 'uint256' | 'bytes' | 'bigint'; | ||
export type Receipt = Record<string, unknown>; | ||
type FilterOption = Record<string, Numbers | Numbers[] | boolean | boolean[]>; | ||
// https://github.com/ethereum/execution-apis/blob/main/src/schemas/filter.json#L28 | ||
@@ -231,2 +235,3 @@ export interface Filter { | ||
readonly topics?: (null | Topic | Topic[])[]; | ||
readonly filter?: FilterOption; | ||
} | ||
@@ -247,19 +252,29 @@ | ||
export type Hardfork = | ||
| 'arrowGlacier' | ||
| 'berlin' | ||
| 'byzantium' | ||
| 'chainstart' | ||
| 'constantinople' | ||
| 'dao' | ||
| 'homestead' | ||
| 'istanbul' | ||
| 'london' | ||
| 'merge' | ||
| 'muirGlacier' | ||
| 'petersburg' | ||
| 'shanghai' | ||
| 'spuriousDragon' | ||
| 'tangerineWhistle'; | ||
// This list of hardforks is expected to be in order | ||
// keep this in mind when making changes to it | ||
export enum HardforksOrdered { | ||
chainstart = 'chainstart', | ||
frontier = 'frontier', | ||
homestead = 'homestead', | ||
dao = 'dao', | ||
tangerineWhistle = 'tangerineWhistle', | ||
spuriousDragon = 'spuriousDragon', | ||
byzantium = 'byzantium', | ||
constantinople = 'constantinople', | ||
petersburg = 'petersburg', | ||
istanbul = 'istanbul', | ||
muirGlacier = 'muirGlacier', | ||
berlin = 'berlin', | ||
london = 'london', | ||
altair = 'altair', | ||
arrowGlacier = 'arrowGlacier', | ||
grayGlacier = 'grayGlacier', | ||
bellatrix = 'bellatrix', | ||
merge = 'merge', | ||
capella = 'capella', | ||
shanghai = 'shanghai', | ||
} | ||
export type Hardfork = `${HardforksOrdered}`; | ||
export interface LogBase<NumberType, ByteType> { | ||
@@ -266,0 +281,0 @@ readonly removed?: boolean; |
@@ -18,17 +18,17 @@ /* | ||
export * from './error_types'; | ||
export * from './apis/eth_execution_api'; | ||
export * from './apis/web3_eth_execution_api'; | ||
export * from './apis/web3_net_api'; | ||
export * from './apis/eth_personal_api'; | ||
export * from './data_format_types'; | ||
export * from './eth_types'; | ||
export * from './eth_abi_types'; | ||
export * from './eth_contract_types'; | ||
export * from './json_rpc_types'; | ||
export * from './primitives_types'; | ||
export * from './utility_types'; | ||
export * from './web3_api_types'; | ||
export * from './web3_base_provider'; | ||
export * from './web3_base_wallet'; | ||
export * from './web3_deferred_promise_type'; | ||
export * from './error_types.js'; | ||
export * from './apis/eth_execution_api.js'; | ||
export * from './apis/web3_eth_execution_api.js'; | ||
export * from './apis/web3_net_api.js'; | ||
export * from './apis/eth_personal_api.js'; | ||
export * from './data_format_types.js'; | ||
export * from './eth_types.js'; | ||
export * from './eth_abi_types.js'; | ||
export * from './eth_contract_types.js'; | ||
export * from './json_rpc_types.js'; | ||
export * from './primitives_types.js'; | ||
export * from './utility_types.js'; | ||
export * from './web3_api_types.js'; | ||
export * from './web3_base_provider.js'; | ||
export * from './web3_base_wallet.js'; | ||
export * from './web3_deferred_promise_type.js'; |
@@ -45,2 +45,10 @@ /* | ||
} | ||
export interface JsonRpcSubscriptionResultOld<T = JsonRpcResult> { | ||
readonly error?: never; | ||
readonly params?: never; | ||
readonly type: string; | ||
readonly data: SubscriptionParams<T>; | ||
} | ||
export interface JsonRpcNotification<T = JsonRpcResult> { | ||
@@ -52,2 +60,3 @@ readonly id?: JsonRpcId; | ||
readonly result: never; | ||
readonly data?: never; | ||
} | ||
@@ -61,2 +70,3 @@ | ||
readonly params: never; | ||
readonly data?: never; | ||
} | ||
@@ -63,0 +73,0 @@ |
@@ -19,3 +19,3 @@ /* | ||
export type HexString = string; | ||
export type Bytes = Buffer | Uint8Array | ArrayBuffer | HexString; | ||
export type Bytes = Uint8Array | HexString; | ||
export type Numbers = number | bigint | string | HexString; | ||
@@ -22,0 +22,0 @@ |
@@ -18,3 +18,3 @@ /* | ||
import { Numbers } from './primitives_types'; | ||
import { Numbers } from './primitives_types.js'; | ||
@@ -21,0 +21,0 @@ // Make each attribute mutable by removing `readonly` |
@@ -18,3 +18,3 @@ /* | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types'; | ||
import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types.js'; | ||
@@ -21,0 +21,0 @@ export interface ProviderMessage { |
@@ -19,4 +19,4 @@ /* | ||
import { Web3Error } from './error_types'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api'; | ||
import { Web3Error } from './error_types.js'; | ||
import { EthExecutionAPI } from './apis/eth_execution_api.js'; | ||
import { | ||
@@ -38,2 +38,3 @@ JsonRpcNotification, | ||
ProviderRpcError, | ||
ProviderMessage, | ||
} from './web3_api_types'; | ||
@@ -62,2 +63,8 @@ import { Web3EthExecutionAPI } from './apis/web3_eth_execution_api'; | ||
export type Web3ProviderMessageEventCallback<T = JsonRpcResult> = ( | ||
result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>, | ||
) => void; | ||
export type Web3Eip1193ProviderEventCallback<T> = (data: T) => void; | ||
export type Web3ProviderRequestCallback<ResultType = unknown> = ( | ||
@@ -165,24 +172,69 @@ // Used "null" value to match the legacy version | ||
type: 'disconnect', | ||
callback: Web3ProviderEventCallback<ProviderRpcError>, | ||
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>, | ||
): void; | ||
public abstract on<T = JsonRpcResult>( | ||
type: 'message' | string, | ||
callback: Web3ProviderEventCallback<T>, | ||
listener: | ||
| Web3Eip1193ProviderEventCallback<ProviderMessage> | ||
| Web3ProviderMessageEventCallback<T>, | ||
): void; | ||
// for old providers | ||
public abstract on<T = JsonRpcResult>( | ||
type: 'data' | string, | ||
listener: | ||
| Web3Eip1193ProviderEventCallback<ProviderMessage> | ||
| Web3ProviderMessageEventCallback<T>, | ||
): void; | ||
public abstract on( | ||
type: 'connect' | 'chainChanged', | ||
callback: Web3ProviderEventCallback<ProviderConnectInfo>, | ||
type: 'connect', | ||
listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>, | ||
): void; | ||
public abstract on( | ||
type: 'chainChanged', | ||
listener: Web3Eip1193ProviderEventCallback<string>, | ||
): void; | ||
public abstract on( | ||
type: 'accountsChanged', | ||
callback: Web3ProviderEventCallback<{ | ||
readonly accounts: string[]; | ||
}>, | ||
listener: Web3Eip1193ProviderEventCallback<string[]>, | ||
): void; | ||
public abstract removeListener(type: string, callback: Web3ProviderEventCallback): void; | ||
public abstract once?<T = JsonRpcResult>( | ||
type: string, | ||
callback: Web3ProviderEventCallback<T>, | ||
public abstract removeListener( | ||
type: 'disconnect', | ||
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>, | ||
): void; | ||
public abstract removeListener<T = JsonRpcResult>( | ||
type: 'message' | string, | ||
listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>, | ||
): void; | ||
public abstract removeListener( | ||
type: 'connect', | ||
listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>, | ||
): void; | ||
public abstract removeListener( | ||
type: 'chainChanged', | ||
listener: Web3Eip1193ProviderEventCallback<string>, | ||
): void; | ||
public abstract removeListener( | ||
type: 'accountsChanged', | ||
listener: Web3Eip1193ProviderEventCallback<string[]>, | ||
): void; | ||
public abstract once( | ||
type: 'disconnect', | ||
listener: Web3Eip1193ProviderEventCallback<ProviderRpcError>, | ||
): void; | ||
public abstract once<T = JsonRpcResult>( | ||
type: 'message' | string, | ||
listener: Web3Eip1193ProviderEventCallback<ProviderMessage> | Web3ProviderEventCallback<T>, | ||
): void; | ||
public abstract once( | ||
type: 'connect', | ||
listener: Web3Eip1193ProviderEventCallback<ProviderConnectInfo>, | ||
): void; | ||
public abstract once( | ||
type: 'chainChanged', | ||
listener: Web3Eip1193ProviderEventCallback<string>, | ||
): void; | ||
public abstract once( | ||
type: 'accountsChanged', | ||
listener: Web3Eip1193ProviderEventCallback<string[]>, | ||
): void; | ||
public abstract removeAllListeners?(type: string): void; | ||
@@ -189,0 +241,0 @@ public abstract connect(): void; |
@@ -17,4 +17,4 @@ /* | ||
*/ | ||
import { Transaction } from './eth_types'; | ||
import { HexString } from './primitives_types'; | ||
import { Transaction } from './eth_types.js'; | ||
import { HexString } from './primitives_types.js'; | ||
@@ -24,4 +24,4 @@ export type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export type CipherOptions = { | ||
salt?: Buffer | string; | ||
iv?: Buffer | string; | ||
salt?: Uint8Array | string; | ||
iv?: Uint8Array | string; | ||
kdf?: 'scrypt' | 'pbkdf2'; | ||
@@ -40,3 +40,3 @@ dklen?: number; | ||
r: number; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -47,3 +47,3 @@ export type PBKDF2SHA256Params = { | ||
prf: 'hmac-sha256'; | ||
salt: Buffer | string; | ||
salt: Uint8Array | string; | ||
}; | ||
@@ -50,0 +50,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
Sorry, the diff of this file 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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
252978
4597
0