Stellar PHP SDK API Documentation

SEP38PriceResponse
in package

Indicative price response for a single asset pair via SEP-38.

This class represents an indicative (non-binding) price quote for exchanging one asset for another. Unlike firm quotes, these prices are not guaranteed and are provided for estimation purposes only.

The price relationship follows the formula: sell_amount = total_price * buy_amount

Tags
see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0038.md#get-price
see
QuoteService::price()
see
SEP38Fee

Table of Contents

Properties

$buyAmount  : string
$fee  : SEP38Fee
$price  : string
$sellAmount  : string
$totalPrice  : string

Methods

__construct()  : mixed
fromJson()  : SEP38PriceResponse
Constructs a new instance of SEP38PriceResponse by using the given data.

Properties

Methods

__construct()

public __construct(string $totalPrice, string $price, string $sellAmount, string $buyAmount, SEP38Fee $fee) : mixed
Parameters
$totalPrice : string

The total price of the quote including fees. Used in formula: sell_amount = total_price * buy_amount

$price : string

The exchange rate without fees.

$sellAmount : string

The amount of the sell asset.

$buyAmount : string

The amount of the buy asset.

$fee : SEP38Fee

The fee structure for this price.

fromJson()

Constructs a new instance of SEP38PriceResponse by using the given data.

public static fromJson(array<string|int, mixed> $json) : SEP38PriceResponse
Parameters
$json : array<string|int, mixed>

the data to construct the object from.

Return values
SEP38PriceResponse

the object containing the parsed data.


        
On this page

Search results