Version: 0.17.1

Class: Payment

"Payment".Payment

The Payment class contains all payment related functions. This includes trustline transfers and TLC transfers. It is meant to be called via a TLNetwork instance like:

const tlNetwork = new TLNetwork(
//...
)
// Get transfer logs
tlNetwork.payment.get(
// ...
).then(
payments => console.log("Payments of loaded user:", payments)
)

Hierarchy#

  • Payment

Methods#

calculateTransferGasLimit#

â–¸ calculateTransferGasLimit(pathLength: number): BigNumber

Defined in src/Payment.ts:380

Parameters:#

NameType
pathLengthnumber

Returns: BigNumber


confirm#

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

Defined in src/Payment.ts:290

Signs a raw transaction object as returned by prepare and sends the signed transaction.

deprecated use confirmPayment instead.

Parameters:#

NameTypeDescription
rawTxRawTxObjectRaw transaction object.

Returns: Promise<any>


confirmPayment#

â–¸ confirmPayment(__namedParameters: { rawTx: RawTxObject ; receiverAddress: string ; transferId: string }, message?: string): Promise<string>

Defined in src/Payment.ts:303

Signs the rawTx provided as returned by prepare and sends the signed transaction as well as the message with transferId Can be directly given a PaymentTxObject object as returned by prepare

Parameters:#

NameTypeDescription
__namedParameters{ rawTx: RawTxObject ; receiverAddress: string ; transferId: string }-
message?stringThe message to be sent.

Returns: Promise<string>


createRequest#

â–¸ createRequest(networkAddress: string, options?: { [key:string]: string; amount?: string ; customBase?: string }): Promise<string>

Defined in src/Payment.ts:330

Creates a payment request link.

Parameters:#

NameTypeDescription
networkAddressstringAddress of a currency network.
options?{ [key:string]: string; amount?: string ; customBase?: string }options.amount - optional amount for the payment request in "normal" units (if we request 1€ - the amount should be 1) options.customBase - optional customBase for the link options[key] - any other additional options that should be added to the URL

Returns: Promise<string>


get#

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

Defined in src/Payment.ts:274

Returns transfer event logs of loaded user in a specified currency network.

Parameters:#

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

Returns: Promise<NetworkTransferEvent[]>


getMaxAmountAndPathInNetwork#

â–¸ getMaxAmountAndPathInNetwork(networkAddress: string, receiverAddress: string): Promise<any>

Defined in src/Payment.ts:357

Retrieve the maximum spendable amount and path to user in a network

Parameters:#

NameTypeDescription
networkAddressstring
receiverAddressstring

Returns: Promise<any>

}


getTransferDetails#

â–¸ getTransferDetails(transferIdentifier: TransferIdentifier, options?: { decimalsOptions?: DecimalsOptions }): Promise<TransferDetails>

Defined in src/Payment.ts:397

Get the transfer details list for given transfer identifier

Parameters:#

NameTypeDefault valueDescription
transferIdentifierTransferIdentifier-Used to identify the transfer for which to get the details. Needs to provide either blockHash and logIndex or txHash Returns a single transfer detail or throw an error if multiple transfer were identified
options{ decimalsOptions?: DecimalsOptions }{}Optional network decimals for formatting the transfer value

Returns: Promise<TransferDetails>


getTransferDetailsList#

â–¸ getTransferDetailsList(transferIdentifier: TransferIdentifier, options?: { decimalsOptions?: DecimalsOptions }): Promise<TransferDetails[]>

Defined in src/Payment.ts:425

Get the transfer details list for given transfer identifier

Parameters:#

NameTypeDefault valueDescription
transferIdentifierTransferIdentifier-Used to identify the transfer for which to get the details. Needs to provide either blockHash and logIndex or txHash
options{ decimalsOptions?: DecimalsOptions }{}Optional network decimals for formatting the transfer value

Returns: Promise<TransferDetails[]>


getTransferPathInfo#

â–¸ getTransferPathInfo(networkAddress: string, senderAddress: string, receiverAddress: string, value: number | string, options?: PaymentOptions): Promise<PathObject>

Defined in src/Payment.ts:227

Returns a path for a trustlines transfer, along with estimated fees and gas costs.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
senderAddressstring-Address of sender of transfer.
receiverAddressstring-Address of receiver of transfer.
valuenumber | string-Amount to transfer in biggest unit, i.e. 1.23 if currency network has 2 decimals.
optionsPaymentOptions{}Payment options. See PaymentOptions for more information.

Returns: Promise<PathObject>


prepare#

â–¸ prepare(networkAddress: string, receiverAddress: string, value: number | string, options?: PaymentOptions): Promise<PaymentTxObject>

Defined in src/Payment.ts:104

Prepares ethereum transaction object for a trustlines transfer, where loaded user is sender.

Parameters:#

NameTypeDefault valueDescription
networkAddressstring-Address of a currency network.
receiverAddressstring-Address of receiver of transfer.
valuenumber | string-Amount to transfer in biggest unit, i.e. 1.5 if currency network has 2 decimals.
optionsPaymentOptions{ addTransferId: true }Optional payment options. See PaymentOptions for more information.

Returns: Promise<PaymentTxObject>


prepareEth#

â–¸ prepareEth(receiverAddress: string, value: number | string, options?: PaymentOptions): Promise<TxObject>

Defined in src/Payment.ts:192

Prepares a ethereum transaction object for a ETH transfer, where loaded user is the sender.

Parameters:#

NameTypeDefault valueDescription
receiverAddressstring-Address of receiver of transfer.
valuenumber | string-Amount of ETH to transfer.
optionsPaymentOptions{}Payment options. See PaymentOptions for more information.

Returns: Promise<TxObject>