Skip to content

Commit

Permalink
Merge pull request #3 from KomodoPlatform/master
Browse files Browse the repository at this point in the history
  • Loading branch information
gcharang authored Jan 19, 2023
2 parents bed0085 + e4e544c commit 8792c5a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Custom
wasm_versions/
coins_versions/
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
## Pre-requisites

- NodejsV16 or newer. Recommendation: use `nvm`: https://www.freecodecamp.org/news/node-version-manager-nvm-install-guide/
- `yarn`. once node and npm are installed, `npm install -g yarn`

## Build steps


- `yarn` -> the first time
- `yarn dev` -> starts a server at http://localhost:1234/
- `npm ci` -> the first time
- `npm run dev` -> starts a server at http://localhost:1234/

## Misc notes

To change the mm2 being used, replace the file: `public/mm2_bg.wasm` with it
To change the mm2 bin being used, replace the file: `public/mm2_bg.wasm` with it

To keep multiple versions of mm2 bins in the public folder and test them one by one, make sure all of them have different names, then replace the name `mm2_bg.wasm` at https://github.com/gcharang/react-atomicdex-wasm/blob/master/src/App.jsx#L30

To keep multiple versions of mm2 bin in the public folder and test them one by one, make sure all of them have different names, then replace the name `mm2_bg.wasm` at https://github.com/gcharang/react-atomicdex-wasm/blob/master/src/App.jsx#L30
Might want to restart the dev server and hard refresh(shift + f5) the browser window when mm2 being used is changed in code or replaced with same name in the file system

might want to re start the dev server when mm2 being used is changed in code or replaced with same name in file system
Best to open/reopen the url: http://localhost:1234/ in a private/incognito window when testing code/mm2 changes, to be completely sure that cached mm2 bins/other code aren't interfering

best to open the url: http://localhost:1234/ in a private/incognito window when testing code/mm2 changes, to be completely sure that cached mm2 bins/other code aren't interfering
To update the API version using a url to a zipfile, use `./update_wasm.sh $zipfile_url`

To update the `coins` file version using a url to a raw github data, use `./update_coins.sh https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins`
5 changes: 5 additions & 0 deletions update_coins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[ ! -d coins_versions ] && mkdir coins_versions
cd coins_versions
commit=$(echo $1 | grep / | cut -d/ -f6)
[ ! -f coins_${commit} ] && wget $1 && mv coins coins_${commit}
cp coins_${commit} ../public/coins
12 changes: 12 additions & 0 deletions update_wasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[ ! -d wasm_versions ] && mkdir wasm_versions
cd wasm_versions
fn=${1##*/}
[ ! -f $fn ] && wget $1
mkdir temp
unzip $fn -d temp
cd temp
mv mm2lib_bg.wasm ../../public/mm2_bg.wasm
mv mm2lib.js ../../src/js/mm2.js
cp -r snippets/* ../../src/js/snippets/
cd ..
rm -rf temp

0 comments on commit 8792c5a

Please sign in to comment.