Skip to main content

SEP-1: Stellar TOML

The stellar.toml file is a common place where the Internet can find information about an organization’s Stellar integration. Regardless of which type of transfer we want to use (SEP-6 or SEP-24), we'll need to start with SEP-1.

For anchors, we’re interested in the CURRENCIES they issue, the TRANSFER_SERVER and/or TRANSFER_SERVER_SEP0024 keywords that indicate if the anchor supports SEP-6, SEP-24, or both, and the WEB_AUTH_ENDPOINT which allows a wallet to set up an authenticated user session.

BasicPay is interoperating with the testing anchor located at testanchor.stellar.org and you can view its toml file here.

import { StellarTomlResolver } from "stellar-sdk";

// Fetches and returns the stellar.toml file hosted by a provided domain.
export async function fetchStellarToml(domain) {
let stellarToml = await StellarTomlResolver.resolve(domain);
return stellarToml;
}

Source: https://github.com/stellar/basic-payment-app/blob/main/src/lib/stellar/sep1.js

Strictly speaking, the StellarTomlResolver function from the JavaScript SDK is the only function we need to retrieve and use the information provided by the anchor (heck, we could even just write our own fetch-based function, and bypass the SDK altogether). However, we've created quite a few "helper" functions to make the rest of our queries a bit more verbose and clear as to what we're looking for from the anchor server. Make sure to check out the sep1.js source file linked above!

Using the stellar.toml information for an asset with a home_domain, we can display to the user some options (depending on the available infrastructure). We'll start with SEP-10 authentication.