Skip to content

Latest commit

 

History

History
79 lines (58 loc) · 4.04 KB

BUILDING.md

File metadata and controls

79 lines (58 loc) · 4.04 KB

Building the Pera Wallet Apps

Some modifications are needed to build the application from this repo. This document explains all the steps needed to build and run the application in a simulator.

Common Steps

  1. Clone this repo: Clone or download this repo to your computer.

  2. Obtain network access: The apps need access to instances of Algod and Indexer to run. The official app supports MainNet and TestNet; however, any network can be used if you supply your node. For a private network, the quickest way to get started is using the Algorand sandbox. This page from the Algorand developer docs contains more options. Regardless of how you obtain access to instances of Algod and Indexer, you will need their addresses and API keys to continue.

  3. Create a Firebase project: Since both applications use Firebase, you will need to create your own Firebase project for them to run. See the Firebase docs for further instructions.

After these steps are complete, you can move on to specific steps for iOS.

iOS Steps

Note: These steps must be run on a MacOS machine.

  1. Install dependencies: First, install Cocoapods if you do not already have it. See https://guides.cocoapods.org/using/getting-started.html for more information. Once you have Cocoapods installed, navigate to the ios folder and run the following command to install build dependencies:
pod install
  1. Open in Xcode: you may now open the ios/algorand.xcworkspace files in Xcode.

  2. Download the iOS Firebase config file: The Firebase config file for iOS is called GoogleService-Info.plist. See this link for how to obtain the config file: https://support.google.com/firebase/answer/7015592. Once you've downloaded it, place it in the location ios/Support/GoogleService-Info.plist.

  3. Specify network access tokens: To specify the Algod and Indexer settings; create the file ios/Support/Config.xcconfig. This file needs to define two values, ALGOD_TOKEN and INDEXER_TOKEN, which are the API tokens for Algod and Indexer respectively. For example, this is how to create a config file from the command line where the Algod token is aaa and the Indexer token is bbb:

echo "ALGOD_TOKEN = aaa\nINDEXER_TOKEN = bbb" > ios/Support/Config.xcconfig
  1. Specify network addresses: You will need to change the default addresses for Algod and Indexer in the file ios/Classes/Core/Environment/Environment.swift. The variables to change are testNetAlgodApi, testNetIndexerApi, mainNetAlgodApi, and mainNetIndexerApi. For example, if your Algod address is http://localhost:4001 and your Indexer address is http://localhost:8980, the following changes need to be made for the MainNet variables (the TestNet variables can be similarly changed):
-    lazy var mainNetAlgodHost = "node-mainnet.aws.algodev.network"
-    lazy var mainNetIndexerHost = "indexer-mainnet.aws.algodev.network"
-    lazy var mainNetAlgodApi = "\(schema)://\(mainNetAlgodHost)"
-    lazy var mainNetIndexerApi = "\(schema)://\(mainNetIndexerHost)"
+    lazy var mainNetAlgodHost = "localhost:4001"
+    lazy var mainNetIndexerHost = "localhost:8980"
+    lazy var mainNetAlgodApi = "http://\(mainNetAlgodHost)"
+    lazy var mainNetIndexerApi = "http://\(mainNetIndexerHost)"

Note: it's ok to use a localhost address in the simulator, but that address will not work if you deploy to an actual device.

  1. Build the app: Once all the above steps are complete, you are ready to build and deploy the iOS app in Xcode.

Note: it's ok to use a localhost address in the simulator, but that address will not work if you deploy to an actual device.

  1. Build the app: Once all the above steps are complete, you are ready to build and deploy the iOS app.