Skip to content

Commit

Permalink
Merge pull request anoma#13 from heliaxdev/feat/12/mnemonic_and_maste…
Browse files Browse the repository at this point in the history
…r_key_creation

Feat/12/mnemonic and master key creation
  • Loading branch information
memasdeligeorgakis committed Mar 16, 2022
2 parents 5d1995d + 04fc4b6 commit d5d870a
Show file tree
Hide file tree
Showing 71 changed files with 9,299 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-wallet-at-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:

- name: Install dependencies
working-directory: ./anoma-wallet
run: npm install
run: CI=false yarn

- name: build the site
working-directory: ./anoma-wallet
run: CI=false npm run build
run: CI=false yarn build-with-craco

- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2.3
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/node_modules
/.pnp
.pnp.js

# testing
/coverage
**/coverage

# production
/build

debug/
target/
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
**/.npmrc

npm-debug.log*
yarn-debug.log*
Expand Down
20 changes: 20 additions & 0 deletions anoma-wallet/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require("path");

module.exports = {
webpack: {
configure: (webpackConfig) => {
// ts-loader for using non-transpiled ts content from yarn workspaces
webpackConfig.module.rules.push({
test: /\.ts?$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
transpileOnly: true,
configFile: "tsconfig.json",
},
});

return webpackConfig;
},
},
};
11 changes: 10 additions & 1 deletion anoma-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
"name": "anoma-wallet",
"version": "0.1.0",
"private": true,
"workspaces": [
"packages/*"
],
"dependencies": {
"@cosmjs/encoding": "^0.27.1",
"@cosmjs/json-rpc": "^0.27.1",
"@cosmjs/tendermint-rpc": "^0.27.1",
"bn.js": "^5.2.0",
"borsh": "^0.7.0",
"buffer": "^6.0.3",
"framer-motion": "^6.2.8",
"path": "^0.12.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "6",
"react-scripts": "5.0.0",
"stream": "^0.0.2",
"styled-components": "^5.3.3",
Expand All @@ -21,10 +26,12 @@
},
"scripts": {
"start": "npx wasm-react-scripts start",
"start-with-craco": "craco start",
"start:local": "REACT_APP_LOCAL=\"true\" yarn start",
"wasm:build": "wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target web",
"wasm:build:node": "wasm-pack build ../anoma-lib/ --out-dir ../anoma-wallet/src/lib/anoma --out-name anoma --target nodejs",
"build": "npx wasm-react-scripts build",
"build-with-craco": "craco build",
"lint": "npx eslint src --ext .ts,.tsx",
"lint:fix": "yarn lint -- --fix",
"test": "yarn wasm:build:node && npx wasm-react-scripts test",
Expand All @@ -49,6 +56,7 @@
]
},
"devDependencies": {
"@craco/craco": "^6.4.3",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -68,6 +76,7 @@
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.5.1"
"prettier": "^2.5.1",
"ts-loader": "^9.2.7"
}
}
30 changes: 30 additions & 0 deletions anoma-wallet/packages/key-management/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Anoma Extension

This packs all the key management used in Anoma wallet. The fain features being the generation and re-generating of key pairs from seed phrase.

## How to run
```bash
# at the root

# rebuild and copy libs
./scripts/build-rust.sh

# run the test suite
yarn jest
```

## Types

### `Mnemonic`
### `KeyPair`
* This is the keypair that is being used to sign transactions.
* It can be encrypted or unencrypted.
* It has the format that is suitable for file storage and is same as in the CLI. Example:
```toml
[keys]
memas-key-2 = "unencrypted:20000000f9e3191d096de7449f03fbfd03031f6b7ec23f1a048a53cbdb545c115a3b293e2000000095b922ce1f3b69b60dd8949867be8694703509ef8a20ec83e436aa08a22edda4"
memas-key-1 = "encrypted:ec5d6c48eb2e27423533f56d4fcea010d6711055fda0f3bd146b555e88ef4bf5e3ec447bab58537e55c2ff87aa9e5e08cf41db3f472d55fa766fa48bf122004e6ab4421142329055989bdf51bd2307a2fe24f0babea4bceb90eee91347188e3b6f0f23d1e3fff690f10ebd1c593d2167c773baf2967b60fde51c71cae64c6b3c"
```

### `KeyPairType`
### `Mnemonic`
3 changes: 3 additions & 0 deletions anoma-wallet/packages/key-management/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { Mnemonic, MnemonicLength } from "./src/Mnemonic";
export { KeyPair, KeyPairType } from "./src/KeyPair";
// export { WalletFileManager } from "./src/WalletFile";
5 changes: 5 additions & 0 deletions anoma-wallet/packages/key-management/jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
export default {
preset: "ts-jest",
testEnvironment: "node",
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"workbench.colorCustomizations": {
"[monokai]": {
"symbolIcon.namespaceForeground": "#ff0000"
},
"activityBar.background": "#007d3b",
"activityBar.activeForeground": "1e5388",
"titleBar.activeBackground": "#007d3b",
"titleBar.activeForeground": "#fff",
"activityBar.foreground": "#fff",
},
"window.title": "anoma-wallet"
}
Loading

0 comments on commit d5d870a

Please sign in to comment.