Skip to content

Commit 65ab66b

Browse files
author
slient-coder
committed
fix: Fix some issues
fix: Fix some issues
1 parent 295b705 commit 65ab66b

File tree

14 files changed

+100
-71
lines changed

14 files changed

+100
-71
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@types/react": "^18.0.9",
5656
"@types/react-cache": "^2.0.1",
5757
"@types/react-dom": "^18.0.4",
58-
"@unisat/wallet-sdk": "1.8.0-beta.2",
58+
"@unisat/wallet-sdk": "1.8.0",
5959
"antd": "^4.20.4",
6060
"antd-dayjs-webpack-plugin": "1.0.6",
6161
"assert": "^2.0.0",

patches/bitcoinjs-lib+6.1.6.patch

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
diff --git a/node_modules/bitcoinjs-lib/src/psbt.js b/node_modules/bitcoinjs-lib/src/psbt.js
2-
index b071f37..1eded75 100644
2+
index b071f37..14b235a 100644
33
--- a/node_modules/bitcoinjs-lib/src/psbt.js
44
+++ b/node_modules/bitcoinjs-lib/src/psbt.js
5+
@@ -444,7 +444,7 @@ class Psbt {
6+
sighashCache = sig.hashType;
7+
hashCache = hash;
8+
scriptCache = script;
9+
- checkScriptForPubkey(pSig.pubkey, script, 'verify');
10+
+ // checkScriptForPubkey(pSig.pubkey, script, 'verify');
11+
results.push(validator(pSig.pubkey, hash, sig.signature));
12+
}
13+
return results.every(res => res === true);
14+
@@ -1194,7 +1194,7 @@ function getHashAndSighashType(
15+
false,
16+
sighashTypes,
17+
);
18+
- checkScriptForPubkey(pubkey, script, 'sign');
19+
+ // checkScriptForPubkey(pubkey, script, 'sign');
20+
return {
21+
hash,
22+
sighashType,
523
@@ -1342,7 +1342,7 @@ function getTaprootHashesForSig(
624
}
725
}

src/ui/components/Input/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ export const AddressInput = (props: InputProps) => {
192192
const chain = useChain();
193193

194194
let SUPPORTED_DOMAINS = ['sats', 'unisat', 'x', 'btc'];
195-
let addressPlaceholder = 'Address or name (sats, unisat, ...) ';
195+
let addressPlaceholder = 'Address or name (.sats, .unisat, ...) ';
196196
if (chain.isFractal) {
197197
SUPPORTED_DOMAINS = ['fb'];
198-
addressPlaceholder = 'Address or name (fb) ';
198+
addressPlaceholder = 'Address or name (.fb) ';
199199
}
200200

201201
const tools = useTools();
@@ -210,6 +210,8 @@ export const AddressInput = (props: InputProps) => {
210210
const addressTips = getAddressTips(validAddress, chain.enum);
211211
if (addressTips.sendTip) {
212212
setAddressTip(addressTips.sendTip);
213+
} else {
214+
setAddressTip('');
213215
}
214216
}, [validAddress]);
215217

src/ui/pages/Account/SwitchAccountScreen.tsx

+14-15
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ import { useAppDispatch } from '@/ui/state/hooks';
1111
import { useCurrentKeyring } from '@/ui/state/keyrings/hooks';
1212
import { colors } from '@/ui/theme/colors';
1313
import { copyToClipboard, shortAddress, useWallet } from '@/ui/utils';
14-
import {
15-
CheckCircleFilled,
16-
CopyOutlined,
17-
EditOutlined,
18-
EllipsisOutlined,
19-
KeyOutlined,
20-
PlusCircleOutlined
21-
} from '@ant-design/icons';
14+
import { CopyOutlined, EditOutlined, EllipsisOutlined, KeyOutlined, PlusCircleOutlined } from '@ant-design/icons';
2215

2316
import { useNavigate } from '../MainRoute';
2417

@@ -52,14 +45,20 @@ export function MyItem({ account, autoNav }: MyItemProps, ref) {
5245
const tools = useTools();
5346

5447
return (
55-
<Card justifyBetween style={{ height: ITEM_HEIGHT - 8, marginTop: 8 }}>
48+
<Card
49+
justifyBetween
50+
style={{
51+
height: ITEM_HEIGHT - 8,
52+
marginTop: 8,
53+
borderColor: 'rgba(244,182,44,0.5)',
54+
borderWidth: selected ? 1 : 0,
55+
backgroundColor: selected ? 'rgba(244,182,44,0.1)' : colors.black_dark,
56+
marginLeft: 10,
57+
marginRight: 10
58+
}}>
5659
<Row>
5760
<Column style={{ width: 20 }} selfItemsCenter>
58-
{selected && (
59-
<Icon>
60-
<CheckCircleFilled />
61-
</Icon>
62-
)}
61+
{selected ? <Icon icon="circle-check" color="gold" /> : <Icon icon="circle-check" color="white_muted2" />}
6362
</Column>
6463
<Column
6564
onClick={async (e) => {
@@ -198,7 +197,7 @@ export default function SwitchAccountScreen() {
198197
)
199198
}
200199
/>
201-
<Content style={{ height: layoutHeight }}>
200+
<Content style={{ padding: 5 }}>
202201
<VirtualList
203202
data={items}
204203
data-id="list"

src/ui/pages/Account/SwitchKeyringScreen.tsx

+14-15
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ import { useCurrentKeyring, useKeyrings } from '@/ui/state/keyrings/hooks';
1212
import { keyringsActions } from '@/ui/state/keyrings/reducer';
1313
import { colors } from '@/ui/theme/colors';
1414
import { shortAddress, useWallet } from '@/ui/utils';
15-
import {
16-
CheckCircleFilled,
17-
DeleteOutlined,
18-
EditOutlined,
19-
KeyOutlined,
20-
PlusCircleOutlined,
21-
SettingOutlined
22-
} from '@ant-design/icons';
15+
import { DeleteOutlined, EditOutlined, KeyOutlined, PlusCircleOutlined, SettingOutlined } from '@ant-design/icons';
2316

2417
import { useNavigate } from '../MainRoute';
2518

@@ -63,7 +56,17 @@ export function MyItem({ keyring, autoNav }: MyItemProps, ref) {
6356
const [removeVisible, setRemoveVisible] = useState(false);
6457

6558
return (
66-
<Card justifyBetween style={{ height: ITEM_HEIGHT - 8, marginTop: 8 }}>
59+
<Card
60+
justifyBetween
61+
style={{
62+
height: ITEM_HEIGHT - 8,
63+
marginTop: 8,
64+
borderColor: 'rgba(244,182,44,0.5)',
65+
borderWidth: selected ? 1 : 0,
66+
backgroundColor: selected ? 'rgba(244,182,44,0.1)' : colors.black_dark,
67+
marginLeft: 10,
68+
marginRight: 10
69+
}}>
6770
<Row
6871
full
6972
onClick={async (e) => {
@@ -80,11 +83,7 @@ export function MyItem({ keyring, autoNav }: MyItemProps, ref) {
8083
if (autoNav) navigate('MainScreen');
8184
}}>
8285
<Column style={{ width: 20 }} selfItemsCenter>
83-
{selected && (
84-
<Icon>
85-
<CheckCircleFilled />
86-
</Icon>
87-
)}
86+
{selected ? <Icon icon="circle-check" color="gold" /> : <Icon icon="circle-check" color="white_muted2" />}
8887
</Column>
8988

9089
<Column justifyCenter>
@@ -244,7 +243,7 @@ export default function SwitchKeyringScreen() {
244243
</Icon>
245244
}
246245
/>
247-
<Content>
246+
<Content style={{ padding: 5 }}>
248247
<VirtualList
249248
ref={refList}
250249
data={items}

src/ui/pages/Approval/components/MultiSignPsbt/MultiSignDisclaimerModal.tsx

+12-21
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import { Checkbox } from 'antd';
2-
import { useState } from 'react';
3-
41
import { Button, Column, Row, Text } from '@/ui/components';
52
import { BottomModal } from '@/ui/components/BottomModal';
63
import { colors } from '@/ui/theme/colors';
74
import { fontSizes } from '@/ui/theme/font';
85
import { CloseOutlined } from '@ant-design/icons';
96

10-
const disclaimStr = `You can sign all transactions at once, but please be aware that UniSat Wallet will skip checking these transactions during when signing at once. Please only use this feature on familiar and trusted websites.`;
11-
export default function MultiSignDisclaimerModal({ onClose, onContinue }: { onClose: any; onContinue: any }) {
12-
const [understand, setUnderstand] = useState(false);
13-
7+
const disclaimStr = `You have the option to sign all transactions at once, but please note that UniSat Wallet will not verify each transaction individually. We strongly recommend using it only on trusted and familiar websites to minimize the risk of potential losses.`;
8+
export default function MultiSignDisclaimerModal({
9+
txCount,
10+
onClose,
11+
onContinue
12+
}: {
13+
txCount: number;
14+
onClose: any;
15+
onContinue: any;
16+
}) {
1417
return (
1518
<BottomModal onClose={onClose}>
1619
<Column>
@@ -33,24 +36,12 @@ export default function MultiSignDisclaimerModal({ onClose, onContinue }: { onCl
3336
<Text
3437
mt="lg"
3538
style={{ fontSize: fontSizes.sm, lineHeight: 2 }}
36-
text={'Before proceeding, please carefully read and accept the disclaimer.'}></Text>
39+
text={`By proceeding, you confirm that you’ve read and accepted this disclaimer.`}></Text>
3740
</Column>
3841

39-
<Row justifyCenter>
40-
<Checkbox
41-
onChange={() => {
42-
setUnderstand(!understand);
43-
}}
44-
checked={understand}
45-
style={{ fontSize: fontSizes.sm }}>
46-
<Text text="" />
47-
</Checkbox>
48-
</Row>
49-
5042
<Button
51-
text={`Continue to sign all at once`}
43+
text={`Sign all ${txCount} transactions at once`}
5244
preset="primaryV2"
53-
disabled={!understand}
5445
onClick={() => {
5546
onContinue();
5647
}}

src/ui/pages/Approval/components/MultiSignPsbt/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export default function MultiSignPsbt({
312312
</Footer>
313313
{disclaimerVisible && (
314314
<MultiSignDisclaimerModal
315+
txCount={txInfo.psbtHexs.length}
315316
onContinue={() => {
316317
handleConfirm();
317318
}}

src/ui/pages/Cat20/Cat20TokenScreen.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useEffect, useMemo, useState } from 'react';
22

3+
import { KEYRING_TYPE } from '@/shared/constant';
34
import { runesUtils } from '@/shared/lib/runes-utils';
45
import { AddressCAT20TokenSummary } from '@/shared/types';
56
import { Button, Column, Content, Header, Icon, Layout, Row, Text } from '@/ui/components';
67
import { useTools } from '@/ui/components/ActionComponent';
78
import { BRC20Ticker } from '@/ui/components/BRC20Ticker';
89
import { useCurrentAccount } from '@/ui/state/accounts/hooks';
10+
import { useCurrentKeyring } from '@/ui/state/keyrings/hooks';
911
import { useCAT20TokenInfoExplorerUrl } from '@/ui/state/settings/hooks';
1012
import { colors } from '@/ui/theme/colors';
1113
import { fontSizes } from '@/ui/theme/font';
@@ -42,6 +44,9 @@ export default function CAT20TokenScreen() {
4244

4345
const account = useCurrentAccount();
4446

47+
const keyring = useCurrentKeyring();
48+
const tools = useTools();
49+
4550
const [loading, setLoading] = useState(true);
4651

4752
useEffect(() => {
@@ -122,6 +127,10 @@ export default function CAT20TokenScreen() {
122127
preset="defaultV2"
123128
icon="merge"
124129
onClick={(e) => {
130+
if (keyring.type === KEYRING_TYPE.KeystoneKeyring) {
131+
tools.toastError('Merge UTXOs is not supported for Keystone yet');
132+
return;
133+
}
125134
navigate('MergeCAT20Screen', {
126135
cat20Balance: tokenSummary.cat20Balance,
127136
cat20Info: tokenSummary.cat20Info
@@ -137,6 +146,10 @@ export default function CAT20TokenScreen() {
137146
style={!enableTransfer ? { backgroundColor: 'grey' } : {}}
138147
disabled={!enableTransfer}
139148
onClick={(e) => {
149+
if (keyring.type === KEYRING_TYPE.KeystoneKeyring) {
150+
tools.toastError('Send CAT20 is not supported for Keystone yet');
151+
return;
152+
}
140153
navigate('SendCAT20Screen', {
141154
cat20Balance: tokenSummary.cat20Balance,
142155
cat20Info: tokenSummary.cat20Info

src/ui/pages/Cat20/MergeCAT20Screen/MergeProgressLayout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function MergeProgressLayout({
6060
preset="defaultV2"
6161
text="Quit Merging Process"
6262
onClick={(e) => {
63-
onContinue();
63+
window.history.go(-1);
6464
}}></Button>
6565
)}
6666

src/ui/pages/Main/WalletTabScreen/Cat20List.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
33
import { CAT20Balance } from '@/shared/types';
44
import { Column, Row } from '@/ui/components';
55
import { useTools } from '@/ui/components/ActionComponent';
6-
import { CAT20BalanceCard } from '@/ui/components/Cat20BalanceCard';
6+
import { CAT20BalanceCard } from '@/ui/components/CAT20BalanceCard';
77
import { Empty } from '@/ui/components/Empty';
88
import { Pagination } from '@/ui/components/Pagination';
99
import { useCurrentAccount } from '@/ui/state/accounts/hooks';

src/ui/pages/Runes/SendRunesScreen.tsx

+1-10
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@ export default function SendRunesScreen() {
113113
return;
114114
}
115115

116-
let dustUtxo = 546;
117-
try {
118-
dustUtxo = getAddressUtxoDust(toInfo.address);
119-
} catch (e) {
120-
// console.log(e);
121-
}
122-
123-
const minOutputValue = dustUtxo;
124-
125116
if (outputValue < minOutputValue) {
126117
setError(`OutputValue must be at least ${minOutputValue}`);
127118
return;
@@ -163,7 +154,7 @@ export default function SendRunesScreen() {
163154
console.log(e);
164155
setError(e.message);
165156
});
166-
}, [toInfo, inputAmount, feeRate, enableRBF, outputValue]);
157+
}, [toInfo, inputAmount, feeRate, enableRBF, outputValue, minOutputValue]);
167158
return (
168159
<Layout>
169160
<Header

src/ui/styles/global.less

+14
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ div {
5353
border: 0px solid;
5454
}
5555

56+
::-webkit-scrollbar {
57+
width: 0px;
58+
height: 2px;
59+
}
60+
5661
// For scrollbar
5762
::-webkit-scrollbar-thumb {
5863
border-radius: 3px;
@@ -68,6 +73,15 @@ div {
6873
background: transparent;
6974
}
7075

76+
.rc-virtual-list-scrollbar {
77+
width: 6px !important;
78+
}
79+
.rc-virtual-list-scrollbar-thumb {
80+
border-radius: 3px;
81+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
82+
background: #4f4d4d !important;
83+
}
84+
7185
.ant-tooltip {
7286
max-width: 300px !important;
7387
}

src/ui/theme/colors.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const palette = {
44
white: '#ffffff',
55
white_muted: 'rgba(255, 255, 255, 0.5)',
6+
white_muted2: 'rgba(255, 255, 255, 0.2)',
67
black: '#000000',
78
black_muted: 'rgba(0, 0, 0, 0.5)',
89
black_muted2: 'rgba(0, 0, 0, 0.)',

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -3023,10 +3023,10 @@
30233023
"@typescript-eslint/types" "5.53.0"
30243024
eslint-visitor-keys "^3.3.0"
30253025

3026-
"@unisat/wallet-sdk@1.8.0-beta.2":
3027-
version "1.8.0-beta.2"
3028-
resolved "https://registry.yarnpkg.com/@unisat/wallet-sdk/-/wallet-sdk-1.8.0-beta.2.tgz#385b497d1923bc87351f06800724d1e42a6e814f"
3029-
integrity sha512-houBR5XQ41AiBZp0Zg02DRzgq3KLOzXE5WSdpkV1JB7tahVfFPlKEdDwvZ91Md1VY0JMZzX6I5hCKKeTPQ4/jw==
3026+
"@unisat/wallet-sdk@1.8.0":
3027+
version "1.8.0"
3028+
resolved "https://registry.yarnpkg.com/@unisat/wallet-sdk/-/wallet-sdk-1.8.0.tgz#b53ffcf8f66c1f03d3bb2eb3930c72e3b2c83332"
3029+
integrity sha512-qt2pR8lXqQln/FFNunFlnm55ucejyr3JGbyJvA3s/Qz13+MSjrH41WtyzzHUWfZbcSbEVHTzVb2MYwLNJYbDOA==
30303030
dependencies:
30313031
"@bitcoinerlab/secp256k1" "^1.0.5"
30323032
"@keystonehq/keystone-sdk" "^0.3.0"

0 commit comments

Comments
 (0)