diff --git a/faucet-api/Controllers/FaucetController.cs b/faucet-api/Controllers/FaucetController.cs index 379ad53..ee3b033 100644 --- a/faucet-api/Controllers/FaucetController.cs +++ b/faucet-api/Controllers/FaucetController.cs @@ -65,12 +65,6 @@ public FaucetController(IOptions bitcoinSettings, IIndexerServi _indexerService = indexerService ?? throw new ArgumentNullException(nameof(indexerService), "IndexerService is not provided."); } - [HttpGet("send/{address}/{address2}/{amount?}")] - public async Task SendFunds(string address, string address2, long? amount) - { - return await SendFunds(new SendRequest { ToAddress = address, Amount = amount ?? 20, ToAddress2 = address2, Amount2 = amount ?? 20 }); - } - [HttpGet("send/{address}/{amount?}")] public async Task SendFunds(string address, long? amount) { @@ -89,9 +83,6 @@ public async Task SendFunds([FromBody] SendRequest request) var toAddress = BitcoinAddress.Create(request.ToAddress, _network); var amount = Money.Coins(request.Amount); - BitcoinAddress? toAddress2 = !string.IsNullOrEmpty(request.ToAddress2) ? BitcoinAddress.Create(request.ToAddress2, _network) : null; - Money amount2 = Money.Coins(request.Amount2 > 0 ? request.Amount2 : request.Amount); - var keyPath = new KeyPath($"m/84'/1'/0'/0/{_bitcoinSettings.ChangeAddressIndex}"); var privateKey = _masterKey.Derive(keyPath).PrivateKey; var fromAddress = privateKey.PubKey.GetAddress(ScriptPubKeyType.Segwit, _network); @@ -109,18 +100,13 @@ public async Task SendFunds([FromBody] SendRequest request) }).Take(2).ToList(); var txBuilder = _network.CreateTransactionBuilder(); - var txbuilder = txBuilder + var tx = txBuilder .AddCoins(coins) .AddKeys(privateKey) .Send(toAddress, amount) .SetChange(fromAddress) - .SendFees(Money.Satoshis(_bitcoinSettings.FeeRate)); - - - if (toAddress2 != null) - txbuilder.Send(toAddress2, amount2); - - var tx = txbuilder.BuildTransaction(true); + .SendFees(Money.Satoshis(_bitcoinSettings.FeeRate)) + .BuildTransaction(true); if (!txBuilder.Verify(tx)) { @@ -220,9 +206,7 @@ public async Task CheckNetworkStatus() public class SendRequest { public string ToAddress { get; set; } - public string ToAddress2 { get; set; } public decimal Amount { get; set; } - public decimal Amount2 { get; set; } } } } diff --git a/faucet-api/Directory.Build.props b/faucet-api/Directory.Build.props index 788e84f..99a5163 100644 --- a/faucet-api/Directory.Build.props +++ b/faucet-api/Directory.Build.props @@ -1,6 +1,6 @@ - 1.0.14 + 1.0.15 Blockcore MIT https://github.com/block-core/bitcoin-custom-signet diff --git a/faucet-api/docker-compose.yml b/faucet-api/docker-compose.yml index d49f2a4..9e99f67 100644 --- a/faucet-api/docker-compose.yml +++ b/faucet-api/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.8' services: faucet-api: container_name: faucet-api - image: blockcore/faucet-api:1.0.14 + image: blockcore/faucet-api:1.0.15 mem_limit: 1024m cpus: 0.200 environment: diff --git a/package.json b/package.json index fe948bd..4c6e823 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "faucet-api", - "version": "1.0.14", + "version": "1.0.15", "description": "Claim free Bitcoin instantly with your Testnet wallet address. Simple and secure!", "main": "index.js", "scripts": {