Version: 0.17.1

Class: Trustline

"Trustline".Trustline

The Trustline class contains all relevant methods for retrieving, creating and editing trustlines. It is meant to be called via a TLNetwork instance like:

const tlNetwork = new TLNetwork(
//...
)
// Get trustlines
tlNetwork.trustline.getAll(
// ...
).then(
trustlines => console.log("Trustlines of loaded user:", trustlines)
)

Hierarchy#

  • Trustline

Methods#

buildTrustlineRequestInviteLink#

â–¸ buildTrustlineRequestInviteLink(networkAddress: string, amounts: { creditlineGiven: string | number ; creditlineReceived: string | number ; interestRateGiven?: string | number ; interestRateReceived?: string | number }, options?: { [key:string]: string; customBase?: string }): Promise<string>

Defined in src/Trustline.ts:644

Builds an invite link for a trustline request in the format

<BASE_URL>/trustlinerequest/:networkAddress/:senderAddress/:creditlineGiven/:creditlineReceived/:interestRateGiven/:interestRateReceived[?:optionalParams]

Parameters:#

NameTypeDescription
networkAddressstringAddress of currency network.
amounts{ creditlineGiven: string | number ; creditlineReceived: string | number ; interestRateGiven?: string | number ; interestRateReceived?: string | number }Amounts to use for the trustline request.
options?{ [key:string]: string; customBase?: string }Additional options for link creation.

Returns: Promise<string>


confirm#

â–¸ confirm(rawTx: RawTxObject): Promise<any>

Defined in src/Trustline.ts:322

Signs a raw transaction object as returned by prepareAccept or prepareUpdate and sends the signed transaction.

Parameters:#

NameTypeDescription
rawTxRawTxObjectRaw transaction object.

Returns: Promise<any>


get#

â–¸ get(networkAddress: string, counterpartyAddress: string, options?: { decimalsOptions?: DecimalsOptions }): Promise<TrustlineObject>

Defined in src/Trustline.ts:381

Returns a trustline to a counterparty address in a specified currency network.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterpartyAddressstring-Address of counterparty of trustline.
options{ decimalsOptions?: DecimalsOptions }{}-

Returns: Promise<TrustlineObject>


getAll#

â–¸ getAll(networkAddress: string, options?: { decimalsOptions?: DecimalsOptions }): Promise<TrustlineObject[]>

Defined in src/Trustline.ts:354

Returns all trustlines of a loaded user in a currency network.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
options{ decimalsOptions?: DecimalsOptions }{}Extra options for user, network or trustline.

Returns: Promise<TrustlineObject[]>


getAllOfUser#

â–¸ getAllOfUser(): Promise<TrustlineObject[]>

Defined in src/Trustline.ts:329

Returns all trustlines of a loaded user in all currency networks.

Returns: Promise<TrustlineObject[]>


getClosePath#

â–¸ getClosePath(networkAddress: string, senderAddress: string, counterpartyAddress: string, options?: PaymentOptions): Promise<ClosePathObject>

Defined in src/Trustline.ts:589

Returns a path for closing a trustline between sender and counterparty.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
senderAddressstring-Address of sender.
counterpartyAddressstring-Address of counterparty of trustline.
optionsPaymentOptions{}Payment options. See PaymentOptions for more information.

Returns: Promise<ClosePathObject>

Relevant information for closing a trustline. See ClosePathObject.


getEvents#

â–¸ getEvents(networkAddress: string, counterPartyAddress: string, filter?: EventFilterOptions): Promise<AnyNetworkTrustlineEvent[]>

Defined in src/Trustline.ts:477

Returns all events of a specific trustline in a currency network. These are BalanceUpdate, TrustlineUpdate, TrustlineUpdateRequest and TrustlineUpdateCancel

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterPartyAddressstring-Address of the counter party of the trustline.
filterEventFilterOptions{}Event filter object. See EventFilterOptions for more information.

Returns: Promise<AnyNetworkTrustlineEvent[]>


getRequests#

â–¸ getRequests(networkAddress: string, filter?: EventFilterOptions): Promise<NetworkTrustlineUpdateRequestEvent[]>

Defined in src/Trustline.ts:411

Returns trustline update requests of loaded user in a currency network.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
filterEventFilterOptions{}Event filter object. See EventFilterOptions for more information.

Returns: Promise<NetworkTrustlineUpdateRequestEvent[]>


getTrustlineBalanceUpdates#

â–¸ getTrustlineBalanceUpdates(networkAddress: string, counterPartyAddress: string, filter?: EventFilterOptions): Promise<NetworkTrustlineBalanceUpdate[]>

Defined in src/Trustline.ts:459

Returns trustline balance updates of a specific trustline in a currency network. A balance update happens, because of interests or because of received, sent or mediated transfers.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterPartyAddressstring-Address of the counter party of the trustline.
filterEventFilterOptions{}Event filter object. See EventFilterOptions for more information.

Returns: Promise<NetworkTrustlineBalanceUpdate[]>


getTrustlineUpdateCancels#

â–¸ getTrustlineUpdateCancels(networkAddress: string, filter?: EventFilterOptions): Promise<NetworkTrustlineCancelEvent[]>

Defined in src/Trustline.ts:426

Returns trustline update cancels of loaded user in a currency network.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
filterEventFilterOptions{}Event filter object. See EventFilterOptions for more information.

Returns: Promise<NetworkTrustlineCancelEvent[]>


getUpdates#

â–¸ getUpdates(networkAddress: string, filter?: EventFilterOptions): Promise<NetworkTrustlineUpdateEvent[]>

Defined in src/Trustline.ts:442

Returns trustline updates of loaded user in a currency network. An update happens when a user accepts a trustline update request.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
filterEventFilterOptions{}Event filter object. See EventFilterOptions for more information.

Returns: Promise<NetworkTrustlineUpdateEvent[]>


prepareAccept#

â–¸ prepareAccept(networkAddress: string, initiatorAddress: string, creditlineGiven: number | string, creditlineReceived: number | string, options?: TrustlineUpdateOptions): Promise<TxObject>

Defined in src/Trustline.ts:262

Prepares a transaction object for accepting a trustline update request. Called by receiver of initial update request.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
initiatorAddressstring-Address of user who initiated the trustline update request.
creditlineGivennumber | string-Proposed creditline limit given by receiver to initiator, i.e. 1.23 if network has to 2 decimals.
creditlineReceivednumber | string-Proposed creditline limit received by initiator from receiver, i.e. 1.23 if network has to 2 decimals.
optionsTrustlineUpdateOptions{}Options for creating a ethereum transaction. See type TrustlineUpdateOptions for more information.

Returns: Promise<TxObject>


prepareCancelTrustlineUpdate#

â–¸ prepareCancelTrustlineUpdate(networkAddress: string, counterpartyAddress: string, options?: TxOptions): Promise<TxObject>

Defined in src/Trustline.ts:288

Prepares a transaction object for canceling / rejecting a trustline update request. Called by initiator of cancel.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterpartyAddressstring-Address of counterparty to cancel / reject the trustline update with.
optionsTxOptions{}Options for creating the ethereum transaction. See TxOptions for more information.

Returns: Promise<TxObject>


prepareClose#

â–¸ prepareClose(networkAddress: string, counterpartyAddress: string, options?: PaymentOptions): Promise<CloseTxObject>

Defined in src/Trustline.ts:511

Prepares an ethereum transaction object for closing a trustline.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterpartyAddressstring-Address of counterparty to who the trustline should be settled.
optionsPaymentOptions{}Payment options. See PaymentOptions for more information.

Returns: Promise<CloseTxObject>

A transaction object for closing a trustline. See CloseTxObject for more information.


prepareUpdate#

â–¸ prepareUpdate(networkAddress: string, counterpartyAddress: string, creditlineGiven: number | string, creditlineReceived: number | string, options?: TrustlineUpdateOptions): Promise<TxObject>

Defined in src/Trustline.ts:122

Prepares a transaction object for creating a trustline update request. Called by initiator of update request.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
counterpartyAddressstring-Address of counterparty who receives trustline update request.
creditlineGivennumber | string-Proposed creditline limit given by initiator to counterparty, e.g. 1.23 if network has 2 decimals.
creditlineReceivednumber | string-Proposed creditline limit received by initiator from counterparty, e.g. 1.23 if network has 2 decimals.
optionsTrustlineUpdateOptions{}Options for creating an updateTrustline ethereum transaction. See type TrustlineUpdateOptions for more information.

Returns: Promise<TxObject>