Skip to content

Commit cf581ca

Browse files
authored
Merge pull request #69 from celo-tools/1.3.5
Fix bug with governance proposal fetching Set currency in send form to none by default Improve error message for amounts over max Upgrade some dependencies
2 parents 8b94c77 + 64b91f1 commit cf581ca

19 files changed

Lines changed: 924 additions & 686 deletions

package-electron.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "celo-web-wallet",
3-
"version": "1.3.4",
3+
"version": "1.3.5",
44
"description": "A lightweight web and desktop wallet for the Celo network",
55
"main": "main.js",
66
"keywords": [

package.json

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "celo-web-wallet",
3-
"version": "1.3.4",
3+
"version": "1.3.5",
44
"description": "A lightweight web and desktop wallet for the Celo network",
55
"keywords": [
66
"Celo",
@@ -26,75 +26,75 @@
2626
"electron:build": "./scripts/build.sh -n Mainnet -e",
2727
"electron:start": "electron ./dist/main.js --enable-logging",
2828
"electron:dev": "yarn electron:build && yarn electron:start",
29-
"electron:dist": "yarn electron:build && DEBUG=electron-builder electron-builder --publish never"
29+
"electron:prod": "yarn electron:build && DEBUG=electron-builder electron-builder --publish never"
3030
},
3131
"dependencies": {
3232
"@celo-tools/celo-ethers-wrapper": "^0.0.5",
33-
"@emotion/react": "^11.4.0",
33+
"@emotion/react": "^11.4.1",
3434
"@ledgerhq/hw-app-eth": "^5.51.1",
3535
"@ledgerhq/hw-transport-node-hid-noevents": "^5.51.1",
3636
"@ledgerhq/hw-transport-u2f": "5.36.0-deprecated",
3737
"@ledgerhq/hw-transport-webhid": "^5.51.1",
3838
"@ledgerhq/hw-transport-webusb": "^5.51.1",
3939
"@metamask/jazzicon": "https://github.com/jmrossy/jazzicon#7a8df28",
40-
"@reduxjs/toolkit": "^1.6.0",
40+
"@reduxjs/toolkit": "^1.6.1",
4141
"@walletconnect/client": "2.0.0-beta.10",
4242
"buffer": "^6.0.3",
4343
"electron-updater": "^4.3.9",
4444
"ethers": "^5.3.0",
4545
"frappe-charts": "^1.6.2",
46-
"history": "^5.0.0",
47-
"idb-keyval": "^5.0.6",
46+
"history": "^5.0.1",
47+
"idb-keyval": "^6.0.1",
4848
"react": "^17.0.2",
4949
"react-dom": "^17.0.2",
5050
"react-frappe-charts": "^4.0.0",
51-
"react-redux": "^7.2.4",
52-
"react-router": "^6.0.0-beta.0",
53-
"react-router-dom": "^6.0.0-beta.0",
51+
"react-redux": "^7.2.5",
52+
"react-router": "^6.0.0-beta.4",
53+
"react-router-dom": "^6.0.0-beta.4",
5454
"react-window": "^1.8.6",
5555
"redux-persist": "^6.0.0",
5656
"redux-saga": "^1.1.3",
5757
"typed-redux-saga": "^1.3.1"
5858
},
5959
"devDependencies": {
60-
"@babel/core": "^7.14.6",
61-
"@babel/plugin-transform-runtime": "^7.14.5",
62-
"@babel/preset-env": "^7.14.7",
60+
"@babel/core": "^7.15.5",
61+
"@babel/plugin-transform-runtime": "^7.15.0",
62+
"@babel/preset-env": "^7.15.6",
6363
"@babel/preset-react": "^7.14.5",
64-
"@babel/preset-typescript": "^7.14.5",
65-
"@babel/register": "^7.14.5",
64+
"@babel/preset-typescript": "^7.15.0",
65+
"@babel/register": "^7.15.3",
6666
"@emotion/babel-plugin": "^11.3.0",
67-
"@testing-library/react": "^12.0.0",
68-
"@types/jasmine": "^3.7.7",
69-
"@types/react": "^17.0.13",
70-
"@types/react-dom": "^17.0.8",
71-
"@types/react-redux": "^7.1.16",
72-
"@types/react-window": "^1.8.3",
73-
"@types/redux-mock-store": "^1.0.2",
74-
"@typescript-eslint/eslint-plugin": "^4.28.2",
75-
"@typescript-eslint/parser": "^4.28.2",
67+
"@testing-library/react": "^12.1.0",
68+
"@types/jasmine": "^3.9.1",
69+
"@types/react": "^17.0.21",
70+
"@types/react-dom": "^17.0.9",
71+
"@types/react-redux": "^7.1.18",
72+
"@types/react-window": "^1.8.5",
73+
"@types/redux-mock-store": "^1.0.3",
74+
"@typescript-eslint/eslint-plugin": "^4.31.1",
75+
"@typescript-eslint/parser": "^4.31.1",
7676
"babel-loader": "^8.2.2",
7777
"babel-plugin-module-name-mapper": "^1.2.0",
7878
"copy-webpack-plugin": "^9.0.1",
79-
"css-loader": "^5.2.6",
80-
"electron": "^13.1.6",
79+
"css-loader": "^6.2.0",
80+
"electron": "^14.0.1",
8181
"electron-builder": "^22.11.7",
82-
"electron-notarize": "^1.0.0",
83-
"eslint": "^7.30.0",
82+
"electron-notarize": "^1.1.1",
83+
"eslint": "^7.32.0",
8484
"eslint-loader": "^4.0.2",
85-
"eslint-plugin-import": "^2.23.4",
86-
"eslint-plugin-react": "^7.24.0",
87-
"jasmine": "^3.8.0",
88-
"jsdom": "^16.6.0",
89-
"node-fetch": "^2.6.1",
90-
"prettier": "2.3.2",
85+
"eslint-plugin-import": "^2.24.2",
86+
"eslint-plugin-react": "^7.25.1",
87+
"jasmine": "^3.9.0",
88+
"jsdom": "^17.0.0",
89+
"node-fetch": "^2.6.2",
90+
"prettier": "^2.4.1",
9191
"redux-mock-store": "^1.5.4",
92-
"style-loader": "^3.0.0",
93-
"ts-loader": "^9.2.3",
94-
"typescript": "^4.3.5",
95-
"webpack": "^5.42.1",
96-
"webpack-cli": "^4.7.2",
97-
"webpack-dev-server": "4.0.0-beta.3"
92+
"style-loader": "^3.2.1",
93+
"ts-loader": "^9.2.5",
94+
"typescript": "^4.4.3",
95+
"webpack": "^5.53.0",
96+
"webpack-cli": "^4.8.0",
97+
"webpack-dev-server": "^4.2.1"
9898
},
9999
"resolutions": {
100100
"pbkdf2": "^3.1.2"

src/app/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const App = () => {
7676
<UpdateBanner />
7777
<Routes>
7878
<Route path="/" element={<HomeNavigator />}>
79-
<Route path="/" element={<HomeScreen />} />
79+
<Route index element={<HomeScreen />} />
8080
<Route path="tx" element={<TransactionReview />} />
8181
<Route path="send" element={<SendFormScreen />} />
8282
<Route path="send-review" element={<SendConfirmationScreen />} />
@@ -93,7 +93,7 @@ export const App = () => {
9393
<Route path="balances" element={<BalanceDetailsScreen />} />
9494
<Route path="account" element={<ViewAccountScreen />} />
9595
<Route path="accounts" element={<AccountsNavigator />}>
96-
<Route path="/" element={<AccountsAndContactsScreen />} />
96+
<Route index element={<AccountsAndContactsScreen />} />
9797
<Route path="add" element={<AddAccountScreen />} />
9898
<Route path="create" element={<AddCreateScreen />} />
9999
<Route path="derive" element={<AddDeriveScreen />} />
@@ -105,7 +105,7 @@ export const App = () => {
105105
</Route>
106106

107107
<Route path="/setup" element={<OnboardingNavigator />}>
108-
<Route path="/" element={<WelcomeScreen />} />
108+
<Route index element={<WelcomeScreen />} />
109109
<Route path="new" element={<NewAccountScreen />} />
110110
<Route path="existing" element={<ImportChoiceScreen />} />
111111
<Route path="import" element={<ImportAccountScreen />} />

src/components/input/AmountAndCurrencyInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface Props {
1414
onTokenSelect: (event: ChangeEvent<HTMLInputElement>) => void
1515
onTokenBlur: (event: ChangeEvent<HTMLInputElement>) => void
1616
amountValue: string
17+
amountName?: string
1718
onAmountChange: (event: ChangeEvent<HTMLInputElement>) => void
1819
onAmountBlur: (event: ChangeEvent<HTMLInputElement>) => void
1920
errors: ErrorState
@@ -28,6 +29,7 @@ export const AmountAndCurrencyInput = (props: Props) => {
2829
onTokenSelect,
2930
onTokenBlur,
3031
amountValue,
32+
amountName,
3133
onAmountChange,
3234
onAmountBlur,
3335
errors,
@@ -88,14 +90,14 @@ export const AmountAndCurrencyInput = (props: Props) => {
8890
<NumberInput
8991
step="0.01"
9092
fillWidth={true}
91-
name="amount"
93+
name={amountName ?? 'amount'}
9294
onChange={onAmountChange}
9395
onBlur={onAmountBlur}
9496
value={amountValue}
9597
placeholder="1.00"
9698
inputStyles={style.amount}
9799
disabled={inputDisabled}
98-
{...errors['amount']}
100+
{...errors[amountName ?? 'amount']}
99101
/>
100102
</Box>
101103
)

src/components/layout/ScreenFrame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const style: Stylesheet = {
178178
height: '100%',
179179
},
180180
contentContainerNoFeed: {
181-
height: '100%',
181+
minHeight: '100%',
182182
backgroundColor: '#FAFAFA',
183183
},
184184
feedContainer: {

src/consts.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const MAX_GAS_LIMIT = '10000000' // 10 million
2828
export const MIN_EXCHANGE_RATE = 0.01 // 1<->100 ratio
2929
export const MAX_EXCHANGE_RATE = 100 // 1<->100 ratio
3030
export const MAX_EXCHANGE_LOSS = 0.015 // 1.5%
31-
export const MAX_EXCHANGE_SPREAD = 0.05
31+
export const MAX_EXCHANGE_SPREAD = 0.1 // 10%
3232

3333
export const MIN_LOCK_AMOUNT = '10000000000000000' // 0.01 CELO
3434
export const MIN_LOCKED_GOLD_TO_VOTE = '200000000000000000' // 0.2 Celo
@@ -54,3 +54,6 @@ export const HIGH_VALUE_THRESHOLD = '25000000000000000000' // 25 cusd - threshol
5454
export const CELO_LEDGER_APP_MIN_VERSION = '1.0.3' // Only allow this ledger app versions or newer
5555

5656
export const DONATION_ADDRESS = '0xE3791A4a231D026c9567BEDbAb977617f2900383' // for receiving donations
57+
58+
export const GOVERNANCE_GITHUB_BASEURL =
59+
'https://api.github.com/repos/celo-org/governance/contents/CGPs/'

src/features/exchange/ExchangeFormScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export function ExchangeFormScreen() {
136136
onTokenSelect={onSelectToken(false)}
137137
onTokenBlur={handleBlur}
138138
amountValue={toAmount}
139+
amountName="toAmount"
139140
onAmountChange={handleChange}
140141
onAmountBlur={handleBlur}
141142
errors={errors}

src/features/exchange/exchangeToken.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ export function validate(
6868
: undefined
6969
errors = {
7070
...errors,
71-
...validateAmount(amountInWei, fromToken, balances, maxAmount),
71+
...validateAmount(
72+
amountInWei,
73+
fromToken,
74+
balances,
75+
maxAmount,
76+
undefined,
77+
'Exceeds max, see settings'
78+
),
7279
}
7380
}
7481

src/features/governance/fetchDescription.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { fetchProposalDescription } from 'src/features/governance/fetchDescripti
44
xdescribe('fetchProposals', () => {
55
it('Fetches and processes as expected', async () => {
66
const prop1Desc = await fetchProposalDescription(
7-
'https://github.com/celo-org/celo-proposals/blob/master/CGPs/0001.md'
7+
'https://github.com/celo-org/governance/blob/main/CGPs/cgp-0001.md'
88
)
99
expect(prop1Desc).toBe('Enable validator elections, epoch rewards and carbon offsetting')
1010
const prop21Desc = await fetchProposalDescription(
11-
'https://github.com/celo-org/celo-proposals/blob/master/CGPs/0021.md'
11+
'https://github.com/celo-org/governance/blob/main/CGPs/cgp-0021.md'
1212
)
1313
expect(prop21Desc).toBe(
1414
'Update randomnessBlockRetentionWindow to Extend Attestation Expiration Duration'

src/features/governance/fetchDescription.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { GOVERNANCE_GITHUB_BASEURL } from 'src/consts'
12
import { logger } from 'src/utils/logger'
23

34
// Putting these in a seperate file to faciliate testing for now
@@ -21,11 +22,11 @@ export async function fetchProposalDescription(url: string) {
2122
async function fetchProposalDescriptionFromGithub(url: URL) {
2223
// TODO hardcoding things here for now but may need more flexible retrieval logic eventually
2324
const urlPath = url.pathname
24-
const pathRegex = /\/celo-org\/celo-proposals\/blob\/master\/CGPs\/(.*)/
25+
const pathRegex = /CGPs\/(.*)/
2526
const pathMatches = urlPath.match(pathRegex)
2627
if (pathMatches?.length !== 2) throw new Error('Unable to extract proposal number')
2728

28-
const proposalRawUrl = `https://api.github.com/repos/celo-org/celo-proposals/contents/CGPs/${pathMatches[1]}`
29+
const proposalRawUrl = `${GOVERNANCE_GITHUB_BASEURL}${pathMatches[1]}`
2930
const response = await fetch(proposalRawUrl, {
3031
headers: {
3132
Accept: 'application/vnd.github.3.raw',

0 commit comments

Comments
 (0)