Class
PCAutoSigner
public class PCAutoSigner
Class for autosigning transactions
Methods
registerToAutosign(user:targetQueue:_:)
public static func registerToAutosign(user: PCUser, targetQueue: DispatchQueue = .main, _ completion: @escaping (_ result: Result<Void, Error>) -> Void)
Registers the user to use autosign.
The registering user should be able to use autosign feature. It can be checked by
user.options.isAutosignEnabled
property.
Parameters
Name | Type | Description |
---|---|---|
user | PCUser |
User to be registered |
targetQueue | DispatchQueue |
The queue where a closure will be invoked on |
completion | @escaping (_ result: Result<Void, Error>) -> Void |
A closure to be invoked after finishing of registration |
result | Returns nothing when success. Otherwise, returns error |
getScoringSettings(for:type:targetQueue:_:)
public static func getScoringSettings<SettingsType: Decodable>(for user: PCUser, type: SettingsType.Type, targetQueue: DispatchQueue = .main, _ completion: @escaping (_ result: Result<PCScoringSettings<SettingsType>, Error>) -> Void)
Returns a scoring settings for this user from the server
Parameters
Name | Type | Description |
---|---|---|
user | PCUser |
User scoring setting will be fetched for |
type | SettingsType.Type |
The received scoring settings will be decoded to this type |
targetQueue | DispatchQueue |
The queue where a closure will be invoked on |
completion | @escaping (_ result: Result<PCScoringSettings<SettingsType>, Error>) -> Void |
A closure to be invoked after finishing of getting data |
result | Return scoring settings when success. Otherwise, returns error |
getAutosignTransactionsList(for:targetQueue:_:)
public static func getAutosignTransactionsList(for user: PCUser, targetQueue: DispatchQueue = .main, _ completion: @escaping (_ result: Result<[String], Error>) -> Void)
Returns list of transactions to auto sign
The autosign feature must be available to the provided user and the user should be registered to autosign
Parameters
Name | Type | Description |
---|---|---|
user | PCUser |
The user which transactions to auto sign should be fetched for |
targetQueue | DispatchQueue |
The queue where a closure will be invoked on |
callback | A closure to be invoked after finishing the fetching process |
|
result | Returns list with transactions to auto sign whe success. Otherwise, returns error. |
autosign(transaction:user:scoringParameters:targetQueue:_:)
public static func autosign(transaction: PCTransaction, user: PCUser, scoringParameters: PCScoringParameters, targetQueue: DispatchQueue = .main, _ completion: @escaping (_ result: Result<Void, Error>) -> Void)
Signing transaction without user's interactions
The user must be registered to use autosign feature before invoking this method.
To register the user use PCAutoSigner.registerUser
method. Otherwise, this method will return
error (PCError.autosignUnavailable
)
Parameters
Name | Type | Description |
---|---|---|
transaction | PCTransaction |
Transaction to sign |
user | PCUser |
User to sign |
scoringParameters | PCScoringParameters |
Parameters provided by a scoring system |
targetQueue | DispatchQueue |
The queue where a closure will be invoked on |
completion | @escaping (_ result: Result<Void, Error>) -> Void |
A closure to be invoked after finishing signing |
result | Returns nothing when success. Otherwise, returns error |