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 / webcrypto-examples.md
Created December 15, 2018 01:07
Web Cryptography API Examples
@pedrouid
pedrouid / setup-ssl.md
Last active July 2, 2024 04:27
Setup SSL with NGINX reverse proxy

Get a Free SSL Certificate With Let’s Encrypt

Let’s Encrypt is a free, automated, and open Certificate Authority.

  1. Install tools for using the Let's Encrypt certificates using Certbot
  sudo apt-get update \
  sudo apt-get install software-properties-common
@pedrouid
pedrouid / walletconnect-instant.md
Last active June 26, 2024 13:04
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 / index.tsx
Last active March 1, 2024 03:43
EIP-6963 react example
import React from "react";
import * as uuid from 'uuid';
import { WindowProvider } from "@wagmi/connectors"
import defaultProviderIcon from "../assets/defaultProviderIcon.png"
// copied from https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/utils/getInjectedName.ts
function getInjectedName(ethereum?: WindowProvider) {
if (!ethereum) return 'Injected'
@pedrouid
pedrouid / randomDomainNameGenerator.js
Last active July 21, 2023 13:41
Random Domain Name Generator
// @desc Creates a list of domains with custom TLDs using a pattern string with fixed length with option for keywords
// @param {String} pattern
// @param {Array|String} tlds
// @returns {Array} domainList
//
//
// Pattern string is defined by:
// - keywords lowercase
// - any letter uppercase A
// - consonants uppercase C
@pedrouid
pedrouid / list.sh
Last active April 10, 2023 19:25
List of Relay messages with size and ttl limits
REQ wc_pairingDelete
- ttl = 86400
- tag = 1000
- msg = 400 (~312)
RES wc_pairingDelete
- ttl = 86400
- tag = 1001
- msg = ??
@pedrouid
pedrouid / index.html
Created July 15, 2019 13:21
Test WalletConnect (HTML + JS)
<html>
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<title>WalletConnect Example</title>
@pedrouid
pedrouid / index.js
Last active February 13, 2023 15:02
Increase rpc_id entropy
// Our RPC id's are expected to be the same "length"
// generating id's should use Unix epoch timestamp in miliseconds and append 3 random digits
// currently Kotlin SDK has at least 3 more digits than all other SDKs
// yet while Kotlin is the minority, it's preferable to increase integers than decrease them
// this way we can keep backwards-compatibility for Kotlin clients in older releases
// thus we could also increase entropy by also increasing other SDKs to 6 random digits
function payloadId() {
const date = Date.now() * Math.pow(10, 6);
const extra = Math.ceil(Math.random() * Math.pow(10, 6));
@pedrouid
pedrouid / wallet-client.md
Last active February 13, 2023 08:10
Web3Wallet SDK for WalletConnect v2.0
@pedrouid
pedrouid / index.js
Created February 8, 2023 15:51
CAIP-25 splitting a namespace between optional and required
// Currently our proposals require a lot from wallets by including all methods into requiredNamespaces
// This puts a high requirement on the wallets to support a lot of methods and chains
{
requiredNamespaces: {
eip155: {
chains: [1, 2, 3],
methods: [
'eth_sendTransaction',
'eth_sendRawTransaction',