Skip to content

Instantly share code, notes, and snippets.

View pedrouid's full-sized avatar
🛠️
Building @WalletConnect

Pedro Gomes pedrouid

🛠️
Building @WalletConnect
View GitHub Profile
@pedrouid
pedrouid / iso-639-1.json
Last active August 23, 2022 22:41
ISO-639-1 Languages (including matching ISO-639-1, ISO-639-2B, ISO-639-2T and ISO-639-3 codes)
[
{
"name": "Afar",
"type": "living",
"scope": "individual",
"iso-639-3": "aar",
"iso-639-2B": "aar",
"iso-639-2T": "aar",
"iso-639-1": "aa"
},
@pedrouid
pedrouid / eslint-typescript.md
Last active August 11, 2022 14:31
Eslint + Prettier configuration for Typescript 3.7+ (2020)

Eslint + Prettier configuration for Typescript 3.7+ (2020)

  1. Install required dependencies
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-prettier eslint-plugin-promise eslint-plugin-react eslint-plugin-standard prettier

# OR

yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-prettier eslint-plugin-promise eslint-plugin-react eslint-plugin-standard prettier
@pedrouid
pedrouid / walletconnect-instant.md
Last active April 28, 2022 23:40
WalletConnect Instant ⚡

WalletConnect Instant ⚡

What's an Instant Request?

WalletConnect Instant feature introduces the ability to make an ephemeral session that bypasses the process of session approval by the wallet, displaying to the user a call request to be signed from the Dapp right after scanning the QR Code. This is useful for one-time use-cases like payments, topping-up or withdrawals. This is still highly experimental and hasn't been published to the official library. A PoC to aggregate feedback on this feature!

Source code available at WalletConnect/walletconnect-monorepo on walletconnect-instant branch.

Install

@pedrouid
pedrouid / wallet.js
Created August 14, 2019 19:03
Example with ethers.js (Ethereum Wallet)
const ethers = require('ethers')
const standardPath = "m/44'/60'/0'/0";
const activeIndex: number = 0;
function generatePath() {
const path = `${standardPath}/${activeIndex}`;
return path;
}
@pedrouid
pedrouid / bignumber.js
Last active November 25, 2021 18:48
BigNumber Helper Functions (Javascript & Typescript)
import BigNumber from "bignumber.js";
export function random() {
return BigNumber.random().toString();
}
export function toFixed(value, decimals) {
return new BigNumber(`${value}`).toFixed(decimals).toString();
}
@pedrouid
pedrouid / devops-cheatsheet.md
Last active March 12, 2021 14:27
Digital Ocean DevOps Cheatsheet (Ubuntu 16.04)

Digital Ocean DevOps Cheatsheet (Ubuntu 16.04)

How to Deploy a Node.js App with SSL

Create an SSH key

We will need this for our server configuration

  1. Open console
@pedrouid
pedrouid / ethers-math.ts
Created February 18, 2021 18:01
math with ethers.js
import { BigNumber, BigNumberish, constants, utils } from "ethers";
const { Zero, MaxUint256 } = constants;
const { parseUnits, formatUnits } = utils;
export const toWad = (amount: string, decimals = 18): BigNumber => {
return parseUnits(sanitizeDecimals(amount, decimals), decimals);
};
export const fromWad = (wad: BigNumberish, decimals = 18): string => {
@pedrouid
pedrouid / caipxx.md
Last active December 13, 2020 11:35
CAIP-XX: JSON-RPC Provider API Specification

Multi-Chain JSON-RPC Provider API Specification

Multi-chain provider would require primarly two main methods to interface with a multi-chain cryptocurrency wallet: enable and request.

Enable Method

Enable method would translate the same JSON-RPC parameters of CAIP-25 as Javascript arguments

CAIP-25 Request

@pedrouid
pedrouid / remote-work.md
Last active October 1, 2020 23:19
REMOTE WORK PLATFORMS & COMPANIES
@pedrouid
pedrouid / fund.js
Last active August 4, 2020 19:35
Funding script for Connext REST API multi client
const axios = require("axios");
const ethers = require("ethers");
// For REST API clietn
const baseUrl = "<INSERT_CONNEXT_REST_API_URL>";
// For Rinkeby provider
const ethProviderUrl = "<INSERT_ETH_PROVIDER_URL>";
// this mnemonic is used to mint tokens and fund clients with some ETH for gas (currently funded with some Rinkeby ETH)