Send tokens
This commit is contained in:
@@ -114,6 +114,28 @@ namespace Managing.Api.Controllers
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends tokens from a specific account to a recipient address.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the account to send tokens from.</param>
|
||||
/// <param name="request">The token sending request containing recipient address, ticker, and amount.</param>
|
||||
/// <returns>The transaction response with details.</returns>
|
||||
[HttpPost]
|
||||
[Route("{name}/send-token")]
|
||||
public async Task<ActionResult<SwapInfos>> SendToken(string name, [FromBody] SendTokenRequest request)
|
||||
{
|
||||
var user = await GetUser();
|
||||
var result = await _AccountService.SendTokenAsync(
|
||||
user,
|
||||
name,
|
||||
request.RecipientAddress,
|
||||
request.Ticker,
|
||||
request.Amount,
|
||||
request.ChainId
|
||||
);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a specific account by name for the authenticated user.
|
||||
/// </summary>
|
||||
|
||||
34
src/Managing.Api/Models/Requests/SendTokenRequest.cs
Normal file
34
src/Managing.Api/Models/Requests/SendTokenRequest.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Api.Models.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request model for token sending operations
|
||||
/// </summary>
|
||||
public class SendTokenRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The recipient's wallet address
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string RecipientAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ticker symbol of the token to send
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Ticker Ticker { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount to send
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Range(0.000001, double.MaxValue, ErrorMessage = "Amount must be greater than 0")]
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The chain ID where the transaction will be executed (optional, defaults to ARBITRUM)
|
||||
/// </summary>
|
||||
public int? ChainId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user