1// need.js: +need but worse
4import { BRIDGE_ERROR } from './error';
6const needBuilder = fn => obj => {
11 return obj.matchWith({
17export const web3 = needBuilder(() => {
18 throw new Error(BRIDGE_ERROR.MISSING_WEB3.message);
21export const contracts = needBuilder(() => {
22 throw new Error(BRIDGE_ERROR.MISSING_CONTRACTS.message);
25export const wallet = needBuilder(() => {
26 throw new Error(BRIDGE_ERROR.MISSING_WALLET.message);
29export const addressFromWallet = obj => wallet(obj).address;
31export const point = needBuilder(() => {
32 throw new Error(BRIDGE_ERROR.MISSING_POINT.message);
35export const pointCache = needBuilder(() => {
36 throw new Error(BRIDGE_ERROR.MISSING_POINT.message);
39export const fromPointCache = (cache, point) => {
40 if (!(point in cache)) {
41 throw new Error(BRIDGE_ERROR.MISSING_POINT.message);
47export const keystore = obj => {
48 const ks = needBuilder(BRIDGE_ERROR.MISSING_KEYSTORE)(obj);
49 return ks.value.matchWith({
50 Ok: result => result.value,
52 throw BRIDGE_ERROR.MISSING_KEYSTORE;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list