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:
#
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:617
Builds an invite link for a trustline request in the format
#
Parameters:Name | Type | Description |
---|---|---|
networkAddress | string | Address 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:295
Signs a raw transaction object as returned by prepareAccept
or prepareUpdate
and sends the signed transaction.
#
Parameters:Name | Type | Description |
---|---|---|
rawTx | RawTxObject | Raw transaction object. |
Returns: Promise<any>
#
getâ–¸ get(networkAddress
: string, counterpartyAddress
: string, options?
: { decimalsOptions?: DecimalsOptions }): Promise<TrustlineObject>
Defined in src/Trustline.ts:354
Returns a trustline to a counterparty address in a specified currency network.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterpartyAddress | string | - | 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:327
Returns all trustlines of a loaded user in a currency network.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | 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:302
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:562
Returns a path for closing a trustline between sender and counterparty.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
senderAddress | string | - | Address of sender. |
counterpartyAddress | string | - | Address of counterparty of trustline. |
options | PaymentOptions | {} | 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:450
Returns all events of a specific trustline in a currency network. These are BalanceUpdate, TrustlineUpdate, TrustlineUpdateRequest and TrustlineUpdateCancel
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterPartyAddress | string | - | Address of the counter party of the trustline. |
filter | EventFilterOptions | {} | Event filter object. See EventFilterOptions for more information. |
Returns: Promise<AnyNetworkTrustlineEvent[]>
#
getRequestsâ–¸ getRequests(networkAddress
: string, filter?
: EventFilterOptions): Promise<NetworkTrustlineUpdateEvent[]>
Defined in src/Trustline.ts:384
Returns trustline update requests of loaded user in a currency network.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
filter | EventFilterOptions | {} | Event filter object. See EventFilterOptions for more information. |
Returns: Promise<NetworkTrustlineUpdateEvent[]>
#
getTrustlineBalanceUpdatesâ–¸ getTrustlineBalanceUpdates(networkAddress
: string, counterPartyAddress
: string, filter?
: EventFilterOptions): Promise<NetworkTrustlineBalanceUpdate[]>
Defined in src/Trustline.ts:432
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:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterPartyAddress | string | - | Address of the counter party of the trustline. |
filter | EventFilterOptions | {} | Event filter object. See EventFilterOptions for more information. |
Returns: Promise<NetworkTrustlineBalanceUpdate[]>
#
getTrustlineUpdateCancelsâ–¸ getTrustlineUpdateCancels(networkAddress
: string, filter?
: EventFilterOptions): Promise<NetworkTrustlineCancelEvent[]>
Defined in src/Trustline.ts:399
Returns trustline update cancels of loaded user in a currency network.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
filter | EventFilterOptions | {} | Event filter object. See EventFilterOptions for more information. |
Returns: Promise<NetworkTrustlineCancelEvent[]>
#
getUpdatesâ–¸ getUpdates(networkAddress
: string, filter?
: EventFilterOptions): Promise<NetworkTrustlineUpdateEvent[]>
Defined in src/Trustline.ts:415
Returns trustline updates of loaded user in a currency network. An update happens when a user accepts a trustline update request.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
filter | EventFilterOptions | {} | 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:235
Prepares a transaction object for accepting a trustline update request. Called by receiver of initial update request.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
initiatorAddress | string | - | Address of user who initiated the trustline update request. |
creditlineGiven | number | string | - | Proposed creditline limit given by receiver to initiator, i.e. 1.23 if network has to 2 decimals. |
creditlineReceived | number | string | - | Proposed creditline limit received by initiator from receiver, i.e. 1.23 if network has to 2 decimals. |
options | TrustlineUpdateOptions | {} | 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:261
Prepares a transaction object for canceling / rejecting a trustline update request. Called by initiator of cancel.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterpartyAddress | string | - | Address of counterparty to cancel / reject the trustline update with. |
options | TxOptions | {} | 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:484
Prepares an ethereum transaction object for closing a trustline.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterpartyAddress | string | - | Address of counterparty to who the trustline should be settled. |
options | PaymentOptions | {} | 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:119
Prepares a transaction object for creating a trustline update request. Called by initiator of update request.
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
counterpartyAddress | string | - | Address of counterparty who receives trustline update request. |
creditlineGiven | number | string | - | Proposed creditline limit given by initiator to counterparty, i.e. 1.23 if network has to 2 decimals. |
creditlineReceived | number | string | - | Proposed creditline limit received by initiator from counterparty, i.e. 1.23 if network has to 2 decimals. |
options | TrustlineUpdateOptions | {} | Options for creating an updateTrustline ethereum transaction. See type TrustlineUpdateOptions for more information. |
Returns: Promise<TxObject>