Sweep selected outputs

This commit is contained in:
pokkst 2022-09-22 05:15:16 -05:00
parent 223f8a5edf
commit 3076777c53
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF
4 changed files with 61 additions and 1 deletions

View file

@ -979,6 +979,35 @@ Java_net_mynero_wallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject inst
return reinterpret_cast<jlong>(tx);
}
JNIEXPORT jlong JNICALL
Java_net_mynero_wallet_model_Wallet_createTransactionSingleJ(JNIEnv *env, jobject instance,
jstring key_image, jstring dst_addr,
jint priority) {
const char *_key_image = env->GetStringUTFChars(key_image, nullptr);
const char *_dst_addr = env->GetStringUTFChars(dst_addr, nullptr);
Monero::PendingTransaction::Priority _priority =
static_cast<Monero::PendingTransaction::Priority>(priority);
Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance);
Monero::PendingTransaction *tx = wallet->createTransactionSingle(_key_image, _dst_addr, _priority);
env->ReleaseStringUTFChars(key_image, _key_image);
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
return reinterpret_cast<jlong>(tx);
}
JNIEXPORT jlong JNICALL
Java_net_mynero_wallet_model_Wallet_createTransactionSelectedJ(JNIEnv *env, jobject instance,
jobject key_images, jstring dst_addr,
jint priority) {
const std::vector<std::string> _key_images = java2cpp(env, key_images);
const char *_dst_addr = env->GetStringUTFChars(dst_addr, nullptr);
Monero::PendingTransaction::Priority _priority =
static_cast<Monero::PendingTransaction::Priority>(priority);
Monero::Wallet *wallet = getHandle<Monero::Wallet>(env, instance);
Monero::PendingTransaction *tx = wallet->createTransactionSelected(_key_images, _dst_addr, _priority);
env->ReleaseStringUTFChars(dst_addr, _dst_addr);
return reinterpret_cast<jlong>(tx);
}
JNIEXPORT jlong JNICALL
Java_net_mynero_wallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobject instance,
jstring dst_addr, jstring payment_id,

View file

@ -25,6 +25,7 @@ import net.mynero.wallet.data.TxData;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import lombok.Getter;
@ -302,6 +303,10 @@ public class Wallet {
int mixin_count,
int priority, int accountIndex);
private native long createTransactionSingleJ(String key_image, String dst_addr, int priority);
private native long createTransactionSelectedJ(List<String> key_images, String dst_addr, int priority);
public PendingTransaction createSweepUnmixableTransaction() {
disposePendingTransaction();
long txHandle = createSweepUnmixableTransactionJ();

View file

@ -1 +1 @@
MONERUJO_monero main with monero release-v0.18.1.0-mynero
MONERUJO_monero feature/select-utxos with monero release-v0.18.1.0-mynero

View file

@ -907,6 +907,32 @@ struct Wallet
uint32_t subaddr_account = 0,
std::set<uint32_t> subaddr_indices = {}) = 0;
/*!
* \brief createTransactionSingle creates transaction with single input
* \param key_image key image as string
* \param dst_addr destination address as string
* \param priority
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
* after object returned
*/
virtual PendingTransaction * createTransactionSingle(const std::string &key_image, const std::string &dst_addr,
size_t outputs = 1, PendingTransaction::Priority = PendingTransaction::Priority_Low) = 0;
/*!
* \brief createTransactionSelected creates transaction with selected inputs
* \param key_images vector of key images as string
* \param dst_addr destination address as string
* \param outputs split amount into this many outputs of equal amount
* \param priority transaction priority
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
* after object returned
*/
virtual PendingTransaction * createTransactionSelected(const std::vector<std::string> &key_images, const std::string &dst_addr,
size_t outputs = 1, PendingTransaction::Priority = PendingTransaction::Priority_Low) = 0;
/*!
* \brief createSweepUnmixableTransaction creates transaction with unmixable outputs.
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()