SEP38QuoteService class
Implements SEP-0038 - Anchor RFQ API. See Anchor RFQ API.
Constructors
- SEP38QuoteService(String _serviceAddress, {Client? httpClient})
-
Constructor accepting the
serviceAddress
from the server (ANCHOR_QUOTE_SERVER in stellar.toml). It also accepts an optionalhttpClient
to be used for requests. If not provided, this service will use its own http client.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpClient ↔ Client
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
errorFromResponseBody(
String body) → String -
getQuote(
String id, String jwtToken) → Future< SEP38QuoteResponse> -
This endpoint can be used to fetch a previously-provided firm quote by
id
. NeedsjwtToken
token obtained before with SEP-0010. -
info(
{String? jwtToken}) → Future< SEP38InfoResponse> -
This endpoint returns the supported Stellar assets and off-chain assets available for trading.
See: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0038.md#get-info
It also accepts an optional
jwtToken
token obtained before with SEP-0010. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
postQuote(
SEP38PostQuoteRequest request, String jwtToken) → Future< SEP38QuoteResponse> -
This endpoint can be used to request a firm quote for a Stellar asset and off-chain asset pair.
Needs
jwtToken
token obtained before with SEP-0010. -
price(
{required String context, required String sellAsset, required String buyAsset, String? sellAmount, String? buyAmount, String? sellDeliveryMethod, String? buyDeliveryMethod, String? countryCode, String? jwtToken}) → Future< SEP38PriceResponse> -
This endpoint can be used to fetch the indicative price for a given asset pair.
See: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0038.md#get-price
The client must provide either
sellAmount
orbuyAmount
, but not both. Parameters:context
The context for what this quote will be used for. Must be one of 'sep6' or 'sep31'.sellAsset
The asset the client would like to sell. Ex. stellar:USDC:G..., iso4217:ARSbuyAsset
The asset the client would like to exchange forsellAsset
.sellAmount
optional, the amount ofsellAsset
the client would like to exchange forbuyAsset
.buyAmount
optional, the amount ofbuyAsset
the client would like to exchange forsellAsset
.sellDeliveryMethod
optional, one of the name values specified by the sell_delivery_methods array for the associated asset returned from GET /info. Can be provided if the user is delivering an off-chain asset to the anchor but is not strictly required.buyDeliveryMethod
optional, one of the name values specified by the buy_delivery_methods array for the associated asset returned from GET /info. Can be provided if the user intends to receive an off-chain asset from the anchor but is not strictly required.countryCode
Optional, The ISO 3166-2 or ISO-3166-1 alpha-2 code of the user's current address. Should be provided if there are two or more country codes available for the desired asset in GET /info. It also accepts an optionaljwtToken
token obtained before with SEP-0010. -
prices(
{required String sellAsset, required String sellAmount, String? sellDeliveryMethod, String? buyDeliveryMethod, String? countryCode, String? jwtToken}) → Future< SEP38PricesResponse> -
This endpoint can be used to fetch the indicative prices of available off-chain assets in exchange for a Stellar asset and vice versa.
It accepts following parameters:
sellAsset
The asset you want to sell, using the Asset Identification Format.sellAmount
The amount of sell_asset the client would exchange for each of the buy_assets.sellDeliveryMethod
Optional, one of the name values specified by the sell_delivery_methods array for the associated asset returned from GET /info. Can be provided if the user is delivering an off-chain asset to the anchor but is not strictly required.buyDeliveryMethod
Optional, one of the name values specified by the buy_delivery_methods array for the associated asset returned from GET /info. Can be provided if the user intends to receive an off-chain asset from the anchor but is not strictly required.countryCode
Optional, The ISO 3166-2 or ISO-3166-1 alpha-2 code of the user's current address. Should be provided if there are two or more country codes available for the desired asset in GET /info. It also accepts an optionaljwtToken
token obtained before with SEP-0010. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromDomain(
String domain, {Client? httpClient}) → Future< SEP38QuoteService> -
Creates an instance of this class by loading the anchor quote server sep 38 url from the given
domain
stellar toml file (ANCHOR_QUOTE_SERVER). It also accepts an optionalhttpClient
to be used for all requests. If not provided, this service will use its own http client.