1. Installing Carthage
Get Carthage by running following command on terminal
brew install carthage
You can also choose other methods to install 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.
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.
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
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
Open application target, under Build Settings
tab, enable Always Embed Swift Standard Libraries
under Build Options
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>
- BlockGenerationTime: The time in seconds it takes to mine a block on auxiliary chain.
- PricePointTokenSymbol: This is the symbol of base currency. So its value will be OST.
- PricePointCurrencySymbol: It is the symbol of quote currency used in price conversion.
- RequestTimeoutDuration: Request timeout in seconds for https calls made by ostWalletSdk.
- PinMaxRetryCount: Maximum retry count to get the wallet Pin from user.
- SessionBufferTime: Buffer expiration time for session keys in seconds. Default value is 3600 seconds.
- 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. - 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.