@dynamic-labs/wallet-book 4.0.0-alpha.4 → 4.0.0-alpha.41

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +361 -0
  2. package/README.md +1 -1
  3. package/package.cjs +8 -0
  4. package/package.js +4 -0
  5. package/package.json +7 -13
  6. package/src/build/sources/walletConnectOverrides/index.d.ts +26 -0
  7. package/src/components/WalletIcon.cjs +15 -7
  8. package/src/components/WalletIcon.d.ts +278 -3
  9. package/src/components/WalletIcon.js +17 -9
  10. package/src/helpers/getWalletBookWallet.d.ts +1 -1
  11. package/src/helpers/getWalletIconData.cjs +39 -0
  12. package/src/helpers/getWalletIconData.d.ts +5 -0
  13. package/src/helpers/getWalletIconData.js +35 -0
  14. package/src/helpers/index.d.ts +1 -4
  15. package/src/hooks/fetchWalletBook/fetchWalletBook.cjs +49 -0
  16. package/src/hooks/fetchWalletBook/fetchWalletBook.d.ts +97 -0
  17. package/src/hooks/fetchWalletBook/fetchWalletBook.js +39 -0
  18. package/src/hooks/fetchWalletBook/index.d.ts +1 -0
  19. package/src/hooks/useWalletBookCdn.cjs +22 -38
  20. package/src/hooks/useWalletBookCdn.js +22 -38
  21. package/src/index.cjs +5 -10
  22. package/src/index.d.ts +1 -2
  23. package/src/index.js +5 -5
  24. package/wallet-book-fallbacks.cjs +125 -5
  25. package/wallet-book-fallbacks.js +125 -5
  26. package/src/helpers/getWalletLinks.cjs +0 -34
  27. package/src/helpers/getWalletLinks.d.ts +0 -10
  28. package/src/helpers/getWalletLinks.js +0 -30
  29. package/src/helpers/getWalletPrimaryColor.cjs +0 -14
  30. package/src/helpers/getWalletPrimaryColor.d.ts +0 -2
  31. package/src/helpers/getWalletPrimaryColor.js +0 -10
  32. package/src/helpers/isWalletEventSupported.cjs +0 -8
  33. package/src/helpers/isWalletEventSupported.d.ts +0 -2
  34. package/src/helpers/isWalletEventSupported.js +0 -4
  35. package/src/helpers/isWalletMethodSupported.cjs +0 -8
  36. package/src/helpers/isWalletMethodSupported.d.ts +0 -2
  37. package/src/helpers/isWalletMethodSupported.js +0 -4
  38. package/src/schemas/walletConnectSourceSchema.cjs +0 -78
  39. package/src/schemas/walletConnectSourceSchema.js +0 -74
@@ -1,8 +1,283 @@
1
- import React, { FC, ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  type WalletIconProps = React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> & {
3
+ icon?: string | undefined;
3
4
  walletKey: string | undefined;
4
- } & {
5
5
  children?: ReactNode | any;
6
+ isGroup?: boolean;
6
7
  };
7
- export declare const WalletIcon: FC<WalletIconProps>;
8
+ type WalletBookWalletIconProps = Omit<WalletIconProps, 'icon' | 'iconUrl'>;
9
+ export declare const WalletIcon: ({ icon, walletKey, isGroup, children, ...props }: WalletIconProps) => React.FunctionComponentElement<WalletBookWalletIconProps> | React.DetailedReactHTMLElement<{
10
+ alt: string | undefined;
11
+ src: string;
12
+ ref?: React.LegacyRef<HTMLImageElement> | undefined;
13
+ key?: React.Key | null | undefined;
14
+ crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
15
+ decoding?: "async" | "auto" | "sync" | undefined;
16
+ height?: string | number | undefined;
17
+ loading?: "eager" | "lazy" | undefined;
18
+ referrerPolicy?: React.HTMLAttributeReferrerPolicy | undefined;
19
+ sizes?: string | undefined;
20
+ srcSet?: string | undefined;
21
+ useMap?: string | undefined;
22
+ width?: string | number | undefined;
23
+ defaultChecked?: boolean | undefined;
24
+ defaultValue?: string | number | readonly string[] | undefined;
25
+ suppressContentEditableWarning?: boolean | undefined;
26
+ suppressHydrationWarning?: boolean | undefined;
27
+ accessKey?: string | undefined;
28
+ className?: string | undefined;
29
+ contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
30
+ contextMenu?: string | undefined;
31
+ dir?: string | undefined;
32
+ draggable?: (boolean | "true" | "false") | undefined;
33
+ hidden?: boolean | undefined;
34
+ id?: string | undefined;
35
+ lang?: string | undefined;
36
+ nonce?: string | undefined;
37
+ placeholder?: string | undefined;
38
+ slot?: string | undefined;
39
+ spellCheck?: (boolean | "true" | "false") | undefined;
40
+ style?: React.CSSProperties | undefined;
41
+ tabIndex?: number | undefined;
42
+ title?: string | undefined;
43
+ translate?: "yes" | "no" | undefined;
44
+ radioGroup?: string | undefined;
45
+ role?: React.AriaRole | undefined;
46
+ about?: string | undefined;
47
+ datatype?: string | undefined;
48
+ inlist?: any;
49
+ prefix?: string | undefined;
50
+ property?: string | undefined;
51
+ resource?: string | undefined;
52
+ typeof?: string | undefined;
53
+ vocab?: string | undefined;
54
+ autoCapitalize?: string | undefined;
55
+ autoCorrect?: string | undefined;
56
+ autoSave?: string | undefined;
57
+ color?: string | undefined;
58
+ itemProp?: string | undefined;
59
+ itemScope?: boolean | undefined;
60
+ itemType?: string | undefined;
61
+ itemID?: string | undefined;
62
+ itemRef?: string | undefined;
63
+ results?: number | undefined;
64
+ security?: string | undefined;
65
+ unselectable?: "on" | "off" | undefined;
66
+ inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
67
+ is?: string | undefined;
68
+ 'aria-activedescendant'?: string | undefined;
69
+ 'aria-atomic'?: (boolean | "true" | "false") | undefined;
70
+ 'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
71
+ 'aria-busy'?: (boolean | "true" | "false") | undefined;
72
+ 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
73
+ 'aria-colcount'?: number | undefined;
74
+ 'aria-colindex'?: number | undefined;
75
+ 'aria-colspan'?: number | undefined;
76
+ 'aria-controls'?: string | undefined;
77
+ 'aria-current'?: boolean | "true" | "false" | "time" | "date" | "page" | "step" | "location" | undefined;
78
+ 'aria-describedby'?: string | undefined;
79
+ 'aria-details'?: string | undefined;
80
+ 'aria-disabled'?: (boolean | "true" | "false") | undefined;
81
+ 'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
82
+ 'aria-errormessage'?: string | undefined;
83
+ 'aria-expanded'?: (boolean | "true" | "false") | undefined;
84
+ 'aria-flowto'?: string | undefined;
85
+ 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
86
+ 'aria-haspopup'?: boolean | "true" | "false" | "dialog" | "grid" | "listbox" | "menu" | "tree" | undefined;
87
+ 'aria-hidden'?: (boolean | "true" | "false") | undefined;
88
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
89
+ 'aria-keyshortcuts'?: string | undefined;
90
+ 'aria-label'?: string | undefined;
91
+ 'aria-labelledby'?: string | undefined;
92
+ 'aria-level'?: number | undefined;
93
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
94
+ 'aria-modal'?: (boolean | "true" | "false") | undefined;
95
+ 'aria-multiline'?: (boolean | "true" | "false") | undefined;
96
+ 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
97
+ 'aria-orientation'?: "horizontal" | "vertical" | undefined;
98
+ 'aria-owns'?: string | undefined;
99
+ 'aria-placeholder'?: string | undefined;
100
+ 'aria-posinset'?: number | undefined;
101
+ 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
102
+ 'aria-readonly'?: (boolean | "true" | "false") | undefined;
103
+ 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
104
+ 'aria-required'?: (boolean | "true" | "false") | undefined;
105
+ 'aria-roledescription'?: string | undefined;
106
+ 'aria-rowcount'?: number | undefined;
107
+ 'aria-rowindex'?: number | undefined;
108
+ 'aria-rowspan'?: number | undefined;
109
+ 'aria-selected'?: (boolean | "true" | "false") | undefined;
110
+ 'aria-setsize'?: number | undefined;
111
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
112
+ 'aria-valuemax'?: number | undefined;
113
+ 'aria-valuemin'?: number | undefined;
114
+ 'aria-valuenow'?: number | undefined;
115
+ 'aria-valuetext'?: string | undefined;
116
+ dangerouslySetInnerHTML?: {
117
+ __html: string;
118
+ } | undefined;
119
+ onCopy?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
120
+ onCopyCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
121
+ onCut?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
122
+ onCutCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
123
+ onPaste?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
124
+ onPasteCapture?: React.ClipboardEventHandler<HTMLImageElement> | undefined;
125
+ onCompositionEnd?: React.CompositionEventHandler<HTMLImageElement> | undefined;
126
+ onCompositionEndCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
127
+ onCompositionStart?: React.CompositionEventHandler<HTMLImageElement> | undefined;
128
+ onCompositionStartCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
129
+ onCompositionUpdate?: React.CompositionEventHandler<HTMLImageElement> | undefined;
130
+ onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLImageElement> | undefined;
131
+ onFocus?: React.FocusEventHandler<HTMLImageElement> | undefined;
132
+ onFocusCapture?: React.FocusEventHandler<HTMLImageElement> | undefined;
133
+ onBlur?: React.FocusEventHandler<HTMLImageElement> | undefined;
134
+ onBlurCapture?: React.FocusEventHandler<HTMLImageElement> | undefined;
135
+ onChange?: React.FormEventHandler<HTMLImageElement> | undefined;
136
+ onChangeCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
137
+ onBeforeInput?: React.FormEventHandler<HTMLImageElement> | undefined;
138
+ onBeforeInputCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
139
+ onInput?: React.FormEventHandler<HTMLImageElement> | undefined;
140
+ onInputCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
141
+ onReset?: React.FormEventHandler<HTMLImageElement> | undefined;
142
+ onResetCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
143
+ onSubmit?: React.FormEventHandler<HTMLImageElement> | undefined;
144
+ onSubmitCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
145
+ onInvalid?: React.FormEventHandler<HTMLImageElement> | undefined;
146
+ onInvalidCapture?: React.FormEventHandler<HTMLImageElement> | undefined;
147
+ onLoad?: React.ReactEventHandler<HTMLImageElement> | undefined;
148
+ onLoadCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
149
+ onError?: React.ReactEventHandler<HTMLImageElement> | undefined;
150
+ onErrorCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
151
+ onKeyDown?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
152
+ onKeyDownCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
153
+ onKeyPress?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
154
+ onKeyPressCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
155
+ onKeyUp?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
156
+ onKeyUpCapture?: React.KeyboardEventHandler<HTMLImageElement> | undefined;
157
+ onAbort?: React.ReactEventHandler<HTMLImageElement> | undefined;
158
+ onAbortCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
159
+ onCanPlay?: React.ReactEventHandler<HTMLImageElement> | undefined;
160
+ onCanPlayCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
161
+ onCanPlayThrough?: React.ReactEventHandler<HTMLImageElement> | undefined;
162
+ onCanPlayThroughCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
163
+ onDurationChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
164
+ onDurationChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
165
+ onEmptied?: React.ReactEventHandler<HTMLImageElement> | undefined;
166
+ onEmptiedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
167
+ onEncrypted?: React.ReactEventHandler<HTMLImageElement> | undefined;
168
+ onEncryptedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
169
+ onEnded?: React.ReactEventHandler<HTMLImageElement> | undefined;
170
+ onEndedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
171
+ onLoadedData?: React.ReactEventHandler<HTMLImageElement> | undefined;
172
+ onLoadedDataCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
173
+ onLoadedMetadata?: React.ReactEventHandler<HTMLImageElement> | undefined;
174
+ onLoadedMetadataCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
175
+ onLoadStart?: React.ReactEventHandler<HTMLImageElement> | undefined;
176
+ onLoadStartCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
177
+ onPause?: React.ReactEventHandler<HTMLImageElement> | undefined;
178
+ onPauseCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
179
+ onPlay?: React.ReactEventHandler<HTMLImageElement> | undefined;
180
+ onPlayCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
181
+ onPlaying?: React.ReactEventHandler<HTMLImageElement> | undefined;
182
+ onPlayingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
183
+ onProgress?: React.ReactEventHandler<HTMLImageElement> | undefined;
184
+ onProgressCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
185
+ onRateChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
186
+ onRateChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
187
+ onResize?: React.ReactEventHandler<HTMLImageElement> | undefined;
188
+ onResizeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
189
+ onSeeked?: React.ReactEventHandler<HTMLImageElement> | undefined;
190
+ onSeekedCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
191
+ onSeeking?: React.ReactEventHandler<HTMLImageElement> | undefined;
192
+ onSeekingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
193
+ onStalled?: React.ReactEventHandler<HTMLImageElement> | undefined;
194
+ onStalledCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
195
+ onSuspend?: React.ReactEventHandler<HTMLImageElement> | undefined;
196
+ onSuspendCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
197
+ onTimeUpdate?: React.ReactEventHandler<HTMLImageElement> | undefined;
198
+ onTimeUpdateCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
199
+ onVolumeChange?: React.ReactEventHandler<HTMLImageElement> | undefined;
200
+ onVolumeChangeCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
201
+ onWaiting?: React.ReactEventHandler<HTMLImageElement> | undefined;
202
+ onWaitingCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
203
+ onAuxClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
204
+ onAuxClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
205
+ onClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
206
+ onClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
207
+ onContextMenu?: React.MouseEventHandler<HTMLImageElement> | undefined;
208
+ onContextMenuCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
209
+ onDoubleClick?: React.MouseEventHandler<HTMLImageElement> | undefined;
210
+ onDoubleClickCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
211
+ onDrag?: React.DragEventHandler<HTMLImageElement> | undefined;
212
+ onDragCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
213
+ onDragEnd?: React.DragEventHandler<HTMLImageElement> | undefined;
214
+ onDragEndCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
215
+ onDragEnter?: React.DragEventHandler<HTMLImageElement> | undefined;
216
+ onDragEnterCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
217
+ onDragExit?: React.DragEventHandler<HTMLImageElement> | undefined;
218
+ onDragExitCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
219
+ onDragLeave?: React.DragEventHandler<HTMLImageElement> | undefined;
220
+ onDragLeaveCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
221
+ onDragOver?: React.DragEventHandler<HTMLImageElement> | undefined;
222
+ onDragOverCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
223
+ onDragStart?: React.DragEventHandler<HTMLImageElement> | undefined;
224
+ onDragStartCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
225
+ onDrop?: React.DragEventHandler<HTMLImageElement> | undefined;
226
+ onDropCapture?: React.DragEventHandler<HTMLImageElement> | undefined;
227
+ onMouseDown?: React.MouseEventHandler<HTMLImageElement> | undefined;
228
+ onMouseDownCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
229
+ onMouseEnter?: React.MouseEventHandler<HTMLImageElement> | undefined;
230
+ onMouseLeave?: React.MouseEventHandler<HTMLImageElement> | undefined;
231
+ onMouseMove?: React.MouseEventHandler<HTMLImageElement> | undefined;
232
+ onMouseMoveCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
233
+ onMouseOut?: React.MouseEventHandler<HTMLImageElement> | undefined;
234
+ onMouseOutCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
235
+ onMouseOver?: React.MouseEventHandler<HTMLImageElement> | undefined;
236
+ onMouseOverCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
237
+ onMouseUp?: React.MouseEventHandler<HTMLImageElement> | undefined;
238
+ onMouseUpCapture?: React.MouseEventHandler<HTMLImageElement> | undefined;
239
+ onSelect?: React.ReactEventHandler<HTMLImageElement> | undefined;
240
+ onSelectCapture?: React.ReactEventHandler<HTMLImageElement> | undefined;
241
+ onTouchCancel?: React.TouchEventHandler<HTMLImageElement> | undefined;
242
+ onTouchCancelCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
243
+ onTouchEnd?: React.TouchEventHandler<HTMLImageElement> | undefined;
244
+ onTouchEndCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
245
+ onTouchMove?: React.TouchEventHandler<HTMLImageElement> | undefined;
246
+ onTouchMoveCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
247
+ onTouchStart?: React.TouchEventHandler<HTMLImageElement> | undefined;
248
+ onTouchStartCapture?: React.TouchEventHandler<HTMLImageElement> | undefined;
249
+ onPointerDown?: React.PointerEventHandler<HTMLImageElement> | undefined;
250
+ onPointerDownCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
251
+ onPointerMove?: React.PointerEventHandler<HTMLImageElement> | undefined;
252
+ onPointerMoveCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
253
+ onPointerUp?: React.PointerEventHandler<HTMLImageElement> | undefined;
254
+ onPointerUpCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
255
+ onPointerCancel?: React.PointerEventHandler<HTMLImageElement> | undefined;
256
+ onPointerCancelCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
257
+ onPointerEnter?: React.PointerEventHandler<HTMLImageElement> | undefined;
258
+ onPointerEnterCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
259
+ onPointerLeave?: React.PointerEventHandler<HTMLImageElement> | undefined;
260
+ onPointerLeaveCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
261
+ onPointerOver?: React.PointerEventHandler<HTMLImageElement> | undefined;
262
+ onPointerOverCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
263
+ onPointerOut?: React.PointerEventHandler<HTMLImageElement> | undefined;
264
+ onPointerOutCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
265
+ onGotPointerCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
266
+ onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
267
+ onLostPointerCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
268
+ onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLImageElement> | undefined;
269
+ onScroll?: React.UIEventHandler<HTMLImageElement> | undefined;
270
+ onScrollCapture?: React.UIEventHandler<HTMLImageElement> | undefined;
271
+ onWheel?: React.WheelEventHandler<HTMLImageElement> | undefined;
272
+ onWheelCapture?: React.WheelEventHandler<HTMLImageElement> | undefined;
273
+ onAnimationStart?: React.AnimationEventHandler<HTMLImageElement> | undefined;
274
+ onAnimationStartCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
275
+ onAnimationEnd?: React.AnimationEventHandler<HTMLImageElement> | undefined;
276
+ onAnimationEndCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
277
+ onAnimationIteration?: React.AnimationEventHandler<HTMLImageElement> | undefined;
278
+ onAnimationIterationCapture?: React.AnimationEventHandler<HTMLImageElement> | undefined;
279
+ onTransitionEnd?: React.TransitionEventHandler<HTMLImageElement> | undefined;
280
+ onTransitionEndCapture?: React.TransitionEventHandler<HTMLImageElement> | undefined;
281
+ 'data-testid': string;
282
+ }, HTMLImageElement>;
8
283
  export {};
@@ -1,26 +1,34 @@
1
1
  'use client'
2
2
  import { __rest } from '../../_virtual/_tslib.js';
3
- import { useState, createElement, Fragment } from 'react';
4
- import { getWalletIconUrl, getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
5
- import { findWalletBookWallet } from '../helpers/findWalletBookWallet.js';
3
+ import { createElement, useState, Fragment } from 'react';
4
+ import { getDefaultWalletIconUrl } from '../helpers/getWalletIconUrl.js';
6
5
  import '../helpers/renderTemplate.js';
7
6
  import '../helpers/logger.js';
7
+ import { getWalletIconData } from '../helpers/getWalletIconData.js';
8
8
  import { useWalletBookContext } from '../context/WalletBookContext.js';
9
9
 
10
- const WalletIcon = (_a) => {
11
- var { walletKey, children } = _a, props = __rest(_a, ["walletKey", "children"]);
10
+ const WalletBookWalletIcon = (_a) => {
11
+ var { walletKey, isGroup, children } = _a, props = __rest(_a, ["walletKey", "isGroup", "children"]);
12
12
  const { walletBook } = useWalletBookContext();
13
- const walletData = findWalletBookWallet(walletBook, walletKey);
14
13
  const [imgError, setImgError] = useState(false);
15
- const walletIconUrl = getWalletIconUrl(walletBook, walletKey);
14
+ const { walletIconUrl, walletIconAlt } = getWalletIconData(walletBook, walletKey, isGroup);
16
15
  const defaultWalletIconUrl = getDefaultWalletIconUrl();
17
- if (!walletData || !walletData.brand || !walletIconUrl) {
16
+ if (!walletIconUrl) {
18
17
  return createElement(Fragment, {}, children);
19
18
  }
20
19
  const onError = () => {
21
20
  setImgError(true);
22
21
  };
23
- return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletData.brand.alt, onError: onError, src: imgError ? defaultWalletIconUrl : walletIconUrl }), children);
22
+ return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletIconAlt, onError: onError, src: imgError ? defaultWalletIconUrl : walletIconUrl }), children);
23
+ };
24
+ const WalletIcon = (_a) => {
25
+ var { icon, walletKey, isGroup, children } = _a, props = __rest(_a, ["icon", "walletKey", "isGroup", "children"]);
26
+ if (!icon) {
27
+ return createElement(WalletBookWalletIcon, Object.assign({ children,
28
+ isGroup,
29
+ walletKey }, props));
30
+ }
31
+ return createElement('img', Object.assign(Object.assign({ 'data-testid': `wallet-icon-${walletKey}` }, props), { alt: walletKey, src: icon }), children);
24
32
  };
25
33
 
26
34
  export { WalletIcon };
@@ -1,2 +1,2 @@
1
1
  import { WalletBookSchema, WalletSchema } from '../schemas';
2
- export declare const getWalletBookWallet: (walletBook: WalletBookSchema, walletKey: string | undefined, walletFallback?: WalletSchema) => WalletSchema;
2
+ export declare const getWalletBookWallet: (walletBook: WalletBookSchema | undefined, walletKey: string | undefined, walletFallback?: WalletSchema) => WalletSchema;
@@ -0,0 +1,39 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var getWalletBookWallet = require('./getWalletBookWallet.cjs');
7
+ var getBrandIconUrl = require('./getBrandIconUrl.cjs');
8
+ var logger = require('./logger.cjs');
9
+ var findWalletGroup = require('./findWalletGroup.cjs');
10
+
11
+ const getWalletIconData = (walletBook, walletKey, isGroup) => {
12
+ if (!walletKey) {
13
+ return {
14
+ walletIconAlt: '',
15
+ walletIconUrl: '',
16
+ };
17
+ }
18
+ try {
19
+ const walletData = isGroup
20
+ ? findWalletGroup.findWalletGroup(walletBook, walletKey)
21
+ : getWalletBookWallet.getWalletBookWallet(walletBook, walletKey);
22
+ const iconData = walletData === null || walletData === void 0 ? void 0 : walletData.brand;
23
+ if (iconData) {
24
+ return {
25
+ walletIconAlt: iconData.alt,
26
+ walletIconUrl: getBrandIconUrl.getBrandIconUrl(iconData),
27
+ };
28
+ }
29
+ }
30
+ catch (err) {
31
+ logger.logger.error(err);
32
+ }
33
+ return {
34
+ walletIconAlt: '',
35
+ walletIconUrl: '',
36
+ };
37
+ };
38
+
39
+ exports.getWalletIconData = getWalletIconData;
@@ -0,0 +1,5 @@
1
+ import { WalletBookSchema } from '../schemas';
2
+ export declare const getWalletIconData: (walletBook: WalletBookSchema, walletKey?: string, isGroup?: boolean) => {
3
+ walletIconAlt: string | undefined;
4
+ walletIconUrl: string | undefined;
5
+ };
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+ import { getWalletBookWallet } from './getWalletBookWallet.js';
3
+ import { getBrandIconUrl } from './getBrandIconUrl.js';
4
+ import { logger } from './logger.js';
5
+ import { findWalletGroup } from './findWalletGroup.js';
6
+
7
+ const getWalletIconData = (walletBook, walletKey, isGroup) => {
8
+ if (!walletKey) {
9
+ return {
10
+ walletIconAlt: '',
11
+ walletIconUrl: '',
12
+ };
13
+ }
14
+ try {
15
+ const walletData = isGroup
16
+ ? findWalletGroup(walletBook, walletKey)
17
+ : getWalletBookWallet(walletBook, walletKey);
18
+ const iconData = walletData === null || walletData === void 0 ? void 0 : walletData.brand;
19
+ if (iconData) {
20
+ return {
21
+ walletIconAlt: iconData.alt,
22
+ walletIconUrl: getBrandIconUrl(iconData),
23
+ };
24
+ }
25
+ }
26
+ catch (err) {
27
+ logger.error(err);
28
+ }
29
+ return {
30
+ walletIconAlt: '',
31
+ walletIconUrl: '',
32
+ };
33
+ };
34
+
35
+ export { getWalletIconData };
@@ -1,7 +1,5 @@
1
1
  export * from './getWalletIconUrl';
2
2
  export * from './getWalletBookWallet';
3
- export * from './getWalletLinks';
4
- export * from './getWalletPrimaryColor';
5
3
  export * from './renderTemplate';
6
4
  export * from './findWalletBookWallet';
7
5
  export * from './logger';
@@ -10,5 +8,4 @@ export * from './findWalletGroup';
10
8
  export * from './getWalletBookCdnUrl';
11
9
  export * from './getBrandIconUrl';
12
10
  export * from './findWalletGroupOverride';
13
- export * from './isWalletMethodSupported';
14
- export * from './isWalletEventSupported';
11
+ export * from './getWalletIconData';
@@ -0,0 +1,49 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var EventEmitter = require('eventemitter3');
8
+ var utils = require('@dynamic-labs/utils');
9
+ var walletBookFallbacks = require('../../../wallet-book-fallbacks.cjs');
10
+ var getWalletBookCdnUrl = require('../../helpers/getWalletBookCdnUrl.cjs');
11
+ var logger = require('../../helpers/logger.cjs');
12
+ var walletBookSchema = require('../../schemas/walletBookSchema.cjs');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
17
+
18
+ const walletBookCache = { current: {} };
19
+ const walletBookEmitter = new EventEmitter__default["default"]();
20
+ const fetchWalletBook = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
21
+ const url = getWalletBookCdnUrl.getWalletBookCdnUrl();
22
+ const fn = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
23
+ const res = yield fetch(url, { mode: 'cors' });
24
+ if (!res.ok) {
25
+ throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
26
+ }
27
+ const json = yield res.json();
28
+ try {
29
+ const parsedData = walletBookSchema.walletBookSchema.parse(json);
30
+ return parsedData;
31
+ }
32
+ catch (e) {
33
+ logger.logger.error('Error parsing wallet book data', e, json);
34
+ throw e;
35
+ }
36
+ });
37
+ walletBookCache.current = yield utils.retryableFn(fn, {
38
+ fallbackValue: walletBookSchema.walletBookSchema.parse(walletBookFallbacks["default"]),
39
+ logger: logger.logger.createLogger('useWalletBookCdn'),
40
+ maxRetries: 3,
41
+ retryStrategy: 'timeout-and-rejection',
42
+ timeoutMs: 30000,
43
+ });
44
+ walletBookEmitter.emit('walletBookLoaded', walletBookCache.current);
45
+ });
46
+
47
+ exports.fetchWalletBook = fetchWalletBook;
48
+ exports.walletBookCache = walletBookCache;
49
+ exports.walletBookEmitter = walletBookEmitter;
@@ -0,0 +1,97 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import { WalletBookSchema } from '../../schemas/walletBookSchema';
3
+ export declare const walletBookCache: {
4
+ current: {
5
+ groups: Record<string, {
6
+ key: string;
7
+ name: string;
8
+ brand?: {
9
+ alt?: string | undefined;
10
+ primaryColor?: string | undefined;
11
+ spriteId?: string | undefined;
12
+ } | undefined;
13
+ walletOverrides?: Record<string, {
14
+ brand?: {
15
+ alt?: string | undefined;
16
+ primaryColor?: string | undefined;
17
+ spriteId?: string | undefined;
18
+ } | undefined;
19
+ name?: string | undefined;
20
+ }> | undefined;
21
+ }>;
22
+ wallets: Record<string, {
23
+ name: string;
24
+ brand?: {
25
+ alt?: string | undefined;
26
+ primaryColor?: string | undefined;
27
+ spriteId?: string | undefined;
28
+ } | undefined;
29
+ chainGroup?: string | undefined;
30
+ chains?: string[] | undefined;
31
+ desktop?: {
32
+ chromeId?: string | undefined;
33
+ edgeId?: string | undefined;
34
+ firefoxId?: string | undefined;
35
+ native?: string | undefined;
36
+ operaId?: string | undefined;
37
+ safariId?: string | undefined;
38
+ universal?: string | undefined;
39
+ } | undefined;
40
+ eip6963Config?: {
41
+ rdns: string;
42
+ } | undefined;
43
+ filterFromWalletConnect?: boolean | undefined;
44
+ group?: string | undefined;
45
+ hardwareWallets?: string[] | undefined;
46
+ injectedConfig?: {
47
+ chain: string;
48
+ extensionLocators: {
49
+ value: boolean;
50
+ flag: string;
51
+ }[];
52
+ providerInterface?: string | undefined;
53
+ walletStandard?: {
54
+ name: string;
55
+ features: string[];
56
+ providerId?: string | undefined;
57
+ } | undefined;
58
+ walletStandardLocators?: {
59
+ name: string;
60
+ locator: string;
61
+ }[] | undefined;
62
+ windowLocations?: string[] | undefined;
63
+ }[] | undefined;
64
+ mobile?: {
65
+ android?: string | null | undefined;
66
+ androidId?: string | undefined;
67
+ inAppBrowser?: string | null | undefined;
68
+ ios?: string | null | undefined;
69
+ iosId?: string | undefined;
70
+ native?: string | undefined;
71
+ universal?: string | undefined;
72
+ } | undefined;
73
+ mobileExperience?: "in-app-browser" | "redirect" | undefined;
74
+ shortName?: string | undefined;
75
+ showOnlyIfInstalled?: boolean | undefined;
76
+ switchNetworkOnlyFromWallet?: boolean | undefined;
77
+ walletConnect?: {
78
+ sdks?: string[] | undefined;
79
+ } | undefined;
80
+ walletGroup?: string | undefined;
81
+ walletLimitations?: {
82
+ browserExtension?: {
83
+ unsupportedEvents?: string[] | undefined;
84
+ unsupportedMethods?: string[] | undefined;
85
+ } | undefined;
86
+ mobile?: {
87
+ unsupportedEvents?: string[] | undefined;
88
+ unsupportedMethods?: string[] | undefined;
89
+ } | undefined;
90
+ } | undefined;
91
+ }>;
92
+ };
93
+ };
94
+ export declare const walletBookEmitter: EventEmitter<{
95
+ walletBookLoaded: (walletBook: WalletBookSchema) => void;
96
+ }, any>;
97
+ export declare const fetchWalletBook: () => Promise<void>;
@@ -0,0 +1,39 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import EventEmitter from 'eventemitter3';
4
+ import { retryableFn } from '@dynamic-labs/utils';
5
+ import walletBookFallbacks from '../../../wallet-book-fallbacks.js';
6
+ import { getWalletBookCdnUrl } from '../../helpers/getWalletBookCdnUrl.js';
7
+ import { logger } from '../../helpers/logger.js';
8
+ import { walletBookSchema } from '../../schemas/walletBookSchema.js';
9
+
10
+ const walletBookCache = { current: {} };
11
+ const walletBookEmitter = new EventEmitter();
12
+ const fetchWalletBook = () => __awaiter(void 0, void 0, void 0, function* () {
13
+ const url = getWalletBookCdnUrl();
14
+ const fn = () => __awaiter(void 0, void 0, void 0, function* () {
15
+ const res = yield fetch(url, { mode: 'cors' });
16
+ if (!res.ok) {
17
+ throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
18
+ }
19
+ const json = yield res.json();
20
+ try {
21
+ const parsedData = walletBookSchema.parse(json);
22
+ return parsedData;
23
+ }
24
+ catch (e) {
25
+ logger.error('Error parsing wallet book data', e, json);
26
+ throw e;
27
+ }
28
+ });
29
+ walletBookCache.current = yield retryableFn(fn, {
30
+ fallbackValue: walletBookSchema.parse(walletBookFallbacks),
31
+ logger: logger.createLogger('useWalletBookCdn'),
32
+ maxRetries: 3,
33
+ retryStrategy: 'timeout-and-rejection',
34
+ timeoutMs: 30000,
35
+ });
36
+ walletBookEmitter.emit('walletBookLoaded', walletBookCache.current);
37
+ });
38
+
39
+ export { fetchWalletBook, walletBookCache, walletBookEmitter };
@@ -0,0 +1 @@
1
+ export * from './fetchWalletBook';