Send tokens
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user