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

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