@ledgerhq/connect-kit 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,11 @@ export declare class ProviderNotFoundError extends Error {
4
4
  export declare class ProviderTypeIsNotSupportedError extends Error {
5
5
  constructor();
6
6
  }
7
+ export declare class ProviderRpcError extends Error {
8
+ code: any;
9
+ constructor(code: any, message: string);
10
+ toString(): string;
11
+ }
7
12
  export declare class UserRejectedRequestError extends Error {
8
13
  name: string;
9
14
  readonly code: number;
@@ -1,4 +1,5 @@
1
1
  import { ConnectWithLedgerLiveModalProps } from "../components/ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal";
2
+ import { ExtensionUnavailableModalProps } from "../components/ExtensionUnavailableModal/ExtensionUnavailableModal";
2
3
  type ModalType = 'ConnectWithLedgerLiveModal' | 'PlatformNotSupportedModal' | 'ExtensionUnavailableModal';
3
- export declare function showModal(modalType: ModalType, props?: ConnectWithLedgerLiveModalProps): void;
4
+ export declare function showModal(modalType: ModalType, props?: ExtensionUnavailableModalProps | ConnectWithLedgerLiveModalProps): void;
4
5
  export {};
@@ -1,4 +1,3 @@
1
- import WalletConnectProvider from "@walletconnect/ethereum-provider/dist/esm";
2
1
  import { EthereumProvider } from "../providers/Ethereum";
3
2
  import { SolanaProvider } from "../providers/Solana";
4
3
  export declare enum ConnectSupportedChains {
@@ -13,7 +12,7 @@ export declare enum SupportedProviderImplementations {
13
12
  LedgerConnect = "LedgerConnect",
14
13
  WalletConnect = "WalletConnect"
15
14
  }
16
- export type ProviderResult = EthereumProvider | SolanaProvider | WalletConnectProvider;
15
+ export type ProviderResult = EthereumProvider | SolanaProvider;
17
16
  export declare function setProviderType(providerType: SupportedProviders): void;
18
17
  export declare function setProviderImplementation(providerImplementation: SupportedProviderImplementations): void;
19
18
  export declare function getProvider(): Promise<ProviderResult>;
@@ -1,4 +1,3 @@
1
- import { ProviderResult } from "../lib/provider";
2
1
  export declare const LEDGER_ETHEREUM_PROVIDER = "ethereum";
3
2
  export declare const LEDGER_CONNECT_ETHEREUM_PROP = "isLedgerConnect";
4
3
  export type EthereumRequestPayload = {
@@ -7,7 +6,7 @@ export type EthereumRequestPayload = {
7
6
  };
8
7
  export interface EthereumProvider {
9
8
  providers?: EthereumProvider[];
10
- request(payload: EthereumRequestPayload): Promise<unknown>;
9
+ request<T = unknown>(args: EthereumRequestPayload): Promise<T>;
11
10
  disconnect?: {
12
11
  (): Promise<void>;
13
12
  };
@@ -18,4 +17,4 @@ export interface EthereumProvider {
18
17
  export interface LedgerConnectProvider extends EthereumProvider {
19
18
  [LEDGER_CONNECT_ETHEREUM_PROP]: boolean;
20
19
  }
21
- export declare function getEthereumProvider(): ProviderResult;
20
+ export declare function getEthereumProvider(): EthereumProvider;
@@ -0,0 +1,7 @@
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
+ }
@@ -7,6 +7,7 @@ export interface initWalletConnectProviderOptions {
7
7
  [chainId: number]: string;
8
8
  };
9
9
  }
10
- export declare function initWalletConnectProvider(options: initWalletConnectProviderOptions): void;
10
+ export declare function setWalletConnectOptions(options: initWalletConnectProviderOptions): void;
11
+ export declare function initWalletConnectProvider(): Promise<void>;
11
12
  export declare function isWalletConnectProviderConnected(): boolean;
12
13
  export declare function getWalletConnectProvider(): Promise<EthereumProvider>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/connect-kit",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A library for dapps to integrate with Ledger Connect and Ledger Live",
5
5
  "author": "Hugo Lopes",
6
6
  "license": "MIT",
@@ -38,10 +38,11 @@
38
38
  "typescript": "^4.7.3"
39
39
  },
40
40
  "dependencies": {
41
+ "@walletconnect/ethereum-provider": "^1.8.0",
42
+ "events": "^3.3.0",
43
+ "qrcode.react": "^3.1.0",
41
44
  "react": "^18.2.0",
42
45
  "react-dom": "^18.2.0",
43
- "styled-components": "^5.3.5",
44
- "@walletconnect/ethereum-provider": "^1.8.0",
45
- "qrcode.react": "^3.1.0"
46
+ "styled-components": "^5.3.5"
46
47
  }
47
48
  }