Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions MobileWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
00BBD801237C5B5200EBF5E6 /* CommandLineArgs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BBD800237C5B5200EBF5E6 /* CommandLineArgs.swift */; };
00BBD809237D80C800EBF5E6 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BBD808237D80C800EBF5E6 /* Date.swift */; };
00BBD80E237DA07400EBF5E6 /* ByteVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BBD80D237DA07400EBF5E6 /* ByteVector.swift */; };
00BBD81A237EB31900EBF5E6 /* CommsConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BBD819237EB31900EBF5E6 /* CommsConfig.swift */; };
00BBD81A237EB31900EBF5E6 /* WalletDbConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00BBD819237EB31900EBF5E6 /* WalletDbConfig.swift */; };
00DC2E22238554FD00036DDC /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 00DC2E21238554FD00036DDC /* libsqlite3.tbd */; };
00DD160B241CCE0600C955B4 /* TariSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00DD160A241CCE0600C955B4 /* TariSettings.swift */; };
00DD160F241CD41D00C955B4 /* BaseNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00DD160E241CD41D00C955B4 /* BaseNode.swift */; };
Expand Down Expand Up @@ -169,7 +169,6 @@
3A8473C228EC556C0015E63A /* CoreTariService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473C128EC556C0015E63A /* CoreTariService.swift */; };
3A8473C428EC55B10015E63A /* TariTransactionsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473C328EC55B10015E63A /* TariTransactionsService.swift */; };
3A8473CA28EC56180015E63A /* TariFeesService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473C928EC56180015E63A /* TariFeesService.swift */; };
3A8473CC28EC562E0015E63A /* TariConnectionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473CB28EC562E0015E63A /* TariConnectionService.swift */; };
3A8473CE28EC56480015E63A /* TariUTXOsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473CD28EC56480015E63A /* TariUTXOsService.swift */; };
3A8473D028EC56600015E63A /* TariRecoveryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473CF28EC56600015E63A /* TariRecoveryService.swift */; };
3A8473D228EC568A0015E63A /* TariMessageSignService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8473D128EC568A0015E63A /* TariMessageSignService.swift */; };
Expand Down Expand Up @@ -368,7 +367,6 @@
54AC12922BCD1C1E0007FFEA /* StringBaseNodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54AC12912BCD1C1E0007FFEA /* StringBaseNodeTests.swift */; };
54AD5F662A420A9F00D223B8 /* Data+Utlis.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54AD5F652A420A9F00D223B8 /* Data+Utlis.swift */; };
54BB5E052A2F081300E239C7 /* UserProfileDeeplink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54BB5E042A2F081300E239C7 /* UserProfileDeeplink.swift */; };
54BFE3F62B99C74800273272 /* PublicKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54BFE3F52B99C74800273272 /* PublicKeys.swift */; };
54C02B912BA075120057301A /* BaseNodeConnectionError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C02B902BA075120057301A /* BaseNodeConnectionError.swift */; };
54C36D0B2A5D3E9800BD973A /* QRCodeScannerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C36D0A2A5D3E9800BD973A /* QRCodeScannerModel.swift */; };
54C36D0D2A5D3EA400BD973A /* QRCodeScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54C36D0C2A5D3EA400BD973A /* QRCodeScannerViewController.swift */; };
Expand Down Expand Up @@ -619,7 +617,7 @@
00BBD800237C5B5200EBF5E6 /* CommandLineArgs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandLineArgs.swift; sourceTree = "<group>"; };
00BBD808237D80C800EBF5E6 /* Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = "<group>"; };
00BBD80D237DA07400EBF5E6 /* ByteVector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ByteVector.swift; sourceTree = "<group>"; };
00BBD819237EB31900EBF5E6 /* CommsConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommsConfig.swift; sourceTree = "<group>"; };
00BBD819237EB31900EBF5E6 /* WalletDbConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletDbConfig.swift; sourceTree = "<group>"; };
00C520AE2469716E0077BF7F /* libc++.1.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.1.tbd"; path = "usr/lib/libc++.1.tbd"; sourceTree = SDKROOT; };
00DC2E21238554FD00036DDC /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
00DD160A241CCE0600C955B4 /* TariSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariSettings.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -764,7 +762,6 @@
3A8473C128EC556C0015E63A /* CoreTariService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreTariService.swift; sourceTree = "<group>"; };
3A8473C328EC55B10015E63A /* TariTransactionsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariTransactionsService.swift; sourceTree = "<group>"; };
3A8473C928EC56180015E63A /* TariFeesService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariFeesService.swift; sourceTree = "<group>"; };
3A8473CB28EC562E0015E63A /* TariConnectionService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariConnectionService.swift; sourceTree = "<group>"; };
3A8473CD28EC56480015E63A /* TariUTXOsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariUTXOsService.swift; sourceTree = "<group>"; };
3A8473CF28EC56600015E63A /* TariRecoveryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariRecoveryService.swift; sourceTree = "<group>"; };
3A8473D128EC568A0015E63A /* TariMessageSignService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TariMessageSignService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -963,7 +960,6 @@
54AC12912BCD1C1E0007FFEA /* StringBaseNodeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBaseNodeTests.swift; sourceTree = "<group>"; };
54AD5F652A420A9F00D223B8 /* Data+Utlis.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Utlis.swift"; sourceTree = "<group>"; };
54BB5E042A2F081300E239C7 /* UserProfileDeeplink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileDeeplink.swift; sourceTree = "<group>"; };
54BFE3F52B99C74800273272 /* PublicKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicKeys.swift; sourceTree = "<group>"; };
54C02B902BA075120057301A /* BaseNodeConnectionError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNodeConnectionError.swift; sourceTree = "<group>"; };
54C36D0A2A5D3E9800BD973A /* QRCodeScannerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeScannerModel.swift; sourceTree = "<group>"; };
54C36D0C2A5D3EA400BD973A /* QRCodeScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeScannerViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2098,7 +2094,6 @@
3A8473C128EC556C0015E63A /* CoreTariService.swift */,
3A8473C328EC55B10015E63A /* TariTransactionsService.swift */,
3A8473C928EC56180015E63A /* TariFeesService.swift */,
3A8473CB28EC562E0015E63A /* TariConnectionService.swift */,
3A8473CD28EC56480015E63A /* TariUTXOsService.swift */,
3A8473CF28EC56600015E63A /* TariRecoveryService.swift */,
3A8473D128EC568A0015E63A /* TariMessageSignService.swift */,
Expand Down Expand Up @@ -2335,7 +2330,6 @@
children = (
3A890EC829262744000F5DA6 /* TariAddress.swift */,
5499CF2C2C3EA7F5001C417F /* TariAddressComponents.swift */,
54BFE3F52B99C74800273272 /* PublicKeys.swift */,
001F6CDB238011CA00FA7002 /* PublicKey.swift */,
);
path = Keys;
Expand All @@ -2344,7 +2338,7 @@
3AF335DD28D7905C00B48F33 /* Configs */ = {
isa = PBXGroup;
children = (
00BBD819237EB31900EBF5E6 /* CommsConfig.swift */,
00BBD819237EB31900EBF5E6 /* WalletDbConfig.swift */,
);
path = Configs;
sourceTree = "<group>";
Expand Down Expand Up @@ -3615,7 +3609,7 @@
3ACDA85C27215BEB00F08C70 /* YatTransactionView.swift in Sources */,
3A2C0B8927DA22C20018C5A8 /* ExpandButton.swift in Sources */,
F8D63B252E81684400071B66 /* UIVideoPlayer.swift in Sources */,
00BBD81A237EB31900EBF5E6 /* CommsConfig.swift in Sources */,
00BBD81A237EB31900EBF5E6 /* WalletDbConfig.swift in Sources */,
3A9A08F526E0A83D00D2E75C /* AppRouter.swift in Sources */,
3708D756247FF81900807D72 /* SettingsParentViewController.swift in Sources */,
54DF83C52A4C5A220040E3F4 /* RoundedGlassContentView.swift in Sources */,
Expand Down Expand Up @@ -3672,7 +3666,6 @@
546CE7F929AF523F00264699 /* ContactBookFormView.swift in Sources */,
3723A7A624AC9389003382EB /* SecureBackupViewController.swift in Sources */,
549E1A012A5EB7B00063022C /* QRCodeScannerBoxView.swift in Sources */,
3A8473CC28EC562E0015E63A /* TariConnectionService.swift in Sources */,
3A84CDD62846089B005F2F8D /* UTXOsWalletModel.swift in Sources */,
54F1FDA62C296CC5007B3CD8 /* ScreenshotPopUpHandler.swift in Sources */,
37C8BA4F24813F98005BBC05 /* SettingsParentTableViewController.swift in Sources */,
Expand Down Expand Up @@ -3892,7 +3885,6 @@
F82150312E0A76DA003EBB25 /* EmojiToggle.swift in Sources */,
717B28A52DB8622200EDD05A /* APIService.swift in Sources */,
3A4205922798001A00A8D49C /* AmountKeyboardView.swift in Sources */,
54BFE3F62B99C74800273272 /* PublicKeys.swift in Sources */,
711D7FB02D5532DC0080A987 /* StylisedLabel.swift in Sources */,
3A03A602288962FA00788A02 /* SplashViewModel.swift in Sources */,
F88B28DA2E27AE6C005B9B13 /* Tab.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CommsConfig.swift
// WalletDbConfig.swift

/*
Package MobileWallet
Expand Down Expand Up @@ -38,7 +38,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

final class CommsConfig {
final class WalletDbConfig {

// MARK: - Properties

Expand All @@ -50,7 +50,7 @@ final class CommsConfig {
var errorCode: Int32 = -1
let errorCodePointer = PointerHandler.pointer(for: &errorCode)

let result = comms_config_create(databaseName, databaseFolderPath, errorCodePointer)
let result = wallet_db_config_create(databaseName, databaseFolderPath, errorCodePointer)

guard errorCode == 0, let result else { throw WalletError(code: errorCode) }
pointer = result
Expand All @@ -59,6 +59,6 @@ final class CommsConfig {
// MARK: - Deinitialiser

deinit {
comms_config_destroy(pointer)
wallet_db_config_destroy(pointer)
}
}
81 changes: 0 additions & 81 deletions MobileWallet/Libraries/TariLib/Core/FFI/Keys/PublicKeys.swift

This file was deleted.

10 changes: 3 additions & 7 deletions MobileWallet/Libraries/TariLib/Core/FFI/Wallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class Wallet {

init(
network: TariNetwork,
commsConfig: CommsConfig,
walletDbConfig: WalletDbConfig,
loggingFilePath: String,
seedWords: SeedWords?,
passphrase: String?,
Expand Down Expand Up @@ -129,7 +129,7 @@ final class Wallet {
let storedMessagesReceivedCallback: (@convention(c) (UnsafeMutableRawPointer?) -> Void) = { _ in
}

let connectivityStatusCallback: (@convention(c) (UnsafeMutableRawPointer?, UInt64) -> Void) = { context, status in
let connectivityStatusCallback: (@convention(c) (UnsafeMutableRawPointer?, UInt64, UInt64) -> Void) = { context, status, latency in
// TODO: not used anymore, should be removed once FFI is updated
}

Expand Down Expand Up @@ -157,7 +157,7 @@ final class Wallet {

let result = wallet_create(
callbacksPointer,
commsConfig.pointer,
walletDbConfig.pointer,
loggingFilePath,
logVerbosity,
Self.numberOfRollingLogFiles,
Expand All @@ -166,9 +166,6 @@ final class Wallet {
nil,
seedWords?.pointer,
network.name,
network.dnsPeer,
nil,
isDnsSecureOn,
network.httpBaseNode,
walletBirthdayOffset,
receivedTransactionCallback,
Expand All @@ -184,7 +181,6 @@ final class Wallet {
txoValidationCallback, // TODO: not used anymore, should be removed once FFI is updated
balanceUpdatedCallback,
trasactionValidationCompleteCallback, // TODO: not used anymore, should be removed once FFI is updated
storedMessagesReceivedCallback,
connectivityStatusCallback,
walletScannedHeightCallback,
baseNodeStateCallback,
Expand Down
10 changes: 4 additions & 6 deletions MobileWallet/Libraries/TariLib/Core/FFI/WalletContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protocol WalletInteractable {

var connectionCallbacks: WalletConnectionCallbacks { get }

var connection: TariConnectionService { get }
var fees: TariFeesService { get }
var keyValues: TariKeyValueService { get }
var messageSign: TariMessageSignService { get }
Expand Down Expand Up @@ -87,7 +86,7 @@ final class WalletContainer: WalletInteractable, MainServiceable {

var dataVersion: String? {
get throws {
try manager.walletVersion(commsConfig: try makeCommsConfig())
try manager.walletVersion(walletDbConfig: try makeWalletDbConfig())
}
}

Expand All @@ -96,7 +95,6 @@ final class WalletContainer: WalletInteractable, MainServiceable {

private(set) lazy var connectionCallbacks = WalletConnectionCallbacks(scannedHeightPublisher: $scannedHeight, blockHeight: $blockHeight)

private(set) lazy var connection: TariConnectionService = TariConnectionService(walletManager: manager, walletCallbacks: walletCallbacks, services: self)
private(set) lazy var fees = TariFeesService(walletManager: manager, walletCallbacks: walletCallbacks, services: self)
private(set) lazy var keyValues = TariKeyValueService(walletManager: manager, walletCallbacks: walletCallbacks, services: self)
private(set) lazy var messageSign = TariMessageSignService(walletManager: manager, walletCallbacks: walletCallbacks, services: self)
Expand Down Expand Up @@ -158,7 +156,7 @@ final class WalletContainer: WalletInteractable, MainServiceable {

try manager.connectWallet(
network: NetworkManager.shared.selectedNetwork,
commsConfig: makeCommsConfig(),
walletDbConfig: makeWalletDbConfig(),
logFilePath: logPath,
seedWords: walletSeedWords,
passphrase: passphrase,
Expand Down Expand Up @@ -197,8 +195,8 @@ final class WalletContainer: WalletInteractable, MainServiceable {
return try SeedWords(words: seedWords)
}

private func makeCommsConfig() throws -> CommsConfig {
try CommsConfig(
private func makeWalletDbConfig() throws -> WalletDbConfig {
try WalletDbConfig(
databaseName: databaseName,
databaseFolderPath: databaseDirectoryURL.path
)
Expand Down
19 changes: 4 additions & 15 deletions MobileWallet/Libraries/TariLib/Core/FFIWalletHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ final class FFIWalletHandler {

// MARK: - Actions

func connectWallet(network: TariNetwork, commsConfig: CommsConfig, logFilePath: String, seedWords: SeedWords?, passphrase: String?, isDnsSecureOn: Bool, logVerbosity: Int32, isCreatedWallet: Bool, callbacks: WalletCallbacks) throws {
func connectWallet(network: TariNetwork, walletDbConfig: WalletDbConfig, logFilePath: String, seedWords: SeedWords?, passphrase: String?, isDnsSecureOn: Bool, logVerbosity: Int32, isCreatedWallet: Bool, callbacks: WalletCallbacks) throws {
do {
let beforeWalletCreationDate = Date()
Logger.log(message: "Wallet will be created", domain: .general, level: .info)
wallet = try Wallet(
network: network,
commsConfig: commsConfig,
walletDbConfig: walletDbConfig,
loggingFilePath: logFilePath,
seedWords: seedWords,
passphrase: passphrase,
Expand Down Expand Up @@ -207,17 +207,6 @@ final class FFIWalletHandler {
return TariFeePerGramStat(pointer: pointer)
}

func seedPeers() throws -> PublicKeys {
let wallet = try exisingWallet

var errorCode: Int32 = -1
let errorCodePointer = PointerHandler.pointer(for: &errorCode)
let result = wallet_get_seed_peers(wallet.pointer, errorCodePointer)

guard errorCode == 0, let result else { throw WalletError(code: errorCode) }
return PublicKeys(pointer: result)
}

func utxos() throws -> [TariUtxo] {
let wallet = try exisingWallet

Expand Down Expand Up @@ -371,10 +360,10 @@ final class FFIWalletHandler {
return String(cString: result)
}

func walletVersion(commsConfig: CommsConfig) throws -> String? {
func walletVersion(walletDbConfig: WalletDbConfig) throws -> String? {
var errorCode: Int32 = -1
let errorCodePointer = PointerHandler.pointer(for: &errorCode)
let result = wallet_get_last_version(commsConfig.pointer, errorCodePointer)
let result = wallet_get_last_version(walletDbConfig.pointer, errorCodePointer)

try checkError(errorCode)
guard let result else { return nil }
Expand Down
Loading