LedgerHQ / ledger-live-common

⛔️ DEPRECATED - Common ground for the Ledger Wallet apps
http://ledger-live-tools.now.sh
Apache License 2.0
136 stars 171 forks source link

Speculos mobile bot test on iOS only #1931

Open henri-ly opened 2 years ago

henri-ly commented 2 years ago

This introduce the ability to run the "Bot" in the React Native mobile tech stack.

There's 3 parts on this PR to take care : bot-speculos-proxy, bot-proxy-log and bot-react-native

bot-speculos-proxy

This part give the ability to speculos to be used as a service and can be host on an external server. It was created because speculos as we used it today, was only possible with node and docker.

You have to ran it with the CLI : so to install it you will need to

yarn install
yalc publish
cd cli
yalc add @ledgerhq/live-common
yarn install

Usage:

SEED="<YOURSEEDHERE>" COINAPPS="<COINAPPSFOLDERHERE>" node ./bin/index.js botSpeculosProxy -p 4377 -t tokentorestrictusage

as -t is a token that you will need to provide on the env BOT_SPECULOS_PROXY_TOKEN when you run the mobile app.

bot-proxy-log

Is will store all the log of the bot into a proxy logger. Same install as above.

Usage:

BOT_LOG_PROXY_FILE: ../botreport/logs.txt node ./bin/index botLogProxy -p 8331

bot-react-native

This part is an react-native project with just ledger-live-common installed and all the minimal dependency he needs to make it run.

When you launch the app, it will try to run on theses settings from the .env:

SPECULOS_SERVICE_WS="ws://localhost8435"
SPECULOS_SERVICE_HTTP="http://localhost:4377"
BOT_LOG_SERVICE="ws://localhost:8331"
BOT_SPECULOS_PROXY_TOKEN=tokentorestrictusage

So you will need to set an .env before running the project.

install:

yarn install
yalc publish
cd bot-react-native
yalc add @ledgerhq/live-common
yarn install

for iOS:

cd ios
pod install
cd ..
yarn run ios

for android:

yarn run android

for the CI we are using Detox to make it ran, it's seems to work fine on iOS, we still have some issues with Android.

What left to do : [] Try to export the Speculos As A Service on a Vercel, and used it as an API (have to see if it's doable first) [] Make Android test work on CI [] Make iOS work again on CI

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ledger-live-common ❌ Failed (Inspect) May 5, 2022 at 0:12AM (UTC)