@n1xyz/wallet-widget 0.0.1 → 0.0.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.
Files changed (100) hide show
  1. package/LICENSE +44 -0
  2. package/README.md +45 -0
  3. package/dist/Logic/utils.d.ts +1 -0
  4. package/dist/Logic/utils.js +47 -9
  5. package/dist/Modal/BackButton.js +14 -1
  6. package/dist/Modal/ConnectView.js +20 -23
  7. package/dist/Modal/CreateSessionView.js +23 -11
  8. package/dist/Modal/CreateUserView.js +1 -1
  9. package/dist/Modal/ModalHeader.js +14 -3
  10. package/dist/Modal/N1WalletModal.js +35 -30
  11. package/dist/Modal/NoWhitelistView.js +14 -1
  12. package/dist/Modal/Sidebar/N1Sidebar.js +152 -13
  13. package/dist/Modal/SigningView.js +1 -1
  14. package/dist/Provider/LazyWalletProvider.js +6 -2
  15. package/dist/Provider/N1WalletProvider.js +10 -7
  16. package/dist/Provider/types.d.ts +8 -0
  17. package/dist/components/Logo.d.ts +7 -0
  18. package/dist/components/Logo.js +118 -0
  19. package/dist/components/QRCodeLoader.d.ts +4 -0
  20. package/dist/components/QRCodeLoader.js +8 -0
  21. package/dist/components/WalletDeposit/AnimatedButton.d.ts +17 -0
  22. package/dist/components/WalletDeposit/AnimatedButton.js +29 -0
  23. package/dist/components/WalletDeposit/components/ChainButton.d.ts +7 -0
  24. package/dist/components/WalletDeposit/components/ChainButton.js +5 -0
  25. package/dist/components/WalletDeposit/components/LoadingSquares.d.ts +1 -0
  26. package/dist/components/WalletDeposit/components/LoadingSquares.js +5 -0
  27. package/dist/components/WalletDeposit/components/TransactionTable.d.ts +6 -0
  28. package/dist/components/WalletDeposit/components/TransactionTable.js +8 -0
  29. package/dist/components/WalletDeposit/components/WaitingMessage.d.ts +6 -0
  30. package/dist/components/WalletDeposit/components/WaitingMessage.js +6 -0
  31. package/dist/components/WalletDeposit/constants.d.ts +15 -0
  32. package/dist/components/WalletDeposit/constants.js +32 -0
  33. package/dist/components/WalletDeposit/hooks.d.ts +9 -0
  34. package/dist/components/WalletDeposit/hooks.js +185 -0
  35. package/dist/components/WalletDeposit/index.d.ts +1 -0
  36. package/dist/components/WalletDeposit/index.js +136 -0
  37. package/dist/components/WalletDeposit/screens/AmountInputScreen.d.ts +12 -0
  38. package/dist/components/WalletDeposit/screens/AmountInputScreen.js +18 -0
  39. package/dist/components/WalletDeposit/screens/AppsTableScreen.d.ts +8 -0
  40. package/dist/components/WalletDeposit/screens/AppsTableScreen.js +28 -0
  41. package/dist/components/WalletDeposit/screens/ChainSelectionScreen.d.ts +5 -0
  42. package/dist/components/WalletDeposit/screens/ChainSelectionScreen.js +8 -0
  43. package/dist/components/WalletDeposit/screens/InitialScreen.d.ts +9 -0
  44. package/dist/components/WalletDeposit/screens/InitialScreen.js +18 -0
  45. package/dist/components/WalletDeposit/screens/SigningScreen.d.ts +6 -0
  46. package/dist/components/WalletDeposit/screens/SigningScreen.js +6 -0
  47. package/dist/components/WalletDeposit/screens/SuccessScreen.d.ts +12 -0
  48. package/dist/components/WalletDeposit/screens/SuccessScreen.js +7 -0
  49. package/dist/components/WalletDeposit/types.d.ts +43 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +2 -0
  52. package/dist/main.css +1 -1
  53. package/dist/utils/dynamicImports.d.ts +24 -0
  54. package/dist/utils/dynamicImports.js +41 -0
  55. package/dist/utils/shortenString.d.ts +2 -0
  56. package/dist/utils/shortenString.js +8 -0
  57. package/package.json +13 -9
  58. package/.eslintrc.js +0 -29
  59. package/dist/Common/NIcon.js +0 -7
  60. package/dist/components/AnimatedButton.d.ts +0 -9
  61. package/dist/components/AnimatedButton.js +0 -5
  62. package/postcss.config.js +0 -6
  63. package/src/Logic/getPseudoName.ts +0 -5832
  64. package/src/Logic/utils.ts +0 -162
  65. package/src/Logic/words.ts +0 -93571
  66. package/src/Modal/BackButton.tsx +0 -23
  67. package/src/Modal/ConnectView.tsx +0 -88
  68. package/src/Modal/CreateSessionView.tsx +0 -242
  69. package/src/Modal/CreateUserView.tsx +0 -195
  70. package/src/Modal/ModalHeader.tsx +0 -64
  71. package/src/Modal/N1WalletModal.tsx +0 -275
  72. package/src/Modal/NoWhitelistView.tsx +0 -61
  73. package/src/Modal/Sidebar/N1Sidebar.tsx +0 -172
  74. package/src/Modal/SigningView.tsx +0 -18
  75. package/src/Modal/SuccessView.tsx +0 -36
  76. package/src/Provider/LazyWalletProvider.tsx +0 -136
  77. package/src/Provider/N1WalletProvider.tsx +0 -208
  78. package/src/Provider/context.ts +0 -11
  79. package/src/Provider/hooks.ts +0 -22
  80. package/src/Provider/icons/CoinbaseWalletIcon.tsx +0 -27
  81. package/src/Provider/icons/ConnectionDotsSVG.tsx +0 -19
  82. package/src/Provider/icons/MetamaskIcon.tsx +0 -58
  83. package/src/Provider/icons/PhantomIcon.tsx +0 -26
  84. package/src/Provider/icons/UserIcon.tsx +0 -15
  85. package/src/Provider/icons/WalletConnectIcon.tsx +0 -15
  86. package/src/Provider/index.ts +0 -3
  87. package/src/Provider/types.ts +0 -77
  88. package/src/WidgetButton/N1ConnectButton.tsx +0 -72
  89. package/src/components/LazyLoadWrapper.tsx +0 -19
  90. package/src/config.ts +0 -2
  91. package/src/errors/types.ts +0 -49
  92. package/src/index.ts +0 -5
  93. package/src/main.css +0 -3
  94. package/src/styles/main.css +0 -3
  95. package/src/utils/lazyLoad.ts +0 -12
  96. package/src/utils/logger.ts +0 -98
  97. package/src/utils/react-shim.js +0 -8
  98. package/tailwind.config.js +0 -44
  99. package/tsconfig.json +0 -21
  100. /package/dist/{Common/NIcon.d.ts → components/WalletDeposit/types.js} +0 -0
@@ -0,0 +1,32 @@
1
+ export var ANIMATION_EASE = 'cubic-bezier(0.16, 1, 0.3, 1)';
2
+ export var TYPING_INTERVAL = 50;
3
+ export var ANIMATION_DURATION = 3000;
4
+ export var MIN_DEPOSIT = 1;
5
+ export var MAX_DEPOSIT = 10000;
6
+ export var INITIAL_APPS = Array.from({ length: 20 }, function (_, i) { return ({
7
+ name: "App".concat(i + 1),
8
+ color: '#ff2b1f',
9
+ progress: 0,
10
+ }); });
11
+ export var CHAINS = [
12
+ {
13
+ id: 'ethereum',
14
+ name: 'Ethereum',
15
+ logo: '/images/chains/ethereum.svg',
16
+ },
17
+ {
18
+ id: 'polygon',
19
+ name: 'Polygon',
20
+ logo: '/images/chains/polygon.svg',
21
+ },
22
+ {
23
+ id: 'arbitrum',
24
+ name: 'Arbitrum',
25
+ logo: '/images/chains/arbitrum.svg',
26
+ },
27
+ {
28
+ id: 'optimism',
29
+ name: 'Optimism',
30
+ logo: '/images/chains/optimism.svg',
31
+ },
32
+ ];
@@ -0,0 +1,9 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { TableValues, WaitingMessageState } from './types';
3
+ import { ButtonStates } from './AnimatedButton';
4
+ export declare function useButtonTyping(buttonStates: ButtonStates, setButtonStates: Dispatch<SetStateAction<ButtonStates>>): void;
5
+ export declare function useWaitingMessage(isSigningView: boolean, isWaitingForTx: boolean, setIsWaitingForTx: Dispatch<SetStateAction<boolean>>, setIsSuccessView: Dispatch<SetStateAction<boolean>>, setIsSigningView: Dispatch<SetStateAction<boolean>>): {
6
+ waitingMessage: WaitingMessageState;
7
+ setHasError: Dispatch<SetStateAction<boolean>>;
8
+ };
9
+ export declare function useTableValues(isSuccessView: boolean, selectedChain: string | null): TableValues;
@@ -0,0 +1,185 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useState, useEffect } from 'react';
13
+ import { TYPING_INTERVAL, CHAINS } from './constants';
14
+ var BUTTON_CONFIGS = {
15
+ deposit: { text: 'Deposit' },
16
+ continue: { text: 'Continue' },
17
+ openApp: { text: 'Launch' },
18
+ };
19
+ export function useButtonTyping(buttonStates, setButtonStates) {
20
+ useEffect(function () {
21
+ Object.entries(buttonStates).forEach(function (_a) {
22
+ var key = _a[0], state = _a[1];
23
+ if (state.isTyping) {
24
+ var config_1 = BUTTON_CONFIGS[key];
25
+ var index_1 = 0;
26
+ var interval_1 = setInterval(function () {
27
+ if (index_1 <= config_1.text.length) {
28
+ setButtonStates(function (prev) {
29
+ var _a;
30
+ return (__assign(__assign({}, prev), (_a = {}, _a[key] = __assign(__assign({}, prev[key]), { text: config_1.text.slice(0, index_1) }), _a)));
31
+ });
32
+ index_1++;
33
+ }
34
+ else {
35
+ clearInterval(interval_1);
36
+ }
37
+ }, TYPING_INTERVAL);
38
+ return function () { return clearInterval(interval_1); };
39
+ }
40
+ });
41
+ }, [buttonStates, setButtonStates]);
42
+ }
43
+ export function useWaitingMessage(isSigningView, isWaitingForTx, setIsWaitingForTx, setIsSuccessView, setIsSigningView) {
44
+ var _a = useState({
45
+ title: '',
46
+ subtitle: '',
47
+ visible: false,
48
+ isTyping: false,
49
+ }), waitingMessage = _a[0], setWaitingMessage = _a[1];
50
+ var _b = useState(false), hasError = _b[0], setHasError = _b[1];
51
+ useEffect(function () {
52
+ if (isSigningView && !isWaitingForTx) {
53
+ var messages_1 = [
54
+ {
55
+ title: 'Waiting for signature',
56
+ subtitle: 'Please sign the transaction in your wallet',
57
+ delay: 0,
58
+ },
59
+ {
60
+ title: 'Waiting for transaction',
61
+ subtitle: 'Transaction is being processed...',
62
+ delay: 3000,
63
+ },
64
+ ];
65
+ var currentMessageIndex = 0;
66
+ var showMessage_1 = function (message) {
67
+ var index = 0;
68
+ var interval = setInterval(function () {
69
+ if (index <= Math.max(message.title.length, message.subtitle.length)) {
70
+ setWaitingMessage({
71
+ title: message.title.slice(0, index),
72
+ subtitle: message.subtitle.slice(0, index),
73
+ visible: true,
74
+ isTyping: true,
75
+ });
76
+ index++;
77
+ }
78
+ else {
79
+ clearInterval(interval);
80
+ setWaitingMessage({
81
+ title: message.title,
82
+ subtitle: message.subtitle,
83
+ visible: true,
84
+ isTyping: false,
85
+ });
86
+ }
87
+ }, TYPING_INTERVAL);
88
+ return interval;
89
+ };
90
+ var currentInterval_1 = showMessage_1(messages_1[currentMessageIndex]);
91
+ var messageTimeout_1 = setTimeout(function () {
92
+ clearInterval(currentInterval_1);
93
+ currentInterval_1 = showMessage_1(messages_1[1]);
94
+ setTimeout(function () {
95
+ setIsWaitingForTx(true);
96
+ setTimeout(function () {
97
+ if (!hasError) {
98
+ setIsSuccessView(true);
99
+ }
100
+ else {
101
+ setWaitingMessage({
102
+ title: 'Transaction Failed',
103
+ subtitle: 'Please try again',
104
+ visible: true,
105
+ isTyping: false,
106
+ });
107
+ setTimeout(function () {
108
+ setIsWaitingForTx(false);
109
+ setIsSigningView(false);
110
+ }, 2000);
111
+ }
112
+ }, 4000);
113
+ }, 4000);
114
+ }, messages_1[1].delay);
115
+ return function () {
116
+ clearInterval(currentInterval_1);
117
+ clearTimeout(messageTimeout_1);
118
+ };
119
+ }
120
+ }, [
121
+ isSigningView,
122
+ isWaitingForTx,
123
+ setIsWaitingForTx,
124
+ setIsSuccessView,
125
+ hasError,
126
+ setIsSigningView,
127
+ ]);
128
+ return { waitingMessage: waitingMessage, setHasError: setHasError };
129
+ }
130
+ export function useTableValues(isSuccessView, selectedChain) {
131
+ var _a = useState({
132
+ tx: { text: '', visible: false, typing: false },
133
+ from: { text: '', visible: false, typing: false },
134
+ to: { text: '', visible: false, typing: false },
135
+ network: { text: '', visible: false, typing: false },
136
+ status: { text: '', visible: false, typing: false },
137
+ }), tableValues = _a[0], setTableValues = _a[1];
138
+ useEffect(function () {
139
+ if (isSuccessView) {
140
+ var chain = CHAINS.find(function (c) { return c.id === selectedChain; });
141
+ var values = {
142
+ tx: '0x1234...5678',
143
+ from: '0xabcd...ef01',
144
+ to: '0x2345...6789',
145
+ network: (chain === null || chain === void 0 ? void 0 : chain.name) || 'Unknown',
146
+ status: 'Success',
147
+ };
148
+ Object.entries(values).forEach(function (_a, index) {
149
+ var key = _a[0], value = _a[1];
150
+ setTimeout(function () {
151
+ var textIndex = 0;
152
+ setTableValues(function (prev) {
153
+ var _a;
154
+ return (__assign(__assign({}, prev), (_a = {}, _a[key] = __assign(__assign({}, prev[key]), { visible: true }), _a)));
155
+ });
156
+ var interval = setInterval(function () {
157
+ if (textIndex <= value.length) {
158
+ setTableValues(function (prev) {
159
+ var _a;
160
+ return (__assign(__assign({}, prev), (_a = {}, _a[key] = {
161
+ text: value.slice(0, textIndex),
162
+ visible: true,
163
+ typing: true,
164
+ }, _a)));
165
+ });
166
+ textIndex++;
167
+ }
168
+ else {
169
+ clearInterval(interval);
170
+ setTableValues(function (prev) {
171
+ var _a;
172
+ return (__assign(__assign({}, prev), (_a = {}, _a[key] = {
173
+ text: value,
174
+ visible: true,
175
+ typing: false,
176
+ }, _a)));
177
+ });
178
+ }
179
+ }, TYPING_INTERVAL);
180
+ }, index * 500);
181
+ });
182
+ }
183
+ }, [isSuccessView, selectedChain]);
184
+ return tableValues;
185
+ }
@@ -0,0 +1 @@
1
+ export default function WalletDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,136 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { ArrowLeft, X } from 'lucide-react';
14
+ import { useState } from 'react';
15
+ import Logo from '../Logo';
16
+ import { INITIAL_APPS } from './constants';
17
+ import { useButtonTyping, useTableValues, useWaitingMessage } from './hooks';
18
+ import { AmountInputScreen } from './screens/AmountInputScreen';
19
+ import { AppsTableScreen } from './screens/AppsTableScreen';
20
+ import { ChainSelectionScreen } from './screens/ChainSelectionScreen';
21
+ import { InitialScreen } from './screens/InitialScreen';
22
+ import { SigningScreen } from './screens/SigningScreen';
23
+ import { SuccessScreen } from './screens/SuccessScreen';
24
+ export default function WalletDeposit() {
25
+ // View states
26
+ var _a = useState(null), selectedChain = _a[0], setSelectedChain = _a[1];
27
+ var _b = useState(''), amount = _b[0], setAmount = _b[1];
28
+ var _c = useState(false), isSigningView = _c[0], setIsSigningView = _c[1];
29
+ var _d = useState(false), isSuccessView = _d[0], setIsSuccessView = _d[1];
30
+ var _e = useState(false), isClosing = _e[0], setIsClosing = _e[1];
31
+ var _f = useState(false), showChainSelect = _f[0], setShowChainSelect = _f[1];
32
+ var _g = useState(true), showInitialScreen = _g[0], setShowInitialScreen = _g[1];
33
+ var _h = useState(false), isWaitingForTx = _h[0], setIsWaitingForTx = _h[1];
34
+ var _j = useState(false), showAppsTable = _j[0], setShowAppsTable = _j[1];
35
+ var _k = useState(INITIAL_APPS), apps = _k[0], setApps = _k[1];
36
+ var _l = useState(false), showModal = _l[0], setShowModal = _l[1];
37
+ var _m = useState(0), blurIntensity = _m[0], setBlurIntensity = _m[1];
38
+ // Animation states
39
+ var _o = useState({
40
+ deposit: { text: '', isTyping: false, showCursor: false },
41
+ continue: { text: '', isTyping: false, showCursor: false },
42
+ openApp: { text: '', isTyping: false, showCursor: false },
43
+ }), buttonStates = _o[0], setButtonStates = _o[1];
44
+ // Custom hooks
45
+ useButtonTyping(buttonStates, setButtonStates);
46
+ var _p = useWaitingMessage(isSigningView, isWaitingForTx, setIsWaitingForTx, setIsSuccessView, setIsSigningView), waitingMessage = _p.waitingMessage, setHasError = _p.setHasError;
47
+ var tableValues = useTableValues(isSuccessView, selectedChain);
48
+ // Event handlers
49
+ var handleClose = function () {
50
+ setIsClosing(true);
51
+ setTimeout(function () {
52
+ setShowAppsTable(true);
53
+ var completedApps = 0;
54
+ var totalApps = apps.length;
55
+ setTimeout(function () {
56
+ var blurInterval = setInterval(function () {
57
+ setBlurIntensity(function (prev) {
58
+ if (prev < 3)
59
+ return prev + 0.15;
60
+ clearInterval(blurInterval);
61
+ return prev;
62
+ });
63
+ }, 50);
64
+ }, 1400);
65
+ apps.forEach(function (_, index) {
66
+ setTimeout(function () {
67
+ var progress = 0;
68
+ var progressInterval = setInterval(function () {
69
+ if (progress < 100) {
70
+ progress += 1;
71
+ setApps(function (prevApps) {
72
+ return prevApps.map(function (app, i) {
73
+ return i === index ? __assign(__assign({}, app), { progress: progress }) : app;
74
+ });
75
+ });
76
+ }
77
+ else {
78
+ clearInterval(progressInterval);
79
+ completedApps++;
80
+ if (completedApps === Math.floor(totalApps * 0.8)) {
81
+ setShowModal(true);
82
+ }
83
+ }
84
+ }, 5);
85
+ }, index * 150);
86
+ });
87
+ }, 700);
88
+ };
89
+ var handleButtonMouseEnter = function (buttonKey) {
90
+ setButtonStates(function (prev) {
91
+ var _a;
92
+ return (__assign(__assign({}, prev), (_a = {}, _a[buttonKey] = { text: '', isTyping: true, showCursor: true }, _a)));
93
+ });
94
+ };
95
+ var handleButtonMouseLeave = function (buttonKey) {
96
+ setButtonStates(function (prev) {
97
+ var _a;
98
+ return (__assign(__assign({}, prev), (_a = {}, _a[buttonKey] = { text: '', isTyping: false, showCursor: false }, _a)));
99
+ });
100
+ };
101
+ if (showAppsTable) {
102
+ return (_jsx("div", { className: "fixed inset-0 bg-white dark:bg-black flex items-center justify-center z-50 font-era overflow-auto", children: _jsx(AppsTableScreen, { apps: apps, blurIntensity: blurIntensity, showModal: showModal }) }));
103
+ }
104
+ return (_jsx("div", { className: "fixed inset-0 bg-gray-50 dark:bg-gray-950 flex items-center justify-center z-50 font-era overflow-auto", children: _jsxs("div", { className: "bg-gray-50 dark:bg-gray-950 relative border border-gray-200 dark:border-gray-800 rounded-md transition-[max-width,transform,opacity] duration-[3000ms] ease-[cubic-bezier(0.16,1,0.3,1)] w-full ".concat(!showChainSelect
105
+ ? 'max-w-sm'
106
+ : isSigningView || isSuccessView
107
+ ? 'max-w-2xl'
108
+ : 'max-w-lg', " ").concat(isClosing ? 'animate-fade-out' : 'animate-fade-in', " m-4 origin-center will-change-[max-width,transform,opacity]"), children: [_jsxs("div", { className: "flex justify-between items-center p-6 ".concat(showInitialScreen ? '' : 'border-b border-gray-200 dark:border-gray-800', " rounded-t-md"), children: [_jsx("div", { className: "flex items-center gap-4", children: !showChainSelect ? (_jsx("div", { className: "w-6 h-6 opacity-0" })) : (_jsxs(_Fragment, { children: [selectedChain && !isSigningView && !isSuccessView && (_jsx("button", { onClick: function () {
109
+ if (showChainSelect && !amount) {
110
+ setSelectedChain(null);
111
+ }
112
+ else {
113
+ setShowChainSelect(false);
114
+ setAmount('');
115
+ }
116
+ }, className: "text-gray-500 hover:text-main dark:text-gray-400 dark:hover:text-main transition-colors duration-200", children: _jsx(ArrowLeft, { size: 20 }) })), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "w-6 h-6 text-gray-50", children: _jsx(Logo, { size: 24 }) }), _jsxs("h2", { className: "text-xl text-gray-400 flex items-center gap-2 ml-2", children: ["Deposit", selectedChain && !isSigningView && !isSuccessView && (_jsx("span", { className: "text-gray-700 font-normal", children: "/ / Amount" })), isSigningView && !isSuccessView && (_jsx("span", { className: "text-gray-700 font-normal", children: "/ / Sign" })), isSuccessView && (_jsx("span", { className: "text-gray-700 font-normal", children: "/ / Success" }))] })] })] })) }), _jsx("button", { onClick: handleClose, className: "text-neutral-400 hover:text-main transition-colors duration-200 h-6 flex items-center", children: _jsx(X, { size: 20 }) })] }), _jsxs("div", { className: "p-6 overflow-hidden relative transition-[height] duration-[3000ms] delay-500 ease-in-out", children: [_jsx("div", { className: "transition-all duration-[3000ms] ease-[cubic-bezier(0.16,1,0.3,1)] ".concat(!showInitialScreen
117
+ ? 'opacity-0 -translate-y-[120%] absolute inset-x-6 pointer-events-none'
118
+ : 'opacity-100 translate-y-0 pointer-events-auto animate-content-appear'), children: _jsx(InitialScreen, { onStart: function () {
119
+ setShowInitialScreen(false);
120
+ setShowChainSelect(true);
121
+ }, buttonStates: buttonStates, onButtonMouseEnter: handleButtonMouseEnter, onButtonMouseLeave: handleButtonMouseLeave }) }), _jsx("div", { className: "transition-all duration-[3000ms] ease-[cubic-bezier(0.16,1,0.3,1)] ".concat(!showChainSelect || selectedChain
122
+ ? 'opacity-0 -translate-x-[120%] absolute inset-x-6 pointer-events-none'
123
+ : 'opacity-100 translate-x-0 pointer-events-auto animate-content-appear'), children: _jsx(ChainSelectionScreen, { onChainSelect: function (chainId) {
124
+ setSelectedChain(chainId);
125
+ setShowChainSelect(true);
126
+ } }) }), _jsx("div", { className: "transition-all duration-[3000ms] ease-[cubic-bezier(0.16,1,0.3,1)] ".concat(!showChainSelect ||
127
+ !selectedChain ||
128
+ isSigningView ||
129
+ isSuccessView
130
+ ? 'opacity-0 translate-x-[120%] absolute inset-x-6 pointer-events-none'
131
+ : 'opacity-100 translate-x-0 pointer-events-auto animate-content-appear'), children: _jsx(AmountInputScreen, { amount: amount, onAmountChange: setAmount, onContinue: function () { return setIsSigningView(true); }, balance: 100, buttonStates: buttonStates, onButtonMouseEnter: handleButtonMouseEnter, onButtonMouseLeave: handleButtonMouseLeave }) }), _jsx("div", { className: "transition-all duration-[3000ms] ease-[cubic-bezier(0.16,1,0.3,1)] ".concat(!isSigningView || isSuccessView
132
+ ? 'opacity-0 translate-x-[120%] absolute inset-x-6 pointer-events-none'
133
+ : 'opacity-100 translate-x-0 pointer-events-auto'), children: _jsx(SigningScreen, { waitingMessage: waitingMessage }) }), _jsx("div", { className: "transition-all duration-[800ms] ease-[cubic-bezier(0.16,1,0.3,1)] ".concat(!isSuccessView
134
+ ? 'opacity-0 translate-x-[120%] absolute inset-x-6 pointer-events-none'
135
+ : 'opacity-100 translate-x-0 pointer-events-auto'), children: _jsx(SuccessScreen, { amount: amount, tableValues: tableValues, onOpenApp: handleClose, buttonStates: buttonStates, onButtonMouseEnter: handleButtonMouseEnter, onButtonMouseLeave: handleButtonMouseLeave }) })] })] }) }));
136
+ }
@@ -0,0 +1,12 @@
1
+ import type { ButtonStates } from '../AnimatedButton';
2
+ interface AmountInputScreenProps {
3
+ amount: string;
4
+ onAmountChange: (amount: string) => void;
5
+ onContinue: () => void;
6
+ balance: number;
7
+ buttonStates: ButtonStates;
8
+ onButtonMouseEnter: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
9
+ onButtonMouseLeave: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
10
+ }
11
+ export declare function AmountInputScreen({ amount, onAmountChange, onContinue, balance, buttonStates, onButtonMouseEnter, onButtonMouseLeave, }: AmountInputScreenProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AnimatedButton } from '../AnimatedButton';
4
+ import { MIN_DEPOSIT, MAX_DEPOSIT } from '../constants';
5
+ export function AmountInputScreen(_a) {
6
+ var amount = _a.amount, onAmountChange = _a.onAmountChange, onContinue = _a.onContinue, balance = _a.balance, buttonStates = _a.buttonStates, onButtonMouseEnter = _a.onButtonMouseEnter, onButtonMouseLeave = _a.onButtonMouseLeave;
7
+ var handleAmountChange = function (e) {
8
+ var value = e.target.value;
9
+ if (/^\d*\.?\d*$/.test(value)) {
10
+ onAmountChange(value);
11
+ }
12
+ };
13
+ var isValidAmount = amount !== '' &&
14
+ Number(amount) >= MIN_DEPOSIT &&
15
+ Number(amount) <= MAX_DEPOSIT &&
16
+ Number(amount) <= balance;
17
+ return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: "Amount" }), _jsxs("span", { className: "text-sm text-gray-500 dark:text-neutral-400", children: ["Balance: ", balance, " USDC"] })] }), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", value: amount, onChange: handleAmountChange, placeholder: "0.00", className: "w-full bg-white dark:bg-neutral-950 border-2 border-gray-100 dark:border-neutral-800 rounded-md px-4 py-3 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-0 focus:border-main dark:focus:border-main transition-colors duration-200" }), _jsxs("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 flex items-center gap-2", children: [_jsx("img", { src: "/images/tokens/usdc.svg", width: 20, height: 20, alt: "USDC" }), _jsx("span", { className: "text-gray-400 dark:text-neutral-500", children: "USDC" })] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Min: ", MIN_DEPOSIT, " USDC"] }), _jsxs("span", { className: "text-xs text-gray-400 dark:text-neutral-500", children: ["Max: ", MAX_DEPOSIT, " USDC"] })] })] }), _jsx(AnimatedButton, { onClick: onContinue, text: "Continue", isTyping: buttonStates.continue.isTyping, disabled: !isValidAmount, onMouseEnter: function () { return onButtonMouseEnter('continue'); }, onMouseLeave: function () { return onButtonMouseLeave('continue'); } })] }));
18
+ }
@@ -0,0 +1,8 @@
1
+ import { App } from '../types';
2
+ interface AppsTableScreenProps {
3
+ apps: App[];
4
+ blurIntensity: number;
5
+ showModal: boolean;
6
+ }
7
+ export declare function AppsTableScreen({ apps, blurIntensity, showModal, }: AppsTableScreenProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Logo from '../../Logo';
3
+ export function AppsTableScreen(_a) {
4
+ var apps = _a.apps, blurIntensity = _a.blurIntensity, showModal = _a.showModal;
5
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid grid-cols-4 gap-4 w-full min-h-full p-8 pb-32 animate-fade-in", children: apps.map(function (app, index) { return (_jsxs("div", { className: "relative h-[200px] overflow-hidden bg-white dark:bg-neutral-950/50 border border-gray-100 dark:border-neutral-800/50 rounded-lg", style: {
6
+ opacity: (app.progress / 100) * 0.6,
7
+ transform: "scale(".concat(0.8 + app.progress / 500, ")"),
8
+ borderColor: 'rgb(var(--main-color), 0.5)',
9
+ borderStyle: 'solid',
10
+ borderWidth: "".concat((app.progress / 100) * 1, "px"),
11
+ transition: 'all 800ms cubic-bezier(0.16, 1, 0.3, 1)',
12
+ filter: "blur(".concat(blurIntensity, "px)"),
13
+ }, children: [_jsx("div", { className: "absolute inset-0 opacity-0 transition-all duration-800 ease-[cubic-bezier(0.16,1,0.3,1)]", style: {
14
+ opacity: app.progress / 2000,
15
+ background: 'rgb(var(--main-color))',
16
+ } }), _jsxs("div", { className: "absolute inset-0 flex flex-col", style: {
17
+ opacity: (app.progress / 100) * 0.7,
18
+ transform: "scale(".concat(0.9 + app.progress / 1000, ")"),
19
+ transition: 'all 800ms cubic-bezier(0.16, 1, 0.3, 1)',
20
+ }, children: [_jsx("div", { className: "h-[1px] w-full bg-gradient-to-r from-transparent via-main/50 dark:via-main/70 to-transparent" }), _jsxs("div", { className: "flex-1 p-4 flex flex-col justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "w-1 h-1 bg-main/50 dark:bg-main/70" }), _jsx("div", { className: "h-[1px] w-12 bg-gradient-to-r from-main/50 dark:from-main/70 to-transparent" })] }), _jsx("div", { className: "flex items-center justify-center", children: _jsx("div", { className: "w-16 h-16 border-2 border-main/50 dark:border-main/70", style: {
21
+ transform: "rotate(".concat(app.progress * 3.6, "deg)"),
22
+ transition: 'transform 800ms cubic-bezier(0.16, 1, 0.3, 1)',
23
+ } }) }), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsx("div", { className: "h-[1px] w-12 bg-gradient-to-l from-main/50 dark:from-main/70 to-transparent" }), _jsx("div", { className: "w-1 h-1 bg-main/50 dark:bg-main/70" })] })] })] })] }, app.name)); }) }), showModal && (_jsx("div", { className: "fixed inset-0 pointer-events-none flex items-center justify-center z-100 brightness-125", children: _jsx("div", { className: "relative border-2 border-gray-100 dark:border-neutral-900 bg-white/90 dark:bg-neutral-950 backdrop-blur-sm rounded-lg transform transition-all duration-500 p-4 -mt-64", style: {
24
+ opacity: 0,
25
+ animation: 'fadeIn 3s cubic-bezier(0.16, 1, 0.3, 1) forwards',
26
+ animationDelay: '1.4s',
27
+ }, children: _jsxs("div", { className: "relative px-8 py-4", children: [_jsx("div", { className: "absolute -top-2 -left-2 w-2 h-2 bg-main/50 dark:bg-neutral-900" }), _jsx("div", { className: "absolute -top-2 -right-2 w-2 h-2 bg-main/50 dark:bg-neutral-900" }), _jsx("div", { className: "absolute -bottom-2 -left-2 w-2 h-2 bg-main/50 dark:bg-neutral-900" }), _jsx("div", { className: "absolute -bottom-2 -right-2 w-2 h-2 bg-main/50 dark:bg-neutral-900" }), _jsx("div", { className: "flex flex-col items-center gap-3", children: _jsxs("h2", { className: "text-xl font-medium tracking-wide text-gray-800 dark:text-neutral-200 flex justify-center items-end", children: [_jsx("span", { className: "text-main/90 dark:text-white/80 px-1", children: "\u2728" }), ' ', "Build something magical on", _jsx("div", { className: "pb-0.5 pl-1", children: _jsx(Logo, { size: 28 }) }), _jsx("span", { className: "text-main/90 dark:text-white/60 px-1", children: "\u2728" })] }) })] }) }) }))] }));
28
+ }
@@ -0,0 +1,5 @@
1
+ interface ChainSelectionScreenProps {
2
+ onChainSelect: (chainId: string) => void;
3
+ }
4
+ export declare function ChainSelectionScreen({ onChainSelect, }: ChainSelectionScreenProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Plus } from 'lucide-react';
3
+ import { CHAINS } from '../constants';
4
+ import { ChainButton } from '../components/ChainButton';
5
+ export function ChainSelectionScreen(_a) {
6
+ var onChainSelect = _a.onChainSelect;
7
+ return (_jsxs("div", { className: "space-y-8", children: [_jsx("div", { className: "grid grid-cols-2 gap-4", children: CHAINS.map(function (chain) { return (_jsx(ChainButton, { chain: chain, onClick: onChainSelect }, chain.id)); }) }), _jsxs("button", { className: "w-full flex items-center justify-center p-6 bg-white dark:bg-neutral-950 border-2 border-gray-100 dark:border-neutral-800 hover:border-main dark:hover:border-main hover:bg-main/5 dark:hover:bg-neutral-900 transition-all duration-200 group rounded-lg", children: [_jsx(Plus, { className: "w-6 h-6 text-gray-400 dark:text-neutral-400 group-hover:text-main dark:group-hover:text-white group-hover:scale-110 transition-all duration-200 mr-2" }), _jsx("span", { className: "font-medium text-gray-600 dark:text-neutral-400 group-hover:text-main dark:group-hover:text-white transition-colors duration-200", children: "More" })] })] }));
8
+ }
@@ -0,0 +1,9 @@
1
+ import { type ButtonStates } from '../AnimatedButton';
2
+ interface InitialScreenProps {
3
+ onStart: () => void;
4
+ buttonStates: ButtonStates;
5
+ onButtonMouseEnter: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
6
+ onButtonMouseLeave: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
7
+ }
8
+ export declare function InitialScreen({ onStart, buttonStates, onButtonMouseEnter, onButtonMouseLeave, }: InitialScreenProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Logo from '../../Logo';
4
+ import { AnimatedButton } from '../AnimatedButton';
5
+ import { useState } from 'react';
6
+ export function InitialScreen(_a) {
7
+ var onStart = _a.onStart, buttonStates = _a.buttonStates, onButtonMouseEnter = _a.onButtonMouseEnter, onButtonMouseLeave = _a.onButtonMouseLeave;
8
+ var _b = useState(0), logoOpacity = _b[0], setLogoOpacity = _b[1];
9
+ var handleMouseEnter = function () {
10
+ setLogoOpacity(1);
11
+ onButtonMouseEnter('deposit');
12
+ };
13
+ var handleMouseLeave = function () {
14
+ setLogoOpacity(0);
15
+ onButtonMouseLeave('deposit');
16
+ };
17
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center pb-8", children: [_jsx("div", { className: "flex justify-center items-center py-8 -mt-8", children: _jsx(Logo, { size: 140, fillOpacity: logoOpacity }) }), _jsx(AnimatedButton, { onClick: onStart, text: "Deposit", isTyping: buttonStates.deposit.isTyping, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave })] }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import { WaitingMessageState } from '../types';
2
+ interface SigningScreenProps {
3
+ waitingMessage: WaitingMessageState;
4
+ }
5
+ export declare function SigningScreen({ waitingMessage }: SigningScreenProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { WaitingMessage } from '../components/WaitingMessage';
3
+ export function SigningScreen(_a) {
4
+ var waitingMessage = _a.waitingMessage;
5
+ return _jsx(WaitingMessage, { message: waitingMessage });
6
+ }
@@ -0,0 +1,12 @@
1
+ import type { ButtonStates } from '../AnimatedButton';
2
+ import type { TableValues } from '../types';
3
+ interface SuccessScreenProps {
4
+ amount: string;
5
+ tableValues: TableValues;
6
+ onOpenApp: () => void;
7
+ buttonStates: ButtonStates;
8
+ onButtonMouseEnter: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
9
+ onButtonMouseLeave: (buttonKey: 'deposit' | 'continue' | 'openApp') => void;
10
+ }
11
+ export declare function SuccessScreen({ amount, tableValues, onOpenApp, buttonStates, }: SuccessScreenProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AnimatedButton } from '../AnimatedButton';
3
+ import { TransactionTable } from '../components/TransactionTable';
4
+ export function SuccessScreen(_a) {
5
+ var amount = _a.amount, tableValues = _a.tableValues, onOpenApp = _a.onOpenApp, buttonStates = _a.buttonStates;
6
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [_jsxs("div", { className: "w-full flex items-start justify-between space-x-4 py-8", children: [_jsx("div", { className: "w-1/2 p-4", children: _jsxs("div", { className: "relative w-full h-full px-5 py-14 rounded-md", children: [_jsx("div", { className: "w-2 h-2 bg-gray-200 dark:bg-neutral-800 absolute -top-2 -left-2" }), _jsx("div", { className: "w-2 h-2 bg-gray-200 dark:bg-neutral-800 absolute -top-2 -right-2" }), _jsx("div", { className: "w-2 h-2 bg-gray-200 dark:bg-neutral-800 absolute -bottom-2 -left-2" }), _jsx("div", { className: "w-2 h-2 bg-gray-200 dark:bg-neutral-800 absolute -bottom-2 -right-2" }), _jsxs("p", { className: "text-7xl tracking-tight text-green-500/80 dark:text-emerald-500/80 font-medium pt-4 underline text-center animate-fade-up", style: { animationDelay: '0.3s' }, children: ["+", Number(amount).toLocaleString(), _jsx("span", { className: "text-2xl text-green-500/50 dark:text-emerald-500/50 ml-2", children: "USDC" })] })] }) }), _jsx(TransactionTable, { tableValues: tableValues })] }), _jsx(AnimatedButton, { onClick: onOpenApp, text: "Launch", isTyping: buttonStates.openApp.isTyping })] }));
7
+ }
@@ -0,0 +1,43 @@
1
+ export interface TableValues {
2
+ tx: {
3
+ text: string;
4
+ visible: boolean;
5
+ typing: boolean;
6
+ };
7
+ from: {
8
+ text: string;
9
+ visible: boolean;
10
+ typing: boolean;
11
+ };
12
+ to: {
13
+ text: string;
14
+ visible: boolean;
15
+ typing: boolean;
16
+ };
17
+ network: {
18
+ text: string;
19
+ visible: boolean;
20
+ typing: boolean;
21
+ };
22
+ status: {
23
+ text: string;
24
+ visible: boolean;
25
+ typing: boolean;
26
+ };
27
+ }
28
+ export interface WaitingMessageState {
29
+ title: string;
30
+ subtitle: string;
31
+ visible: boolean;
32
+ isTyping: boolean;
33
+ }
34
+ export interface Chain {
35
+ id: string;
36
+ name: string;
37
+ logo: string;
38
+ }
39
+ export interface App {
40
+ name: string;
41
+ color: string;
42
+ progress: number;
43
+ }
package/dist/index.d.ts CHANGED
@@ -3,3 +3,5 @@ export { N1WalletProvider } from './Provider/N1WalletProvider';
3
3
  export { N1ModalViewMode } from './Provider/types';
4
4
  export { N1ConnectButton } from './WidgetButton/N1ConnectButton';
5
5
  export { useN1WalletContext } from './Provider/hooks';
6
+ export { default as Logo } from './components/Logo';
7
+ export { default as WalletDeposit } from './components/WalletDeposit';
package/dist/index.js CHANGED
@@ -3,3 +3,5 @@ export { N1WalletProvider } from './Provider/N1WalletProvider';
3
3
  export { N1ModalViewMode } from './Provider/types';
4
4
  export { N1ConnectButton } from './WidgetButton/N1ConnectButton';
5
5
  export { useN1WalletContext } from './Provider/hooks';
6
+ export { default as Logo } from './components/Logo';
7
+ export { default as WalletDeposit } from './components/WalletDeposit';