web3-types
Advanced tools
Comparing version 1.0.1-dev.3e7f004.0 to 1.0.1-dev.3f49e18.0
@@ -31,3 +31,3 @@ import { Address } from './eth_types.js'; | ||
}; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback'; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export declare type AbiBaseFragment = { | ||
@@ -102,3 +102,3 @@ readonly type: string | FragmentTypes; | ||
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 = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
export declare 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']>; | ||
@@ -110,3 +110,3 @@ } : Type extends `tuple[${infer Size}]` ? _TypedArray<{ | ||
declare type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export declare type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
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 ? [ | ||
@@ -113,0 +113,0 @@ MatchPrimitiveType<H['type'], H['components']>, |
@@ -28,5 +28,23 @@ /// <reference types="node" /> | ||
} | ||
export interface EIP1193Provider<API extends Web3APISpec> { | ||
export interface SimpleProvider<API extends Web3APISpec> { | ||
request<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResponseType> | unknown>; | ||
} | ||
export interface ProviderInfo { | ||
chainId: string; | ||
} | ||
export declare type ProviderChainId = string; | ||
export declare type ProviderAccounts = string[]; | ||
export declare type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export interface EIP1193Provider<API extends Web3APISpec> extends SimpleProvider<API> { | ||
on(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
on(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
on(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
on(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
removeListener(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
removeListener(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
removeListener(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
removeListener(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
removeListener(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
} | ||
export declare abstract class Web3BaseProvider<API extends Web3APISpec = EthExecutionAPI> implements LegacySendProvider, LegacySendAsyncProvider, EIP1193Provider<API> { | ||
@@ -70,4 +88,4 @@ static isWeb3Provider(provider: unknown): boolean; | ||
} | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider; | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API>; | ||
export declare type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export {}; |
@@ -31,3 +31,3 @@ import { Address } from './eth_types.js'; | ||
}; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback'; | ||
declare type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
export declare type AbiBaseFragment = { | ||
@@ -102,3 +102,3 @@ readonly type: string | FragmentTypes; | ||
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 = []> = TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends 'tuple' ? { | ||
export declare 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']>; | ||
@@ -110,3 +110,3 @@ } : Type extends `tuple[${infer Size}]` ? _TypedArray<{ | ||
declare type ArrToObjectWithFunctions<T extends unknown[]> = Array<unknown> & ObjectToArray<T>; | ||
export declare type MatchPrimitiveType<Type extends string, TypeComponents extends ReadonlyArray<AbiParameter> | undefined> = PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never; | ||
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 ? [ | ||
@@ -113,0 +113,0 @@ MatchPrimitiveType<H['type'], H['components']>, |
@@ -28,5 +28,23 @@ /// <reference types="node" /> | ||
} | ||
export interface EIP1193Provider<API extends Web3APISpec> { | ||
export interface SimpleProvider<API extends Web3APISpec> { | ||
request<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResponseType> | unknown>; | ||
} | ||
export interface ProviderInfo { | ||
chainId: string; | ||
} | ||
export declare type ProviderChainId = string; | ||
export declare type ProviderAccounts = string[]; | ||
export declare type Eip1193EventName = 'connect' | 'disconnect' | 'message' | 'chainChanged' | 'accountsChanged'; | ||
export interface EIP1193Provider<API extends Web3APISpec> extends SimpleProvider<API> { | ||
on(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
on(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
on(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
on(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
removeListener(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
removeListener(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
removeListener(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
removeListener(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
removeListener(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
} | ||
export declare abstract class Web3BaseProvider<API extends Web3APISpec = EthExecutionAPI> implements LegacySendProvider, LegacySendAsyncProvider, EIP1193Provider<API> { | ||
@@ -70,5 +88,5 @@ static isWeb3Provider(provider: unknown): boolean; | ||
} | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider; | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider | SimpleProvider<API>; | ||
export declare type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export {}; | ||
//# sourceMappingURL=web3_base_provider.d.ts.map |
{ | ||
"name": "web3-types", | ||
"version": "1.0.1-dev.3e7f004.0+3e7f004", | ||
"version": "1.0.1-dev.3f49e18.0+3f49e18", | ||
"description": "Provide the common data structures and interfaces for web3 modules.", | ||
@@ -59,3 +59,3 @@ "main": "./lib/commonjs/index.js", | ||
}, | ||
"gitHead": "3e7f00448fe9b5541c8a3639af982031124b6ffa" | ||
"gitHead": "3f49e18d24af3dffe2ed47bf65dcf97c0204fc87" | ||
} |
@@ -87,3 +87,3 @@ /* | ||
type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback'; | ||
type FragmentTypes = 'constructor' | 'event' | 'function' | 'fallback' | 'receive'; | ||
@@ -224,3 +224,3 @@ export type AbiBaseFragment = { | ||
Type extends string, | ||
TypeComponents extends ReadonlyArray<AbiParameter> | undefined = [], | ||
TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown = [], | ||
> = TypeComponents extends ReadonlyArray<AbiParameter> | ||
@@ -256,3 +256,3 @@ ? Type extends 'tuple' | ||
Type extends string, | ||
TypeComponents extends ReadonlyArray<AbiParameter> | undefined, | ||
TypeComponents extends ReadonlyArray<AbiParameter> | undefined | unknown, | ||
> = | ||
@@ -259,0 +259,0 @@ | PrimitiveAddressType<Type> |
@@ -97,3 +97,3 @@ /* | ||
export interface EIP1193Provider<API extends Web3APISpec> { | ||
export interface SimpleProvider<API extends Web3APISpec> { | ||
request<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>( | ||
@@ -104,2 +104,31 @@ args: Web3APIPayload<API, Method>, | ||
export interface ProviderInfo { | ||
chainId: string; | ||
} | ||
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> { | ||
on(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
on(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
on(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
on(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
removeListener(event: 'connect', listener: (info: ProviderInfo) => void): void; | ||
removeListener(event: 'disconnect', listener: (error: ProviderRpcError) => void): void; | ||
removeListener(event: 'message', listener: (message: ProviderMessage) => void): void; | ||
removeListener(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): void; | ||
removeListener(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): void; | ||
} | ||
// Provider interface compatible with EIP-1193 | ||
@@ -249,3 +278,4 @@ // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md | ||
| LegacySendProvider | ||
| LegacySendAsyncProvider; | ||
| LegacySendAsyncProvider | ||
| SimpleProvider<API>; | ||
@@ -252,0 +282,0 @@ export type Web3BaseProviderConstructor = new <API extends Web3APISpec>( |
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
258013
4657