From 022e673844e85bd0dc6effebe0a0d83046e5b8ef Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Thu, 7 Nov 2024 20:16:49 +0400 Subject: [PATCH] feat!: drop bridge wrapper --- index.js | 6 +- monero_utils/MyMoneroBridge_utils.js | 43 ------------- .../MyMoneroCoreBridgeEssentialsClass.js | 62 ------------------- 3 files changed, 2 insertions(+), 109 deletions(-) delete mode 100644 monero_utils/MyMoneroBridge_utils.js delete mode 100644 monero_utils/MyMoneroCoreBridgeEssentialsClass.js diff --git a/index.js b/index.js index d093d2737..6ca6c340a 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,10 @@ 'use strict' -const MyMoneroCoreBridgeEssentialsClass = require('./monero_utils/MyMoneroCoreBridgeEssentialsClass.js') const MyMoneroCoreCppWASM = require('./monero_utils/MyMoneroCoreCpp_WASM.js') async function loadMyMoneroCore(options) { - const thisModule = await MyMoneroCoreCppWASM(options).ready - const instance = new MyMoneroCoreBridgeEssentialsClass(thisModule) - return instance + const Module = await MyMoneroCoreCppWASM(options).ready + return { Module } } module.exports = { loadMyMoneroCore } diff --git a/monero_utils/MyMoneroBridge_utils.js b/monero_utils/MyMoneroBridge_utils.js deleted file mode 100644 index c4e3406b7..000000000 --- a/monero_utils/MyMoneroBridge_utils.js +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014-2019, MyMonero.com -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -function api_safe_wordset_name(wordset_name) -{ - // convert all lowercase, legacy values to core-cpp compatible - if (wordset_name == "english") { - return "English" - } else if (wordset_name == "spanish") { - return "Español" - } else if (wordset_name == "portuguese") { - return "Português" - } else if (wordset_name == "japanese") { - return "日本語" - } - return wordset_name // must be a value returned by core-cpp -} -exports.api_safe_wordset_name = api_safe_wordset_name; diff --git a/monero_utils/MyMoneroCoreBridgeEssentialsClass.js b/monero_utils/MyMoneroCoreBridgeEssentialsClass.js deleted file mode 100644 index 4d72b56ef..000000000 --- a/monero_utils/MyMoneroCoreBridgeEssentialsClass.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014-2019, MyMonero.com -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Original Author: Lucas Jones -// Modified to remove jQuery dep and support modular inclusion of deps by Paul Shapiro (2016) -// Modified to add RingCT support by luigi1111 (2017) -// -// v--- These should maybe be injected into a context and supplied to currencyConfig for future platforms -const MyMoneroBridge_utils = require('./MyMoneroBridge_utils') -// -class MyMoneroCoreBridgeEssentialsClass -{ - constructor(this_Module) - { - this.Module = this_Module; - } - // - mnemonic_from_seed( - seed_string, - wordset_name - ) { - const args = - { - seed_string: seed_string, - wordset_name: MyMoneroBridge_utils.api_safe_wordset_name(wordset_name) - }; - const args_str = JSON.stringify(args); - const ret_string = this.Module.mnemonic_from_seed(args_str); - const ret = JSON.parse(ret_string); - if (typeof ret.err_msg !== 'undefined' && ret.err_msg) { - throw ret.err_msg // TODO: maybe return this somehow - } - return ret.retVal; - } -} -// -module.exports = MyMoneroCoreBridgeEssentialsClass