diff options
| -rw-r--r-- | impls/monero.dart/lib/monero.dart | 77 | ||||
| -rw-r--r-- | impls/monero.dart/lib/src/checksum_monero.dart | 4 | ||||
| -rw-r--r-- | impls/monero.dart/lib/src/generated_bindings_monero.g.dart | 176 | ||||
| -rw-r--r-- | impls/monero.ts/checksum_monero.ts | 4 | ||||
| -rw-r--r-- | monero_libwallet2_api_c/src/main/cpp/monero_checksum.h | 4 | ||||
| -rw-r--r-- | monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp | 44 | ||||
| -rw-r--r-- | monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h | 10 |
7 files changed, 50 insertions, 269 deletions
diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index 7b6eac3..5acc431 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -3279,76 +3279,17 @@ int MONERO_Wallet_getBytesSent(wallet ptr) { return getBytesSent; } -bool Wallet_getStateIsConnected(wallet ptr) { - debugStart?.call('MONERO_Wallet_getStateIsConnected'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getStateIsConnected(ptr); - debugEnd?.call('MONERO_Wallet_getStateIsConnected'); - return ret; -} - -Pointer<UnsignedChar> Wallet_getSendToDevice(wallet ptr) { - debugStart?.call('MONERO_Wallet_getSendToDevice'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getSendToDevice(ptr); - debugEnd?.call('MONERO_Wallet_getSendToDevice'); - return ret; -} - -int Wallet_getSendToDeviceLength(wallet ptr) { - debugStart?.call('MONERO_Wallet_getSendToDeviceLength'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getSendToDeviceLength(ptr); - debugEnd?.call('MONERO_Wallet_getSendToDeviceLength'); - return ret; -} - -Pointer<UnsignedChar> Wallet_getReceivedFromDevice(wallet ptr) { - debugStart?.call('MONERO_Wallet_getReceivedFromDevice'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getReceivedFromDevice(ptr); - debugEnd?.call('MONERO_Wallet_getReceivedFromDevice'); - return ret; -} - -int Wallet_getReceivedFromDeviceLength(wallet ptr) { - debugStart?.call('MONERO_Wallet_getReceivedFromDeviceLength'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getReceivedFromDeviceLength(ptr); - debugEnd?.call('MONERO_Wallet_getReceivedFromDeviceLength'); - return ret; -} - -bool Wallet_getWaitsForDeviceSend(wallet ptr) { - debugStart?.call('MONERO_Wallet_getWaitsForDeviceSend'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getWaitsForDeviceSend(ptr); - debugEnd?.call('MONERO_Wallet_getWaitsForDeviceSend'); - return ret; -} - -bool Wallet_getWaitsForDeviceReceive(wallet ptr) { - debugStart?.call('MONERO_Wallet_getWaitsForDeviceReceive'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_getWaitsForDeviceReceive(ptr); - debugEnd?.call('MONERO_Wallet_getWaitsForDeviceReceive'); - return ret; -} - -void Wallet_setDeviceReceivedData( - wallet ptr, Pointer<UnsignedChar> data, int len) { - debugStart?.call('MONERO_Wallet_setDeviceReceivedData'); - lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_setDeviceReceivedData(ptr, data, len); - debugEnd?.call('MONERO_Wallet_setDeviceReceivedData'); - return ret; -} +typedef LedgerExchangeFunction = Pointer< + NativeFunction< + Int Function(Pointer<UnsignedChar> command, UnsignedInt cmd_len, + Pointer<UnsignedChar> response, UnsignedInt max_resp_len)>>; -void Wallet_setDeviceSendData(wallet ptr, Pointer<UnsignedChar> data, int len) { - debugStart?.call('MONERO_Wallet_setDeviceSendData'); +void Wallet_setLedgerExchange( + wallet ptr, LedgerExchangeFunction sendToLedgerDevice) { + debugStart?.call('MONERO_Wallet_setLedgerExchange'); lib ??= MoneroC(DynamicLibrary.open(libPath)); - final ret = lib!.MONERO_Wallet_setDeviceSendData(ptr, data, len); - debugEnd?.call('MONERO_Wallet_setDeviceSendData'); + final ret = lib!.MONERO_Wallet_setLedgerExchange(ptr, sendToLedgerDevice); + debugEnd?.call('MONERO_Wallet_setLedgerExchange'); return ret; } diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index 1092533..f3f2884 100644 --- a/impls/monero.dart/lib/src/checksum_monero.dart +++ b/impls/monero.dart/lib/src/checksum_monero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names -const String wallet2_api_c_h_sha256 = "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b"; -const String wallet2_api_c_cpp_sha256 = "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; +const String wallet2_api_c_h_sha256 = "87ec362cdf9b3e6403d899c11e7ae39d932a8098c3ebb360723b537bded2d8de"; +const String wallet2_api_c_cpp_sha256 = "32cc5fbbdb89e77f33619b7f3d942cfac4202f3a3838605a396aed3882d668b5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const String wallet2_api_c_exp_sha256 = "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522"; 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 cd2124b..48a59a6 100644 --- a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart +++ b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart @@ -4384,158 +4384,46 @@ class MoneroC { late final _MONERO_Wallet_getBytesSent = _MONERO_Wallet_getBytesSentPtr .asFunction<int Function(ffi.Pointer<ffi.Void>)>(); - bool MONERO_Wallet_getStateIsConnected( + void MONERO_Wallet_setLedgerExchange( ffi.Pointer<ffi.Void> wallet_ptr, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<ffi.UnsignedChar> command, + ffi.UnsignedInt cmd_len, + ffi.Pointer<ffi.UnsignedChar> response, + ffi.UnsignedInt max_resp_len)>> + sendToLedgerDevice, ) { - return _MONERO_Wallet_getStateIsConnected( + return _MONERO_Wallet_setLedgerExchange( wallet_ptr, + sendToLedgerDevice, ); } - late final _MONERO_Wallet_getStateIsConnectedPtr = - _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>( - 'MONERO_Wallet_getStateIsConnected'); - late final _MONERO_Wallet_getStateIsConnected = - _MONERO_Wallet_getStateIsConnectedPtr.asFunction< - bool Function(ffi.Pointer<ffi.Void>)>(); - - ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getSendToDevice( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getSendToDevice( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getSendToDevicePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer<ffi.UnsignedChar> Function( - ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_getSendToDevice'); - late final _MONERO_Wallet_getSendToDevice = - _MONERO_Wallet_getSendToDevicePtr.asFunction< - ffi.Pointer<ffi.UnsignedChar> Function(ffi.Pointer<ffi.Void>)>(); - - int MONERO_Wallet_getSendToDeviceLength( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getSendToDeviceLength( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getSendToDeviceLengthPtr = - _lookup<ffi.NativeFunction<ffi.Size Function(ffi.Pointer<ffi.Void>)>>( - 'MONERO_Wallet_getSendToDeviceLength'); - late final _MONERO_Wallet_getSendToDeviceLength = - _MONERO_Wallet_getSendToDeviceLengthPtr.asFunction< - int Function(ffi.Pointer<ffi.Void>)>(); - - ffi.Pointer<ffi.UnsignedChar> MONERO_Wallet_getReceivedFromDevice( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getReceivedFromDevice( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getReceivedFromDevicePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer<ffi.UnsignedChar> Function( - ffi.Pointer<ffi.Void>)>>('MONERO_Wallet_getReceivedFromDevice'); - late final _MONERO_Wallet_getReceivedFromDevice = - _MONERO_Wallet_getReceivedFromDevicePtr.asFunction< - ffi.Pointer<ffi.UnsignedChar> Function(ffi.Pointer<ffi.Void>)>(); - - int MONERO_Wallet_getReceivedFromDeviceLength( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getReceivedFromDeviceLength( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getReceivedFromDeviceLengthPtr = - _lookup<ffi.NativeFunction<ffi.Size Function(ffi.Pointer<ffi.Void>)>>( - 'MONERO_Wallet_getReceivedFromDeviceLength'); - late final _MONERO_Wallet_getReceivedFromDeviceLength = - _MONERO_Wallet_getReceivedFromDeviceLengthPtr.asFunction< - int Function(ffi.Pointer<ffi.Void>)>(); - - bool MONERO_Wallet_getWaitsForDeviceSend( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getWaitsForDeviceSend( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getWaitsForDeviceSendPtr = - _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>( - 'MONERO_Wallet_getWaitsForDeviceSend'); - late final _MONERO_Wallet_getWaitsForDeviceSend = - _MONERO_Wallet_getWaitsForDeviceSendPtr.asFunction< - bool Function(ffi.Pointer<ffi.Void>)>(); - - bool MONERO_Wallet_getWaitsForDeviceReceive( - ffi.Pointer<ffi.Void> wallet_ptr, - ) { - return _MONERO_Wallet_getWaitsForDeviceReceive( - wallet_ptr, - ); - } - - late final _MONERO_Wallet_getWaitsForDeviceReceivePtr = - _lookup<ffi.NativeFunction<ffi.Bool Function(ffi.Pointer<ffi.Void>)>>( - 'MONERO_Wallet_getWaitsForDeviceReceive'); - late final _MONERO_Wallet_getWaitsForDeviceReceive = - _MONERO_Wallet_getWaitsForDeviceReceivePtr.asFunction< - bool Function(ffi.Pointer<ffi.Void>)>(); - - void MONERO_Wallet_setDeviceReceivedData( - ffi.Pointer<ffi.Void> wallet_ptr, - ffi.Pointer<ffi.UnsignedChar> data, - int len, - ) { - return _MONERO_Wallet_setDeviceReceivedData( - wallet_ptr, - data, - len, - ); - } - - late final _MONERO_Wallet_setDeviceReceivedDataPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.UnsignedChar>, - ffi.Size)>>('MONERO_Wallet_setDeviceReceivedData'); - late final _MONERO_Wallet_setDeviceReceivedData = - _MONERO_Wallet_setDeviceReceivedDataPtr.asFunction< + late final _MONERO_Wallet_setLedgerExchangePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<ffi.UnsignedChar> command, + ffi.UnsignedInt cmd_len, + ffi.Pointer<ffi.UnsignedChar> response, + ffi.UnsignedInt max_resp_len)>>)>>( + 'MONERO_Wallet_setLedgerExchange'); + late final _MONERO_Wallet_setLedgerExchange = + _MONERO_Wallet_setLedgerExchangePtr.asFunction< void Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.UnsignedChar>, int)>(); - - void MONERO_Wallet_setDeviceSendData( - ffi.Pointer<ffi.Void> wallet_ptr, - ffi.Pointer<ffi.UnsignedChar> data, - int len, - ) { - return _MONERO_Wallet_setDeviceSendData( - wallet_ptr, - data, - len, - ); - } - - late final _MONERO_Wallet_setDeviceSendDataPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.UnsignedChar>, - ffi.Size)>>('MONERO_Wallet_setDeviceSendData'); - late final _MONERO_Wallet_setDeviceSendData = - _MONERO_Wallet_setDeviceSendDataPtr.asFunction< - void Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.UnsignedChar>, int)>(); + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer<ffi.UnsignedChar> command, + ffi.UnsignedInt cmd_len, + ffi.Pointer<ffi.UnsignedChar> response, + ffi.UnsignedInt max_resp_len)>>)>(); ffi.Pointer<ffi.Void> MONERO_WalletManager_createWallet( ffi.Pointer<ffi.Void> wm_ptr, diff --git a/impls/monero.ts/checksum_monero.ts b/impls/monero.ts/checksum_monero.ts index b8e57cb..7a322dd 100644 --- a/impls/monero.ts/checksum_monero.ts +++ b/impls/monero.ts/checksum_monero.ts @@ -1,5 +1,5 @@ export const moneroChecksum = { - wallet2_api_c_h_sha256: "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b", - wallet2_api_c_cpp_sha256: "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd", + wallet2_api_c_h_sha256: "87ec362cdf9b3e6403d899c11e7ae39d932a8098c3ebb360723b537bded2d8de", + wallet2_api_c_cpp_sha256: "32cc5fbbdb89e77f33619b7f3d942cfac4202f3a3838605a396aed3882d668b5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd", wallet2_api_c_exp_sha256: "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522", } diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h index 4d3d39f..ffd5517 100644 --- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h +++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS -const char * MONERO_wallet2_api_c_h_sha256 = "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b"; -const char * MONERO_wallet2_api_c_cpp_sha256 = "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; +const char * MONERO_wallet2_api_c_h_sha256 = "87ec362cdf9b3e6403d899c11e7ae39d932a8098c3ebb360723b537bded2d8de"; +const char * MONERO_wallet2_api_c_cpp_sha256 = "32cc5fbbdb89e77f33619b7f3d942cfac4202f3a3838605a396aed3882d668b5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const char * MONERO_wallet2_api_c_exp_sha256 = "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522"; #endif diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 0cc2f9f..f44e46a 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -1607,49 +1607,9 @@ uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr) { return wallet->getBytesSent(); } -bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr) { +void MONERO_Wallet_setLedgerExchange(void* wallet_ptr, int (*sendToLedgerDevice) (unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len)) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getStateIsConnected(); -} - -unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getSendToDevice(); -} - -size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getSendToDeviceLength(); -} - -unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getReceivedFromDevice(); -} - -size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getReceivedFromDeviceLength(); -} - -bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getWaitsForDeviceSend(); -} - -bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->getWaitsForDeviceReceive(); -} - -void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->setDeviceReceivedData(data, len); -} - -void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len) { - Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); - return wallet->setDeviceSendData(data, len); + return wallet->setLedgerExchange(sendToLedgerDevice); } void* MONERO_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) { diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h index 143da40..80a72c5 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h @@ -834,15 +834,7 @@ extern ADDAPI uint64_t MONERO_Wallet_getBytesReceived(void* wallet_ptr); // virtual uint64_t getBytesSent() = 0; extern ADDAPI uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr); // HIDAPI_DUMMY -extern ADDAPI bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr); -extern ADDAPI unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr); -extern ADDAPI size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr); -extern ADDAPI unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr); -extern ADDAPI size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr); -extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr); -extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr); -extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len); -extern ADDAPI void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len); +extern ADDAPI void MONERO_Wallet_setLedgerExchange(void* wallet_ptr, int (*sendToLedgerDevice) (unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len)); // }; // struct WalletManager |
