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 watchEtherTransfers() { | |
// Instantiate web3 with WebSocket provider | |
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws')) | |
// Instantiate subscription object | |
const subscription = web3.eth.subscribe('pendingTransactions') | |
// Subscribe to pending transactions | |
subscription.subscribe((error, result) => { | |
if (error) console.log(error) |
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 watchTokenTransfers() { | |
// Instantiate web3 with WebSocketProvider | |
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws')) | |
// Instantiate token contract object with JSON ABI and address | |
const tokenContract = new web3.eth.Contract( | |
TOKEN_ABI, process.env.TOKEN_CONTRACT_ADDRESS, | |
(error, result) => { if (error) console.log(error) } | |
) |
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
async function getConfirmations(txHash) { | |
try { | |
// Instantiate web3 with HttpProvider | |
const web3 = new Web3('https://rinkeby.infura.io/') | |
// Get transaction details | |
const trx = await web3.eth.getTransaction(txHash) | |
// Get current block number | |
const currentBlock = await web3.eth.getBlockNumber() |
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 confirmEtherTransaction(txHash, confirmations = 10) { | |
setTimeout(async () => { | |
// Get current number of confirmations and compare it with sought-for value | |
const trxConfirmations = await getConfirmations(txHash) | |
console.log('Transaction with hash ' + txHash + ' has ' + trxConfirmations + ' confirmation(s)') | |
if (trxConfirmations >= confirmations) { | |
// Handle confirmation event according to your business logic |
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
// Douglas Hill, December 2018 | |
// Made for https://douglashill.co/reading-app/ | |
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
import UIKit | |
/// A table view that allows navigation and selection using a hardware keyboard. | |
/// Only supports a single section. | |
class KeyboardTableView: UITableView { | |
// These properties may be set or overridden to provide discoverability titles for key commands. |
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
{ | |
"microsoft.net.sdk.ios": "15.2.301-preview.13.5", | |
"microsoft.net.sdk.macos": "12.1.301-preview.13.5" | |
} |
OlderNewer