Skip to content

Instantly share code, notes, and snippets.

View giansalex's full-sized avatar

Giancarlos Salas giansalex

View GitHub Profile
@giansalex
giansalex / amino.js
Last active May 5, 2023 04:20
Authz Ledger support for Cosmos sdk 45.x
function isAminoConverter(
converter,
) {
return typeof converter[1] !== "string";
}
/**
* A map from Stargate message types as used in the messages's `Any` type
* to Amino types.
*/
@giansalex
giansalex / cw20-ics20.md
Last active December 14, 2023 18:00
Deploy CW20-ICS20 contract

CW20-ICS20 on Juno

TX_FLAGS="--gas auto --gas-adjustment 1.3 --gas-prices 0.025ujunox"
junod tx wasm store cw20_ics20.wasm --from user $TX_FLAGS

GET Code ID.

  • Instantiate Contract:
@giansalex
giansalex / keplr-suggest.js
Last active January 3, 2023 23:08
Evmos chain to keplr v0.11.30
// Download and install keplr: https://github.com/chainapsis/keplr-wallet/releases/tag/v0.9.13
// Use developer console (Browser)
let chainInfo = {
"chainId": "evmos_9000-4",
"chainName": "Evmos Testnet",
"rpc": "https://tendermint.bd.evmos.dev:26657",
"rest": "https://rest.bd.evmos.dev:1317",
"stakeCurrency": {
"coinDenom": "EVMOS",
@giansalex
giansalex / 01-main.js
Last active March 6, 2023 05:01
Parse Cosmwasm contract state.
const fs = require('fs');
// state.json -> GET /cosmwasm/wasm/v1/contract/{contract}/state
function main() {
const data = fs.readFileSync('cw721-state.json', 'utf8');
const state = JSON.parse(data);
const items = [];
state.models.forEach(m => {
items.push({
@giansalex
giansalex / sync_juno_from_genesis.md
Created April 21, 2022 20:47 — forked from webmaster128/sync_juno_from_genesis.md
Sync Juno from genesis (April 7th, 2022)

Run juno node from genesis

Base installation

Tested on Ubuntu 20.04 but should be very similar for all Ubuntu/Debian systems. Logged in as root because I'm feeling lucky.

# Base installation
apt update && apt upgrade -y \
  && apt install -y joe git build-essential jq screen
@giansalex
giansalex / mint-collection-nft.md
Last active April 21, 2022 02:25
Minting gno NFTs

Create collection

# args(2): name, symbol.
./build/gnokey maketx call test1 --pkgpath "gno.land/r/legend" --func CreateCollection \
  --args "Disperze NFTs" \
  --args "DNFT" \
  --gas-fee 1gnot --gas-wanted 2000000 > create.unsigned.txt

./build/gnokey sign test1 --txpath create.unsigned.txt --chainid "testchain" --number $ACC_NUMBER --sequence $SEQUENCE > create.signed.txt
./build/gnokey broadcast create.signed.txt --remote gno.land:36657
import { SigningStargateClient } from '@cosmjs/stargate'
import { fromBase64 } from "@cosmjs/encoding";
import {
makeAuthInfoBytes,
makeSignDoc,
} from '@cosmjs/proto-signing'
import { Int53, Uint53 } from "@cosmjs/math";
import { Any } from "cosmjs-types/google/protobuf/any";
import { PubKey } from "cosmjs-types/cosmos/crypto/secp256k1/keys";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
@giansalex
giansalex / eth-sign.js
Last active April 21, 2022 02:27
Ethereum - Sign arbitrary data (sign cosmos tx bytes)
var Web3 = require('web3');
var web3 = new Web3(window.web3.currentProvider);
var accountToSignWith = '0xbedcf417ff2752d996d2ade98b97a6f0bef4beb9';
var message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Eaedem res maneant alio modo.'
function signHandler(err, signature) {
if (!err) {
console.log('Signature:', signature);
signature = signature.substr(2);
@giansalex
giansalex / juno-state-sync.md
Last active November 29, 2021 17:53
Join to Juno UNI Testnet [state-sync]

Juno Cosmwasm state-sync

Build binary

git clone https://github.com/disperze/Juno
cd Juno
git checkout v2.0.0-beta-sync.3
make build && make install
@giansalex
giansalex / listen-cw20-transfer.go
Last active June 24, 2022 08:50
Listen cw20 transactions (Cosmwasm v1)
package main
import (
"context"
"fmt"
"log"
"time"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)