Skip to content

Instantly share code, notes, and snippets.

View adamwhitakerwilson's full-sized avatar

Adam adamwhitakerwilson

View GitHub Profile
package com.covalenthq.scout.utils;
import java.io.IOException;
/*
** Markdown Version of API v1 docs converted
to a string for OpenApi Swaggar Documentation Description.
*/
/*
Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta, Beta
Shared APRIL 2012 by Lasse Vestergaard <lassesvestergaard@gmail.com>
The protocol for communicating with this sketch is:
SERIAL INPUT:
- set pin state (p) og set pin value (v)
- When setting a pin state you can write 0 (input),1 (output),2 (pwm)
@adamwhitakerwilson
adamwhitakerwilson / covalent_prepare_nft_metadata_batch.py
Last active December 9, 2021 16:20
By using the Covalent APIs, given an NFT contract and chain id, fetch all token ids and prepare an array of urls that call Get External NFT Metadata to be passed into the body for the batch query endpoint.
import requests
import time
import urllib3
def check_internet(url):
try:
req = urllib3.PoolManager().request("GET", url)
if str(req.status) != "500":
if str(req.status) != "404":
This file has been truncated, but you can view the full file.
// http://localhost:7000/v1/137/address/0x471F2B55035a9cFDeC727Fd1F1838aF600234b16/balances_v2/?nft=true&key=ckey_&page-size=900
{
"data": {
"address": "0x471f2b55035a9cfdec727fd1f1838af600234b16",
"updated_at": "2021-07-07T18:04:52.287462Z",
"next_update_at": "2021-07-07T18:09:52.287464Z",
"quote_currency": "USD",
"chain_id": 137,
"items": [
{
@adamwhitakerwilson
adamwhitakerwilson / spiritswap_network_assets_first_pass.json
Created June 9, 2021 07:21
spiritswap_network_assets_first_pass --> todo: get more prices --> implement stablecoin price router
// 20210609031840
// http://localhost:7000/v1/250/networks/uniswaplike/address/0xef45d134b73241eda7703fa787148d9c9f4950b0/assets/?key=ckey_
{
"data": {
"updated_at": "2021-06-09T07:05:39.191Z",
"items": [
{
"exchange": "0x8aa63a690dc69adc4240d991459c32229693dc8a",
"swap_count_24h": 0,
// 20210609030535
// http://localhost:7000/v1/43114/networks/uniswaplike/address/0xefa94de7a4656d787667c749f7e1223d71e9fd88/assets/?key=ckey_
{
"data": {
"updated_at": "2021-06-09T07:05:19.972Z",
"items": [
{
"exchange": "0xe7b228187243c7a46945d0da8ec79091b0fa86c4",
"swap_count_24h": 14,
// 20210529114715
// http://localhost:7000/v1/56/events/address/0x0000000000000000000000000000000000001004/?starting-block=7758612&ending-block=7787247&key=ckey_6272ec7acf0f459bbc9a90bf707
{
"data": {
"updated_at": "2021-05-29T15:47:14.698109Z",
"items": [
{
"block_signed_at": "2021-05-27T04:00:01Z",
"block_height": 7758612,
This file has been truncated, but you can view the full file.
select
'0x' || encode(bt.hash, 'hex') as tx_hash,
bt.tx_offset,
bt.successful,
'0x' || encode(bt.
from
, 'hex') as from_address,
'0x' || encode(bt.to, 'hex') as to_address,
bt.value,
bt.gas_offered,
@adamwhitakerwilson
adamwhitakerwilson / scratch_queries.json
Last active April 25, 2021 01:15
www.covalenthq.com - Primer Class A endpoint examples
This file has been truncated, but you can view the full file.
// Erc20 token transfers
// 20210423130137
// https://api.covalenthq.com/v1/1/address/0x4754B849DC5164C4e09f5dE6639077438A94d205/transfers_v2/?contract-address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&primer=[{$match:{successful:true}},{%20%22$group%22:%20{%20%22_id%22:%20{%20%22month%22:%20{%20%22$month%22:%20%22block_signed_at%22%20},%20%22day%22:%20{%20%22$dayOfMonth%22:%20%22block_signed_at%22%20},%20%22year%22:%20{%20%22$year%22:%20%22block_signed_at%22%20},%20%22hour%22:%20{%20%22$hourOfDay%22:%20%22block_signed_at%22%20}%20},%20%22transfer_count%22:%20{%20%22$sum%22:%201%20},%20%22sum_of_delta_quote%22:%20{%20%22$sum%22:%20%22transfers.0.delta_quote%22%20}%20}%20}]
{
"data": {
"address": "0x4754b849dc5164c4e09f5de6639077438a94d205",
"updated_at": "2021-04-23T20:01:37.066807Z",
"next_update_at": "2021-04-23T20:06:37.066817Z",
"quote_currency": "USD",
"chain_id": 1,
#!/usr/bin/env ruby
require 'pathname'
class << ENV
def path
@path ||= self['PATH'].split(':').map{ |d| Pathname.new(d) }
end
def which(cmd)