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: traderxyz #6120

Closed
wants to merge 53 commits into from
Closed

feat: traderxyz #6120

wants to merge 53 commits into from

Conversation

vaimeo
Copy link

@vaimeo vaimeo commented Apr 20, 2022

Description

Traderxyz plugin added, opeansea cost exported to support the plugin

Closes # (NO_ISSUE)

Type of change

Previews

NFT Swap Preview

  • NFT POST Preview

image

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have removed all in development console.logs
  • I have removed all commented code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have read Internationalization Guide and moved text fields to the i18n JSON file.

@Jack-Works Jack-Works changed the title feat(traderxyz): spell-check fix feat(traderxyz) Apr 21, 2022
@guanbinrui guanbinrui changed the title feat(traderxyz) feat: traderxyz Apr 21, 2022
@guanbinrui guanbinrui requested review from Jack-Works and septs April 21, 2022 02:46
},
name,
tutorialLink:
'https://realmasknetwork.notion.site/Use-File-Service-via-Arweave-IPFS-SIA-Swarm-soon-8c8fe1efce5a48b49739a38f4ea8c60f',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'https://realmasknetwork.notion.site/Use-File-Service-via-Arweave-IPFS-SIA-Swarm-soon-8c8fe1efce5a48b49739a38f4ea8c60f',
'https://realmasknetwork.notion.site/8c8fe1efce5a48b49739a38f4ea8c60f',

Copy link
Author

Choose a reason for hiding this comment

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

It was there before let me remove it.

Copy link
Author

Choose a reason for hiding this comment

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

Once the traderxyz tutorial is upload to notion, i will put the updated link here.

Comment on lines +6 to +18
const useTraderApi_ = memoize(
(chainId: ChainId) => {
const p = useWeb3Provider()
const provider = new Web3Provider(p as unknown as ExternalProvider, chainId)
const signer = provider.getSigner(0)
return new NftSwap(provider, signer, chainId)
},
(chainId: ChainId) => String(chainId),
)

export function useTraderApi(chainId: number) {
return useTraderApi_(chainId)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const useTraderApi_ = memoize(
(chainId: ChainId) => {
const p = useWeb3Provider()
const provider = new Web3Provider(p as unknown as ExternalProvider, chainId)
const signer = provider.getSigner(0)
return new NftSwap(provider, signer, chainId)
},
(chainId: ChainId) => String(chainId),
)
export function useTraderApi(chainId: number) {
return useTraderApi_(chainId)
}
export const useTraderApi = memoize(
(chainId: ChainId) => {
const p = useWeb3Provider()
const provider = new Web3Provider(p as unknown as ExternalProvider, chainId)
const signer = provider.getSigner(0)
return new NftSwap(provider, signer, chainId)
},
(chainId: ChainId) => String(chainId),
)

Copy link
Author

Choose a reason for hiding this comment

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

Due to this error i used the the current aproach

image

@vaimeo vaimeo requested review from Jack-Works and septs May 15, 2022 22:37
import { useTraderApi } from '../apis/nftSwap'
import type { TradeMetaData, NFTData } from '../types'
import type { SwappableAsset } from '@traderxyz/nft-swap-sdk'
import { ActionButtonPromise } from '../../../../mask/src/extension/options-page/DashboardComponents/ActionButton'
Copy link
Member

Choose a reason for hiding this comment

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

You should not import from mask.

Copy link
Author

Choose a reason for hiding this comment

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

It is available in shared?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you should avoid using this component. ActionButtonPromise is overcomplicated and we want to get rid of it.


export const PreviewOrderView = (props: {
nftList: NFTData[] | undefined
setDisplaySection: Function
Copy link
Member

Choose a reason for hiding this comment

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

Type not accurate.

Comment on lines +2 to +3
import { InputTokenPanel } from '../../../../../packages/mask/src/plugins/Trader/SNSAdaptor/trader/InputTokenPanel'
import { TokenPanelType } from '../../../../../packages/mask/src/plugins/Trader/types'
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +174 to +176
const [step1, setState1] = useState(true)
const [step2, setState2] = useState(false)
const [step3, setState3] = useState(false)
Copy link
Member

Choose a reason for hiding this comment

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

Use a single state to represent step.

const { classes } = useStyles()
const t = useI18N()

const CustomTreeParent = styled(
Copy link
Member

Choose a reason for hiding this comment

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

Don't declare a component inside another component.

Comment on lines +16 to +18
export function useTraderApi(chainId: number) {
return useTraderApi_(chainId)
}
Copy link
Member

Choose a reason for hiding this comment

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

Why you need to wrap this function?

Copy link
Author

Choose a reason for hiding this comment

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

ID: PLUGIN_ID,
name: { fallback: PLUGIN_NAME },
description: { fallback: PLUGIN_DESCRIPTION },
publisher: { name: { fallback: '' }, link: '' },
Copy link
Member

Choose a reason for hiding this comment

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

Not resolved.

import type { Result } from 'ts-results'
import BigNumber from 'bignumber.js'

const reader_v2 = createTypedMessageMetadataReader<TradeMetaData>(META_KEY, schema)
Copy link
Member

Choose a reason for hiding this comment

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

Why v2? Is there a v1?


export interface TradeMetaData {
assetsInfo: {
nfts: [
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean T[] instead of [T]?

"include": ["src", "src/**/*.json"],
"references": [
{ "path": "../../theme" },
{ "path": "../../mask/src" },
Copy link
Member

Choose a reason for hiding this comment

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

Still not resolved.

@Jack-Works Jack-Works marked this pull request as draft May 17, 2022 04:14
@vaimeo vaimeo requested a review from Jack-Works May 21, 2022 08:47
@vaimeo
Copy link
Author

vaimeo commented Jun 4, 2022

Please remove it from draft.

@Jack-Works
Copy link
Member

This PR still has some problems (including import mask from a plugin) so I want to keep it as a draft.

@nuanyang233 nuanyang233 removed the request for review from septs July 6, 2022 10:06
@stale
Copy link

stale bot commented Sep 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

Successfully merging this pull request may close these issues.

5 participants