#nothing much
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const drizzleOptions = { | |
contracts: [SimpleStorage] | |
}; | |
const initialState = { | |
contracts: generateContractsInitialState(drizzleOptions) | |
}; | |
// Redux DevTools | |
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | |
const sagaMiddleware = createSagaMiddleware(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class App extends Component { | |
constructor(props, context) { | |
super(props); | |
const { onSetDrizzleState } = this.props; | |
onSetDrizzleState(context.drizzle); | |
} | |
render() { | |
const { classes, onCheckingTxDone } = this.props; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class Home extends Component { | |
componentDidUpdate(prevProps) { | |
const { onGetStoredValue } = this.props; | |
if (this.props.SimpleStorage.initialized && this.props.SimpleStorage.initialized !== prevProps.SimpleStorage.initialized) { | |
onGetStoredValue(); | |
} | |
if (this.props.txSuccessful && prevProps.txSuccessful === false) { | |
onGetStoredValue(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class Edit extends Component { | |
... | |
handleSubmit = (event) => { | |
this.contracts.SimpleStorage.methods.set.cacheSend(this.state.newVal); | |
event.preventDefault(); | |
} | |
componentDidUpdate(prevProps) { | |
const { onRedirectToHomeDone } = this.props; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
function* showMetaMaskOverlay() { | |
yield put({ type: 'CHECK_METAMASK' }); | |
} | |
function* showTxErrorMsg() { | |
yield put({ type: 'TX_ERROR_METAMASK' }); | |
} | |
function* showCheckingTxMsg() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// reducer with initial state | |
const initialState = { | |
checkMetaMask: false, | |
metaMaskReject: false, | |
checkingTx: false, | |
txSuccessful: false, | |
redirectToHome: false, | |
drizzle: null, | |
gotStoredValue: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SimpleStorage = artifacts.require("./SimpleStorage.sol"); | |
contract('SimpleStorage', function(accounts) { | |
it("...should start with the value 0.", async function() { | |
let simpleStorage = await SimpleStorage.deployed(); | |
let storedData = await simpleStorage.storedData_(); | |
assert.equal(storedData.valueOf(), 0, "0 wasn't stored in contract"); | |
}); | |
it("...should store the value 89.", async function() { | |
let simpleStorage = await SimpleStorage.deployed(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
function* pollSagaWorker(dataKey) { | |
while (true) { | |
const contracts = yield select(getContracts); | |
if (contracts.SimpleStorage.synced) { | |
const storedValueObj = contracts.SimpleStorage.storedData_[dataKey]; | |
if (storedValueObj && storedValueObj.value) { | |
yield put({ type: 'GOT_STORED_VALUE', storedValue: storedValueObj.value }); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Login(props) { | |
const { state, dispatch } = React.useContext(AuthContext); | |
const GITHUB_CLIENT_ID = "6e0b5f325ac2e324312c"; | |
const GITHUB_REDIRECT_URI = process.env.REACT_APP_FRONTEND_URL + "/callback"; | |
const handleGithubLogin = event => { | |
event.preventDefault(); | |
window.open(`https://github.com/login/oauth/authorize?client_id=${GITHUB_CLIENT_ID}&scope=user&redirect_uri=${GITHUB_REDIRECT_URI}`, "_self"); | |
} |
OlderNewer