Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
chore: merge develop into main
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdef1cafe committed Sep 20, 2021
2 parents dbbd2bb + 92a23ff commit b0e5a6a
Show file tree
Hide file tree
Showing 53 changed files with 70,961 additions and 2,730 deletions.
7 changes: 2 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ jobs:
git config --global -l
git config --global user.name "CircleCI"
- run:
name: Bump version
command: npx lerna version patch --yes -m "[skip ci]"
- run:
name: 'Publish Packages'
command: npx lerna publish from-package --yes
name: Cut Release
command: npx lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo

workflows:
version: 2
Expand Down
19 changes: 15 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@
"process": "readonly"
},
"rules": {
"jsx-a11y/alt-text": "warn",
"jsx-a11y/no-autofocus": "warn",
"jsx-a11y/alt-text": "error",
"jsx-a11y/no-autofocus": "error",
"prettier/prettier": "error",
"default-case": "off",
"no-console": "warn",
"no-console": [
"error",
{
"allow": [
"warn",
"error",
"info",
"group",
"groupEnd"
]
}
],
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
Expand All @@ -47,4 +58,4 @@
}
}
]
}
}
33 changes: 33 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: commitlint/lint/test/build

on:
pull_request:
branches:
- main
- develop

jobs:
commitlint-lint-test-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Commit lint
uses: wagoid/commitlint-github-action@v4
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn install --frozen-lockfile
- name: Type check
run: yarn type-check
- name: Lint
run: yarn lint
- name: Test
run: yarn test
- name: Build
run: yarn build
24 changes: 24 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": "develop",
"repositoryUrl": "https://github.com/shapeshift/lib",
"debug": "true",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Contributing Guidelines

### Conventional Commits

We use Conventional Commits for our commit messages. This allows automated tools like semantic-release to generate changelogs, bump versions according to semver, and release and publish the latest code. Please see https://www.conventionalcommits.org/en/v1.0.0/ for more information.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ yarn test:dev

**Helpful Testing Process**

One technique that can helpful when writing tests, is to reference the coverage report for the file/function/feature you're testing. To do this, run `yarn test:dev` from your terminal. This will generate a coverage report for the project. The `coverage` directory will be located in the root directory. There is an `index.html` which shows the coverage report per file.
One technique that can helpful when writing tests, is to reference the coverage report for the file/function/feature you're testing. To do this, run `yarn test:dev` from your terminal. This will generate a coverage report for the project in the `coverage` directory. To view the report, open the file `coverage/lcov-report/index.html`.

## Contributing

Please see the [Contributing Guidlines](CONTRIBUTING.md) document for this repo's specific contributing guidelines.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']}
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lib",
"version": "0.1.0",
"version": "1.0.0",
"private": true,
"workspaces": {
"packages": [
Expand All @@ -9,17 +9,22 @@
"version": "independent"
},
"scripts": {
"build": "lerna run build --include-dependencies",
"dev": "lerna run dev --stream --parallel",
"lint": "eslint --cache .",
"test": "jest",
"test:dev": "jest --watch",
"build": "lerna run build --include-dependencies",
"dev": "lerna run dev --stream --parallel",
"type-check": "lerna run type-check",
"publish:lerna": "lerna publish from-package --no-private --yes",
"version:patch": "lerna version patch --yes --no-git-tag-version --no-push",
"version:minor": "lerna version minor --yes --no-git-tag-version --no-push",
"version:major": "lerna version major --yes --no-git-tag-version --no-push",
"publish:lerna": "lerna publish from-package --no-private --yes"
"version:major": "lerna version major --yes --no-git-tag-version --no-push"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
Expand All @@ -34,6 +39,8 @@
"jest-mock-extended": "^1.0.9",
"lerna": "^4.0.0",
"prettier": "1.19.1",
"semantic-release": "^17.4.7",
"semantic-release-monorepo": "^7.0.5",
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"typescript": "^4.2.4"
Expand Down
1 change: 0 additions & 1 deletion packages/asset-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ It does not provide asset market data \(price, volume, etc\) or wallet balance i

1. Run `yarn generate` to build the `generatedAssetData.json` used by the the service to provide asset data.
2. Commit and push changes to `generatedAssetData.json` to github
3. Use assetService to lookup assets as needed \(not yet built\)

3 changes: 2 additions & 1 deletion packages/asset-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"generate": "node ./dist/generateAssetData/GenerateAssetData.js",
"dev": "tsc --watch",
"clean": "rm -rf dist",
"test": "jest test"
"test": "jest test",
"type-check": "tsc --project ./tsconfig.json --noEmit"
},
"dependencies": {
"lodash": "^4.17.21"
Expand Down
50 changes: 40 additions & 10 deletions packages/asset-service/src/generateAssetData/baseAssets.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { BaseAsset, ContractTypes, NetworkTypes } from '../types'
import { BaseAsset, ContractTypes, NetworkTypes, ChainTypes } from '../types'

export const baseAssets: Array<BaseAsset> = [
{
chain: 'ETH',
network: NetworkTypes.ETH_MAINNET,
chain: ChainTypes.Ethereum,
network: NetworkTypes.MAINNET,
symbol: 'ETH',
displayName: 'Ethereum',
name: 'Ethereum',
precision: 18,
slip44: 60,
color: '#FFFFFF',
Expand All @@ -17,10 +17,10 @@ export const baseAssets: Array<BaseAsset> = [
receiveSupport: true
},
{
chain: 'BTC',
network: NetworkTypes.BTC_MAINNET,
chain: ChainTypes.Bitcoin,
network: NetworkTypes.MAINNET,
symbol: 'BTC',
displayName: 'Bitcoin',
name: 'Bitcoin',
precision: 8,
slip44: 0,
color: '#FFFFFF',
Expand All @@ -32,10 +32,40 @@ export const baseAssets: Array<BaseAsset> = [
receiveSupport: false
},
{
chain: 'ETH',
chain: ChainTypes.Bitcoin,
network: NetworkTypes.TESTNET,
symbol: 'BTC',
name: 'Bitcoin',
precision: 8,
slip44: 1,
color: '#FFFFFF',
secondaryColor: '#FFFFFF',
icon: 'https://assets.coincap.io/assets/icons/[email protected]',
explorer: 'https://live.blockcypher.com/btc-testnet/',
explorerTxLink: 'https://live.blockcypher.com/btc-testnet/tx/',
sendSupport: false,
receiveSupport: false
},
{
chain: ChainTypes.Litecoin,
network: NetworkTypes.MAINNET,
symbol: 'LTC',
name: 'Litecoin',
precision: 8,
slip44: 2,
color: '#FFFFFF',
secondaryColor: '#FFFFFF',
icon: 'https://assets.coincap.io/assets/icons/[email protected]',
explorer: 'https://live.blockcypher.com',
explorerTxLink: 'https://live.blockcypher.com/ltc/tx/',
sendSupport: false,
receiveSupport: false
},
{
chain: ChainTypes.Ethereum,
network: NetworkTypes.ETH_ROPSTEN,
symbol: 'ETH',
displayName: 'Ropsten Testnet Ethereum',
name: 'Ropsten Testnet Ethereum',
precision: 18,
slip44: 1,
color: '#FFFFFF',
Expand All @@ -47,7 +77,7 @@ export const baseAssets: Array<BaseAsset> = [
receiveSupport: false,
tokens: [
{
displayName: 'Test Token',
name: 'Test Token',
precision: 18,
tokenId: '0x1da00b6fc705f2ce4c25d7e7add25a3cc045e54a',
contractType: ContractTypes.ERC20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import lodash from 'lodash'
import { tokensToOverride } from './overrides'

type CoingeckoTokenData = {
chainId: number
address: string
name: string
symbol: string
Expand All @@ -26,7 +25,7 @@ export async function getTokens(): Promise<TokenAsset[]> {
if (overrideToken) return overrideToken

return {
displayName: token.name,
name: token.name,
precision: token.decimals,
tokenId: token.address.toLowerCase(),
contractType: ContractTypes.ERC20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TokenAsset, ContractTypes } from '../../types'
export const tokensToOverride: Array<TokenAsset> = [
// example overriding FOX token with custom values instead of goingecko
{
displayName: 'Fox',
name: 'Fox',
precision: 18,
tokenId: '0xc770eefad204b5180df6a14ee197d99d808ee52d',
contractType: ContractTypes.ERC20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import fs from 'fs'
import { baseAssets } from './baseAssets'
import { getTokens } from './ethTokens'
import { BaseAsset, NetworkTypes } from '../types'
import { ChainTypes } from '..'

const generateAssetData = async () => {
const generatedAssetData = await Promise.all(
baseAssets.map(async (baseAsset) => {
if (baseAsset.chain === 'ETH' && baseAsset.network === NetworkTypes.ETH_MAINNET) {
if (baseAsset.chain === ChainTypes.Ethereum && baseAsset.network === NetworkTypes.MAINNET) {
const ethTokens = await getTokens()
const baseAssetWithTokens: BaseAsset = { ...baseAsset, tokens: ethTokens }
return baseAssetWithTokens
Expand All @@ -23,5 +24,5 @@ const generateAssetData = async () => {
}

generateAssetData().then(() => {
console.log('done')
console.info('done')
})
Loading

0 comments on commit b0e5a6a

Please sign in to comment.