@n1xyz/wallet-widget 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +29 -0
- package/dist/Common/NIcon.d.ts +1 -0
- package/dist/Common/NIcon.js +7 -0
- package/dist/Logic/getPseudoName.d.ts +1 -0
- package/dist/Logic/getPseudoName.js +5825 -0
- package/dist/Logic/utils.d.ts +20 -0
- package/dist/Logic/utils.js +199 -0
- package/dist/Logic/words.d.ts +9 -0
- package/dist/Logic/words.js +93571 -0
- package/dist/Modal/BackButton.d.ts +3 -0
- package/dist/Modal/BackButton.js +13 -0
- package/dist/Modal/ConnectView.d.ts +1 -0
- package/dist/Modal/ConnectView.js +71 -0
- package/dist/Modal/CreateSessionView.d.ts +1 -0
- package/dist/Modal/CreateSessionView.js +236 -0
- package/dist/Modal/CreateUserView.d.ts +1 -0
- package/dist/Modal/CreateUserView.js +160 -0
- package/dist/Modal/ModalHeader.d.ts +1 -0
- package/dist/Modal/ModalHeader.js +9 -0
- package/dist/Modal/N1WalletModal.d.ts +1 -0
- package/dist/Modal/N1WalletModal.js +232 -0
- package/dist/Modal/NoWhitelistView.d.ts +1 -0
- package/dist/Modal/NoWhitelistView.js +29 -0
- package/dist/Modal/Sidebar/N1Sidebar.d.ts +1 -0
- package/dist/Modal/Sidebar/N1Sidebar.js +38 -0
- package/dist/Modal/SigningView.d.ts +1 -0
- package/dist/Modal/SigningView.js +5 -0
- package/dist/Modal/SuccessView.d.ts +1 -0
- package/dist/Modal/SuccessView.js +10 -0
- package/dist/Provider/LazyWalletProvider.d.ts +1 -0
- package/dist/Provider/LazyWalletProvider.js +160 -0
- package/dist/Provider/N1WalletProvider.d.ts +2 -0
- package/dist/Provider/N1WalletProvider.js +219 -0
- package/dist/Provider/context.d.ts +5 -0
- package/dist/Provider/context.js +4 -0
- package/dist/Provider/hooks.d.ts +2 -0
- package/dist/Provider/hooks.js +16 -0
- package/dist/Provider/icons/CoinbaseWalletIcon.d.ts +1 -0
- package/dist/Provider/icons/CoinbaseWalletIcon.js +4 -0
- package/dist/Provider/icons/ConnectionDotsSVG.d.ts +1 -0
- package/dist/Provider/icons/ConnectionDotsSVG.js +4 -0
- package/dist/Provider/icons/MetamaskIcon.d.ts +1 -0
- package/dist/Provider/icons/MetamaskIcon.js +4 -0
- package/dist/Provider/icons/PhantomIcon.d.ts +1 -0
- package/dist/Provider/icons/PhantomIcon.js +4 -0
- package/dist/Provider/icons/UserIcon.d.ts +1 -0
- package/dist/Provider/icons/UserIcon.js +4 -0
- package/dist/Provider/icons/WalletConnectIcon.d.ts +1 -0
- package/dist/Provider/icons/WalletConnectIcon.js +4 -0
- package/dist/Provider/index.d.ts +3 -0
- package/dist/Provider/index.js +3 -0
- package/dist/Provider/types.d.ts +68 -0
- package/dist/Provider/types.js +14 -0
- package/dist/WidgetButton/N1ConnectButton.d.ts +5 -0
- package/dist/WidgetButton/N1ConnectButton.js +24 -0
- package/dist/components/AnimatedButton.d.ts +9 -0
- package/dist/components/AnimatedButton.js +5 -0
- package/dist/components/LazyLoadWrapper.d.ts +8 -0
- package/dist/components/LazyLoadWrapper.js +17 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -0
- package/dist/errors/types.d.ts +21 -0
- package/dist/errors/types.js +64 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/main.css +1 -0
- package/dist/utils/lazyLoad.d.ts +3 -0
- package/dist/utils/lazyLoad.js +9 -0
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.js +106 -0
- package/dist/utils/react-shim.d.ts +2 -0
- package/dist/utils/react-shim.js +6 -0
- package/package.json +46 -0
- package/postcss.config.js +6 -0
- package/src/Logic/getPseudoName.ts +5832 -0
- package/src/Logic/utils.ts +162 -0
- package/src/Logic/words.ts +93571 -0
- package/src/Modal/BackButton.tsx +23 -0
- package/src/Modal/ConnectView.tsx +88 -0
- package/src/Modal/CreateSessionView.tsx +242 -0
- package/src/Modal/CreateUserView.tsx +195 -0
- package/src/Modal/ModalHeader.tsx +64 -0
- package/src/Modal/N1WalletModal.tsx +275 -0
- package/src/Modal/NoWhitelistView.tsx +61 -0
- package/src/Modal/Sidebar/N1Sidebar.tsx +172 -0
- package/src/Modal/SigningView.tsx +18 -0
- package/src/Modal/SuccessView.tsx +36 -0
- package/src/Provider/LazyWalletProvider.tsx +136 -0
- package/src/Provider/N1WalletProvider.tsx +208 -0
- package/src/Provider/context.ts +11 -0
- package/src/Provider/hooks.ts +22 -0
- package/src/Provider/icons/CoinbaseWalletIcon.tsx +27 -0
- package/src/Provider/icons/ConnectionDotsSVG.tsx +19 -0
- package/src/Provider/icons/MetamaskIcon.tsx +58 -0
- package/src/Provider/icons/PhantomIcon.tsx +26 -0
- package/src/Provider/icons/UserIcon.tsx +15 -0
- package/src/Provider/icons/WalletConnectIcon.tsx +15 -0
- package/src/Provider/index.ts +3 -0
- package/src/Provider/types.ts +77 -0
- package/src/WidgetButton/N1ConnectButton.tsx +72 -0
- package/src/components/LazyLoadWrapper.tsx +19 -0
- package/src/config.ts +2 -0
- package/src/errors/types.ts +49 -0
- package/src/index.ts +5 -0
- package/src/main.css +3 -0
- package/src/styles/main.css +3 -0
- package/src/utils/lazyLoad.ts +12 -0
- package/src/utils/logger.ts +98 -0
- package/src/utils/react-shim.js +8 -0
- package/tailwind.config.js +44 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
2
|
+
|
|
3
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
4
|
+
|
|
5
|
+
interface LoggerOptions {
|
|
6
|
+
prefix?: string;
|
|
7
|
+
level?: LogLevel;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class Logger {
|
|
11
|
+
private prefix: string;
|
|
12
|
+
private level: LogLevel;
|
|
13
|
+
|
|
14
|
+
constructor(options: LoggerOptions = {}) {
|
|
15
|
+
this.prefix = options.prefix || '[N1-Wallet]';
|
|
16
|
+
this.level = options.level || 'debug';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private shouldLog(level: LogLevel): boolean {
|
|
20
|
+
if (!isDevelopment) return false;
|
|
21
|
+
|
|
22
|
+
const levels: Record<LogLevel, number> = {
|
|
23
|
+
debug: 0,
|
|
24
|
+
info: 1,
|
|
25
|
+
warn: 2,
|
|
26
|
+
error: 3,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return levels[level] >= levels[this.level];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private formatMessage(level: LogLevel, ...args: any[]): any[] {
|
|
33
|
+
const timestamp = new Date().toISOString();
|
|
34
|
+
const prefix = `${timestamp} ${this.prefix} [${level.toUpperCase()}]`;
|
|
35
|
+
return [prefix, ...args];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
debug(...args: any[]): void {
|
|
39
|
+
if (this.shouldLog('debug')) {
|
|
40
|
+
console.log(...this.formatMessage('debug', ...args));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
info(...args: any[]): void {
|
|
45
|
+
if (this.shouldLog('info')) {
|
|
46
|
+
console.info(...this.formatMessage('info', ...args));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
warn(...args: any[]): void {
|
|
51
|
+
if (this.shouldLog('warn')) {
|
|
52
|
+
console.warn(...this.formatMessage('warn', ...args));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
error(...args: any[]): void {
|
|
57
|
+
if (this.shouldLog('error')) {
|
|
58
|
+
console.error(...this.formatMessage('error', ...args));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
group(label: string): void {
|
|
63
|
+
if (isDevelopment) {
|
|
64
|
+
console.group(this.formatMessage('debug', label)[0]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
groupEnd(): void {
|
|
69
|
+
if (isDevelopment) {
|
|
70
|
+
console.groupEnd();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Create default logger instance
|
|
76
|
+
export const logger = new Logger();
|
|
77
|
+
|
|
78
|
+
// Export the Logger class for custom instances
|
|
79
|
+
export { Logger };
|
|
80
|
+
|
|
81
|
+
// Example usage:
|
|
82
|
+
/*
|
|
83
|
+
import { logger } from '@/utils/logger';
|
|
84
|
+
|
|
85
|
+
logger.debug('Debug message');
|
|
86
|
+
logger.info('Info message');
|
|
87
|
+
logger.warn('Warning message');
|
|
88
|
+
logger.error('Error message');
|
|
89
|
+
|
|
90
|
+
logger.group('Group label');
|
|
91
|
+
logger.debug('Grouped message');
|
|
92
|
+
logger.groupEnd();
|
|
93
|
+
|
|
94
|
+
// Custom logger instance
|
|
95
|
+
const customLogger = new Logger({ prefix: '[Custom]', level: 'warn' });
|
|
96
|
+
customLogger.debug('This won\'t show');
|
|
97
|
+
customLogger.warn('This will show');
|
|
98
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
content: [
|
|
3
|
+
'./src/**/*.{html,js,jsx,ts,tsx}', // Adjust this based on your file structure and extensions
|
|
4
|
+
],
|
|
5
|
+
darkMode: 'class',
|
|
6
|
+
theme: {
|
|
7
|
+
extend: {
|
|
8
|
+
animation: {
|
|
9
|
+
'spin-slow': 'spin 2.1s linear infinite',
|
|
10
|
+
},
|
|
11
|
+
fontFamily: {
|
|
12
|
+
MonSans: ["Mona Sans", "sans-serif"],
|
|
13
|
+
mono: ["Monument Grotesk", "mono"],
|
|
14
|
+
},
|
|
15
|
+
colors: {
|
|
16
|
+
primary: {
|
|
17
|
+
bg: {
|
|
18
|
+
DEFAULT: 'white',
|
|
19
|
+
dark: '#171717',
|
|
20
|
+
},
|
|
21
|
+
text: {
|
|
22
|
+
DEFAULT: '#171717',
|
|
23
|
+
dark: 'white',
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
secondary: {
|
|
27
|
+
bg: {
|
|
28
|
+
DEFAULT: '#f5f5f5',
|
|
29
|
+
dark: '#262626',
|
|
30
|
+
},
|
|
31
|
+
text: {
|
|
32
|
+
DEFAULT: '#525252',
|
|
33
|
+
dark: '#a3a3a3',
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
border: {
|
|
37
|
+
DEFAULT: '#e5e5e5',
|
|
38
|
+
dark: '#404040',
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
plugins: [],
|
|
44
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"outDir": "./dist",
|
|
14
|
+
"moduleResolution": "node",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"jsx": "react-jsx"
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"]
|
|
21
|
+
}
|