Skip to content

Instantly share code, notes, and snippets.

View mosesfinlay's full-sized avatar

Moses Finlay mosesfinlay

View GitHub Profile
const fs = require("fs");
const axios = require("axios");
const blocks = [];
let gasUsed = 0;
function toDateTime(secs) {
var t = new Date(1970, 0, 1); // Epoch
t.setSeconds(secs);
return t;
// TipButton.js
import React, { Component } from "react";
import Modal from "react-bootstrap/Modal";
class TipButton extends Component {
state = {
modalOpen: false,
amount: "0"
}
@mosesfinlay
mosesfinlay / App.js
Last active September 12, 2021 20:35
// ...
nearLogin = () => {
const { wallet } = this.state;
wallet.requestSignIn("example.testnet");
}
componentDidMount() {
this.initNear();
}
@mosesfinlay
mosesfinlay / App.js
Last active September 12, 2021 21:38
// ...
class App extends Component {
state = {
wallet: false,
accountId: null,
}
sendNear = async (amount, receiver) => {
const { wallet } = this.state;
@mosesfinlay
mosesfinlay / App.js
Last active September 12, 2021 20:26
render() {
const { accountId } = this.state;
return (
<div className="App">
<header>
<h1>Near Tip Button</h1>
<button onClick={this.nearLogin}>Login with Near</button>
{accountId && <p>Signed in as: {accountId}</p>}
@mosesfinlay
mosesfinlay / App.js
Last active September 12, 2021 20:05
// ...
// Import library
import * as nearAPI from "near-api-js";
const { utils, connect, keyStores, WalletConnection } = nearAPI;
// Connection configuration
const config = {
testnet: {
networkId: "testnet",
keyStore: new keyStores.BrowserLocalStorageKeyStore(),

Keybase proof

I hereby claim:

  • I am mosesfinlay on github.
  • I am mosesfinlay (https://keybase.io/mosesfinlay) on keybase.
  • I have a public key ASA7lhU2XdYcyKva-CbkplG6NtqX2vjj9f_ygviIpPQuvAo

To claim this, I am signing this object: