From 910fdc9d2e4314d5ce0dce66ecb03db48d7204c9 Mon Sep 17 00:00:00 2001 From: Philip Liu <12836897+philipliu@users.noreply.github.com> Date: Fri, 16 Jun 2023 15:23:06 -0400 Subject: [PATCH] Add native asset support to SEP-24 (#1363) * Mention XLM in the SEP-24 docs * Fix changelog and date * Fix withdrawal account * Add note about XLM * Prettier * Apply suggestions from code review Wording changes Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --------- Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- ecosystem/sep-0024.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/ecosystem/sep-0024.md b/ecosystem/sep-0024.md index 10d655785..70a00440f 100644 --- a/ecosystem/sep-0024.md +++ b/ecosystem/sep-0024.md @@ -6,8 +6,8 @@ Title: Hosted Deposit and Withdrawal Author: SDF Status: Active Created: 2019-09-18 -Updated: 2023-02-06 -Version 3.0.0 +Updated: 2023-06-14 +Version 3.1.0 ``` ## Simple Summary @@ -324,8 +324,8 @@ Request Parameters: | Name | Type | Description | | ----------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `asset_code` | string | The code of the stellar asset the user wants to receive for their deposit with the anchor. The value passed must match one of the codes listed in the [/info](#info) response's deposit object. | -| `asset_issuer` | string | (optional) The issuer of the stellar asset the user wants to receive for their deposit with the anchor. If asset_issuer is not provided, the anchor should use the asset issued by themselves as described in their TOML file. | +| `asset_code` | string | The code of the stellar asset the user wants to receive for their deposit with the anchor. The value passed must match one of the codes listed in the [/info](#info) response's deposit object. `native` is a special `asset_code` that represents the native XLM token. | +| `asset_issuer` | string | (optional) The issuer of the stellar asset the user wants to receive for their deposit with the anchor. If asset_issuer is not provided, the anchor should use the asset issued by themselves as described in their TOML file. If `native` is specified as the `asset_code`, `asset_issuer` must be not be set. | | `amount` | number | (optional) Amount of asset requested to deposit. If this is not provided it will be collected in the interactive flow. | | `account` | `G...` or `M...` string | (optional) The Stellar or muxed account the client wants to use as the destination of the payment sent by the anchor. Defaults to the account authenticated via SEP-10 if not specified. | | `memo_type` | string | (optional) Type of memo that anchor should attach to the Stellar transaction, one of `text`, `id` or `hash`. | @@ -518,8 +518,8 @@ Request parameters: | Name | Type | Description | | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `asset_code` | string | Code of the asset the user wants to withdraw. The value passed must match one of the codes listed in the [/info](#info) response's withdraw object. | -| `asset_issuer` | string | (optional) The issuer of the stellar asset the user wants to withdraw with the anchor. If asset_issuer is not provided, the anchor should use the asset issued by themselves as described in their TOML file. | +| `asset_code` | string | Code of the asset the user wants to withdraw. The value passed must match one of the codes listed in the [/info](#info) response's withdraw object. `native` is a special `asset_code` that represents the native XLM token. | +| `asset_issuer` | string | (optional) The issuer of the stellar asset the user wants to withdraw with the anchor. If asset_issuer is not provided, the anchor should use the asset issued by themselves as described in their TOML file. If `native` is specified as the `asset_code`, `asset_issuer` must be not be set. | | `amount` | number | (optional) Amount of asset requested to withdraw. If this is not provided it will be collected in the interactive flow. | | `account` | `G...` or `M...` string | (optional) The Stellar or muxed account the client will use as the source of the withdrawal payment to the anchor. Defaults to the account authenticated via SEP-10 if not specified. | | `memo` | string | (**deprecated**, optional) This field was originally intended to differentiate users of the same Stellar account. However, the anchor should use the `sub` value included in the decoded SEP-10 JWT instead. Anchors should still support this parameter to maintain support for outdated clients. See the [Shared Account Authentication](#shared-omnibus-or-pooled-accounts) section for more information. | @@ -768,6 +768,12 @@ wallet. For example: ## Info Allows an anchor to communicate basic info about what their `TRANSFER_SERVER_SEP0024` supports to wallets and clients. +If an anchor supports the native asset, the `native` asset code with a `null` asset issuer should be included in the response. + +The `native` asset on the [Stellar Public Network][pubnet] is the [lumen (XLM)][lumen]. + +[pubnet]: https://developers.stellar.org/docs/fundamentals-and-concepts/testnet-and-pubnet +[lumen]: https://stellar.org/lumens ### Request @@ -799,6 +805,11 @@ The response should be a JSON object like: "enabled": true, "fee_fixed": 0.002, "fee_percent": 0 + }, + "native": { + "enabled": true, + "fee_fixed": 0.00001, + "fee_percent": 0 } }, "withdraw": { @@ -811,6 +822,9 @@ The response should be a JSON object like: }, "ETH": { "enabled": false + }, + "native": { + "enabled": true } }, "fee": { @@ -942,7 +956,7 @@ Request parameters: | Name | Type | Description | | --------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `asset_code` | string | The code of the asset of interest. E.g. BTC, ETH, USD, INR, etc. | +| `asset_code` | string | The code of the asset of interest. E.g. BTC, ETH, USD, INR, native, etc. | | `no_older_than` | UTC ISO 8601 string | (optional) The response should contain transactions starting on or after this date & time. | | `limit` | int | (optional) The response should contain at most `limit` transactions. | | `kind` | string | (optional) The kind of transaction that is desired. Should be either `deposit` or `withdrawal`. | @@ -996,7 +1010,7 @@ Each object in the `transactions` array should have the following fields: | Name | Type | Description | | ------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `withdraw_anchor_account` | string | If this is a withdrawal, this is the anchor's Stellar account that the user transferred (or will transfer) their issued asset to. | +| `withdraw_anchor_account` | string | If this is a withdrawal, this is the anchor's Stellar account that the user transferred (or will transfer) their asset to. | | `withdraw_memo` | string | Memo used when the user transferred to `withdraw_anchor_account`. Assigned null if the withdraw is not ready to receive payment, for example if KYC is not completed. | | `withdraw_memo_type` | string | Memo type for `withdraw_memo`. | | `from` | string | Stellar address the assets were withdrawn from | @@ -1276,6 +1290,7 @@ There is a small set of changes when upgrading from SEP-6 to SEP-24. ## Changelog +- `v3.1.0`: Add native asset support to SEP-24 ([#1363](https://github.com/stellar/stellar-protocol/pull/1363)) - `v3.0.0`: Make the `account` parameter for `POST /transactions/deposit/interactive` request optional ([#1343](https://github.com/stellar/stellar-protocol/pull/1343)) - `v2.9.2`: Remove confusing statement on `updated_at` matching `completed_at` when `status` is `refunded`