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:
#
Hierarchy- Payment
#
Methods#
calculateTransferGasLimitâ–¸ calculateTransferGasLimit(pathLength
: number): BigNumber
Defined in src/Payment.ts:380
#
Parameters:Name | Type |
---|---|
pathLength | number |
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:Name | Type | Description |
---|---|---|
rawTx | RawTxObject | Raw 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:Name | Type | Description |
---|---|---|
__namedParameters | { rawTx: RawTxObject ; receiverAddress: string ; transferId: string } | - |
message? | string | The 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:Name | Type | Description |
---|---|---|
networkAddress | string | Address 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:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of currency network. |
filter | EventFilterOptions | {} | 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:Name | Type | Description |
---|---|---|
networkAddress | string | |
receiverAddress | string |
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:Name | Type | Default value | Description |
---|---|---|---|
transferIdentifier | TransferIdentifier | - | 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:Name | Type | Default value | Description |
---|---|---|---|
transferIdentifier | TransferIdentifier | - | 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:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
senderAddress | string | - | Address of sender of transfer. |
receiverAddress | string | - | Address of receiver of transfer. |
value | number | string | - | Amount to transfer in biggest unit, i.e. 1.23 if currency network has 2 decimals. |
options | PaymentOptions | {} | 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:Name | Type | Default value | Description |
---|---|---|---|
networkAddress | string | - | Address of a currency network. |
receiverAddress | string | - | Address of receiver of transfer. |
value | number | string | - | Amount to transfer in biggest unit, i.e. 1.5 if currency network has 2 decimals. |
options | PaymentOptions | { 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:Name | Type | Default value | Description |
---|---|---|---|
receiverAddress | string | - | Address of receiver of transfer. |
value | number | string | - | Amount of ETH to transfer. |
options | PaymentOptions | {} | Payment options. See PaymentOptions for more information. |
Returns: Promise<TxObject>