title | publishedOn | description |
---|---|---|
Hello World |
2022-05-15 |
T3st1ng G1thub G15t5 as CeeDee En |
$$ L = \frac{1}{2} \rho v^2 S C_L
declare const window: any | |
// account is the ethereum address | |
export const signMessage = async (account: string, message: string) => { | |
const { ethereum } = window | |
if (!ethereum) return | |
try { | |
const signature = await window.ethereum.request({ | |
method: 'personal_sign', | |
params: [account, message], |
declare const window: any | |
const chainIds: { | |
[chainId: string]: string | |
} = { | |
ethereum: '0x1', | |
bsc: '0x38', | |
} | |
const rpcUrls: { |
[ | |
{ | |
"name": "Ethereum Mainnet", | |
"chain": "ETH", | |
"network": "mainnet", | |
"icon": "ethereum", | |
"rpc": [ | |
"https://mainnet.infura.io/v3/${INFURA_API_KEY}", | |
"wss://mainnet.infura.io/ws/v3/${INFURA_API_KEY}", | |
"https://api.mycryptoapi.com/eth", |
import * as React from 'react' | |
function lazyImport< | |
T extends React.ComponentType<any>, | |
I extends { [K2 in K]: T }, | |
K extends keyof I | |
>(factory: () => Promise<I>, name: K): I { | |
return Object.create({ | |
[name]: React.lazy(() => | |
factory().then(module => ({ default: module[name] })) |
import React from "react"; | |
import ReactDOM from "react-dom"; | |
// set the defaults | |
const LanguageContext = React.createContext({ | |
language: "en", | |
setLanguage: () => {} | |
}); | |
const LanguageSwitcher = () => { |
import * as React from 'react'; | |
import { providers } from 'ethers'; | |
const logout = async () => | |
axios | |
.get('/api/auth/logout') | |
.then(_ => _) | |
.catch(_ => console.log(_)); | |
export const useDetectAccountChange = () => { |
// don't use this. I'm not sure if this is a good solution | |
// keeping it as notes till I find a better solution | |
// assume you got this from a JSON file: | |
const statesWeather = { | |
"wisconsin": "cloudy", | |
"california": "rainy", | |
"newyork": "sunny", | |
"florida": "cloudy", | |
"texas": "rainy", |
type NewLinkTagStatus = 'ALREADY_EXISTS' | 'CREATED' | 'ERROR' | |
type NewLinkTagArgs = Pick<HTMLLinkElement, 'href' | 'rel' | 'type'> & Partial<HTMLLinkElement> | |
export function newLinkTag(attributes: NewLinkTagArgs): NewLinkTagStatus { | |
// these two attributes are required | |
const { href, rel } = attributes | |
if (!href || !rel) { | |
console.error('newLinkTag: href and rel are required attributes') | |
return 'ERROR' | |
} |