Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🤖

Gabriel Cardona cgcardona

💭
🤖
  • San Francisco, CA
View GitHub Profile
View onramp-avash-user.md

Onramp Avash User

Dependencies

Golang

First, confirm you have the latest and greatest version of Golang and if not then install it.

go version
View nft.ts
// npx hardhat run scripts/erc721.ts --network mainnet
// snowflake.market/api/nfts/QmUKReSPRYzDveDfSvXX7QAqVAD7ojBBaQ7sLJDMZRhTjs
import { Contract } from "ethers"
import { ethers } from "hardhat"
const coinAddr: string = "0xe304EDd5C4e590e2b8ce08b9625597FF38192D71"
const abi: any[] = [
{
"inputs": [
View decode-utxo.ts
import { Buffer } from "avalanche"
import { UTXO } from "avalanche/dist/apis/avm"
import { Serialization } from "avalanche/dist/utils"
const main = async (): Promise<any> => {
const serialization: Serialization = Serialization.getInstance()
const u: string = "11XU8pxA7Z7Y7tJAEtXGeiXNcTGJycDKWzWRXytxA5uH8vVMvq3MEE3TqtcBHn8iz4fyQbBGhpodtqDxT4FUECdNQnEjqVQ63mwjsHNCBgiqEbXkULnSEALywXXQzWjcFvAJyUjFoW4zujXuw7s5MBZoip7H6fC5BphP9B"
const m: Buffer = serialization.typeToBuffer(u, "cb58")
const utxo: UTXO = new UTXO()
utxo.fromBuffer(m)
View create-txid.ts
import createHash from 'create-hash'
import { Avalanche, BN, Buffer } from "../../src"
import { AVMAPI, KeyChain as AVMKeyChain, UTXOSet, UnsignedTx, Tx } from "../../src/apis/avm"
import { KeyChain as PlatformVMKeyChain, PlatformVMAPI } from "../../src/apis/platformvm"
import { PrivateKeyPrefix, DefaultLocalGenesisPrivateKey, Defaults, UnixNow, SerializedType } from "../../src/utils"
import { Serialization } from "../../src/utils"
const serialization: Serialization = Serialization.getInstance()
const ip: string = "localhost"
const port: number = 9650
@cgcardona
cgcardona / Dockerfile
Last active Jun 14, 2021
Example showing how to get a NodeJS app into a Docker container w/ cached layers.
View Dockerfile
# Set the baseImage.
# The ECR node:14 image is noticeably faster than dockerhub.
FROM public.ecr.aws/bitnami/node:14
# Set the working dir to /example-directory.
WORKDIR /example-directory
# Rather than copying the entire working directory only copy the package.json file.
# This takes advantage of cached Docker layers and doesn't rebuild the modules each time the container is rebuilt.
# If the package.json file changes then the modules will be rebuilt.
@cgcardona
cgcardona / zsh_stats
Created Jun 12, 2021
Get a list of the top 20 commands and how many times they have been run.
View zsh_stats
zsh_stats () {
fc -l 1 | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl
}
@cgcardona
cgcardona / config.json
Created Jun 4, 2021
avalanchego --config-file=./config.json
View config.json
{
"coreth-config": {
"snowman-api-enabled": true,
"coreth-admin-api-enabled": true,
"net-api-enabled": true,
"rpc-gas-cap": 2500000000,
"rpc-tx-fee-cap": 100,
"eth-api-enabled": true,
"personal-api-enabled": true,
"tx-pool-api-enabled": true,
View Golang-Dev-Environment-Setup.md

Golang Dev Environment Setup

GVM (Golang Version Manager)

# Install gvm
zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

# Install golang v1.16
gvm install go1.16
View bip32.ts
import {
Buffer,
BinTools
} from "../../src"
import {
KeyChain,
KeyPair,
} from "../../src/apis/avm"
import * as bip39 from "bip39"
import * as HDKey from "hdkey"
View bip32.ts
import {
Buffer
} from "../../src"
import {
KeyChain,
KeyPair,
} from "../../src/apis/avm"
import * as bip39 from "bip39"
import * as HDKey from "hdkey"