@rango-dev/widget-embedded 0.29.1-next.12 → 0.29.1-next.13
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/dist/hooks/useWalletList.d.ts +2 -1
- package/dist/hooks/useWalletList.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/widget-embedded.build.json +1 -1
- package/package.json +2 -2
- package/src/hooks/useWalletList.ts +6 -3
- package/src/index.ts +4 -0
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ interface Params {
|
|
|
28
28
|
chain?: string;
|
|
29
29
|
onBeforeConnect?: (walletType: string) => void;
|
|
30
30
|
onConnect?: (walletType: string) => void;
|
|
31
|
+
onError?: (error?: string) => void;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -36,7 +37,7 @@ interface Params {
|
|
|
36
37
|
* you can use this list whenever you need to show the list of wallets and needed callbacks
|
|
37
38
|
*/
|
|
38
39
|
export function useWalletList(params: Params) {
|
|
39
|
-
const { chain, onBeforeConnect, onConnect } = params;
|
|
40
|
+
const { chain, onBeforeConnect, onConnect, onError } = params;
|
|
40
41
|
const { config } = useAppStore();
|
|
41
42
|
const { state, disconnect, getWalletInfo, connect } = useWallets();
|
|
42
43
|
const { connectedWallets } = useWalletsStore();
|
|
@@ -90,8 +91,10 @@ export function useWalletList(params: Params) {
|
|
|
90
91
|
await connect(type, undefined, namespaces);
|
|
91
92
|
onConnect?.(type);
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
} catch (e: any) {
|
|
96
|
+
onError?.(e?.message);
|
|
97
|
+
setError('Error: ' + e?.message);
|
|
95
98
|
}
|
|
96
99
|
};
|
|
97
100
|
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
QuoteEventData,
|
|
6
6
|
Tokens,
|
|
7
7
|
WalletEventData,
|
|
8
|
+
WalletInfoWithNamespaces,
|
|
8
9
|
WidgetColors,
|
|
9
10
|
WidgetColorsKeys,
|
|
10
11
|
WidgetConfig,
|
|
@@ -64,6 +65,7 @@ import { WidgetWallets } from './containers/Wallets';
|
|
|
64
65
|
import { Widget } from './containers/Widget';
|
|
65
66
|
import { useWidget } from './containers/WidgetInfo';
|
|
66
67
|
import { WidgetProvider } from './containers/WidgetProvider';
|
|
68
|
+
import { useWalletList } from './hooks/useWalletList';
|
|
67
69
|
import { useWidgetEvents } from './hooks/useWidgetEvents';
|
|
68
70
|
import { widgetEventEmitter } from './services/eventEmitter';
|
|
69
71
|
import {
|
|
@@ -106,6 +108,7 @@ export type {
|
|
|
106
108
|
WidgetVariant,
|
|
107
109
|
WalletEventData,
|
|
108
110
|
QuoteEventData,
|
|
111
|
+
WalletInfoWithNamespaces,
|
|
109
112
|
};
|
|
110
113
|
export {
|
|
111
114
|
Widget,
|
|
@@ -120,6 +123,7 @@ export {
|
|
|
120
123
|
* @deprecated Use `widgetEventEmitter` instead. This hook will be removed in future versions.
|
|
121
124
|
*/
|
|
122
125
|
useWidgetEvents,
|
|
126
|
+
useWalletList,
|
|
123
127
|
customizedThemeTokens,
|
|
124
128
|
widgetEventEmitter,
|
|
125
129
|
WidgetEvents,
|