diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e6bae5..2e9bb2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(LogosExecutionZone LANGUAGES CXX) +project(LEZCore LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -12,10 +12,10 @@ else() endif() logos_module( - NAME logos_execution_zone + NAME lez_core SOURCES - src/logos_execution_zone_wallet_module.h - src/logos_execution_zone_wallet_module.cpp + src/lez_core_module.h + src/lez_core_module.cpp EXTERNAL_LIBS wallet_ffi ) diff --git a/README.md b/README.md index edb9259..b76f648 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Logos Blockchain Module +# Logos Execution Zone Core Module ### Setup diff --git a/flake.nix b/flake.nix index b35fc50..48e324e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Logos Execution Zone Wallet Module"; + description = "Logos Execution Zone Core Module"; inputs = { logos-module-builder.url = "github:logos-co/logos-module-builder"; diff --git a/justfile b/justfile index 19a87c2..774fdab 100644 --- a/justfile +++ b/justfile @@ -3,11 +3,11 @@ default: build configure: cmake -S . -B build -G Ninja \ ${LOGOS_CORE_ROOT:+-DLOGOS_CORE_ROOT="$LOGOS_CORE_ROOT"} \ - ${LOGOS_EXECUTION_ZONE_WALLET_LIB:+-DLOGOS_EXECUTION_ZONE_WALLET_LIB="$LOGOS_EXECUTION_ZONE_WALLET_LIB"} \ - ${LOGOS_EXECUTION_ZONE_WALLET_INCLUDE:+-DLOGOS_EXECUTION_ZONE_WALLET_INCLUDE="$LOGOS_EXECUTION_ZONE_WALLET_INCLUDE"} + ${LEZ_CORE_LIB:+-DLEZ_CORE_LIB="$LEZ_CORE_LIB"} \ + ${LEZ_CORE_INCLUDE:+-DLEZ_CORE_INCLUDE="$LEZ_CORE_INCLUDE"} build: configure - cmake --build build --parallel --target lez_wallet_module_plugin + cmake --build build --parallel --target lez_core_module_plugin clean: rm -rf build result diff --git a/metadata.json b/metadata.json index 7469dd1..4bbc267 100644 --- a/metadata.json +++ b/metadata.json @@ -1,17 +1,17 @@ { - "name": "logos_execution_zone", - "display_name": "LEZ Module", - "version": "1.0.0", - "description": "Logos Execution Zone Module for Logos Core", + "name": "lez_core", + "display_name": "LEZ Core Module", + "version": "0.2.0", + "description": "Logos Execution Zone Core Module for Logos Core", "author": "Logos Blockchain Team", "type": "core", "category": "blockchain", "interface": "universal", "codegen": { - "impl_header": "src/logos_execution_zone_wallet_module.h", - "impl_class": "LogosExecutionZoneWalletModule" + "impl_header": "src/lez_core_module.h", + "impl_class": "LEZCoreModule" }, - "main": "logos_execution_zone_plugin", + "main": "lez_core_plugin", "dependencies": [], "capabilities": [], "include": [], diff --git a/src/logos_execution_zone_wallet_module.cpp b/src/lez_core_module.cpp similarity index 92% rename from src/logos_execution_zone_wallet_module.cpp rename to src/lez_core_module.cpp index 0eadbc2..d49c373 100644 --- a/src/logos_execution_zone_wallet_module.cpp +++ b/src/lez_core_module.cpp @@ -1,4 +1,4 @@ -#include "logos_execution_zone_wallet_module.h" +#include "lez_core_module.h" #include #include @@ -263,26 +263,26 @@ bool jsonArrayHexToSiblings32(const std::string& json_array_str, std::vector(block_id)); } -int64_t LogosExecutionZoneWalletModule::get_last_synced_block() { +int64_t LEZCoreModule::get_last_synced_block() { uint64_t block_id = 0; const WalletFfiError error = wallet_ffi_get_last_synced_block(walletHandle, &block_id); if (error != SUCCESS) { @@ -453,7 +453,7 @@ int64_t LogosExecutionZoneWalletModule::get_last_synced_block() { return static_cast(block_id); } -int64_t LogosExecutionZoneWalletModule::get_current_block_height() { +int64_t LEZCoreModule::get_current_block_height() { uint64_t block_height = 0; const WalletFfiError error = wallet_ffi_get_current_block_height(walletHandle, &block_height); if (error != SUCCESS) { @@ -465,7 +465,7 @@ int64_t LogosExecutionZoneWalletModule::get_current_block_height() { // === Pinata claiming === -std::string LogosExecutionZoneWalletModule::claim_pinata( +std::string LEZCoreModule::claim_pinata( const std::string& pinata_account_id_hex, const std::string& winner_account_id_hex, const std::string& solution_le16_hex @@ -491,7 +491,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata( return resultJson; } -std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_already_initialized( +std::string LEZCoreModule::claim_pinata_private_owned_already_initialized( const std::string& pinata_account_id_hex, const std::string& winner_account_id_hex, const std::string& solution_le16_hex, @@ -541,7 +541,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_already_i return resultJson; } -std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_not_initialized( +std::string LEZCoreModule::claim_pinata_private_owned_not_initialized( const std::string& pinata_account_id_hex, const std::string& winner_account_id_hex, const std::string& solution_le16_hex @@ -575,7 +575,7 @@ std::string LogosExecutionZoneWalletModule::claim_pinata_private_owned_not_initi // === Operations === -std::string LogosExecutionZoneWalletModule::transfer_public( +std::string LEZCoreModule::transfer_public( const std::string& from_hex, const std::string& to_hex, const std::string& amount_le16_hex @@ -603,7 +603,7 @@ std::string LogosExecutionZoneWalletModule::transfer_public( return resultJson; } -std::string LogosExecutionZoneWalletModule::transfer_shielded( +std::string LEZCoreModule::transfer_shielded( const std::string& from_hex, const std::string& to_keys_json, const std::string& amount_le16_hex @@ -648,7 +648,7 @@ std::string LogosExecutionZoneWalletModule::transfer_shielded( return resultJson; } -std::string LogosExecutionZoneWalletModule::transfer_deshielded( +std::string LEZCoreModule::transfer_deshielded( const std::string& from_hex, const std::string& to_hex, const std::string& amount_le16_hex @@ -676,7 +676,7 @@ std::string LogosExecutionZoneWalletModule::transfer_deshielded( return resultJson; } -std::string LogosExecutionZoneWalletModule::transfer_private( +std::string LEZCoreModule::transfer_private( const std::string& from_hex, const std::string& to_keys_json, const std::string& amount_le16_hex @@ -717,7 +717,7 @@ std::string LogosExecutionZoneWalletModule::transfer_private( return resultJson; } -std::string LogosExecutionZoneWalletModule::transfer_shielded_owned( +std::string LEZCoreModule::transfer_shielded_owned( const std::string& from_hex, const std::string& to_hex, const std::string& amount_le16_hex @@ -748,7 +748,7 @@ std::string LogosExecutionZoneWalletModule::transfer_shielded_owned( return resultJson; } -std::string LogosExecutionZoneWalletModule::transfer_private_owned( +std::string LEZCoreModule::transfer_private_owned( const std::string& from_hex, const std::string& to_hex, const std::string& amount_le16_hex @@ -776,7 +776,7 @@ std::string LogosExecutionZoneWalletModule::transfer_private_owned( return resultJson; } -std::string LogosExecutionZoneWalletModule::register_public_account(const std::string& account_id_hex) { +std::string LEZCoreModule::register_public_account(const std::string& account_id_hex) { FfiBytes32 id{}; if (!hexToBytes32(account_id_hex, &id)) { fprintf(stderr, "register_public_account: invalid account_id_hex\n"); @@ -795,7 +795,7 @@ std::string LogosExecutionZoneWalletModule::register_public_account(const std::s // === Bridge (L1 Bedrock <-> L2) === -std::string LogosExecutionZoneWalletModule::bridge_withdraw( +std::string LEZCoreModule::bridge_withdraw( const std::string& from_hex, const std::string& bedrock_account_pk_hex, const uint64_t amount @@ -820,7 +820,7 @@ std::string LogosExecutionZoneWalletModule::bridge_withdraw( // === Vault claiming === -std::string LogosExecutionZoneWalletModule::get_vault_balance(const std::string& owner_account_id_hex) { +std::string LEZCoreModule::get_vault_balance(const std::string& owner_account_id_hex) { FfiBytes32 ownerId{}; if (!hexToBytes32(owner_account_id_hex, &ownerId)) { fprintf(stderr, "get_vault_balance: invalid owner_account_id_hex\n"); @@ -836,7 +836,7 @@ std::string LogosExecutionZoneWalletModule::get_vault_balance(const std::string& return balanceLe16ToDecimalString(balance); } -std::string LogosExecutionZoneWalletModule::vault_claim( +std::string LEZCoreModule::vault_claim( const std::string& owner_account_id_hex, const std::string& amount_le16_hex ) { @@ -863,7 +863,7 @@ std::string LogosExecutionZoneWalletModule::vault_claim( return resultJson; } -std::string LogosExecutionZoneWalletModule::vault_claim_private( +std::string LEZCoreModule::vault_claim_private( const std::string& owner_account_id_hex, const std::string& amount_le16_hex ) { @@ -890,7 +890,7 @@ std::string LogosExecutionZoneWalletModule::vault_claim_private( return resultJson; } -std::string LogosExecutionZoneWalletModule::register_private_account(const std::string& account_id_hex) { +std::string LEZCoreModule::register_private_account(const std::string& account_id_hex) { FfiBytes32 id{}; if (!hexToBytes32(account_id_hex, &id)) { fprintf(stderr, "register_private_account: invalid account_id_hex\n"); @@ -907,7 +907,7 @@ std::string LogosExecutionZoneWalletModule::register_private_account(const std:: return resultJson; } -std::vector LogosExecutionZoneWalletModule::token_elf() { +std::vector LEZCoreModule::token_elf() { FfiProgram ffi_program{}; WalletFfiError error = wallet_ffi_token_elf(&ffi_program); if (error != SUCCESS) { @@ -922,7 +922,7 @@ std::vector LogosExecutionZoneWalletModule::token_elf() { return result; } -std::vector LogosExecutionZoneWalletModule::amm_elf() { +std::vector LEZCoreModule::amm_elf() { FfiProgram ffi_program{}; WalletFfiError error = wallet_ffi_token_elf(&ffi_program); if (error != SUCCESS) { @@ -937,7 +937,7 @@ std::vector LogosExecutionZoneWalletModule::amm_elf() { return result; } -std::vector LogosExecutionZoneWalletModule::ata_elf() { +std::vector LEZCoreModule::ata_elf() { FfiProgram ffi_program{}; WalletFfiError error = wallet_ffi_token_elf(&ffi_program); if (error != SUCCESS) { @@ -952,7 +952,7 @@ std::vector LogosExecutionZoneWalletModule::ata_elf() { return result; } -std::vector LogosExecutionZoneWalletModule::authenticated_transfer_elf() { +std::vector LEZCoreModule::authenticated_transfer_elf() { FfiProgram ffi_program{}; WalletFfiError error = wallet_ffi_token_elf(&ffi_program); if (error != SUCCESS) { @@ -967,7 +967,7 @@ std::vector LogosExecutionZoneWalletModule::authenticated_transfer_elf( return result; } -std::string LogosExecutionZoneWalletModule::send_generic_public_transaction( +std::string LEZCoreModule::send_generic_public_transaction( const std::vector& account_ids, const std::vector& signing_requirements, const std::vector& instruction, @@ -1032,7 +1032,7 @@ std::string LogosExecutionZoneWalletModule::send_generic_public_transaction( return resultJson; } -std::string LogosExecutionZoneWalletModule::send_generic_private_transaction( +std::string LEZCoreModule::send_generic_private_transaction( const std::vector& account_ids, const std::vector& instruction, const std::vector& program_elf, @@ -1121,7 +1121,7 @@ std::string LogosExecutionZoneWalletModule::send_generic_private_transaction( return resultJson; } -std::string LogosExecutionZoneWalletModule::send_program_deployment_transaction( +std::string LEZCoreModule::send_program_deployment_transaction( const std::vector& program_elf ) { FfiTransactionResult result {}; @@ -1147,7 +1147,7 @@ std::string LogosExecutionZoneWalletModule::send_program_deployment_transaction( // === Wallet Lifecycle === -std::string LogosExecutionZoneWalletModule::create_new( +std::string LEZCoreModule::create_new( const std::string& config_path, const std::string& storage_path, const std::string& password @@ -1171,7 +1171,7 @@ std::string LogosExecutionZoneWalletModule::create_new( return mnemonic; } -int64_t LogosExecutionZoneWalletModule::restore_storage(const std::string& mnemonic, const std::string password, uint32_t depth) { +int64_t LEZCoreModule::restore_storage(const std::string& mnemonic, const std::string password, uint32_t depth) { const WalletFfiError error = wallet_ffi_restore_data(walletHandle, mnemonic.c_str(), password.c_str(), depth); if (error != SUCCESS) { fprintf(stderr, "restore_storage: wallet FFI error %d\n", error); @@ -1181,7 +1181,7 @@ int64_t LogosExecutionZoneWalletModule::restore_storage(const std::string& mnemo return SUCCESS; } -int64_t LogosExecutionZoneWalletModule::open(const std::string& config_path, const std::string& storage_path) { +int64_t LEZCoreModule::open(const std::string& config_path, const std::string& storage_path) { if (walletHandle) { fprintf(stderr, "open: wallet is already open\n"); return INTERNAL_ERROR; @@ -1196,13 +1196,13 @@ int64_t LogosExecutionZoneWalletModule::open(const std::string& config_path, con return SUCCESS; } -int64_t LogosExecutionZoneWalletModule::save() { +int64_t LEZCoreModule::save() { return wallet_ffi_save(walletHandle); } // === Configuration === -std::string LogosExecutionZoneWalletModule::get_sequencer_addr() { +std::string LEZCoreModule::get_sequencer_addr() { char* addr = wallet_ffi_get_sequencer_addr(walletHandle); if (!addr) { fprintf(stderr, "get_sequencer_addr: wallet_ffi returned null\n"); diff --git a/src/logos_execution_zone_wallet_module.h b/src/lez_core_module.h similarity index 83% rename from src/logos_execution_zone_wallet_module.h rename to src/lez_core_module.h index 0a05bd8..4c82286 100644 --- a/src/logos_execution_zone_wallet_module.h +++ b/src/lez_core_module.h @@ -1,5 +1,5 @@ -#ifndef LOGOS_EXECUTION_ZONE_WALLET_MODULE_H -#define LOGOS_EXECUTION_ZONE_WALLET_MODULE_H +#ifndef LEZ_CORE_MODULE_H +#define LEZ_CORE_MODULE_H #include #include @@ -10,7 +10,7 @@ extern "C" { #include } -// Universal (Qt-free) execution-zone wallet module. The Qt glue (provider +// Universal (Qt-free) execution-zone core module. The Qt glue (provider // object + plugin) is generated from this header by logos-cpp-generator, which // maps the std return types below to the Qt signatures callers invoke: // std::string -> QString, int64_t -> int, LogosList -> QVariantList. @@ -18,13 +18,13 @@ extern "C" { // NOTE: the generator parses this header line-by-line and only recognises a // method when its declaration ends with ';' on a single line. Keep every // method declaration on ONE line — multi-line signatures are silently dropped. -class LogosExecutionZoneWalletModule { +class LEZCoreModule { public: - LogosExecutionZoneWalletModule(); - ~LogosExecutionZoneWalletModule(); + LEZCoreModule(); + ~LEZCoreModule(); - LogosExecutionZoneWalletModule(const LogosExecutionZoneWalletModule&) = delete; - LogosExecutionZoneWalletModule& operator=(const LogosExecutionZoneWalletModule&) = delete; + LEZCoreModule(const LEZCoreModule&) = delete; + LEZCoreModule& operator=(const LEZCoreModule&) = delete; std::string name() const; std::string version() const; @@ -78,15 +78,8 @@ public: std::vector ata_elf(); std::string send_generic_public_transaction(const std::vector& account_ids, const std::vector& signing_requirements, const std::vector& instruction, const std::string& program_id_hex); - std::string send_generic_private_transaction( - const std::vector& account_ids, - const std::vector& instruction, - const std::vector& program_elf, - const std::vector>& program_dependencies - ); - std::string send_program_deployment_transaction( - const std::vector& program_elf - ); + std::string send_generic_private_transaction(const std::vector& account_ids, const std::vector& instruction, const std::vector& program_elf, const std::vector>& program_dependencies); + std::string send_program_deployment_transaction(const std::vector& program_elf); // === Bridge (L1 Bedrock <-> L2) === std::string bridge_withdraw(const std::string& from_hex, const std::string& bedrock_account_pk_hex, uint64_t amount); @@ -103,4 +96,4 @@ private: WalletHandle* walletHandle = nullptr; }; -#endif // LOGOS_EXECUTION_ZONE_WALLET_MODULE_H +#endif // LEZ_CORE_MODULE_H