Skip to content

Latest commit

 

History

History
137 lines (97 loc) · 5.39 KB

File metadata and controls

137 lines (97 loc) · 5.39 KB

iOS setup required for OST React Native SDK

1. Installing Carthage

Get Carthage by running following command on terminal

 brew install carthage

You can also choose other methods to install Carthage

2. Downloading OST React Native SDK using Carthage

Carthage looks at a file called Cartfile to determine which libraries to install. Create a file in the ./ios directory of your react-native project called Cartfile and enter the following to tell Carthage which dependencies we want:

Add following entry in your Cartfile

 github "ostdotcom/ost-wallet-sdk-ios" == 2.3.5

Now to actually install everything run the following in your terminal:

 carthage update --platform iOS

A Cartfile.resolved file and a Carthage directory will appear in the same directory where your .xcodeproj or .xcworkspace is.

3. Copying the OstWalletSdk.framework file in your Xcode project

Open your project in Xcode, click on the project file in the left section of the screen and scroll down to the Linked Frameworks and Libraries section in Xcode.

Carthage folder will have the .framework files that we will add in Xcode project.

Now open the ./ios/Carthage/Build/iOS folder in Finder:

Run this command

open ios/Carthage/Build/iOS

Open application target, under General tab, drag the built OstWalletSdk.framework binary from ./ios/Carthage/Build/iOS folder into Linked Frameworks and Libraries section.

copy-framework-file

4. Adding the OstWalletSdk dependencies in your Xcode project

We need to add the .framework files of dependencies present inside ./ios/Carthage/Build/iOS.

Open application targets in Xcode. Under Build Phases click + icon and choose New Run Script Phase. Add the following command.

/usr/local/bin/carthage copy-frameworks

Click the + under Input Files and add the following entry framework:

$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
$(SRCROOT)/Carthage/Build/iOS/BigInt.framework
$(SRCROOT)/Carthage/Build/iOS/CryptoEthereumSwift.framework
$(SRCROOT)/Carthage/Build/iOS/CryptoSwift.framework
$(SRCROOT)/Carthage/Build/iOS/EthereumKit.framework
$(SRCROOT)/Carthage/Build/iOS/FMDB.framework
$(SRCROOT)/Carthage/Build/iOS/SipHash.framework
$(SRCROOT)/Carthage/Build/iOS/TrustKit.framework
$(SRCROOT)/Carthage/Build/iOS/OstWalletSdk.framework

copy-framework-file

5. Add additional SDK files

Follow these steps to add additional files:

  • Click on your project, select File > Add Files to "<Your Project>"

  • Browse to ./node_modules/@ostdotcom/ost-wallet-sdk-react-native/ios

  • Add the folder ostwalletrnsdk with following settings:

    • Destination: (uncheck) Copy items if needed
    • Added folders: (select) Create groups

Add-image

6. Change Build Settings

Open application target, under Build Settings tab, enable Always Embed Swift Standard Libraries under Build Options

Add image

7. Create SDK configuration file

Create OstWalletSdk.plist file. This file has configuration attributes used by OstWalletSdk. You should copy paste the configuration values from below snippet.

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
    <key>BlockGenerationTime</key>
    <integer>3</integer>
    <key>PricePointTokenSymbol</key>
    <string>OST</string>
    <key>PricePointCurrencySymbol</key>
    <string>USD</string>
    <key>RequestTimeoutDuration</key>
    <integer>30</integer>
    <key>PinMaxRetryCount</key>
    <integer>3</integer>
    <key>SessionBufferTime</key>
    <integer>3600</integer>
    <key>UseSeedPassword</key>
	<false/>
    <key>EnableIOSDeviceRestore</key>
	<false/>
 </dict>
 </plist>
  1. BlockGenerationTime: The time in seconds it takes to mine a block on auxiliary chain.
  2. PricePointTokenSymbol: This is the symbol of base currency. So its value will be OST.
  3. PricePointCurrencySymbol: It is the symbol of quote currency used in price conversion.
  4. RequestTimeoutDuration: Request timeout in seconds for https calls made by ostWalletSdk.
  5. PinMaxRetryCount: Maximum retry count to get the wallet Pin from user.
  6. SessionBufferTime: Buffer expiration time for session keys in seconds. Default value is 3600 seconds.
  7. UseSeedPassword: The seed password is salt to PBKDF2 used to generate seed from the mnemonic. When UseSeedPassword set to true, different deterministic salts are used for different keys.
  8. EnableIOSDeviceRestore: When EnableIOSDeviceRestore is set to true, After app re-installation, SDK checks for available device key in Keychain for given user id.

These configurations are MANDATORY for successful operation. Failing to set them will significantly impact usage.

Next Steps

  1. SDK Usage
  2. SDK Methods
  3. SDK Callbacks