ZcashRustBackendWelding
public protocol ZcashRustBackendWelding
Undocumented
-
gets the latest error if available
Declaration
Swift
static func lastError() -> RustWeldingError? -
gets the latest error message from librustzcash
Declaration
Swift
static func getLastError() -> String? -
initializes the data db
Declaration
Swift
static func initDataDb(dbData: URL) throwsParameters
dbDatalocation of the data db sql file
-
Throws
Error when the provided address belongs to another networkDeclaration
Swift
static func isValidShieldedAddress(_ address: String) throws -> BoolReturn Value
true when the address is valid and shielded. Returns false in any other case
-
Throws
Error when the provided address belongs to another networkDeclaration
Swift
static func isValidTransparentAddress(_ address: String) throws -> BoolReturn Value
true when the address is valid and transparent. false in any other case
-
initialize the blocks table from a given checkpoint (birthday)
Declaration
Swift
static func initAccountsTable(dbData: URL, seed: [UInt8], accounts: Int32) -> [String]?Parameters
dbDatalocation of the data db
seedbyte array of the zip32 seed
accountshow many accounts you want to have
-
initialize the blocks table from a given checkpoint (birthday)
Declaration
Swift
static func initBlocksTable(dbData: URL, height: Int32, hash: String, time: UInt32, saplingTree: String) throwsParameters
dbDatalocation of the data db
heightrepresents the block height of the given checkpoint
hashhash of the merkle tree
timein milliseconds from reference
saplingTreehash of the sapling tree
-
gets the address from data db from the given account
Declaration
Swift
static func getAddress(dbData: URL, account: Int32) -> String?Parameters
dbDatalocation of the data db
accountindex of the given account
Return Value
an optional string with the address if found
-
get the (unverified) balance from the given account
Declaration
Swift
static func getBalance(dbData: URL, account: Int32) -> Int64Parameters
dbDatalocation of the data db
accountindex of the given account
-
get the verified balance from the given account
Declaration
Swift
static func getVerifiedBalance(dbData: URL, account: Int32) -> Int64Parameters
dbDatalocation of the data db
accountindex of the given account
-
get received memo from note
Declaration
Swift
static func getReceivedMemoAsUTF8(dbData: URL, idNote: Int64) -> String?Parameters
dbDatalocation of the data db file
idNotenote_id of note where the memo is located
-
get sent memo from note
Declaration
Swift
static func getSentMemoAsUTF8(dbData: URL, idNote: Int64) -> String?Parameters
dbDatalocation of the data db file
idNotenote_id of note where the memo is located
-
Checks that the scanned blocks in the data database, when combined with the recent `CompactBlock`s in the cache database, form a valid chain. This function is built on the core assumption that the information provided in the cache database is more likely to be accurate than the previously-scanned information. This follows from the design (and trust) assumption that the `lightwalletd` server provides accurate block information as of the time it was requested.Declaration
Swift
static func validateCombinedChain(dbCache: URL, dbData: URL) -> Int32Return Value
-1if the combined chain is valid.upper_boundif the combined chain is invalid.upper_boundis the height of the highest invalid block (on the assumption that the highest block in the cache database is correct).0if there was an error during validation unrelated to chain validity.
Important
This function does not mutate either of the databases. -
rewinds the compact block storage to the given height. clears up all derived data as well
Declaration
Swift
static func rewindToHeight(dbData: URL, height: Int32) -> BoolParameters
dbDatalocation of the data db file
heightheight to rewind to
-
Scans new blocks added to the cache for any transactions received by the tracked accounts. This function pays attention only to cached blocks with heights greater than the highest scanned block in
db_data. Cached blocks with lower heights are not verified against previously-scanned blocks. In particular, this function assumes that the caller is handling rollbacks. For brand-new light client databases, this function starts scanning from the Sapling activation height. This height can be fast-forwarded to a more recent block by calling [zcashlc_init_blocks_table] before this function. Scanned blocks are required to be height-sequential. If a block is missing from the cache, an error will be signalled.Declaration
Swift
static func scanBlocks(dbCache: URL, dbData: URL) -> BoolParameters
dbCachelocation of the compact block cache db
dbDatalocation of the data db file returns false if fails to scan.
-
Creates a transaction to the given address from the given account
Declaration
Swift
static func createToAddress(dbData: URL, account: Int32, extsk: String, to: String, value: Int64, memo: String?, spendParamsPath: String, outputParamsPath: String) -> Int64Parameters
dbDataURL for the Data DB
accountthe account index that will originate the transaction
extskextended spending key string
torecipient address
valuetransaction amount in Zatoshi
memothe memo string for this transaction
spendParamsPathpath escaped String for the filesystem locations where the spend paremeters are located
outputParamsPathpath escaped String for the filesystem locations where the output paremeters are located
-
Derives a full viewing key from a seed
Throws
RustBackendError if fatal error occursDeclaration
Swift
static func deriveExtendedFullViewingKey(_ spendingKey: String) throws -> String?Parameters
spendingKeya string containing the spending key
Return Value
the derived key
-
Derives a set of full viewing keys from a seed
Throws
RustBackendError if fatal error occursDeclaration
Swift
static func deriveExtendedFullViewingKeys(seed: String, accounts: Int32) throws -> [String]?Parameters
spendingKeya string containing the spending key
accountsthe number of accounts you want to derive from this seed
Return Value
an array containing the derived keys
-
Derives a set of full viewing keys from a seed
Throws
RustBackendError if fatal error occursDeclaration
Swift
static func deriveExtendedSpendingKeys(seed: String, accounts: Int32) throws -> [String]?Parameters
seeda string containing the seed
accountsthe number of accounts you want to derive from this seed
Return Value
an array containing the spending keys
ZcashRustBackendWelding Protocol Reference