Add a stack for running uniswap frontend on urbit #670

Merged
nikugogoi merged 25 commits from ng-uniswap-frontend into main 2023-12-04 13:09:20 +00:00
3 changed files with 73 additions and 34 deletions
Showing only changes of commit c2be02a06b - Show all commits

View File

@ -22,9 +22,7 @@ services:
command: ["./deploy-to-urbit.sh"]
volumes:
- app_builds:/app-builds
- urbit_data:/urbit
- ../config/uniswap-interface/deploy-to-urbit.sh:/app/deploy-to-urbit.sh
volumes:
app_builds:
urbit_data:

View File

@ -4,7 +4,7 @@ services:
urbit-fake-ship:
restart: unless-stopped
image: tloncorp/vere
entrypoint: ["bash", "-c", "./run-urbit-ship.sh && deploy-uniswap-app.sh"]
entrypoint: ["bash", "-c", "./run-urbit-ship.sh && ./deploy-uniswap-app.sh"]
volumes:
- urbit_data:/urbit
- app_builds:/app-builds

View File

@ -5,8 +5,15 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
uniswap_app_build='/app-builds/uniswap/build'
uniswap_desk_dir='/urbit/zod/uniswap'
if [ -d ${uniswap_desk_dir} ]; then
echo "Uniswap desk dir already exists, exiting"
exit 0
fi
# Fire curl requests to perform operations on the ship
dojo () {
curl -s --data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' http://localhost:12321
}
@ -15,46 +22,80 @@ hood () {
curl -s --data '{"source":{"dojo":"+hood/'"$1"'"},"sink":{"app":"hood"}}' http://localhost:12321
}
# Fire curl requests to create/mount a uniswap desk
curl -s --data '{"source":{"dojo":"+hood/merge %uniswap our %landscape"},"sink":{"app":"hood"}}' http://localhost:12321
# Create/mount a uniswap desk
hood "merge %uniswap our %landscape"
hood "mount %uniswap"
tail -f /dev/null
# Loop until the uniswap build appears
while [ ! -d ${uniswap_app_build} ]; do
echo "Uniswap app build not found, retrying in 5s..."
sleep 5
done
echo "Build found..."
# Wait for uniswap build to appear
# Copy over build to desk data dir
cp -r ${uniswap_app_build} ${uniswap_desk_dir}
# cat << EOF > file.txt
# ::
# :::: /hoon/map/mar
# :: Mark for js source maps
# /? 310
# ::
# =, eyre
# |_ mud=@
# ++ grow
# |%
# ++ mime [/application/octet-stream (as-octs:mimes:html (@t mud))]
# --
# ++ grab
# |% :: convert from
# ++ mime |=([p=mite q=octs] (@t q.q))
# ++ noun cord :: clam from %noun
# --
# ++ grad %mime
# --
# EOF
# Create a mark file for .map file type
cat << EOF > "${uniswap_desk_dir}/mar/map.hoon"
::
:::: /hoon/map/mar
:: Mark for js source maps
/? 310
::
=, eyre
|_ mud=@
++ grow
|%
++ mime [/application/octet-stream (as-octs:mimes:html (@t mud))]
--
++ grab
|% :: convert from
++ mime |=([p=mite q=octs] (@t q.q))
++ noun cord :: clam from %noun
--
++ grad %mime
--
EOF
# cp ~/zod/uniswap/mar/woff2.hoon ~/zod/uniswap/mar/woff.hoon and edit the only line that has woff2 to woff
# cp ~/zod/uniswap/mar/woff2.hoon ~/zod/uniswap/mar/ttf.hoon and edit woff2 to ttf
# Create a mark file for .woff file type
cat << EOF > "${uniswap_desk_dir}/mar/woff.hoon"
|_ dat=octs
++ grow
|%
++ mime [/font/woff dat]
--
++ grab
|%
++ mime |=([=mite =octs] octs)
++ noun octs
--
++ grad %mime
--
EOF
# rm ~/zod/uniswap/desk.bill
# rm ~/zod/uniswap/desk.ship
# Create a mark file for .ttf file type
cat << EOF > "${uniswap_desk_dir}/mar/ttf.hoon"
|_ dat=octs
++ grow
|%
++ mime [/font/ttf dat]
--
++ grab
|%
++ mime |=([=mite =octs] octs)
++ noun octs
--
++ grad %mime
--
EOF
# |commit %uniswap
rm "${uniswap_desk_dir}/desk.bill"
rm "${uniswap_desk_dir}/desk.ship"
# -landscape!make-glob %uniswap /build
# Commit changes and create a glob
hood "commit %uniswap"
dojo "-landscape!make-glob %uniswap /build"
# Curl and wait for the glob to be hosted