Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@walletconnect/types

Package Overview
Dependencies
Maintainers
1
Versions
658
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/types - npm Package Compare versions

Comparing version 1.0.0-next.0 to 1.0.0-rc.0

406

index.d.ts

@@ -1,137 +0,166 @@

declare module '@walletconnect/types' {
declare module "@walletconnect/types" {
export interface IConnector {
bridge: string
key: string
nextKey: string
clientId: string
peerId: string
clientMeta: IClientMeta | null
peerMeta: IClientMeta | null
handshakeTopic: string
handshakeId: number
accounts: string[]
chainId: number
networkId: number
rpcUrl: string
connected: boolean
pending: boolean
createSession: (opts?: { chainId: number }) => Promise<void>
approveSession: (sessionStatus: ISessionStatus) => void
rejectSession: (sessionError?: ISessionError) => void
updateSession: (sessionStatus: ISessionStatus) => void
killSession: (sessionError?: ISessionError) => Promise<void>
sendTransaction: (tx: ITxData) => Promise<any>
signTransaction: (tx: ITxData) => Promise<any>
signMessage: (params: any[]) => Promise<any>
signPersonalMessage: (params: any[]) => Promise<any>
signTypedData: (params: any[]) => Promise<any>
sendCustomRequest: (request: Partial<IJsonRpcRequest>) => Promise<any>
approveRequest: (response: Partial<IJsonRpcResponseSuccess>) => void
rejectRequest: (response: Partial<IJsonRpcResponseError>) => void
bridge: string;
key: string;
clientId: string;
peerId: string;
readonly clientMeta: IClientMeta | null;
peerMeta: IClientMeta | null;
handshakeTopic: string;
handshakeId: number;
uri: string;
chainId: number;
networkId: number;
accounts: string[];
rpcUrl: string;
readonly connected: boolean;
readonly pending: boolean;
session: IWalletConnectSession;
on(event: string, callback: (error: Error | null, payload: any | null) => void): void;
connect(opts?: ICreateSessionOptions): Promise<ISessionStatus>;
createSession(opts?: ICreateSessionOptions): Promise<void>;
approveSession(sessionStatus: ISessionStatus): void;
rejectSession(sessionError?: ISessionError): void;
updateSession(sessionStatus: ISessionStatus): void;
killSession(sessionError?: ISessionError): Promise<void>;
sendTransaction(tx: ITxData): Promise<any>;
signTransaction(tx: ITxData): Promise<any>;
signMessage(params: any[]): Promise<any>;
signPersonalMessage(params: any[]): Promise<any>;
signTypedData(params: any[]): Promise<any>;
updateChain(chainParams: IUpdateChainParams): Promise<any>;
sendCustomRequest(request: Partial<IJsonRpcRequest>, options?: IRequestOptions): Promise<any>;
unsafeSend(
request: IJsonRpcRequest,
options?: IRequestOptions,
): Promise<IJsonRpcResponseSuccess | IJsonRpcResponseError>;
approveRequest(response: Partial<IJsonRpcResponseSuccess>): void;
rejectRequest(response: Partial<IJsonRpcResponseError>): void;
}
export interface ICryptoLib {
generateKey: (length?: number) => Promise<ArrayBuffer>
generateKey: (length?: number) => Promise<ArrayBuffer>;
encrypt: (
data: IJsonRpcRequest | IJsonRpcResponseSuccess | IJsonRpcResponseError,
key: ArrayBuffer
) => Promise<IEncryptionPayload>
key: ArrayBuffer,
iv?: ArrayBuffer,
) => Promise<IEncryptionPayload>;
decrypt: (
payload: IEncryptionPayload,
key: ArrayBuffer
) => Promise<
IJsonRpcRequest | IJsonRpcResponseSuccess | IJsonRpcResponseError | null
>
key: ArrayBuffer,
) => Promise<IJsonRpcRequest | IJsonRpcResponseSuccess | IJsonRpcResponseError | null>;
}
export interface ITransportLib {
open: () => void
send: (socketMessage: ISocketMessage) => void
close: () => void
on: (event: string, callback: (payload: any) => void) => void
open: () => void;
close: () => void;
send: (message: string, topic?: string, silent?: boolean) => void;
subscribe: (topic: string) => void;
on: (event: string, callback: (payload: any) => void) => void;
}
export interface ITransportEvent {
event: string
callback: (payload: any) => void
event: string;
callback: (payload: any) => void;
}
export type NetworkEvent = "online" | "offline";
export interface INetworkMonitor {
on: (event: NetworkEvent, callback: () => void) => void;
}
export interface INetworkEventEmitter {
event: NetworkEvent;
callback: () => void;
}
export interface ISessionStorage {
getSession: () => IWalletConnectSession | null
setSession: (session: IWalletConnectSession) => IWalletConnectSession
removeSession: () => void
getSession: () => IWalletConnectSession | null;
setSession: (session: IWalletConnectSession) => IWalletConnectSession;
removeSession: () => void;
}
export interface IEncryptionPayload {
data: string
hmac: string
iv: string
data: string;
hmac: string;
iv: string;
}
export interface ISocketMessage {
topic: string
type: string
payload: string
silent: boolean
topic: string;
type: string;
payload: string;
silent: boolean;
}
export interface ISocketTransportOptions {
url: string;
netMonitor?: INetworkMonitor;
subscriptions?: string[];
}
export interface ISessionStatus {
chainId: number
accounts: string[]
networkId?: number
rpcUrl?: string
chainId: number;
accounts: string[];
networkId?: number;
rpcUrl?: string;
}
export interface ISessionError {
message?: string
message?: string;
}
export interface IInternalEvent {
event: string
params: any
event: string;
params: any;
}
export interface ICallTxData {
to?: string
value?: number | string
gas?: number | string
gasLimit?: number | string
gasPrice?: number | string
nonce?: number | string
data?: string
to?: string;
value?: number | string;
gas?: number | string;
gasLimit?: number | string;
gasPrice?: number | string;
nonce?: number | string;
data?: string;
}
export interface ITxData extends ICallTxData {
from: string
from: string;
}
export interface IJsonRpcResponseSuccess {
id: number
jsonrpc: string
result: any
id: number;
jsonrpc: string;
result: any;
}
export interface IJsonRpcErrorMessage {
code?: number
message: string
code?: number;
message: string;
}
export interface IJsonRpcResponseError {
id: number
jsonrpc: string
error: IJsonRpcErrorMessage
id: number;
jsonrpc: string;
error: IJsonRpcErrorMessage;
}
export interface IJsonRpcRequest {
id: number
jsonrpc: string
method: string
params: any[]
id: number;
jsonrpc: string;
method: string;
params: any[];
}
export interface IJsonRpcSubscription {
id: number
jsonrpc: string
method: string
params: any
id: number;
jsonrpc: string;
method: string;
params: any;
}

@@ -143,116 +172,193 @@

| IJsonRpcResponseSuccess
| IJsonRpcResponseError
| IJsonRpcResponseError;
export type IErrorCallback = (err: Error | null, data?: any) => void
export type IErrorCallback = (err: Error | null, data?: any) => void;
export type ICallback = () => void
export type ICallback = () => void;
export interface IError extends Error {
res?: any
code?: any
res?: any;
code?: any;
}
export interface IClientMeta {
description: string
url: string
icons: string[]
name: string
description: string;
url: string;
icons: string[];
name: string;
}
export interface IEventEmitter {
event: string
callback: (error: Error | null, request: any | null) => void
event: string;
callback: (error: Error | null, request: any | null) => void;
}
export interface IRequiredParamsResult {
handshakeTopic: string
version: number
handshakeTopic: string;
version: number;
}
export interface IQueryParamsResult {
bridge: string
key: string
bridge: string;
key: string;
}
export interface IParseURIResult {
protocol: string
handshakeTopic: string
version: number
bridge: string
key: string
protocol: string;
handshakeTopic: string;
version: number;
bridge: string;
key: string;
}
export interface ISessionParams {
approved: boolean
chainId: number | null
networkId: number | null
accounts: string[] | null
rpcUrl?: string | null
peerId?: string | null
peerMeta?: IClientMeta | null
approved: boolean;
chainId: number | null;
networkId: number | null;
accounts: string[] | null;
rpcUrl?: string | null;
peerId?: string | null;
peerMeta?: IClientMeta | null;
}
export interface IWalletConnectSession {
connected: boolean
accounts: string[]
chainId: number
bridge: string
key: string
clientId: string
clientMeta: IClientMeta | null
peerId: string
peerMeta: IClientMeta | null
handshakeId: number
handshakeTopic: string
connected: boolean;
accounts: string[];
chainId: number;
bridge: string;
key: string;
clientId: string;
clientMeta: IClientMeta | null;
peerId: string;
peerMeta: IClientMeta | null;
handshakeId: number;
handshakeTopic: string;
}
export interface IWalletConnectOptions {
bridge?: string
uri?: string
session?: IWalletConnectSession
bridge?: string;
uri?: string;
session?: IWalletConnectSession;
storage?: ISessionStorage;
clientMeta?: IClientMeta;
qrcodeModal?: IQRCodeModal;
}
export interface IConnectorOpts {
cryptoLib: ICryptoLib;
connectorOpts: IWalletConnectOptions;
transport?: ITransportLib;
sessionStorage?: ISessionStorage;
pushServerOpts?: IPushServerOptions;
}
export interface INodeJSOptions {
clientMeta: IClientMeta;
}
export interface IPushServerOptions {
url: string
type: string
token: string
peerMeta?: boolean
language?: string
url: string;
type: string;
token: string;
peerMeta?: boolean;
language?: string;
}
export interface INativeWalletOptions {
clientMeta: IClientMeta
push?: IPushServerOptions | null
clientMeta: IClientMeta;
push?: IPushServerOptions | null;
}
export interface IPushSubscription {
bridge: string
topic: string
type: string
token: string
peerName: string
language: string
bridge: string;
topic: string;
type: string;
token: string;
peerName: string;
language: string;
}
export interface IUpdateChainParams {
chainId: number
networkId: number
rpcUrl: string
chainId: number;
networkId: number;
rpcUrl: string;
nativeCurrency: {
name: string
symbol: string
}
name: string;
symbol: string;
};
}
export interface IRPCMap {
[chainId: number]: string
[chainId: number]: string;
}
export interface IWalletConnectConnectionOptions {
bridge?: string
qrcode?: boolean
chainId?: number
rpc?: IRPCMap
infuraId?: string
export interface IWCRpcConnectionOptions {
connector?: IConnector;
bridge?: string;
qrcode?: boolean;
chainId?: number;
}
export interface IWCEthRpcConnectionOptions extends IWCRpcConnectionOptions {
rpc?: IRPCMap;
infuraId?: string;
}
export interface IWalletConnectStarkwareProviderOptions extends IWCRpcConnectionOptions {
contractAddress: string;
}
export interface IWalletConnectSDKOptions extends IWalletConnectOptions {
bridge?: string;
}
export interface IWalletConnectProviderOptions extends IWCEthRpcConnectionOptions {
pollingInterval?: number;
}
export interface IRequestOptions {
forcePushNotification?: boolean;
}
export interface IInternalRequestOptions extends IRequestOptions {
topic: string;
}
export interface ICreateSessionOptions {
chainId?: number;
}
export interface IRpcConnection extends NodeJS.EventEmitter {
connected: boolean;
send(payload: any): Promise<any>;
open(): Promise<void>;
close(): Promise<void>;
}
export interface IWCRpcConnection extends IRpcConnection {
bridge: string;
qrcode: boolean;
wc: IConnector | null;
connected: boolean;
create(chainId?: number): void;
onClose(): void;
onError(payload: any, message: string, code?: number): void;
sendPayload(payload: any): Promise<IJsonRpcResponseSuccess | IJsonRpcResponseError>;
}
export interface IQRCodeModal {
open(uri: string, cb: any): void;
close(): void;
}
export interface IMobileRegistryEntry {
name: string;
color: string;
logo: string;
universalLink: string;
deepLink: string;
chromeIntent: string;
}
}
{
"name": "@walletconnect/types",
"version": "1.0.0-next.0",
"version": "1.0.0-rc.0",
"description": "Typescript Types for WalletConnect",
"scripts": {},
"keywords": [
"wallet",
"walletconnect",
"ethereum",
"jsonrpc",
"mobile",
"qrcode",
"web3",
"crypto",
"dapp",
"wallet"
"cryptocurrency",
"dapp"
],

@@ -26,6 +30,3 @@ "author": "WalletConnect <walletconnect.org>",

},
"gitHead": "165f7993c2acc907c653c02847fb02721052c6e7",
"devDependencies": {
"@types/mocha": "^5.2.6"
}
"gitHead": "165f7993c2acc907c653c02847fb02721052c6e7"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc