Add Privy type wallet

This commit is contained in:
2025-03-05 10:36:54 +07:00
parent 30bf9d26f6
commit 988cc9eb61
21 changed files with 287 additions and 53 deletions

View File

@@ -37,6 +37,7 @@ public class EvmManager : IEvmManager
private readonly IEnumerable<ISubgraphPrices> _subgraphs;
private Dictionary<string, Dictionary<string, decimal>> _geckoPrices;
private readonly GmxV2Service _gmxV2Service;
private readonly IPrivyService _privyService;
private readonly List<Ticker> _eligibleTickers = new List<Ticker>()
{
@@ -44,12 +45,13 @@ public class EvmManager : IEvmManager
Ticker.PEPE, Ticker.DOGE, Ticker.UNI
};
public EvmManager(IEnumerable<ISubgraphPrices> subgraphs)
public EvmManager(IEnumerable<ISubgraphPrices> subgraphs, IPrivyService privyService)
{
var defaultChain = ChainService.GetEthereum();
_web3 = new Web3(defaultChain.RpcUrl);
_httpClient = new HttpClient();
_subgraphs = subgraphs;
_privyService = privyService;
_geckoPrices = _geckoPrices != null && _geckoPrices.Any()
? _geckoPrices
: new Dictionary<string, Dictionary<string, decimal>>();
@@ -657,4 +659,11 @@ public class EvmManager : IEvmManager
var chain = ChainService.GetChain(Constants.Chains.Arbitrum);
return new Web3(wallet, chain.RpcUrl);
}
public async Task<(string Id, string Address)> CreatePrivyWallet()
{
var privyWallet = await _privyService.CreateWalletAsync();
return (privyWallet.Id, privyWallet.Address);
}
}