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

chore(communities-wallet): various improvements on community related transaction flows #17010

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

saledjenic
Copy link
Contributor

@saledjenic saledjenic commented Dec 24, 2024

Corresponding status-go PRs:

These changes should simplify the community-related tx handlings on the client side, align it with tx flows that we already have for other sending types and make it maintainable.

Related issue: #16810

This PR doesn't fix issues that we already have (if any are fixed, that's a side effect, not intention). The intention of this PR is to introduce a new sending flow to the community part of the app and make it maintainable for the future.

UI for the community's settings part has to be revised and improved a lot on the UI (qml) side. I am not sure if BrokerFees will be needed at all after these changes (but they are kept because of minimizing number of changes) as well as many other approaches done there. Code can be improved and simplified a lot on the qml side.

Spotted issues:

  • When minting community collectibles/assets, selecting any part of the image for the artwork, ignores the selected area and always uses the entire image.
  • After minting the token owner, when the user goes mint a token either collectible or asset, the chain is not displayed, while all is good after the app restart. It could be some binding issue.
  • If the token is minted on the chain that is not globally enabled, the app displays a warning like "The owner token is minted on a network that isn't selected. Click here to enable it:". Clicking that button causes a crash.
  • When creating a new Status profile all chains are enabled, then go to settings just to turn on "testnet mode", then go back to the wallet section and see that only mainnet chain is selected.
  • When airdropping community assets/collectibles, amounts (based on decimals) are not correctly displayed in UI.
  • There is some logic for fetching token holders (fetching is being done every 5 minutes), that's ok, but we need some improvements there, cause now if the user goes to see token details and there are no holder details for the token, when goes back and again to the details page will see "Loading token holders..." page instead the "No hodlers just yet" page.
  • In some places "holder" is used in some places "holder", we should align on that.
  • Arbitrum txs are being opened to https://sepolia-explorer.arbitrum.io/tx/ instead to https://sepolia.arbiscan.io/tx/ the issue with the first one is that tx has never been found, while on the second one is always there.
  • Loading token holders doesn't work for assets.
  • Cropping images when minting new tokens display cropped image in the UI, but doesn't use it for the token, but instead always uses a full image.

Flows that will be covered by finishing this PR:

  • deploying owner and master token - done
  • deploying collectible for community - done
  • sending deployed collectibles to one or more recipients in a single send - done
  • deploying asset for community - done
  • sending deployed asset to one or more recipients in a single send - done
  • sending multiple deployed collectibles/assets to one or more recipients in a single send - done
  • remote burn - done
  • burn tokens - done
  • set signer - done
  • transfer ownership - done

@status-im-auto
Copy link
Member

status-im-auto commented Dec 24, 2024

Jenkins Builds

Click to see older builds (102)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 02124c5 #1 2024-12-24 09:38:53 ~7 min tests/nim 📄log
✔️ 02124c5 #1 2024-12-24 09:39:57 ~8 min macos/aarch64 🍎dmg
02124c5 #1 2024-12-24 09:40:50 ~9 min tests/ui 📄log
✔️ 02124c5 #1 2024-12-24 09:47:42 ~16 min macos/x86_64 🍎dmg
✔️ 02124c5 #1 2024-12-24 09:49:29 ~18 min linux/x86_64 📦tgz
✔️ 02124c5 #1 2024-12-24 09:51:19 ~19 min linux-nix/x86_64 📦tgz
✔️ 02124c5 #1 2024-12-24 09:52:45 ~21 min windows/x86_64 💿exe
✔️ 67acc70 #2 2024-12-25 14:40:32 ~6 min macos/aarch64 🍎dmg
✔️ 67acc70 #2 2024-12-25 14:41:31 ~7 min tests/nim 📄log
67acc70 #2 2024-12-25 14:43:25 ~9 min tests/ui 📄log
✔️ 67acc70 #2 2024-12-25 14:45:27 ~11 min macos/x86_64 🍎dmg
✔️ 67acc70 #2 2024-12-25 14:50:35 ~16 min linux/x86_64 📦tgz
✔️ 67acc70 #2 2024-12-25 14:51:47 ~17 min linux-nix/x86_64 📦tgz
✔️ 67acc70 #2 2024-12-25 14:54:06 ~19 min windows/x86_64 💿exe
✔️ 6cd4280 #3 2024-12-29 12:33:41 ~6 min macos/aarch64 🍎dmg
✔️ 6cd4280 #3 2024-12-29 12:35:00 ~7 min tests/nim 📄log
6cd4280 #3 2024-12-29 12:37:00 ~9 min tests/ui 📄log
✔️ 6cd4280 #3 2024-12-29 12:39:04 ~11 min macos/x86_64 🍎dmg
✔️ 6cd4280 #3 2024-12-29 12:44:40 ~17 min linux-nix/x86_64 📦tgz
✔️ 6cd4280 #3 2024-12-29 12:44:53 ~17 min linux/x86_64 📦tgz
✔️ 6cd4280 #3 2024-12-29 12:46:35 ~19 min windows/x86_64 💿exe
23ce959 #4 2024-12-31 00:09:28 ~2 min macos/aarch64 📄log
23ce959 #4 2024-12-31 00:10:36 ~3 min linux-nix/x86_64 📄log
23ce959 #4 2024-12-31 00:11:05 ~3 min macos/x86_64 📄log
23ce959 #4 2024-12-31 00:12:14 ~5 min linux/x86_64 📄log
✖️ 23ce959 #4 2024-12-31 00:13:49 ~6 min tests/nim 📄log
23ce959 #4 2024-12-31 00:15:03 ~7 min windows/x86_64 📄log
23ce959 #4 2024-12-31 00:16:21 ~9 min tests/ui 📄log
fa6b1f5 #5 2024-12-31 10:16:57 ~2 min macos/aarch64 📄log
fa6b1f5 #5 2024-12-31 10:17:51 ~3 min linux-nix/x86_64 📄log
fa6b1f5 #5 2024-12-31 10:18:18 ~3 min macos/x86_64 📄log
fa6b1f5 #5 2024-12-31 10:19:28 ~5 min linux/x86_64 📄log
✖️ fa6b1f5 #5 2024-12-31 10:21:02 ~6 min tests/nim 📄log
fa6b1f5 #5 2024-12-31 10:21:47 ~7 min windows/x86_64 📄log
fa6b1f5 #5 2024-12-31 10:23:34 ~9 min tests/ui 📄log
✔️ 963dda6 #6 2025-01-08 07:22:37 ~7 min macos/aarch64 🍎dmg
✔️ 963dda6 #6 2025-01-08 07:23:39 ~8 min tests/nim 📄log
963dda6 #6 2025-01-08 07:23:55 ~9 min tests/ui 📄log
✔️ 963dda6 #6 2025-01-08 07:28:38 ~13 min macos/x86_64 🍎dmg
✔️ 963dda6 #6 2025-01-08 07:32:56 ~18 min linux/x86_64 📦tgz
✔️ 963dda6 #6 2025-01-08 07:34:46 ~20 min linux-nix/x86_64 📦tgz
✔️ 963dda6 #6 2025-01-08 07:38:15 ~23 min windows/x86_64 💿exe
✔️ b37a3ee #7 2025-01-13 13:59:25 ~9 min tests/nim 📄log
b37a3ee #7 2025-01-13 14:00:42 ~10 min tests/ui 📄log
✔️ b37a3ee #7 2025-01-13 14:02:15 ~11 min macos/aarch64 🍎dmg
✔️ b37a3ee #7 2025-01-13 14:04:39 ~14 min macos/x86_64 🍎dmg
✔️ b37a3ee #7 2025-01-13 14:10:22 ~20 min linux-nix/x86_64 📦tgz
✔️ b37a3ee #7 2025-01-13 14:12:35 ~22 min windows/x86_64 💿exe
✔️ b37a3ee #7 2025-01-13 14:12:44 ~22 min linux/x86_64 📦tgz
✔️ a33044d #8 2025-01-14 12:20:24 ~7 min macos/aarch64 🍎dmg
a33044d #8 2025-01-14 12:21:47 ~8 min tests/ui 📄log
✔️ a33044d #8 2025-01-14 12:22:21 ~9 min tests/nim 📄log
✔️ a33044d #8 2025-01-14 12:26:18 ~13 min macos/x86_64 🍎dmg
✔️ a33044d #8 2025-01-14 12:32:26 ~19 min linux/x86_64 📦tgz
✔️ a33044d #8 2025-01-14 12:33:53 ~20 min windows/x86_64 💿exe
✔️ a33044d #8 2025-01-14 12:36:12 ~23 min linux-nix/x86_64 📦tgz
38d7d04 #9 2025-01-15 15:52:06 ~4 min macos/aarch64 📄log
✔️ 38d7d04 #9 2025-01-15 15:56:34 ~8 min tests/nim 📄log
38d7d04 #9 2025-01-15 15:56:55 ~8 min tests/ui 📄log
✔️ 38d7d04 #9 2025-01-15 16:00:58 ~13 min macos/x86_64 🍎dmg
✔️ 38d7d04 #9 2025-01-15 16:07:25 ~19 min linux-nix/x86_64 📦tgz
✔️ 38d7d04 #9 2025-01-15 16:08:45 ~20 min windows/x86_64 💿exe
✔️ 38d7d04 #9 2025-01-15 16:08:51 ~20 min linux/x86_64 📦tgz
✔️ 348bc1f #10 2025-01-16 19:18:10 ~5 min macos/aarch64 🍎dmg
✔️ 348bc1f #10 2025-01-16 19:21:38 ~9 min tests/nim 📄log
✔️ 6913c91 #11 2025-01-16 19:26:37 ~4 min macos/aarch64 🍎dmg
6913c91 #11 2025-01-16 19:31:48 ~9 min tests/ui 📄log
✔️ 6913c91 #11 2025-01-16 19:31:56 ~10 min tests/nim 📄log
✔️ 6913c91 #11 2025-01-16 19:39:55 ~18 min macos/x86_64 🍎dmg
✔️ 6913c91 #11 2025-01-16 19:39:56 ~18 min linux-nix/x86_64 📦tgz
✔️ 6913c91 #11 2025-01-16 19:43:19 ~21 min windows/x86_64 💿exe
✔️ 6913c91 #11 2025-01-16 19:43:59 ~22 min linux/x86_64 📦tgz
f792337 #12 2025-01-23 19:49:50 ~9 min tests/ui 📄log
✔️ f792337 #12 2025-01-24 00:34:41 ~9 min tests/nim 📄log
f792337 #12 2025-01-24 08:57:27 ~4 min macos/x86_64 📄log
✔️ f792337 #12 2025-01-24 09:48:37 ~23 min linux-nix/x86_64 📦tgz
fe044c7 #13 2025-01-24 10:07:15 ~3 min macos/x86_64 📄log
fe044c7 #12 2025-01-24 10:07:42 ~3 min macos/aarch64 📄log
✔️ fe044c7 #13 2025-01-24 10:11:51 ~8 min tests/nim 📄log
fe044c7 #13 2025-01-24 10:12:39 ~8 min tests/ui 📄log
✔️ fe044c7 #13 2025-01-24 10:21:48 ~18 min linux-nix/x86_64 📦tgz
✔️ fe044c7 #13 2025-01-24 10:24:45 ~21 min linux/x86_64 📦tgz
✔️ fe044c7 #12 2025-01-24 10:26:00 ~22 min windows/x86_64 💿exe
✔️ 7a7341d #13 2025-01-27 10:39:53 ~9 min macos/aarch64 🍎dmg
✔️ 7a7341d #14 2025-01-27 10:41:53 ~11 min tests/nim 📄log
✔️ 7a7341d #14 2025-01-27 10:45:14 ~14 min macos/x86_64 🍎dmg
7a7341d #14 2025-01-27 10:46:55 ~16 min tests/ui 📄log
✔️ 7a7341d #14 2025-01-27 10:51:28 ~21 min linux/x86_64 📦tgz
✔️ 7a7341d #13 2025-01-27 10:51:40 ~21 min windows/x86_64 💿exe
✔️ 7a7341d #14 2025-01-27 10:54:23 ~24 min linux-nix/x86_64 📦tgz
7a7341d #15 2025-01-27 11:14:13 ~9 min tests/ui 📄log
✔️ 1cb4c07 #14 2025-01-29 10:52:32 ~7 min macos/aarch64 🍎dmg
✔️ 1cb4c07 #15 2025-01-29 10:57:36 ~12 min macos/x86_64 🍎dmg
✔️ 1cb4c07 #15 2025-01-29 10:58:44 ~14 min tests/nim 📄log
1cb4c07 #16 2025-01-29 11:00:01 ~15 min tests/ui 📄log
✔️ 1cb4c07 #14 2025-01-29 11:06:39 ~21 min windows/x86_64 💿exe
✔️ 1cb4c07 #15 2025-01-29 11:06:39 ~22 min linux-nix/x86_64 📦tgz
✔️ 1cb4c07 #15 2025-01-29 11:06:47 ~22 min linux/x86_64 📦tgz
✔️ 91f13bb #15 2025-01-29 12:18:03 ~5 min macos/aarch64 🍎dmg
✔️ 91f13bb #16 2025-01-29 12:21:41 ~8 min tests/nim 📄log
✔️ 91f13bb #16 2025-01-29 12:24:26 ~11 min macos/x86_64 🍎dmg
✔️ 91f13bb #17 2025-01-29 12:24:34 ~11 min tests/ui 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e9744f7 #16 2025-01-29 12:30:15 ~4 min macos/aarch64 🍎dmg
✔️ e9744f7 #17 2025-01-29 12:34:56 ~9 min tests/nim 📄log
✔️ e9744f7 #18 2025-01-29 12:37:23 ~11 min tests/ui 📄log
✔️ e9744f7 #17 2025-01-29 12:37:34 ~11 min macos/x86_64 🍎dmg
✔️ e9744f7 #17 2025-01-29 12:45:23 ~19 min linux-nix/x86_64 📦tgz
✔️ e9744f7 #17 2025-01-29 12:47:04 ~21 min linux/x86_64 📦tgz
✔️ e9744f7 #16 2025-01-29 12:48:25 ~22 min windows/x86_64 💿exe
✔️ d274453 #17 2025-01-30 14:03:34 ~5 min macos/aarch64 🍎dmg
✔️ d274453 #18 2025-01-30 14:07:11 ~9 min tests/nim 📄log
✔️ d274453 #19 2025-01-30 14:10:29 ~12 min tests/ui 📄log
✔️ d274453 #18 2025-01-30 14:11:47 ~13 min macos/x86_64 🍎dmg
✔️ d274453 #18 2025-01-30 14:17:39 ~19 min linux-nix/x86_64 📦tgz
✔️ d274453 #18 2025-01-30 14:17:57 ~19 min linux/x86_64 📦tgz
✔️ d274453 #17 2025-01-30 14:20:11 ~22 min windows/x86_64 💿exe

@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch 3 times, most recently from 23ce959 to fa6b1f5 Compare December 31, 2024 10:14
@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch 3 times, most recently from b37a3ee to a33044d Compare January 14, 2025 12:12
@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch 3 times, most recently from 348bc1f to 6913c91 Compare January 16, 2025 19:21
@saledjenic saledjenic marked this pull request as ready for review January 16, 2025 19:25
@saledjenic saledjenic requested review from micieslak, a team and caybro as code owners January 16, 2025 19:25
@virginiabalducci
Copy link

I have some questions about this PR

When airdropping, if the 'Show fees' toggle is not switched on, nothing happens (the 'create airdrop' button does not enable). This is a bit confusing because the toggle seems an optional field; the 'create airdrop' button should be enabled when the token and the address have been selected, regardless of the fees toggle. What is the correct behavior in this case?

Screenshot 2025-01-20 at 2 47 49 PM

Keycard

The flows cannot be tested with Keycard: the minting of owner and TokenMaster seems to be stuck.

Owner and TokenMaster tokens minted using keycard. Note that I cancelled the authentication via Biometrics and chose the keycard PIN. https://sepolia-optimism.etherscan.io//tx/0x7272f1087f5e2774ff151a6ab926f4b2babac34bb16a7ef68e79e72eeb65d61e

Screen.Recording.2025-01-20.at.2.11.11.PM.mov

Something seems stuck because the UI still shows the screen to mint the owner/tokenmaster tokens.

Screen.Recording.2025-01-20.at.2.12.17.PM.mov

I'm also noticing some issues on this PR:

  1. Unable to transfer ownership
    This may be related to the New send modal?
    When selecting 'Transfer ownership', the send modal displays. It should have the network used to create the owner token pre-selected. When selecting the token, an error message triggers on the app log.

WRN 2025-01-20 18:13:05.310Z qt warning topics="qt" tid=12745753 text="TypeError: Cannot read property 'name' of undefined" file=qrc:/app/AppLayouts/Wallet/controls/TokenSelector.qml:124 category=default

Screen.Recording.2025-01-20.at.3.12.42.PM.mov
  1. Unable to add or accept a new contact
Screen.Recording.2025-01-20.at.3.00.59.PM.mov
ERR 2025-01-20 18:02:59.869Z an error occurred while accepting the contact request topics="contacts-service" tid=12745753 file=service.nim:450 msg="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
DBG 2025-01-20 18:03:00.274Z NewBE_callPrivateRPC                       topics="rpc" tid=12745753 file=core.nim:27 rpc_method=wakuext_acceptLatestContactRequestForContact
WARN [01-20|18:03:00.274] Served wakuext_acceptLatestContactRequestForContact reqid=527 duration="227.458µs" err="accept-contact-request: invalid id"
ERR 2025-01-20 18:03:00.275Z rpc response error                         topics="rpc" tid=12745753 file=core.nim:36 err="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
ERR 2025-01-20 18:03:00.275Z error doing rpc request                    topics="rpc" tid=12745753 file=core.nim:39 methodName=wakuext_acceptLatestContactRequestForContact exception="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
ERR 2025-01-20 18:03:00.275Z an error occurred while accepting the contact request topics="contacts-service" tid=12745753 file=service.nim:450 msg="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
DBG 2025-01-20 18:03:00.455Z NewBE_callPrivateRPC                       topics="rpc" tid=12745753 file=core.nim:27 rpc_method=wakuext_acceptLatestContactRequestForContact
WARN [01-20|18:03:00.456] Served wakuext_acceptLatestContactRequestForContact reqid=528 duration="141.292µs" err="accept-contact-request: invalid id"
ERR 2025-01-20 18:03:00.456Z rpc response error                         topics="rpc" tid=12745753 file=core.nim:36 err="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
ERR 2025-01-20 18:03:00.456Z error doing rpc request                    topics="rpc" tid=12745753 file=core.nim:39 methodName=wakuext_acceptLatestContactRequestForContact exception="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
ERR 2025-01-20 18:03:00.456Z an error occurred while accepting the contact request topics="contacts-service" tid=12745753 file=service.nim:450 msg="\nstatus-go error [methodName:wakuext_acceptLatestContactRequestForContact, code:-32000, message:accept-contact-request: invalid id ]\n"
Screen.Recording.2025-01-20.at.3.02.52.PM.mov

I'm attaching the logs of the account that I used to test in case they are useful:

Account with keycard:
app_20250120_120949.log
app_20250120_121521.log
app_20250120_124410.log

Account without a keycard:
app_20250120_095248.log
app_20250120_113410.log
app_20250120_125829.log

@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch 2 times, most recently from f792337 to fe044c7 Compare January 24, 2025 10:03
@saledjenic
Copy link
Contributor Author

@virginiabalducci thanks for checking this PR.

When airdropping, if the 'Show fees' toggle is not switched on, nothing happens (the 'create airdrop' button does not enable). This is a bit confusing because the toggle seems an optional field; the 'create airdrop' button should be enabled when the token and the address have been selected, regardless of the fees toggle. What is the correct behavior in this case?

There are some technical limitations with the old approach. Already discussed this with @benjthayer cause we do not know all the details necessary for asking for the best route and all the calculations that we need before the form is fulfilled. Also, for the difference from the old approach, the received route is valid for the entered data and that's why as the first aid I added that "fees toggle". It becomes enabled once the form is fulfilled and once it's enabled, toggling on asks for the route. All that from the UX side of things will be handled by the new design.

The flows cannot be tested with Keycard: the minting of owner and TokenMaster seems to be stuck.

Actually, it's not an issue in the keycard flow itself since the tx is always executed, but was an issue in the form of an address used to add tokens later. That's fixed now, you can check it now.

I'm also noticing some issues on this PR:

As said above this PR was not about fixing things, but it's about switching to completely different way of doing things than how it was.

In general, this PR aligns the desktop client with the changes we did on the statusgo side. All other issues that we had/have will be fixed after, and I am pretty sure all of them (or the majority) are on the UI (qml) side. Also it's on the UI team of the backend team, once it becomes a priority, to revise/rework the entire community part.

Based on all I said here, also having in mind the complexity of this PR (including statusgo PRs) and since it's tough to rebase it if conflicts appear due to many old redundant codes which is removed in this PR, I am kindly asking you all reviewers here to review this PR (and related statusgo PRs) and finally have it merged soon. @ALL

@virginiabalducci
Copy link

@virginiabalducci thanks for checking this PR.

When airdropping, if the 'Show fees' toggle is not switched on, nothing happens (the 'create airdrop' button does not enable). This is a bit confusing because the toggle seems an optional field; the 'create airdrop' button should be enabled when the token and the address have been selected, regardless of the fees toggle. What is the correct behavior in this case?

There are some technical limitations with the old approach. Already discussed this with @benjthayer cause we do not know all the details necessary for asking for the best route and all the calculations that we need before the form is fulfilled. Also, for the difference from the old approach, the received route is valid for the entered data and that's why as the first aid I added that "fees toggle". It becomes enabled once the form is fulfilled and once it's enabled, toggling on asks for the route. All that from the UX side of things will be handled by the new design.

The flows cannot be tested with Keycard: the minting of owner and TokenMaster seems to be stuck.

Actually, it's not an issue in the keycard flow itself since the tx is always executed, but was an issue in the form of an address used to add tokens later. That's fixed now, you can check it now.

I'm also noticing some issues on this PR:

As said above this PR was not about fixing things, but it's about switching to completely different way of doing things than how it was.

In general, this PR aligns the desktop client with the changes we did on the statusgo side. All other issues that we had/have will be fixed after, and I am pretty sure all of them (or the majority) are on the UI (qml) side. Also it's on the UI team of the backend team, once it becomes a priority, to revise/rework the entire community part.

Based on all I said here, also having in mind the complexity of this PR (including statusgo PRs) and since it's tough to rebase it if conflicts appear due to many old redundant codes which is removed in this PR, I am kindly asking you all reviewers here to review this PR (and related statusgo PRs) and finally have it merged soon. @ALL

Thanks for the feedback @saledjenic , then from my end it's good to merge

@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch from fe044c7 to 7a7341d Compare January 27, 2025 10:30
@virginiabalducci
Copy link

The issue of the contact requests is no longer present on latest commit, however the Start Chat button issue is still present, this seems to be an issue coming from the master build. It was reported here #17131

Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

Unfortunately the SubscriptionBroker is still needed for dapps with all its features. My suggestion is to drop the changes done in SubscriptionBroker and Subscription.

I see two ways of doing this, depending how much effort we're willing to put into removing flows that are no longer necessary.

The simple approach would be continue using the SubscriptionBroker. But to extend it instead of changing it, to allow single shot requests instead of periodic requests (maybe it will work out of the box if the request interval is set to 0).
It would work just as it used to work before, but the request-response ratio wouldn't be 1-1, but 1-n.
The downside is that we'll push the refactoring for later. Maybe not a downside at all since the changes needed for this PR are already substantial.

The other way would be to remove the SubscriptionBroker dependency from ui/app/AppLayouts/Communities/helpers/TransactionFeesBroker.qml. Instead of calling d.feesBroker.subscribe(subscription) in TransactionFeesBroker::subscribe to do an immediate request to the router. On top of this, we'll need to also copy some of the logic provided by SubscriptionBroker::connectToSubscriptionEvents to preserve the "managed" subscription flows and connect/disconnect from nim events when needed.

active: finalisePopup.contentItem.Window.window.active
}
onStopUpdatingFees: {
root.stopUpdatingFees()
Copy link
Contributor

Choose a reason for hiding this comment

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

stopUpdatingFees is not implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, not sure the stopUpdatingFees is needed. With the current mechanism it can be controlled by using the enabled property exposed by the subscriber.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stopUpdatingFees is not implemented.

How do you mean this?

Also, not sure the stopUpdatingFees is needed. With the current mechanism it can be controlled by using the enabled property exposed by the subscriber.

Yes, it's needed, cause it tells the backend (statusgo) to stop updating and sending fees. At first yes, we could use the enabled property, but there is one more component added there, fees toggle, and the user can toggle it off, while the subscriber is still enabled and in that case we actually don't want to receive any updates.

Copy link
Contributor

Choose a reason for hiding this comment

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

How do you mean this?

There's no stopUpdatingFees() implementation in Popups.qml

Yes, it's needed, cause it tells the backend (statusgo) to stop updating and sending fees. At first yes, we could use the enabled property, but there is one more component added there, fees toggle, and the user can toggle it off, while the subscriber is still enabled and in that case we actually don't want to receive any updates.

What this means is that there are cases where the router continues to update fees and send signals, but we don't want to propagate to QML?
I've had the impression that we want to stop the router processing when the toggle is off. I was expecting the subscriber to control this flow when it's disabled.

SetSignerFeesSubscriber {
id: feeSubscriber
onCalculateFees: {
const subscription = feesBroker.prepareSetSignerFeesSubscribtion(feeSubscriber)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally the subscription object is not exposed by the broker. It was an internal detail.

Why is it a 2 steps mechanism to use the subscribe function? Can we modify the subscribe to receive the subscriber and prepare the data internally? Then the usage is quite simple: Declare the subscriber and call subscribe when needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is it a 2 steps mechanism to use the subscribe function?

When I started integrating the backend changes, I remembered that I needed subscriptionId out of the broker. Still, I didn't check for justification of that after I cleaned the code and prepared the PR. Now, looking at the code seems no need and we can merge those two calls into a single one. Will try to update that.

}

onStopUpdatingFees: {
root.stopUpdatingFees()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not controlling the deployFeeSubscriber.enabled property instead of delegating the action with a signal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answered above.

@saledjenic
Copy link
Contributor Author

@alexjba thanks for the review and comments. I see the point you made, and yes, I agree and that's something we need to do, but not sure if the time is now (in this PR) since I just wanted to not touch the qml (or touch it as less as possible, just to make the app works with the new backed logic).

@alexjba
Copy link
Contributor

alexjba commented Jan 29, 2025

@alexjba thanks for the review and comments. I see the point you made, and yes, I agree and that's something we need to do, but not sure if the time is now (in this PR) since I just wanted to not touch the qml (or touch it as less as possible, just to make the app works with the new backed logic).

Unfortunately I don't see any way out without touching qml..The main constraint is that we need the SubscriptionBroker with all its features for dapps.
The most promising option I see now is to try the approach below. Or any other option where the SubscriptionBroker is extended for the new flow without changing the current behavior. Basically we'd need a short-circuit for single shot requests so that the nim request is no longer periodic.

The simple approach would be continue using the SubscriptionBroker. But to extend it instead of changing it, to allow single shot requests instead of periodic requests (maybe it will work out of the box if the request interval is set to 0).
It would work just as it used to work before, but the request-response ratio wouldn't be 1-1, but 1-n.
The downside is that we'll push the refactoring for later. Maybe not a downside at all since the changes needed for this PR are already substantial.

@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch 2 times, most recently from 1cb4c07 to 91f13bb Compare January 29, 2025 12:12
@saledjenic
Copy link
Contributor Author

@alexjba I created a new SubscriptionBrokerCommunities for community purposes specifically, so dapps are not affected by the changes. Also kept the subscriptions within the broker, cause there is no need for a subscription id out of it now.

@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch from 91f13bb to e9744f7 Compare January 29, 2025 12:25
Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

👍 Thank you!

We'll need a task to totally remove the SubscriptionBroker once the dApps have been migrated to the router mechanism. Looking forward to removing all this code! 😄

…transaction flows

These changes should simplify the community related tx handlings on the client side, align it with
tx flows that we already have for other sending types and make it maintainable.
@saledjenic saledjenic force-pushed the fix/community-minting-airdrop branch from e9744f7 to d274453 Compare January 30, 2025 13:57
@saledjenic saledjenic merged commit 442c0cb into master Jan 30, 2025
9 checks passed
@saledjenic saledjenic deleted the fix/community-minting-airdrop branch January 30, 2025 14:49
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.

4 participants