Add hex and txKey for monero pending transaction.

This commit is contained in:
M 2022-06-22 12:39:48 +01:00
parent 06a6d8d8bb
commit 76fe14c9a5
7 changed files with 37 additions and 3 deletions

View file

@ -24,6 +24,9 @@ class PendingBitcoinTransaction with PendingTransaction {
@override
String get id => _tx.getId();
@override
String get hex => '';
@override
String get amountFormatted => bitcoinAmountToString(amount: amount);

View file

@ -2,6 +2,7 @@ mixin PendingTransaction {
String get id;
String get amountFormatted;
String get feeFormatted;
String get hex;
Future<void> commit();
}

View file

@ -22,6 +22,9 @@ class PendingHavenTransaction with PendingTransaction {
@override
String get id => pendingTransactionDescription.hash;
@override
String get hex => '';
@override
String get amountFormatted => AmountConverter.amountIntToString(
cryptoCurrency, pendingTransactionDescription.amount);

View file

@ -166,6 +166,8 @@ extern "C"
uint64_t amount;
uint64_t fee;
char *hash;
char *hex;
char *txKey;
Monero::PendingTransaction *transaction;
PendingTransactionRaw(Monero::PendingTransaction *_transaction)
@ -174,6 +176,8 @@ extern "C"
amount = _transaction->amount();
fee = _transaction->fee();
hash = strdup(_transaction->txid()[0].c_str());
hex = strdup(_transaction->hex()[0].c_str());
txKey = strdup(_transaction->txKey()[0].c_str());
}
};
@ -228,8 +232,6 @@ extern "C"
bool create_wallet(char *path, char *password, char *language, int32_t networkType, char *error)
{
Monero::WalletManagerFactory::setLogLevel(4);
Monero::NetworkType _networkType = static_cast<Monero::NetworkType>(networkType);
Monero::WalletManager *walletManager = Monero::WalletManagerFactory::getWalletManager();
Monero::Wallet *wallet = walletManager->createWallet(path, password, language, _networkType);

View file

@ -10,14 +10,30 @@ class PendingTransactionRaw extends Struct {
Pointer<Utf8> hash;
Pointer<Utf8> hex;
Pointer<Utf8> txKey;
String getHash() => Utf8.fromUtf8(hash);
String getHex() => Utf8.fromUtf8(hex);
String getKey() => Utf8.fromUtf8(txKey);
}
class PendingTransactionDescription {
PendingTransactionDescription({this.amount, this.fee, this.hash, this.pointerAddress});
PendingTransactionDescription({
this.amount,
this.fee,
this.hash,
this.hex,
this.txKey,
this.pointerAddress});
final int amount;
final int fee;
final String hash;
final String hex;
final String txKey;
final int pointerAddress;
}

View file

@ -104,6 +104,8 @@ PendingTransactionDescription createTransactionSync(
amount: pendingTransactionRawPointer.ref.amount,
fee: pendingTransactionRawPointer.ref.fee,
hash: pendingTransactionRawPointer.ref.getHash(),
hex: pendingTransactionRawPointer.ref.getHex(),
txKey: pendingTransactionRawPointer.ref.getKey(),
pointerAddress: pendingTransactionRawPointer.address);
}
@ -157,6 +159,8 @@ PendingTransactionDescription createTransactionMultDestSync(
amount: pendingTransactionRawPointer.ref.amount,
fee: pendingTransactionRawPointer.ref.fee,
hash: pendingTransactionRawPointer.ref.getHash(),
hex: pendingTransactionRawPointer.ref.getHex(),
txKey: pendingTransactionRawPointer.ref.getKey(),
pointerAddress: pendingTransactionRawPointer.address);
}

View file

@ -22,6 +22,11 @@ class PendingMoneroTransaction with PendingTransaction {
@override
String get id => pendingTransactionDescription.hash;
@override
String get hex => pendingTransactionDescription.hex;
String get txKey => pendingTransactionDescription.txKey;
@override
String get amountFormatted => AmountConverter.amountIntToString(
CryptoCurrency.xmr, pendingTransactionDescription.amount);