Configuration
Modify a Stellar Info File
Next, let's modify the stellar.toml
file created earlier. Wallets need to know that SEP-6 functionality is supported by your business, and they also need to know all the currencies you support.
- TOML
# dev.stellar.toml
ACCOUNTS = ["add your public keys for your distribution accounts here"]
SIGNING_KEY = "add your signing key here"
NETWORK_PASSPHRASE = "Test SDF Network ; September 2015"
TRANSFER_SERVER = "http://localhost:8080/sep6"
WEB_AUTH_ENDPOINT = "http://localhost:8080/auth"
# Add support for USDC
[[CURRENCIES]]
code = "USDC"
issuer = "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
status = "test"
is_asset_anchored = false
desc = "USD Coin issued by Circle"
[DOCUMENTATION]
ORG_NAME = "Your organization"
ORG_URL = "Your website"
ORG_DESCRIPTION = "A description of your organization"
Note that you will need to create another file for your production deployment that uses the public network's passphrase, your production service URLs, your Mainnet distribution accounts and signing key, as well as the Mainnet issuing accounts of the assets your service utilizes.
Enable Programmatic Deposits & Withdrawals
Now you're ready to enable programmatic deposits and withdrawals using the SEP-6 API. Specify the following in your dev.assets.yaml
file, and change the values depending on your use case. This example asset file enables support for Circle's USDC and a fiat USD to deposit from and withdraw to. The methods specified in the deposit
and withdraw
sections are the methods that will be exposed by the GET /info
SEP-6 endpoint under the type
field in the case of deposit
and types
field in the case of withdraw
.
- YAML
assets:
- schema: stellar
code: USDC
issuer: GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
distribution_account: GBLSAHONJRODSFTLOV225NZR4LHICH63RIFQTQN37L5CRTR2IMQ5UEK7
significant_decimals: 2
sep6_enabled: true
deposit:
enabled: true
methods:
- SEPA
- SWIFT
- cash
withdraw:
enabled: true
methods:
- bank_account
- cash
- schema: iso4217
code: USD
significant_decimals: 2
The information provided for the assets
value closely maps to the information that will be exposed to the wallet application using the GET /info
SEP-6 endpoint. The Anchor Platform also uses this information to validate requests made to your service.
Test With the Demo Wallet
Wallets should now be able to discover, authenticate, and initiate transactions with your service! Your project and source files should now look something like this.
- Example
├── dev.env
├── docker-compose.yaml
├── config
│ ├── dev.assets.yaml
│ ├── dev.stellar.toml
Your environment should now look like the following.
- bash
# dev.env
ASSETS_TYPE=file
ASSETS_VALUE=/home/dev.assets.yaml
SEP1_ENABLED=true
SEP1_TOML_TYPE=file
SEP1_TOML_VALUE=/home/dev.stellar.toml
SEP10_ENABLED=true
SEP10_HOME_DOMAIN=localhost:8080
SECRET_SEP10_SIGNING_SEED="a Stellar private key"
SECRET_SEP10_JWT_SECRET="a secret encryption key"
To test this out, go to the Stellar Demo Wallet.
Initiate a deposit transaction by doing the following:
- Create a new keypair
- Click the "Add Asset" button and enter
- the code of the Stellar asset on your
stellar.toml
file - your home domain,
localhost:8080
- the code of the Stellar asset on your
- Select the dropdown and click "SEP-6 Deposit", then click "Start"
The demo wallet should be able to find your stellar.toml
file, authenticate using the Stellar keypair you just created, and initiate a transaction.