crypto-com / defi-wallet-core-rs

Cross-platform, cross-blockchain wallet library in Rust for DeFi Wallet and other applications.
Other
47 stars 16 forks source link

Problem: The namespace is not clear to distinguish between cosmos and cronos #355

Open damoncro opened 2 years ago

damoncro commented 2 years ago

After discussed with @lezzokafka and @ricky321q long time ago, we should rename the namespace to be easily distinguish between cosmos and cronos, for example:

  1. org::defi_wallet_core::cosmos
  2. org::defi_wallet_core::cronos
  3. org::defi_wallet_core::unit

etc.

rather than one single org::defi_wallet_core

tomtau commented 2 years ago

I guess this only affects C++ bindings? Do C++ bindings work for any Ethereum chains, then perhaps following the common's module naming works?

damoncro commented 2 years ago

Yes, only C++ bindings. No need to modify common crate.

damoncro commented 2 years ago

Having different namespaces in c++ is easier for developers divide the functions groups in documents.

damoncro commented 2 years ago

Do you mean we follow the common module's naming, based on the lib.rs:

/// Eth contract types generated from ABI
pub mod contract;
/// interactions with remote node RPC / API (querying, broadcast etc.)
pub mod node;
/// transaction building etc.
pub mod transaction;
/// HD wallet-related functionality
mod wallet;

/// Login module: signing using EIP-4361 on Ethereum or ADR-036 on Cosmos SDK
#[cfg(feature = "login")]
mod login;

/// Utility functions
mod utils;

pub use defi_wallet_core_proto as proto;
// expose all proto related types (e.g. for uniffi)
pub use cosmrs::{tx::Msg, AccountId};
pub use eyre::{Report as ErrorReport, Result};
pub use ibc::Height;
pub use proto::chainmain::nft::v1::*;

#[cfg(feature = "login")]
pub use login::*;
pub use node::*;
pub use transaction::*;
pub use wallet::*;
#[cfg(feature = "uniffi-binding")]
uniffi_macros::include_scaffolding!("common");

#[macro_use]
mod macros;

If so, it is quite a lot of works to do, may need to rearrange the functions in cpp bindings.

damoncro commented 2 years ago

It is possible, we just create many cxx::bridge.

damoncro commented 2 years ago

@ricky321q Do C++ bindings work for any Ethereum chains? Only Cronos?

damoncro commented 2 years ago

We can promote that we can support many chains, but the namespace in c++ should be carefully chosen, if it is org::defi_wallet_core::cronos, then it may confuse the users that we only support cronos.