Skip to content

Function: withCandidate() ​

Call Signature ​

ts
function withCandidate<T>(
   target, 
   fn, 
   options
): Promise<ConfirmedTransaction<T>>;

Defined in: netconf/src/operations/transaction.ts:383

Run fn in an RFC 6241 candidate transaction and commit it as a confirmed commit. Resolves with a ConfirmedTransaction holding what fn returned, to confirm or cancel before it expires. See Confirmed commits.

Type Parameters ​

T ​

T

Parameters ​

target ​

TransactionTarget

fn ​

(txn) => T | Promise<T>

options ​

TransactionOptions & object

Returns ​

Promise<ConfirmedTransaction<T>>

Call Signature ​

ts
function withCandidate<T>(
   target, 
   fn, 
   options?
): Promise<T>;

Defined in: netconf/src/operations/transaction.ts:389

Run fn in a candidate transaction and commit it. Resolves with what fn returns.

Type Parameters ​

T ​

T

Parameters ​

target ​

TransactionTarget

fn ​

(txn) => T | Promise<T>

options? ​

TransactionOptions & object

Returns ​

Promise<T>

Call Signature ​

ts
function withCandidate<T>(
   target, 
   fn, 
   options?
): Promise<
  | T
| ConfirmedTransaction<T>>;

Defined in: netconf/src/operations/transaction.ts:399

Run fn in a candidate transaction and commit it, confirmed when options.confirmed says so: resolves with a ConfirmedTransaction then, and with what fn returns otherwise.

Type Parameters ​

T ​

T

Parameters ​

target ​

TransactionTarget

fn ​

(txn) => T | Promise<T>

options? ​

TransactionOptions

Returns ​

Promise< | T | ConfirmedTransaction<T>>

Released under the MIT Licence.