1// need.js: +need but worse
4import { BRIDGE_ERROR } from './error';
6const needBuilder = fn => obj => {
11 return obj.matchWith({
17// simpler function for inline need.value(thing, () => {})
18export const value = (obj, fn) => needBuilder(fn)(obj);
20export const details = needBuilder(() => {
21 throw new Error(BRIDGE_ERROR.MISSING_POINT_DETAILS);
24export const web3 = needBuilder(() => {
25 throw new Error(BRIDGE_ERROR.MISSING_WEB3);
28export const contracts = needBuilder(() => {
29 throw new Error(BRIDGE_ERROR.MISSING_CONTRACTS);
32export const wallet = needBuilder(() => {
33 throw new Error(BRIDGE_ERROR.MISSING_WALLET);
36export const addressFromWallet = obj => wallet(obj).address;
38export const point = needBuilder(() => {
39 throw new Error(BRIDGE_ERROR.MISSING_POINT);
42export const pointCache = needBuilder(() => {
43 throw new Error(BRIDGE_ERROR.MISSING_POINT);
46export const fromPointCache = (cache, point) => {
47 if (!(point in cache)) {
48 throw new Error(BRIDGE_ERROR.MISSING_POINT);
54export const keystore = obj => {
55 const ks = needBuilder(BRIDGE_ERROR.MISSING_KEYSTORE)(obj);
56 return ks.value.matchWith({
57 Ok: result => result.value,
59 throw new Error(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