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

feat: Auto teleport V1 #7711

Merged
merged 130 commits into from
Nov 9, 2023
Merged

feat: Auto teleport V1 #7711

merged 130 commits into from
Nov 9, 2023

Conversation

hassnian
Copy link
Contributor

@hassnian hassnian commented Oct 17, 2023

Thank you for your contribution to the KodaDot - One Stop Shop for Polkadot NFTs.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

⚠️WIP ⚠️

Did your issue had any of the "$" label on it?

  • Fill up your DOT address: Payout

Community participation

Screenshot 📸

  • My fix has changed something on UI;

CleanShot 2023-10-26 at 08 35 18@2x

CleanShot 2023-10-30 at 10 26 31@2x

Copilot Summary

🤖 Generated by Copilot at c55e671

This pull request improves the functionality and user experience of the NFT gallery by adding support for cross-chain transfers of NFTs and displaying multiple balances for different chains and tokens. It introduces new composables, components, and utils to handle the logic and UI for auto teleport, multi balance, and teleport routes. It also simplifies and refactors some existing code in MultipleBalances.vue and Teleport.vue.

🤖 Generated by Copilot at c55e671

We are the masters of the chains, we teleport with ease
We balance all the assets, we use the composables
We create the components, we improve the UI
We are the kodadot rockers, we code with Vue and TS

@kodabot
Copy link
Collaborator

kodabot commented Oct 17, 2023

SUCCESS @hassnian PR for issue #7643 which is assigned to you. Please wait for review and don't hesitate to grab another issue in the meantime!

@netlify
Copy link

netlify bot commented Oct 17, 2023

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit bf629cf
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/654ccbab05a0bd00080ee0fa
😎 Deploy Preview https://deploy-preview-7711--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@reviewpad
Copy link
Contributor

reviewpad bot commented Oct 17, 2023

AI-Generated Summary: This pull request introduces several modifications and functionality across eight different files. Modifications include implementation of functions related to balance checks in multiple chains and auto-teleport feature. Significant changes are also found within the teleport files, including expansions to the enumerations for chains and allowed transitions. New functions including 'calculateUsd', 'getBalance', and 'fetchMultipleBalance' are created for balance calculations. Additionally, the creation of 'AutoTeleportActionButton.vue', 'useAutoTeleport.ts', and 'useMultiBalance.ts' extend the application's functionality. Some existing code blocks have been reduced or noticeably modified, such as the switch block within 'getBalance' function within 'useBalance.ts' and removal of 'getBalance' implementation in 'MultipleBalances.vue'.

@reviewpad reviewpad bot added the large Pull request is large label Oct 17, 2023
composables/useMultiBalance.ts Outdated Show resolved Hide resolved
composables/useMultiBalance.ts Outdated Show resolved Hide resolved
composables/useMultiBalance.ts Outdated Show resolved Hide resolved
utils/teleport.ts Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
utils/teleport.ts Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useAutoTeleport.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useMultiBalance.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useAutoTeleport.ts Outdated Show resolved Hide resolved
components/shared/TransactionSteps/utils.ts Outdated Show resolved Hide resolved
composables/useAutoTeleport.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
composables/useTeleport.ts Outdated Show resolved Hide resolved
@prury prury removed the request for review from floyd-li November 8, 2023 14:39
Copy link
Contributor

@Jarsen136 Jarsen136 left a comment

Choose a reason for hiding this comment

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

Good job! Thank you for the code refactoring.

components/buy/Buy.vue Outdated Show resolved Hide resolved
items.value.map(ShoppingCartItemToTokenToBuy),
items.value.map((item) => item.name),
items.value.map((item) => item?.name),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Is it possible that the item is equal to null or undefined?

Copy link
Contributor

Choose a reason for hiding this comment

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

here again.
do not close conversations on behalf of the reviewer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

duly noted

Copy link
Contributor

Choose a reason for hiding this comment

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

So is there any clarification here? 👀

components/common/autoTeleport/AutoTeleportModal.vue Outdated Show resolved Hide resolved
composables/autoTeleport/useAutoTeleportTransition.ts Outdated Show resolved Hide resolved
@yangwao
Copy link
Member

yangwao commented Nov 8, 2023

wow, I noticed this, congratulations @hassnian !
waiting for green checks for approval and paying out )
image

@prury
Copy link
Member

prury commented Nov 8, 2023

#7711 (comment) updated

@yangwao if you want me to test auto-teleport on Polkadot Asset Hub, please fund the following account for collection and nft creation: 1CBmjqJvV1ha8BPQ5JAXGEzeJBLmGHNG9gYg96eC1dnjH5W

utils/balance.ts Outdated
Comment on lines 66 to 74
return (
(await api.query.tokens.accounts(
address,
tokenId,
)) as PalletBalancesAccountData
).free.toString()
}

return await balanceOf(api, address)
Copy link
Contributor

Choose a reason for hiding this comment

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

mind you there is no need for return await
a simple return would return a promise the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed, only first one is needed

Copy link
Contributor

@daiagi daiagi left a comment

Choose a reason for hiding this comment

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

nice work!

1 thing is:
this link should point to the transaction, currently, it points to the block
image

Copy link
Contributor

@Jarsen136 Jarsen136 left a comment

Choose a reason for hiding this comment

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

Please resolve the code conflict

@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

@yangwao if you want me to test auto-teleport on Polkadot Asset Hub, please fund the following account for collection and nft creation: 1CBmjqJvV1ha8BPQ5JAXGEzeJBLmGHNG9gYg96eC1dnjH5W

done

Copy link

codeclimate bot commented Nov 9, 2023

Code Climate has analyzed commit bf629cf and detected 10 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 4
Duplication 6

View more on Code Climate.

Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hassnian
Copy link
Contributor Author

hassnian commented Nov 9, 2023

@prury

  • listing should be fixed
  • collection creation

Second try: ❌
https://github.com/kodadot/nft-gallery/assets/36627808/1f0a476c-3545-4325-91f9-92bcf9c4843f
https://assethub-kusama.subscan.io/tx/0x19aac0a9c95e1af819ad9e5d6ef468d923c2c6eaf3000ca07afc4541c243266f

i get the same error on canary not sure why , any idea @kodadot/internal (check video 👆),

already checked txFee and collectionTotalDeposit

1 thing is: this link should point to the transaction, currently, it points to the block image

can do that on follow up or when I'm back

fyi, got something to do and will be afk for a couple of days , will be back on Monday maybe earlier

@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

can do that on follow up or when I'm back

yes, I'm gonna test it myself and would be pro merging it as I sense some dragons might appear or some edge cases over time.

@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

Noticed a few errors on the sidelines, but probably unrelated, as everything has worked for me

image

image

image

@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

lot of effort and worked perfectly, looking forward!
pay 230 usd

@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

😍 Perfect, I’ve sent the payout
💵 $230 @ 5.13 USD/DOT ~ 44.834 $DOT
🧗 13QUj3pZyFNfYj4AM336hRdyLQbevj5H3sR4PKmLEXLdwZhh
🔗 0x10eb2d33b999f723c67a57c261bfda92098f2d043d01f91dfce555d6436531c9

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label Nov 9, 2023
@yangwao
Copy link
Member

yangwao commented Nov 9, 2023

@prury if there is something, let's create follow up, for me buying worked and that was primary goal for this one, happy to learn if there any bugs in follow up isues

@yangwao yangwao merged commit 73767db into kodadot:main Nov 9, 2023
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large Pull request is large paid pull-request has been paid S-changes-requested-🤞 PR is almost good to go, just some fine tunning waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xmark modals Auto teleport V1
8 participants