Skip to content

Commit

Permalink
feat: balances again (#92)
Browse files Browse the repository at this point in the history
* ci: add wip to the list of allowed commit types

* wip: better balances

* wip: better balances

* wip: better balances

* refactor: moved core/domains/tokens/rpc/OrmlTokens -> core/domains/balances/rpc/OrmlTokenBalances

* fix: failing tests

* fix: another failing test

* fix: can't run extension tests without first building monorepo deps

* fix: grouped amounts

* ci: added devcontainer spec

* chore: added support for DISABLE_BUNDLE_ANALYZER env var

* wip: better balances

* chore: add changesets library to manage release of packages

* chore: changeset for balances and chains packages

* chore: update yarn and turbo configs to build packages for publish

* chore: add changelog for every package

* wip: partially configured webpack process for building packacges

* fix: use latest git in devcontainer

* wip: removed webpack for packages (to be revisited later)

* added prepack script, author, homepage and (no) license to packages

* fix: eslint config publishing to user instead of npm org

* fix: packages trying to publish with access private

* ci: bump package versions

* fix: alias vim to code in devcontainer

* ci: watch app dependencies in development

* feat: implemented @talismn/balances-substrate-native

* ci: bump package versions

* fix: switched non-react packages from esm to commonjs for ecosystem (node) compatibility

* ci: bump package versions

* fix: migrated orml token code into substrate orml module

* ci: bump package versions

* fix: wrong chaindata-provider-extension chaindata-squid url

* ci: bump package versions

* fix: orml token performance

* ci: bump package versions

* fix: orml tokens always 0

* ci: bump package versions

* chore: added yarn-plugin-workspace-tools and added publish instructions to readme

* fix: token logo urls

* fix: useBalances creating too many subscriptions when called from multiple components

* ci: bump package versions

* fix: evm native tokens

* ci: bump package versions

* fix: access property of undefined error

* ci: bump package versions

* fix: evm erc20 tokens

* ci: bump package versions

* feat: implemented token fiat rates in @talismn/balances

* ci: bump package versions

* fix: missing/unnecessary/broken deps in @talismn/balances libs

* fix: only attempt to fetch each token using its respective balance module

* fix: missing token rates and empty token rates requests

* feat: fetch evm erc20 symbol and decimals from contract

* ci: bump package versions

* fix: dont fetch ethereum account balances in substrate-native module

* ci: bump package versions

* feat: added coingeckoId to evm module configs

* ci: bump package versions

* fix: improved error handling for failing balance subscriptions

* ci: bump package versions

* fix: get token logo urls from chaindata-provider

* ci: bump package versions

* fix: use @talismn/chaindata-provider and @talismn/balances in apps/extension

* fix: prettier plugins conflict

* fix: call to db.chains instead of chaindataProvider.getChain

* fix: removed @core/domains/chains/api mocks

* fix: don't add id to base eth signing requests

* fix: removed mystery line from evm-erc20 module

* chore: removed unused import

* fix: removed unnecessary @substrate deps from frontend bundles

* ci: removed DISABLE_BUNDLE_ANALYZER env var

* fix: added mock chaindata provider

* fix: improved AccountInfo handling for substrate-native tokens

* ci: bump package versions

* ci: don't publish talisman-ui to npm

* chore: remove .devcontainer before we merge it into dev

Co-authored-by: Chid Gilovitz <[email protected]>
  • Loading branch information
alecdwm and chidg authored Dec 7, 2022
1 parent 25214d8 commit 2414da1
Show file tree
Hide file tree
Showing 503 changed files with 33,988 additions and 7,671 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [
["@talismn/balances", "@talismn/balances-*"],
["@talismn/chain-connector", "@talismn/chaindata-*"]
],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
root: true,
// default config (common + react)
extends: ["eslint-config-talisman/react"],
extends: ["@talismn/eslint-config/react"],
}
28 changes: 28 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
/* eslint-disable */

// Because both of these prettier plugins hijack the typescript parser,
// we can only use one of them at a time!
//
// If we try to use both, the second will overwrite the first.
//
// What follows is a workaround stolen from:
// https://github.com/tailwindlabs/prettier-plugin-tailwindcss/issues/31#issuecomment-1203264916

const pluginImportSort = require("prettier-plugin-import-sort")
const pluginTailwindcss = require("prettier-plugin-tailwindcss")

/** @type {import("prettier").Parser} */
const myParser = {
...pluginImportSort.parsers.typescript,
parse: pluginTailwindcss.parsers.typescript.parse,
}

/** @type {import("prettier").Plugin} */
const myPlugin = {
parsers: {
typescript: myParser,
},
}

module.exports = {
plugins: [myPlugin],

printWidth: 100,
quoteProps: "consistent",
semi: false,
Expand Down
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ 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"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ This README was written and verified with:
### Apps and Packages

- `apps/extension`: the Talisman browser extension (non-custodial wallet)
- `packages/eslint-config-talisman`: shared `eslint` configurations
- `packages/eslint-config`: shared `eslint` configurations
- `packages/tsconfig`: shared `tsconfig.json`s used throughout the monorepo
- `packages/talisman-utils`: library containing shared non-react code. It is not meant to be npm published.
- `packages/util`: library containing shared non-react code. It is not meant to be npm published.

All our package and apps are 100% [TypeScript](https://www.typescriptlang.org/).

Expand Down Expand Up @@ -60,3 +60,27 @@ All our package and apps are 100% [TypeScript](https://www.typescriptlang.org/).
rm -rf dist && DOCKER_BUILDKIT=1 docker build --output type=local,dest=./dist .

```

### Update packages

```bash
# Make changes, and then run:
yarn changeset
# Select the packages which have been modified and write a commit message


# Later on, after merging some created changesets:
yarn changeset version
# Commit the changed files and then go to the next step, `Publish packages`.


```

### Publish packages

```bash
yarn plugin import workspace-tools

yarn npm login
yarn workspaces foreach --no-private npm publish --tolerate-republish
```
164 changes: 164 additions & 0 deletions apps/balances-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# balances-demo

## 0.1.12

### Patch Changes

- Updated dependencies [ca50757]
- @talismn/balances@0.1.12
- @talismn/balances-react@0.1.12
- @talismn/balances-evm-erc20@0.1.12
- @talismn/balances-evm-native@0.1.12
- @talismn/balances-example@0.1.12
- @talismn/balances-substrate-native@0.1.12
- @talismn/balances-substrate-orml@0.1.12
- @talismn/chaindata-provider-extension@0.1.6

## 0.1.11

### Patch Changes

- Updated dependencies [9cefc14]
- @talismn/balances-evm-erc20@0.1.11
- @talismn/balances-react@0.1.11
- @talismn/balances@0.1.11
- @talismn/balances-evm-native@0.1.11
- @talismn/balances-example@0.1.11
- @talismn/balances-substrate-native@0.1.11
- @talismn/balances-substrate-orml@0.1.11

## 0.1.10

### Patch Changes

- Updated dependencies [850a4d0]
- @talismn/balances@0.1.10
- @talismn/balances-evm-native@0.1.10
- @talismn/balances-evm-erc20@0.1.10
- @talismn/balances-example@0.1.10
- @talismn/balances-react@0.1.10
- @talismn/balances-substrate-native@0.1.10
- @talismn/balances-substrate-orml@0.1.10

## 0.1.9

### Patch Changes

- Updated dependencies [d66c5bc]
- @talismn/balances@0.1.9
- @talismn/balances-evm-native@0.1.9
- @talismn/balances-example@0.1.9
- @talismn/balances-react@0.1.9
- @talismn/balances-substrate-native@0.1.9
- @talismn/balances-substrate-orml@0.1.9
- @talismn/balances-evm-erc20@0.1.9
- @talismn/chaindata-provider-extension@0.1.5

## 0.1.8

### Patch Changes

- Updated dependencies [cbd4770]
- Updated dependencies [3db774a]
- @talismn/balances-substrate-native@0.1.8
- @talismn/balances-substrate-orml@0.1.8
- @talismn/balances@0.1.8
- @talismn/balances-react@0.1.8
- @talismn/balances-evm-erc20@0.1.8
- @talismn/balances-evm-native@0.1.8
- @talismn/balances-example@0.1.8

## 0.1.7

### Patch Changes

- Updated dependencies [1582220]
- @talismn/balances-substrate-native@0.1.7
- @talismn/balances-substrate-orml@0.1.7
- @talismn/balances-react@0.1.7
- @talismn/balances@0.1.7
- @talismn/balances-evm-erc20@0.1.7
- @talismn/balances-evm-native@0.1.7
- @talismn/balances-example@0.1.7

## 0.1.6

### Patch Changes

- Updated dependencies [b0cec1a]
- @talismn/balances-substrate-native@0.1.6
- @talismn/balances-substrate-orml@0.1.6
- @talismn/balances-react@0.1.6
- @talismn/balances@0.1.6
- @talismn/balances-evm-erc20@0.1.6
- @talismn/balances-evm-native@0.1.6
- @talismn/balances-example@0.1.6

## 0.1.5

### Patch Changes

- Updated dependencies [2338966]
- @talismn/chaindata-provider-extension@0.1.4
- @talismn/balances-react@0.1.5
- @talismn/balances@0.1.5
- @talismn/balances-evm-erc20@0.1.5
- @talismn/balances-evm-native@0.1.5
- @talismn/balances-example@0.1.5
- @talismn/balances-substrate-native@0.1.5
- @talismn/balances-substrate-orml@0.1.5

## 0.1.4

### Patch Changes

- Updated dependencies [d5f69f7]
- @talismn/balances@0.1.4
- @talismn/balances-example@0.1.4
- @talismn/balances-substrate-native@0.1.4
- @talismn/balances-substrate-orml@0.1.4
- @talismn/chaindata-provider-extension@0.1.3
- @talismn/balances-evm-erc20@0.1.4
- @talismn/balances-evm-native@0.1.4
- @talismn/balances-react@0.1.4

## 0.1.3

### Patch Changes

- Updated dependencies [5af305c]
- @talismn/balances@0.1.3
- @talismn/balances-evm-erc20@0.1.3
- @talismn/balances-evm-native@0.1.3
- @talismn/balances-example@0.1.3
- @talismn/balances-substrate-native@0.1.3
- @talismn/balances-substrate-orml@0.1.3
- @talismn/chaindata-provider-extension@0.1.2
- @talismn/balances-react@0.1.3

## 0.1.2

### Patch Changes

- Updated dependencies [2ccd51b]
- @talismn/balances@0.1.2
- @talismn/balances-example@0.1.2
- @talismn/balances-substrate-native@0.1.2
- @talismn/balances-evm-erc20@0.1.2
- @talismn/balances-evm-native@0.1.2
- @talismn/balances-react@0.1.2
- @talismn/balances-substrate-orml@0.1.2

## 0.1.1

### Patch Changes

- Updated dependencies [43c1a3a]
- @talismn/balances@0.1.0
- @talismn/balances-evm-erc20@0.1.0
- @talismn/balances-evm-native@0.1.0
- @talismn/balances-example@0.1.0
- @talismn/balances-react@0.1.0
- @talismn/balances-substrate-native@0.1.0
- @talismn/balances-substrate-orml@0.1.0
- @talismn/chaindata-provider-extension@0.1.0
46 changes: 46 additions & 0 deletions apps/balances-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
72 changes: 72 additions & 0 deletions apps/balances-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "balances-demo",
"version": "0.1.12",
"private": true,
"dependencies": {
"@polkadot/api": "^9.1.1",
"@polkadot/extension-dapp": "^0.44.3",
"@talismn/balances": "workspace:^",
"@talismn/balances-evm-erc20": "workspace:^",
"@talismn/balances-evm-native": "workspace:^",
"@talismn/balances-example": "workspace:^",
"@talismn/balances-react": "workspace:^",
"@talismn/balances-substrate-native": "workspace:^",
"@talismn/balances-substrate-orml": "workspace:^",
"@talismn/chaindata-provider-extension": "workspace:^",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"anylogger": "^1.0.11",
"anylogger-loglevel": "^1.0.0",
"loglevel": "^1.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.4.2",
"web-vitals": "^2.1.0"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.18.10",
"@testing-library/dom": "^8.16.1",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0"
},
"scripts": {
"dev": "react-scripts start --port 3001",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"root": true,
"extends": [
"@talismn/eslint-config"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version"
]
}
}
Binary file added apps/balances-demo/public/favicon.ico
Binary file not shown.
Loading

0 comments on commit 2414da1

Please sign in to comment.