@babylonlabs-io/wallet-connector 0.4.1 → 0.4.2
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 +25 -0
- package/dist/components/WalletProvider/index.d.ts +3 -1
- package/dist/context/LifecycleHooks.context.d.ts +9 -0
- package/dist/core/types.d.ts +22 -0
- package/dist/core/wallets/bbn/keplr/provider.d.ts +3 -0
- package/dist/core/wallets/bbn/leap/provider.d.ts +3 -0
- package/dist/core/wallets/bbn/okx/provider.d.ts +3 -0
- package/dist/index.cjs.js +21 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2402 -2314
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -219,6 +219,31 @@ export interface IBBNProvider extends IProvider {
|
|
|
219
219
|
* @throws {Error} If wallet connection is not established or signer cannot be retrieved
|
|
220
220
|
*/
|
|
221
221
|
getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Retrieves an offline signer that supports either Amino or Direct signing methods.
|
|
225
|
+
* This is required for compatibility with older wallets and hardware wallets (like Ledger) that do not support both signing methods.
|
|
226
|
+
* This signer is used for signing transactions offline before broadcasting them to the network.
|
|
227
|
+
*
|
|
228
|
+
* @returns {Promise<OfflineAminoSigner & OfflineDirectSigner>} A promise that resolves to a signer supporting either Amino or Direct signing
|
|
229
|
+
* @throws {Error} If wallet connection is not established or signer cannot be retrieved
|
|
230
|
+
*/
|
|
231
|
+
getOfflineSignerAuto?(): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Registers an event listener for the specified event.
|
|
235
|
+
* At the moment, only the "accountChanged" event is supported.
|
|
236
|
+
* @param eventName - The name of the event to listen for.
|
|
237
|
+
* @param callBack - The callback function to be executed when the event occurs.
|
|
238
|
+
*/
|
|
239
|
+
on(eventName: string, callBack: () => void): void;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Unregisters an event listener for the specified event.
|
|
243
|
+
* @param eventName - The name of the event to listen for.
|
|
244
|
+
* @param callBack - The callback function to be executed when the event occurs.
|
|
245
|
+
*/
|
|
246
|
+
off(eventName: string, callBack: () => void): void;
|
|
222
247
|
}
|
|
223
248
|
```
|
|
224
249
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { ChainConfigArr } from '../../context/Chain.context';
|
|
3
|
+
import { LifeCycleHooksProps } from '../../context/LifecycleHooks.context';
|
|
3
4
|
interface WalletProviderProps {
|
|
5
|
+
lifecycleHooks?: LifeCycleHooksProps;
|
|
4
6
|
context?: any;
|
|
5
7
|
config: Readonly<ChainConfigArr>;
|
|
6
8
|
onError?: (e: Error) => void;
|
|
7
9
|
}
|
|
8
|
-
export declare function WalletProvider({ children, config, context, onError, }: PropsWithChildren<WalletProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function WalletProvider({ lifecycleHooks, children, config, context, onError, }: PropsWithChildren<WalletProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface LifeCycleHooksProps {
|
|
3
|
+
verifyBTCAddress?: (address: string) => Promise<boolean>;
|
|
4
|
+
acceptTermsOfService?: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function LifeCycleHooksProvider({ children, value }: PropsWithChildren<{
|
|
7
|
+
value?: LifeCycleHooksProps;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useLifeCycleHooks: () => LifeCycleHooksProps;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -211,4 +211,26 @@ export interface IBBNProvider extends IProvider {
|
|
|
211
211
|
* @throws {Error} If wallet connection is not established or signer cannot be retrieved
|
|
212
212
|
*/
|
|
213
213
|
getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
|
|
214
|
+
/**
|
|
215
|
+
* Retrieves an offline signer that supports either Amino or Direct signing methods.
|
|
216
|
+
* This is required for compatibility with older wallets and hardware wallets (like Ledger) that do not support both signing methods.
|
|
217
|
+
* This signer is used for signing transactions offline before broadcasting them to the network.
|
|
218
|
+
*
|
|
219
|
+
* @returns {Promise<OfflineAminoSigner & OfflineDirectSigner>} A promise that resolves to a signer supporting either Amino or Direct signing
|
|
220
|
+
* @throws {Error} If wallet connection is not established or signer cannot be retrieved
|
|
221
|
+
*/
|
|
222
|
+
getOfflineSignerAuto?(): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
223
|
+
/**
|
|
224
|
+
* Registers an event listener for the specified event.
|
|
225
|
+
* At the moment, only the "accountChanged" event is supported.
|
|
226
|
+
* @param eventName - The name of the event to listen for.
|
|
227
|
+
* @param callBack - The callback function to be executed when the event occurs.
|
|
228
|
+
*/
|
|
229
|
+
on(eventName: string, callBack: () => void): void;
|
|
230
|
+
/**
|
|
231
|
+
* Unregisters an event listener for the specified event.
|
|
232
|
+
* @param eventName - The name of the event to listen for.
|
|
233
|
+
* @param callBack - The callback function to be executed when the event occurs.
|
|
234
|
+
*/
|
|
235
|
+
off(eventName: string, callBack: () => void): void;
|
|
214
236
|
}
|
|
@@ -19,4 +19,7 @@ export declare class KeplrProvider implements IBBNProvider {
|
|
|
19
19
|
getWalletProviderName(): Promise<string>;
|
|
20
20
|
getWalletProviderIcon(): Promise<string>;
|
|
21
21
|
getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
|
|
22
|
+
getOfflineSignerAuto(): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
23
|
+
on: (eventName: string, callBack: () => void) => void;
|
|
24
|
+
off: (eventName: string, callBack: () => void) => void;
|
|
22
25
|
}
|
|
@@ -14,4 +14,7 @@ export declare class LeapProvider implements IBBNProvider {
|
|
|
14
14
|
getWalletProviderName(): Promise<string>;
|
|
15
15
|
getWalletProviderIcon(): Promise<string>;
|
|
16
16
|
getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
|
|
17
|
+
getOfflineSignerAuto(): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
18
|
+
on: (eventName: string, callBack: () => void) => void;
|
|
19
|
+
off: (eventName: string, callBack: () => void) => void;
|
|
17
20
|
}
|
|
@@ -14,4 +14,7 @@ export declare class OKXBabylonProvider implements IBBNProvider {
|
|
|
14
14
|
getWalletProviderName(): Promise<string>;
|
|
15
15
|
getWalletProviderIcon(): Promise<string>;
|
|
16
16
|
getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
|
|
17
|
+
getOfflineSignerAuto(): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
18
|
+
on: (eventName: string, callBack: () => void) => void;
|
|
19
|
+
off: (eventName: string, callBack: () => void) => void;
|
|
17
20
|
}
|