@babylonlabs-io/wallet-connector 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,7 @@
18
18
  - [Wallet Integration](#wallet-integration)
19
19
  - [1. Browser extension wallets](#1-browser-extension-wallets)
20
20
  - [2. Mobile wallets](#2-mobile-wallets)
21
+ - [IProvider](#iprovider)
21
22
  - [IBTCProvider](#ibtcprovider)
22
23
  - [IBBNProvider](#ibbnprovider)
23
24
 
@@ -95,6 +96,7 @@ implemented for integration with the Babylon staking app.
95
96
  export interface IProvider {
96
97
  /**
97
98
  * Connects to the wallet and returns the instance of the wallet provider.
99
+ * Currently Bitcoin only supports Native SegWit and Taproot address types.
98
100
  * @returns A promise that resolves to an instance of the wrapper wallet provider.
99
101
  * @throws An error if the wallet is not installed or if connection fails.
100
102
  */
@@ -3,6 +3,7 @@ interface WalletDialogProps {
3
3
  onError?: (e: Error) => void;
4
4
  storage: HashMap;
5
5
  config: any;
6
+ persistent: boolean;
6
7
  }
7
- export declare function WalletDialog({ storage, config, onError }: WalletDialogProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function WalletDialog({ persistent, storage, config, onError }: WalletDialogProps): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -2,10 +2,11 @@ import { PropsWithChildren } from 'react';
2
2
  import { ChainConfigArr } from '../../context/Chain.context';
3
3
  import { LifeCycleHooksProps } from '../../context/LifecycleHooks.context';
4
4
  interface WalletProviderProps {
5
+ persistent?: boolean;
5
6
  lifecycleHooks?: LifeCycleHooksProps;
6
7
  context?: any;
7
8
  config: Readonly<ChainConfigArr>;
8
9
  onError?: (e: Error) => void;
9
10
  }
10
- export declare function WalletProvider({ lifecycleHooks, children, config, context, onError, }: PropsWithChildren<WalletProviderProps>): import("react/jsx-runtime").JSX.Element;
11
+ export declare function WalletProvider({ persistent, lifecycleHooks, children, config, context, onError, }: PropsWithChildren<WalletProviderProps>): import("react/jsx-runtime").JSX.Element;
11
12
  export {};
@@ -10,6 +10,7 @@ interface ChainConfig<K extends string = string, P extends IProvider = IProvider
10
10
  }
11
11
  export type ChainConfigArr = (ChainConfig<"BTC", IBTCProvider, BTCConfig> | ChainConfig<"BBN", IBBNProvider, BBNConfig>)[];
12
12
  interface ProviderProps {
13
+ persistent: boolean;
13
14
  storage: HashMap;
14
15
  context: any;
15
16
  config: Readonly<ChainConfigArr>;
@@ -20,6 +21,6 @@ export interface Connectors {
20
21
  BBN: WalletConnector<"BBN", IBBNProvider, BBNConfig> | null;
21
22
  }
22
23
  export declare const Context: import('react').Context<Connectors>;
23
- export declare function ChainProvider({ storage, children, context, config, onError }: PropsWithChildren<ProviderProps>): import("react/jsx-runtime").JSX.Element;
24
+ export declare function ChainProvider({ persistent, storage, children, context, config, onError, }: PropsWithChildren<ProviderProps>): import("react/jsx-runtime").JSX.Element;
24
25
  export declare const useChainProviders: () => Connectors;
25
26
  export {};
@@ -3,4 +3,4 @@ import { WalletConnector } from './WalletConnector';
3
3
  import { ExternalWalletProps, IProvider, WalletConnectorProps, WalletProps } from './types';
4
4
  export declare const createWallet: <P extends IProvider, C>({ metadata, context, config }: WalletProps<P, C>) => Promise<Wallet<P>>;
5
5
  export declare const createExternalWallet: <P extends IProvider>({ id, name, icon, provider }: ExternalWalletProps<P>) => Wallet<P>;
6
- export declare const createWalletConnector: <N extends string, P extends IProvider, C>({ metadata, context, config, accountStorage, }: WalletConnectorProps<N, P, C>) => Promise<WalletConnector<N, P, C>>;
6
+ export declare const createWalletConnector: <N extends string, P extends IProvider, C>({ persistent, metadata, context, config, accountStorage, }: WalletConnectorProps<N, P, C>) => Promise<WalletConnector<N, P, C>>;
@@ -96,6 +96,7 @@ export interface ExternalWalletProps<P extends IProvider> {
96
96
  provider: P;
97
97
  }
98
98
  export interface WalletConnectorProps<N extends string, P extends IProvider, C> {
99
+ persistent: boolean;
99
100
  metadata: ChainMetadata<N, P, C>;
100
101
  context: any;
101
102
  config: C;
@@ -17,7 +17,15 @@ export declare class KeystoneProvider implements IBTCProvider {
17
17
  signPsbt: (psbtHex: string) => Promise<string>;
18
18
  signPsbts: (psbtsHexes: string[]) => Promise<string[]>;
19
19
  getNetwork: () => Promise<Network>;
20
- signMessage: (message: string, type: "ecdsa") => Promise<string>;
20
+ signMessage: (message: string, type: "bip322-simple" | "ecdsa") => Promise<string>;
21
+ /**
22
+ * https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
23
+ * signMessageBIP322 signs a message using the BIP322 standard.
24
+ * @param message
25
+ * @returns signature
26
+ */
27
+ signMessageBIP322: (message: string) => Promise<string>;
28
+ signMessageECDSA: (message: string) => Promise<string>;
21
29
  getInscriptions: () => Promise<InscriptionIdentifier[]>;
22
30
  on: () => void;
23
31
  off: () => void;
@@ -1,9 +1,10 @@
1
1
  import { HashMap, IChain, IWallet } from '../core/types';
2
2
  interface Props {
3
+ persistent: boolean;
3
4
  accountStorage: HashMap;
4
5
  onError?: (e: Error) => void;
5
6
  }
6
- export declare function useWalletConnectors({ accountStorage, onError }: Props): {
7
+ export declare function useWalletConnectors({ persistent, accountStorage, onError }: Props): {
7
8
  connect: (chain: IChain, wallet: IWallet) => Promise<void>;
8
9
  disconnect: (chainId: string) => Promise<void>;
9
10
  };