summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--impls/monero.dart/lib/monero.dart33
-rw-r--r--impls/monero.dart/lib/src/generated_bindings_monero.g.dart20
-rw-r--r--impls/monero.dart/lib/src/monero.dart12
-rw-r--r--impls/monero.dart/lib/src/wallet2.dart2
-rw-r--r--impls/monero.dart/lib/src/wownero.dart1006
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp9
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h1
-rw-r--r--patches/monero/0021-trezor-import-export-sign-functions.patch422
8 files changed, 1090 insertions, 415 deletions
diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart
index ef1da28..10317b6 100644
--- a/impls/monero.dart/lib/monero.dart
+++ b/impls/monero.dart/lib/monero.dart
@@ -570,8 +570,7 @@ String UnsignedTransaction_signUR(
}
@Deprecated("TODO")
-String PendingTransaction_commitTrezor(
- PendingTransaction ptr, int tx_index) {
+String PendingTransaction_commitTrezor(PendingTransaction ptr, int tx_index) {
debugStart?.call('MONERO_PendingTransaction_commitTrezor');
lib ??= MoneroC(DynamicLibrary.open(libPath));
final txid = lib!.MONERO_PendingTransaction_commitTrezor(ptr, tx_index);
@@ -589,6 +588,19 @@ String PendingTransaction_commitTrezor(
}
}
+@Deprecated("TODO")
+bool PendingTransaction_commitTrezorNext(
+ PendingTransaction ptr, String response_json, int tx_index) {
+ debugStart?.call('MONERO_PendingTransaction_commitTrezorNext');
+ lib ??= MoneroC(DynamicLibrary.open(libPath));
+ final response_jsonC = response_json.toNativeUtf8();
+ final result = lib!.MONERO_PendingTransaction_commitTrezorNext(
+ ptr, response_jsonC.cast(), tx_index);
+ calloc.free(response_jsonC);
+ debugEnd?.call('MONERO_PendingTransaction_commitTrezorNext');
+ return result;
+}
+
// TransactionInfo
typedef TransactionInfo = Pointer<Void>;
@@ -3616,7 +3628,9 @@ void Wallet_setDeviceSendData(Pointer<UnsignedChar> data, int len) {
}
@Deprecated("TODO")
-void Wallet_setLedgerCallback(Pointer<NativeFunction<Void Function(Pointer<UnsignedChar>, UnsignedInt)>> callback) {
+void Wallet_setLedgerCallback(
+ Pointer<NativeFunction<Void Function(Pointer<UnsignedChar>, UnsignedInt)>>
+ callback) {
debugStart?.call('MONERO_Wallet_setDeviceSendData');
lib ??= MoneroC(DynamicLibrary.open(libPath));
final ret = lib!.MONERO_Wallet_setLedgerCallback(callback);
@@ -3640,7 +3654,8 @@ bool Wallet_importTrezorEncryptedKeyImagesJson(wallet ptr, String json) {
debugStart?.call('MONERO_Wallet_importTrezorEncryptedKeyImagesJson');
lib ??= MoneroC(DynamicLibrary.open(libPath));
final jsonStr = json.toNativeUtf8();
- final ret = lib!.MONERO_Wallet_importTrezorEncryptedKeyImagesJson(ptr, jsonStr.cast());
+ final ret = lib!
+ .MONERO_Wallet_importTrezorEncryptedKeyImagesJson(ptr, jsonStr.cast());
malloc.free(jsonStr);
debugEnd?.call('MONERO_Wallet_importTrezorEncryptedKeyImagesJson');
return ret;
@@ -3924,11 +3939,11 @@ bool WalletManager_verifyWalletPassword(
@Deprecated("TODO")
int WalletManager_queryWalletDevice(
- WalletManager wm_ptr, {
- required String keysFileName,
- required String password,
- required int kdfRounds,
- }) {
+ WalletManager wm_ptr, {
+ required String keysFileName,
+ required String password,
+ required int kdfRounds,
+}) {
debugStart?.call('MONERO_WalletManager_queryWalletDevice');
lib ??= MoneroC(DynamicLibrary.open(libPath));
final keysFileName_ = keysFileName.toNativeUtf8().cast<Char>();
diff --git a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart
index 36736d3..7c709ec 100644
--- a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart
+++ b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart
@@ -106,6 +106,26 @@ class MoneroC {
_MONERO_PendingTransaction_commitTrezorPtr.asFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Void>, int)>();
+ bool MONERO_PendingTransaction_commitTrezorNext(
+ ffi.Pointer<ffi.Void> pendingTx_ptr,
+ ffi.Pointer<ffi.Char> response_json,
+ int tx_index,
+ ) {
+ return _MONERO_PendingTransaction_commitTrezorNext(
+ pendingTx_ptr,
+ response_json,
+ tx_index,
+ );
+ }
+
+ late final _MONERO_PendingTransaction_commitTrezorNextPtr = _lookup<
+ ffi.NativeFunction<
+ ffi.Bool Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
+ ffi.Int)>>('MONERO_PendingTransaction_commitTrezorNext');
+ late final _MONERO_PendingTransaction_commitTrezorNext =
+ _MONERO_PendingTransaction_commitTrezorNextPtr.asFunction<
+ bool Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, int)>();
+
int MONERO_PendingTransaction_amount(
ffi.Pointer<ffi.Void> pendingTx_ptr,
) {
diff --git a/impls/monero.dart/lib/src/monero.dart b/impls/monero.dart/lib/src/monero.dart
index d227bef..780f0fc 100644
--- a/impls/monero.dart/lib/src/monero.dart
+++ b/impls/monero.dart/lib/src/monero.dart
@@ -423,6 +423,18 @@ class MoneroPendingTransaction implements Wallet2PendingTransaction {
}
@override
+ String commitTrezor(int tx_index) {
+ return monero.PendingTransaction_commitTrezor(
+ pendingTransactionPtr, tx_index);
+ }
+
+ @override
+ bool commitTrezorNext(String response_json, int tx_index) {
+ return monero.PendingTransaction_commitTrezorNext(
+ pendingTransactionPtr, response_json, tx_index);
+ }
+
+ @override
int dust() {
return monero.PendingTransaction_dust(pendingTransactionPtr);
}
diff --git a/impls/monero.dart/lib/src/wallet2.dart b/impls/monero.dart/lib/src/wallet2.dart
index 309621d..23e12ff 100644
--- a/impls/monero.dart/lib/src/wallet2.dart
+++ b/impls/monero.dart/lib/src/wallet2.dart
@@ -151,6 +151,8 @@ abstract class Wallet2PendingTransaction {
void signMultisigTx();
String signersKeys(String separator);
String hex(String separator);
+ String commitTrezor(int tx_index);
+ bool commitTrezorNext(String response_json, int tx_index);
}
abstract class Wallet2Subaddress {
diff --git a/impls/monero.dart/lib/src/wownero.dart b/impls/monero.dart/lib/src/wownero.dart
index ebf576b..189176b 100644
--- a/impls/monero.dart/lib/src/wownero.dart
+++ b/impls/monero.dart/lib/src/wownero.dart
@@ -19,46 +19,53 @@ class WowneroAddressBook implements Wallet2AddressBook {
WowneroAddressBook(this.addressBookPtr);
final wownero.AddressBook addressBookPtr;
-
+
@override
- bool addRow({required String dstAddr, required String paymentId, required String description}) {
- return wownero.AddressBook_addRow(addressBookPtr, dstAddr: dstAddr, paymentId: paymentId, description: description);
+ bool addRow(
+ {required String dstAddr,
+ required String paymentId,
+ required String description}) {
+ return wownero.AddressBook_addRow(addressBookPtr,
+ dstAddr: dstAddr, paymentId: paymentId, description: description);
}
-
+
@override
bool deleteRow({required int rowId}) {
return wownero.AddressBook_deleteRow(addressBookPtr, rowId: rowId);
}
-
+
@override
int errorCode() {
return wownero.AddressBook_errorCode(addressBookPtr);
}
-
+
@override
Wallet2AddressBookRow getAll_byIndex(int index) {
- final row = wownero.AddressBook_getAll_byIndex(addressBookPtr, index: index);
+ final row =
+ wownero.AddressBook_getAll_byIndex(addressBookPtr, index: index);
return WowneroAddressBookRow(row);
}
-
+
@override
int getAll_size() {
return wownero.AddressBook_getAll_size(addressBookPtr);
}
-
+
@override
int lookupPaymentID({required String paymentId}) {
- return wownero.AddressBook_lookupPaymentID(addressBookPtr, paymentId: paymentId);
+ return wownero.AddressBook_lookupPaymentID(addressBookPtr,
+ paymentId: paymentId);
}
-
+
@override
void refresh() {
wownero.AddressBook_refresh(addressBookPtr);
}
-
+
@override
bool setDescription({required int rowId, required String description}) {
- return wownero.AddressBook_setDescription(addressBookPtr, rowId: rowId, description: description);
+ return wownero.AddressBook_setDescription(addressBookPtr,
+ rowId: rowId, description: description);
}
@override
@@ -69,27 +76,27 @@ class WowneroAddressBookRow implements Wallet2AddressBookRow {
WowneroAddressBookRow(this.addressBookRowPtr);
final wownero.AddressBookRow addressBookRowPtr;
-
+
@override
String extra() {
return wownero.AddressBookRow_extra(addressBookRowPtr);
}
-
+
@override
String getAddress() {
return wownero.AddressBookRow_getAddress(addressBookRowPtr);
}
-
+
@override
String getDescription() {
return wownero.AddressBookRow_getDescription(addressBookRowPtr);
}
-
+
@override
String getPaymentId() {
return wownero.AddressBookRow_getPaymentId(addressBookRowPtr);
}
-
+
@override
int getRowId() {
return wownero.AddressBookRow_getRowId(addressBookRowPtr);
@@ -103,54 +110,55 @@ class WowneroCoins implements Wallet2Coins {
WowneroCoins(this.coinsPtr);
final wownero.Coins coinsPtr;
-
+
@override
Wallet2CoinsInfo coin(int index) {
final coin = wownero.Coins_coin(coinsPtr, index);
return WowneroCoinsInfo(coin);
}
-
+
@override
int count() {
return wownero.Coins_count(coinsPtr);
}
-
+
@override
Wallet2CoinsInfo getAll_byIndex(int index) {
final coin = wownero.Coins_getAll_byIndex(coinsPtr, index);
return WowneroCoinsInfo(coin);
}
-
+
@override
int getAll_size() {
return wownero.Coins_getAll_size(coinsPtr);
}
-
+
@override
bool isTransferUnlocked({required int unlockTime, required int blockHeight}) {
- return wownero.Coins_isTransferUnlocked(coinsPtr, unlockTime: unlockTime, blockHeight: blockHeight);
+ return wownero.Coins_isTransferUnlocked(coinsPtr,
+ unlockTime: unlockTime, blockHeight: blockHeight);
}
-
+
@override
void refresh() {
wownero.Coins_refresh(coinsPtr);
}
-
+
@override
void setFrozen({required int index}) {
wownero.Coins_setFrozen(coinsPtr, index: index);
}
-
+
@override
void setFrozenByPublicKey({required String publicKey}) {
wownero.Coins_setFrozenByPublicKey(coinsPtr, publicKey: publicKey);
}
-
+
@override
void thaw({required int index}) {
wownero.Coins_thaw(coinsPtr, index: index);
}
-
+
@override
void thawByPublicKey({required String publicKey}) {
wownero.Coins_thawByPublicKey(coinsPtr, publicKey: publicKey);
@@ -164,107 +172,107 @@ class WowneroCoinsInfo implements Wallet2CoinsInfo {
WowneroCoinsInfo(this.coinsInfoPtr);
final wownero.CoinsInfo coinsInfoPtr;
-
+
@override
String address() {
return wownero.CoinsInfo_address(coinsInfoPtr);
}
-
+
@override
String addressLabel() {
return wownero.CoinsInfo_addressLabel(coinsInfoPtr);
}
-
+
@override
int amount() {
return wownero.CoinsInfo_amount(coinsInfoPtr);
}
-
+
@override
int blockHeight() {
return wownero.CoinsInfo_blockHeight(coinsInfoPtr);
}
-
+
@override
bool coinbase() {
return wownero.CoinsInfo_coinbase(coinsInfoPtr);
}
-
+
@override
String description() {
return wownero.CoinsInfo_description(coinsInfoPtr);
}
-
+
@override
bool frozen() {
return wownero.CoinsInfo_frozen(coinsInfoPtr);
}
-
+
@override
int globalOutputIndex() {
return wownero.CoinsInfo_globalOutputIndex(coinsInfoPtr);
}
-
+
@override
String hash() {
return wownero.CoinsInfo_hash(coinsInfoPtr);
}
-
+
@override
int internalOutputIndex() {
return wownero.CoinsInfo_internalOutputIndex(coinsInfoPtr);
}
-
+
@override
String keyImage() {
return wownero.CoinsInfo_keyImage(coinsInfoPtr);
}
-
+
@override
bool keyImageKnown() {
return wownero.CoinsInfo_keyImageKnown(coinsInfoPtr);
}
-
+
@override
int pkIndex() {
return wownero.CoinsInfo_pkIndex(coinsInfoPtr);
}
-
+
@override
String pubKey() {
return wownero.CoinsInfo_pubKey(coinsInfoPtr);
}
-
+
@override
bool rct() {
return wownero.CoinsInfo_rct(coinsInfoPtr);
}
-
+
@override
bool spent() {
return wownero.CoinsInfo_spent(coinsInfoPtr);
}
-
+
@override
int spentHeight() {
return wownero.CoinsInfo_spentHeight(coinsInfoPtr);
}
-
+
@override
int subaddrAccount() {
return wownero.CoinsInfo_subaddrAccount(coinsInfoPtr);
}
-
+
@override
int subaddrIndex() {
return wownero.CoinsInfo_subaddrIndex(coinsInfoPtr);
}
-
+
@override
int unlockTime() {
return wownero.CoinsInfo_unlockTime(coinsInfoPtr);
}
-
+
@override
bool unlocked() {
return wownero.CoinsInfo_unlocked(coinsInfoPtr);
@@ -278,12 +286,12 @@ class WowneroDeviceProgress implements Wallet2DeviceProgress {
WowneroDeviceProgress(this.deviceProgressPtr);
final wownero.DeviceProgress deviceProgressPtr;
-
+
@override
bool indeterminate() {
return wownero.DeviceProgress_indeterminate(deviceProgressPtr);
}
-
+
@override
bool progress() {
return wownero.DeviceProgress_progress(deviceProgressPtr);
@@ -297,27 +305,29 @@ class WowneroWalletListener implements Wallet2WalletListener {
WowneroWalletListener(this.walletListenerPtr);
final wownero.WalletListener walletListenerPtr;
-
+
@override
int height() {
return wownero.WOWNERO_cw_WalletListener_height(walletListenerPtr);
}
-
+
@override
bool isNeedToRefresh() {
return wownero.WOWNERO_cw_WalletListener_isNeedToRefresh(walletListenerPtr);
}
-
+
@override
bool isNewTransactionExist() {
- return wownero.WOWNERO_cw_WalletListener_isNewTransactionExist(walletListenerPtr);
+ return wownero.WOWNERO_cw_WalletListener_isNewTransactionExist(
+ walletListenerPtr);
}
-
+
@override
void resetIsNewTransactionExist() {
- wownero.WOWNERO_cw_WalletListener_resetIsNewTransactionExist(walletListenerPtr);
+ wownero.WOWNERO_cw_WalletListener_resetIsNewTransactionExist(
+ walletListenerPtr);
}
-
+
@override
void resetNeedToRefresh() {
wownero.WOWNERO_cw_WalletListener_resetNeedToRefresh(walletListenerPtr);
@@ -334,12 +344,12 @@ class WowneroWalletChecksum implements Wallet2Checksum {
String checksum_wallet2_api_c_cpp() {
return wownero.WOWNERO_checksum_wallet2_api_c_cpp();
}
-
+
@override
String checksum_wallet2_api_c_exp() {
return wownero.WOWNERO_checksum_wallet2_api_c_exp();
}
-
+
@override
String checksum_wallet2_api_c_h() {
return wownero.WOWNERO_checksum_wallet2_api_c_h();
@@ -365,22 +375,22 @@ class WowneroMultisigState implements Wallet2MultisigState {
WowneroMultisigState(this.multisigStatePtr);
final wownero.MultisigState multisigStatePtr;
-
+
@override
bool isMultisig(Pointer<Void> ptr) {
return wownero.MultisigState_isMultisig(multisigStatePtr);
}
-
+
@override
bool isReady(Pointer<Void> ptr) {
return wownero.MultisigState_isReady(multisigStatePtr);
}
-
+
@override
int threshold(Pointer<Void> ptr) {
return wownero.MultisigState_threshold(multisigStatePtr);
}
-
+
@override
int total(Pointer<Void> ptr) {
return wownero.MultisigState_total(multisigStatePtr);
@@ -394,77 +404,81 @@ class WowneroPendingTransaction implements Wallet2PendingTransaction {
WowneroPendingTransaction(this.pendingTransactionPtr);
final wownero.PendingTransaction pendingTransactionPtr;
-
+
@override
int amount() {
return wownero.PendingTransaction_amount(pendingTransactionPtr);
}
-
+
@override
bool commit({required String filename, required bool overwrite}) {
- return wownero.PendingTransaction_commit(pendingTransactionPtr, filename: filename, overwrite: overwrite);
+ return wownero.PendingTransaction_commit(pendingTransactionPtr,
+ filename: filename, overwrite: overwrite);
}
-
+
@override
String commitUR(int max_fragment_length) {
throw UnimplementedError();
}
-
+
@override
int dust() {
return wownero.PendingTransaction_dust(pendingTransactionPtr);
}
-
+
@override
String errorString() {
return wownero.PendingTransaction_errorString(pendingTransactionPtr);
}
-
+
@override
int fee() {
return wownero.PendingTransaction_fee(pendingTransactionPtr);
}
-
+
@override
String hex(String separator) {
return wownero.PendingTransaction_hex(pendingTransactionPtr, separator);
}
-
+
@override
String multisigSignData() {
return wownero.PendingTransaction_multisigSignData(pendingTransactionPtr);
}
-
+
@override
void signMultisigTx() {
wownero.PendingTransaction_signMultisigTx(pendingTransactionPtr);
}
-
+
@override
String signersKeys(String separator) {
- return wownero.PendingTransaction_signersKeys(pendingTransactionPtr, separator);
+ return wownero.PendingTransaction_signersKeys(
+ pendingTransactionPtr, separator);
}
-
+
@override
int status() {
return wownero.PendingTransaction_status(pendingTransactionPtr);
}
-
+
@override
String subaddrAccount(String separator) {
- return wownero.PendingTransaction_subaddrAccount(pendingTransactionPtr, separator);
+ return wownero.PendingTransaction_subaddrAccount(
+ pendingTransactionPtr, separator);
}
-
+
@override
String subaddrIndices(String separator) {
- return wownero.PendingTransaction_subaddrIndices(pendingTransactionPtr, separator);
+ return wownero.PendingTransaction_subaddrIndices(
+ pendingTransactionPtr, separator);
}
-
+
@override
int txCount() {
return wownero.PendingTransaction_txCount(pendingTransactionPtr);
}
-
+
@override
String txid(String separator) {
return wownero.PendingTransaction_txid(pendingTransactionPtr, separator);
@@ -472,37 +486,50 @@ class WowneroPendingTransaction implements Wallet2PendingTransaction {
@override
int ffiAddress() => pendingTransactionPtr.address;
+
+ @override
+ String commitTrezor(int tx_index) => throw UnimplementedError();
+
+ @override
+ bool commitTrezorNext(String response_json, int tx_index) =>
+ throw UnimplementedError();
}
class WowneroSubaddress implements Wallet2Subaddress {
WowneroSubaddress(this.subaddressPtr);
final wownero.Subaddress subaddressPtr;
-
+
@override
void addRow({required int accountIndex, required String label}) {
- wownero.Subaddress_addRow(subaddressPtr, accountIndex: accountIndex, label: label);
+ wownero.Subaddress_addRow(subaddressPtr,
+ accountIndex: accountIndex, label: label);
}
-
+
@override
Wallet2SubaddressRow getAll_byIndex(int index) {
final row = wownero.Subaddress_getAll_byIndex(subaddressPtr, index: index);
return WowneroSubaddressRow(row);
}
-
+
@override
int getAll_size() {
return wownero.Subaddress_getAll_size(subaddressPtr);
}
-
+
@override
void refresh({required int accountIndex, required String label}) {
- wownero.Subaddress_refresh(subaddressPtr, accountIndex: accountIndex, label: label);
+ wownero.Subaddress_refresh(subaddressPtr,
+ accountIndex: accountIndex, label: label);
}
-
+
@override
- void setLabel({required int accountIndex, required int addressIndex, required String label}) {
- wownero.Subaddress_setLabel(subaddressPtr, accountIndex: accountIndex, addressIndex: addressIndex, label: label);
+ void setLabel(
+ {required int accountIndex,
+ required int addressIndex,
+ required String label}) {
+ wownero.Subaddress_setLabel(subaddressPtr,
+ accountIndex: accountIndex, addressIndex: addressIndex, label: label);
}
@override
@@ -513,31 +540,33 @@ class WowneroSubaddressAccount implements Wallet2SubaddressAccount {
WowneroSubaddressAccount(this.subaddressAccountPtr);
final wownero.SubaddressAccount subaddressAccountPtr;
-
+
@override
void addRow({required String label}) {
wownero.SubaddressAccount_addRow(subaddressAccountPtr, label: label);
}
-
+
@override
Wallet2SubaddressAccountRow getAll_byIndex(int index) {
- final row = wownero.SubaddressAccount_getAll_byIndex(subaddressAccountPtr, index: index);
+ final row = wownero.SubaddressAccount_getAll_byIndex(subaddressAccountPtr,
+ index: index);
return WowneroSubaddressAccountRow(row);
}
-
+
@override
int getAll_size() {
return wownero.SubaddressAccount_getAll_size(subaddressAccountPtr);
}
-
+
@override
void refresh() {
wownero.SubaddressAccount_refresh(subaddressAccountPtr);
}
-
+
@override
void setLabel({required int accountIndex, required String label}) {
- wownero.SubaddressAccount_setLabel(subaddressAccountPtr, accountIndex: accountIndex, label: label);
+ wownero.SubaddressAccount_setLabel(subaddressAccountPtr,
+ accountIndex: accountIndex, label: label);
}
@override
@@ -548,35 +577,36 @@ class WowneroSubaddressAccountRow implements Wallet2SubaddressAccountRow {
WowneroSubaddressAccountRow(this.subaddressAccountRowPtr);
final wownero.SubaddressAccountRow subaddressAccountRowPtr;
-
+
@override
String extra() {
return wownero.SubaddressAccountRow_extra(subaddressAccountRowPtr);
}
-
+
@override
String getAddress() {
return wownero.SubaddressAccountRow_getAddress(subaddressAccountRowPtr);
}
-
+
@override
String getBalance() {
return wownero.SubaddressAccountRow_getBalance(subaddressAccountRowPtr);
}
-
+
@override
String getLabel() {
return wownero.SubaddressAccountRow_getLabel(subaddressAccountRowPtr);
}
-
+
@override
int getRowId() {
return wownero.SubaddressAccountRow_getRowId(subaddressAccountRowPtr);
}
-
+
@override
String getUnlockedBalance() {
- return wownero.SubaddressAccountRow_getUnlockedBalance(subaddressAccountRowPtr);
+ return wownero.SubaddressAccountRow_getUnlockedBalance(
+ subaddressAccountRowPtr);
}
@override
@@ -587,22 +617,22 @@ class WowneroSubaddressRow implements Wallet2SubaddressRow {
WowneroSubaddressRow(this.subaddressRowPtr);
final wownero.SubaddressRow subaddressRowPtr;
-
+
@override
String extra() {
return wownero.SubaddressRow_extra(subaddressRowPtr);
}
-
+
@override
String getAddress() {
return wownero.SubaddressRow_getAddress(subaddressRowPtr);
}
-
+
@override
String getLabel() {
return wownero.SubaddressRow_getLabel(subaddressRowPtr);
}
-
+
@override
int getRowId() {
return wownero.SubaddressRow_getRowId(subaddressRowPtr);
@@ -616,31 +646,34 @@ class WowneroTransactionHistory implements Wallet2TransactionHistory {
WowneroTransactionHistory(this.transactionHistoryPtr);
final wownero.TransactionHistory transactionHistoryPtr;
-
+
@override
int count() {
return wownero.TransactionHistory_count(transactionHistoryPtr);
}
-
+
@override
void refresh() {
wownero.TransactionHistory_refresh(transactionHistoryPtr);
}
-
+
@override
void setTxNote({required String txid, required String note}) {
- wownero.TransactionHistory_setTxNote(transactionHistoryPtr, txid: txid, note: note);
+ wownero.TransactionHistory_setTxNote(transactionHistoryPtr,
+ txid: txid, note: note);
}
-
+
@override
Wallet2TransactionInfo transaction(int index) {
- final tx = wownero.TransactionHistory_transaction(transactionHistoryPtr, index: index);
+ final tx = wownero.TransactionHistory_transaction(transactionHistoryPtr,
+ index: index);
return WowneroTransactionInfo(tx);
}
-
+
@override
Wallet2TransactionInfo transactionById(String txid) {
- final tx = wownero.TransactionHistory_transactionById(transactionHistoryPtr, txid: txid);
+ final tx = wownero.TransactionHistory_transactionById(transactionHistoryPtr,
+ txid: txid);
return WowneroTransactionInfo(tx);
}
@@ -652,97 +685,97 @@ class WowneroTransactionInfo implements Wallet2TransactionInfo {
WowneroTransactionInfo(this.transactionInfoPtr);
final wownero.TransactionInfo transactionInfoPtr;
-
+
@override
int amount() {
return wownero.TransactionInfo_amount(transactionInfoPtr);
}
-
+
@override
int blockHeight() {
return wownero.TransactionInfo_blockHeight(transactionInfoPtr);
}
-
+
@override
int confirmations() {
return wownero.TransactionInfo_confirmations(transactionInfoPtr);
}
-
+
@override
String description() {
return wownero.TransactionInfo_description(transactionInfoPtr);
}
-
+
@override
int direction() {
return wownero.TransactionInfo_direction(transactionInfoPtr).index;
}
-
+
@override
int fee() {
return wownero.TransactionInfo_fee(transactionInfoPtr);
}
-
+
@override
String hash() {
return wownero.TransactionInfo_hash(transactionInfoPtr);
}
-
+
@override
bool isCoinbase() {
return wownero.TransactionInfo_isCoinbase(transactionInfoPtr);
}
-
+
@override
bool isFailed() {
return wownero.TransactionInfo_isFailed(transactionInfoPtr);
}
-
+
@override
bool isPending() {
return wownero.TransactionInfo_isPending(transactionInfoPtr);
}
-
+
@override
String label() {
return wownero.TransactionInfo_label(transactionInfoPtr);
}
-
+
@override
String paymentId() {
return wownero.TransactionInfo_paymentId(transactionInfoPtr);
}
-
+
@override
int subaddrAccount() {
return wownero.TransactionInfo_subaddrAccount(transactionInfoPtr);
}
-
+
@override
String subaddrIndex() {
return wownero.TransactionInfo_subaddrIndex(transactionInfoPtr);
}
-
+
@override
int timestamp() {
return wownero.TransactionInfo_timestamp(transactionInfoPtr);
}
-
+
@override
String transfers_address(int index) {
return wownero.TransactionInfo_transfers_address(transactionInfoPtr, index);
}
-
+
@override
int transfers_amount(int index) {
return wownero.TransactionInfo_transfers_amount(transactionInfoPtr, index);
}
-
+
@override
int transfers_count() {
return wownero.TransactionInfo_transfers_count(transactionInfoPtr);
}
-
+
@override
int unlockTime() {
return wownero.TransactionInfo_unlockTime(transactionInfoPtr);
@@ -756,67 +789,69 @@ class WowneroUnsignedTransaction implements Wallet2UnsignedTransaction {
WowneroUnsignedTransaction(this.unsignedTransactionPtr);
final wownero.UnsignedTransaction unsignedTransactionPtr;
-
+
@override
String amount() {
return wownero.UnsignedTransaction_amount(unsignedTransactionPtr);
}
-
+
@override
String confirmationMessage() {
- return wownero.UnsignedTransaction_confirmationMessage(unsignedTransactionPtr);
+ return wownero.UnsignedTransaction_confirmationMessage(
+ unsignedTransactionPtr);
}
-
+
@override
String errorString() {
return wownero.UnsignedTransaction_errorString(unsignedTransactionPtr);
}
-
+
@override
String fee() {
return wownero.UnsignedTransaction_fee(unsignedTransactionPtr);
}
-
+
@override
int minMixinCount() {
return wownero.UnsignedTransaction_minMixinCount(unsignedTransactionPtr);
}
-
+
@override
String mixin() {
return wownero.UnsignedTransaction_mixin(unsignedTransactionPtr);
}
-
+
@override
String paymentId() {
return wownero.UnsignedTransaction_paymentId(unsignedTransactionPtr);
}
-
+
@override
String recipientAddress() {
return wownero.UnsignedTransaction_recipientAddress(unsignedTransactionPtr);
}
-
+
@override
bool sign(String signedFileName) {
- return wownero.UnsignedTransaction_sign(unsignedTransactionPtr, signedFileName);
+ return wownero.UnsignedTransaction_sign(
+ unsignedTransactionPtr, signedFileName);
}
-
+
@override
String signUR(int max_fragment_length) {
throw UnimplementedError();
}
-
+
@override
int status() {
return wownero.UnsignedTransaction_status(unsignedTransactionPtr);
}
-
+
@override
int txCount() {
return wownero.UnsignedTransaction_txCount(unsignedTransactionPtr);
}
-
+
@override
int ffiAddress() => unsignedTransactionPtr.address;
@@ -828,696 +863,805 @@ class WowneroWallet implements Wallet2Wallet {
WowneroWallet(this.walletPtr);
final wownero.wallet walletPtr;
-
+
@override
void addSubaddress({required int accountIndex, String label = ""}) {
- wownero.Wallet_addSubaddress(walletPtr, accountIndex: accountIndex, label: label);
+ wownero.Wallet_addSubaddress(walletPtr,
+ accountIndex: accountIndex, label: label);
}
-
+
@override
void addSubaddressAccount({String label = ""}) {
wownero.Wallet_addSubaddressAccount(walletPtr, label: label);
}
-
+
@override
String address({int accountIndex = 0, int addressIndex = 0}) {
- return wownero.Wallet_address(walletPtr, accountIndex: accountIndex, addressIndex: addressIndex);
+ return wownero.Wallet_address(walletPtr,
+ accountIndex: accountIndex, addressIndex: addressIndex);
}
-
+
@override
Wallet2AddressBook addressBook() {
return WowneroAddressBook(wownero.Wallet_addressBook(walletPtr));
}
-
+
@override
bool addressValid(String address, int networkType) {
return wownero.Wallet_addressValid(address, networkType);
}
-
+
@override
int amountFromDouble(double amount) {
return wownero.Wallet_amountFromDouble(amount);
}
-
+
@override
int amountFromString(String amount) {
return wownero.Wallet_amountFromString(amount);
}
-
+
@override
int approximateBlockChainHeight() {
return wownero.Wallet_approximateBlockChainHeight(walletPtr);
}
-
+
@override
int autoRefreshInterval() {
return wownero.Wallet_autoRefreshInterval(walletPtr);
}
-
+
@override
int balance({required int accountIndex}) {
return wownero.Wallet_balance(walletPtr, accountIndex: accountIndex);
}
-
+
@override
int blockChainHeight() {
return wownero.Wallet_blockChainHeight(walletPtr);
}
-
+
@override
Wallet2Coins coins() {
return WowneroCoins(wownero.Wallet_coins(walletPtr));
}
-
+
@override
int coldKeyImageSync({required int spent, required int unspent}) {
- return wownero.Wallet_coldKeyImageSync(walletPtr, spent: spent, unspent: unspent);
+ return wownero.Wallet_coldKeyImageSync(walletPtr,
+ spent: spent, unspent: unspent);
}
-
+
@override
bool connectToDaemon() {
return wownero.Wallet_connectToDaemon(walletPtr);
}
-
+
@override
int connected() {
return wownero.Wallet_connected(walletPtr);
}
-
+
@override
String createPolyseed({String language = "English"}) {
return wownero.Wallet_createPolyseed(language: language);
}
-
+
@override
- Wallet2PendingTransaction createTransaction({required String dst_addr, required String payment_id, required int amount, required int mixin_count, required int pendingTransactionPriority, required int subaddr_account, List<String> preferredInputs = const []}) {
- final transaction = wownero.Wallet_createTransaction(walletPtr, dst_addr: dst_addr, payment_id: payment_id, amount: amount, mixin_count: mixin_count, pendingTransactionPriority: pendingTransactionPriority, subaddr_account: subaddr_account, preferredInputs: preferredInputs);
+ Wallet2PendingTransaction createTransaction(
+ {required String dst_addr,
+ required String payment_id,
+ required int amount,
+ required int mixin_count,
+ required int pendingTransactionPriority,
+ required int subaddr_account,
+ List<String> preferredInputs = const []}) {
+ final transaction = wownero.Wallet_createTransaction(walletPtr,
+ dst_addr: dst_addr,
+ payment_id: payment_id,
+ amount: amount,
+ mixin_count: mixin_count,
+ pendingTransactionPriority: pendingTransactionPriority,
+ subaddr_account: subaddr_account,
+ preferredInputs: preferredInputs);
return WowneroPendingTransaction(transaction);
}
-
+
@override
- Wallet2PendingTransaction createTransactionMultDest({required List<String> dstAddr, String paymentId = "", required bool isSweepAll, required List<int> amounts, required int mixinCount, required int pendingTransactionPriority, required int subaddr_account, List<String> preferredInputs = const []}) {
- final transaction = wownero.Wallet_createTransactionMultDest(walletPtr, dstAddr: dstAddr, paymentId: paymentId, isSweepAll: isSweepAll, amounts: amounts, mixinCount: mixinCount, pendingTransactionPriority: pendingTransactionPriority, subaddr_account: subaddr_account, preferredInputs: preferredInputs);
+ Wallet2PendingTransaction createTransactionMultDest(
+ {required List<String> dstAddr,
+ String paymentId = "",
+ required bool isSweepAll,
+ required List<int> amounts,
+ required int mixinCount,
+ required int pendingTransactionPriority,
+ required int subaddr_account,
+ List<String> preferredInputs = const []}) {
+ final transaction = wownero.Wallet_createTransactionMultDest(walletPtr,
+ dstAddr: dstAddr,
+ paymentId: paymentId,
+ isSweepAll: isSweepAll,
+ amounts: amounts,
+ mixinCount: mixinCount,
+ pendingTransactionPriority: pendingTransactionPriority,
+ subaddr_account: subaddr_account,
+ preferredInputs: preferredInputs);
return WowneroPendingTransaction(transaction);
}
-
+
@override
- bool createWatchOnly({required String path, required String password, required String language}) {
- return wownero.Wallet_createWatchOnly(walletPtr, path: path, password: password, language: language);
+ bool createWatchOnly(
+ {required String path,
+ required String password,
+ required String language}) {
+ return wownero.Wallet_createWatchOnly(walletPtr,
+ path: path, password: password, language: language);
}
-
+
@override
int daemonBlockChainHeight() {
return wownero.Wallet_daemonBlockChainHeight(walletPtr);
}
-
+
@override
int defaultMixin() {
return wownero.Wallet_defaultMixin(walletPtr);
}
-
+
@override
- String deviceShowAddress({required int accountIndex, required int addressIndex}) {
- return wownero.Wallet_deviceShowAddress(walletPtr, accountIndex: accountIndex, addressIndex: addressIndex);
+ String deviceShowAddress(
+ {required int accountIndex, required int addressIndex}) {
+ return wownero.Wallet_deviceShowAddress(walletPtr,
+ accountIndex: accountIndex, addressIndex: addressIndex);
}
-
+
@override
String displayAmount(int amount) {
return wownero.Wallet_displayAmount(amount);
}
-
+
@override
String errorString() {
return wownero.Wallet_errorString(walletPtr);
}
-
+
@override
int estimateBlockChainHeight() {
return wownero.Wallet_estimateBlockChainHeight(walletPtr);
}
-
+
@override
- String exchangeMultisigKeys({required List<String> info, required bool force_update_use_with_caution}) {
+ String exchangeMultisigKeys(
+ {required List<String> info,
+ required bool force_update_use_with_caution}) {
throw UnimplementedError();
}
-
+
@override
bool exportKeyImages(String filename, {required bool all}) {
return wownero.Wallet_exportKeyImages(walletPtr, filename, all: all);
}
-
+
@override
String exportKeyImagesUR({int max_fragment_length = 130, bool all = false}) {
throw UnimplementedError();
}
-
+
@override
List<String> exportMultisigImages({required List<String> info}) {
throw UnimplementedError();
}
-
+
@override
bool exportOutputs(String filename, {required bool all}) {
return wownero.Wallet_exportOutputs(walletPtr, filename, all: all);
}
-
+
@override
String exportOutputsUR({int max_fragment_length = 130, bool all = false}) {
throw UnimplementedError();
}
-
+
@override
String filename() {
return wownero.Wallet_filename(walletPtr);
}
-
+
@override
String genPaymentId() {
return wownero.Wallet_genPaymentId();
}
-
+
@override
int getBackgroundSyncType() {
return wownero.Wallet_getBackgroundSyncType(walletPtr);
}
-
+
@override
int getBytesReceived() {
return wownero.Wallet_getBytesReceived(walletPtr);
}
-
+
@override
int getBytesSent() {
throw UnimplementedError();
}
-
+
@override
String getCacheAttribute({required String key}) {
return wownero.Wallet_getCacheAttribute(walletPtr, key: key);
}
-
+
@override
int getDeviceType() {
return wownero.Wallet_getDeviceType(walletPtr);
}
-
+
@override
String getMultisigInfo() {
return wownero.Wallet_getMultisigInfo(walletPtr);
}
-
+
@override
String getPassword() {
return wownero.Wallet_getPassword(walletPtr);
}
-
+
@override
String getPolyseed({required String passphrase}) {
return wownero.Wallet_getPolyseed(walletPtr, passphrase: passphrase);
}
-
+
@override
Pointer<UnsignedChar> getReceivedFromDevice() {
throw UnimplementedError();
}
-
+
@override
int getReceivedFromDeviceLength() {
throw UnimplementedError();
}
-
+
@override
int getRefreshFromBlockHeight() {
return wownero.Wallet_getRefreshFromBlockHeight(walletPtr);
}
-
+
@override
String getSeedLanguage() {
return wownero.Wallet_getSeedLanguage(walletPtr);
}
-
+
@override
Pointer<UnsignedChar> getSendToDevice() {
throw UnimplementedError();
}
-
+
@override
int getSendToDeviceLength() {
throw UnimplementedError();
}
-
+
@override
bool getStateIsConnected() {
throw UnimplementedError();
}
-
+
@override
- String getSubaddressLabel({required int accountIndex, required int addressIndex}) {
- return wownero.Wallet_getSubaddressLabel(walletPtr, accountIndex: accountIndex, addressIndex: addressIndex);
+ String getSubaddressLabel(
+ {required int accountIndex, required int addressIndex}) {
+ return wownero.Wallet_getSubaddressLabel(walletPtr,
+ accountIndex: accountIndex, addressIndex: addressIndex);
}
-
+
@override
String getTxKey({required String txid}) {
return wownero.Wallet_getTxKey(walletPtr, txid: txid);
}
-
+
@override
String getUserNote({required String txid}) {
return wownero.Wallet_getUserNote(walletPtr, txid: txid);
}
-
+
@override
bool getWaitsForDeviceReceive() {
throw UnimplementedError();
}
-
+
@override
bool getWaitsForDeviceSend() {
throw UnimplementedError();
}
-
+
@override
Wallet2WalletListener getWalletListener() {
final listener = wownero.WOWNERO_cw_getWalletListener(walletPtr);
return WowneroWalletListener(listener);
}
-
+
@override
int hasMultisigPartialKeyImages() {
throw UnimplementedError();
}
-
+
@override
bool hasUnknownKeyImages() {
return wownero.Wallet_hasUnknownKeyImages(walletPtr);
}
-
+
@override
Wallet2TransactionHistory history() {
return WowneroTransactionHistory(wownero.Wallet_history(walletPtr));
}
-
+
@override
bool importKeyImages(String filename) {
return wownero.Wallet_importKeyImages(walletPtr, filename);
}
-
+
@override
bool importKeyImagesUR(String input) {
throw UnimplementedError();
}
-
+
@override
int importMultisigImages({required List<String> info}) {
throw UnimplementedError();
}
-
+
@override
bool importOutputs(String filename) {
return wownero.Wallet_importOutputs(walletPtr, filename);
}
-
+
@override
bool importOutputsUR(String input) {
throw UnimplementedError();
}
-
+
@override
- bool init({required String daemonAddress, int upperTransacationSizeLimit = 0, String daemonUsername = "", String daemonPassword = "", bool useSsl = false, bool lightWallet = false, String proxyAddress = ""}) {
- return wownero.Wallet_init(walletPtr, daemonAddress: daemonAddress, upperTransacationSizeLimit: upperTransacationSizeLimit, daemonUsername: daemonUsername, daemonPassword: daemonPassword, useSsl: useSsl, lightWallet: lightWallet, proxyAddress: proxyAddress);
+ bool init(
+ {required String daemonAddress,
+ int upperTransacationSizeLimit = 0,
+ String daemonUsername = "",
+ String daemonPassword = "",
+ bool useSsl = false,
+ bool lightWallet = false,
+ String proxyAddress = ""}) {
+ return wownero.Wallet_init(walletPtr,
+ daemonAddress: daemonAddress,
+ upperTransacationSizeLimit: upperTransacationSizeLimit,
+ daemonUsername: daemonUsername,
+ daemonPassword: daemonPassword,
+ useSsl: useSsl,
+ lightWallet: lightWallet,
+ proxyAddress: proxyAddress);
}
-
+
@override
- void init3({required String argv0, required String defaultLogBaseName, required String logPath, required bool console}) {
- return wownero.Wallet_init3(walletPtr, argv0: argv0, defaultLogBaseName: defaultLogBaseName, logPath: logPath, console: console);
+ void init3(
+ {required String argv0,
+ required String defaultLogBaseName,
+ required String logPath,
+ required bool console}) {
+ return wownero.Wallet_init3(walletPtr,
+ argv0: argv0,
+ defaultLogBaseName: defaultLogBaseName,
+ logPath: logPath,
+ console: console);
}
-
+
@override
String integratedAddress({required String paymentId}) {
return wownero.Wallet_integratedAddress(walletPtr, paymentId: paymentId);
}
-
+
@override
bool isBackgroundSyncing() {
return wownero.Wallet_isBackgroundSyncing(walletPtr);
}
-
+
@override
bool isBackgroundWallet() {
return wownero.Wallet_isBackgroundWallet(walletPtr);
}
-
+
@override
bool isKeysFileLocked() {
return wownero.Wallet_isKeysFileLocked(walletPtr);
}
-
+
@override
bool isOffline() {
return wownero.Wallet_isOffline(walletPtr);
}
-
+
@override
void keyReuseMitigation2({required bool mitigation}) {
wownero.Wallet_keyReuseMitigation2(walletPtr, mitigation: mitigation);
}
-
+
@override
- bool keyValid({required String secret_key_string, required String address_string, required bool isViewKey, required int nettype}) {
- return wownero.Wallet_keyValid(secret_key_string: secret_key_string, address_string: address_string, isViewKey: isViewKey, nettype: nettype);
+ bool keyValid(
+ {required String secret_key_string,
+ required String address_string,
+ required bool isViewKey,
+ required int nettype}) {
+ return wownero.Wallet_keyValid(
+ secret_key_string: secret_key_string,
+ address_string: address_string,
+ isViewKey: isViewKey,
+ nettype: nettype);
}
-
+
@override
- String keyValid_error({required String secret_key_string, required String address_string, required bool isViewKey, required int nettype}) {
- return wownero.Wallet_keyValid_error(secret_key_string: secret_key_string, address_string: address_string, isViewKey: isViewKey, nettype: nettype);
+ String keyValid_error(
+ {required String secret_key_string,
+ required String address_string,
+ required bool isViewKey,
+ required int nettype}) {
+ return wownero.Wallet_keyValid_error(
+ secret_key_string: secret_key_string,
+ address_string: address_string,
+ isViewKey: isViewKey,
+ nettype: nettype);
}
-
+
@override
String keysFilename() {
return wownero.Wallet_keysFilename(walletPtr);
}
-
+
@override
- Wallet2UnsignedTransaction loadUnsignedTx({required String unsigned_filename}) {
- final tx = wownero.Wallet_loadUnsignedTx(walletPtr, unsigned_filename: unsigned_filename);
+ Wallet2UnsignedTransaction loadUnsignedTx(
+ {required String unsigned_filename}) {
+ final tx = wownero.Wallet_loadUnsignedTx(walletPtr,
+ unsigned_filename: unsigned_filename);
return WowneroUnsignedTransaction(tx);
}
-
+
@override
Wallet2UnsignedTransaction loadUnsignedTxUR({required String input}) {
throw UnimplementedError();
}
-
+
@override
bool lockKeysFile() {
return wownero.Wallet_lockKeysFile(walletPtr);
}
-
+
@override
String makeMultisig({required List<String> info, required int threshold}) {
throw UnimplementedError();
}
-
+
@override
int maximumAllowedAmount() {
return wownero.Wallet_maximumAllowedAmount();
}
-
+
@override
Wallet2MultisigState multisig() {
throw UnimplementedError();
}
-
+
@override
int nettype() {
return wownero.Wallet_nettype(walletPtr);
}
-
+
@override
int numSubaddressAccounts() {
return wownero.Wallet_numSubaddressAccounts(walletPtr);
}
-
+
@override
int numSubaddresses({required int accountIndex}) {
- return wownero.Wallet_numSubaddresses(walletPtr, accountIndex: accountIndex);
+ return wownero.Wallet_numSubaddresses(walletPtr,
+ accountIndex: accountIndex);
}
-
+
@override
String path() {
return wownero.Wallet_path(walletPtr);
}
-
+
@override
void pauseRefresh() {
wownero.Wallet_pauseRefresh(walletPtr);
}
-
+
@override
String paymentIdFromAddress({required String strarg, required int nettype}) {
- return wownero.Wallet_paymentIdFromAddress(nettype: nettype, strarg: strarg);
+ return wownero.Wallet_paymentIdFromAddress(
+ nettype: nettype, strarg: strarg);
}
-
+
@override
bool paymentIdValid(String paymentId) {
return wownero.Wallet_paymentIdValid(paymentId);
}
-
+
@override
String publicMultisigSignerKey() {
return wownero.Wallet_publicMultisigSignerKey(walletPtr);
}
-
+
@override
String publicSpendKey() {
return wownero.Wallet_publicSpendKey(walletPtr);
}
-
+
@override
String publicViewKey() {
return wownero.Wallet_publicViewKey(walletPtr);
}
-
+
@override
bool reconnectDevice() {
return wownero.Wallet_reconnectDevice(walletPtr);
}
-
+
@override
bool refresh() {
return wownero.Wallet_refresh(walletPtr);
}
-
+
@override
void refreshAsync() {
wownero.Wallet_refreshAsync(walletPtr);
}
-
+
@override
bool rescanBlockchain() {
return wownero.Wallet_rescanBlockchain(walletPtr);
}
-
+
@override
void rescanBlockchainAsync() {
wownero.Wallet_rescanBlockchainAsync(walletPtr);
}
-
+
@override
bool rescanSpent() {
return wownero.Wallet_rescanSpent(walletPtr);
}
-
+
@override
- Wallet2PendingTransaction restoreMultisigTransaction({required String signData}) {
+ Wallet2PendingTransaction restoreMultisigTransaction(
+ {required String signData}) {
throw UnimplementedError();
}
-
+
@override
String secretSpendKey() {
return wownero.Wallet_secretSpendKey(walletPtr);
}
-
+
@override
String secretViewKey() {
return wownero.Wallet_secretViewKey(walletPtr);
}
-
+
@override
String seed({required String seedOffset}) {
return wownero.Wallet_seed(walletPtr, seedOffset: seedOffset);
}
-
+
@override
void segregatePreForkOutputs({required bool segregate}) {
wownero.Wallet_segregatePreForkOutputs(walletPtr, segregate: segregate);
}
-
+
@override
void segregationHeight({required int height}) {
wownero.Wallet_segregationHeight(walletPtr, height: height);
}
-
+
@override
void setAutoRefreshInterval({required int millis}) {
wownero.Wallet_setAutoRefreshInterval(walletPtr, millis: millis);
}
-
+
@override
bool setCacheAttribute({required String key, required String value}) {
return wownero.Wallet_setCacheAttribute(walletPtr, key: key, value: value);
}
-
+
@override
void setDefaultMixin(int arg) {
wownero.Wallet_setDefaultMixin(walletPtr, arg);
}
-
+
@override
bool setDevicePin({required String passphrase}) {
return wownero.Wallet_setDevicePin(walletPtr, passphrase: passphrase);
}
-
+
@override
void setDeviceReceivedData(Pointer<UnsignedChar> data, int len) {
throw UnimplementedError();
}
-
+
@override
void setDeviceSendData(Pointer<UnsignedChar> data, int len) {
throw UnimplementedError();
}
-
+
@override
void setOffline({required bool offline}) {
wownero.Wallet_setOffline(walletPtr, offline: offline);
}
-
+
@override
bool setPassword({required String password}) {
return wownero.Wallet_setPassword(walletPtr, password: password);
}
-
+
@override
void setProxy({required String address}) {
wownero.Wallet_setProxy(walletPtr, address: address);
}
-
+
@override
void setRecoveringFromDevice({required bool recoveringFromDevice}) {
- wownero.Wallet_setRecoveringFromDevice(walletPtr, recoveringFromDevice: recoveringFromDevice);
+ wownero.Wallet_setRecoveringFromDevice(walletPtr,
+ recoveringFromDevice: recoveringFromDevice);
}
-
+
@override
void setRecoveringFromSeed({required bool recoveringFromSeed}) {
- wownero.Wallet_setRecoveringFromSeed(walletPtr, recoveringFromSeed: recoveringFromSeed);
+ wownero.Wallet_setRecoveringFromSeed(walletPtr,
+ recoveringFromSeed: recoveringFromSeed);
}
-
+
@override
void setRefreshFromBlockHeight({required int refresh_from_block_height}) {
- wownero.Wallet_setRefreshFromBlockHeight(walletPtr, refresh_from_block_height: refresh_from_block_height);
+ wownero.Wallet_setRefreshFromBlockHeight(walletPtr,
+ refresh_from_block_height: refresh_from_block_height);
}
-
+
@override
void setSeedLanguage({required String language}) {
wownero.Wallet_setSeedLanguage(walletPtr, language: language);
}
-
+
@override
- void setSubaddressLabel({required int accountIndex, required int addressIndex, required String label}) {
- wownero.Wallet_setSubaddressLabel(walletPtr, accountIndex: accountIndex, addressIndex: addressIndex, label: label);
+ void setSubaddressLabel(
+ {required int accountIndex,
+ required int addressIndex,
+ required String label}) {
+ wownero.Wallet_setSubaddressLabel(walletPtr,
+ accountIndex: accountIndex, addressIndex: addressIndex, label: label);
}
-
+
@override
void setSubaddressLookahead({required int major, required int minor}) {
- wownero.Wallet_setSubaddressLookahead(walletPtr, major: major, minor: minor);
+ wownero.Wallet_setSubaddressLookahead(walletPtr,
+ major: major, minor: minor);
}
-
+
@override
void setTrustedDaemon({required bool arg}) {
wownero.Wallet_setTrustedDaemon(walletPtr, arg: arg);
}
-
+
@override
bool setUserNote({required String txid, required String note}) {
return wownero.Wallet_setUserNote(walletPtr, txid: txid, note: note);
}
-
+
@override
- bool setupBackgroundSync({required int backgroundSyncType, required String walletPassword, required String backgroundCachePassword}) {
- return wownero.Wallet_setupBackgroundSync(walletPtr, backgroundSyncType: backgroundSyncType, walletPassword: walletPassword, backgroundCachePassword: backgroundCachePassword);
+ bool setupBackgroundSync(
+ {required int backgroundSyncType,
+ required String walletPassword,
+ required String backgroundCachePassword}) {
+ return wownero.Wallet_setupBackgroundSync(walletPtr,
+ backgroundSyncType: backgroundSyncType,
+ walletPassword: walletPassword,
+ backgroundCachePassword: backgroundCachePassword);
}
-
+
@override
String signMessage({required String message, required String address}) {
- return wownero.Wallet_signMessage(walletPtr, message: message, address: address);
+ return wownero.Wallet_signMessage(walletPtr,
+ message: message, address: address);
}
-
+
@override
bool startBackgroundSync() {
return wownero.Wallet_startBackgroundSync(walletPtr);
}
-
+
@override
void startRefresh() {
wownero.Wallet_startRefresh(walletPtr);
}
-
+
@override
int status() {
return wownero.Wallet_status(walletPtr);
}
-
+
@override
void stop() {
wownero.Wallet_stop(walletPtr);
}
-
+
@override
bool stopBackgroundSync(String walletPassword) {
return wownero.Wallet_stopBackgroundSync(walletPtr, walletPassword);
}
-
+
@override
bool store({String path = ""}) {
return wownero.Wallet_store(walletPtr, path: path);
}
-
+
@override
Wallet2Subaddress subaddress() {
return WowneroSubaddress(wownero.Wallet_subaddress(walletPtr));
}
-
+
@override
Wallet2SubaddressAccount subaddressAccount() {
- return WowneroSubaddressAccount(wownero.Wallet_subaddressAccount(walletPtr));
+ return WowneroSubaddressAccount(
+ wownero.Wallet_subaddressAccount(walletPtr));
}
-
+
@override
bool submitTransaction(String filename) {
return wownero.Wallet_submitTransaction(walletPtr, filename);
}
-
+
@override
bool submitTransactionUR(String input) {
throw UnimplementedError();
}
-
+
@override
bool synchronized() {
return wownero.Wallet_synchronized(walletPtr);
}
-
+
@override
bool trustedDaemon() {
return wownero.Wallet_trustedDaemon(walletPtr);
}
-
+
@override
bool unlockKeysFile() {
return wownero.Wallet_unlockKeysFile(walletPtr);
}
-
+
@override
int unlockedBalance({required int accountIndex}) {
- return wownero.Wallet_unlockedBalance(walletPtr, accountIndex: accountIndex);
+ return wownero.Wallet_unlockedBalance(walletPtr,
+ accountIndex: accountIndex);
}
-
+
@override
int useForkRules({required int version, required int earlyBlocks}) {
- return wownero.Wallet_useForkRules(walletPtr, version: version, earlyBlocks: earlyBlocks);
+ return wownero.Wallet_useForkRules(walletPtr,
+ version: version, earlyBlocks: earlyBlocks);
}
-
+
@override
- bool verifySignedMessage({required String message, required String address, required String signature}) {
- return wownero.Wallet_verifySignedMessage(walletPtr, message: message, address: address, signature: signature);
+ bool verifySignedMessage(
+ {required String message,
+ required String address,
+ required String signature}) {
+ return wownero.Wallet_verifySignedMessage(walletPtr,
+ message: message, address: address, signature: signature);
}
-
+
@override
int viewOnlyBalance({required int accountIndex}) {
- return wownero.Wallet_viewOnlyBalance(walletPtr, accountIndex: accountIndex);
+ return wownero.Wallet_viewOnlyBalance(walletPtr,
+ accountIndex: accountIndex);
}
-
+
@override
bool watchOnly() {
return wownero.Wallet_watchOnly(walletPtr);
@@ -1531,131 +1675,234 @@ class WowneroWalletManager implements Wallet2WalletManager {
WowneroWalletManager(this.wmPtr);
final wownero.WalletManager wmPtr;
-
+
@override
Future<int> blockTarget() async {
return wownero.WalletManager_blockTarget(wmPtr);
}
-
+
@override
Future<int> blockchainHeight() async {
return wownero.WalletManager_blockchainHeight(wmPtr);
}
-
+
@override
Future<int> blockchainTargetHeight() async {
return wownero.WalletManager_blockchainTargetHeight(wmPtr);
}
-
+
@override
- Wallet2Wallet createDeterministicWalletFromSpendKey({required String path, required String password, String language = "English", int networkType = 0, required String spendKeyString, required bool newWallet, required int restoreHeight, int kdfRounds = 1}) {
- final wallet = wownero.WalletManager_createDeterministicWalletFromSpendKey(wmPtr, path: path, password: password, language: language, networkType: networkType, spendKeyString: spendKeyString, newWallet: newWallet, restoreHeight: restoreHeight, kdfRounds: kdfRounds);
+ Wallet2Wallet createDeterministicWalletFromSpendKey(
+ {required String path,
+ required String password,
+ String language = "English",
+ int networkType = 0,
+ required String spendKeyString,
+ required bool newWallet,
+ required int restoreHeight,
+ int kdfRounds = 1}) {
+ final wallet = wownero.WalletManager_createDeterministicWalletFromSpendKey(
+ wmPtr,
+ path: path,
+ password: password,
+ language: language,
+ networkType: networkType,
+ spendKeyString: spendKeyString,
+ newWallet: newWallet,
+ restoreHeight: restoreHeight,
+ kdfRounds: kdfRounds);
return WowneroWallet(wallet);
}
-
+
@override
- Wallet2Wallet createWallet({required String path, required String password, String language = "English", int networkType = 0}) {
- final wallet = wownero.WalletManager_createWallet(wmPtr, path: path, password: password, language: language, networkType: networkType);
+ Wallet2Wallet createWallet(
+ {required String path,
+ required String password,
+ String language = "English",
+ int networkType = 0}) {
+ final wallet = wownero.WalletManager_createWallet(wmPtr,
+ path: path,
+ password: password,
+ language: language,
+ networkType: networkType);
return WowneroWallet(wallet);
}
-
+
@override
- Wallet2Wallet createWalletFromDevice({required String path, required String password, int networkType = 0, required String deviceName, int restoreHeight = 0, String subaddressLookahead = "", int kdfRounds = 1}) {
+ Wallet2Wallet createWalletFromDevice(
+ {required String path,
+ required String password,
+ int networkType = 0,
+ required String deviceName,
+ int restoreHeight = 0,
+ String subaddressLookahead = "",
+ int kdfRounds = 1}) {
throw UnimplementedError();
}
-
+
@override
- Wallet2Wallet createWalletFromKeys({required String path, required String password, String language = "English", int nettype = 1, required int restoreHeight, required String addressString, required String viewKeyString, required String spendKeyString, int kdf_rounds = 1}) {
- final wallet = wownero.WalletManager_createWalletFromKeys(wmPtr, path: path, password: password, language: language, nettype: nettype, restoreHeight: restoreHeight, addressString: addressString, viewKeyString: viewKeyString, spendKeyString: spendKeyString);
+ Wallet2Wallet createWalletFromKeys(
+ {required String path,
+ required String password,
+ String language = "English",
+ int nettype = 1,
+ required int restoreHeight,
+ required String addressString,
+ required String viewKeyString,
+ required String spendKeyString,
+ int kdf_rounds = 1}) {
+ final wallet = wownero.WalletManager_createWalletFromKeys(wmPtr,
+ path: path,
+ password: password,
+ language: language,
+ nettype: nettype,
+ restoreHeight: restoreHeight,
+ addressString: addressString,
+ viewKeyString: viewKeyString,
+ spendKeyString: spendKeyString);
return WowneroWallet(wallet);
}
-
+
@override
- Wallet2Wallet createWalletFromPolyseed({required String path, required String password, int networkType = 0, required String mnemonic, required String seedOffset, required bool newWallet, required int restoreHeight, required int kdfRounds}) {
- final wallet = wownero.WalletManager_createWalletFromPolyseed(wmPtr, path: path, password: password, networkType: networkType, mnemonic: mnemonic, seedOffset: seedOffset, newWallet: newWallet, restoreHeight: restoreHeight, kdfRounds: kdfRounds);
+ Wallet2Wallet createWalletFromPolyseed(
+ {required String path,
+ required String password,
+ int networkType = 0,
+ required String mnemonic,
+ required String seedOffset,
+ required bool newWallet,
+ required int restoreHeight,
+ required int kdfRounds}) {
+ final wallet = wownero.WalletManager_createWalletFromPolyseed(wmPtr,
+ path: path,
+ password: password,
+ networkType: networkType,
+ mnemonic: mnemonic,
+ seedOffset: seedOffset,
+ newWallet: newWallet,
+ restoreHeight: restoreHeight,
+ kdfRounds: kdfRounds);
return WowneroWallet(wallet);
}
-
+
@override
String errorString() {
return wownero.WalletManager_errorString(wmPtr);
}
-
+
@override
List<String> findWallets({required String path}) {
return wownero.WalletManager_findWallets(wmPtr, path: path);
}
-
+
@override
bool isMining() {
return wownero.WalletManager_isMining(wmPtr);
}
-
+
@override
double miningHashRate() {
return wownero.WalletManager_miningHashRate(wmPtr);
}
-
+
@override
int networkDifficulty() {
return wownero.WalletManager_networkDifficulty(wmPtr);
}
-
+
@override
- Wallet2Wallet openWallet({required String path, required String password, int networkType = 0}) {
- final wallet = wownero.WalletManager_openWallet(wmPtr, path: path, password: password, networkType: networkType);
+ Wallet2Wallet openWallet(
+ {required String path, required String password, int networkType = 0}) {
+ final wallet = wownero.WalletManager_openWallet(wmPtr,
+ path: path, password: password, networkType: networkType);
return WowneroWallet(wallet);
}
-
+
@override
- int queryWalletDevice({required String keysFileName, required String password, required int kdfRounds}) {
+ int queryWalletDevice(
+ {required String keysFileName,
+ required String password,
+ required int kdfRounds}) {
throw UnimplementedError();
}
-
+
@override
- Wallet2Wallet recoveryWallet({required String path, required String password, required String mnemonic, int networkType = 0, required int restoreHeight, int kdfRounds = 0, required String seedOffset}) {
- final wallet = wownero.WalletManager_recoveryWallet(wmPtr, path: path, password: password, mnemonic: mnemonic, networkType: networkType, restoreHeight: restoreHeight, kdfRounds: kdfRounds, seedOffset: seedOffset);
+ Wallet2Wallet recoveryWallet(
+ {required String path,
+ required String password,
+ required String mnemonic,
+ int networkType = 0,
+ required int restoreHeight,
+ int kdfRounds = 0,
+ required String seedOffset}) {
+ final wallet = wownero.WalletManager_recoveryWallet(wmPtr,
+ path: path,
+ password: password,
+ mnemonic: mnemonic,
+ networkType: networkType,
+ restoreHeight: restoreHeight,
+ kdfRounds: kdfRounds,
+ seedOffset: seedOffset);
return WowneroWallet(wallet);
}
-
+
@override
- String resolveOpenAlias({required String address, required bool dnssecValid}) {
- return wownero.WalletManager_resolveOpenAlias(wmPtr, address: address, dnssecValid: dnssecValid);
+ String resolveOpenAlias(
+ {required String address, required bool dnssecValid}) {
+ return wownero.WalletManager_resolveOpenAlias(wmPtr,
+ address: address, dnssecValid: dnssecValid);
}
-
+
@override
void setDaemonAddress(String address) {
wownero.WalletManager_setDaemonAddress(wmPtr, address);
}
-
+
@override
bool setProxy(String address) {
return wownero.WalletManager_setProxy(wmPtr, address);
}
-
+
@override
- bool startMining({required String address, required int threads, required bool backgroundMining, required bool ignoreBattery}) {
- return wownero.WalletManager_startMining(wmPtr, address: address, threads: threads, backgroundMining: backgroundMining, ignoreBattery: ignoreBattery);
+ bool startMining(
+ {required String address,
+ required int threads,
+ required bool backgroundMining,
+ required bool ignoreBattery}) {
+ return wownero.WalletManager_startMining(wmPtr,
+ address: address,
+ threads: threads,
+ backgroundMining: backgroundMining,
+ ignoreBattery: ignoreBattery);
}
-
+
@override
bool stopMining(String address) {
return wownero.WalletManager_stopMining(wmPtr, address);
}
-
+
@override
- bool verifyWalletPassword({required String keysFileName, required String password, required bool noSpendKey, required int kdfRounds}) {
- return wownero.WalletManager_verifyWalletPassword(wmPtr, keysFileName: keysFileName, password: password, noSpendKey: noSpendKey, kdfRounds: kdfRounds);
+ bool verifyWalletPassword(
+ {required String keysFileName,
+ required String password,
+ required bool noSpendKey,
+ required int kdfRounds}) {
+ return wownero.WalletManager_verifyWalletPassword(wmPtr,
+ keysFileName: keysFileName,
+ password: password,
+ noSpendKey: noSpendKey,
+ kdfRounds: kdfRounds);
}
-
+
@override
bool walletExists(String path) {
return wownero.WalletManager_walletExists(wmPtr, path);
}
-
+
@override
void closeWallet(Wallet2Wallet wallet, bool store) {
- wownero.WalletManager_closeWallet(wmPtr, Pointer.fromAddress(wallet.ffiAddress()), store);
+ wownero.WalletManager_closeWallet(
+ wmPtr, Pointer.fromAddress(wallet.ffiAddress()), store);
}
@override
@@ -1665,7 +1912,8 @@ class WowneroWalletManager implements Wallet2WalletManager {
class WowneroWalletManagerFactory implements Wallet2WalletManagerFactory {
@override
Wallet2WalletManager getWalletManager() {
- return WowneroWalletManager(wownero.WalletManagerFactory_getWalletManager());
+ return WowneroWalletManager(
+ wownero.WalletManagerFactory_getWalletManager());
}
@override
diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp
index 391cb65..c4faa69 100644
--- a/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.cpp
@@ -102,7 +102,6 @@ const char* MONERO_PendingTransaction_commitUR(void* pendingTx_ptr, int max_frag
DEBUG_END()
}
-
const char* MONERO_PendingTransaction_commitTrezor(void* pendingTx_ptr, int tx_index) {
DEBUG_START()
Monero::PendingTransaction *pendingTx = reinterpret_cast<Monero::PendingTransaction*>(pendingTx_ptr);
@@ -111,6 +110,14 @@ const char* MONERO_PendingTransaction_commitTrezor(void* pendingTx_ptr, int tx_i
DEBUG_END()
}
+bool MONERO_PendingTransaction_commitTrezorNext(void* pendingTx_ptr, const char* response_json, int tx_index) {
+ DEBUG_START()
+ Monero::PendingTransaction *pendingTx = reinterpret_cast<Monero::PendingTransaction*>(pendingTx_ptr);
+ std::string str = pendingTx->commitTrezorNext(std::string(response_json), tx_index);
+ return strdup(str.c_str());
+ DEBUG_END()
+}
+
uint64_t MONERO_PendingTransaction_amount(void* pendingTx_ptr) {
DEBUG_START()
Monero::PendingTransaction *pendingTx = reinterpret_cast<Monero::PendingTransaction*>(pendingTx_ptr);
diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h
index f30d233..4b4c8ad 100644
--- a/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_wallet2_api_c.h
@@ -85,6 +85,7 @@ extern ADDAPI const char* MONERO_PendingTransaction_errorString(void* pendingTx_
extern ADDAPI bool MONERO_PendingTransaction_commit(void* pendingTx_ptr, const char* filename, bool overwrite);
extern ADDAPI const char* MONERO_PendingTransaction_commitUR(void* pendingTx_ptr, int max_fragment_length);
extern ADDAPI const char* MONERO_PendingTransaction_commitTrezor(void* pendingTx_ptr, int tx_index);
+extern ADDAPI bool MONERO_PendingTransaction_commitTrezorNext(void* pendingTx_ptr, const char* response_json, int tx_index);
// virtual uint64_t amount() const = 0;
extern ADDAPI uint64_t MONERO_PendingTransaction_amount(void* pendingTx_ptr);
// virtual uint64_t dust() const = 0;
diff --git a/patches/monero/0021-trezor-import-export-sign-functions.patch b/patches/monero/0021-trezor-import-export-sign-functions.patch
index 8f89f01..b9b76b5 100644
--- a/patches/monero/0021-trezor-import-export-sign-functions.patch
+++ b/patches/monero/0021-trezor-import-export-sign-functions.patch
@@ -1,21 +1,21 @@
-From b0fb84c69bba4cc6ffdd7c401a804c2d73089043 Mon Sep 17 00:00:00 2001
+From fc7c14b26225627c74b23467bb442247ca35d010 Mon Sep 17 00:00:00 2001
From: Czarek Nakamoto <cyjan@mrcyjanek.net>
-Date: Wed, 13 May 2026 11:35:01 -0400
-Subject: [PATCH] trezor import/export/sign functions
+Date: Mon, 18 May 2026 08:48:12 -0400
+Subject: [PATCH] trezor import export sign broadcast functions
---
- cmake/CheckTrezor.cmake | 28 +--
- src/device_trezor/trezor/protocol.cpp | 220 ++++++++++++++++++++++++
- src/device_trezor/trezor/protocol.hpp | 8 +
- src/wallet/api/pending_transaction.cpp | 60 +++++++
- src/wallet/api/pending_transaction.h | 1 +
+ cmake/CheckTrezor.cmake | 28 +-
+ src/device_trezor/trezor/protocol.cpp | 453 ++++++++++++++++++++++++
+ src/device_trezor/trezor/protocol.hpp | 27 ++
+ src/wallet/api/pending_transaction.cpp | 143 ++++++++
+ src/wallet/api/pending_transaction.h | 18 +
src/wallet/api/unsigned_transaction.cpp | 2 +
- src/wallet/api/wallet.cpp | 31 +++-
+ src/wallet/api/wallet.cpp | 31 +-
src/wallet/api/wallet.h | 2 +
- src/wallet/api/wallet2_api.h | 14 ++
- src/wallet/wallet2.cpp | 158 +++++++++++++++++
+ src/wallet/api/wallet2_api.h | 15 +
+ src/wallet/wallet2.cpp | 158 +++++++++
src/wallet/wallet2.h | 5 +-
- 11 files changed, 500 insertions(+), 29 deletions(-)
+ 11 files changed, 853 insertions(+), 29 deletions(-)
diff --git a/cmake/CheckTrezor.cmake b/cmake/CheckTrezor.cmake
index 4fae15fad..57e3d4866 100644
@@ -65,14 +65,16 @@ index 4fae15fad..57e3d4866 100644
set(ENV{PROTOBUF_PROTOC_EXECUTABLE} "${Protobuf_PROTOC_EXECUTABLE}")
set(TREZOR_PROTOBUF_PARAMS "")
diff --git a/src/device_trezor/trezor/protocol.cpp b/src/device_trezor/trezor/protocol.cpp
-index 0e59a16ba..afd1498d2 100644
+index 0e59a16ba..acbc5ac76 100644
--- a/src/device_trezor/trezor/protocol.cpp
+++ b/src/device_trezor/trezor/protocol.cpp
-@@ -29,12 +29,17 @@
+@@ -29,12 +29,19 @@
#include "version.h"
#include "protocol.hpp"
+#include "string_tools.h"
++#include "cryptonote_basic/cryptonote_format_utils.h"
++#include <boost/lexical_cast.hpp>
#include <unordered_map>
#include <set>
+#include <sstream>
@@ -86,7 +88,7 @@ index 0e59a16ba..afd1498d2 100644
#include <crypto/hmac-keccak.h>
#include <ringct/rctSigs.h>
#include <ringct/bulletproofs.h>
-@@ -450,6 +455,10 @@ namespace tx {
+@@ -450,6 +457,10 @@ namespace tx {
}
}
@@ -97,7 +99,7 @@ index 0e59a16ba..afd1498d2 100644
void Signer::set_tx_input(MoneroTransactionSourceEntry * dst, size_t idx, bool need_ring_keys, bool need_ring_indices){
const cryptonote::tx_source_entry & src = cur_tx().sources[idx];
const tools::wallet2::transfer_details & transfer = get_source_transfer(idx);
-@@ -1096,6 +1105,217 @@ namespace tx {
+@@ -1096,6 +1107,448 @@ namespace tx {
memwipe(plaintext.get(), keys_len);
}
@@ -312,20 +314,262 @@ index 0e59a16ba..afd1498d2 100644
+ return std::string(buffer.GetString(), buffer.GetSize());
+ }
+
++ namespace {
++
++ std::string hex_to_bin(const std::string &hex)
++ {
++ std::string stripped = hex;
++ if (stripped.size() >= 2 && stripped[0] == '0' && (stripped[1] == 'x' || stripped[1] == 'X'))
++ stripped = stripped.substr(2);
++ std::string bin;
++ if (!epee::string_tools::parse_hexstr_to_binbuff(stripped, bin))
++ throw std::invalid_argument("Invalid hex string");
++ return bin;
++ }
++
++ const rapidjson::Value & parse_connect_response(const std::string &response_json, rapidjson::Document &doc)
++ {
++ if (doc.Parse(response_json.c_str()).HasParseError())
++ throw std::invalid_argument("Trezor Connect response: JSON parse error");
++ if (!doc.IsObject())
++ throw std::invalid_argument("Trezor Connect response: expected JSON object");
++
++ if (doc.HasMember("payload") && doc["payload"].IsObject()) {
++ if (doc.HasMember("success") && doc["success"].IsBool() && !doc["success"].GetBool())
++ throw std::invalid_argument("Trezor Connect response: success is false");
++ return doc["payload"];
++ }
++
++ return doc;
++ }
++
++ std::string get_hex_field(const rapidjson::Value &obj, const char *name, bool required = true)
++ {
++ if (!obj.HasMember(name) || !obj[name].IsString()) {
++ if (required)
++ throw std::invalid_argument(std::string("Trezor Connect response: missing field ") + name);
++ return {};
++ }
++ return hex_to_bin(std::string(obj[name].GetString(), obj[name].GetStringLength()));
++ }
++
++ const rapidjson::Value * get_array_field(const rapidjson::Value &obj, const char *name)
++ {
++ if (!obj.HasMember(name) || !obj[name].IsArray())
++ return nullptr;
++ return &obj[name];
++ }
++
++ void prepare_connect_signing_state(
++ Signer &signer,
++ const rapidjson::Value &payload,
++ const cryptonote::transaction &prefix_tx)
++ {
++ TData &ct = signer.tdata();
++ signer.step_init();
++ ct.tx = prefix_tx;
++
++ CHECK_AND_ASSERT_THROW_MES(
++ payload.HasMember("tx_prefix_hash") && payload["tx_prefix_hash"].IsString(),
++ "Trezor Connect response: missing tx_prefix_hash");
++
++ ::crypto::hash computed{};
++ cryptonote::get_transaction_prefix_hash(ct.tx, computed);
++ const std::string expected = hex_to_bin(
++ std::string(payload["tx_prefix_hash"].GetString(), payload["tx_prefix_hash"].GetStringLength()));
++ if (expected.size() != sizeof(computed) ||
++ crypto_verify_32(
++ reinterpret_cast<const unsigned char *>(computed.data),
++ reinterpret_cast<const unsigned char *>(expected.data()))) {
++ throw exc::proto::SecurityException("Transaction prefix hash does not match");
++ }
++
++ ct.tx_prefix_hash = expected;
++
++ ct.rv = std::make_shared<rct::rctSig>();
++ if (prefix_tx.version > 1) {
++ const auto &src_rct = prefix_tx.rct_signatures;
++ ct.rv->type = src_rct.type;
++ ct.rv->txnFee = src_rct.txnFee;
++ ct.rv->message = src_rct.message;
++ ct.rv->outPk = src_rct.outPk;
++ ct.rv->ecdhInfo = src_rct.ecdhInfo;
++ if (rct::is_rct_bulletproof_plus(src_rct.type))
++ ct.rv->p.bulletproofs_plus = src_rct.p.bulletproofs_plus;
++ else if (rct::is_rct_bulletproof(src_rct.type))
++ ct.rv->p.bulletproofs = src_rct.p.bulletproofs;
++ }
++
++ if (payload.HasMember("rv") && payload["rv"].IsObject()) {
++ const auto &rvj = payload["rv"];
++ if (rvj.HasMember("txn_fee") && rvj["txn_fee"].IsUint64())
++ ct.rv->txnFee = rvj["txn_fee"].GetUint64();
++ if (rvj.HasMember("rv_type") && rvj["rv_type"].IsUint())
++ ct.rv->type = static_cast<uint8_t>(rvj["rv_type"].GetUint());
++ if (rvj.HasMember("message") && rvj["message"].IsString())
++ string_to_key(ct.rv->message, hex_to_bin(std::string(rvj["message"].GetString(), rvj["message"].GetStringLength())));
++ }
++
++ if (payload.HasMember("extra") && payload["extra"].IsString()) {
++ const std::string extra_bin = hex_to_bin(
++ std::string(payload["extra"].GetString(), payload["extra"].GetStringLength()));
++ ct.tx.extra.assign(extra_bin.begin(), extra_bin.end());
++ }
++
++ const rapidjson::Value *pseudo_outs = get_array_field(payload, "pseudo_outs");
++ if (pseudo_outs) {
++ ct.pseudo_outs.clear();
++ ct.rv->p.pseudoOuts.clear();
++ for (rapidjson::SizeType i = 0; i < pseudo_outs->Size(); ++i) {
++ if (!(*pseudo_outs)[i].IsString())
++ throw std::invalid_argument("Trezor Connect response: invalid pseudo_out entry");
++ const std::string po = hex_to_bin(
++ std::string((*pseudo_outs)[i].GetString(), (*pseudo_outs)[i].GetStringLength()));
++ ct.pseudo_outs.push_back(po);
++ rct::key k{};
++ string_to_key(k, po);
++ ct.rv->p.pseudoOuts.push_back(k);
++ }
++ }
++
++ ct.rv->mixRing.resize(signer.num_inputs());
++ }
++
++ tools::wallet2::pending_tx build_pending_tx_from_tdata(const TData &cdata)
++ {
++ tools::wallet2::pending_tx cpend;
++ cpend.tx = cdata.tx;
++ cpend.dust = 0;
++ cpend.fee = cpend.tx.rct_signatures.txnFee;
++ cpend.dust_added_to_fee = false;
++ cpend.change_dts = cdata.tx_data.change_dts;
++ cpend.selected_transfers = cdata.tx_data.selected_transfers;
++ cpend.key_images = "";
++ cpend.dests = cdata.tx_data.dests;
++ cpend.construction_data = cdata.tx_data;
++
++ std::string key_images;
++ const bool all_are_txin_to_key = std::all_of(cdata.tx.vin.begin(), cdata.tx.vin.end(), [&](const cryptonote::txin_v &s_e) -> bool {
++ CHECKED_GET_SPECIFIC_VARIANT(s_e, const cryptonote::txin_to_key, in, false);
++ key_images += boost::lexical_cast<std::string>(in.k_image) + " ";
++ return true;
++ });
++ if (!all_are_txin_to_key)
++ throw std::invalid_argument("Not all are txin_to_key");
++ cpend.key_images = key_images;
++
++ return cpend;
++ }
++
++ void fill_key_images_from_signed_tx(
++ std::vector<::crypto::key_image> &key_images,
++ const TData &cdata,
++ const unsigned_tx_set &utx)
++ {
++ key_images.clear();
++ key_images.resize(std::get<2>(utx.transfers).size());
++ for (size_t cidx = 0; cidx < key_images.size(); ++cidx)
++ key_images[cidx] = std::get<2>(utx.transfers)[cidx].m_key_image;
++
++ const size_t num_sources = cdata.tx_data.sources.size();
++ CHECK_AND_ASSERT_THROW_MES(num_sources == cdata.tx.vin.size(), "Invalid tx.vin size");
++
++ for (size_t src_idx = 0; src_idx < num_sources; ++src_idx) {
++ CHECK_AND_ASSERT_THROW_MES(src_idx < cdata.tx_data.selected_transfers.size(), "Invalid source index");
++ size_t idx_map_src = cdata.tx_data.selected_transfers[src_idx];
++ CHECK_AND_ASSERT_THROW_MES(idx_map_src >= std::get<0>(utx.transfers), "Invalid offset");
++ idx_map_src -= std::get<0>(utx.transfers);
++ CHECK_AND_ASSERT_THROW_MES(idx_map_src < key_images.size(), "Invalid key image index");
++
++ const auto vini = boost::get<cryptonote::txin_to_key>(cdata.tx.vin[src_idx]);
++ key_images[idx_map_src] = vini.k_image;
++ }
++ }
++
++ } // namespace
++
++ trezor_connect_signed_tx trezor_connect_monero_apply_sign_response(
++ wallet_shim *wallet,
++ const unsigned_tx_set *utx,
++ size_t tx_idx,
++ hw::tx_aux_data *aux_data,
++ const std::string &response_json,
++ const cryptonote::transaction *prefix_tx)
++ {
++ CHECK_AND_ASSERT_THROW_MES(wallet && utx && aux_data, "null argument");
++ CHECK_AND_ASSERT_THROW_MES(prefix_tx, "Trezor Connect: call commitTrezor first (unsigned transaction missing)");
++ CHECK_AND_ASSERT_THROW_MES(std::get<0>(utx->transfers) == 0, "Unsupported non zero offset");
++ CHECK_AND_ASSERT_THROW_MES(tx_idx < utx->txes.size(), "Invalid transaction index");
++
++ rapidjson::Document doc;
++ const rapidjson::Value &payload = parse_connect_response(response_json, doc);
++
++ Signer signer(wallet, utx, tx_idx, aux_data);
++ prepare_connect_signing_state(signer, payload, *prefix_tx);
++
++ const size_t num_sources = signer.num_inputs();
++
++ const rapidjson::Value *signatures = get_array_field(payload, "signatures");
++ if (!signatures)
++ throw std::invalid_argument("Trezor Connect response: missing signatures array");
++ if (signatures->Size() != num_sources)
++ throw std::invalid_argument("Trezor Connect response: signatures count mismatch");
++
++ const rapidjson::Value *pseudo_outs = get_array_field(payload, "pseudo_outs");
++
++ for (rapidjson::SizeType i = 0; i < signatures->Size(); ++i) {
++ if (!(*signatures)[i].IsString())
++ throw std::invalid_argument("Trezor Connect response: invalid signature entry");
++ auto ack = std::make_shared<messages::monero::MoneroTransactionSignInputAck>();
++ ack->set_signature(hex_to_bin(
++ std::string((*signatures)[i].GetString(), (*signatures)[i].GetStringLength())));
++ if (pseudo_outs && i < pseudo_outs->Size() && (*pseudo_outs)[i].IsString())
++ ack->set_pseudo_out(hex_to_bin(
++ std::string((*pseudo_outs)[i].GetString(), (*pseudo_outs)[i].GetStringLength())));
++ signer.step_sign_input_ack(ack);
++ }
++
++ auto final_ack = std::make_shared<messages::monero::MoneroTransactionFinalAck>();
++ final_ack->set_salt(get_hex_field(payload, "salt", false));
++ final_ack->set_rand_mult(get_hex_field(payload, "rand_mult", false));
++ final_ack->set_tx_enc_keys(get_hex_field(payload, "tx_enc_keys", false));
++ final_ack->set_cout_key(get_hex_field(payload, "cout_key", false));
++ final_ack->set_opening_key(get_hex_field(payload, "opening_key", true));
++
++ signer.step_final_ack(final_ack);
++
++ trezor_connect_signed_tx result;
++ result.ptx = build_pending_tx_from_tdata(signer.tdata());
++ result.tx_device_aux = signer.store_tx_aux_info();
++ fill_key_images_from_signed_tx(result.key_images, signer.tdata(), *utx);
++ return result;
++ }
++
}
}
}
diff --git a/src/device_trezor/trezor/protocol.hpp b/src/device_trezor/trezor/protocol.hpp
-index 7ffadd9aa..7899e60d0 100644
+index 7ffadd9aa..987c95eb5 100644
--- a/src/device_trezor/trezor/protocol.hpp
+++ b/src/device_trezor/trezor/protocol.hpp
-@@ -340,8 +340,16 @@ namespace tx {
+@@ -340,8 +340,35 @@ namespace tx {
const TData & tdata() const {
return m_ct;
}
++
++ TData & tdata() {
++ return m_ct;
++ }
++
+ void export_source_entry(MoneroTransactionSourceEntry *dst, size_t idx, bool need_ring_keys, bool need_ring_indices);
};
++ struct trezor_connect_signed_tx {
++ tools::wallet2::pending_tx ptx;
++ std::string tx_device_aux;
++ std::vector<::crypto::key_image> key_images;
++ };
++
+ std::string trezor_connect_monero_sign_transaction_to_json(
+ wallet_shim *wallet,
+ const unsigned_tx_set *utx,
@@ -333,11 +577,19 @@ index 7ffadd9aa..7899e60d0 100644
+ hw::tx_aux_data *aux_data,
+ cryptonote::network_type network_type);
+
++ trezor_connect_signed_tx trezor_connect_monero_apply_sign_response(
++ wallet_shim *wallet,
++ const unsigned_tx_set *utx,
++ size_t tx_idx,
++ hw::tx_aux_data *aux_data,
++ const std::string &response_json,
++ const cryptonote::transaction *prefix_tx);
++
// TX Key decryption
void load_tx_key_data(hw::device_cold::tx_key_data_t & res, const std::string & data);
diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp
-index 1f714d229..22c09483d 100644
+index 1f714d229..548e24352 100644
--- a/src/wallet/api/pending_transaction.cpp
+++ b/src/wallet/api/pending_transaction.cpp
@@ -44,6 +44,11 @@
@@ -352,7 +604,7 @@ index 1f714d229..22c09483d 100644
using namespace std;
namespace Monero {
-@@ -210,6 +215,61 @@ std::string PendingTransactionImpl::commitUR(int max_fragment_length) {
+@@ -210,6 +215,144 @@ std::string PendingTransactionImpl::commitUR(int max_fragment_length) {
}
}
@@ -398,6 +650,14 @@ index 1f714d229..22c09483d 100644
+ static_cast<size_t>(tx_index),
+ &aux_data,
+ w->nettype());
++
++ m_trezor_connect_session = std::make_unique<TrezorConnectSession>();
++ m_trezor_connect_session->utx = std::move(utx);
++ m_trezor_connect_session->aux = aux_data;
++ m_trezor_connect_session->shim = shim;
++ m_trezor_connect_session->prefix_tx = m_pending_tx[tx_index].tx;
++ m_trezor_connect_session->tx_idx = tx_index;
++
+ m_errorString.clear();
+ m_status = Status_Ok;
+ return json;
@@ -411,21 +671,130 @@ index 1f714d229..22c09483d 100644
+#endif
+}
+
++bool PendingTransactionImpl::commitTrezorNext(const std::string &response_json, uint64_t tx_index)
++{
++#if !defined(DEVICE_TREZOR_READY) || !DEVICE_TREZOR_READY
++ (void)response_json;
++ (void)tx_index;
++ m_errorString = tr("This build was compiled without Trezor support");
++ m_status = Status_Error;
++ return false;
++#else
++ if (tx_index >= m_pending_tx.size())
++ {
++ m_errorString = tr("Invalid transaction index");
++ m_status = Status_Error;
++ return false;
++ }
++ try
++ {
++ tools::wallet2 *w = m_wallet.m_wallet.get();
++ std::unique_ptr<TrezorConnectSession> session = std::move(m_trezor_connect_session);
++ std::unique_ptr<TrezorConnectSession> fallback_session;
++
++ if (!session || session->tx_idx != tx_index)
++ {
++ fallback_session = std::make_unique<TrezorConnectSession>();
++ session = std::move(fallback_session);
++ w->construct_unsigned_tx_set_for_signing(m_pending_tx, session->utx);
++ if (std::get<0>(session->utx.transfers) != 0)
++ {
++ m_errorString = tr("Unsupported unsigned transaction transfer offset");
++ m_status = Status_Error;
++ return false;
++ }
++ const int bpv = w->use_fork_rules(HF_VERSION_BULLETPROOF_PLUS, -10) ? 4
++ : (w->use_fork_rules(HF_VERSION_CLSAG, -10) ? 3
++ : (w->use_fork_rules(HF_VERSION_SMALLER_BP, -10) ? 2 : 1));
++ session->aux.bp_version = bpv;
++ session->aux.hard_fork = w->get_current_hard_fork();
++ session->aux.client_version = static_cast<unsigned>(bpv >= 4 ? 4u : 3u);
++ session->shim.get_tx_pub_key_from_received_outs = std::bind(
++ &tools::wallet2::get_tx_pub_key_from_received_outs, w, std::placeholders::_1);
++ session->prefix_tx = m_pending_tx[tx_index].tx;
++ session->tx_idx = tx_index;
++ }
++
++ const auto signed_tx = hw::trezor::protocol::tx::trezor_connect_monero_apply_sign_response(
++ &session->shim,
++ &session->utx,
++ static_cast<size_t>(tx_index),
++ &session->aux,
++ response_json,
++ &session->prefix_tx);
++
++ m_pending_tx[tx_index] = signed_tx.ptx;
++ m_key_images = signed_tx.key_images;
++
++ if (!signed_tx.tx_device_aux.empty())
++ {
++ if (m_tx_device_aux.size() <= tx_index)
++ m_tx_device_aux.resize(tx_index + 1);
++ m_tx_device_aux[tx_index] = signed_tx.tx_device_aux;
++ }
++
++ m_errorString.clear();
++ m_status = Status_Ok;
++ return commit();
++ }
++ catch (const std::exception &e)
++ {
++ m_errorString = e.what();
++ m_status = Status_Error;
++ return false;
++ }
++#endif
++}
++
uint64_t PendingTransactionImpl::amount() const
{
diff --git a/src/wallet/api/pending_transaction.h b/src/wallet/api/pending_transaction.h
-index 0cc6c58e9..9c9097cd1 100644
+index 0cc6c58e9..32a7a296f 100644
--- a/src/wallet/api/pending_transaction.h
+++ b/src/wallet/api/pending_transaction.h
-@@ -47,6 +47,7 @@ public:
+@@ -31,9 +31,14 @@
+ #include "wallet/api/wallet2_api.h"
+ #include "wallet/wallet2.h"
+
++#include <memory>
+ #include <string>
+ #include <vector>
+
++#if defined(DEVICE_TREZOR_READY) && DEVICE_TREZOR_READY
++#include "device/device_cold.hpp"
++#endif
++
+
+ namespace Monero {
+
+@@ -47,6 +52,8 @@ public:
std::string errorString() const override;
bool commit(const std::string &filename = "", bool overwrite = false) override;
std::string commitUR(int max_fragment_length = 130) override;
+ std::string commitTrezor(uint64_t tx_index = 0) override;
++ bool commitTrezorNext(const std::string &response_json, uint64_t tx_index = 0) override;
uint64_t amount() const override;
uint64_t dust() const override;
uint64_t fee() const override;
+@@ -72,6 +79,17 @@ private:
+ std::unordered_set<crypto::public_key> m_signers;
+ std::vector<std::string> m_tx_device_aux;
+ std::vector<crypto::key_image> m_key_images;
++
++#if defined(DEVICE_TREZOR_READY) && DEVICE_TREZOR_READY
++ struct TrezorConnectSession {
++ tools::wallet2::unsigned_tx_set utx;
++ hw::tx_aux_data aux;
++ hw::wallet_shim shim;
++ cryptonote::transaction prefix_tx;
++ size_t tx_idx{0};
++ };
++ std::unique_ptr<TrezorConnectSession> m_trezor_connect_session;
++#endif
+ };
+
+
diff --git a/src/wallet/api/unsigned_transaction.cpp b/src/wallet/api/unsigned_transaction.cpp
index fd03e959d..7232e518f 100644
--- a/src/wallet/api/unsigned_transaction.cpp
@@ -505,18 +874,19 @@ index 98c03b9c1..5248badb8 100644
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
-index 3d11929f9..ee9edd68e 100644
+index 3d11929f9..760fc8859 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
-@@ -92,6 +92,7 @@ struct PendingTransaction
+@@ -92,6 +92,8 @@ struct PendingTransaction
// commit transaction or save to file if filename is provided.
virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0;
virtual std::string commitUR(int max_fragment_length = 130) = 0;
+ virtual std::string commitTrezor(uint64_t tx_index = 0) = 0;
++ virtual bool commitTrezorNext(const std::string &response_json, uint64_t tx_index = 0) = 0;
virtual uint64_t amount() const = 0;
virtual uint64_t dust() const = 0;
virtual uint64_t fee() const = 0;
-@@ -1220,6 +1221,19 @@ struct Wallet
+@@ -1220,6 +1222,19 @@ struct Wallet
//! serialize wallet cache to JSON
virtual std::string serializeCacheToJson() const = 0;
@@ -741,5 +1111,5 @@ index 37a2447d2..a1ca49e90 100644
bool daemon_requires_payment();
bool make_rpc_payment(uint32_t nonce, uint32_t cookie, uint64_t &credits, uint64_t &balance);
--
-2.51.0
+2.50.1 (Apple Git-155)