You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-92
Original file line number
Diff line number
Diff line change
@@ -39,22 +39,25 @@ npm run dev:https
39
39
```
40
40
41
41
#### Address Derivation Checker:
42
+
42
43
EthereumJS-Util previously contained a bug that would incorrectly derive addresses from private keys with a 1/128 probability of occurring. A summary of this issue can be found [here](https://www.reddit.com/r/ethereum/comments/48rt6n/using_myetherwalletcom_just_burned_me_for/d0m4c6l/).
43
44
44
-
As a reactionary measure, the address derivation checker was created.
45
+
As a reactionary measure, the address derivation checker was created.
45
46
46
47
To test for correct address derivation, the address derivation checker uses multiple sources of address derivation (EthereumJS and PyEthereum) to ensure that multiple official implementations derive the same address for any given private key.
47
48
48
49
##### The derivation checker utility assumes that you have:
50
+
49
51
1. Docker installed/available
50
52
2.[dternyak/eth-priv-to-addr](https://hub.docker.com/r/dternyak/eth-priv-to-addr/) pulled from DockerHub
51
53
52
54
##### Docker setup instructions:
55
+
53
56
1. Install docker (on macOS, [Docker for Mac](https://docs.docker.com/docker-for-mac/) is suggested)
54
57
2.`docker pull dternyak/eth-priv-to-addr`
55
58
56
-
57
59
##### Run Derivation Checker
60
+
58
61
The derivation checker utility runs as part of the integration test suite.
59
62
60
63
```bash
@@ -84,7 +87,6 @@ npm run test:int
84
87
85
88
The following are guides for developers to follow for writing compliant code.
86
89
87
-
88
90
### Redux and Actions
89
91
90
92
Each reducer has one file in `reducers/[namespace].ts` that contains the reducer
@@ -116,19 +118,20 @@ export function [namespace](
116
118
return {
117
119
...state,
118
120
// Alterations to state
119
-
};
121
+
};
120
122
default:
121
123
returnstate;
122
124
}
123
125
}
124
126
```
125
127
126
128
#### Actions
129
+
127
130
* Define each action creator in `actionCreator.ts`
128
131
* Define each action object type in `actionTypes.ts`
129
-
* Export a union of all of the action types for use by the reducer
130
-
* Define each action type as a string enum in `constants.ts`
131
-
* Export `actionCreators` and `actionTypes` from module file `index.ts`
132
+
* Export a union of all of the action types for use by the reducer
133
+
* Define each action type as a string enum in `constants.ts`
134
+
* Export `actionCreators` and `actionTypes` from module file `index.ts`
132
135
133
136
```
134
137
├── common
@@ -139,27 +142,30 @@ export function [namespace](
139
142
├── constants.ts - string enum
140
143
├── index.ts - exports all action creators and action object types
@@ -172,7 +178,9 @@ export function nameOfAction(): interfaces.NameOfActionAction {
172
178
};
173
179
};
174
180
```
181
+
175
182
##### index.ts
183
+
176
184
```ts
177
185
export*from'./actionCreators';
178
186
export*from'./actionTypes';
@@ -215,60 +223,34 @@ conditional render.)
215
223
### Higher Order Components
216
224
217
225
#### Typing Injected Props
218
-
Props made available through higher order components can be tricky to type. Normally, if a component requires a prop, you add it to the component's interface and it just works. However, working with injected props from [higher order components](https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1), you will be forced to supply all required props whenever you compose the component.
Instead of tacking the injected props on the MyComponentProps interface, put them in another interface called `InjectedProps`:
227
+
Props made available through higher order components can be tricky to type. You can inherit the injected props, and in the case of react router, specialize the generic in `withRouter` so it can omit all of its injected props from the component.
Now add a [getter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) to cast `this.props` as the original props - `MyComponentProps` and the injected props - `InjectedProps`:
const { name, countryCode, location } =this.props;// location being the one of the injected props from the withRouter HOC
264
243
...
265
244
}
266
245
}
246
+
247
+
exportdefaultwithRouter<Props>(MyComponent);
267
248
```
268
249
269
250
## Event Handlers
270
251
271
252
Event handlers such as `onChange` and `onClick`, should be properly typed. For example, if you have an event listener on an input element inside a form:
0 commit comments