@ledgerhq/connect-kit 1.1.0-beta.0 → 1.1.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +3 -1
- package/dist/umd/components/ExtensionInstallModal/ExtensionInstallModal.d.ts +4 -0
- package/dist/umd/components/ExtensionInstallModal/index.d.ts +1 -0
- package/dist/umd/components/Modal/Modal.d.ts +1 -1
- package/dist/umd/components/UseLedgerLiveModal/UseLedgerLiveModal.d.ts +8 -0
- package/dist/umd/components/UseLedgerLiveModal/index.d.ts +1 -0
- package/dist/umd/components/index.d.ts +2 -2
- package/dist/umd/index.d.ts +34 -5
- package/dist/umd/index.js +307 -41
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/lib/errors.d.ts +5 -3
- package/dist/umd/lib/modal.d.ts +14 -4
- package/dist/umd/lib/provider.d.ts +11 -8
- package/dist/umd/lib/support.d.ts +9 -13
- package/dist/umd/lib/supportOptions.d.ts +40 -0
- package/dist/umd/providers/ExtensionEvm.d.ts +46 -0
- package/dist/umd/providers/{Solana.d.ts → ExtensionSolana.d.ts} +6 -3
- package/dist/umd/providers/WalletConnectEvm.d.ts +13 -0
- package/dist/umd/providers/WalletConnectLegacy.d.ts +7 -0
- package/dist/umd/support/EthereumProvider/EthereumProvider.d.ts +126 -0
- package/dist/umd/support/EthereumProvider/constants/index.d.ts +2 -0
- package/dist/umd/support/EthereumProvider/constants/rpc.d.ts +4 -0
- package/dist/umd/support/EthereumProvider/constants/values.d.ts +5 -0
- package/dist/umd/support/EthereumProvider/types.d.ts +57 -0
- package/package.json +20 -13
- package/dist/umd/components/ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal.d.ts +0 -7
- package/dist/umd/components/ConnectWithLedgerLiveModal/index.d.ts +0 -1
- package/dist/umd/components/ExtensionUnavailableModal/ExtensionUnavailableModal.d.ts +0 -4
- package/dist/umd/components/ExtensionUnavailableModal/index.d.ts +0 -1
- package/dist/umd/lib/connectSupport.d.ts +0 -2
- package/dist/umd/providers/Ethereum.d.ts +0 -21
- package/dist/umd/providers/TryConnectEthereum.d.ts +0 -7
- package/dist/umd/providers/WalletConnect.d.ts +0 -13
- /package/dist/umd/components/{ExtensionUnavailableModal/ExtensionUnavailableModal.styles.d.ts → ExtensionInstallModal/ExtensionInstallModal.styles.d.ts} +0 -0
- /package/dist/umd/components/{ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal.styles.d.ts → UseLedgerLiveModal/UseLedgerLiveModal.styles.d.ts} +0 -0
package/dist/umd/lib/errors.d.ts
CHANGED
@@ -5,12 +5,14 @@ export declare class ProviderTypeIsNotSupportedError extends Error {
|
|
5
5
|
constructor();
|
6
6
|
}
|
7
7
|
export declare class ProviderRpcError extends Error {
|
8
|
-
code:
|
9
|
-
constructor(code:
|
8
|
+
readonly code: number;
|
9
|
+
constructor(code: number, message: string);
|
10
10
|
toString(): string;
|
11
11
|
}
|
12
12
|
export declare class UserRejectedRequestError extends Error {
|
13
|
-
name: string;
|
14
13
|
readonly code: number;
|
15
14
|
constructor();
|
16
15
|
}
|
16
|
+
export declare class NoServerSideError extends Error {
|
17
|
+
constructor();
|
18
|
+
}
|
package/dist/umd/lib/modal.d.ts
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
type ModalType = '
|
4
|
-
|
1
|
+
import { UseLedgerLiveModalProps } from "../components/UseLedgerLiveModal/UseLedgerLiveModal";
|
2
|
+
import { ExtensionInstallModalProps } from "../components/ExtensionInstallModal/ExtensionInstallModal";
|
3
|
+
type ModalType = 'UseLedgerLiveModal' | 'PlatformNotSupportedModal' | 'ExtensionInstallModal';
|
4
|
+
/**
|
5
|
+
* Shows a modal component.
|
6
|
+
*/
|
7
|
+
export declare function showModal(modalType: ModalType, props?: ExtensionInstallModalProps | UseLedgerLiveModalProps): void;
|
8
|
+
/**
|
9
|
+
* Shows one of two modals depending on if the extension is supported or not.
|
10
|
+
*/
|
11
|
+
export declare function showExtensionOrLLModal(props: {
|
12
|
+
uri: string;
|
13
|
+
onClose: Function;
|
14
|
+
}): void;
|
5
15
|
export {};
|
@@ -1,10 +1,8 @@
|
|
1
|
-
import { EthereumProvider } from "../providers/
|
2
|
-
import { SolanaProvider } from "../providers/
|
3
|
-
export declare
|
4
|
-
|
5
|
-
|
6
|
-
}
|
7
|
-
export declare function isChainIdSupported(chainId: number): boolean;
|
1
|
+
import { EthereumProvider } from "../providers/ExtensionEvm";
|
2
|
+
import { SolanaProvider } from "../providers/ExtensionSolana";
|
3
|
+
export declare const DEFAULT_CHAIN_ID: number;
|
4
|
+
export declare const DEFAULT_REQUIRED_CHAINS: number[];
|
5
|
+
export declare const DEFAULT_WALLETCONNECT_VERSION: number;
|
8
6
|
export declare enum SupportedProviders {
|
9
7
|
Ethereum = "Ethereum",
|
10
8
|
Solana = "Solana"
|
@@ -14,6 +12,11 @@ export declare enum SupportedProviderImplementations {
|
|
14
12
|
WalletConnect = "WalletConnect"
|
15
13
|
}
|
16
14
|
export type ProviderResult = EthereumProvider | SolanaProvider;
|
17
|
-
|
15
|
+
/**
|
16
|
+
* Sets the provider implementation to be used by getProvider.
|
17
|
+
*/
|
18
18
|
export declare function setProviderImplementation(providerImplementation: SupportedProviderImplementations): void;
|
19
|
+
/**
|
20
|
+
* Gets a provider instance based on the implementation set earlier.
|
21
|
+
*/
|
19
22
|
export declare function getProvider(): Promise<ProviderResult>;
|
@@ -1,20 +1,16 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
providerType: SupportedProviders;
|
4
|
-
chainId?: number;
|
5
|
-
bridge?: string;
|
6
|
-
infuraId?: string;
|
7
|
-
rpc?: {
|
8
|
-
[chainId: number]: string;
|
9
|
-
};
|
10
|
-
};
|
1
|
+
import { SupportedProviderImplementations } from "./provider";
|
2
|
+
import { CheckSupportOptions } from "./supportOptions";
|
11
3
|
export type CheckSupportResult = {
|
12
4
|
isLedgerConnectSupported?: boolean;
|
13
5
|
isLedgerConnectEnabled?: boolean;
|
14
6
|
isChainIdSupported?: boolean;
|
15
7
|
providerImplementation: SupportedProviderImplementations;
|
16
8
|
};
|
9
|
+
/**
|
10
|
+
* Check support for user's platform.
|
11
|
+
*/
|
17
12
|
export declare function checkSupport(options: CheckSupportOptions): CheckSupportResult;
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
/**
|
14
|
+
* Gets support results.
|
15
|
+
*/
|
16
|
+
export declare function getSupportResult(): CheckSupportResult;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { CoreTypes } from '@walletconnect/types';
|
2
|
+
import { WalletConnectProviderOptions } from "../providers/WalletConnectEvm";
|
3
|
+
import { WalletConnectLegacyProviderOptions } from '../providers/WalletConnectLegacy';
|
4
|
+
import { SupportedProviders } from "./provider";
|
5
|
+
type CheckSupportCommonOptions = {
|
6
|
+
version?: number;
|
7
|
+
providerType: SupportedProviders;
|
8
|
+
};
|
9
|
+
export type CheckSupportWalletConnectProviderOptions = {
|
10
|
+
projectId?: string;
|
11
|
+
chains?: number[];
|
12
|
+
optionalChains?: number[];
|
13
|
+
methods?: string[];
|
14
|
+
optionalMethods?: string[];
|
15
|
+
events?: string[];
|
16
|
+
optionalEvents?: string[];
|
17
|
+
rpcMap?: {
|
18
|
+
[chainId: string]: string;
|
19
|
+
};
|
20
|
+
metadata?: CoreTypes.Metadata;
|
21
|
+
};
|
22
|
+
export type CheckSupportWalletConnectLegacyProviderOptions = {
|
23
|
+
chainId?: number;
|
24
|
+
bridge?: string;
|
25
|
+
infuraId?: string;
|
26
|
+
rpc?: {
|
27
|
+
[chainId: number]: string;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
export type CheckSupportOptions = CheckSupportCommonOptions & CheckSupportWalletConnectProviderOptions & CheckSupportWalletConnectLegacyProviderOptions;
|
31
|
+
export type ValidatedSupportOptions = CheckSupportOptions & WalletConnectProviderOptions & WalletConnectLegacyProviderOptions;
|
32
|
+
/**
|
33
|
+
* Sets defaults and makes the result available for other modules.
|
34
|
+
*/
|
35
|
+
export declare const setSupportOptions: (options: CheckSupportOptions) => void;
|
36
|
+
/**
|
37
|
+
* Gets the validated support options.
|
38
|
+
*/
|
39
|
+
export declare const getSupportOptions: () => ValidatedSupportOptions;
|
40
|
+
export {};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Device } from "../lib/browser";
|
2
|
+
export declare const EXTENSION_EVM_GLOBAL = "ethereum";
|
3
|
+
export declare const EXTENSION_EVM_PROP = "isLedgerConnect";
|
4
|
+
export declare enum ExtensionSupportedChains {
|
5
|
+
EthereumMainnet = 1,
|
6
|
+
Polygon = 137
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* Checks if the user's platform supports the extension.
|
10
|
+
*/
|
11
|
+
export declare function isExtensionSupported(device: Device): boolean;
|
12
|
+
/**
|
13
|
+
* Checks if the chain id is supported by the extension.
|
14
|
+
*/
|
15
|
+
export declare function isChainIdSupported(chainId: number): boolean;
|
16
|
+
/**
|
17
|
+
* Checks if all the chain ids are supported by the extension.
|
18
|
+
*/
|
19
|
+
export declare function areAllRequiredChainsSupported(chains: number[]): boolean;
|
20
|
+
export type EthereumRequestPayload = {
|
21
|
+
method: string;
|
22
|
+
params?: unknown[] | Record<string, unknown> | undefined;
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* A common interface for all the returned providers.
|
26
|
+
*/
|
27
|
+
export interface EthereumProvider {
|
28
|
+
providers?: EthereumProvider[];
|
29
|
+
connector?: unknown;
|
30
|
+
session?: unknown;
|
31
|
+
request<T = unknown>(args: EthereumRequestPayload): Promise<T>;
|
32
|
+
disconnect?: {
|
33
|
+
(): Promise<void>;
|
34
|
+
};
|
35
|
+
on(event: any, listener: any): void;
|
36
|
+
removeListener(event: string, listener: any): void;
|
37
|
+
}
|
38
|
+
export interface ExtensionEvmProvider extends EthereumProvider {
|
39
|
+
[EXTENSION_EVM_PROP]: boolean;
|
40
|
+
chainId: string;
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Gets the extension provider. In case it does not exist returns an instance
|
44
|
+
* of the install provider.
|
45
|
+
*/
|
46
|
+
export declare function getExtensionProvider(): EthereumProvider;
|
@@ -1,12 +1,15 @@
|
|
1
1
|
import { ProviderResult } from "../lib/provider";
|
2
|
-
export declare const
|
3
|
-
export declare const
|
2
|
+
export declare const EXTENSION_SOLANA_PROVIDER = "solana";
|
3
|
+
export declare const EXTENSION_SOLANA_PROP = "isLedgerConnect";
|
4
4
|
export interface SolanaProvider {
|
5
|
-
[
|
5
|
+
[EXTENSION_SOLANA_PROP]: boolean;
|
6
6
|
signTransaction(...args: unknown[]): Promise<unknown>;
|
7
7
|
signAllTransactions(...args: unknown[]): Promise<unknown>;
|
8
8
|
signAndSendTransaction(...args: unknown[]): Promise<unknown>;
|
9
9
|
connect(): Promise<void>;
|
10
10
|
disconnect(): Promise<void>;
|
11
11
|
}
|
12
|
+
/**
|
13
|
+
* Gets the Solana provider.
|
14
|
+
*/
|
12
15
|
export declare function getSolanaProvider(): ProviderResult;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { default as WalletConnectProvider } from '../support/EthereumProvider/EthereumProvider';
|
2
|
+
import { CheckSupportWalletConnectProviderOptions } from '../lib/supportOptions';
|
3
|
+
/**
|
4
|
+
* Specifies the required options for the provider.
|
5
|
+
*/
|
6
|
+
export type WalletConnectProviderOptions = CheckSupportWalletConnectProviderOptions & {
|
7
|
+
projectId: string;
|
8
|
+
chains: number[];
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* Gets the WalletConnect provider.
|
12
|
+
*/
|
13
|
+
export declare function getWalletConnectProvider(): Promise<WalletConnectProvider>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { EthereumProvider } from './ExtensionEvm';
|
2
|
+
import { CheckSupportWalletConnectLegacyProviderOptions } from '../lib/supportOptions';
|
3
|
+
export type WalletConnectLegacyProviderOptions = CheckSupportWalletConnectLegacyProviderOptions;
|
4
|
+
/**
|
5
|
+
* Gets the legacy WalletConnect provider.
|
6
|
+
*/
|
7
|
+
export declare function getWalletConnectLegacyProvider(): Promise<EthereumProvider>;
|
@@ -0,0 +1,126 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { EventEmitter } from "events";
|
3
|
+
import { IEthereumProvider as IProvider, IEthereumProviderEvents, ProviderAccounts, RequestArguments } from "./types";
|
4
|
+
import { Metadata, Namespace, UniversalProvider } from "@walletconnect/universal-provider/dist/index.umd.js";
|
5
|
+
export type RpcEvent = "accountsChanged" | "chainChanged" | "message" | "disconnect" | "connect";
|
6
|
+
export interface EthereumRpcMap {
|
7
|
+
[chainId: string]: string;
|
8
|
+
}
|
9
|
+
export interface SessionEvent {
|
10
|
+
event: {
|
11
|
+
name: string;
|
12
|
+
data: any;
|
13
|
+
};
|
14
|
+
chainId: string;
|
15
|
+
}
|
16
|
+
export interface EthereumRpcConfig {
|
17
|
+
chains: string[];
|
18
|
+
optionalChains?: string[];
|
19
|
+
methods: string[];
|
20
|
+
optionalMethods?: string[];
|
21
|
+
/**
|
22
|
+
* @description Events that the wallet MUST support or the connection will be rejected
|
23
|
+
*/
|
24
|
+
events: string[];
|
25
|
+
optionalEvents?: string[];
|
26
|
+
rpcMap: EthereumRpcMap;
|
27
|
+
projectId: string;
|
28
|
+
metadata?: Metadata;
|
29
|
+
}
|
30
|
+
export interface ConnectOps {
|
31
|
+
chains?: number[];
|
32
|
+
optionalChains?: number[];
|
33
|
+
rpcMap?: EthereumRpcMap;
|
34
|
+
pairingTopic?: string;
|
35
|
+
}
|
36
|
+
export interface IEthereumProvider extends IProvider {
|
37
|
+
connect(opts?: ConnectOps | undefined): Promise<void>;
|
38
|
+
}
|
39
|
+
export declare function getRpcUrl(chainId: string, rpc: EthereumRpcConfig): string | undefined;
|
40
|
+
export declare function getEthereumChainId(chains: string[]): number;
|
41
|
+
export declare function toHexChainId(chainId: number): string;
|
42
|
+
export type NamespacesParams = {
|
43
|
+
chains: EthereumRpcConfig["chains"];
|
44
|
+
optionalChains?: EthereumRpcConfig["optionalChains"];
|
45
|
+
methods?: EthereumRpcConfig["methods"];
|
46
|
+
optionalMethods?: EthereumRpcConfig["methods"];
|
47
|
+
events?: EthereumRpcConfig["events"];
|
48
|
+
rpcMap: EthereumRpcConfig["rpcMap"];
|
49
|
+
optionalEvents?: EthereumRpcConfig["events"];
|
50
|
+
};
|
51
|
+
export declare function buildNamespaces(params: NamespacesParams): {
|
52
|
+
required: Namespace;
|
53
|
+
optional?: Namespace;
|
54
|
+
};
|
55
|
+
export interface EthereumProviderOptions {
|
56
|
+
projectId: string;
|
57
|
+
/**
|
58
|
+
* @note Chains that your app intents to use and the peer MUST support. If the peer does not support these chains, the connection will be rejected.
|
59
|
+
* @default [1]
|
60
|
+
* @example [1, 3, 4, 5, 42]
|
61
|
+
*/
|
62
|
+
chains: number[];
|
63
|
+
/**
|
64
|
+
* @note Optional chains that your app MAY attempt to use and the peer MAY support. If the peer does not support these chains, the connection will still be established.
|
65
|
+
* @default [1]
|
66
|
+
* @example [1, 3, 4, 5, 42]
|
67
|
+
*/
|
68
|
+
optionalChains?: number[];
|
69
|
+
/**
|
70
|
+
* @note Methods that your app intents to use and the peer MUST support. If the peer does not support these methods, the connection will be rejected.
|
71
|
+
* @default ["eth_sendTransaction", "personal_sign"]
|
72
|
+
*/
|
73
|
+
methods?: string[];
|
74
|
+
/**
|
75
|
+
* @note Methods that your app MAY attempt to use and the peer MAY support. If the peer does not support these methods, the connection will still be established.
|
76
|
+
*/
|
77
|
+
optionalMethods?: string[];
|
78
|
+
events?: string[];
|
79
|
+
optionalEvents?: string[];
|
80
|
+
rpcMap?: EthereumRpcMap;
|
81
|
+
metadata?: Metadata;
|
82
|
+
}
|
83
|
+
export declare class EthereumProvider implements IEthereumProvider {
|
84
|
+
events: EventEmitter;
|
85
|
+
namespace: string;
|
86
|
+
accounts: string[];
|
87
|
+
signer: InstanceType<typeof UniversalProvider>;
|
88
|
+
chainId: number;
|
89
|
+
private rpc;
|
90
|
+
private readonly STORAGE_KEY;
|
91
|
+
constructor();
|
92
|
+
static init(opts: EthereumProviderOptions): Promise<EthereumProvider>;
|
93
|
+
request<T = unknown>(args: RequestArguments): Promise<T>;
|
94
|
+
sendAsync(args: RequestArguments, callback: (error: Error | null, response: any) => void): void;
|
95
|
+
get connected(): boolean;
|
96
|
+
get connecting(): boolean;
|
97
|
+
enable(): Promise<ProviderAccounts>;
|
98
|
+
connect(opts?: ConnectOps): Promise<void>;
|
99
|
+
disconnect(): Promise<void>;
|
100
|
+
on: IEthereumProviderEvents["on"];
|
101
|
+
once: IEthereumProviderEvents["once"];
|
102
|
+
removeListener: IEthereumProviderEvents["removeListener"];
|
103
|
+
off: IEthereumProviderEvents["off"];
|
104
|
+
get isWalletConnect(): boolean;
|
105
|
+
get session(): any;
|
106
|
+
private registerEventListeners;
|
107
|
+
private setHttpProvider;
|
108
|
+
private isCompatibleChainId;
|
109
|
+
private formatChainId;
|
110
|
+
private parseChainId;
|
111
|
+
private setChainIds;
|
112
|
+
private setChainId;
|
113
|
+
private parseAccountId;
|
114
|
+
private setAccounts;
|
115
|
+
private getRpcConfig;
|
116
|
+
private buildRpcMap;
|
117
|
+
private initialize;
|
118
|
+
private loadConnectOpts;
|
119
|
+
private getRpcUrl;
|
120
|
+
private loadPersistedSession;
|
121
|
+
private reset;
|
122
|
+
private persist;
|
123
|
+
private parseAccounts;
|
124
|
+
private parseAccount;
|
125
|
+
}
|
126
|
+
export default EthereumProvider;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { SignClientTypes } from "@walletconnect/types";
|
2
|
+
import { EthereumProvider } from "./EthereumProvider";
|
3
|
+
export interface ProviderRpcError extends Error {
|
4
|
+
message: string;
|
5
|
+
code: number;
|
6
|
+
data?: unknown;
|
7
|
+
}
|
8
|
+
export interface ProviderMessage {
|
9
|
+
type: string;
|
10
|
+
data: unknown;
|
11
|
+
}
|
12
|
+
export interface ProviderInfo {
|
13
|
+
chainId: string;
|
14
|
+
}
|
15
|
+
export interface RequestArguments {
|
16
|
+
method: string;
|
17
|
+
params?: unknown[] | object;
|
18
|
+
}
|
19
|
+
export type ProviderChainId = ProviderInfo["chainId"];
|
20
|
+
export type ProviderAccounts = string[];
|
21
|
+
export interface EIP1102Request extends RequestArguments {
|
22
|
+
method: "eth_requestAccounts";
|
23
|
+
}
|
24
|
+
export declare namespace IProviderEvents {
|
25
|
+
type Event = "connect" | "disconnect" | "message" | "chainChanged" | "accountsChanged" | "session_delete" | "session_event" | "session_update" | "display_uri";
|
26
|
+
interface EventArguments {
|
27
|
+
connect: ProviderInfo;
|
28
|
+
disconnect: ProviderRpcError;
|
29
|
+
message: ProviderMessage;
|
30
|
+
chainChanged: ProviderChainId;
|
31
|
+
accountsChanged: ProviderAccounts;
|
32
|
+
session_delete: {
|
33
|
+
topic: string;
|
34
|
+
};
|
35
|
+
session_event: SignClientTypes.EventArguments["session_event"];
|
36
|
+
session_update: SignClientTypes.EventArguments["session_delete"];
|
37
|
+
display_uri: string;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
export interface IEthereumProviderEvents {
|
41
|
+
on: <E extends IProviderEvents.Event>(event: E, listener: (args: IProviderEvents.EventArguments[E]) => void) => EthereumProvider;
|
42
|
+
once: <E extends IProviderEvents.Event>(event: E, listener: (args: IProviderEvents.EventArguments[E]) => void) => EthereumProvider;
|
43
|
+
off: <E extends IProviderEvents.Event>(event: E, listener: (args: IProviderEvents.EventArguments[E]) => void) => EthereumProvider;
|
44
|
+
removeListener: <E extends IProviderEvents.Event>(event: E, listener: (args: IProviderEvents.EventArguments[E]) => void) => EthereumProvider;
|
45
|
+
emit: <E extends IProviderEvents.Event>(event: E, payload: IProviderEvents.EventArguments[E]) => boolean;
|
46
|
+
}
|
47
|
+
export interface EIP1193Provider {
|
48
|
+
on(event: "connect", listener: (info: ProviderInfo) => void): EthereumProvider;
|
49
|
+
on(event: "disconnect", listener: (error: ProviderRpcError) => void): EthereumProvider;
|
50
|
+
on(event: "message", listener: (message: ProviderMessage) => void): EthereumProvider;
|
51
|
+
on(event: "chainChanged", listener: (chainId: ProviderChainId) => void): EthereumProvider;
|
52
|
+
on(event: "accountsChanged", listener: (accounts: ProviderAccounts) => void): EthereumProvider;
|
53
|
+
request(args: RequestArguments): Promise<unknown>;
|
54
|
+
}
|
55
|
+
export interface IEthereumProvider extends EIP1193Provider {
|
56
|
+
enable(): Promise<ProviderAccounts>;
|
57
|
+
}
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ledgerhq/connect-kit",
|
3
|
-
"version": "1.1.0-beta.
|
3
|
+
"version": "1.1.0-beta.1",
|
4
4
|
"description": "A library for dApps to integrate with the Ledger Extension and Ledger Live",
|
5
|
-
"author": "
|
5
|
+
"author": "Ledger SAS <ledger.com>",
|
6
6
|
"license": "MIT",
|
7
7
|
"main": "dist/umd/index.js",
|
8
|
-
"module": "dist/
|
8
|
+
"module": "dist/esm/index.js",
|
9
9
|
"files": [
|
10
10
|
"dist"
|
11
11
|
],
|
@@ -24,25 +24,32 @@
|
|
24
24
|
"devDependencies": {
|
25
25
|
"@rollup/plugin-commonjs": "^22.0.0",
|
26
26
|
"@rollup/plugin-image": "^2.1.1",
|
27
|
+
"@rollup/plugin-json": "^6.0.0",
|
27
28
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
28
29
|
"@rollup/plugin-replace": "^4.0.0",
|
29
30
|
"@rollup/plugin-typescript": "^8.3.3",
|
30
|
-
"@types/react": "^18.0.
|
31
|
-
"@types/react-dom": "^18.0.
|
31
|
+
"@types/react": "^18.0.0",
|
32
|
+
"@types/react-dom": "^18.0.0",
|
32
33
|
"@types/styled-components": "^5.1.25",
|
34
|
+
"@walletconnect/legacy-provider": "^2.0.0",
|
35
|
+
"@walletconnect/types": "^2.8.0",
|
36
|
+
"@walletconnect/universal-provider": "^2.8.0",
|
37
|
+
"@walletconnect/utils": "^2.8.0",
|
33
38
|
"bowser": "^2.11.0",
|
39
|
+
"events": "^3.3.0",
|
40
|
+
"qrcode.react": "^3.1.0",
|
41
|
+
"react": "^18.0.0",
|
42
|
+
"react-dom": "^18.0.0",
|
34
43
|
"rollup": "^2.75.6",
|
44
|
+
"rollup-plugin-auto-external": "^2.0.0",
|
35
45
|
"rollup-plugin-dts": "^4.2.2",
|
46
|
+
"rollup-plugin-polyfill-node": "^0.12.0",
|
36
47
|
"rollup-plugin-terser": "^7.0.2",
|
48
|
+
"rollup-plugin-url-resolve": "^0.2.0",
|
49
|
+
"rollup-plugin-worker-factory": "^0.5.7",
|
50
|
+
"styled-components": "^5.3.5",
|
37
51
|
"tslib": "^2.4.0",
|
38
52
|
"typescript": "^4.7.3"
|
39
53
|
},
|
40
|
-
"dependencies": {
|
41
|
-
"@walletconnect/ethereum-provider": "^1.8.0",
|
42
|
-
"events": "^3.3.0",
|
43
|
-
"qrcode.react": "^3.1.0",
|
44
|
-
"react": "^18.2.0",
|
45
|
-
"react-dom": "^18.2.0",
|
46
|
-
"styled-components": "^5.3.5"
|
47
|
-
}
|
54
|
+
"dependencies": {}
|
48
55
|
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { ModalProps } from "../Modal/Modal";
|
2
|
-
export type ConnectWithLedgerLiveModalProps = {
|
3
|
-
isDesktop?: boolean;
|
4
|
-
uri?: string;
|
5
|
-
} & ModalProps;
|
6
|
-
declare const ConnectWithLedgerLiveModal: ({ isDesktop, uri, onClose, }: ConnectWithLedgerLiveModalProps) => import("react/jsx-runtime").JSX.Element;
|
7
|
-
export default ConnectWithLedgerLiveModal;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from "./ConnectWithLedgerLiveModal";
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import { ModalProps } from "../Modal/Modal";
|
2
|
-
export type ExtensionUnavailableModalProps = ModalProps;
|
3
|
-
declare const ExtensionUnavailableModal: ({ onClose, }: ExtensionUnavailableModalProps) => import("react/jsx-runtime").JSX.Element;
|
4
|
-
export default ExtensionUnavailableModal;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from "./ExtensionUnavailableModal";
|
@@ -1,21 +0,0 @@
|
|
1
|
-
export declare const LEDGER_ETHEREUM_PROVIDER = "ethereum";
|
2
|
-
export declare const LEDGER_CONNECT_ETHEREUM_PROP = "isLedgerConnect";
|
3
|
-
export type EthereumRequestPayload = {
|
4
|
-
method: string;
|
5
|
-
params?: unknown[] | object;
|
6
|
-
};
|
7
|
-
export interface EthereumProvider {
|
8
|
-
providers?: EthereumProvider[];
|
9
|
-
connector?: unknown;
|
10
|
-
request<T = unknown>(args: EthereumRequestPayload): Promise<T>;
|
11
|
-
disconnect?: {
|
12
|
-
(): Promise<void>;
|
13
|
-
};
|
14
|
-
emit(eventName: string | symbol, ...args: any[]): boolean;
|
15
|
-
on(event: any, listener: any): void;
|
16
|
-
removeListener(event: string, listener: any): void;
|
17
|
-
}
|
18
|
-
export interface LedgerConnectProvider extends EthereumProvider {
|
19
|
-
[LEDGER_CONNECT_ETHEREUM_PROP]: boolean;
|
20
|
-
}
|
21
|
-
export declare function getEthereumProvider(): EthereumProvider;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import EventEmitter from "events";
|
3
|
-
import { EthereumRequestPayload } from "./Ethereum";
|
4
|
-
export declare class TryConnectEthereumProvider extends EventEmitter {
|
5
|
-
constructor();
|
6
|
-
request(payload: EthereumRequestPayload): never[] | Promise<unknown>;
|
7
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { EthereumProvider } from './Ethereum';
|
2
|
-
export interface initWalletConnectProviderOptions {
|
3
|
-
chainId?: number;
|
4
|
-
bridge?: string;
|
5
|
-
infuraId?: string;
|
6
|
-
rpc?: {
|
7
|
-
[chainId: number]: string;
|
8
|
-
};
|
9
|
-
}
|
10
|
-
export declare function setWalletConnectOptions(options: initWalletConnectProviderOptions): void;
|
11
|
-
export declare function initWalletConnectProvider(): Promise<void>;
|
12
|
-
export declare function isWalletConnectProviderConnected(): boolean;
|
13
|
-
export declare function getWalletConnectProvider(): Promise<EthereumProvider>;
|
File without changes
|