开源软件名称(OpenSource Name):Emurgo/yoroi-mobile开源软件地址(OpenSource Url):https://github.com/Emurgo/yoroi-mobile开源编程语言(OpenSource Language):TypeScript 95.6%开源软件介绍(OpenSource Introduction):Download
Looking for the Yoroi Extension? See here DevelopmentInstallation MacCommon instalation IOS/Android
iOS preparation
Additional configuration for MacOS Big Sur usersMacOS Big Sur changed the default path of the system C linker, which breaks Android Preparation
Existing users of Homebrew may encounter Error: Cask adoptopenjdk8 exists in multiple taps due to prior workarounds with different instructions. This can be solved by fully specifying the location with:
Optional
Installation Windows + WSL2 Ubuntu / UbuntuNOTE The Windows + WSL2 Ubuntu is used in the instruction for building project for android devices. Android preparation
NOTE. For windows users only.
It is necessary to activate WSL2 and install the Ubuntu distribution on it. How to do that, please read hereWSL2 Ubuntu preparation
sudo apt-get update
sudo apt-get install build-essential git curl wget unzip socat -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install 1.41.0
rustup install 1.41.0
rustup target add wasm32-unknown-unknown --toolchain 1.41.0
rustup default 1.41.0
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo apt-get install python
wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
cd ~
mkdir -p Android/Sdk
unzip commandlinetools-linux-6200805_latest.zip -d Android/Sdk
export ANDROID_HOME=$HOME/Android/Sdk
export PATH="$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"
# Make sure emulator path comes before tools. Had trouble on Ubuntu with emulator from /tools being loaded instead of the one from /emulator
# Further lines are only necessary if you use Windows + WSL2 Ubuntu
export WSL_HOST_IP="$(tail -1 /etc/resolv.conf | cut -d' ' -f2)"
export ADB_SERVER_SOCKET=tcp:$WSL_HOST_IP:5037
sdkmanager --sdk_root=${ANDROID_HOME} "tools"
sdkmanager --update
sdkmanager --list
sdkmanager "build-tools;28.0.3" "platform-tools" "platforms;android-28" "tools"
sdkmanager --licenses
sdkmanager --install "ndk;20.0.5594570"
sudo apt install gradle -y Windows preparation
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk"
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk\emulator"
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk\platform-tools"
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk\tools"
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk\tools\bin"
setx /m PATH "C:\Users\<YOUR_USER>\AppData\Local\Android\Sdk\tools\lib\x86_64\swt.jar"
Connecting a device, Windows + WSL2 Ubuntu (Physical or virtual device)This requires a physical Android phone & USB cable, the Android Studio should be installed on Windows On Windows
iex "netsh interface portproxy delete v4tov4 listenport=8081 listenaddress=127.0.0.1" | out-null;
$WSL_CLIENT = bash.exe -c "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'";
$WSL_CLIENT -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
$WSL_CLIENT = $matches[0];
iex "netsh interface portproxy add v4tov4 listenport=8081 listenaddress=127.0.0.1 connectport=8081 connectaddress=$WSL_CLIENT"
adb kill-server
adb -a -P 5037 nodaemon server If you want to use an emulator emulator -avd <image_name> On WSL2 Ubuntu
socat -d -d TCP-LISTEN:5037,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5037
yarn start First timeMake sure the rust targets for the platform you will work on (android/iOS) have been correctly installed with
cd ~ && mkdir Emurgo && cd Emurgo
git clone https://github.com/Emurgo/yoroi-mobile.git
cd yoroi-mobile
If these steps fail, try looking at the android CLI Launching
TestingUnit TestingTo run all unit tests: $ yarn test You can also run single test files, e.g.: $ jest wallet.test.js End-to-end TestingFor E2E testing we use the detox framework. Requirements
Setup (applies to iOS only)You only need to follow the instructions listed in the Step 1 of Detox's official docs: $ brew tap wix/brew
$ brew install applesimutils
$ npm install -g detox-cli Building and RunningImportant: You need to build the app not only the first time you run the tests but also anytime you modify the code. $ yarn e2e:build-android # for ios just replace "android" by "ios"
$ yarn e2e:test-android This will build and test a release version of the app. DebuggingRead through this page to understand debugging for React-Native React-Native DebuggerThis will allow you to put breakpoints and everything else you would ever need.
Releasing
Important: You may run into
TroubleshootingChecking that Rust is well setup (iOS & Android)After following the instructions for iOS and Android -- it is not required to install both,
Binaryen submodule problemsIf you have been facing the problem failed to fetch submodule `binaryen` from git@github.com:WebAssembly/binaryen.git These steps should help you.
eval `ssh-agent -s`
ssh-add ~/.ssh/<your_private_key> If the error still persists.Add the
ping github.com -c 1
ssh-keyscan <github.com ip-address> The output will be something like that 140.82.121.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
140.82.121.3 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
140.82.121.3 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
Code styleImportsThe imports should be in this order:
Example: // external libraries
import React from 'react'
import {compose} from 'redux'
import {connect} from 'react-redux'
import {View} from 'react-native'
// our code
import Screen from '../../components/Screen'
import AdaIcon from '../../assets/AdaIcon'
import {confirmationsToAssuranceLevel, printAda} from '../../helpers/utils'
// types
import type {TransactionType} from '../../types/HistoryTransaction' Styles
// src/components/UiKit/index.js
// Example of export for a default component that can be imported from UI.
export {default as Button} from './Button' import {Text, Button, Input} from '../UiKit'
// ... Variablesimport {colors} from './config'
// Wrong
// The background color can change, gray is constant name for specific color.
background: colors.GRAY
// ...
// Good
// Changing the background color doesn't require to change the name.
// We want to change values, not labels most of time.
background: colors.background
// ... |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论