balanced-network-interface icon indicating copy to clipboard operation
balanced-network-interface copied to clipboard

feat: add avax chain

Open 0xmilktea opened this issue 10 months ago • 5 comments

0xmilktea avatar Apr 18 '24 02:04 0xmilktea

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 May 30, 2024 9:19am

vercel[bot] avatar Apr 18 '24 02:04 vercel[bot]

Okay, here's my first round of feedback based on the testing I've done so far.

I tried a number of cross-chain swaps and transfers of AVAX from ICON to Avalanche, but the confirmation modal would never move past the Awaiting confirmation on Avalanche step. I did receive AVAX on Avalanche, and refreshing the page on Balanced shows the correct amount in my wallet, but the transaction still shows as pending in the UI (even after I disconnect all wallets).


I'm unable to complete a swap from Archway to Avalanche: Screenshot 2024-05-08 at 2 33 01 PM


The UI isn't pulling through my AVAX balance on Avalanche:

Screenshot 2024-05-08 at 12 23 13 PM

Screenshot 2024-05-08 at 12 23 26 PM


The destination blockchain was inconsistent in this transaction:

Screenshot 2024-05-08 at 12 29 48 PM

Screenshot 2024-05-08 at 2 35 45 PM


  • [x] Change this button label from Connect Wallet to Transfer: Screenshot 2024-05-08 at 11 59 46 AM

  • [x] Change the Bridge H2 back to Transfer I know it’s inconsistent with the tab label, but this was a conscious decision to improve the way we talk about it in the content that surrounds and supports this feature.

  • [x] Update the bridge content for Avalanche:
  • Bridge = Custom Relay + GMP
  • Tooltip =

Custom Relay can connect any chain to ICON's GMP service. Connections are secured by multiple relays, which are managed by different entities.

GMP (general message passing) is a cross-chain messenger that interacts with smart contracts on supported chains. Screenshot 2024-05-08 at 2 09 17 PM

  • Increase the tooltip width to 310px for optimal readability.
  • Update the xCall content to GMP for the Archway connection, as well.

  • [x] Hide the testnet options in the blockchain selector If testnets are needed (all our cross-chain testing has been on mainnet so far), it might be better to handle it on a different domain so users never have to see these options.

Following on from that...

  • [x] Only show relevant blockchains in the blockchain selector AVAX isn't available on Archway, just as sARCH isn't available on Avalanche, yet the UI allows this combination to exist. Only supported blockchains should appear for the chosen asset. Screenshot 2024-05-08 at 12 24 21 PM

  • [x] After you choose a blockchain from the dropdown selector, make the dropdown disappear rather than require you to click away to hide it. It's quite annoying in the Bridge tab.

  • [x] When you choose AVAX from an asset selector, the blockchain should default to Avalanche, and the blockchain selector should appear so you know there's an option to change it. The dropdown behaviour has disappeared in this PR, but you can see how it should behave in the live app or this screen recording: https://github.com/balancednetwork/balanced-network-interface/assets/63842577/826c0987-f9e7-4acf-a64d-baadb157c3c7


  • [x] Adjust the wording in the cross-chain confirmation modals

  • Awaiting confirmation on {blockchain}. -> Awaiting confirmation on {blockchain}...

  • Awaiting execution on {blockchain}. -> Finalising transaction on {blockchain}...

  • xCall in progress button label -> Transfer in progress

Screenshot 2024-05-08 at 12 07 30 PM


  • [x] Make the Sign out link disconnect all wallets. Avalanche refuses to disconnect currently. Screenshot 2024-05-08 at 12 18 45 PM

  • [ ] Avoid getting into a state where no tokens are supported for cross-chain transfers. At minimum, bnUSD should be featured in this list, right? Screenshot 2024-05-08 at 2 26 57 PM

  • [ ] Add AVAX on ICON as a collateral type (I assume the plan is still to launch with the ICON version, @FezBox?)

parrot9design avatar May 08 '24 02:05 parrot9design

Yes we do want to use avax as collateral on icon as well before the cross chain loans is ready

FezBox avatar May 08 '24 06:05 FezBox

@0xmilktea we need to fix the crashing issue due to store migration.

swiftcc624 avatar May 10 '24 03:05 swiftcc624

@0xmilktea hana integration as well

swiftcc624 avatar May 10 '24 03:05 swiftcc624

  • [x] https://github.com/balancednetwork/balanced-network-interface/issues/1304

  • [ ] https://github.com/balancednetwork/balanced-network-interface/issues/1328

  • [x] ust making sure when swapping any asset to bnusd - bnusd should be available as a delivery chain for avax (all connected chains)

  • [ ] Add AVAX on ICON as a collateral type (I assume the plan is still to launch with the ICON version. allowing avax on Loan contract is not done yet. blocked

  • [ ] we need to fix the crashing issue due to store migration.

0xmilktea avatar May 16 '24 16:05 0xmilktea

  • [x] could not use the supply function to supply avax via avalanche or Icon image

FezBox avatar May 16 '24 23:05 FezBox

  • [ ] Make it so that on mobile (tested on iOS), the search box for the sign-in modal isn’t active by default. It forces the keyboard to appear which makes the experience worse than scrolling a list.

  • [ ] Only getting WalletConnect as an option for Avalanche via Hana mobile. Is there something we/they need to do to fix this? I can't test properly on mobile because of it.

  • [x] When you choose AVAX from an asset selector, the blockchain should default to Avalanche, and the blockchain selector should appear so you know there's an option to change it. Check the live app or this screen recording to see how it should behave: https://github.com/balancednetwork/balanced-network-interface/assets/63842577/826c0987-f9e7-4acf-a64d-baadb157c3c7

  • [x] Let’s cut same-asset transfers from the Swap tab. I tried to be open-minded, but it doesn’t make sense with the metadata that’s displayed and it would be better to avoid scenarios like this:

  • [x] When I try to swap with no wallets connected, the sign-in modal appears, but so does the swap confirmation modal:

You shouldn’t be able to surface a confirmation modal until the base requirements for the transaction have been met. In this instance, only display the sign-in modal so the app can load in the wallet balance and addresses involved before moving ahead.

  • Upon closer inspection, the swap confirmation modal appears when at least one of the assets is not on the ICON blockchain.

  • [x] Fix the order of assets in the asset selector. If you have a wallet connected, it should order based on highest to lowest $ value, then alphabetical underneath. We should also add column sorting so people can choose to order the list based on name or value. Q Search name or contract

  • [x] Fix the Swap/Supply/Bridge panel between 390px - 800px: Multi-chain wallet Enter an amount ICON, Avalanche

  • [x] Adjust the wording in the cross-chain swap confirmation modal:
  • Awaiting confirmation on {blockchain}. -> Awaiting confirmation on {blockchain}…
  • Awaiting execution on {blockchain}. -> Finalising transaction on {blockchain}…
  • xCall in progress button label -> Swap in progress

  • [x] bnUSD is only available to transfer between ICON and Archway. You should be able to transfer it to/from all chains.
  • [x] Make USDC available to transfer to/from Archway

  • [x] Fix the USDC logo (it uses the custom token icon when it originates on Avalanche) Screenshot 2024-05-17 at 4 21 56 PM Screenshot 2024-05-17 at 4 22 01 PM

  • [x] The CALL EXECUTED message has gotta go. Transfer We only show pending transactions in the live app, not successful ones (because they require no action from the user). I'm indifferent about their inclusion, but if we keep them we need to:

    • [x] Change Call executed to Complete
    • [x] Clear the data when you sign out of all wallets so you don’t need to quit the browser to remove it.

To increase the usefulness of the completed transaction listings, we could also link to the transaction info from each side, if available: COMPLETE

parrot9design avatar May 17 '24 04:05 parrot9design

  • [ ] Archway connection doesn't load keplr wallet (it loads leap but if that's disabled it wont load keplr) image

FezBox avatar May 17 '24 05:05 FezBox

  • [x] bnUSD - doesn’t require approval on archway

  • [x] when approval tx is pending, disable (grey out) the button and change text to ‘approving’
Screenshot 2024-05-21 at 22 00 08
  • [x] when swapping Avalanche -> Archway, Avalanche -> Avalanche or Archway -> ICON Swap in progress button disappears
Screenshot 2024-05-21 at 21 15 39
  • [x] when trying to swap from bnUSD (Avalanche) to AVAX (Avalanche) and am signed in with EVM wallet only, swap modal warns about not enough ICX
Screenshot 2024-05-21 at 21 22 30

hetfly avatar May 21 '24 20:05 hetfly

  • [x] When swapping or transferring bnUSD from non ICON chains, asset manager can't be used. See bnUSD transfer implementation for the Archway chain

  • [x] when trying to swap or bridge bnUSD from Avalanche, xCalls are failing because of the reason above, but the UI doesn't show any errors

hetfly avatar May 21 '24 20:05 hetfly

  • [ ] Add the blockchain to the base tokens in the Supply tab (bnUSD in this example). Screenshot 2024-05-22 at 3 30 50 PM

  • [ ] Prevent the app from automatically connecting to Hana Go to the Trade page, but don't sign in. Unlock the Hana extension, then change the active wallet. Without any prompting, Balanced will automatically sign in with your Avalanche wallet. Now rotate between your wallets stored in Hana, and you'll see that Balanced automatically changes the active address. I can only reproduce this for Avalanche, but changes to the connected wallets should require user input to prevent anyone hurting themselves.

  • [x] If I set the Bridge tab to transfer from Archway > Avalanche, I get a white page.

  • [x] The price charts for sARCH/bnUSD and AVAX/bnUSD are only supported when the ICON:ICON versions are selected. Can we ignore the chains and show the price chart for every combination? Screenshot 2024-05-22 at 3 57 46 PM Screenshot 2024-05-22 at 3 57 52 PM

  • [x] Change the Approve button in the confirmation modals to Approve transfer: Screenshot 2024-05-22 at 4 12 51 PM

  • [x] Change approve to approval in this message: Screenshot 2024-05-22 at 4 04 11 PM

  • [ ] Make this message more specific: Screenshot 2024-05-22 at 4 04 26 PM

Couldn't approve cross-chain transfer. View common transaction issues.

  • [ ] Not all cross-chain swaps display a concrete fee to transfer. Is there none, or are they just not being pulled through properly? When there's no transfer fee, omit this line from the swap confirmation modal: Screenshot 2024-05-22 at 4 03 22 PM

  • [x] Replace the Connect wallet prompt on the Bridge tab with this placeholder text: {destination blockchain} address. Keep the current behaviour that prefills the address for chains you're connected to. Screenshot 2024-05-22 at 4 33 44 PM

parrot9design avatar May 22 '24 04:05 parrot9design

In the latest build, when trying to pick a token to swap while the drop-down is displayed, the tokens keep moving positions randomly as the mouse hovers over it.

FezBox avatar May 23 '24 06:05 FezBox

To remove the need to connect 2 wallets for a cross-chain swap, here's some updated handling for the Swap tab:

  • If you haven't connected a wallet for the recipient chain, show Choose address instead: Screenshot 2024-05-16 at 3 45 37 PM (If you've already connected a wallet, continue to default to that address.)

  • Click Choose address or the prefilled wallet address to get a variation of this modal: address-picker

  • If you enter a custom address, ignore the wallet balance because the amount is less helpful (especially if sending to an exchange). Instead, use Wallet: Custom to draw attention to the fact that it's set to an alternative address: Screenshot 2024-05-23 at 8 51 50 PM

  • If you enter a custom address and then reverse the swap (so the For asset + chain now appear under Swap), forget the custom address and either fill the connected wallet address or prompt to connect one.


Note: The Choose address modal I've provided is just a mockup, and I've already talked to @hetfly about this in more detail, so I'd prefer to let him tackle this piece.

parrot9design avatar May 23 '24 08:05 parrot9design

  • [x] When I try to swap CFT for bnUSD on Avalanche, app asks for CFT approval, no token on ICON should need approval
image

hetfly avatar May 23 '24 15:05 hetfly

  • [x] Update the currency sorting to include ICX. Right now ICX always appears at the top, which is initially confusing and makes no sense now that Balanced is cross-chain.
  • [x] When signed in, default to sorting the list by highest to lowest wallet value.
  • [ ] Seeing some strange behaviour in the asset dropdown across all tabs: https://github.com/balancednetwork/balanced-network-interface/assets/63842577/3533ec70-6445-452d-ab77-e3178a6da982

  • [ ] Transactions to Avalanche take forever to finalise? It stays on this modal for so long that I always assume it's gotten stuck: Screenshot 2024-05-24 at 2 02 46 PM

There should be a time counting up underneath Pending, as well: Screenshot 2024-05-24 at 2 12 07 PM

  • I have a suspicion this is related to the Hana issue I mentioned in this comment, as it always resolves itself when I open the Hana extension.

  • [ ] Transfers between Avalanche & Archway should support bnUSD and USDC

  • [ ] I get this error when I try to supply AVAX liquidity. It doesn't happen in the live app: Screenshot 2024-05-24 at 1 45 00 PM

  • [ ] My balance for ICON assets isn't consistent between elements on the Supply tab: Screenshot 2024-05-24 at 1 47 39 PM Screenshot 2024-05-24 at 1 47 43 PM

  • [x] Fix up the padding for the hover effect on WalletConnect at mobile:

parrot9design avatar May 24 '24 02:05 parrot9design

Here are the issues still outstanding from my previous comments, plus a couple of additional ones based on the latest round of testing:

  • [x] Transfers between Avalanche & Archway should support bnUSD and USDC

  • [x] Add the blockchain to the second token on the Supply tab (bnUSD in this example): 332645025-2a659cd8-8de8-44ca-924d-df36e63499c2

  • [ ] Prevent the app from automatically connecting to Avalanche in the Hana browser wallet Go to the Trade page, but don't sign in. Unlock the Hana extension, then change the active wallet. Without any prompting, Balanced will automatically sign in on Avalanche. Set up the Swap tab to show a cross-chain swap (e.g. Avalanche to ICON). Now rotate between a few different wallets within Hana, and you'll see that Balanced automatically changes the active Avalanche address. I'm not sure whether the fix is on us or Hana to resolve, but changes to the wallets Balanced is connected to should require user input to prevent anyone from hurting themselves.

  • [x] Replace the Enter recipient button label with Enter address: Screenshot 2024-05-26 at 4 46 18 PM

  • [x] Update the Avalanche transfer time. It appears to be hardcoded using the same value as Archway, but in my experience ~30s would be more accurate (it often only seems to finalise after I interact with the Hana extension?). Screenshot 2024-05-26 at 4 49 27 PM

  • [x] The order of chains doesn't make any sense here. Let's order them alphabetically: Screenshot 2024-05-26 at 4 52 44 PM

  • [ ] When I choose to sign in with WalletConnect on desktop or mobile, I'm unable to click into the search field or scroll the list. let's fix it later.

  • [ ] When I swap bnUSD for AVAX (both on Avalanche), it seems to hang on the finalising step. Opening Hana seems to trigger its completion, but then a second message appears underneath after the first (there should only ever be one message): Screenshot 2024-05-26 at 5 03 46 PM

It also results in two separate messages in the Activity section, rather than one (Avalanche -> Avalanche). It's reproducible, so I took a video the second time around. The final transaction is still pending in the UI 6 minutes later. The video is too large to include here, but you can access it from https://drive.google.com/file/d/1dtTMGV-4JNGA-aMNVQw1AbY5dPwh6s8a/


  • [ ] The app also seems to hang for Archway <> Avalanche transactions. The banner message signals a successful swap, but the modal doesn't disappear until I click outside of it, and it still shows as pending in the Activity section. My wallet balances have changed, however. https://drive.google.com/file/d/1T7vjQwzH5n-pto_Svu_93R_X68Lh4qrR

  • [x] Order the Activity messages from most -> least recent (it currently does the opposite): Screenshot 2024-05-26 at 5 25 26 PM

parrot9design avatar May 26 '24 05:05 parrot9design

  • [x] The Choose address option is inconsistent for ICON assets. It only seems to appear when the original asset comes from another chain. cc @hetfly

  • [x] The Swap button is active when you haven't connected a receiving wallet or entered a custom address. Clicking it prompts a connect wallet modal, which isn't actually needed to move forwards: the address is. When the receiving address is unknown, make the Swap button inactive, hide the wallet balance, and replace the button label with Choose address: Screenshot 2024-05-27 at 11 54 55 AM ->

  • [x] Replace xCall with GMP in the swap metadata: Screenshot 2024-05-27 at 11 50 55 AM

  • [x] Add the bridge for transactions between Archway and Avalanche Screenshot 2024-05-27 at 11 56 19 AM Screenshot 2024-05-27 at 12 15 09 PM

Also, the bridge fee is missing from Archway -> Avalanche.


  • [x] Can we do something to prevent the blockchains from looking broken? Screenshot 2024-05-27 at 12 30 34 PM

  • [x] I'm seeing multiple entries for bnUSD in the wallet for Avalanche and Archway: Screenshot 2024-05-27 at 12 32 33 PM Screenshot 2024-05-27 at 12 32 27 PM

parrot9design avatar May 27 '24 00:05 parrot9design

  • [ ] merge transfer & swap functions into one function. DRY

  • [ ] filter logs by xcall address. Optimize

  • [ ] refactor XCallService. readability.

    • [ ] define XCallMessageSentEvent, XCallMessageEvent, XCallExecutedEvent interfaces. XCallEvent = XCallMessageSentEvent | XCallMessageEvent | XCallExecutedEvent reference https://github.com/icon-project/xcall-multi/blob/main/docs/adr/xcall.md

    • [ ] define parseEventLogs(rawEventLogs: any[]) the function accepts raw event logs and filters and parses only XCallEvents

    • [ ] define parseEventLog(rawEventLog: any, type: XCallEventType): the function parses raw log event into the one above event interfaces. remove parseCallMessageSentEventLog, parseCallMessageEventLog, parseCallExecutedEventLog remove filterCallMessageSentEventLog, filterCallMessageEventLogs, filterCallExecutedEventLogs filterEvents(events: XCallEvent[], type: XCallEventType)

    • [ ] add getXCallFee and refactor related parts.

    • [ ] add approve and refactor related parts

0xmilktea avatar May 27 '24 08:05 0xmilktea

xswaping USDC from archway to icon is failing.

0xmilktea avatar May 27 '24 16:05 0xmilktea

xswaping USDC from archway to icon is failing.

@0xmilktea this is possible with routeV2 only https://github.com/balancednetwork/balanced-network-interface/issues/1328

hetfly avatar May 28 '24 13:05 hetfly

  • [x] Make the activity list scrollable if there are 4+ entries to avoid stretching the Bridge panel. Screenshot 2024-05-29 at 2 03 36 PM

parrot9design avatar May 29 '24 02:05 parrot9design

  • [ ] when trying to bridge bnUSD from Archway to Avalanche, wallet doesn't popup after I click on Transfer in the confirmation modal. Console shows this error:
Error: Query failed with (6): rpc error: code = Unknown desc = failed to execute message; message index: 0: Invalid Network Address according to Network ID: execute wasm contract failed [CosmWasm/[email protected]/x/wasm/keeper/keeper.go:395] With gas wanted: '300000000' and gas used: '127733' : unknown request

hetfly avatar May 29 '24 13:05 hetfly