Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createOrder = async ({ fromPeer, order, ...rest }) => {
console.log('rest', ...rest)
// TODO add check exchange rate and format order
const createdOrder = await actions.core.createOrder(order)
actions.core.requestToPeer('accept request', fromPeer, { orderId: createdOrder.id })
}
}
const account = bitcoin.ECPair.fromWIF(privateKey, btc.network) // eslint-disable-line
const address = account.getAddress()
const publicKey = account.getPublicKeyBuffer().toString('hex')
const data = {
account,
keyPair,
address,
privateKey,
publicKey,
}
console.info('Logged in with USDT', data)
reducers.user.setAuthData({ name: 'usdtData', data })
}
import CommunityWorkshops from './views/community-workshops';
import Map from './views/map';
import LocationsHub from './views/locations-hub';
import LocationItem from './views/location';
import CountriesHub from './views/countries-hub';
import Country from './views/country';
import Compare from './views/compare';
const logger = createLogger({
level: 'info',
collapsed: true,
predicate: (getState, action) => {
return (process.env.NODE_ENV !== 'production');
}
});
const store = createStore(reducer, applyMiddleware(thunkMiddleware, logger));
const history = syncHistoryWithStore(hashHistory, store);
// Base data.
store.dispatch(fetchBaseData());
store.dispatch(fetchBaseStats());
const scrollerMiddleware = useScroll((prevRouterProps, currRouterProps) => {
return prevRouterProps &&
decodeURIComponent(currRouterProps.location.pathname) !== decodeURIComponent(prevRouterProps.location.pathname);
});
render((
/* global JSON, localStorage */
import { createStore } from 'redux'
import defaultState from './defaultState'
/**
* Create a new redux store
* @type {Redux}
*/
const store = createStore((
state = (JSON.parse(localStorage.getItem('store')) || defaultState),
action
) => {
switch (action.type) {
case 'SET_VIEW':
return { ...state, view: action.view }
case 'SET_HOST':
return { ...state, settings: { host: action.host } }
case 'SET_BRIDGE':
return { ...state, bridge: action.bridge }
case 'SET_LIGHTS':
return { ...state, lights: action.lights }
case 'SET_GROUPS':
return { ...state, groups: action.groups }
default:
return { ...state }
export const initStore = initialState => {
if (typeof window === 'undefined') {
let store = createStore(reducers, initialState, enhancer)
return store
} else {
if (!window.store) {
// For each key of initialState, convert to Immutable object
// Because SSR passed it as plain object
Object.keys(initialState).map(function (key, index) {
initialState[key] = Immutable.fromJS(initialState[key])
})
window.store = createStore(reducers, initialState, enhancer)
}
return window.store
}
}
import { logic as dataLogic } from 'data/logic'
import { logic as scenesLogic } from 'scenes/logic'
/* ROOT REDUCER */
const rootReducer = combineReducers({
data: dataReducer,
scenes: scenesReducer
})
/* ROOT LOGIC */
const rootLogic = [...dataLogic, ...scenesLogic]
const logicMiddleware = createLogicMiddleware(rootLogic)
const middleware = applyMiddleware(logicMiddleware)
/* STORE */
const store = createStore(rootReducer, middleware)
export default store
const initial_animation_state = {
ball: {
style: {
position: 'relative',
top: '0%',
left: '45%',
backgroundColor: 'red',
width: 100,
height: 100,
borderRadius: 50,
zIndex: 1000,
}
}
}
window.store = createStore(combineReducers({
animations: animationsReducer,
ball: ballReducer,
}))
window.time = startAnimation(window.store, initial_animation_state)
const BOUNCE_ANIMATIONS = (start_time) =>
RepeatSequence([
// high bounce
Translate({
path: '/ball',
start_state: {top: 0, left: 0},
end_state: {top: -200, left: 0},
duration: 500,
curve: 'easeOutQuad',
// start_time: window.time.getWarpedTime(), // optional, defaults to now
// unit: 'px', // optional, defaults to px
// selector-only modules
// import message from './message'
// import fallRate from './fallRate'
// import level from './level'
export const REPLACE_STATE = 'REPLACE_STATE'
export const replaceState = (state) => ({
type: REPLACE_STATE,
payload: state
})
export const reducer = combineReducers(
{score, lines, nextPiece, currentPiece, board, gameState, config}
)
export default createStore(
reducer,
// To trigger dev tools in browser extension
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
)
// import a11y from 'react-a11y';
// if (process.env.NODE_ENV !== 'production') {
// a11y(React, { includeSrcNode: true, ReactDOM });
// }
const docs = (state = { dark: false }, action) => {
if (action.type === 'TOGGLE_THEME_SHADE') {
return {
...state,
dark: !state.dark,
};
}
return state;
};
const store = createStore(docs);
const rootEl = document.querySelector('#app');
render(
{
throw error;
}}
>
,
rootEl,
);
if (process.env.NODE_ENV !== 'production' && module.hot) {
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import rootReducer from './reducers';
// Store setup
const middleware = applyMiddleware(thunkMiddleware);
const store = createStore(rootReducer, {}, composeWithDevTools(middleware));
export default store;