Skip to content

Instantly share code, notes, and snippets.

all your base are belong to us

Paul PaulLaux

all your base are belong to us
Block or report user

Report or block PaulLaux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# This installs alacritty terminal on ubuntu (
# You have to have rust/cargo installed for this to work
# Install required tools
sudo apt-get install -y cmake libfreetype6-dev libfontconfig1-dev xclip
# Download, compile and install Alacritty
git clone
PaulLaux / redux-saga-poll.js
Last active Sep 4, 2018
Polling pattern using redux-saga
View redux-saga-poll.js
export default function* defaultSaga() {
// ...
// The polling will start only after the first CHECK_BALANCES ends
yield [
takeLatest(CHECK_BALANCES, checkAllBalances),
// Start Polling when first call to checkAllBalances succeded or fails
PaulLaux / ethereum-transaction-register-redux-saga-channel.js
Last active Sep 3, 2018
Register to events generated by an Ethereum transaction
View ethereum-transaction-register-redux-saga-channel.js
function* commitEthSendAsync() {
try {
const web3 = yield select(makeSelectWeb3());
// ...
from: defaultAccount,
value: web3.utils.toWei(amount.toString(), 'ether'),
}).once('transactionHash', (tx) => {
PaulLaux / ethereum-transaction-state-redux-saga-channel.js
Last active Sep 3, 2018
Updating ethereum transaction state using redux-saga channels
View ethereum-transaction-state-redux-saga-channel.js
import { channel } from 'redux-saga';
const transactionChannel = channel();
/* Init Dapp */
function* initDappAsync(action) {
// ...
// fork to handle channel events
yield fork(handleChannelEvents);
PaulLaux / eth-hot-wallet-send-token.js
Last active Aug 30, 2018
Sending token via Ethereum smart contract interaction with redux-saga
View eth-hot-wallet-send-token.js
// full source:
export function* SendTransaction() {
try {
// ...
const contractAddress = tokenInfo.contractAddress;
const sendParams = { from: fromAddress, value: '0x0', gasPrice, gas: maxGasForTokenSend };
const tokenAmount = amount * (10 ** tokenInfo.decimals);
function sendTokenPromise(tokenContractAddress, sendToAddress, sendAmount, params) {
return new Promise((resolve, reject) => {
PaulLaux / eth-hot-wallet-contract-methods.js
Last active Aug 30, 2018
Calling Ethereum contract methods via Web3.js
View eth-hot-wallet-contract-methods.js
// Automatically determines the use of call or sendTransaction based on the method type
myContractInstance.myMethod(param1 [, ...][, callback]);
// Explicitly calling this method - simulate execution and return result
// No cost, no actual transaction is sent to the blockchain [, ...] [, callback]);
// Explicitly sending a transaction to this method
myContractInstance.myMethod.sendTransaction(param1 [, ...] [, callback]);
PaulLaux / eth-hot-wallet-sendTransaction.js
Last active Aug 29, 2018
Promisify web3.js sendTransaction to use it with saga.js
View eth-hot-wallet-sendTransaction.js
export function* SendTransaction() {
try {
// ...
let tx;
const sendAmount = new BigNumber(amount).times(Ether);
const sendParams = { from: fromAddress, to: toAddress, value: sendAmount, gasPrice, gas: maxGasForEthSend };
function sendTransactionPromise(params) {
return new Promise((resolve, reject) => {
PaulLaux / eth-hot-wallet-store.js
Created Aug 29, 2018
Save encrypted keystore into local storage
View eth-hot-wallet-store.js
import localStore from 'store/dist/store.modern';
/* keystore will be saved to local storage under this key */
export const localStorageKey = 'ks';
* Save wallet to localStorage
export function* saveWalletS() {
try {
View eth-hot-wallet-generateWallet.js
* Generate new seed and password
export function* generateWallet() {
try {
const password = generateString(generatedPasswordLength);
const extraEntropy = generateString(generatedPasswordLength);
const seed = lightwallet.keystore.generateRandomSeed(extraEntropy);
PaulLaux / eth-hot-wallet-Saga.js
Last active Apr 29, 2019
eth-hot-wallet Saga.js usage example
View eth-hot-wallet-Saga.js
* Saga.js usage example
* The mental model is that a saga is like a separate thread in your application
* that's solely responsible for side effects. redux-saga is a redux middleware,
* which means this thread can be started, paused and cancelled from the main
* application with normal redux actions, it has access to the full redux application
* state and it can dispatch redux actions as well.
export function* checkFaucetApi() {
const requestURL = checkFaucetAddress;
You can’t perform that action at this time.