Skip to content

Commit

Permalink
chore: monorail choo choo (shapeshift#4208)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight authored Apr 10, 2023
1 parent 6cfebbf commit 1e3429b
Show file tree
Hide file tree
Showing 696 changed files with 224,103 additions and 21,030 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

35 changes: 31 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"react-app",
"react-app/jest",
"plugin:jsx-a11y/recommended",
"prettier"
],
"ignorePatterns": [
"build",
"dist",
"coverage",
"generated",
"node_modules"
],
"plugins": [
"jest",
"prettier",
"simple-import-sort",
"@shapeshiftoss/logger"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
"sourceType": "module"
},
"env": {
"browser": true,
Expand Down Expand Up @@ -76,5 +82,26 @@
"@shapeshiftoss/logger/no-native-console": "error",
"require-await": "error",
"import/no-duplicates": "error"
}
},
"overrides": [
{
"files": ["**/*.stories.*"],
"rules": {
"import/no-anonymous-default-export": "off"
}
},
{
"files": ["**/*/*.test.ts", "scripts/**/*"],
"rules": {
"@shapeshiftoss/logger/no-native-console": "off"
}
},
{
"files": ["**/__tests__/mockData/*.ts"],
"rules": {
"import/no-default-export": "off",
"import/no-anonymous-default-export": "off"
}
}
]
}
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ a19b440bd20285cf4ae1928cd31a449c08c8a1d1
47c64e5d7ce4d4702dacac14e61e949aac5415b7
# chore: add import/no-duplicates rule (#3287)
67806f1058fd76904ecbcf734d9f2df72f8ce9aa
# chore: add trailing comma lint rule (#975)
505516c23b582ff1cd2d684b6c84a117157e3423
# chore: add array-type lint rule (#1017)
cfd28ee08c22be19069c5b88d025deb5fc699cef
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary
3 changes: 3 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[blame]
ignoreRevsFile = .git-blame-ignore-revs

[grep]
lineNumber = true
2 changes: 1 addition & 1 deletion .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
restore-keys: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Yarn Install
run: yarn install --frozen-lockfile
run: yarn install --immutable

call-pr-workflow:
name: Call
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Yarn Install
run: yarn install --frozen-lockfile
- name: Build
run: yarn env && yarn build
run: yarn install --immutable
- name: Build Packages
run: yarn build:packages
- name: Build Web
run: yarn env && yarn build:web
# a poor mans extension of cloudflare/pages-action@1 https://github.com/cloudflare/pages-action/blob/main/src/index.ts
# passing more params directly to wrangler to control commit hash and message
# https://developers.cloudflare.com/workers/wrangler/commands/#publish-1
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: OpenJDK
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '11'

- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -27,7 +33,7 @@ jobs:
restore-keys: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Yarn Install
run: yarn install --frozen-lockfile
run: yarn install --immutable

# needs to run after install
- name: Commitlint PR Title
Expand All @@ -40,6 +46,9 @@ jobs:
TITLE: ${{ github.event.pull_request.title }}
run: printf '%s' "$TITLE" | npx commitlint

- name: Build Packages
run: yarn build:packages

- name: Lint
run: yarn lint

Expand All @@ -50,4 +59,4 @@ jobs:
run: yarn env app

- name: Test
run: yarn test
run: yarn test:ci
26 changes: 21 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# no zero installs
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# generated files
packages/unchained-client/src/generated

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

# testing
/coverage
coverage

# production
/build
*.tsbuildinfo
build
dist

# Optional eslint cache
.eslintcache

# misc
.DS_Store
.env

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down
7 changes: 7 additions & 0 deletions .jest/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
global.console = {
...console,
debug: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
}
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/src/crypto.js b/src/crypto.js
index e7dd596bdd78cc36c3bdfb7bb32a3bf9de3413c5..212ca83084509aaabc89dabb11014445b2d237dc 100644
--- a/src/crypto.js
+++ b/src/crypto.js
@@ -30,6 +30,11 @@ function hash160(buffer) {
}
exports.hash160 = hash160;
function hash256(buffer) {
- return sha256(sha256(buffer));
+ const out = sha256(sha256(buffer));
+ out[Symbol.for("hdwallet_isolation_digest_source_hint")] = {
+ preimage: buffer,
+ algorithm: "hash256",
+ };
+ return out;
}
exports.hash256 = hash256;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/node_modules/friendly-challenge/index.js b/node_modules/friendly-challenge/index.js
index 9152aa1..7b1dd50 100644
--- a/node_modules/friendly-challenge/index.js
+++ b/node_modules/friendly-challenge/index.js
diff --git a/index.js b/index.js
index 9152aa10be04ad1a403f7d5dddbaf6a12d74d78f..7b1dd50b7460b80d22a84f3c72e08ba22dcda7c0 100644
--- a/index.js
+++ b/index.js
@@ -2,6 +2,8 @@
// (https://github.com/niklasvh/base64-arraybuffer, MIT licensed)
const CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/node_modules/react-dom/cjs/react-dom.development.js b/node_modules/react-dom/cjs/react-dom.development.js
index e4ed5ae..6a8ca9f 100644
--- a/node_modules/react-dom/cjs/react-dom.development.js
+++ b/node_modules/react-dom/cjs/react-dom.development.js
diff --git a/cjs/react-dom.development.js b/cjs/react-dom.development.js
index e4ed5aecb725ca7db6a2e8780270f1edc45d0ba8..6a8ca9fca8d58fb63acd8b294564f751e86d98d2 100644
--- a/cjs/react-dom.development.js
+++ b/cjs/react-dom.development.js
@@ -28757,12 +28757,6 @@ function findHostInstanceWithWarning(component, methodName) {

try {
Expand Down
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-postinstall.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable */
module.exports = {
name: "@yarnpkg/plugin-postinstall",
factory: function (require) {
var plugin;(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>s});const n=require("@yarnpkg/core"),o=require("clipanion"),a={postinstall:{description:"Postinstall hook that will always run in Yarn v2",type:n.SettingsType.STRING,default:""}},r=require("@yarnpkg/shell"),l=async e=>{if(e){console.log("Running postinstall command...");const t=await r.execute(e);if(0!==t)throw new Error("postinstall command failed with exit code "+t)}};var i=function(e,t,n,o){var a,r=arguments.length,l=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,o);else for(var i=e.length-1;i>=0;i--)(a=e[i])&&(l=(r<3?a(l):r>3?a(t,n,l):a(t,n))||l);return r>3&&l&&Object.defineProperty(t,n,l),l};class c extends o.Command{async execute(){const e=(await n.Configuration.find(this.context.cwd,this.context.plugins)).get("postinstall");await l(e)}}i([o.Command.Path("postinstall")],c.prototype,"execute",null);const s={configuration:a,commands:[c],hooks:{afterAllInstalled:async e=>{const t=e.configuration.get("postinstall");await l(t)}}};plugin=t})();
return plugin;
}
};
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
postinstall: yarn generate:abis

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-postinstall.cjs
spec: "https://raw.githubusercontent.com/gravitywelluk/yarn-plugin-postinstall/master/bundles/%40yarnpkg/plugin-postinstall.js"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ShapeShift's OSS 2nd generation Web application. (Under Development)

## Dependencies
- [hdwallet](https://github.com/shapeshift/hdwallet)
- [lib](https://github.com/shapeshift/lib)
- [unchained](https://github.com/shapeshift/unchained)
- [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) (optional; must be installed manually)

Expand All @@ -60,10 +59,16 @@ If you are using Linux and macOS it works out of the box following these steps:
3. Install Dependencies:

```sh
# This is short for `yarn install`; be sure to use `yarn install --frozen-lockfile` instead if you're setting up a CI pipeline or trying to duplicate a historical build.
# This is short for `yarn install`; be sure to use `yarn install --immutable` instead if you're setting up a CI pipeline or trying to duplicate a historical build.
yarn
```

3. Build Packages:

```sh
yarn build
```

4. Run `yarn env dev` to generate a `.env` file

> ⚠️ On Windows, _[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)_ (WSL) is required but **WE DO NOT SUPPORT THIS ENVIRONMENT, SO USE IT AT YOUR OWN RISK**.
Expand Down Expand Up @@ -118,7 +123,7 @@ yarn test:cypress:headless
To build the app for production in the `/build` folder at the root level of the project:

```sh
yarn build
yarn build:web
```

> It correctly bundles React in production mode and optimizes the build for the best performance.
Expand All @@ -129,25 +134,6 @@ yarn build
>
> See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### Linking

If you're developing locally in this `web` repository, and need to make changes affecting packages in `lib`
or `unchained` (backend), use the following steps to link packages locally for developing.
If your changes only touch `web` these steps are unnecessary.

**Initial, one-off setup:**

1. Clone the `lib` repo, `cd` into it, and run `yarn build`
1. From `lib`, run `yarn link`
1. Clone `unchained`, `cd` into it, and run `yarn build`
1. From `unchained`, `cd packages/client` and `yarn link`, then do the same from `packages/parser`

**When working in `web`, and using local changes in `lib` or `unchained`:**

1. Run `yarn link-packages` in `web` to use local versions of `lib` and `unchained` - now your `web`'s chain-adapters have a symlink to your `lib`'s.
1. `yarn show-linked-packages` will show what's currently linked
1. Once you're done developing locally, run `yarn unlink-packages` to use published upstream versions

## Developer Onboarding

1. Create a pull request on GitHub. (You can do this at `https://github.com/<username>/<fork name>/pull/new/<branch name>`.)
Expand Down
6 changes: 6 additions & 0 deletions __mocks__/@yfi/sdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const sdk = jest.createMockFromModule('@yfi/sdk')

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const Yearn = jest.fn().mockImplementation(() => ({ ...(sdk as any).Yearn }))

export { Yearn }
Loading

0 comments on commit 1e3429b

Please sign in to comment.