From 7dd91b9abe6b5fd70e715d0358cf80e60d025bb5 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 17 Jan 2023 12:44:22 +0800 Subject: [PATCH 1/7] add update wasm script and related note in readme --- README.md | 1 + update_wasm.sh | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100755 update_wasm.sh diff --git a/README.md b/README.md index 115c8ef..ca186cf 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,4 @@ might want to re start the dev server when mm2 being used is changed in code or 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` \ No newline at end of file diff --git a/update_wasm.sh b/update_wasm.sh new file mode 100755 index 0000000..8eca3d6 --- /dev/null +++ b/update_wasm.sh @@ -0,0 +1,8 @@ +mkdir temp && cd temp +wget $1 +unzip ${1##*/} +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 \ No newline at end of file From e5ef6558b93e3be66a71a52a09877a7f8499349f Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 17 Jan 2023 13:06:26 +0800 Subject: [PATCH 2/7] reuse zipfiles if already present --- update_wasm.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/update_wasm.sh b/update_wasm.sh index 8eca3d6..1d6c8ec 100755 --- a/update_wasm.sh +++ b/update_wasm.sh @@ -1,8 +1,12 @@ -mkdir temp && cd temp -wget $1 -unzip ${1##*/} -mv mm2lib_bg.wasm ../public/mm2_bg.wasm -mv mm2lib.js ../src/js/mm2.js -cp -r snippets/* ../src/js/snippets/ +[ ! -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 \ No newline at end of file +rm -rf temp From 5c79083781799ea6ec7b51b376c7d2d8c1f1f179 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:53:47 +0530 Subject: [PATCH 3/7] adds wasm_versions to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a547bf3..537c363 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ dist-ssr *.njsproj *.sln *.sw? + +# Custom +wasm_versions \ No newline at end of file From 964640ff85604c02576951a38f3a2c357e258661 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:56:42 +0530 Subject: [PATCH 4/7] update readme to use npm --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ca186cf..9e80936 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,20 @@ ## 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 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 +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 -might want to re start the dev server when mm2 being used is changed in code or replaced with same name in file system +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 -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 +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 -To update the API version using a url to a zipfile, use `./update_wasm.sh $zipfile_url` \ No newline at end of file +To update the API version using a url to a zipfile, use `./update_wasm.sh $zipfile_url` From 4773aed3e6f4552a9e119802583ff7f188b80772 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 17 Jan 2023 13:31:28 +0800 Subject: [PATCH 5/7] add coin update script --- .gitignore | 3 ++- update_coins.sh | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 update_coins.sh diff --git a/.gitignore b/.gitignore index 537c363..bcfa9c5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ dist-ssr *.sw? # Custom -wasm_versions \ No newline at end of file +wasm_versions/ +coins_versions/ \ No newline at end of file diff --git a/update_coins.sh b/update_coins.sh new file mode 100755 index 0000000..5bbf888 --- /dev/null +++ b/update_coins.sh @@ -0,0 +1,5 @@ +[ ! -d coins_versions ] && mkdir coins_versions +cd coins_versions +commit=$(echo $1 | grep / | cut -d/ -f6-| grep / | cut -d/ -f1) +[ ! -f coins_${commit} ] && wget $1 && mv coins coins_${commit} +cp coins_${commit} ../public/coins From e3880078695112690f6adc11ddd63b02e8f461b4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 17 Jan 2023 13:33:17 +0800 Subject: [PATCH 6/7] tweak coin update script --- update_coins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_coins.sh b/update_coins.sh index 5bbf888..beba59c 100755 --- a/update_coins.sh +++ b/update_coins.sh @@ -1,5 +1,5 @@ [ ! -d coins_versions ] && mkdir coins_versions cd coins_versions -commit=$(echo $1 | grep / | cut -d/ -f6-| grep / | cut -d/ -f1) +commit=$(echo $1 | grep / | cut -d/ -f6) [ ! -f coins_${commit} ] && wget $1 && mv coins coins_${commit} cp coins_${commit} ../public/coins From 58d928306e36061bf57f25d565da43c1f995431f Mon Sep 17 00:00:00 2001 From: smk762 Date: Tue, 17 Jan 2023 13:35:20 +0800 Subject: [PATCH 7/7] add coin update script note to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9e80936..3d2ee9e 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,5 @@ Might want to restart the dev server and hard refresh(shift + f5) the browser wi 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 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` \ No newline at end of file