web3-types
Advanced tools
Comparing version 0.1.1-alpha.1 to 0.1.1-alpha.2
@@ -20,2 +20,3 @@ import { Numbers } from './primitives_types'; | ||
}; | ||
export declare type Sha3Input = TypedObject | TypedObjectAbbreviated | Numbers | boolean | object; | ||
export declare type IndexKeysForArray<A extends readonly unknown[]> = Exclude<keyof A, keyof []>; | ||
@@ -22,0 +23,0 @@ export declare type ArrayToIndexObject<T extends ReadonlyArray<unknown>> = { |
@@ -6,4 +6,4 @@ import { JsonRpcId, JsonRpcIdentifier } from './json_rpc_types'; | ||
export interface Web3APIRequest<API extends Web3APISpec, Method extends Web3APIMethod<API>> { | ||
method: Method; | ||
params: Web3APIParams<API, Method>; | ||
method: Method | string; | ||
params?: Web3APIParams<API, Method> | readonly unknown[] | object; | ||
} | ||
@@ -13,4 +13,5 @@ export interface Web3APIPayload<API extends Web3APISpec, Method extends Web3APIMethod<API>> extends Web3APIRequest<API, Method> { | ||
readonly id?: JsonRpcId; | ||
readonly requestOptions?: unknown; | ||
} | ||
export declare 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 |
@@ -7,2 +7,3 @@ /// <reference types="node" /> | ||
import { Web3APISpec, Web3APIMethod, Web3APIReturnType, Web3APIPayload } from './web3_api_types'; | ||
import { Web3EthExecutionAPI } from './apis/web3_eth_execution_api'; | ||
declare const symbol: unique symbol; | ||
@@ -22,3 +23,3 @@ export declare type Web3ProviderStatus = 'connecting' | 'connected' | 'disconnected'; | ||
export interface EIP1193Provider<API extends Web3APISpec> { | ||
request<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>(request: Web3APIPayload<API, Method>, requestOptions?: unknown): Promise<JsonRpcResponseWithResult<ResponseType>>; | ||
request<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResponseType> | unknown>; | ||
} | ||
@@ -30,5 +31,5 @@ export declare abstract class Web3BaseProvider<API extends Web3APISpec = EthExecutionAPI> implements LegacySendProvider, LegacySendAsyncProvider, EIP1193Provider<API> { | ||
abstract supportsSubscriptions(): boolean; | ||
send<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>, callback: (err?: Error | null, response?: JsonRpcResponse<R>) => void): void; | ||
send<ResultType = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>, callback: (err?: Error | null, response?: JsonRpcResponse<ResultType>) => void): void; | ||
sendAsync<R = JsonRpcResult, P = unknown>(payload: JsonRpcPayload<P>): Promise<JsonRpcResponse<R, JsonRpcResult>>; | ||
abstract request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method>>(request: Web3APIPayload<API, Method>, requestOptions?: unknown): Promise<JsonRpcResponseWithResult<ResultType>>; | ||
abstract request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method> | unknown>(args: Web3APIPayload<API, Method>): Promise<JsonRpcResponseWithResult<ResultType>>; | ||
abstract on<T = JsonRpcResult>(type: 'message' | 'disconnect' | string, callback: Web3ProviderEventCallback<T>): void; | ||
@@ -50,5 +51,5 @@ abstract on(type: 'connect' | 'chainChanged', callback: Web3ProviderEventCallback<{ | ||
} | ||
export declare type SupportedProviders<API extends Web3APISpec> = Web3BaseProvider<API> | EIP1193Provider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider; | ||
export declare type SupportedProviders<API extends Web3APISpec = Web3EthExecutionAPI> = EIP1193Provider<API> | Web3BaseProvider<API> | LegacyRequestProvider | LegacySendProvider | LegacySendAsyncProvider; | ||
export declare type Web3BaseProviderConstructor = new <API extends Web3APISpec>(url: string, net?: Socket) => Web3BaseProvider<API>; | ||
export {}; | ||
//# sourceMappingURL=web3_base_provider.d.ts.map |
@@ -0,3 +1,42 @@ | ||
/// <reference types="node" /> | ||
import { HexString } from './primitives_types'; | ||
export declare type Web3EncryptedWallet = string; | ||
export declare type Cipher = 'aes-128-ctr' | 'aes-128-cbc' | 'aes-256-cbc'; | ||
export declare type CipherOptions = { | ||
salt?: Buffer | string; | ||
iv?: Buffer | string; | ||
kdf?: 'scrypt' | 'pbkdf2'; | ||
dklen?: number; | ||
c?: number; | ||
n?: number; | ||
r?: number; | ||
p?: number; | ||
}; | ||
export declare type ScryptParams = { | ||
dklen: number; | ||
n: number; | ||
p: number; | ||
r: number; | ||
salt: Buffer | string; | ||
}; | ||
export declare type PBKDF2SHA256Params = { | ||
c: number; | ||
dklen: number; | ||
prf: 'hmac-sha256'; | ||
salt: Buffer | string; | ||
}; | ||
export declare type KeyStore = { | ||
crypto: { | ||
cipher: Cipher; | ||
ciphertext: string; | ||
cipherparams: { | ||
iv: string; | ||
}; | ||
kdf: 'pbkdf2' | 'scrypt'; | ||
kdfparams: ScryptParams | PBKDF2SHA256Params; | ||
mac: HexString; | ||
}; | ||
id: string; | ||
version: 3; | ||
address: string; | ||
}; | ||
export interface Web3BaseWalletAccount { | ||
@@ -23,3 +62,3 @@ [key: string]: unknown; | ||
}; | ||
readonly encrypt: (password: string, options?: Record<string, unknown>) => Promise<Web3EncryptedWallet>; | ||
readonly encrypt: (password: string, options?: Record<string, unknown>) => Promise<KeyStore>; | ||
} | ||
@@ -29,3 +68,3 @@ export interface Web3AccountProvider<T> { | ||
create: () => T; | ||
decrypt: (keystore: string, password: string, options?: Record<string, unknown>) => Promise<T>; | ||
decrypt: (keystore: KeyStore | string, password: string, options?: Record<string, unknown>) => Promise<T>; | ||
} | ||
@@ -40,4 +79,4 @@ export declare abstract class Web3BaseWallet<T extends Web3BaseWalletAccount> extends Array<T> { | ||
abstract clear(): this; | ||
abstract encrypt(password: string, options?: Record<string, unknown>): Promise<Web3EncryptedWallet[]>; | ||
abstract decrypt(encryptedWallet: Web3EncryptedWallet[], password: string, options?: Record<string, unknown>): Promise<this>; | ||
abstract encrypt(password: string, options?: Record<string, unknown>): Promise<KeyStore[]>; | ||
abstract decrypt(encryptedWallet: KeyStore[], password: string, options?: Record<string, unknown>): Promise<this>; | ||
abstract save(password: string, keyName?: string): Promise<boolean | never>; | ||
@@ -44,0 +83,0 @@ abstract load(password: string, keyName?: string): Promise<this | never>; |
{ | ||
"name": "web3-types", | ||
"version": "0.1.1-alpha.1", | ||
"version": "0.1.1-alpha.2", | ||
"description": "Provide the common data structures and interfaces for web3 modules.", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "a754e3a965c30f42a6e639df27462650062833ee" | ||
"gitHead": "7d5de3b049bf7929669c89e474387b16bd27c612" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a 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
82980
957
1