Skip to content

Commit

Permalink
Merge pull request #503 from tari-project/jason-lib-update-0-16-0
Browse files Browse the repository at this point in the history
Lib wallet update
  • Loading branch information
Jasonvdb committed Jul 23, 2020
2 parents cf219b3 + 4adfdc4 commit 0f9b6e1
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 12 deletions.
8 changes: 4 additions & 4 deletions MobileWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2645,7 +2645,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWalletNotificationService/MobileWalletNotificationService.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 108;
CURRENT_PROJECT_VERSION = 114;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -2682,7 +2682,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWalletNotificationService/MobileWalletNotificationService.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 108;
CURRENT_PROJECT_VERSION = 114;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -2838,7 +2838,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWallet/Tari.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 108;
CURRENT_PROJECT_VERSION = 114;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -2874,7 +2874,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWallet/Tari.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 108;
CURRENT_PROJECT_VERSION = 114;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
2 changes: 1 addition & 1 deletion MobileWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>108</string>
<string>114</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
1 change: 1 addition & 0 deletions MobileWallet/TariLib/Wrappers/Wallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class Wallet {
wallet_create(
commsConfig.pointer,
loggingFilePathPointer,
nil, //TODO use passphrase when ready to implement
receivedTransactionCallback,
receivedTransactionReplyCallback,
receivedFinalizedTransactionCallback,
Expand Down
43 changes: 42 additions & 1 deletion MobileWallet/TariLib/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,42 @@ void comms_config_destroy(struct TariCommsConfig *wc);

/// -------------------------------- TariWallet ----------------------------------------------- //

// Creates a TariWallet
/// Creates a TariWallet
/// ## Arguments
/// `config` - The TariCommsConfig pointer
/// `log_path` - An optional file path to the file where the logs will be written. If no log is required pass *null*
/// pointer.
/// `passphrase` - An optional string that represents the passphrase used to encrypt/decrypt the databases for this
/// wallet. If it is left Null no encryption is used. If the databases have been encrypted then the correct passphrase
/// is required or this function will fail.
/// `callback_received_transaction` - The callback function pointer matching the
/// function signature. This will be called when an inbound transaction is received.
/// `callback_received_transaction_reply` - The callback function pointer matching the function signature. This will be
/// called when a reply is received for a pending outbound transaction
/// `callback_received_finalized_transaction` - The callback function pointer matching the function signature. This will
/// be called when a Finalized version on an Inbound transaction is received
/// `callback_transaction_broadcast` - The callback function pointer matching the function signature. This will be
/// called when a Finalized transaction is detected a Broadcast to a base node mempool.
/// `callback_transaction_mined` - The callback function pointer matching the function signature. This will be called
/// when a Broadcast transaction is detected as mined.
/// `callback_discovery_process_complete` - The callback function pointer matching the function signature. This will be
/// called when a `send_transacion(..)` call is made to a peer whose address is not known and a discovery process must
/// be conducted. The outcome of the discovery process is relayed via this callback
/// `callback_base_node_sync_complete` - The callback function pointer matching the function signature. This is called
/// when a Base Node Sync process is completed or times out. The request_key is used to identify which request this
/// callback references and a result of true means it was successful and false that the process timed out and new one
/// will be started
/// `error_out` - Pointer to an int which will be modified
/// to an error code should one occur, may not be null. Functions as an out parameter.
/// ## Returns
/// `*mut TariWallet` - Returns a pointer to a TariWallet, note that it returns ptr::null_mut()
/// if config is null, a wallet error was encountered or if the runtime could not be created
///
/// # Safety
/// The ```wallet_destroy``` method must be called when finished with a TariWallet to prevent a memory leak
struct TariWallet *wallet_create(struct TariWalletConfig *config,
const char *log_path,
const char *passphrase,
void (*callback_received_transaction)(struct TariPendingInboundTransaction*),
void (*callback_received_transaction_reply)(struct TariCompletedTransaction*),
void (*callback_received_finalized_transaction)(struct TariCompletedTransaction*),
Expand Down Expand Up @@ -464,6 +497,14 @@ unsigned long long wallet_coin_split(struct TariWallet *wallet, unsigned long lo
/// Get the seed words representing the seed private key of the provided TariWallet
struct TariSeedWords *wallet_get_seed_words(struct TariWallet *wallet, int* error_out);

// Apply encryption to the databases used in this wallet using the provided passphrase. If the databases are already
// encrypted this function will fail.
void wallet_apply_encryption(struct TariWallet *wallet, const char *passphrase, int* error_out);

// Remove encryption to the databases used in this wallet. If this wallet is currently encrypted this encryption will
// be removed. If it is not encrypted then this function will still succeed to make the operation idempotent
void wallet_remove_encryption(struct TariWallet *wallet, int* error_out);

// Frees memory for a TariWallet
void wallet_destroy(struct TariWallet *wallet);

Expand Down
2 changes: 1 addition & 1 deletion MobileWalletNotificationService/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>108</string>
<string>114</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion MobileWalletTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>108</string>
<string>114</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion MobileWalletUISnapshots/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>108</string>
<string>114</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion MobileWalletUITests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>108</string>
<string>114</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion dependencies.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FFI_VERSION="0.15.2"
FFI_VERSION="0.16.0"
3 changes: 2 additions & 1 deletion update_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ else
fi

# curl -s "https://www.tari.com/binaries/$FFI_FILE" | tar xz - -C MobileWallet/TariLib/ --exclude wallet.h
curl -s "https://tari-binaries.s3.amazonaws.com/libwallet/$FFI_FILE" | tar xz - --exclude wallet.h
curl -s "https://tari-binaries.s3.amazonaws.com/libwallet/$FFI_FILE" | tar xz
mv "libwallet-ios-$FFI_VERSION/libtari_wallet_ffi.a" MobileWallet/TariLib/
mv "libwallet-ios-$FFI_VERSION/wallet.h" MobileWallet/TariLib/

# Check for cocoapods and install if missing.
if hash pod 2>/dev/null; then
Expand Down

0 comments on commit 0f9b6e1

Please sign in to comment.