Send tokens

This commit is contained in:
2025-07-06 14:39:01 +07:00
parent c7dec76809
commit f973be2e08
13 changed files with 693 additions and 12 deletions

View File

@@ -213,6 +213,36 @@ namespace Managing.Infrastructure.Evm.Services
};
}
public async Task<SwapInfos> SendTokenAsync(string senderAddress, string recipientAddress, Ticker ticker, decimal amount, int? chainId = null)
{
var payload = new
{
senderAddress,
recipientAddress,
ticker = ticker.ToString(),
amount = amount.ToString(), // Convert decimal to string for bigint compatibility
chainId
};
var response = await CallPrivyServiceAsync<Web3ProxyTokenSendResponse>("/send-token", payload);
if (response == null)
{
throw new Web3ProxyException("Token send response is null");
}
// Map from infrastructure model to domain model
return new SwapInfos
{
Success = response.Success,
Hash = response.Hash,
Message = null, // Web3ProxyTokenSendResponse doesn't have Message property
Error = response.Error,
ErrorType = null, // Web3ProxyTokenSendResponse doesn't have ErrorType property
Suggestion = null // Web3ProxyTokenSendResponse doesn't have Suggestion property
};
}
private async Task HandleErrorResponse(HttpResponseMessage response)
{
var statusCode = (int)response.StatusCode;