Skip to content

Instantly share code, notes, and snippets.

View AlmostEfficient's full-sized avatar

Raza AlmostEfficient

View GitHub Profile
// SPDX-License-Identifier: MIT
// Source:
// https://github.com/ensdomains/ens-contracts/blob/master/contracts/ethregistrar/StringUtils.sol
pragma solidity >=0.8.4;
library StringUtils {
/**
* @dev Returns the length of a given string
*
* @param s The string to measure the length of
@AlmostEfficient
AlmostEfficient / getTokenAccounts.ts
Last active November 2, 2021 11:31
Get all Solana token accounts for a given address
// https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountsbyowner
import axios from "axios";
async function getTokenAccounts(address: string) {
try {
return new Promise(async (resolve, reject) => {
let data = {
jsonrpc: "2.0",
id: 1,
method: "getProgramAccounts",