I hereby claim:
- I am xavierlepretre on github.
- I am xavierlepretre (https://keybase.io/xavierlepretre) on keybase.
- I have a public key whose fingerprint is A75D D98D B756 36FA AFE8 2BDD 78C5 1285 AAC6 B231
To claim this, I am signing this object:
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.support.test.InstrumentationRegistry; | |
import org.junit.Assume; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; |
I hereby claim:
To claim this, I am signing this object:
const Promise = require("bluebird"); | |
const sequentialPromise = require("./sequentialPromise.js"); | |
/** | |
* @param {!string | !Array.<!string>} txHash, a transaction hash or an array of transaction hashes. | |
* @param {Number} interval, in seconds. | |
* @returns {!Promise.<!object> | !Promise.<!Array.<!object>>} the receipt or an array of receipts. | |
*/ | |
module.exports = function getTransactionReceiptMined(txHash, interval) { | |
const self = this; |
web3.eth.getAccountsPromise = function () { | |
return new Promise(function (resolve, reject) { | |
web3.eth.getAccounts(function (e, accounts) { | |
if (e != null) { | |
reject(e); | |
} else { | |
resolve(accounts); | |
} | |
}); | |
}); |
if (typeof(mist) !== "undefined") { | |
mist.requestAccountPromise = function () { | |
return new Promise (function (resolve, reject) { | |
mist.requestAccount(function(e, account) { | |
if(e != null) { | |
reject(e); | |
} else { | |
resolve(account); | |
} | |
}); |
web3.eth.getFirstAccountPromise = function () { | |
// https://gist.github.com/xavierlepretre/ed82f210df0f9300493d5ca79893806a | |
return web3.eth.getAccountsPromise() | |
.then(function (accounts) { | |
if (accounts.length > 0) { | |
return accounts[0]; | |
} else if (typeof(mist) !== "undefined") { | |
// https://gist.github.com/xavierlepretre/ee456323b2544dd4da22cd5fa6d2894c | |
return mist.requestAccountPromise(); | |
} else { |
"use strict"; | |
/** | |
* @param {!Function.<!Promise>} action. | |
* @param {!Number | !string | !BigNumber} gasToUse. | |
* @returns {!Promise} which throws unless it hit a valid error. | |
*/ | |
module.exports = function expectedExceptionPromise(action, gasToUse) { | |
return new Promise(function (resolve, reject) { | |
try { |
web3.eth.filter("pending").watch(function() { | |
if (eth.mining) return; | |
console.log(new Date() + "-- Transactions detected, so starting mining."); | |
miner.start(1); | |
}); | |
web3.eth.filter('latest', function(error, result) { | |
console.log(new Date() + "-- Got latest, so stopping mining"); | |
miner.stop(); | |
if (txpool.status.pending > 0) { |
getEventsPromise= function (myFilter, count, timeOut) { | |
timeOut = timeOut ? timeOut : 30000; | |
var promise = new Promise(function (resolve, reject) { | |
count = (typeof count !== "undefined") ? count : 1; | |
var results = []; | |
var toClear = setTimeout(function () { | |
reject("Timed out"); | |
}, timeOut); | |
myFilter.watch(function (error, result) { | |
if (error) { |
const Rx = require('rx'); | |
module.exports = { | |
rxify: function (web3) { | |
// List synchronous functions masquerading as values. | |
var syncGetters = { | |
db: [], | |
eth: [ "accounts", "blockNumber", "coinbase", "gasPrice", "hashrate", | |
"mining", "protocolVersion", "syncing" ], | |
net: [ "listening", "peerCount" ], |