PCSDKModule Documentation Beta

Class PCAuto​Signer

public class PCAutoSigner

Class for autosigning transactions

Methods

register​ToAutosign(user:​target​Queue:​_:​)

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

user PCUser

User to be registered

target​Queue Dispatch​Queue

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

get​Scoring​Settings(for:​type:​target​Queue:​_:​)

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

user PCUser

User scoring setting will be fetched for

type Settings​Type.​Type

The received scoring settings will be decoded to this type

target​Queue Dispatch​Queue

The queue where a closure will be invoked on

completion @escaping (_ result:​ Result<PCScoring​Settings<Settings​Type>, Error>) -> Void

A closure to be invoked after finishing of getting data

result

Return scoring settings when success. Otherwise, returns error

get​Autosign​Transactions​List(for:​target​Queue:​_:​)

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

user PCUser

The user which transactions to auto sign should be fetched for

target​Queue Dispatch​Queue

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:​scoring​Parameters:​target​Queue:​_:​)

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

transaction PCTransaction

Transaction to sign

user PCUser

User to sign

scoring​Parameters PCScoring​Parameters

Parameters provided by a scoring system

target​Queue Dispatch​Queue

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