balancednetwork / balanced-network-interface

An open-source interface for the Balanced Network protocol (https://balanced.network)
https://app.balanced.network/
23 stars 22 forks source link

Feat/sui #1454

Closed swiftcc624 closed 1 month ago

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
balanced-network-interface ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 4:22am
balanced-network-stats ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 4:22am
hswap ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 4:22am
parrot9design commented 2 months ago
FezBox commented 2 months ago
  • [x] If you don't have a Sui wallet installed, nothing happens when you click Connect wallet. Related: Fix the 'Connect wallet' handling for ICON and EVM chains #1429
  • [x] Hana doesn't appear to be supported yet? When I try to connect after enabling Sui in Hana, nothing happens, so that's about as far as I've gotten with testing so far.

hmm strange, after I disabled the sui wallet hana connected for me

parrot9design commented 2 months ago

hmm strange, after I disabled the sui wallet hana connected for me

Weird. I have no other Sui wallets installed so that's not an issue here. I've only managed to get Hana to trigger for Sui's Connect wallet prompts after restarting my Mac or clearing data from the browser, but even then it only connects me to ICON or the EVM chains, never Sui.

This is what appears in the console logs: Screenshot 2024-09-24 at 12 23 35 PM


How it looks for other chains How it looks for Sui
Screenshot 2024-09-23 at 2 03 01 PM Screenshot 2024-09-23 at 2 03 16 PM

swiftcc624 commented 2 months ago

@parrot9design I've fixed all feedbacks, can you please check?

parrot9design commented 2 months ago


I was still having trouble connecting to Sui via Hana, turns out this was the problem: https://support.hanawallet.io/en/articles/9827255-why-can-t-i-generate-certain-blockchain-addresses-in-my-hana-wallet


Regarding transaction speeds, the majority of the swaps/transfers I tested included a delay between when the destination wallet balance updated and the modal/activity section treated the transaction as complete.

Comparison to the live app:

parrot9design commented 1 month ago

Screenshot 2024-10-01 at 5 31 14 PM




Screenshot 2024-10-01 at 5 55 15 PM Screenshot 2024-10-01 at 5 55 23 PM


If you don't have a Sui wallet installed, nothing happens when you click Connect wallet. Related: https://github.com/balancednetwork/balanced-network-interface/issues/1429


Also worth noting: all but two transactions I tested today took 1m15s – 1m30s to complete.

swiftcc624 commented 1 month ago

@parrot9design I've fixed issues regarding collateral and loans. Can you please check them?

parrot9design commented 1 month ago

Thanks! I managed to deposit SUI collateral and borrow bnUSD on Sui this time. It took around 1-1.5 minutes for the modal to say it was successful, but the Collateral/Loan sections won't update with the new values unless you leave the page and come back again.

Can you please resolve this plus the other comments mentioned in my previous comment before my next review?

swiftcc624 commented 1 month ago

@parrot9design

I frequently have issues using ETH on Arbitrum (for collateral/swaps/transfers) unless I use a minuscule amount, even when I leave more than enough to account for fees:

The borrow fee resets to 0 once a transaction is in progress:

Do you still get those issues? Did you get them in the just previous testing?

swiftcc624 commented 1 month ago
image

If you don't have a Sui wallet installed, nothing happens when you click Connect wallet. Related: https://github.com/balancednetwork/balanced-network-interface/issues/1429

It shows the modal in the screenshot in that case on my side.

parrot9design commented 1 month ago

Strange, I can't get the ICON, EVM, or Sui Connect wallet prompts to trigger in any browser on Mac or iOS unless there's a compatible wallet installed.

Let's update that Sui message to:

No Sui-based wallet detected.

Add a wallet like [Hana]() or [Sui Wallet]() to your browser, then try again.


Do you still get those issues? Did you get them in the just previous testing?

I encounter these issues in both this build and the live app, but as Balanced development has been neglected in favour of HanaSwap recently, let's at least get the Arbitrum issue fixed now to avoid waiting weeks for the fix.

parrot9design commented 1 month ago

It should be:

Confirming transaction on {origination chain}...

Finalising transaction on {destination chain}...



swiftcc624 commented 1 month ago

@parrot9design I've fixed all feedbacks except It still takes a loooong time for most Sui transactions to finalise.

But it's not my scope and it's fixed, I think.

Can you please check the latest build again?

parrot9design commented 1 month ago
parrot9design commented 1 month ago
swiftcc624 commented 1 month ago
image

I'm still seeing ICON mentioned in a few of the transaction messages.

@parrot9design it's because the destination chain of Repay is ICON

you said

It should be:

Confirming transaction on {origination chain}...

Finalising transaction on {destination chain}...
swiftcc624 commented 1 month ago

The bnUSD balance on Sui still isn't being pulled through in the loan blockchain selector

Let's also update the default swap pair: SUI on Sui for ETH on Base

@parrot9design I've fixed the above feedbacks.

parrot9design commented 1 month ago

I'm still seeing ICON mentioned in a few of the transaction messages.

@parrot9design it's because the destination chain of Repay is ICON

you said

It should be:

Confirming transaction on {origination chain}...

Finalising transaction on {destination chain}...

I meant the destination chain from the user's perspective. If they haven't chosen to interact with ICON, they shouldn't need to know about it. Here, the destination chain would be Sui because that's the chain my collateral position is held on:

Screenshot 2024-10-08 at 6 34 22 PM

So the logic would be: Deposit/withdraw collateral: confirm and finalise on the collateral chain (e.g. Sui for SUI collateral) Borrow bnUSD: confirm on the collateral chain, finalise on the active chain in the Loan section Repay bnUSD: confirm on the active chain in the Loan section, finalise on the collateral chain


Screenshot 2024-10-08 at 6 35 43 PM Screenshot 2024-10-08 at 6 36 12 PM Screenshot 2024-10-08 at 6 36 27 PM Screenshot 2024-10-08 at 6 36 41 PM Screenshot 2024-10-08 at 6 40 35 PM
swiftcc624 commented 1 month ago

I'm still seeing ICON mentioned in a few of the transaction messages.

I'm now seeing an Approve transfer button in all Sui-related confirmation modals, none of which trigger the wallet (Hana), so I can't test any Sui transactions right now:

@parrot9design I've fixed them, can you please check again?

parrot9design commented 1 month ago

Looks good, thank you!

I found another issue that I initially thought was due to the Sui relay, but turned out to be because of gas. If your SUI balance is below a certain level, you're still able to confirm transactions, but they never appear in xcallscan so they remain in a pending state until they revert (which is only triggered by starting another transaction). Even if I choose to use the max SUI (which leaves 0.02 in my wallet), the transaction won't succeed.

Can you please add handling for SUI to prevent people from proceeding if they don't have enough gas to complete the transaction, similar to how we've done for gas on other chains?

swiftcc624 commented 1 month ago

@parrot9design I fixed gas checking, can you please check again?

parrot9design commented 1 month ago

It still doesn't check for gas. Whether I use the 100% input option or enter an amount manually, it continues to act like the transaction will go through as normal.

Only Avalanche and BNB Chain appear to check gas properly at the moment.

swiftcc624 commented 1 month ago

@parrot9design I've fixed it, can you please check it again?

parrot9design commented 1 month ago

I withdrew SUI collateral, which appeared to work well from the xcallscan side, but it's still pending in the UI 200+ minutes later.

Also need to fix up this decimal issue in the collateral dropdown

Screenshot 2024-10-10 at 9 54 14 AM
swiftcc624 commented 1 month ago

@parrot9design is it still pending? can you please double click it and give me the xcallscan link?

parrot9design commented 1 month ago

I quit out of the browser so it no longer appears under Bridge > Activity, but my SUI is still being held as collateral.

I think this was my first transaction: https://xcallscan.xyz/messages/17116 And here's one I just started. It executed on xcallscan almost instantly, but gets stuck finalising on the frontend. https://xcallscan.xyz/messages/17126

Fez mentioned he also encountered the same problem.

swiftcc624 commented 1 month ago

@parrot9design it's because you didn't repay the full/exact bnUSD amount. You need to borrow some and repay full amount again. And then you can withdraw all SUI.

parrot9design commented 1 month ago

Oh weird, yeah that fixed it – thanks!

The UI never had any indication that there was any loan remaining, and I repaid it right before I tried to withdraw collateral. Will this affect any new users, or only those who borrowed before you updated the decimal issue?

swiftcc624 commented 1 month ago

@parrot9design

Will this affect any new users, or only those who borrowed before you updated the decimal issue?

only those who borrowed before

parrot9design commented 1 month ago

Ok nice, thanks.

One issue that's just burned me a couple of times: If I deposit max SUI, it doesn't leave me with enough SUI to complete any other transactions. I can't borrow bnUSD or even withdraw my collateral without trying to find a way to top up my wallet.

This doesn't seem to be an issue for others, e.g. I can deposit and then withdraw ETH on Base without needing to worry about how to pay for the gas.

swiftcc624 commented 1 month ago

@parrot9design Did you get the issue on the latest build?

parrot9design commented 1 month ago

Yes, I always use the latest build.

swiftcc624 commented 1 month ago

@parrot9design I've fixed it, can you please check again?

parrot9design commented 1 month ago

After depositing max SUI as collateral, I'm able to sign other transactions, e.g. repay bnUSD and swap, but the transaction never appears in xcallscan and it reverts as soon as I start another one.

I also noticed the cross-chain fee for Sui has been updated – is it supposed to be 0.11 SUI? It was more like 0.000000011 SUI earlier.

swiftcc624 commented 1 month ago

@parrot9design

is it supposed to be 0.11 SUI?

Yes

it was more like 0.000000011 SUI earlier.

It was wrong before, Sui decimals 9, it was treated as 18 decimals before.

After depositing max SUI as collateral, I'm able to sign other transactions, e.g. repay bnUSD and swap, but the transaction never appears in xcallscan and it reverts as soon as I start another one.

Can you please give me the detailed steps? So I can reproduce it on my side.

swiftcc624 commented 1 month ago

After depositing max SUI as collateral, I'm able to sign other transactions, e.g. repay bnUSD and swap, but the transaction never appears in xcallscan and it reverts as soon as I start another one.

@parrot9design I increased gasThreshold, can you please test again?

parrot9design commented 1 month ago

Yeah, that's much better. This should be good to ship. 💪