Skip to content

Instantly share code, notes, and snippets.

View TrevorJTClarke's full-sized avatar
🙈

Trevor Clarke TrevorJTClarke

🙈
View GitHub Profile
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 305
Hash: 20f76660 f3ecd008 f55ee086 6d669153
1a8e7553 eff89313 cc848e16 de95c191
172603a2 580ccf3a 9bc00185 d0dbf492
70092358 115c68b8 eb45d7e3 b8474a76
set -e
NETWORK=mainnet
OWNER=sputnik-dao.$NETWORK
COUNCIL_ACC=CHANGE_ME.near
export DAO_NAME=hack #mynewdao.sputnikv2.testnet
##Change NODE_ENV between mainnet, testnet and betanet
export NODE_ENV=mainnet
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.web3api.io', {headers: {x-api-key:'<api_key>'}});
// Events:
// addLiquidity 0x4d49e87d
// addLiquidityIbETHv2AlphaOptimal(uint256,uint256,uint256,address,uint256) 0xe52bc129
// addLiquidityETHAlphaOptimal(uint256,uint256,address,uint256) 0xb057e457
// addLiquidity(uint256) 0x51c6590a
ws.on('open', () => {
@TrevorJTClarke
TrevorJTClarke / nodejs session with near protocol ed25519
Last active January 25, 2021 09:12
Expressjs middleware for handling authentication based on recent signed messages
import axios from 'axios'
import nacl from 'tweetnacl'
import { utils } from 'near-api-js'
import getNearConfig from './config'
require('dotenv').config()
// string to uint array
// REF: https://coolaj86.com/articles/unicode-string-to-a-utf-8-typed-array-buffer-in-javascript/
function unicodeStringToTypedArray(s) {
const escstr = encodeURIComponent(s)
const socket = new WebSocket(`wss://ws.web3api.io?x-api-key=${YOUR_API_KEY_HERE}`)
socket.addEventListener('open', event => {
console.log('Connection opened - ', event)
})
// Closed Connection
socket.addEventListener('close', event => {
console.log('Connection closed - ', event.data)
})
// View Full documentation here: https://docs.amberdata.io/reference/tokens#get-historical-token-holders
axios({
method:'get',
url: 'https://web3api.io/api/v1/tokens/ETHEREUM_ADDRESS_HERE/holders/historical?timeFrame=30d',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "metadata": {
// "columns": ["timestamp", "timestamp.holder*"]
axios({
method:'get',
url: 'https://web3api.io/api/v1/tokens/ETHEREUM_ADDRESS_HERE/transfers',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "totalRecords": 3545827,
// "records": [
// {
axios({
method:'get',
url: 'https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/tokens',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "totalRecords": "738",
// "records": [
// {
axios({
method:'get',
url: 'https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/transactions',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
{
"totalRecords": 3300291,
"records": [
{
axios({
method:'get',
url: 'https://web3api.io/api/v1/addresses/ETHEREUM_ADDRESS_HERE/account-balances/latest',
headers: { 'x-api-key': 'YOUR_API_KEY_HERE' }
}).then(res => {
// res data example:
// {
// "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
// "blockNumber": "7280439",
// "timestamp": 1551391449000,