@web3jskit/walletkit 0.0.4 → 0.0.6

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 (94) hide show
  1. package/README.md +18 -20
  2. package/dist/package.json +7 -4
  3. package/dist/src/components/ConnectButton/ConnectedInfo.js +1 -0
  4. package/dist/src/components/ConnectButton/ConnectedInfo.js.map +1 -1
  5. package/dist/src/components/ConnectButton/index.d.ts +1 -1
  6. package/dist/src/components/ConnectButton/index.js +3 -2
  7. package/dist/src/components/ConnectButton/index.js.map +1 -1
  8. package/dist/src/components/Connecting/index.js +1 -0
  9. package/dist/src/components/Connecting/index.js.map +1 -1
  10. package/dist/src/components/GetWallet/index.js +3 -7
  11. package/dist/src/components/GetWallet/index.js.map +1 -1
  12. package/dist/src/components/Header/ModalHeader.js +1 -0
  13. package/dist/src/components/Header/ModalHeader.js.map +1 -1
  14. package/dist/src/components/Icon/index.js +1 -0
  15. package/dist/src/components/Icon/index.js.map +1 -1
  16. package/dist/src/components/Introduce/index.js +1 -0
  17. package/dist/src/components/Introduce/index.js.map +1 -1
  18. package/dist/src/components/Modal/ConnectModal.js +1 -0
  19. package/dist/src/components/Modal/ConnectModal.js.map +1 -1
  20. package/dist/src/components/Modal/WalletInfoModal.js +1 -0
  21. package/dist/src/components/Modal/WalletInfoModal.js.map +1 -1
  22. package/dist/src/components/Modal/index.js +1 -0
  23. package/dist/src/components/Modal/index.js.map +1 -1
  24. package/dist/src/components/Text/index.js +1 -0
  25. package/dist/src/components/Text/index.js.map +1 -1
  26. package/dist/src/components/WalletKitProvider/ChainProvider.js +1 -0
  27. package/dist/src/components/WalletKitProvider/ChainProvider.js.map +1 -1
  28. package/dist/src/components/WalletKitProvider/I18nProvider.js +1 -0
  29. package/dist/src/components/WalletKitProvider/I18nProvider.js.map +1 -1
  30. package/dist/src/components/WalletKitProvider/ThemeProvider.js +1 -0
  31. package/dist/src/components/WalletKitProvider/ThemeProvider.js.map +1 -1
  32. package/dist/src/components/WalletKitProvider/index.js +1 -0
  33. package/dist/src/components/WalletKitProvider/index.js.map +1 -1
  34. package/dist/src/components/WalletList/index.js +1 -0
  35. package/dist/src/components/WalletList/index.js.map +1 -1
  36. package/dist/src/components/WalletTriggerButton/index.js +1 -0
  37. package/dist/src/components/WalletTriggerButton/index.js.map +1 -1
  38. package/dist/tsconfig.build.tsbuildinfo +1 -1
  39. package/package.json +7 -4
  40. package/src/assets/svg/dataBase.ts +0 -11
  41. package/src/assets/svg/metaMaskWallet.ts +0 -35
  42. package/src/components/ConnectButton/ConnectedInfo.tsx +0 -17
  43. package/src/components/ConnectButton/index.tsx +0 -48
  44. package/src/components/Connecting/index.tsx +0 -26
  45. package/src/components/Connecting/style.ts +0 -53
  46. package/src/components/GetWallet/index.tsx +0 -82
  47. package/src/components/GetWallet/style.ts +0 -118
  48. package/src/components/Header/ModalHeader.tsx +0 -24
  49. package/src/components/Header/style.ts +0 -74
  50. package/src/components/Icon/index.tsx +0 -120
  51. package/src/components/Introduce/index.tsx +0 -30
  52. package/src/components/Introduce/style.ts +0 -73
  53. package/src/components/Modal/ConnectModal.tsx +0 -155
  54. package/src/components/Modal/WalletInfoModal.tsx +0 -82
  55. package/src/components/Modal/index.tsx +0 -80
  56. package/src/components/Modal/style.ts +0 -190
  57. package/src/components/SVGs/backArrowSvg.tsx +0 -10
  58. package/src/components/SVGs/closeSvg.tsx +0 -11
  59. package/src/components/SVGs/copiedSvg.tsx +0 -11
  60. package/src/components/SVGs/copySvg.tsx +0 -11
  61. package/src/components/SVGs/exitSvg.tsx +0 -11
  62. package/src/components/SVGs/spinSvg.tsx +0 -10
  63. package/src/components/Text/index.tsx +0 -67
  64. package/src/components/WalletKitProvider/ChainProvider.tsx +0 -34
  65. package/src/components/WalletKitProvider/I18nProvider.tsx +0 -52
  66. package/src/components/WalletKitProvider/ThemeProvider.tsx +0 -16
  67. package/src/components/WalletKitProvider/index.tsx +0 -40
  68. package/src/components/WalletList/index.tsx +0 -42
  69. package/src/components/WalletList/style.ts +0 -102
  70. package/src/components/WalletTriggerButton/index.tsx +0 -50
  71. package/src/components/WalletTriggerButton/style.ts +0 -53
  72. package/src/default.d.ts +0 -18
  73. package/src/hooks/useWalletKit.ts +0 -42
  74. package/src/index.ts +0 -9
  75. package/src/locals/i18n.ts +0 -19
  76. package/src/locals/languages/en.json +0 -30
  77. package/src/locals/languages/zh.json +0 -30
  78. package/src/locals/resources.ts +0 -11
  79. package/src/stores/SlotsWalletStore.ts +0 -48
  80. package/src/stores/index.ts +0 -75
  81. package/src/styled/index.ts +0 -79
  82. package/src/test/getwalletprovider.test.ts +0 -9
  83. package/src/test/setup.ts +0 -7
  84. package/src/theme/index.ts +0 -93
  85. package/src/theme/styled.d.ts +0 -30
  86. package/src/types/configType.ts +0 -2
  87. package/src/types/slotsType.ts +0 -23
  88. package/src/utils/formatter.ts +0 -4
  89. package/src/utils/generateAvatar.ts +0 -35
  90. package/src/wallets/GelWallet/index.ts +0 -0
  91. package/src/wallets/SlotsWallets/index.ts +0 -30
  92. package/tsconfig.build.json +0 -4
  93. package/tsconfig.json +0 -55
  94. package/vitest.config.ts +0 -10
@@ -1,75 +0,0 @@
1
- import { create } from 'zustand';
2
- import { persist, createJSONStorage } from 'zustand/middleware';
3
- import type { Locals, Theme } from '../types/configType';
4
-
5
- export enum AppModal {
6
- ConnectModal,
7
- InfoModal
8
- }
9
-
10
- type Avatar = {
11
- text: string;
12
- bg: string;
13
- };
14
-
15
- export interface WalletKitState {
16
- chains: Array<any>;
17
- setChains: (chains: Array<any>) => void;
18
-
19
- language: Locals;
20
- setLanguage: (language: Locals) => void;
21
-
22
- theme: Theme;
23
- toggleTheme: () => void;
24
-
25
- modalType: AppModal | null;
26
- openModal: (modal: AppModal) => void;
27
- closeModal: () => void;
28
-
29
- avatar: Avatar | null;
30
- setAvatar: (avatar: Avatar) => void;
31
- }
32
-
33
- export const walletKitStore = create<WalletKitState>()(
34
- persist(
35
- (set, get) => ({
36
- chains: [],
37
- setChains(chains: Array<any>) {
38
- return set(() => ({ chains }));
39
- },
40
-
41
- language: 'en',
42
- setLanguage(language: Locals) {
43
- return set(() => ({ language }));
44
- },
45
-
46
- theme: 'lightMode',
47
- toggleTheme() {
48
- const { theme } = get();
49
- return set(() => ({ theme: theme === 'darkMode' ? 'lightMode' : 'darkMode' }));
50
- },
51
-
52
- modalType: null,
53
- openModal(modal: AppModal) {
54
- return set(() => ({ modalType: modal }));
55
- },
56
- closeModal() {
57
- return set(() => ({ modalType: null }));
58
- },
59
-
60
- avatar: null,
61
- setAvatar(avatar: Avatar) {
62
- return set(() => ({ avatar }));
63
- }
64
- }),
65
- {
66
- name: 'WALLET_KIT_STORE',
67
- storage: createJSONStorage(() => localStorage),
68
- onRehydrateStorage: () => state => {
69
- if (state) {
70
- state.closeModal();
71
- }
72
- }
73
- }
74
- )
75
- );
@@ -1,79 +0,0 @@
1
- import { styled } from 'styled-components';
2
-
3
- export const FlexBox = styled.div`
4
- display: flex;
5
- position: relative;
6
- `;
7
- export const FlexCenter = styled.div`
8
- display: flex;
9
- align-items: center;
10
- justify-content: center;
11
- `;
12
- export const FlexAICenter = styled.div`
13
- display: flex;
14
- align-items: center;
15
- `;
16
- export const FlexJCCenter = styled.div`
17
- display: flex;
18
- justify-content: center;
19
- `;
20
- export const FlexJCSpaceBetween = styled.div`
21
- display: flex;
22
- justify-content: space-between;
23
- `;
24
-
25
- export const FlexJCEnd = styled.div`
26
- display: flex;
27
- justify-content: flex-end;
28
- `;
29
- export const FlexJCStart = styled.div`
30
- display: flex;
31
- justify-content: flex-start;
32
- `;
33
- export const FlexWrap = styled.div`
34
- display: flex;
35
- flex-wrap: wrap;
36
- `;
37
- export const FlexCol = styled.div`
38
- display: flex;
39
- flex-direction: column;
40
- `;
41
- export const FlexColAIEnd = styled.div`
42
- display: flex;
43
- flex-direction: column;
44
- align-items: end;
45
- `;
46
- export const FlexColJCEnd = styled.div`
47
- display: flex;
48
- flex-direction: column;
49
- justify-content: end;
50
- `;
51
- export const FlexCenterCol = styled.div`
52
- display: flex;
53
- flex-direction: column;
54
- align-items: center;
55
- justify-content: center;
56
- `;
57
- export const FlexJCCenterCol = styled.div`
58
- display: flex;
59
- flex-direction: column;
60
- justify-content: center;
61
- `;
62
-
63
- export const FlexJCSBCol = styled.div`
64
- display: flex;
65
- flex-direction: column;
66
- justify-content: space-between;
67
- `;
68
- export const FlexJCSBCenter = styled.div`
69
- display: flex;
70
- align-items: center;
71
- justify-content: space-between;
72
- `;
73
- export const FlexAICenterCol = styled.div`
74
- display: flex;
75
- flex-direction: column;
76
- justify-content: center;
77
- `;
78
-
79
- export const SlotWrapper = styled.div``;
@@ -1,9 +0,0 @@
1
- import { describe, it } from 'vitest';
2
- describe('getInjectedProvider', () => {
3
- it('metamask provider', () => {
4
- console.log('connector');
5
- });
6
- it('getInjectedConnector', () => {
7
- console.log('connector');
8
- });
9
- });
package/src/test/setup.ts DELETED
@@ -1,7 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- import { cleanup } from '@testing-library/react';
3
- import { afterEach } from 'vitest';
4
-
5
- afterEach(() => {
6
- cleanup();
7
- });
@@ -1,93 +0,0 @@
1
- import { createGlobalStyle } from 'styled-components';
2
-
3
- export const themeStyle = {
4
- darkMode: {
5
- textColor: '#ffffff',
6
- textColor1: '#757575 ',
7
- textColor2: '#ffffff',
8
- textColor3: '#5c5c5c',
9
- textColor4: '#ffffff',
10
- textColor5: '#858585',
11
- buttonBg: '#ffffff',
12
- buttonColor: '#000000',
13
- modalBg: '#191919',
14
- modalSideBg: '#171717',
15
- itemActiveBg: 'rgba(255, 255, 255, 0.20)',
16
- itemHoverBg: 'rgba(255, 255, 255, 0.10)',
17
- blue: '#00a6ff',
18
- gray: '#acacac',
19
- borderColor: '#2a2a2a',
20
- backArrowColor: '#fbfbfb',
21
- closeBtnBg: 'rgba(146, 146, 146, .2)',
22
- closeBtnColor: '#ffffff',
23
- closeBtnHoverBg: 'rgba(146, 146, 146, .4)',
24
- infoBtnBg: 'rgba(224, 232, 255, 0.1)',
25
- infoBtnHoverBg: 'rgba(224, 232, 255, 0.2)',
26
- cardBg: 'linear-gradient(126deg, rgba(120, 120, 120, 0.2) 9.49%, rgba(0, 0, 0, 0) 71.04%), #1A1B1F',
27
- spinColor: '#ffffff'
28
- },
29
- lightMode: {
30
- textColor: '#000000',
31
- textColor1: '#757575',
32
- textColor2: '#444444',
33
- textColor3: '#a8a8a8',
34
- textColor4: '#111111',
35
- textColor5: '#858585',
36
- buttonBg: '#000000',
37
- buttonColor: '#ffffff',
38
- modalBg: '#ffffff',
39
- modalSideBg: '#f9f9f9',
40
- itemActiveBg: 'rgba(0, 0, 0, 0.20)',
41
- itemHoverBg: 'rgba(0, 0, 0, 0.10)',
42
- blue: '#00a6ff',
43
- gray: '#acacac',
44
- borderColor: '#f0f0f0',
45
- backArrowColor: '#161617',
46
- closeBtnBg: 'rgba(146, 146, 146, .3)',
47
- closeBtnColor: '#ffffff',
48
- closeBtnHoverBg: 'rgba(146, 146, 146, .5)',
49
- infoBtnBg: 'rgba(0, 0, 0, 0.05)',
50
- infoBtnHoverBg: 'rgba(0, 0, 0, 0.1)',
51
- cardBg: 'linear-gradient(126deg,rgba(200, 200, 200, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%),#f5f5f5',
52
- spinColor: '#6a6a6a'
53
- }
54
- };
55
-
56
- export const ThemedGlobalStyle = createGlobalStyle`
57
-
58
- .gap-2 {
59
- gap: 2px;
60
- }
61
-
62
- .gap-4 {
63
- gap: 4px;
64
- }
65
-
66
- .gap-6 {
67
- gap: 6px;
68
- }
69
-
70
- .gap-8 {
71
- gap: 8px;
72
- }
73
-
74
- .gap-10 {
75
- gap: 10px;
76
- }
77
-
78
- .gap-12 {
79
- gap: 12px;
80
- }
81
-
82
- .gap-14 {
83
- gap: 14px;
84
- }
85
-
86
- .gap-16 {
87
- gap: 16px;
88
- }
89
-
90
- .pd-tb-10{
91
- padding: 10px 0;
92
- }
93
- `;
@@ -1,30 +0,0 @@
1
- // styled.d.ts
2
- import 'styled-components';
3
-
4
- declare module 'styled-components' {
5
- export interface DefaultTheme {
6
- textColor: string;
7
- textColor1: string;
8
- textColor2: string;
9
- textColor3: string;
10
- textColor4: string;
11
- textColor5: string;
12
- buttonBg: string;
13
- buttonColor: string;
14
- modalBg: string;
15
- modalSideBg: string;
16
- itemActiveBg: string;
17
- itemHoverBg: string;
18
- blue: string;
19
- gray: string;
20
- borderColor: string;
21
- backArrowColor: string;
22
- closeBtnBg: string;
23
- closeBtnColor: string;
24
- closeBtnHoverBg: string;
25
- infoBtnBg: string;
26
- infoBtnHoverBg: string;
27
- cardBg: string;
28
- spinColor: string;
29
- }
30
- }
@@ -1,2 +0,0 @@
1
- export type Locals = 'zh-CN' | 'en' | 'zh' | 'en-US';
2
- export type Theme = 'darkMode' | 'lightMode';
@@ -1,23 +0,0 @@
1
- export interface EIP6963ProviderInfo {
2
- uuid: string;
3
- name: string;
4
- icon: string;
5
- rdns: string;
6
- }
7
- export interface ISlots {
8
- EIP6963ProviderInfo?: EIP6963ProviderInfo;
9
- isEIP6963Provider?: boolean;
10
- injected?: boolean;
11
- provider: any;
12
- namespace: string;
13
- }
14
- export interface ICreateSlots {
15
- slots?: Array<ISlots>;
16
- }
17
- export interface ISlotsConnector {
18
- uuid: string;
19
- walletName: string;
20
- walletIcon: string;
21
- connector?: any;
22
- connectorNamespace?: string;
23
- }
@@ -1,4 +0,0 @@
1
- export const formatAddress = (address: string) => {
2
- if (!address) return '';
3
- return `${address.slice(0, 4)}...${address.slice(-4)}`;
4
- };
@@ -1,35 +0,0 @@
1
- export function generateRandomAvatar() {
2
- const animalColors = {
3
- '🐵': '#8B4513',
4
- '🐶': '#A0522D',
5
- '🐺': '#696969',
6
- '🦊': '#FF8C00',
7
- '🦝': '#808080',
8
- '🐱': '#FAFAD2',
9
- '🦁': '#FFA500',
10
- '🐯': '#FF8C00',
11
- '🐮': '#8B4513',
12
- '🐷': '#FF8CBC',
13
- '🐗': '#8B4513',
14
- '🦒': '#FFD700',
15
- '🐭': '#D3D3D3',
16
- '🐹': '#DEB887',
17
- '🐰': '#FFF5EE',
18
- '🐻': '#8B4513',
19
- '🐨': '#A9A9A9',
20
- '🐼': '#FFFFFF',
21
- '🐸': '#7CFC00'
22
- };
23
-
24
- const keys = Object.keys(animalColors) as (keyof typeof animalColors)[];
25
- const randomIndex = Math.floor(Math.random() * keys.length);
26
- const text = keys[randomIndex];
27
-
28
- if (!text) {
29
- throw new Error('Unexpected undefined value from keys[randomIndex]');
30
- }
31
-
32
- const bg = animalColors[text];
33
-
34
- return { text, bg };
35
- }
File without changes
@@ -1,30 +0,0 @@
1
- import type { EIP6963ProviderInfo, ICreateSlots, ISlots } from '../../types/slotsType';
2
-
3
- export function announceProvider(info: EIP6963ProviderInfo, provider: any) {
4
- (window as any)['ethereum'] = provider;
5
- try {
6
- window.dispatchEvent(
7
- new CustomEvent('eip6963:announceProvider', {
8
- detail: Object.freeze({ info, provider })
9
- })
10
- );
11
- window.dispatchEvent(new Event('eip6963:requestProvider'));
12
- } catch (e) {
13
- console.error(e);
14
- }
15
- }
16
-
17
- export function createSlots({ slots }: ICreateSlots) {
18
- if (slots && slots?.length) {
19
- const providers: any = {};
20
-
21
- slots?.map((slot: ISlots) => {
22
- if (slot?.isEIP6963Provider && slot?.EIP6963ProviderInfo && !slot?.injected) {
23
- announceProvider(slot.EIP6963ProviderInfo, slot.provider);
24
- }
25
- providers[slot.namespace] = slot.provider;
26
- });
27
- return providers;
28
- }
29
- return;
30
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "exclude": ["**/tests"]
4
- }
package/tsconfig.json DELETED
@@ -1,55 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2021",
4
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
5
- "module": "ESNext",
6
- "skipLibCheck": true,
7
- "strict": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "esModuleInterop": true,
10
- "moduleResolution": "Bundler",
11
- "experimentalDecorators": true,
12
- "resolveJsonModule": true,
13
- "removeComments": true,
14
- "isolatedModules": true,
15
- "allowJs": false,
16
- "allowSyntheticDefaultImports": true,
17
- "allowUnreachableCode": false,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noImplicitReturns": true,
21
- "noImplicitOverride": true,
22
- "noFallthroughCasesInSwitch": true,
23
- "noPropertyAccessFromIndexSignature": true,
24
- "noUncheckedIndexedAccess": true,
25
- "verbatimModuleSyntax": true,
26
- "sourceMap": true,
27
- "incremental": true,
28
- // "composite": true,
29
- "preserveSymlinks": false,
30
- "declaration": true,
31
- "declarationDir": "dist",
32
- "jsx": "react-jsx",
33
- "outDir": "dist" // 指定输出目录
34
-
35
- //
36
- // "noEmit": true,
37
- // "alwaysStrict": true,
38
- // "strictNullChecks": true,
39
- // "noImplicitAny": true,
40
- // "noImplicitThis": true,
41
- // "downlevelIteration": true,
42
- },
43
- "exclude": [
44
- "node_modules",
45
- "src/**/*.test.tsx",
46
- "src/**/*.test.ts",
47
- "dist",
48
- "types",
49
- "out",
50
- ".next",
51
- ".turbo",
52
- "coverage"
53
- ],
54
- "include": ["src/**/*", "package.json"]
55
- }
package/vitest.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'jsdom',
6
- globals: true,
7
- setupFiles: ['./src/test/setup.ts'],
8
- watch: false
9
- }
10
- });