mirror of
https://github.com/LORDBABUINO/stealth.git
synced 2026-06-17 09:29:44 -07:00
Feat: Backend commit
This commit is contained in:
@@ -79,7 +79,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>1.9.22</version>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
||||
+7
-1
@@ -4,13 +4,19 @@ import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import org.backend.stealth.service.impl.WalletController;
|
||||
import org.bitcoindevkit.BdkException;
|
||||
|
||||
@Path("/hello")
|
||||
public class ExampleResponse {
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String hello() {
|
||||
public String hello() throws BdkException {
|
||||
|
||||
WalletController controller = new WalletController();
|
||||
controller.ConnectWallet();
|
||||
|
||||
return "Hello from Quarkus REST";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.backend.stealth.domain.entity;
|
||||
|
||||
public class UTXO {
|
||||
|
||||
private String value;
|
||||
private String scriptPubKey;
|
||||
private String txid;
|
||||
private Integer vout;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package org.backend.stealth.service.impl;
|
||||
|
||||
import org.bitcoindevkit.*;
|
||||
|
||||
public class WalletController {
|
||||
|
||||
public void ConnectWallet() throws BdkException {
|
||||
|
||||
Mnemonic mnemonic = new Mnemonic(WordCount.WORDS12);
|
||||
|
||||
DescriptorSecretKey masterKey = new DescriptorSecretKey(
|
||||
Network.REGTEST,
|
||||
mnemonic,
|
||||
""
|
||||
);
|
||||
|
||||
String externalDescStr = "wpkh(" + masterKey.asString() + "/84'/1'/0'/0/*)";
|
||||
|
||||
Descriptor externalDescriptor = new Descriptor(externalDescStr, Network.REGTEST);
|
||||
|
||||
Wallet wallet = new Wallet(
|
||||
externalDescriptor,
|
||||
null, // changeDescriptor (pode continuar null por enquanto)
|
||||
Network.REGTEST,
|
||||
DatabaseConfig.Memory.INSTANCE
|
||||
);
|
||||
|
||||
System.out.println("✅ Carteira criada com sucesso! Endereço: " +
|
||||
wallet.getAddress(AddressIndex.New.INSTANCE).getAddress());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.backend.stealth.utils;
|
||||
|
||||
public class WalletUtils {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user