Skip to content

Instantly share code, notes, and snippets.

View dohaki's full-sized avatar

Dong-Ha Kim dohaki

View GitHub Profile
@dohaki
dohaki / toFBT.js
Created November 28, 2019 16:56
script to migrate from i18n.js to fbt in trustlines mobileapp
const fs = require("fs")
const srcDir = `${__dirname}/../src/shared/`
const translations = require(`${srcDir}i18n/en.json`)
function getJSFileNames(dir, prevFiles = []) {
const files = fs.readdirSync(dir)
files.forEach(file => {
const name = dir + "/" + file
@dohaki
dohaki / build-local-clientlib-for-mobileapp.sh
Created November 19, 2019 09:41
Use local trustlines clientlib build in mobileapp
# Run in clientlib root
yarn build:esm && \
rm -r <PATH_TO_MOBILEAPP>/node_modules/trustlines-clientlib/lib-esm/ && \
cp -r ./lib-esm/ <PATH_TO_MOBILEAPP>/node_modules/trustlines-clientlib/lib-esm/
import { ethers } from "ethers";
import { EthersWalletData, IdentityWalletData } from "../typings";
import { TL_WALLET_VERSION } from "./TLWallet";
export class WalletFromEthers extends ethers.Wallet {
public static fromWalletData(
walletData: EthersWalletData | IdentityWalletData
) {
const { signingKey } = walletData.meta
const { privateKey, mnemonic } = signingKey
@dohaki
dohaki / clientlib-ethers-migration.md
Last active January 3, 2019 09:50
Guideline on migrating to ethers.js

Migration to ethers.js and refactoring

Introduction

This document serves as a guideline for migrating from eth-lightwallet and web3 to ethers.js. It also contains required refactoring for a more composite/modular architecture.

Why migrating at all?

In the past we had some issues with eth-lightwallet as it is no really maintained anymore. This includes:

  • Not updated dependencies which lead to breaking the library
  • Long waiting time until PRs are merged
  • Smaller (but a lot of) inconveniences while working with the library
0xeFe9d70Ce11F6b70F55fA706ECF6dE40F5d1988F
0x712066E2Cc1725C39249e62DC0809ec5078163eA