Commit Graph

23 Commits

Author SHA1 Message Date
Francisco Gindre c0f1aa959a Fix SendViewController `viewDidLoad` 2022-10-31 20:45:58 -03:00
Francisco Gindre dbd4b8934c Merge branch 'master' into merge-master 2022-10-31 09:34:38 -03:00
Lukas Korba cfe71d5da2
[#523] Make a CompactBlockProcessor an Actor (#565)
- Sample app refactored for the processor being an actor
- tests refactored as well
- dark side tests fixed
- utilities separated to new file
- synchronizer's start and stop are no longer in async context
- updating the UI for the scan fixed
2022-10-27 12:51:38 +02:00
Francisco Gindre 7806b5114f
Use UnifiedSpendingKey for shielding and Spending (#535)
[#534] Use UnifiedSpendingKey for shielding and Spending

This commit implements the use of Unified Spending Keys for shielding
and spending as well as rolling Unified Addresses.

Users should obtain addresses by rolling them from the SDK.
USKs replace Sapling Extended Spending keys and TransparentAccountPrivKeys
when shielding or spending

Closes #534

Co-authored-by: Kris Nuttycombe <kris@nutty.land>

* Fix rebase issues

* PR Suggestion. Make `lastError` an Optional

* Fix test `testReOrgRemovesOutboundTxAndIsNeverMined`

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-10-02 23:11:17 -03:00
Francisco Gindre ca5221ac75 Merge branch 'master' into merge-master-to-zip-316 2022-09-30 09:53:34 -03:00
Lukas Korba 61683a85f3 [486] sendToAddress async/await
- sendToAddress and SaplingParameterDownloader refactored to async
- unit tests WIP

[486] sendToAddress async/await

- testing code cleanup

[#486] sendToAddress async/await

- reducing number of Tasks in Sample app

[#486] sendToAddress async/await

- I finally figure out how to make the dark side tests async, using new sendToAddress APIs and pass, POC done, 18 more tests to refactor

[#486] sendToAddress async/await

- async sendToAddress unit test refactored except NetworkUpgradeTests

[#486] sendToAddress async/await

- NetworkUpgradeTests refactored to async API

[#486] sendToAddress async/await

- cleanup

[#486] sendToAddress async/await (#536)

- PR comments resolved
2022-09-21 13:47:17 +02:00
Francisco Gindre 72c1f14aa6 Issue #375 - User can't go twice in a row to SendFundsViewController 2022-09-12 16:58:29 -06:00
Francisco Gindre ed87a2781c [#461] Adopt a Type-Safe Keys and Addresses API
This PR creates data types for Addresses and Keys so that they are
not represented by Strings anymore. This avoids mistakenly use
the wrong keys because they are all alike for the type system.

New Protocols:
=============

StringEncoded -> Protocol that makes a type can be expressed in an
string-encoded fashion either for UI or Interchange purposes.

Undescribable -> A protocol that implements methods that override default
decriptions used by debuggers, loggers and event trackers to avoid types
conforming to it to be leaked to logs.

Deleted Protocols:
==================

UnifiedFullViewingKey --> turned into a struct.
UnifiedAddress --> turned into a struct

new Error Type:
================

````
enum KeyEncodingError: Error {
    case invalidEncoding
}
````

This error is thrown when an Address or Key type (addresses are public
keys in the end) can be decoded from their String representation,
typically upon initialization from a User input.

New Types:
=========

SaplingExtendedSpendingKey -> Type for Sapling Extended Full Viewing Keys
this type will be replaced with Unified Spending Keys soon.

SaplingExtendedFullViewingKey -> Extended Full Viewing Key for Sapling.
Maintains existing funcionality. Will be probably deprecated in favor of
UFVK.

TransparentAccountPrivKey -> Private key for transparent account. Used
only for shielding operations. Note: this will probably be deprecated soon.

UnifiedFullViewingKey -> Replaces the protocol that had the same name.

TransparentAddress -> Replaces a type alias with a struct

SaplingAddress --> Represents a Sapling receiver address. Comonly called zAddress. This address corresponds to the Zcash Sapling shielded pool.
Although this it is fully functional, we encourage developers to
choose `UnifiedAddress` before Sapling or Transparent ones.

UnifiedAddress -> Represents a UA. String-encodable and Equatable. Use of
UAs must be favored instead of individual receivers for different pools.
This type can't be decomposed into their Receiver types yet.

Recipient -> This represents all valid receiver types to be used as
inputs for outgoing transactions.

````
public enum Recipient: Equatable, StringEncoded {
    case transparent(TransparentAddress)
    case sapling(SaplingAddress)
    case unified(UnifiedAddress)
````

The wrapped concrete receiver is a valid receiver type.

Deleted Type Aliases:
=====================

The following aliases were deleted and turned into types
````
public typealias TransparentAddress = String
public typealias SaplingShieldedAddress = String

````

Changes to Derivation Tool
==========================

DerivationTool has been changed to accomodate this new types and
remove Strings whenever possible.

Changes to Synchronizer and CompactBlockProcessor
=================================================
Accordingly these to components have been modified to accept the
new types intead of strings when possible.

Changes to Demo App
===================
The demo App has been patch to compile and work with the new types.
Developers must consider that the use (and abuse) of forced_try and
forced unwrapping is a "license" that maintainers are using for the
sake of brevity. We consider that clients of this SDK do know how to
handle Errors and Optional and it is not the objective of the demo
code to show good practices on those matters.

Closes #461
2022-09-05 15:09:07 -03:00
Kris Nuttycombe 905ee401d1 Use zcash_client_sqlite to manage migrations for the wallet db.
This change removes responsibility for maintaining the state of
the wallet database from `ZcashLightClientKit` in favor of using
the migration system now provided by librustzcash. This will help
to ensure that the structure of the database is kept consistent with
the functions that query and update the database state.

Co-authored-by: Francisco Gindre <francisco.gindre@gmail.com>
2022-08-24 09:38:42 -06:00
Francisco Gindre b9ae012e09
[#381] Move Zatoshi and Amount Types to the SDK (#396)
Closes #381

This commit brings a Zatoshi type developed on the Secant project,
helper classes like Clamped and tests.

Zatoshi has been incorporated as a Codable type for SQLite Swift
to allow serialization into the pending database.

FIXES on Demo App

fix comments
2022-06-22 16:45:37 -03:00
Adam Stener ae5b3cfc21 SwiftLint Fixes 2021-09-21 06:27:49 -05:00
Francisco Gindre b1a0b01673 Clear SwiftLint on ZcashLightClientKit 2021-09-15 09:21:29 -03:00
Francisco Gindre 392b4ee0d4 Fix Demo App 2021-06-14 19:56:32 -03:00
Francisco Gindre f663df1711 fix demo app not compiling 2021-05-19 18:49:08 -03:00
Francisco Gindre 9a00284a28
Added memo demo! (#155) 2020-06-18 20:53:11 -03:00
Kevin Gorham a45f056242
Enable heartwood. (#138)
* Enable heartwood.

We might want to make further adjustments to conditionally enable this only on testnet.

* add consensus branch Id code

* better address validation

Co-authored-by: Francisco Gindre <francisco.gindre@gmail.com>
2020-06-09 21:23:46 -03:00
Dimitris Apostolou 51419010ea
Fix typos and cleanup (#103) 2020-03-26 11:27:55 -03:00
Francisco Gindre 9f223596f8 fix sample code where interface changed 2020-03-16 15:25:55 -03:00
Francisco Gindre 72c3cb59ef
Integrate logging capabilities (#93)
* Integrate logging capabilities

* Relocate file
2020-03-09 17:25:27 -03:00
Francisco Gindre 750108252f
Feature/single pod mainnet (#60)
* Mainnet changes [WIP]

* Separate pods approach [WIP]

* Create a single podfile and scripts to build mainnet or testnet [WIP]

* Added test spec to pod with TESTNET Script [WIP]

* pod install + sample app testnet build worked

* add prefix to database names

* Fix constants in tests

* fix plist

* fix stencils

* Force environment variable

* Get config from environment variable

* Save project settings and create new DemoAppConfig settings

* Fix Template. change demoApp config port

* Add extra warning when building to see environment in logs

* New Readme! + enhanced messaging on build_librustzcash_xcode.sh

* Fix Stencil if statement

* add our domain names to the demo app endpoints

* clean up Podfile

* fix: mainnet not building properly

* improve cleanup

* fixed weird seed change

* remove duplicated file reference

* Improve error handling on LightWalletService

* Improve error handling on Latest block height. fix get address pasteboard gesture

* fix mainnet walletbirthday stencil

* fix: demo app not syncing on mainnet

* Verified Balances and Send Max Funds fixed

* Add paths to preserve when installing pod

* add Stencil to preserved paths

* Fix $ZCASH_SDK_GENERATED_SOURCES_FOLDER not writable error

* Fixes from PR Comments

* Fixed TransactionId string generation

* Fixed Test build scripts + PR comments

* fix indentation

* Changes to script_commons

* fixes per PR

* remove else from mismatch function

* Add comment to poorly named function
2020-01-14 19:25:14 -03:00
Francisco Gindre 4f6e15bd9a
Add SampleStorage (#58) 2019-12-20 17:52:53 -03:00
Francisco Gindre a139ffbdfe
Transaction Listing + send funds + synchronizer implementation (#47)
* Create UIKit subfolder

* add offset to transaction repository

* mock repository and tests [WIP]

* Paged transaction DAO

* Paged transaction repository by kind

* update protobuf files

* move SDKSynchronizer to UIKit folder

* created some health check test on transactions

* Build release version of librustzcash

* Add Send on main thread button for troubleshooting purposes

* fix submit method by using RawTransaction factory method

* fix transactions table mapping

* fix transactions table mapping

* fix get balance sample

* FIX: cosensus branch ID for Blossom

* SDKSynchronizer integration for Send Funds

* fix rawTransactionId mistaken by raw field

* fix testEncodeSpend

* Transaction submission failed tests

* unpaged transaction listings

* renamed method, fixed typo

* stupid xcode misplaced folders again

* add PaginatedTableView Dependency to Example and hook it up [WIP]

* fix  unit test target not being shared

* removed performance test

* fix get address, paged transactions nulled, added type of transaction

* added kind of transaction to transaction repo builder, fixed transaction builder

* Transaction Detail screen

* add transaction details to paginated transaction
2019-12-16 19:25:45 -03:00
Francisco Gindre 561ea7b620
Feature/sending ui (#39)
* [WIp} Send View Controller + Synchronizer methods to send and cancel tx +  builders

* Send Funds scaffold

* project changes

* initializer and synchronizer enhancements. removed dummy file

* fix bitcode issue, add Progress HUD

* Pending Transactions, send transactions

* create_to_address tests + sending UI
2019-12-06 09:38:47 -03:00