Version: 0.13.7

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:376

Parameters:#

NameType
pathLengthnumber

Returns: BigNumber


confirm#

confirm(rawTx: RawTxObject): Promise<any>

Defined in src/Payment.ts:286

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:299

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:326

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:270

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:353

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:393

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:421

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:223

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:102

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:188

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>