Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wownero integration #2 #1260

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sanderfoobar
Copy link

Continuation of #362

Wownero support. Uses Polyseed this time (we are phasing out wownero-seed).

I tested: sending/receiving/history on both Android (arm64) and Android emulator (x86_64).

Screenshot from 2024-01-03 13-59-59

Notes:

There are still some to-do's:

1. Fiat <-> WOW calculations

Probably requires #361

2. Accounts runtime error

Dashboard -> Receive -> Accounts gives an error. Fix would be to leave out the accounts feature in its entirety just like last PR - as we do not use the account feature in Wownero. Would be nice if someone could exclude this feature when coin type == wownero.

3. Exchange button

The exchange button at the dashboard for WOW should (probably) not be active.

4. iOS/macos untested

Untested - getting the iOS emulator to run is a bit difficult with the certificates and all.

5. pubspec

I updated watcher to 1.1.0.

6. Docker fixes

The following had some issues:

cd scripts/docker
docker build --tag=build_monero_deps --progress plain --no-cache .
docker compose up

I fixed various things in scripts/docker:

  • Changed file permission mode
  • build_haven.sh interpreter changed to /bin/bash
  • Added build requirement byacc to apt get in Dockerfile, it is needed for libunbound to compile correctly
  • Changed carriage return to Unix style (sorry for the diffs)

7. Wownero branch

Changes to Wownero to facilitate Cake using wow's wallet2 API went into a branch called cake-fixes. The build script build_wownero.sh is pinned to a commit hash.

8. Polyseed

Waiting on:

Current situation is that create wallet generates a Polyseed with the Monero coin type.

Copy link

@nahuhh nahuhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just spotted a couple places that were 12 instead of 11

cw_core/lib/crypto_currency.dart Outdated Show resolved Hide resolved
cw_core/lib/wownero_amount_format.dart Outdated Show resolved Hide resolved
cw_core/lib/node.dart Outdated Show resolved Hide resolved
@nahuhh
Copy link

nahuhh commented Jan 25, 2024

  1. Exchange button

The exchange button at the dashboard for WOW should (probably) not be active.

trocador supports wownero iirc. So i think it can stay (would need to add wownero to the list of swappable coins)

@nahuhh
Copy link

nahuhh commented Jan 26, 2024

@OmarHatem28 please look into

  • needs added to cake's fiat api

1. Fiat <-> WOW calculations

Probably requires #361

  • needs accounts removed for wownero

2. Accounts runtime error

Dashboard -> Receive -> Accounts gives an error ... we do not use the account feature in Wownero. Would be nice if someone could exclude this feature when coin type == wownero.

  • Trocador supports wownero, so you should be able to add wow as a supported currency

3. Exchange button

The exchange button at the dashboard for WOW should (probably) not be active.

  • needs confirm working:

4. iOS/macos untested

Untested - getting the iOS emulator to run is a bit difficult with the certificates and all.

  • needs merge:

8. Polyseed

Waiting on:

  • Needs review / confirm everything ok:

5. pubspec

I updated watcher to 1.1.0.

6. Docker fixes

The following had some issues:

cd scripts/docker
docker build --tag=build_monero_deps --progress plain --no-cache .
docker compose up

I fixed various things in scripts/docker:

  • Changed file permission mode
  • build_haven.sh interpreter changed to /bin/bash
  • Added build requirement byacc to apt get in Dockerfile, it is needed for libunbound to compile correctly
  • Changed carriage return to Unix style (sorry for the diffs)

7. Wownero branch

Changes to Wownero to facilitate Cake using wow's wallet2 API went into a branch called cake-fixes. The build script build_wownero.sh is pinned to a commit hash.

  • need to change to wownero coin type after polyseed_dart pr merge

Current situation is that create wallet generates a Polyseed with the Monero coin type.

assets/wownero_node_list.yml Outdated Show resolved Hide resolved
@OmarHatem28
Copy link
Contributor

Hi @nahuhh thanks for helping in reviewing this PR

I am currently in the review process but I might submit my current comments so far until I complete the review.

I will review the Polyseed PR afterwards but @sanderfoobar can't we make both seed types (normal, polyseed) supported?

Also, like @nahuhh suggested, can you please remove the Accounts feature and all its related files, and update the PR with the latest main to resolve the conflicts

Copy link
Contributor

@OmarHatem28 OmarHatem28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for android/app/src/main/java/com/cakewallet/wownero/ since there won't be a separate app for wownero and it would be included in Cake Wallet

cw_core/lib/wownero_amount_format.dart Outdated Show resolved Hide resolved
cw_core/lib/wownero_wallet_keys.dart Outdated Show resolved Hide resolved
cw_core/lib/wownero_wallet_utils.dart Outdated Show resolved Hide resolved
@@ -86,6 +86,8 @@ class PreSeedPage extends BasePage {
if (moneroSeedType == SeedType.polyseed)
return 16;
return 25;
case WalletType.wownero:
return 16; // always polyseed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is it always polyseed, when it's waiting for a PR on polyseed library

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently using monero's polyseed (so likely creates invalid seeds)

cw_core/lib/wownero_amount_format.dart Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I know, wownero doesn't use accounts, so there should be no need for this or any account related changes/addition

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cw_wownero is a copy of cw_monero which is then modified to support Wownero. As such, there are things in there that do not necessarily reflect reality, such as supporting accounts (that are not exposed to the user) or references to 'seed type' (while there is only polyseed). This is done in favor of not changing Dart class/function signatures, as doing that involves actual Dart development. This PR was largely done in my free-time, and I don't have ambitions to become a Dart developer ;)). My assumption was that Cake would take the PR, take a few days to clean it up, and finish it. This was not the case.

For now ill skip this, because I don't want to possibly get stuck in (what would be trivial for others) Dart stuff when I'm on a schedule (limited time available). Can pick this up later when I have a better understanding of what needs to done in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, not needed

lib/view_model/send/output.dart Outdated Show resolved Hide resolved
import 'package:cake_wallet/haven/haven.dart';
import 'package:cw_monero/api/wallet.dart' as monero_wallet;
import 'package:cw_wownero/api/wallet.dart' as wownero_wallet;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will throw an exception when building Monero.com app as it will not include this package, please use the wownero instance instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure where this instance is that I should be using instead.

@sanderfoobar
Copy link
Author

Thanks guys. So currently I have a client that has been requiring my time, and I should be finished in a few days, at which point Ill look at this PR again.

@tuxpizza tuxpizza linked an issue Feb 25, 2024 that may be closed by this pull request
@OmarHatem28
Copy link
Contributor

OmarHatem28 commented Mar 4, 2024

Hi @sanderfoobar We're excited about the changes you've proposed and adding Wownero, and we would love to see this PR integrated into Cake.
If you have any questions or need further assistance with your pull request, please don't hesitate to let me know.

@sanderfoobar
Copy link
Author

Hi @sanderfoobar We're excited about the changes you've proposed and adding Wownero, and we would love to see this PR integrated into Cake. If you have any questions or need further assistance with your pull request, please don't hesitate to let me know.

Thanks, I'm continuing my efforts starting from tomorrow or so. Finishing up some other work.

@sanderfoobar sanderfoobar force-pushed the wow-support branch 2 times, most recently from ddac9eb to 69716bd Compare March 12, 2024 03:44
@sanderfoobar
Copy link
Author

sanderfoobar commented Mar 12, 2024

  • fixed fractionals
  • changed wownero node list (removed some dead nodes, still subject to change)
  • some locale strings dont throw anymore
  • removed wownero_wallet_keys.dart;
  • removed wownero_wallet_utils.dart;

diff: https://github.com/cake-tech/cake_wallet/compare/f1bbf035e6605376a99ba5f726cda05313925457..ddac9ebdd688ee7dd5a443ba9c8fd047082e0eb1

And then rebased to latest main. Up next I need to compile this now, as solana was added + other changes from main.

@nahuhh
Copy link

nahuhh commented Mar 15, 2024

@OmarHatem28 to proceed and properly test, from cake side, we need cake-tech/polyseed_dart#1

@OmarHatem28
Copy link
Contributor

@nahuhh merged

cw_core/lib/crypto_currency.dart Outdated Show resolved Hide resolved
Comment on lines +815 to +849
int32_t account_size()
{
std::vector<Monero::SubaddressAccountRow *> _accocunts = m_account->getAll();
return _accocunts.size();
}

int64_t *account_get_all()
{
std::vector<Monero::SubaddressAccountRow *> _accocunts = m_account->getAll();
size_t size = _accocunts.size();
int64_t *accocunts = (int64_t *)malloc(size * sizeof(int64_t));

for (int i = 0; i < size; i++)
{
Monero::SubaddressAccountRow *row = _accocunts[i];
AccountRow *_row = new AccountRow(row->getRowId(), strdup(row->getLabel().c_str()));
accocunts[i] = reinterpret_cast<int64_t>(_row);
}

return accocunts;
}

void account_add_row(char *label)
{
m_account->addRow(std::string(label));
}

void account_set_label_row(uint32_t account_index, char *label)
{
m_account->setLabel(account_index, label);
}

void account_refresh()
{
m_account->refresh();
Copy link

@nahuhh nahuhh Mar 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OmarHatem28
idk where to remove accounts. Can you guys handle

  1. Removing accounts
  2. Adding to fiat api
  3. Adding to exchange

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I removed accounts, at least visually. There's still code related to accounts, but that's because we're using account 0 by default.

edit: lets see what @OmarHatem28 thinks about the current situation regarding accounts.

@sanderfoobar
Copy link
Author

sanderfoobar commented Mar 17, 2024

Thanks @nahuhh

Rebased against latest main, switched to latest polyseed.dart (Wownero support), and some other small fixes that were necessary for building.

I tested:

  • creating a polyseed wallet
    • sending, receiving wownero
  • restoring a polyseed wallet
  • creating a legacy wallet
    • sent, received wownero
    • restored this wallet on desktop with different software to confirm its the same wallet

I enabled the buy/exchange options, but need confirmation these actually work (don't know which providers they integrate with).

Regarding the fiat API, this is on Cake's side, it can be fetched from coingecko:

$ curl -s 'https://api.coingecko.com/api/v3/coins/wownero?tickers=false&community_data=false&developer_data=false&sparkline=false' | jq '.market_data.current_price.usd'
0.120241

Edit: maybe the fiat API already supports WOW, I'm not sure without API key.

Copy link

@nahuhh nahuhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soon, no more tm

@nahuhh
Copy link

nahuhh commented Mar 17, 2024

need from cake for release:

  • ios test (or disable)
  • fiat api (or disable)
  • exchange integration (or disable)
  • wownero easter eggs (jk.)

@nahuhh
Copy link

nahuhh commented Mar 21, 2024

Pinging @OmarHatem28
can you do the above and(/or) run test build

ty

@MrCyjaneK
Copy link
Collaborator

Hey! There is a little detail that I've encountered when a combination of wownero and monero is used together in one process as a shared library.

The issue is as follows

  • once you open wownero wallet it works great
  • when you try to use monero wallet it uses previously loaded wownero symbols
  • so when you opened one of the coins, another one may reuse it's symbols.

I've encountered this issue on linux while working on another wallet that uses cw libraries, I'm not sure if this is the case with cake in this PR (I'll check it once I have some more time), but this is something that may cause issue.

@OmarHatem28
Copy link
Contributor

@MrCyjaneK thanks for sharing this issue, we will check if it's indeed the case in #1345, alongside the other fixes, feel free to try the APK in there and share your insights on the PR if you find anything missing or should be fixed or needs enhancements.
we will try to give more attention to finalizing Wownero soon if everything goes smooth

@sanderfoobar
Copy link
Author

sanderfoobar commented Apr 1, 2024

I've encountered this issue on linux while working on another wallet that uses cw libraries, I'm not sure if this is the case with cake in this PR (I'll check it once I have some more time), but this is something that may cause issue.

I am now wondering if this is not already happening between all monero-like cw_ plugins.

@MrCyjaneK
Copy link
Collaborator

@sanderfoobar up to my current knowledge it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Wownero (WOW)
4 participants