@gluwa/connect-kit 0.1.0-next.3 → 0.2.0-next.10
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/CHANGELOG.md +68 -0
- package/assets/fonts/Inter-Medium.ttf +0 -0
- package/assets/fonts/Inter-Medium.woff2 +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-Regular.woff2 +0 -0
- package/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/assets/fonts/Inter-SemiBold.woff2 +0 -0
- package/assets/graphic.png +0 -0
- package/assets/metamask.png +0 -0
- package/assets/penguinwallet.png +0 -0
- package/assets/wc-logo.svg +3 -0
- package/assets/wc-search.png +0 -0
- package/dist/chunk-VE5LB7BN.js +405 -0
- package/dist/credit-connect.js +2 -394
- package/dist/index.css +2075 -0
- package/dist/index.d.ts +58 -33
- package/dist/index.js +1748 -1503
- package/dist/package.json +16 -10
- package/package.json +14 -11
- package/src/ConnectKitProvider.tsx +133 -75
- package/src/api/account.ts +21 -0
- package/src/api/asset.ts +10 -0
- package/src/api/balance.ts +10 -0
- package/src/api/chain.ts +17 -0
- package/src/api/contract.ts +33 -0
- package/src/api/transaction.ts +12 -0
- package/src/assets.d.ts +5 -0
- package/src/components/actionItem/index.tsx +50 -0
- package/src/components/actionItem/style.scss +47 -0
- package/src/components/copyLink/index.tsx +16 -0
- package/src/components/copyLink/style.scss +16 -0
- package/src/components/qrArea/index.tsx +72 -0
- package/src/components/qrArea/style.scss +122 -0
- package/src/components/searchBar/asset/Search.tsx +20 -0
- package/src/components/searchBar/asset/XMarkCircle.tsx +24 -0
- package/src/components/searchBar/index.tsx +44 -0
- package/src/components/searchBar/style.scss +58 -0
- package/src/components/toast/index.tsx +41 -0
- package/src/components/toast/style.scss +108 -0
- package/src/components/toggle/index.tsx +27 -0
- package/src/components/toggle/style.scss +53 -0
- package/src/components/walletGrid/index.tsx +64 -0
- package/src/components/walletGrid/style.scss +108 -0
- package/src/components/walletItem/index.tsx +49 -0
- package/src/components/walletItem/style.scss +70 -0
- package/src/connector-meta.ts +16 -11
- package/src/core/config.ts +102 -0
- package/src/creditConnectConnector.ts +198 -184
- package/src/events/account.ts +76 -0
- package/src/hooks/useConnectBanner.ts +79 -0
- package/src/hooks/useConnectTimeout.ts +92 -0
- package/src/hooks/useMetaMaskExtension.ts +29 -0
- package/src/hooks/useWCState.ts +45 -14
- package/src/hooks/useWagmiConnect.ts +42 -11
- package/src/index.ts +38 -2
- package/src/layout/allWallets/index.tsx +52 -0
- package/src/layout/allWallets/style.scss +57 -0
- package/src/layout/connectDialog/asset/backIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/checkIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/closeIcon.tsx +21 -0
- package/src/layout/connectDialog/asset/copyIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/linkIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/spinner.tsx +21 -0
- package/src/layout/connectDialog/asset/warningIcon.tsx +21 -0
- package/src/layout/connectDialog/idle/assets/banner-placeholder.png +0 -0
- package/src/layout/connectDialog/idle/index.tsx +55 -0
- package/src/layout/connectDialog/idle/style.scss +52 -0
- package/src/layout/connectDialog/index.tsx +432 -0
- package/src/layout/connectDialog/loading/index.tsx +13 -0
- package/src/layout/connectDialog/loading/style.scss +19 -0
- package/src/layout/connectDialog/metaMask/index.tsx +61 -0
- package/src/layout/connectDialog/metaMask/style.scss +65 -0
- package/src/layout/connectDialog/qr/index.tsx +33 -0
- package/src/layout/connectDialog/style.scss +48 -0
- package/src/layout/connectDialog/timeout/index.tsx +31 -0
- package/src/layout/connectDialog/timeout/style.scss +64 -0
- package/src/layout/connectDialog/walletConnect/index.tsx +45 -0
- package/src/layout/connectDialog/walletConnect/style.scss +48 -0
- package/src/layout/connectDialog/walletQR/index.tsx +37 -0
- package/src/layout/detailPanel/index.tsx +175 -0
- package/src/layout/detailPanel/style.scss +70 -0
- package/src/layout/selectorPanel/index.tsx +100 -0
- package/src/layout/selectorPanel/style.scss +113 -0
- package/src/style/color.scss +417 -0
- package/src/style/font.scss +28 -0
- package/src/style/index.scss +5 -0
- package/src/style/mixin.scss +217 -0
- package/src/style/reset.scss +110 -0
- package/src/style/variables.scss +13 -0
- package/src/types.ts +40 -7
- package/src/utils/platform.ts +6 -7
- package/src/wallet-display-override.ts +15 -0
- package/tsconfig.json +5 -1
- package/tsup.config.ts +32 -2
- package/assets/creditwallet.png +0 -0
- package/dist/chunk-DDA6FP6U.js +0 -7
- package/src/ConnectModal.scss +0 -665
- package/src/ConnectModal.tsx +0 -559
- package/src/components/QRFrame.tsx +0 -43
- package/src/views/CreditWalletView.tsx +0 -59
- package/src/views/IdleView.tsx +0 -10
- package/src/views/MetaMaskView.tsx +0 -64
- package/src/views/SwitchChainView.tsx +0 -67
- package/src/views/WalletConnectView.tsx +0 -206
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use './variables.scss' as *;
|
|
4
|
+
|
|
5
|
+
@mixin tiny-mobile {
|
|
6
|
+
@media (max-width: #{$tiny-mobile-width}) {
|
|
7
|
+
@content;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@mixin themedScrollbar {
|
|
12
|
+
// Firefox
|
|
13
|
+
scrollbar-width: thin;
|
|
14
|
+
scrollbar-color: var(--scale-gray-300) transparent;
|
|
15
|
+
|
|
16
|
+
// WebKit (Chrome / Safari)
|
|
17
|
+
&::-webkit-scrollbar {
|
|
18
|
+
width: 6px;
|
|
19
|
+
height: 6px;
|
|
20
|
+
}
|
|
21
|
+
&::-webkit-scrollbar-track {
|
|
22
|
+
background: transparent;
|
|
23
|
+
}
|
|
24
|
+
&::-webkit-scrollbar-thumb {
|
|
25
|
+
background-color: var(--scale-gray-300);
|
|
26
|
+
border-radius: 3px;
|
|
27
|
+
}
|
|
28
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
29
|
+
background-color: var(--scale-gray-400);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@mixin small-mobile {
|
|
34
|
+
@media (max-width: #{$small-mobile-width}) {
|
|
35
|
+
@content;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@mixin mobile {
|
|
40
|
+
@media (max-width: #{$mobile-width}) {
|
|
41
|
+
@content;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@mixin wide-mobile {
|
|
46
|
+
@media (max-width: #{$wide-mobile-width}) {
|
|
47
|
+
@content;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin tablet {
|
|
52
|
+
@media (max-width: #{$tablet-width}) {
|
|
53
|
+
@content;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@mixin break {
|
|
58
|
+
@media (max-width: #{$break-width}) {
|
|
59
|
+
@content;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@mixin tiny-pc {
|
|
64
|
+
@media (max-width: #{$tiny-pc-width}) {
|
|
65
|
+
@content;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@mixin small-pc {
|
|
70
|
+
@media (max-width: #{$small-pc-width}) {
|
|
71
|
+
@content;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@mixin min-pc {
|
|
76
|
+
@media (max-width: #{$min-pc-width}) {
|
|
77
|
+
@content;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@mixin max-width($width) {
|
|
82
|
+
@media (max-width: #{$width}) {
|
|
83
|
+
@content;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@mixin background-image($image, $path: null, $type: png) {
|
|
88
|
+
background-repeat: no-repeat;
|
|
89
|
+
background-size: cover;
|
|
90
|
+
@if ($path == null) {
|
|
91
|
+
background-image: url(../../src/asset/image/#{$image}.#{$type});
|
|
92
|
+
|
|
93
|
+
} @else {
|
|
94
|
+
background-image: url(../../src/asset/image/#{$path}/#{$image}.#{$type});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
@mixin mask-image($image, $type: svg, $path: null) {
|
|
98
|
+
mask-repeat: no-repeat;
|
|
99
|
+
mask-size: cover;
|
|
100
|
+
|
|
101
|
+
@if ($path == null) {
|
|
102
|
+
mask-image: url(../../src/asset/image/#{$image}.#{$type});
|
|
103
|
+
} @else {
|
|
104
|
+
mask-image: url(../../src/asset/image/#{$path}/#{$image}.#{$type});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@mixin font-scale(
|
|
109
|
+
$font-family,
|
|
110
|
+
$size-pc,
|
|
111
|
+
$size-tablet,
|
|
112
|
+
$line-height: 1.5,
|
|
113
|
+
$letter-spacing: null
|
|
114
|
+
) {
|
|
115
|
+
font-family: $font-family;
|
|
116
|
+
font-size: $size-pc;
|
|
117
|
+
line-height: $line-height;
|
|
118
|
+
@if $letter-spacing != null {
|
|
119
|
+
letter-spacing: $letter-spacing;
|
|
120
|
+
}
|
|
121
|
+
@include tablet {
|
|
122
|
+
font-size: calc(($size-pc + $size-tablet) / 2);
|
|
123
|
+
}
|
|
124
|
+
@include mobile {
|
|
125
|
+
font-size: $size-tablet;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$tokens: (
|
|
130
|
+
'h1-bold': ('Inter-SB', 72px, 36px, 1.15, -0.03em),
|
|
131
|
+
'h1-regular': ('Inter-R', 72px, 36px, 1.15, -0.03em),
|
|
132
|
+
'h2-bold': ('Inter-SB', 60px, 36px, 1.15, -0.03em),
|
|
133
|
+
'h2-regular': ('Inter-R', 60px, 36px, 1.15, -0.03em),
|
|
134
|
+
'h3-bold': ('Inter-SB', 54px, 36px, 1.15, -0.03em),
|
|
135
|
+
'h3-regular': ('Inter-R', 54px, 36px, 1.15, -0.03em),
|
|
136
|
+
'h4-bold': ('Inter-SB', 48px, 30px, 1.15, -0.03em),
|
|
137
|
+
'h4-regular': ('Inter-R', 48px, 30px, 1.15, -0.03em),
|
|
138
|
+
'h5-bold': ('Inter-SB', 42px, 28px, 1.15, -0.03em),
|
|
139
|
+
'h5-regular': ('Inter-R', 42px, 28px, 1.15, -0.03em),
|
|
140
|
+
|
|
141
|
+
'amount-bold': ('Inter-SB', 60px, 60px, 1.15, -0.03em),
|
|
142
|
+
'amount-regular': ('Inter-R', 60px, 60px, 1.15, -0.03em),
|
|
143
|
+
|
|
144
|
+
'title1-bold': ('Inter-SB', 32px, 24px, 1.5, -0.03em),
|
|
145
|
+
'title1-regular': ('Inter-R', 32px, 24px, 1.5, -0.03em),
|
|
146
|
+
'title2-bold': ('Inter-SB', 26px, 22px, 1.5, -0.03em),
|
|
147
|
+
'title2-regular': ('Inter-R', 26px, 22px, 1.5, -0.03em),
|
|
148
|
+
'title3-bold': ('Inter-SB', 24px, 20px, 1.5, -0.03em),
|
|
149
|
+
'title3-regular': ('Inter-R', 24px, 20px, 1.5, -0.03em),
|
|
150
|
+
'title4-bold': ('Inter-SB', 20px, 18px, 1.5, -0.03em),
|
|
151
|
+
'title4-regular': ('Inter-R', 20px, 18px, 1.5, -0.03em),
|
|
152
|
+
'title5-bold': ('Inter-SB', 19px, 17px, 1.5, -0.01em),
|
|
153
|
+
'title5-regular': ('Inter-R', 19px, 17px, 1.5, -0.01em),
|
|
154
|
+
|
|
155
|
+
'subtitle1-bold': ('Inter-SB', 18px, 16px, 1.5, -0.01em),
|
|
156
|
+
'subtitle1-regular': ('Inter-R', 18px, 16px, 1.5, -0.01em),
|
|
157
|
+
'subtitle2-bold': ('Inter-SB', 17px, 15px, 1.5, -0.01em),
|
|
158
|
+
'subtitle2-regular': ('Inter-R', 17px, 15px, 1.5, -0.01em),
|
|
159
|
+
|
|
160
|
+
'body1-l1-bold': ('Inter-SB', 18px, 16px, 1.8, -0.01em),
|
|
161
|
+
'body1-l1-regular': ('Inter-R', 18px, 16px, 1.8, -0.01em),
|
|
162
|
+
'body1-l1-medium': ('Inter-M', 18px, 16px, 1.8, -0.01em),
|
|
163
|
+
'body1-l2-bold': ('Inter-SB', 18px, 16px, 1.5, -0.01em),
|
|
164
|
+
'body1-l2-regular':('Inter-R', 18px, 16px, 1.5, -0.01em),
|
|
165
|
+
'body1-l2-medium': ('Inter-M', 18px, 16px, 1.5, -0.01em),
|
|
166
|
+
|
|
167
|
+
'body2-l1-bold': ('Inter-SB', 17px, 15px, 1.8, -0.01em),
|
|
168
|
+
'body2-l1-regular': ('Inter-R', 17px, 15px, 1.8, -0.01em),
|
|
169
|
+
'body2-l1-medium': ('Inter-M', 17px, 15px, 1.8, -0.01em),
|
|
170
|
+
'body2-l2-bold': ('Inter-SB', 17px, 15px, 1.5, -0.01em),
|
|
171
|
+
'body2-l2-regular': ('Inter-R', 17px, 15px, 1.5, -0.01em),
|
|
172
|
+
'body2-l2-medium': ('Inter-M', 17px, 15px, 1.5, -0.01em),
|
|
173
|
+
|
|
174
|
+
'body3-l1-bold': ('Inter-SB', 16px, 14px, 1.8, -0.01em),
|
|
175
|
+
'body3-l1-regular': ('Inter-R', 16px, 14px, 1.8, -0.01em),
|
|
176
|
+
'body3-l1-medium': ('Inter-M', 16px, 14px, 1.8, -0.01em),
|
|
177
|
+
'body3-l2-bold': ('Inter-SB', 16px, 14px, 1.5, -0.01em),
|
|
178
|
+
'body3-l2-regular': ('Inter-R', 16px, 14px, 1.5, -0.01em),
|
|
179
|
+
'body3-l2-medium': ('Inter-M', 16px, 14px, 1.5, -0.01em),
|
|
180
|
+
|
|
181
|
+
'body4-l1-bold': ('Inter-SB', 15px, 13px, 1.8, -0.01em),
|
|
182
|
+
'body4-l1-regular': ('Inter-R', 15px, 13px, 1.8, -0.01em),
|
|
183
|
+
'body4-l1-medium': ('Inter-M', 15px, 13px, 1.8, -0.01em),
|
|
184
|
+
'body4-l2-bold': ('Inter-SB', 15px, 13px, 1.5, -0.01em),
|
|
185
|
+
'body4-l2-regular': ('Inter-R', 15px, 13px, 1.5, -0.01em),
|
|
186
|
+
'body4-l2-medium': ('Inter-M', 15px, 13px, 1.5, -0.01em),
|
|
187
|
+
|
|
188
|
+
'label1-bold': ('Inter-SB', 18px, 16px, 1.5, -0.01em),
|
|
189
|
+
'label1-regular': ('Inter-R', 18px, 16px, 1.5, -0.01em),
|
|
190
|
+
'label2-bold': ('Inter-SB', 17px, 15px, 1.5, -0.01em),
|
|
191
|
+
'label2-regular': ('Inter-R', 17px, 15px, 1.5, -0.01em),
|
|
192
|
+
'label3-bold': ('Inter-SB', 16px, 14px, 1.5, -0.01em),
|
|
193
|
+
'label3-regular': ('Inter-R', 16px, 14px, 1.5, -0.01em),
|
|
194
|
+
'label4-bold': ('Inter-SB', 15px, 13px, 1.5, -0.01em),
|
|
195
|
+
'label4-regular': ('Inter-R', 15px, 13px, 1.5, -0.01em),
|
|
196
|
+
'label5-bold': ('Inter-SB', 14px, 12px, 1.5, -0.01em),
|
|
197
|
+
'label5-regular': ('Inter-R', 14px, 12px, 1.5, -0.01em),
|
|
198
|
+
'label6-bold': ('Inter-SB', 13px, 11px, 1.5, -0.01em),
|
|
199
|
+
'label6-regular': ('Inter-R', 13px, 11px, 1.5, -0.01em),
|
|
200
|
+
|
|
201
|
+
'caption1-bold': ('Inter-SB', 12px, 10px, 1.5, -0.01em),
|
|
202
|
+
'caption1-regular': ('Inter-R', 12px, 10px, 1.5, -0.01em),
|
|
203
|
+
'caption2-bold': ('Inter-SB', 11px, 9px, 1.5, -0.01em),
|
|
204
|
+
'caption2-regular': ('Inter-R', 11px, 9px, 1.5, -0.01em),
|
|
205
|
+
'caption3-bold': ('Inter-SB', 10px, 8px, 1.5, -0.01em),
|
|
206
|
+
'caption3-regular': ('Inter-R', 10px, 8px, 1.5, -0.01em),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
@mixin textToken($type) {
|
|
210
|
+
$mixin-item: map.get($tokens, $type);
|
|
211
|
+
@if $mixin-item {
|
|
212
|
+
--font-name: #{$type};
|
|
213
|
+
@include font-scale($mixin-item...);
|
|
214
|
+
} @else {
|
|
215
|
+
@warn 'Unknown text token: #{$type}';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// ── Scoped reset (.ck-root 안에서만 적용) ────────────────────────────────────
|
|
2
|
+
// 전역 reset이 없는 환경에서도 dialog UI가 일관되게 보이도록 보호.
|
|
3
|
+
|
|
4
|
+
.ck-root {
|
|
5
|
+
*,
|
|
6
|
+
*::before,
|
|
7
|
+
*::after {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 텍스트
|
|
12
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
font-weight: normal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 리스트
|
|
19
|
+
ul, ol {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
list-style: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
li {
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
vertical-align: top;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 이미지
|
|
32
|
+
img {
|
|
33
|
+
display: block;
|
|
34
|
+
border: 0;
|
|
35
|
+
vertical-align: top;
|
|
36
|
+
max-width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 링크
|
|
40
|
+
a {
|
|
41
|
+
color: inherit;
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 버튼
|
|
47
|
+
button {
|
|
48
|
+
margin: 0;
|
|
49
|
+
padding: 0;
|
|
50
|
+
border: 0;
|
|
51
|
+
background: none;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
font-family: inherit;
|
|
54
|
+
color: inherit;
|
|
55
|
+
appearance: none;
|
|
56
|
+
-webkit-appearance: none;
|
|
57
|
+
outline: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 인풋
|
|
61
|
+
input {
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
border: none;
|
|
65
|
+
background: none;
|
|
66
|
+
font-family: inherit;
|
|
67
|
+
color: inherit;
|
|
68
|
+
appearance: none;
|
|
69
|
+
-webkit-appearance: none;
|
|
70
|
+
outline: none;
|
|
71
|
+
|
|
72
|
+
&[type='search']::-webkit-search-cancel-button {
|
|
73
|
+
-webkit-appearance: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[type='text']:focus,
|
|
77
|
+
&[type='search']:focus {
|
|
78
|
+
outline: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// dialog — preserve browser centering (margin: auto) for showModal()
|
|
83
|
+
dialog {
|
|
84
|
+
padding: 0;
|
|
85
|
+
border: none;
|
|
86
|
+
background: transparent;
|
|
87
|
+
color: inherit;
|
|
88
|
+
max-width: none;
|
|
89
|
+
max-height: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// label
|
|
93
|
+
label {
|
|
94
|
+
margin: 0;
|
|
95
|
+
padding: 0;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// figure
|
|
100
|
+
figure {
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 폰트 기본값
|
|
106
|
+
font-family: 'Inter-R', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
107
|
+
color: var(--scale-gray-900);
|
|
108
|
+
-webkit-font-smoothing: antialiased;
|
|
109
|
+
-moz-osx-font-smoothing: grayscale;
|
|
110
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
|
|
3
|
+
$max-width: 1280px;
|
|
4
|
+
$min-pc-width: 1279px;
|
|
5
|
+
$small-pc-width: 1080px;
|
|
6
|
+
$tiny-pc-width: 920px;
|
|
7
|
+
$break-width: 821px;
|
|
8
|
+
$tablet-width: 767px;
|
|
9
|
+
$wide-mobile-width: 500px;
|
|
10
|
+
$mobile-width: 450px;
|
|
11
|
+
$small-mobile-width: 400px;
|
|
12
|
+
$tiny-mobile-width: 346px;
|
|
13
|
+
|
package/src/types.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Chain, Transport } from 'viem';
|
|
3
|
+
import type { CreateConnectorFn } from 'wagmi';
|
|
2
4
|
|
|
3
|
-
export type ConnectorId = '
|
|
5
|
+
export type ConnectorId = 'CREDIT_CONNECT' | 'METAMASK' | 'WALLET_CONNECT';
|
|
4
6
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export interface ConnectKitConfig {
|
|
8
|
+
chains: [Chain, ...Chain[]];
|
|
9
|
+
transports: Record<number, Transport>;
|
|
10
|
+
wcProjectId?: string;
|
|
11
|
+
creditConnect?: {
|
|
12
|
+
projectId: string;
|
|
13
|
+
serverUrl: string;
|
|
14
|
+
};
|
|
15
|
+
extraConnectors?: CreateConnectorFn[];
|
|
16
|
+
autoConnectInjected?: boolean;
|
|
11
17
|
}
|
|
12
18
|
|
|
19
|
+
// 활성화할 connector key 배열. 빠진 key 는 비활성. 순서가 selector 표시 순서를 결정.
|
|
20
|
+
export type ConnectorKey = 'creditWallet' | 'metamask' | 'walletConnect';
|
|
21
|
+
export type Connectors = readonly ConnectorKey[];
|
|
22
|
+
|
|
13
23
|
export interface WCWallet {
|
|
14
24
|
id: string;
|
|
15
25
|
name: string;
|
|
@@ -25,6 +35,28 @@ export interface WCWallet {
|
|
|
25
35
|
|
|
26
36
|
export type WCSubView = 'qr' | 'list' | 'wallet';
|
|
27
37
|
|
|
38
|
+
export type ConnectKitTheme = 'light' | 'dark';
|
|
39
|
+
|
|
40
|
+
export type ConnectBannerSiteKey =
|
|
41
|
+
| 'penguin-swap'
|
|
42
|
+
| 'penguin-bridge'
|
|
43
|
+
| 'penguin-base'
|
|
44
|
+
| 'penguin-wallet';
|
|
45
|
+
|
|
46
|
+
export interface ConnectBanner {
|
|
47
|
+
id: number;
|
|
48
|
+
siteKey: ConnectBannerSiteKey;
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle: string;
|
|
51
|
+
linkText: string;
|
|
52
|
+
linkUrl: string;
|
|
53
|
+
imageUrl: string;
|
|
54
|
+
titleColor: string;
|
|
55
|
+
subtitleColor: string;
|
|
56
|
+
linkTextColor: string;
|
|
57
|
+
closeColor: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
28
60
|
export interface ConnectResult {
|
|
29
61
|
address: `0x${string}`;
|
|
30
62
|
connectorId: ConnectorId;
|
|
@@ -48,5 +80,6 @@ export interface ConnectModalProps {
|
|
|
48
80
|
onLog?: (message: string, error?: Error) => void;
|
|
49
81
|
wcProjectId?: string;
|
|
50
82
|
requiredChainId?: number;
|
|
83
|
+
theme: ConnectKitTheme;
|
|
51
84
|
renderConnectError?: (ctx: ConnectErrorContext) => ReactNode;
|
|
52
85
|
}
|
package/src/utils/platform.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
// 모바일 기기 감지
|
|
2
1
|
export const isMobileDevice = (): boolean => {
|
|
3
2
|
if (typeof window === 'undefined') return false;
|
|
4
3
|
return /android|iphone|ipad|ipod/i.test(navigator.userAgent);
|
|
5
4
|
};
|
|
6
5
|
|
|
7
|
-
// 딥링크 열기 (walletConnect가 지원하는 지갑앱)
|
|
8
6
|
export const tryOpenDeepLink = (uri: string, deepLinkBase: string): void => {
|
|
9
7
|
const sep = deepLinkBase.endsWith('/') ? '' : '/';
|
|
10
|
-
window.location.
|
|
8
|
+
window.location.replace(`${deepLinkBase}${sep}wc?uri=${encodeURIComponent(uri)}`);
|
|
11
9
|
};
|
|
12
10
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
// CC payload (full URL `https://app.creditcoin.org/?creditconnect=<base64>`) 를
|
|
12
|
+
// wallet custom scheme 으로 wrap 해 redirect — wallet parser 가 step 1 unwrap 후 step 3 cc 인식.
|
|
13
|
+
export const tryOpenCreditWalletDeeplink = (payloadUrl: string): void => {
|
|
14
|
+
window.location.replace(`creditwallet://?uri=${encodeURIComponent(payloadUrl)}`);
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import penguinWalletIcon from '../assets/penguinwallet.png';
|
|
2
|
+
import type { WCWallet } from './types';
|
|
3
|
+
|
|
4
|
+
// TODO-CRCN-11: WC에 PenguinWallet 추가 시 삭제
|
|
5
|
+
export const CREDIT_WALLET_LISTING_ID =
|
|
6
|
+
'ce02f1ae74686234eabfa7d31876c442779b730dfe7924a3ca0e6559a7afa30f';
|
|
7
|
+
|
|
8
|
+
export const overrideWalletDisplay = (wallet: WCWallet): WCWallet =>
|
|
9
|
+
wallet.id === CREDIT_WALLET_LISTING_ID
|
|
10
|
+
? {
|
|
11
|
+
...wallet,
|
|
12
|
+
name: 'PenguinWallet',
|
|
13
|
+
imageUrl: penguinWalletIcon,
|
|
14
|
+
}
|
|
15
|
+
: wallet;
|
package/tsconfig.json
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"noEmit": true,
|
|
5
|
-
"baseUrl": "./"
|
|
5
|
+
"baseUrl": "./",
|
|
6
|
+
"paths": {
|
|
7
|
+
"react": ["./node_modules/@types/react"],
|
|
8
|
+
"react/*": ["./node_modules/@types/react/*"]
|
|
9
|
+
}
|
|
6
10
|
},
|
|
7
11
|
"include": ["src/**/*"]
|
|
8
12
|
}
|
package/tsup.config.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'tsup';
|
|
2
2
|
import { sassPlugin } from 'esbuild-sass-plugin';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { resolve as resolvePath, extname } from 'node:path';
|
|
3
5
|
|
|
4
6
|
export default defineConfig({
|
|
5
7
|
entry: {
|
|
@@ -26,8 +28,36 @@ export default defineConfig({
|
|
|
26
28
|
banner: {
|
|
27
29
|
js: 'import React from "react";',
|
|
28
30
|
},
|
|
29
|
-
|
|
31
|
+
// esbuild 의 css url() resolveDir 는 entry scss 의 위치 — chain 안 깊은 곳의
|
|
32
|
+
// font.scss 의 './fonts/' 경로가 entry 마다 다른 dir 로 잘못 resolve 됨.
|
|
33
|
+
// 우회: sass 컴파일 결과의 './fonts/<file>' url 을 transform 에서 직접 base64 inline.
|
|
34
|
+
// dist/index.css 가 fonts 까지 self-contained — 외부 dApp 의 추가 설정 불필요.
|
|
35
|
+
esbuildPlugins: [
|
|
36
|
+
sassPlugin({
|
|
37
|
+
type: 'css',
|
|
38
|
+
transform: (css) => {
|
|
39
|
+
const fontsDir = resolvePath(__dirname, 'assets/fonts');
|
|
40
|
+
// url(...) 안의 어떤 상대경로 prefix 든 무시하고 마지막 'fonts/<file>' 만 사용.
|
|
41
|
+
// font.scss 의 ../../assets/fonts/Inter-*.{woff2,ttf} 매칭.
|
|
42
|
+
return css.replace(
|
|
43
|
+
/url\((['"]?)[^'")]*?\/fonts\/([^'")]+)\1\)/g,
|
|
44
|
+
(_match, _quote, file: string) => {
|
|
45
|
+
const absPath = resolvePath(fontsDir, file);
|
|
46
|
+
const data = readFileSync(absPath).toString('base64');
|
|
47
|
+
const ext = extname(file).slice(1);
|
|
48
|
+
const mime =
|
|
49
|
+
ext === 'woff2' ? 'font/woff2' : ext === 'ttf' ? 'font/ttf' : `font/${ext}`;
|
|
50
|
+
return `url(data:${mime};base64,${data})`;
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
],
|
|
30
56
|
esbuildOptions(options) {
|
|
31
|
-
options.loader = {
|
|
57
|
+
options.loader = {
|
|
58
|
+
...options.loader,
|
|
59
|
+
'.png': 'dataurl',
|
|
60
|
+
'.svg': 'dataurl',
|
|
61
|
+
};
|
|
32
62
|
},
|
|
33
63
|
});
|
package/assets/creditwallet.png
DELETED
|
Binary file
|