From d108939442c3447d4eb82b0f1959ac7233dce610 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 4 Feb 2022 12:34:48 +0200 Subject: [PATCH] Fix Cucumber FFI interface --- integration_tests/helpers/ffi/ffiInterface.js | 7 ++++++- integration_tests/helpers/ffi/wallet.js | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/integration_tests/helpers/ffi/ffiInterface.js b/integration_tests/helpers/ffi/ffiInterface.js index 048041480a..250d69a2ff 100644 --- a/integration_tests/helpers/ffi/ffiInterface.js +++ b/integration_tests/helpers/ffi/ffiInterface.js @@ -291,6 +291,7 @@ class InterfaceFFI { this.ptr, this.ptr, this.ptr, + this.ptr, this.boolPtr, this.intPtr, ], @@ -1165,6 +1166,9 @@ class InterfaceFFI { fn ); } + static createCallbackConnectivityStatus(fn) { + return ffi.Callback(this.void, [this.ulonglong], fn); + } //endregion static walletCreate( @@ -1186,7 +1190,8 @@ class InterfaceFFI { callback_txo_validation_complete, callback_balance_updated, callback_transaction_validation_complete, - callback_saf_message_received + callback_saf_message_received, + callback_connectivity_status ) { let error = this.initError(); let recovery_in_progress = this.initBool(); diff --git a/integration_tests/helpers/ffi/wallet.js b/integration_tests/helpers/ffi/wallet.js index d48a4e3cda..d307660dd2 100644 --- a/integration_tests/helpers/ffi/wallet.js +++ b/integration_tests/helpers/ffi/wallet.js @@ -43,6 +43,7 @@ class Wallet { callback_balance_updated; callback_transaction_validation_complete; callback_saf_message_received; + callback_connectivity_status; recoveryProgressCallback; getTxoValidationStatus() { @@ -141,6 +142,10 @@ class Wallet { this.recoveryProgressCallback = InterfaceFFI.createRecoveryProgressCallback( this.onRecoveryProgress ); + this.callback_connectivity_status = + InterfaceFFI.createCallbackConnectivityStatus( + this.onConnectivityStatusChange + ); //endregion this.receivedTransaction = 0; @@ -180,7 +185,8 @@ class Wallet { this.callback_txo_validation_complete, this.callback_balance_updated, this.callback_transaction_validation_complete, - this.callback_saf_message_received + this.callback_saf_message_received, + this.callback_connectivity_status ); } @@ -328,6 +334,10 @@ class Wallet { return InterfaceFFI.walletIsRecoveryInProgress(this.ptr); } + onConnectivityStatusChange = (status) => { + console.log("Connectivity Status Changed to ", status); + }; + getPublicKey() { let ptr = InterfaceFFI.walletGetPublicKey(this.ptr); let pk = new PublicKey(); @@ -463,6 +473,7 @@ class Wallet { this.callback_transaction_validation_complete = this.callback_saf_message_received = this.recoveryProgressCallback = + this.callback_connectivity_status = undefined; // clear callback function pointers } }