Skip to content

Instantly share code, notes, and snippets.

Avatar

Giancarlos Salas giansalex

View GitHub Profile
@giansalex
giansalex / keplr-suggest.js
Last active Jun 28, 2022
Evmos chain to keplr v0.9.13
View keplr-suggest.js
// 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 Aug 7, 2022
Export Cosmwasm contract state.
View 01-main.js
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 Apr 21, 2022 — forked from webmaster128/sync_juno_from_genesis.md
Sync Juno from genesis (April 7th, 2022)
View sync_juno_from_genesis.md

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
View mint-collection-nft.md

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
View sign-evmos-keplr.js
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 Apr 21, 2022
Ethereum - Sign arbitrary data (sign cosmos tx bytes)
View eth-sign.js
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 Nov 29, 2021
Join to Juno UNI Testnet [state-sync]
View juno-state-sync.md

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 Jun 24, 2022
Listen cw20 transactions (Cosmwasm v1)
View listen-cw20-transfer.go
package main
import (
"context"
"fmt"
"log"
"time"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
)
@giansalex
giansalex / juno-lucina-testnet.md
Last active Aug 23, 2021
Join to JUNO chain testnet (lucina)
View juno-lucina-testnet.md

Join to Juno testnet

Initialize junod

junod init [moniker] --chain-id lucina

Configure junod

  • Download and replace the lucina Testnet genesis.json by:
@giansalex
giansalex / query-ruc-padron.php
Last active Apr 30, 2022
Query RUC list - SUNAT
View query-ruc-padron.php
<?php
// Descargar padron reducido: https://www.sunat.gob.pe/descargaPRR/mrc137_padron_reducido.html
// Resultado al descomprimir: padron_reducido_ruc.txt
set_time_limit(0);
function queryRucPadron($txtPath, $ruc)
{
$handle = fopen($txtPath, "r") or die("No se puede abrir el txt");