@ledgerhq/connect-kit 1.0.0-beta.1 → 1.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/README.md +2 -1
  3. package/dist/umd/components/ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal.d.ts +7 -0
  4. package/dist/umd/components/ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal.styles.d.ts +3 -0
  5. package/dist/umd/components/ConnectWithLedgerLiveModal/index.d.ts +1 -0
  6. package/dist/umd/components/ExtensionUnavailableModal/ExtensionUnavailableModal.d.ts +3 -0
  7. package/dist/umd/components/ExtensionUnavailableModal/ExtensionUnavailableModal.styles.d.ts +1 -0
  8. package/dist/umd/components/ExtensionUnavailableModal/index.d.ts +1 -0
  9. package/dist/umd/components/Modal/Backdrop.styles.d.ts +1 -0
  10. package/dist/umd/components/Modal/Modal.d.ts +8 -0
  11. package/dist/umd/components/Modal/Modal.styles.d.ts +18 -0
  12. package/dist/umd/components/Modal/index.d.ts +1 -0
  13. package/dist/umd/components/NeedALedgerSection/NeedALedgerSection.d.ts +4 -0
  14. package/dist/umd/components/NeedALedgerSection/NeedALedgerSection.styles.d.ts +5 -0
  15. package/dist/umd/components/NeedALedgerSection/index.d.ts +1 -0
  16. package/dist/umd/components/PlatformNotSupportedModal/PlatformNotSupportedModal.d.ts +3 -0
  17. package/dist/umd/components/PlatformNotSupportedModal/PlatformNotSupportedModal.styles.d.ts +2 -0
  18. package/dist/umd/components/PlatformNotSupportedModal/index.d.ts +1 -0
  19. package/dist/umd/components/index.d.ts +3 -0
  20. package/dist/umd/index.d.ts +53 -0
  21. package/dist/umd/index.js +62 -0
  22. package/dist/umd/index.js.map +1 -0
  23. package/dist/umd/lib/browser.d.ts +18 -0
  24. package/dist/umd/lib/connectSupport.d.ts +2 -0
  25. package/dist/umd/lib/errors.d.ts +6 -0
  26. package/dist/umd/lib/logger.d.ts +4 -0
  27. package/dist/umd/lib/modal.d.ts +4 -0
  28. package/dist/umd/lib/provider.d.ts +20 -0
  29. package/dist/umd/lib/support.d.ts +20 -0
  30. package/dist/umd/providers/Ethereum.d.ts +13 -0
  31. package/dist/umd/providers/Solana.d.ts +12 -0
  32. package/dist/umd/providers/WalletConnect.d.ts +12 -0
  33. package/package.json +5 -4
@@ -0,0 +1,18 @@
1
+ declare type DeviceOS = {
2
+ name: DeviceOSName;
3
+ version: string;
4
+ };
5
+ declare type DeviceBrowser = {
6
+ name: DeviceBrowserName;
7
+ version: string;
8
+ };
9
+ declare type DeviceOSName = "Windows Phone" | "Windows" | "macOS" | "iOS" | "Android" | "Linux" | "Chrome OS";
10
+ declare type DeviceBrowserName = "Android Browser" | "Chrome" | "Chromium" | "Firefox" | "Microsoft Edge" | "Opera" | "Safari";
11
+ declare type DeviceType = "desktop" | "mobile" | "tablet";
12
+ export declare type Device = {
13
+ os: DeviceOS;
14
+ type: DeviceType;
15
+ browser: DeviceBrowser;
16
+ };
17
+ export declare function getBrowser(): Device;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Device } from "./browser";
2
+ export declare function isLedgerConnectSupported(device: Device): boolean;
@@ -0,0 +1,6 @@
1
+ export declare class ProviderNotFoundError extends Error {
2
+ constructor();
3
+ }
4
+ export declare class ProviderTypeIsNotSupportedError extends Error {
5
+ constructor();
6
+ }
@@ -0,0 +1,4 @@
1
+ export declare type Logger = (message: string, ...others: unknown[]) => void;
2
+ export declare const getDebugLogger: (context: string) => Logger;
3
+ export declare const getErrorLogger: (context: string) => Logger;
4
+ export declare const enableDebugLogs: () => void;
@@ -0,0 +1,4 @@
1
+ import { ConnectWithLedgerLiveModalProps } from "../components/ConnectWithLedgerLiveModal/ConnectWithLedgerLiveModal";
2
+ declare type ModalType = 'ConnectWithLedgerLiveModal' | 'PlatformNotSupportedModal' | 'ExtensionUnavailableModal';
3
+ export declare function showModal(modalType: ModalType, props?: ConnectWithLedgerLiveModalProps): void;
4
+ export {};
@@ -0,0 +1,20 @@
1
+ import WalletConnectProvider from "@walletconnect/ethereum-provider/dist/esm";
2
+ import { EthereumProvider } from "../providers/Ethereum";
3
+ import { SolanaProvider } from "../providers/Solana";
4
+ export declare enum ConnectSupportedChains {
5
+ EthereumMainnet = 1
6
+ }
7
+ export declare function setChainId(chainId: ConnectSupportedChains): void;
8
+ export declare function isChainIdSupported(chainId: ConnectSupportedChains): boolean;
9
+ export declare enum SupportedProviders {
10
+ Ethereum = "Ethereum",
11
+ Solana = "Solana"
12
+ }
13
+ export declare enum SupportedProviderImplementations {
14
+ LedgerConnect = "LedgerConnect",
15
+ WalletConnect = "WalletConnect"
16
+ }
17
+ export declare type ProviderResult = EthereumProvider | SolanaProvider | WalletConnectProvider;
18
+ export declare function setProviderType(providerType: SupportedProviders): void;
19
+ export declare function setProviderImplementation(providerImplementation: SupportedProviderImplementations): void;
20
+ export declare function getProvider(): Promise<ProviderResult>;
@@ -0,0 +1,20 @@
1
+ import { ConnectSupportedChains, SupportedProviders, SupportedProviderImplementations } from "./provider";
2
+ export declare type CheckSupportOptions = {
3
+ providerType: SupportedProviders;
4
+ chainId?: ConnectSupportedChains;
5
+ bridge?: string;
6
+ infuraId?: string;
7
+ rpc: {
8
+ [chainId: number]: string;
9
+ };
10
+ };
11
+ export declare type CheckSupportResult = {
12
+ isLedgerConnectSupported?: boolean;
13
+ isLedgerConnectEnabled?: boolean;
14
+ isChainIdSupported?: boolean;
15
+ providerImplementation: SupportedProviderImplementations;
16
+ };
17
+ export declare function checkSupport(options: CheckSupportOptions): CheckSupportResult;
18
+ export declare type CheckEthereumSupportOptions = CheckSupportOptions & {
19
+ chainId: ConnectSupportedChains;
20
+ };
@@ -0,0 +1,13 @@
1
+ import { ProviderResult } from "../lib/provider";
2
+ export declare const LEDGER_ETHEREUM_PROVIDER = "ethereum";
3
+ export declare const LEDGER_CONNECT_ETHEREUM_PROP = "isLedgerConnect";
4
+ export interface EthereumProvider {
5
+ providers?: EthereumProvider[];
6
+ request(...args: unknown[]): Promise<unknown>;
7
+ on(...args: unknown[]): void;
8
+ removeListener(...args: unknown[]): void;
9
+ }
10
+ export interface LedgerConnectProvider extends EthereumProvider {
11
+ [LEDGER_CONNECT_ETHEREUM_PROP]: boolean;
12
+ }
13
+ export declare function getEthereumProvider(): ProviderResult;
@@ -0,0 +1,12 @@
1
+ import { ProviderResult } from "../lib/provider";
2
+ export declare const LEDGER_SOLANA_PROVIDER = "solana";
3
+ export declare const LEDGER_CONNECT_SOLANA_PROP = "isLedgerConnect";
4
+ export interface SolanaProvider {
5
+ [LEDGER_CONNECT_SOLANA_PROP]: boolean;
6
+ signTransaction(...args: unknown[]): Promise<unknown>;
7
+ signAllTransactions(...args: unknown[]): Promise<unknown>;
8
+ signAndSendTransaction(...args: unknown[]): Promise<unknown>;
9
+ connect(): Promise<void>;
10
+ disconnect(): Promise<void>;
11
+ }
12
+ export declare function getSolanaProvider(): ProviderResult;
@@ -0,0 +1,12 @@
1
+ import { EthereumProvider } from './Ethereum';
2
+ export interface initWalletConnectProviderOptions {
3
+ bridge?: string;
4
+ infuraId?: string;
5
+ rpc?: {
6
+ [chainId: number]: string;
7
+ };
8
+ chainId?: number;
9
+ }
10
+ export declare function initWalletConnectProvider(options: initWalletConnectProviderOptions): void;
11
+ export declare function isWalletConnectProviderConnected(): boolean;
12
+ export declare function getWalletConnectProvider(): Promise<EthereumProvider>;
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@ledgerhq/connect-kit",
3
- "version": "1.0.0-beta.1",
4
- "description": "",
3
+ "version": "1.0.0-beta.3",
4
+ "description": "A library for dapps to integrate with Ledger Connect and Ledger Live",
5
+ "author": "Hugo Lopes",
6
+ "license": "MIT",
5
7
  "main": "dist/umd/index.js",
6
8
  "module": "dist/umd/index.js",
7
9
  "files": [
8
10
  "dist"
9
11
  ],
10
12
  "types": "dist/index.d.ts",
13
+ "homepage": "https://get-connect.ledger.com",
11
14
  "repository": {
12
15
  "type": "git",
13
16
  "url": "https://github.com/LedgerHQ/connect-kit",
@@ -18,8 +21,6 @@
18
21
  "rollup": "rollup -c",
19
22
  "build": "rollup -c --compact"
20
23
  },
21
- "author": "",
22
- "license": "ISC",
23
24
  "devDependencies": {
24
25
  "@rollup/plugin-commonjs": "^22.0.0",
25
26
  "@rollup/plugin-image": "^2.1.1",