Skip to content

Commit

Permalink
Merge pull request #1069 from novasamatech/rc/1.1.0-127
Browse files Browse the repository at this point in the history
Release candidate - 1.1.0
  • Loading branch information
stepanLav authored Sep 18, 2023
2 parents 305114f + a551f41 commit 3a830c6
Show file tree
Hide file tree
Showing 808 changed files with 14,231 additions and 13,112 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
node: true,
jest: true,
},
globals: {
JSX: 'readonly',
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
CSC_FOR_PULL_REQUEST: true
CI: true
BUILD_SOURCE: 'github'

jobs:
release-build:
Expand Down Expand Up @@ -92,7 +93,7 @@ jobs:
filename="${original%.*}"
new="$filename"_x86_64.AppImage
mv "$original" "$new"
- name: Replace space by "-"
run: |
for file in *; do
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_chains_file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: ➡️ Make pull request
uses: ./.github/workflows/make-pull-request
with:
commit_path: src/renderer/services/network/common/*.json
commit_path: src/renderer/assets/chains/*.json
commit_message: "ci: chains.json file"
pr_title: "Update chains.json file"
branch_name: update-chains-file
Expand Down
4 changes: 3 additions & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Nova Spektr - Polkadot, Kusama enterprise application

Copyright 2023 Novasama Technologies PTE. LTD.
Copyright 2022-2023 Novasama Technologies PTE. LTD.
This product includes software developed at Novasama Technologies PTE. LTD.
License Rights transferred from Novasama Technologies PTE. LTD to Novasama Technologies GmbH starting from 1st of April 2023
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The `production` run configuration is the same as [production build](#production
installed in the operating system and source code hot-reload will be used.

Production configuration uses:
1. [`chains.json`](/src/renderer/services/network/common/chains/chains.json) file for chains configuration
1. [`chains.json`](/src/renderer/assets/chains/chains.json) file for chains configuration
2. debug tools are disabled by default
3. errors are handled in a smooth way in order not to interrupt the user

Expand All @@ -97,7 +97,7 @@ The `dev` run configuration **shouldn't be** used for production. This configura
debugging errors.

Development configuration uses:
1. [`chains_dev.json`](/src/renderer/services/network/common/chains/chains_dev.json) file that contains testnets in order to debug and test new features
1. [`chains_dev.json`](/src/renderer/assets/chains/chains_dev.json) file that contains testnets in order to debug and test new features
2. debug tools are enabled by default
3. error handling is turned off in order to pay developer's attention to errors

Expand Down Expand Up @@ -172,3 +172,7 @@ All issues are being tracked in the [Nova Spektr Support project](https://github
# Feedback
Your feedback is welcome. Use GitHub issues for submitting the feedback.
All feedback is being tracked in the [Nova Spektr Feedback project](https://github.com/orgs/novasamatech/projects/5)

## License
Nova Spektr - Polkadot, Kusama enterprise application is available under the Apache 2.0 license. See the LICENSE file for more info.
© Novasama Technologies GmbH 2023
4 changes: 2 additions & 2 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ exports.APP_CONFIG = {
ENTRY_POINTS: {
MAIN: 'src/main/index.ts',
BRIDGE: 'src/shared/bridge.ts',
RENDERER: 'src/renderer/index.tsx',
RENDERER: 'src/renderer/app/index.tsx',
},

INDEX_HTML: 'src/renderer/index.html',
INDEX_HTML: 'src/renderer/app/index.html',
RESOURCES: 'src/main/resources',
DEV_BUILD: 'release/build/',
PROD_BUILD: 'release/dist/',
Expand Down
48 changes: 48 additions & 0 deletions docs/effector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Effector

### Sample with type guard
Sometimes you need to filter `effector` result and pass it further into `target`, but TypeScript warns you that
types do not align: `error: clock should extend target type`.

To fix this you need to provide a `type guard` as `filter` return value.

Let's say `getConfigFx` returns `XcmConfig | null` and `calculateFinalConfigFx` accepts only `XcmConfig`.
To make it work we do the following:

```typescript
const getConfigFx = createEffect((config: XcmConfig): XcmConfig | null => {
// some actions
});

const calculateFinalConfigFx = createEffect((config: XcmConfig): string => {
// some actions
});

sample({
clock: getConfigFx.doneData,
filter: (config: XcmConfig | null): config is XcmConfig => Boolean(config),
target: calculateFinalConfigFx,
});
```

### AppStarted event
Because `effetor` is a pure JS library, it's units could be used in any part of the app.
So in order to emit some important event like `appStarted` we can do the following:
```typescript
// index.tsx - app's entrypoint

const container = document.getElementById('app');
if (!container) {
throw new Error('Root container is missing in index.html');
}

kernelModel.events.appStarted();

createRoot(container).render(
<Router>
<App />
</Router>
);
```

[Documentation](https://effector.dev/docs/typescript/typing-effector/#filter--fn)
55 changes: 55 additions & 0 deletions docs/fiat-price.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Fiat price

Now fiat price feature consists of `PriceAdapter` type. Each adapter should implement two functions 1. to return price for selected crypto assets with selected currencies (fiat or crypto) and 2. return history data for selected asset, currency and time range.

```typescript
getPrice: (ids: AssetId[], currencies: Currency[], includeRateChange: boolean) => Promise<PriceObject>;
getHistoryData: (id: AssetId, currency: Currency, from: number, to: number) => Promise<PriceRange[]>;
```

And we have two util functions, which can convert `PriceObject` format to `PriceDB` format.

`PriceObject` is based on coingecko format.
`PriceDB` is based on IndexedDB storage object.

```typescript
type PriceObject = Record<AssetId, AssetPrice>;
type AssetPrice = Record<Currency, PriceItem>;
type PriceItem = {
price: number;
change: number;
};
```

example

```typescript
const priceObject = {
polkadot: {
usd: {
price: 4.1
change: -0.1
}
}
}
```

```typescript
type PriceDB = {
assetId: AssetId;
currency: Currency;
price: number;
change: number;
};
```

example

```typescript
const priceArray = [{
assetId: 'polkadot',
currency: 'usd',
price: 4.1,
change: -0.1
}]
```
4 changes: 3 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const config: Config = {
'^.+\\.(t|j)sx?$': ['@swc/jest', swcConfig],
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|json)$)': '<rootDir>/scripts/fileTransform.js',
},
// help @swc/jest to transform node_modules esm packages (swiper.js I look at you)
transformIgnorePatterns: [],
testRegex: ['^.*\\.(test|spec)\\.[jt]sx?$'],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'^raptorq$': '<rootDir>/node_modules/raptorq/raptorq.js',
Expand All @@ -47,6 +47,8 @@ const config: Config = {
'^@renderer(.*)$': '<rootDir>/src/renderer/$1',
'^@images(.*)$': '<rootDir>/src/renderer/assets/images/$1',
'^@video(.*)$': '<rootDir>/src/renderer/assets/video/$1',
'^dexie$': '<rootDir>/node_modules/dexie/dist/dexie.js',
'^lottie': 'lottie-react',
},
modulePathIgnorePatterns: ['<rootDir>/tests'],
collectCoverageFrom: [
Expand Down
49 changes: 27 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nova-spektr",
"description": "Polkadot Enterprise application",
"version": "1.0.5",
"version": "1.1.0",
"main": "./release/build/main.js",
"license": "MIT",
"author": {
Expand All @@ -10,20 +10,16 @@
"scripts": {
"start": "pnpm clean:build && concurrently \"pnpm start:renderer\" \"pnpm start:main\" && watch",
"start:dev": "pnpm clean:build && concurrently \"pnpm start:renderer:dev\" \"pnpm start:main:dev\" && watch",

"start:electron": "electron .",

"start:renderer": "cross-env NODE_ENV=staging CHAINS_FILE=chains pnpm webpack:renderer:stage",
"start:renderer:dev": "cross-env NODE_ENV=development CHAINS_FILE=chains-dev pnpm webpack:renderer:dev",

"start:main": "cross-env NODE_ENV=staging pnpm r webpack:main:stage start:electron",
"start:main:dev": "cross-env NODE_ENV=development pnpm r webpack:main:dev start:electron",
"watch": "nodemon --watch src/main --watch src/renderer/bridge --watch src/shared --ignore src/main/resources --ext \"*\" --exec",

"webpack:renderer:dev": "webpack serve --config webpack/webpack.renderer.dev.ts",
"webpack:renderer:stage": "webpack serve --config webpack/webpack.renderer.stage.ts",
"webpack:renderer:prod": "webpack --config webpack/webpack.renderer.prod.ts",

"webpack:main:dev": "webpack --config webpack/webpack.main.dev.ts",
"webpack:main:stage": "webpack --config webpack/webpack.main.stage.ts",
"webpack:main:prod": "webpack --config webpack/webpack.main.prod.ts",
Expand All @@ -33,22 +29,26 @@
"dist": "electron-builder -p never",
"clean:build": "rimraf release/build",
"clean:prod": "rimraf release/dist",

"test": "jest --config=jest.config.ts --json --outputFile=jest-unit-results.json",
"test:integration": "jest --config=tests/integrations/jest.config.ts --group=integration --json --outputFile=jest-results.json",
"test:dataVerification": "jest --config=tests/integrations/jest.config.ts --group=dataVerification --json --outputFile=jest-results.json",
"test:matrix": "jest --config=tests/integrations/jest.config.ts --group=matrix --json --outputFile=jest-results.json",
"test:coverage": "jest --config=jest.config.ts --coverage --passWithNoTests | tee ./coverage.txt",
"test:coverage-new-files": "jest --config=jest.config.ts --coverage --changedSince=dev | tee ./coverage.txt",

"lint": "eslint . --ext=js,ts,tsx,json",
"lint:fix": "pnpm lint --fix",
"lint:i18n-locale": "cross-env I18N=true eslint ./src/shared/locale/ --ext=json --plugin i18n-json",
"lint:i18n-fix": "cross-env I18N=true pnpm lint:i18n-locale --fix",
"lint:i18n-tsx": "cross-env I18N=true eslint . --ext=tsx --ignore-pattern=**/*.test.* --ignore-pattern=**/*.stories.* --plugin i18next",

"storybook": "start-storybook -p 6006",
"build:storybook": "build-storybook",

"update:chains-file": "node scripts/buildChainsJson.js",
"githook:pre-commit": "cross-env NODE_ENV=production lint-staged && tsc -p tsconfig.json",
"githook:pre-push": "cross-env pnpm test:coverage",
"storybook": "start-storybook -p 6006",
"build:storybook": "build-storybook",
"prepare": "husky install",
"r": "pnpm run-s"
},
Expand All @@ -58,7 +58,7 @@
},
"dependencies": {
"@apollo/client": "^3.7.1",
"@headlessui/react": "^1.6.5",
"@headlessui/react": "^1.7.17",
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.12.tgz",
"@polkadot/api": "^10.7.1",
"@polkadot/keyring": "^12.2.1",
Expand All @@ -68,8 +68,8 @@
"@polkadot/util": "^12.2.1",
"@polkadot/util-crypto": "^12.2.1",
"@substrate/connect": "^0.7.26",
"@substrate/txwrapper-orml": "^6.0.0",
"@substrate/txwrapper-polkadot": "^6.0.0",
"@substrate/txwrapper-orml": "^7.0.1",
"@substrate/txwrapper-polkadot": "^7.0.1",
"@zxing/browser": "^0.1.3",
"@zxing/library": "^0.20.0",
"bignumber.js": "^9.0.2",
Expand All @@ -78,15 +78,20 @@
"classnames": "^2.3.1",
"crypto-browserify": "^3.12.0",
"date-fns": "^2.29.3",
"dexie": "^3.2.2",
"dexie-react-hooks": "^1.1.1",
"dexie": "^3.2.4",
"dexie-react-hooks": "^1.1.6",
"effector": "^22.8.6",
"effector-forms": "^1.3.4",
"effector-react": "^22.5.3",
"electron-log": "5.0.0-beta.23",
"electron-updater": "^6.1.1",
"electron-window-state": "^5.0.3",
"graphql": "^16.6.0",
"i18next": "^21.8.13",
"lodash": "^4.17.21",
"lottie-react": "^2.4.0",
"parity-scale-codec": "^0.6.1",
"patronum": "^1.19.1",
"qrcode-generator": "^1.4.4",
"raptorq": "^1.7.22",
"react": "^18.2.0",
Expand Down Expand Up @@ -118,10 +123,10 @@
"@storybook/manager-webpack5": "^6.5.9",
"@storybook/react": "^6.5.9",
"@svgr/webpack": "^6.2.1",
"@swc/cli": "^0.1.57",
"@swc/core": "^1.3.21",
"@swc/helpers": "^0.5.0",
"@swc/jest": "^0.2.23",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.80",
"@swc/helpers": "^0.5.1",
"@swc/jest": "^0.2.29",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
Expand Down Expand Up @@ -150,7 +155,7 @@
"electron-devtools-installer": "^3.2.0",
"electron-react-devtools": "^0.5.3",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^8.10.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-i18n-json": "^4.0.0",
"eslint-plugin-i18next": "6.0.0-2",
Expand All @@ -177,7 +182,7 @@
"pnpm": "^8.6.11",
"postcss": "^8.4.18",
"postcss-loader": "^7.0.1",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"react-refresh": "^0.14.0",
"regenerator-runtime": "^0.13.9",
Expand All @@ -191,10 +196,10 @@
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.9.3",
"webpack": "^5.80.0",
"webpack-cli": "^5.0.0",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-merge": "^5.9.0",
"whatwg-fetch": "^3.6.2"
}
}
Loading

0 comments on commit 3a830c6

Please sign in to comment.