115 lines
3.7 KiB
Plaintext
115 lines
3.7 KiB
Plaintext
//swiftlint:disable all
|
|
import Foundation
|
|
|
|
/**
|
|
Wrapper for all the constant values in the SDK. It is important that these values stay fixed for
|
|
all users of the SDK. Otherwise, if individual wallet makers are using different values, it
|
|
becomes easier to reduce privacy by segmenting the anonymity set of users, particularly as it
|
|
relates to network requests.
|
|
*/
|
|
|
|
public class ZcashSDK {
|
|
|
|
/**
|
|
DEPRECATED. Miner's fee in zatoshi.
|
|
*/
|
|
public static let MINERS_FEE_ZATOSHI: BlockHeight = 10_000
|
|
|
|
/**
|
|
The number of zatoshi that equal 1 ZEC.
|
|
*/
|
|
public static let ZATOSHI_PER_ZEC: BlockHeight = 100_000_000
|
|
|
|
/**
|
|
The height of the first sapling block. When it comes to shielded transactions, we do not need to consider any blocks
|
|
prior to this height, at all.
|
|
*/
|
|
public static let SAPLING_ACTIVATION_HEIGHT: BlockHeight = {{ argument.saplingActivationHeight }}
|
|
|
|
/**
|
|
The theoretical maximum number of blocks in a reorg, due to other bottlenecks in the protocol design.
|
|
*/
|
|
public static let MAX_REORG_SIZE = 100
|
|
|
|
/**
|
|
The amount of blocks ahead of the current height where new transactions are set to expire. This value is controlled
|
|
by the rust backend but it is helpful to know what it is set to and should be kept in sync.
|
|
*/
|
|
public static let EXPIRY_OFFSET = 20
|
|
|
|
//
|
|
// Defaults
|
|
//
|
|
|
|
/**
|
|
Default size of batches of blocks to request from the compact block service.
|
|
*/
|
|
public static let DEFAULT_BATCH_SIZE = 100
|
|
|
|
/**
|
|
Default amount of time, in in seconds, to poll for new blocks. Typically, this should be about half the average
|
|
block time.
|
|
*/
|
|
public static let DEFAULT_POLL_INTERVAL: TimeInterval = 20
|
|
|
|
/**
|
|
Default attempts at retrying.
|
|
*/
|
|
public static let DEFAULT_RETRIES = 5
|
|
|
|
/**
|
|
The default maximum amount of time to wait during retry backoff intervals. Failed loops will never wait longer than
|
|
this before retyring.
|
|
*/
|
|
public static let DEFAULT_MAX_BACKOFF_INTERVAL: TimeInterval = 600
|
|
|
|
/**
|
|
Default number of blocks to rewind when a chain reorg is detected. This should be large enough to recover from the
|
|
reorg but smaller than the theoretical max reorg size of 100.
|
|
*/
|
|
public static let DEFAULT_REWIND_DISTANCE = 10
|
|
|
|
/**
|
|
The number of blocks to allow before considering our data to be stale. This usually helps with what to do when
|
|
returning from the background and is exposed via the Synchronizer's isStale function.
|
|
*/
|
|
public static let DEFAULT_STALE_TOLERANCE = 10
|
|
|
|
/**
|
|
Default Name for LibRustZcash data.db
|
|
*/
|
|
public static let DEFAULT_DATA_DB_NAME = "data.db"
|
|
|
|
/**
|
|
Default Name for Compact Block caches db
|
|
*/
|
|
public static let DEFAULT_CACHES_DB_NAME = "caches.db"
|
|
|
|
/**
|
|
Default name for pending transactions db
|
|
*/
|
|
public static let DEFAULT_PENDING_DB_NAME = "pending.db"
|
|
|
|
public static let DEFAULT_DB_NAME_PREFIX = "{{ argument.dbprefix }}"
|
|
|
|
/**
|
|
File name for the sapling spend params
|
|
*/
|
|
public static let SPEND_PARAM_FILE_NAME = "sapling-spend.params"
|
|
|
|
/**
|
|
File name for the sapling output params
|
|
*/
|
|
public static let OUTPUT_PARAM_FILE_NAME = "sapling-output.params"
|
|
|
|
/**
|
|
The Url that is used by default in zcashd.
|
|
We'll want to make this externally configurable, rather than baking it into the SDK but
|
|
this will do for now, since we're using a cloudfront URL that already redirects.
|
|
*/
|
|
public static let CLOUD_PARAM_DIR_URL = "https://z.cash/downloads/"
|
|
|
|
public static let isMainnet = {{ argument.ismainnet }}
|
|
|
|
}
|