Skip to content

Instantly share code, notes, and snippets.

View justingreenberg's full-sized avatar

justin justingreenberg

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@justingreenberg
justingreenberg / kinetiq-integration.md
Created October 10, 2025 15:23
Kinetiq Integration Guide

Kinetiq Protocol Integration Guide

This guide provides practical examples for integrating with the Kinetiq liquid staking protocol using both Solidity smart contracts and TypeScript with Viem.

Contract Addresses (Hyperliquid Mainnet)

// Core contract addresses
address constant STAKING_MANAGER = 0x393D0B87Ed38fc779FD9611144aE649BA6082109;
address constant KHYPE_TOKEN = 0xfD739d4e423301CE9385c1fb8850539D657C296D;
import * as assert from 'assert'
import * as crypto from 'crypto'
import * as data from './data'
function ascendingByProp(prop) {
return (a, b) => b[prop] - a[prop]
}
function descendingByProp(prop) {
@justingreenberg
justingreenberg / headers.ts
Created February 23, 2020 06:05
Recursively prepend a header banner to all files in directory
const fs = require('fs').promises;
const path = require('path');
interface Params {
dir: string;
header: string;
predicate: (filePath: string) => Boolean;
}
interface WalkTree {
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore } from 'redux'
import { connect, Provider } from 'react-redux'
import './styles.css'
// Log unnecessary re-renders
require('@welldone-software/why-did-you-render')(React, {
trackAllPureComponents: true,
include: [/^ConnectFunction/],
@justingreenberg
justingreenberg / styled-media-queries.js
Last active June 17, 2018 16:26
Media queries for styled-components
const sizes = {
giant: 1170,
desktop: 992,
tablet: 768,
phablet: 572,
phone: 376
}
export const media = Object.keys(sizes).reduce((accumulator, label) => {
accumulator[label] = (...args) => css`
import { exec } from 'child_process'
import debug from 'debug'
export default {
check: cwd => new Promise((resolve, reject) => {
let resolveObj = {
behind: false,
amount: 0,
branch: 'origin/stable'
}
import assert from 'assert'
import Immutable from 'immutable'
const batchSetters = state => {
state.set('a', 1)
state.set('b', 2)
state.set('c', 3)
return state
}
@justingreenberg
justingreenberg / proxy-trace.js
Last active January 11, 2017 06:58
Simple tracing using ES Proxies
import assert from 'assert'
const tracer = async obj => {
const trace = {}
let order = []
const object = new Proxy(obj, {
get (target, prop) {
order = order.concat(prop)
trace[prop] = Reflect.has(trace, prop) ? trace[prop] + 1 : 1
import fs from 'fs'
import { interpolateName } from 'loader-utils'
// webpack config
const publicPath = 'static'
const filenameTemplate = '[name].[hash].[ext]'
const extensions = [
'png', 'jpg', 'jpeg', 'gif',
'ico', 'svg', 'otf', 'eot', 'svg',
'ttf', 'woff', 'woff2'