Skip to content

Commit a7baa2a

Browse files
committed
input
1 parent 1a07e36 commit a7baa2a

File tree

19 files changed

+276
-273
lines changed

19 files changed

+276
-273
lines changed

public/manifest.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44
"icons": [
55
{
66
"src": "favicon.png",
7-
"sizes": "64x64 32x32 24x24 16x16",
8-
"type": "image/x-icon"
9-
},
10-
{
11-
"src": "favicon.png",
12-
"type": "image/png",
13-
"sizes": "192x192"
14-
},
15-
{
16-
"src": "favicon.png",
17-
"type": "image/png",
18-
"sizes": "512x512"
7+
"sizes": "32x32",
8+
"type": "image/png"
199
}
2010
],
2111
"start_url": ".",

src/components/bid/index.tsx

Lines changed: 0 additions & 75 deletions
This file was deleted.

src/components/tokenName.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type TokenNameProps = {
55
}
66

77
const TokenName = ({ publicKey }: TokenNameProps) => {
8-
const tokenName = publicKey?.toBase58().substring(0, 2) || '??'
8+
const tokenName = publicKey?.toBase58().substring(0, 4) || '??'
99
return <span>{tokenName}</span>
1010
}
1111

src/components/tokenSelection/index.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
1-
import { Fragment } from 'react'
2-
31
import { Space, Typography } from 'antd'
4-
import { DownOutlined } from '@ant-design/icons'
2+
import IconSax from 'components/iconsax'
53
import TokenAvatar from 'components/tokenAvatar'
64
import TokenName from 'components/tokenName'
5+
import { CSSProperties } from 'react'
76

8-
const TokenSelection = ({ publicKey }: { publicKey?: any }) => {
7+
export type TokenSelectionProps = { publicKey?: any; style?: CSSProperties }
98

9+
const TokenSelection = ({ publicKey, style }: TokenSelectionProps) => {
1010
return (
11-
<Fragment>
12-
<Space
13-
style={{ boxShadow: '0 4px 40px #2124332e' }}
14-
className="token-select"
15-
>
16-
<TokenAvatar
17-
publicKey={publicKey}
18-
style={{ border: 'none' }}
19-
></TokenAvatar>
20-
21-
<Typography.Text type="secondary">
22-
<TokenName publicKey={publicKey} />
23-
</Typography.Text>
24-
<Typography.Text type="secondary">
25-
<DownOutlined style={{ fontSize: '10px' }} />
26-
</Typography.Text>
27-
</Space>
28-
</Fragment>
11+
<Space className="token-select shadowed" style={style}>
12+
<TokenAvatar publicKey={publicKey} style={{ border: 'none' }} />
13+
<Typography.Text type="secondary">
14+
<TokenName publicKey={publicKey} />
15+
</Typography.Text>
16+
<Typography.Text type="secondary">
17+
<IconSax variant="Bulk" name="ArrowDown2" />
18+
</Typography.Text>
19+
</Space>
2920
)
3021
}
3122

src/helper/nizk/deposit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const Deposit = {
9696
const HE1 = HybridEquality.prove(s1, r1_, srcAmountA, dstAmountA)
9797
const HE2 = HybridEquality.prove(s2, r2_, srcAmountB, dstAmountB)
9898
const HE3 = HybridEquality.prove(s3, r3_, dstAmountLP, srcAmountLP)
99+
99100
return {
100101
srcAmountA,
101102
srcAmountB,
@@ -111,6 +112,7 @@ export const Deposit = {
111112
HE3,
112113
}
113114
},
115+
114116
verify: (proof: DepositProof) => {
115117
let ok = true
116118
const {

src/index.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { StrictMode } from 'react'
21
import { render } from 'react-dom'
32
import { HashRouter } from 'react-router-dom'
43
import { Provider } from 'react-redux'
@@ -11,13 +10,11 @@ import reportWebVitals from 'reportWebVitals'
1110
import 'static/styles/index.less'
1211

1312
render(
14-
<StrictMode>
15-
<Provider store={store}>
16-
<HashRouter>
17-
<App />
18-
</HashRouter>
19-
</Provider>
20-
</StrictMode>,
13+
<Provider store={store}>
14+
<HashRouter>
15+
<App />
16+
</HashRouter>
17+
</Provider>,
2118
document.getElementById('root'),
2219
)
2320

src/store/devTools.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,12 @@ export const devTools = (appName: string): any => {
1111
}
1212
}
1313

14-
// BigInt Serialization Middleware
15-
// https://redux-toolkit.js.org/api/serializabilityMiddleware
16-
const isPlain = (val: any): boolean => {
17-
const isPlainObject = (obj: object): boolean => {
18-
if (obj === null) return false
19-
const proto = Object.getPrototypeOf(obj)
20-
return proto !== null && Object.getPrototypeOf(proto) === null
21-
}
22-
return (
23-
typeof val === 'undefined' ||
24-
val === null ||
25-
typeof val === 'string' ||
26-
typeof val === 'boolean' ||
27-
typeof val === 'number' ||
28-
Array.isArray(val) ||
29-
isPlainObject(val) ||
30-
typeof val === 'bigint'
31-
)
32-
}
3314
BigInt.prototype.toJSON = function () {
3415
return this.toString() // https://github.com/GoogleChromeLabs/jsbi/issues/30
3516
}
17+
3618
export const bigintSerializationMiddleware = {
3719
serializableCheck: {
38-
isSerializable: isPlain,
20+
isSerializable: () => true,
3921
},
4022
}

src/store/swap.reducer.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type SwapState = {
1414
export type Wallet = {
1515
publicKey?: PublicKey
1616
mint?: PublicKey
17-
amount?: number
17+
amount: number | ''
1818
}
1919

2020
export enum Direction {
@@ -29,8 +29,12 @@ export enum Direction {
2929
const NAME = 'swap'
3030
const initialState: SwapState = {
3131
direction: Direction.AB,
32-
bid: {},
33-
ask: {},
32+
bid: {
33+
amount: '',
34+
},
35+
ask: {
36+
amount: '',
37+
},
3438
}
3539

3640
/**
@@ -39,18 +43,11 @@ const initialState: SwapState = {
3943

4044
export const setSwapWallet = createAsyncThunk(
4145
`${NAME}/setSwapWallet`,
42-
async (state: SwapState) => {
46+
async (state: Partial<SwapState>) => {
4347
return state
4448
},
4549
)
4650

47-
export const setAmountWallet = createAsyncThunk(
48-
`${NAME}/setAmountWallet`,
49-
async ({ type, wallet }: { type: string; wallet: Wallet }) => {
50-
return { [`${type}`]: wallet }
51-
},
52-
)
53-
5451
/**
5552
* Usual procedure
5653
*/
@@ -60,15 +57,10 @@ const slice = createSlice({
6057
initialState,
6158
reducers: {},
6259
extraReducers: (builder) =>
63-
void builder
64-
.addCase(
65-
setSwapWallet.fulfilled,
66-
(state, { payload }) => void Object.assign(state, payload),
67-
)
68-
.addCase(
69-
setAmountWallet.fulfilled,
70-
(state, { payload }) => void Object.assign(state, payload),
71-
),
60+
void builder.addCase(
61+
setSwapWallet.fulfilled,
62+
(state, { payload }) => void Object.assign(state, payload),
63+
),
7264
})
7365

7466
export default slice.reducer

src/view/approval/index.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ const Approval = () => {
8484
return (
8585
<Modal visible={visible} footer={null} closable={false}>
8686
<Row gutter={[24, 24]}>
87+
<Col span={24}>
88+
<Typography.Title level={4}>
89+
<Space>
90+
<IconSax variant="Bulk" name="Warning2" />
91+
<span>For demostration only!</span>
92+
</Space>
93+
</Typography.Title>
94+
</Col>
8795
<Col span={24}>
8896
<Row gutter={[8, 8]}>
89-
<Col span={24}>
90-
<Typography.Title level={4}>
91-
<Space>
92-
<IconSax variant="Bulk" name="Warning2" />
93-
<span>For demostration only!</span>
94-
</Space>
95-
</Typography.Title>
96-
</Col>
9797
<Col span={24}>
9898
<Typography.Text>
9999
The prototype is to propose a zero-knowledge Automated Market
@@ -128,8 +128,13 @@ const Approval = () => {
128128
</Row>
129129
</Col>
130130
<Col span={24}>
131-
<Button type="primary" onClick={initSwap} block>
132-
Undestand
131+
<Button
132+
type="primary"
133+
onClick={initSwap}
134+
icon={<IconSax variant="Bulk" name="TickCircle" />}
135+
block
136+
>
137+
Understand
133138
</Button>
134139
</Col>
135140
</Row>

src/view/header/debug/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ const Debug = () => {
1818
<Fragment>
1919
<Button
2020
type="text"
21-
icon={<IconSax variant="Bulk" name="ShieldSearch" />}
21+
icon={
22+
<IconSax
23+
style={{ fontSize: 20 }}
24+
variant="Bulk"
25+
name="ShieldSearch"
26+
/>
27+
}
2228
onClick={() => setVisible(true)}
2329
/>
2430
<Drawer

0 commit comments

Comments
 (0)