The web repo is React application that also must consist two submodules — core and storybook.
To start using it from developer side you should:
- Clone the repo:
git clone https://gitlab.com/crypto_project/frontend/web.git
, or do it by ssh. 1.1. Confirm that your nodejs version matches the version in .nvmrc file inside this repo. If it doesn't match, install the nodejs version that matches .nvmrc - Install dependencies:
yarn
(use yarn only, not npm!) - Install submodules:
yarn submodule
- Build project with developer environment:
yarn dev:fast
There is also one major moment of using submodules — you can't commit push your changes directly using submodule token from another repository (e.g. web repo). (You can try to do it and you would see the next error after you will try to push: remote: You are not allowed to upload code. fatal: unable to access 'https://gitlab+deploy-token-57725:[email protected]/crypto_project/frontend/core.git/': The requested URL returned error: 403 master )
There are two separate ways to do that:
- Add another remote for each of two web repo submodules: core and storybook.
- Clone submodules (core and storybook) to the same directory in your filesystem and use them with scripts in web repo:
fetch-local-core
andfetch-local-storybook
.
The first way steps:
- Open terminal and go to web repo directory.
- Type:
cd src/core
. (you should move to the core submodule inside web repo) - Type:
git remote add coreOrigin [email protected]:crypto_project/frontend/core.git
These steps should create another remote and you should use coreOrigin
remote when you want to push changes to core
submodule inside web repo.
The final command would look like: git push coreOrigin <branchname>
, where <branchname>
- is the name of the branch that you want to push to the remote branch.
For the storybook repo you should do the same steps as for core repo.
The second way steps:
- Go to the directory that consist(!) web repo.
In our example, it would be
crypto
directory, e.g....\users\work\crypto\web\
Your terminal should be opened incrypto
directory. - Clone 2 repos: core & storybook into the
crypto
directory. As the result your crypto directory should have this structure:
- crypto
- web
- core
- storybook
- Then you should open these two repos ( core & storybook ) in your favorite IDE in separate projects (or open the crypto directory as only one project, it's up to you)
- You can these two repos ( core & storybook ) as common repos. You also will be able to push inside these two repos as usual.
When you want to see the changes in these repos that affect to the web repo, you should use next commands:
fetch-local-core
for core andfetch-local-storybook
for storybook inside web repo. These commands will copy files from core or storybook directories insidecrypto
directory (!), and paste them tosrc
folder inside web repo.
Notes:
-
If somehow happened, that the staging api (api develop branch) would not work, and your work depends on working backend, you should change few line of code to switch to the production api (api master branch). In this case, you should open file in core repo (@core/utils/config), and change 4th line from this "const addDevelopToURL = (URL: string) =>
develop.${URL}
" to this "const addDevelopToURL = (URL: string) =>${URL}
". In that case, you will use prod api after you rebuild the web project. You may also clear thedist
folder in your project before rebuild to make sure that cached js code will not affect on this action. -
Please note that "@project-serum/serum": "0.13.25", "@solana/web3.js": "0.90.0" should be same in web, api and xpull_exchanges coz if one of this packages version will change version it can produce issues with number of markets.
use build:bundleanalyzer:without:submodule
Requirements:
- node 8+
- pkg-config, pixman, cairo, pangocairo
- any other packages that you be ask for (@todo)
Usage: yarn token-icons-sprite-generate
The command accepts no params and does the following:
-
Collect token names
1.1. from the aldrin pools
1.2. from aldrin-registry markets
1.3. from custom local folder
-
Download an icons (except those in 1.3)
2.1. Iterate over the token names and trying to find those in spl-token-registry
2.2. Download for those found
-
Compressing
we resize each image to fit 64px square
-
Creating the sprite
we make it with spritesmith library powered by canvassmith so let's leave it the blackbox as long as it works well
-
Converting to webp
-
Make a json-descriptor file we store the following data there:
- link to .webp image
- token name/address
- the dimensions of each image (token)
- coordinates in sprite (x/y)
-
Moving it to the target folder once we good we move our output to the target
TokenIcon
component's folderthat components know already how to operate with the image/json
TODO:
- make it on CI but not manually (like we have it now)
- provide some more requirements
Swap logic separated to another gitlab repository. For using it we need to specify url for scoped package in .npmrc with deploy token, that have read_package_registry permission, so we'll have access to package registry of this repo.
- Website: https://aldrin.com
- API: https://api.cryptocurrencies.ai/playground
- Website: ???
- API: https://develop.api.cryptocurrencies.ai/playground
You can configure the app through environment variables. All parameters are optional and not needed to run app.
Variable | Description | Value example |
---|---|---|
RPC_PROVIDERS_ADDRESSES | Title | [{ url: 'https://frontend-solana-api-1.aldrin.com', weight: 20 }] |