diff --git a/packages/mask/shared-ui/service.ts b/packages/mask/shared-ui/service.ts index d26840f3e5f7..e5317371bc51 100644 --- a/packages/mask/shared-ui/service.ts +++ b/packages/mask/shared-ui/service.ts @@ -52,8 +52,8 @@ export const GeneratorServices: AsyncGeneratorVersionOf = function add(key: string, generator = false): AsyncVersionOf { const channel = message.events[key].bind(Environment.ManifestBackground) - const RPC = (generator ? AsyncGeneratorCall : AsyncCall) as any as typeof AsyncCall - const service = RPC(null, { + const asyncCall = (generator ? AsyncGeneratorCall : AsyncCall) as any as typeof AsyncCall + const service = asyncCall(null, { key, encoder, log, diff --git a/packages/plugins/Tips/src/components/TipDialog.tsx b/packages/plugins/Tips/src/components/TipDialog.tsx index 46c64f8952bc..2fa99d0b2c5e 100644 --- a/packages/plugins/Tips/src/components/TipDialog.tsx +++ b/packages/plugins/Tips/src/components/TipDialog.tsx @@ -95,33 +95,25 @@ export function TipDialog({ open = false, onClose }: TipDialogProps) { const isTokenTip = tipType === TokenType.Fungible const shareText = useMemo(() => { const recipientName = recipient?.label || recipientEns - const promote = _(msg`Install https://mask.io/download-links to send your first tip.`) if (isTokenTip) { - return ( - _( - msg`I just tipped ${amount} ${select(token?.symbol ? 'namedToken' : 'token', { - namedToken: token?.symbol || '', - other: 'token', - })} to @${recipientUserId}'s ${select(recipientName ? 'name' : 'address', { - name: 'wallet', - address: 'wallet address', - other: 'wallet', - })} ${recipientName || recipientAddress}`, - ) + `\n\n${promote}` + return _( + msg`I just tipped ${amount} ${select(token?.symbol ? 'namedToken' : 'token', { + namedToken: token?.symbol || '', + other: 'token', + })} to @${recipientUserId}'s ${select(recipientName ? 'name' : 'address', { + name: 'wallet', + address: 'wallet address', + other: 'wallet', + })} ${recipientName || recipientAddress}\n\nInstall https://mask.io/download-links to send your first tip.`, ) } else { const NFT_Name = nonFungibleTokenContract?.name || 'NFT' - return ( - _( - msg`I just tipped a ${NFT_Name} to @${recipientUserId}'s ${select( - recipientName ? 'name' : 'address', - { - name: 'wallet', - address: 'wallet address', - other: 'wallet', - }, - )} ${recipientAddress}`, - ) + `\n\n${promote}` + return _( + msg`I just tipped a ${NFT_Name} to @${recipientUserId}'s ${select(recipientName ? 'name' : 'address', { + name: 'wallet', + address: 'wallet address', + other: 'wallet', + })} ${recipientAddress}\n\nInstall https://mask.io/download-links to send your first tip.`, ) } }, [amount, isTokenTip, nonFungibleTokenContract?.name, token, recipient, recipientUserId, _, recipientEns]) diff --git a/packages/plugins/Tips/src/components/TipsButton/index.tsx b/packages/plugins/Tips/src/components/TipsButton/index.tsx index cb82307bfc22..ff636aeaf16d 100644 --- a/packages/plugins/Tips/src/components/TipsButton/index.tsx +++ b/packages/plugins/Tips/src/components/TipsButton/index.tsx @@ -17,7 +17,7 @@ import { useTipsAccounts } from './useTipsAccounts.js' interface Props extends HTMLProps { // This is workaround solution, link issue mf-2536 and pr #7576. - // Should refactor social account to support multi-account for one post. + // Should refactor social account to support post by multiple authors. accounts?: Array> recipient?: string receiver?: ProfileIdentifier @@ -26,7 +26,7 @@ interface Props extends HTMLProps { onStatusUpdate?(disabled: boolean): void } -const useStyles = makeStyles<{ iconSize: number }>()((theme, props) => ({ +const useStyles = makeStyles()({ tipButton: { cursor: 'pointer', display: 'flex', @@ -34,11 +34,7 @@ const useStyles = makeStyles<{ iconSize: number }>()((theme, props) => ({ alignItems: 'center', fontFamily: '-apple-system, system-ui, sans-serif', }, - icon: { - width: props.iconSize, - height: props.iconSize, - }, -})) +}) export function TipButton(props: Props) { const { @@ -51,7 +47,7 @@ export function TipButton(props: Props) { onStatusUpdate, ...rest } = props - const { classes, cx } = useStyles({ iconSize }) + const { classes, cx } = useStyles() const { data: personaPubkey, isPending: loadingPersona } = useProfilePublicKey(receiver?.userId) const receiverUserId = receiver?.userId @@ -124,7 +120,7 @@ export function TipButton(props: Props) { return (
- + {children}
) diff --git a/packages/plugins/Tips/src/contexts/Tip/useRecipientValidate.ts b/packages/plugins/Tips/src/contexts/Tip/useRecipientValidate.ts index f4f4ef83915f..73268c6adecc 100644 --- a/packages/plugins/Tips/src/contexts/Tip/useRecipientValidate.ts +++ b/packages/plugins/Tips/src/contexts/Tip/useRecipientValidate.ts @@ -1,34 +1,39 @@ -import { useMemo } from 'react' -import { useAsync } from 'react-use' +import { msg } from '@lingui/macro' +import { useLingui } from '@lingui/react' +import { NetworkPluginID } from '@masknet/shared-base' import { useAddressType, useChainContext } from '@masknet/web3-hooks-base' import { GoPlusLabs } from '@masknet/web3-providers' -import { AddressType } from '@masknet/web3-shared-evm' -import { NetworkPluginID } from '@masknet/shared-base' +import { AddressType, type ChainId } from '@masknet/web3-shared-evm' +import { useQuery } from '@tanstack/react-query' +import { useMemo } from 'react' import type { ValidationTuple } from '../../types/index.js' -import { msg } from '@lingui/macro' -import { useLingui } from '@lingui/react' +import { TargetRuntimeContext } from '../TargetRuntimeContext.js' export function useRecipientValidate(recipientAddress: string): { loading: boolean validation: ValidationTuple } { const { _ } = useLingui() - const { chainId } = useChainContext() - const { value: addressType, loading } = useAddressType(NetworkPluginID.PLUGIN_EVM, recipientAddress, { + const { targetPluginID } = TargetRuntimeContext.useContainer() + const { chainId } = useChainContext() + const { value: addressType, loading } = useAddressType(targetPluginID, recipientAddress, { chainId, }) - const { value: security } = useAsync(async () => { - return GoPlusLabs.getAddressSecurity(chainId, recipientAddress) - }, [chainId, recipientAddress]) - - const isMaliciousAddress = security && Object.values(security).filter((x) => x === '1').length > 0 + const isEvm = targetPluginID === NetworkPluginID.PLUGIN_EVM + const { data: security } = useQuery({ + enabled: isEvm, + queryKey: ['go-plus', 'address-security', chainId, recipientAddress], + queryFn: () => GoPlusLabs.getAddressSecurity(chainId as ChainId, recipientAddress), + }) const validation: ValidationTuple = useMemo(() => { + if (!isEvm) return [true] if (addressType === AddressType.Contract) return [false, _(msg`The receiving address is a contract address. Please check again.`)] + const isMaliciousAddress = security && Object.values(security).filter((x) => x === '1').length > 0 if (isMaliciousAddress) return [false, _(msg`The receiving address may be a malicious address.`)] return [true] - }, [addressType, isMaliciousAddress, _]) + }, [isEvm, addressType, security, _]) return { loading, validation, diff --git a/packages/plugins/Tips/src/locale/en-US.json b/packages/plugins/Tips/src/locale/en-US.json index 3ffee116f0ea..b7827f0e60f3 100644 --- a/packages/plugins/Tips/src/locale/en-US.json +++ b/packages/plugins/Tips/src/locale/en-US.json @@ -17,6 +17,19 @@ " ", ["3"] ], + "Wam87B": [ + "I just tipped ", + ["amount"], + " ", + ["0", "select", { "namedToken": [["1"]], "other": "token" }], + " to @", + ["recipientUserId"], + "'s ", + ["2", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["3"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "x5tVFy": [ "I just tipped a ", ["NFT_Name"], @@ -27,6 +40,17 @@ " ", ["recipientAddress"] ], + "7e+2an": [ + "I just tipped a ", + ["NFT_Name"], + " to @", + ["recipientUserId"], + "'s ", + ["0", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["recipientAddress"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "2Wwd56": "Install https://mask.io/download-links to send your first tip.", "znqB4T": "Insufficient balance", "8Dh77Z": "NFTs", diff --git a/packages/plugins/Tips/src/locale/en-US.po b/packages/plugins/Tips/src/locale/en-US.po index ca9ea91e216b..3b819cb39158 100644 --- a/packages/plugins/Tips/src/locale/en-US.po +++ b/packages/plugins/Tips/src/locale/en-US.po @@ -32,17 +32,25 @@ msgid "Gift crypto or NFTs tips to any <0>Next.ID verified users on social m msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" -msgstr "" +#~ msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" +#~ msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" #: src/components/TipDialog.tsx -msgid "Install https://mask.io/download-links to send your first tip." +#~ msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +#~ msgstr "" + +#: src/components/TipDialog.tsx +msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" +#: src/components/TipDialog.tsx +#~ msgid "Install https://mask.io/download-links to send your first tip." +#~ msgstr "" + #: src/contexts/Tip/useTipValidate.ts msgid "Insufficient balance" msgstr "" diff --git a/packages/plugins/Tips/src/locale/ja-JP.json b/packages/plugins/Tips/src/locale/ja-JP.json index 6b350f2af188..8adee911d446 100644 --- a/packages/plugins/Tips/src/locale/ja-JP.json +++ b/packages/plugins/Tips/src/locale/ja-JP.json @@ -17,6 +17,19 @@ " ", ["3"] ], + "Wam87B": [ + "I just tipped ", + ["amount"], + " ", + ["0", "select", { "namedToken": [["1"]], "other": "token" }], + " to @", + ["recipientUserId"], + "'s ", + ["2", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["3"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "x5tVFy": [ "I just tipped a ", ["NFT_Name"], @@ -27,6 +40,17 @@ " ", ["recipientAddress"] ], + "7e+2an": [ + "I just tipped a ", + ["NFT_Name"], + " to @", + ["recipientUserId"], + "'s ", + ["0", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["recipientAddress"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "2Wwd56": "Install https://mask.io/download-links to send your first tip.", "znqB4T": "残高が不足しています", "8Dh77Z": "NFTs", diff --git a/packages/plugins/Tips/src/locale/ja-JP.po b/packages/plugins/Tips/src/locale/ja-JP.po index c2ebc81b22f6..9d1a82a2fd90 100644 --- a/packages/plugins/Tips/src/locale/ja-JP.po +++ b/packages/plugins/Tips/src/locale/ja-JP.po @@ -37,17 +37,25 @@ msgid "Gift crypto or NFTs tips to any <0>Next.ID verified users on social m msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" -msgstr "" +#~ msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" +#~ msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" #: src/components/TipDialog.tsx -msgid "Install https://mask.io/download-links to send your first tip." +#~ msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +#~ msgstr "" + +#: src/components/TipDialog.tsx +msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" +#: src/components/TipDialog.tsx +#~ msgid "Install https://mask.io/download-links to send your first tip." +#~ msgstr "" + #: src/contexts/Tip/useTipValidate.ts msgid "Insufficient balance" msgstr "残高が不足しています" diff --git a/packages/plugins/Tips/src/locale/ko-KR.json b/packages/plugins/Tips/src/locale/ko-KR.json index d606800e67fc..e8cc0931439d 100644 --- a/packages/plugins/Tips/src/locale/ko-KR.json +++ b/packages/plugins/Tips/src/locale/ko-KR.json @@ -17,6 +17,19 @@ " ", ["3"] ], + "Wam87B": [ + "I just tipped ", + ["amount"], + " ", + ["0", "select", { "namedToken": [["1"]], "other": "token" }], + " to @", + ["recipientUserId"], + "'s ", + ["2", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["3"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "x5tVFy": [ "I just tipped a ", ["NFT_Name"], @@ -27,6 +40,17 @@ " ", ["recipientAddress"] ], + "7e+2an": [ + "I just tipped a ", + ["NFT_Name"], + " to @", + ["recipientUserId"], + "'s ", + ["0", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["recipientAddress"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "2Wwd56": "Install https://mask.io/download-links to send your first tip.", "znqB4T": "잔액 부족", "8Dh77Z": "NFTs", diff --git a/packages/plugins/Tips/src/locale/ko-KR.po b/packages/plugins/Tips/src/locale/ko-KR.po index 70d5b7966bbb..c4546ef02f9c 100644 --- a/packages/plugins/Tips/src/locale/ko-KR.po +++ b/packages/plugins/Tips/src/locale/ko-KR.po @@ -37,17 +37,25 @@ msgid "Gift crypto or NFTs tips to any <0>Next.ID verified users on social m msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" -msgstr "" +#~ msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" +#~ msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" #: src/components/TipDialog.tsx -msgid "Install https://mask.io/download-links to send your first tip." +#~ msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +#~ msgstr "" + +#: src/components/TipDialog.tsx +msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" +#: src/components/TipDialog.tsx +#~ msgid "Install https://mask.io/download-links to send your first tip." +#~ msgstr "" + #: src/contexts/Tip/useTipValidate.ts msgid "Insufficient balance" msgstr "잔액 부족" diff --git a/packages/plugins/Tips/src/locale/zh-CN.json b/packages/plugins/Tips/src/locale/zh-CN.json index 0fcdec200827..bc83a8ff986d 100644 --- a/packages/plugins/Tips/src/locale/zh-CN.json +++ b/packages/plugins/Tips/src/locale/zh-CN.json @@ -17,6 +17,19 @@ " ", ["3"] ], + "Wam87B": [ + "I just tipped ", + ["amount"], + " ", + ["0", "select", { "namedToken": [["1"]], "other": "token" }], + " to @", + ["recipientUserId"], + "'s ", + ["2", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["3"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "x5tVFy": [ "I just tipped a ", ["NFT_Name"], @@ -27,6 +40,17 @@ " ", ["recipientAddress"] ], + "7e+2an": [ + "I just tipped a ", + ["NFT_Name"], + " to @", + ["recipientUserId"], + "'s ", + ["0", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["recipientAddress"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "2Wwd56": "Install https://mask.io/download-links to send your first tip.", "znqB4T": "余额不足", "8Dh77Z": "NFTs", diff --git a/packages/plugins/Tips/src/locale/zh-CN.po b/packages/plugins/Tips/src/locale/zh-CN.po index d464d69faa43..f39088afe3a6 100644 --- a/packages/plugins/Tips/src/locale/zh-CN.po +++ b/packages/plugins/Tips/src/locale/zh-CN.po @@ -37,17 +37,25 @@ msgid "Gift crypto or NFTs tips to any <0>Next.ID verified users on social m msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" -msgstr "" +#~ msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" +#~ msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" #: src/components/TipDialog.tsx -msgid "Install https://mask.io/download-links to send your first tip." +#~ msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +#~ msgstr "" + +#: src/components/TipDialog.tsx +msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" +#: src/components/TipDialog.tsx +#~ msgid "Install https://mask.io/download-links to send your first tip." +#~ msgstr "" + #: src/contexts/Tip/useTipValidate.ts msgid "Insufficient balance" msgstr "余额不足" diff --git a/packages/plugins/Tips/src/locale/zh-TW.json b/packages/plugins/Tips/src/locale/zh-TW.json index 0fcdec200827..bc83a8ff986d 100644 --- a/packages/plugins/Tips/src/locale/zh-TW.json +++ b/packages/plugins/Tips/src/locale/zh-TW.json @@ -17,6 +17,19 @@ " ", ["3"] ], + "Wam87B": [ + "I just tipped ", + ["amount"], + " ", + ["0", "select", { "namedToken": [["1"]], "other": "token" }], + " to @", + ["recipientUserId"], + "'s ", + ["2", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["3"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "x5tVFy": [ "I just tipped a ", ["NFT_Name"], @@ -27,6 +40,17 @@ " ", ["recipientAddress"] ], + "7e+2an": [ + "I just tipped a ", + ["NFT_Name"], + " to @", + ["recipientUserId"], + "'s ", + ["0", "select", { "name": "wallet", "address": "wallet address", "other": "wallet" }], + " ", + ["recipientAddress"], + "\\n\\nInstall https://mask.io/download-links to send your first tip." + ], "2Wwd56": "Install https://mask.io/download-links to send your first tip.", "znqB4T": "余额不足", "8Dh77Z": "NFTs", diff --git a/packages/plugins/Tips/src/locale/zh-TW.po b/packages/plugins/Tips/src/locale/zh-TW.po index 21cd888549e1..ea3ad40aa9d3 100644 --- a/packages/plugins/Tips/src/locale/zh-TW.po +++ b/packages/plugins/Tips/src/locale/zh-TW.po @@ -37,17 +37,25 @@ msgid "Gift crypto or NFTs tips to any <0>Next.ID verified users on social m msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" -msgstr "" +#~ msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}" +#~ msgstr "" #: src/components/TipDialog.tsx -msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +msgid "I just tipped {amount} {0, select, namedToken {{1}} other {token}} to @{recipientUserId}'s {2, select, name {wallet} address {wallet address} other {wallet}} {3}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" #: src/components/TipDialog.tsx -msgid "Install https://mask.io/download-links to send your first tip." +#~ msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}" +#~ msgstr "" + +#: src/components/TipDialog.tsx +msgid "I just tipped a {NFT_Name} to @{recipientUserId}'s {0, select, name {wallet} address {wallet address} other {wallet}} {recipientAddress}\\n\\nInstall https://mask.io/download-links to send your first tip." msgstr "" +#: src/components/TipDialog.tsx +#~ msgid "Install https://mask.io/download-links to send your first tip." +#~ msgstr "" + #: src/contexts/Tip/useTipValidate.ts msgid "Insufficient balance" msgstr "" diff --git a/packages/shared/src/UI/modals/SelectFungibleTokenModal/SelectFungibleTokenDialog.tsx b/packages/shared/src/UI/modals/SelectFungibleTokenModal/SelectFungibleTokenDialog.tsx index 0ea2cb352e4b..792f355e2315 100644 --- a/packages/shared/src/UI/modals/SelectFungibleTokenModal/SelectFungibleTokenDialog.tsx +++ b/packages/shared/src/UI/modals/SelectFungibleTokenModal/SelectFungibleTokenDialog.tsx @@ -129,7 +129,7 @@ export function SelectFungibleTokenDialog({ }>
- {!lockChainId ? + {!lockChainId && currentPluginID === NetworkPluginID.PLUGIN_EVM ? extends withClasses<'listBox' | 'searchInput'> { +const useStyles = makeStyles()((theme) => ({ + container: { + display: 'flex', + flexDirection: 'column', + overflow: 'visible', + gap: theme.spacing(2), + }, + listBox: { + flexGrow: 1, + minHeight: 0, + overflow: 'auto', + '& > div': { + scrollbarWidth: 'none', + }, + '& > div::-webkit-scrollbar': { + backgroundColor: 'transparent', + width: 0, + }, + '& > div::-webkit-scrollbar-thumb': { + borderRadius: '20px', + width: 5, + border: '7px solid rgba(0, 0, 0, 0)', + backgroundColor: theme.palette.maskColor.secondaryLine, + backgroundClip: 'padding-box', + }, + '& > div > div': { + position: 'relative', + margin: 'auto', + }, + }, + list: { + scrollbarWidth: 'none', + }, + error: { + backgroundColor: theme.palette.maskColor.bottom, + fontSize: 14, + color: theme.palette.maskColor.danger, + }, +})) + +export interface MaskSearchableListProps + extends withClasses<'listBox' | 'searchInput'>, + Omit, 'data' | 'onSelect'> { /** The list data should be render */ data: T[] /** The identity of list data item for remove duplicates item */ @@ -116,9 +158,9 @@ export function SearchableList({ const windowHeight = !!textFieldPropsRest.error && typeof height === 'number' ? height - 28 : height return ( -
+
{!disableSearch && ( - + ({ ) } -const useStyles = makeStyles()((theme) => ({ - container: { - overflow: 'visible', - }, - listBox: { - '& > div': { - scrollbarWidth: 'none', - }, - '& > div::-webkit-scrollbar': { - backgroundColor: 'transparent', - width: 0, - }, - '& > div::-webkit-scrollbar-thumb': { - borderRadius: '20px', - width: 5, - border: '7px solid rgba(0, 0, 0, 0)', - backgroundColor: theme.palette.maskColor.secondaryLine, - backgroundClip: 'padding-box', - }, - '& > div > div': { - position: 'relative', - margin: 'auto', - }, - }, - input: { - paddingBottom: '16px', - }, - list: { - scrollbarWidth: 'none', - }, - error: { - backgroundColor: theme.palette.maskColor.bottom, - fontSize: 14, - color: theme.palette.maskColor.danger, - }, -})) - export interface MaskFixedSizeListProps extends FixedSizeListProps {} diff --git a/packages/web3-hooks/base/src/useFungibleToken.ts b/packages/web3-hooks/base/src/useFungibleToken.ts index 576afa88c9b3..5923e31df59c 100644 --- a/packages/web3-hooks/base/src/useFungibleToken.ts +++ b/packages/web3-hooks/base/src/useFungibleToken.ts @@ -1,11 +1,11 @@ import { NetworkPluginID } from '@masknet/shared-base' import type { Web3Helper } from '@masknet/web3-helpers' +import { getHub } from '@masknet/web3-providers' import type { HubOptions } from '@masknet/web3-providers/types' import { attemptUntil } from '@masknet/web3-shared-base' -import { useQuery } from '@tanstack/react-query' -import { useWeb3Hub } from './useWeb3Hub.js' -import { useChainContext } from './useContext.js' import { isNativeTokenAddress } from '@masknet/web3-shared-evm' +import { useQuery } from '@tanstack/react-query' +import { useChainContext, useNetworkContext } from './useContext.js' import { useNetworks } from './useNetworks.js' export function useFungibleToken( @@ -15,26 +15,28 @@ export function useFungibleToken, ) { const { chainId } = useChainContext({ chainId: options?.chainId }) - const Hub = useWeb3Hub(pluginID, { - chainId, - ...options, - } as HubOptions) - const networks = useNetworks(pluginID) + const { pluginID: contextPluginID } = useNetworkContext(pluginID) + const networks = useNetworks(contextPluginID) return useQuery({ enabled: !!address, - // eslint-disable-next-line @tanstack/query/exhaustive-deps - queryKey: ['fungible-token', pluginID, address, chainId, options], + queryKey: ['fungible-token', contextPluginID, address, chainId, options], queryFn: async () => { return attemptUntil( [ async () => { - if (pluginID !== NetworkPluginID.PLUGIN_EVM || !isNativeTokenAddress(address!) || !chainId) + if ( + contextPluginID !== NetworkPluginID.PLUGIN_EVM || + !isNativeTokenAddress(address!) || + !chainId + ) return const network = networks.find((x) => x.chainId === chainId) return network?.nativeCurrency }, async () => { + if (!contextPluginID) return + const Hub = getHub(contextPluginID, options) const token = await Hub.getFungibleToken(address!, { chainId }) if (!token) return const logoURL = token.logoURL ?? fallbackToken?.logoURL @@ -43,8 +45,11 @@ export function useFungibleToken }, ], - fallbackToken, + undefined, ) }, + select(data) { + return data || fallbackToken + }, }) } diff --git a/packages/web3-hooks/base/src/useFungibleTokensBalance.ts b/packages/web3-hooks/base/src/useFungibleTokensBalance.ts index 5dba342a5159..52d8a2bcdd9d 100644 --- a/packages/web3-hooks/base/src/useFungibleTokensBalance.ts +++ b/packages/web3-hooks/base/src/useFungibleTokensBalance.ts @@ -1,7 +1,7 @@ -import { useAsyncRetry } from 'react-use' import { EMPTY_OBJECT, type NetworkPluginID } from '@masknet/shared-base' +import { useWeb3Connection } from '@masknet/web3-hooks-base' import type { ConnectionOptions } from '@masknet/web3-providers/types' -import { useWeb3Connection } from './useWeb3Connection.js' +import { useAsyncRetry } from 'react-use' export function useFungibleTokensBalance( pluginID?: T, diff --git a/packages/web3-hooks/base/src/useFungibleTokensFromTokenList.ts b/packages/web3-hooks/base/src/useFungibleTokensFromTokenList.ts index b7535c1d69ad..64b3af598e32 100644 --- a/packages/web3-hooks/base/src/useFungibleTokensFromTokenList.ts +++ b/packages/web3-hooks/base/src/useFungibleTokensFromTokenList.ts @@ -15,7 +15,7 @@ export function useFungibleTokensFromTokenList) return useQuery({ - queryKey: ['get-fungible-tokens', 'from-token-list', chainId], + queryKey: ['get-fungible-tokens', 'from-token-list', chainId, options], queryFn: async () => { return Hub.getFungibleTokensFromTokenList(chainId, { chainId }) }, diff --git a/packages/web3-providers/package.json b/packages/web3-providers/package.json index 38bb6bd4afeb..844cc9bd03b8 100644 --- a/packages/web3-providers/package.json +++ b/packages/web3-providers/package.json @@ -53,11 +53,10 @@ "@masknet/web3-telemetry": "workspace:^", "@metamask/eth-sig-util": "^7.0.2", "@metaplex-foundation/mpl-token-metadata": "^1.1.0", - "@metaplex/js": "^4.11.7", "@project-serum/sol-wallet-adapter": "^0.2.6", "@servie/events": "^3.0.0", "@solana/buffer-layout": "^4.0.1", - "@solana/spl-token": "^0.1.8", + "@solana/spl-token": "^0.4.9", "@solana/web3.js": "^1.75.0", "@walletconnect/sign-client": "^2.10.5", "@walletconnect/utils": "^2.10.5", diff --git a/packages/web3-providers/src/Web3/Solana/apis/ConnectionAPI.ts b/packages/web3-providers/src/Web3/Solana/apis/ConnectionAPI.ts index 5890e6d41074..64c3d6694504 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/ConnectionAPI.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/ConnectionAPI.ts @@ -3,7 +3,6 @@ import { ChainId, SchemaType, type Signature, - type Transaction, type TransactionDetailed, type TransactionReceipt, type Block, @@ -14,6 +13,7 @@ import { type TransactionSignature, type ProviderType, type Operation, + type Transaction, } from '@masknet/web3-shared-solana' import { TransactionStatusType, @@ -365,11 +365,17 @@ export class SolanaConnectionAPI async sendTransaction(transaction: Transaction, initial?: SolanaConnectionOptions) { const signedTransaction = await this.signTransaction(transaction) - return SolanaWeb3.sendAndConfirmRawTransaction(this.Web3.getConnection(initial), signedTransaction.serialize()) + return SolanaWeb3.sendAndConfirmRawTransaction( + this.Web3.getConnection(initial), + signedTransaction.message.serialize() as Buffer, + ) } sendSignedTransaction(signature: TransactionSignature, initial?: SolanaConnectionOptions): Promise { - return SolanaWeb3.sendAndConfirmRawTransaction(this.Web3.getConnection(initial), signature.serialize()) + return SolanaWeb3.sendAndConfirmRawTransaction( + this.Web3.getConnection(initial), + signature.message.serialize() as Buffer, + ) } replaceTransaction(hash: string, config: Transaction, options?: SolanaConnectionOptions): Promise { diff --git a/packages/web3-providers/src/Web3/Solana/apis/ConnectionOptionsAPI.ts b/packages/web3-providers/src/Web3/Solana/apis/ConnectionOptionsAPI.ts index 2dfe2d41e173..86c7ddae72b5 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/ConnectionOptionsAPI.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/ConnectionOptionsAPI.ts @@ -1,10 +1,10 @@ -import { getDefaultChainId, getDefaultProviderType, isValidChainId } from '@masknet/web3-shared-solana' -import type { ChainId, ProviderType, NetworkType, Transaction } from '@masknet/web3-shared-solana' -import { ConnectionOptionsProvider } from '../../Base/apis/ConnectionOptions.js' import { NetworkPluginID } from '@masknet/shared-base' +import type { ChainId, NetworkType, ProviderType, Transaction } from '@masknet/web3-shared-solana' +import { getDefaultChainId, getDefaultProviderType, isValidChainId } from '@masknet/web3-shared-solana' +import { solana } from '../../../Manager/registry.js' import { createConnectionCreator } from '../../Base/apis/ConnectionCreator.js' +import { ConnectionOptionsProvider } from '../../Base/apis/ConnectionOptions.js' import { SolanaConnectionAPI } from './ConnectionAPI.js' -import { solana } from '../../../Manager/registry.js' export class SolanaConnectionOptionsAPI extends ConnectionOptionsProvider< ChainId, diff --git a/packages/web3-providers/src/Web3/Solana/apis/FungibleTokenAPI.ts b/packages/web3-providers/src/Web3/Solana/apis/FungibleTokenAPI.ts index 3f4066ad3c35..e73463a50deb 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/FungibleTokenAPI.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/FungibleTokenAPI.ts @@ -1,6 +1,13 @@ import { memoize, uniqBy } from 'lodash-es' import { memoizePromise } from '@masknet/kit' -import { type PageIndicator, type Pageable, createPageable, createIndicator, EMPTY_LIST } from '@masknet/shared-base' +import { + type PageIndicator, + type Pageable, + createPageable, + createIndicator, + EMPTY_LIST, + NetworkPluginID, +} from '@masknet/shared-base' import { type FungibleAsset, TokenType, @@ -19,44 +26,80 @@ import { } from '@masknet/web3-shared-solana' import { SolanaChainResolver } from './ResolverAPI.js' import * as CoinGeckoPriceSolana from /* webpackDefer: true */ '../../../CoinGecko/index.js' -import { RAYDIUM_TOKEN_LIST, SPL_TOKEN_PROGRAM_ID } from '../constants/index.js' +import { JUP_TOKEN_LIST, RAYDIUM_TOKEN_LIST, SPL_TOKEN_PROGRAM_ID } from '../constants/index.js' import { createFungibleAsset, createFungibleToken, requestRPC } from '../helpers/index.js' import type { GetBalanceResponse, GetProgramAccountsResponse, - RaydiumTokenList, MaskToken, + RaydiumTokenList, SolanaHubOptions, } from '../types/index.js' import { fetchJSON } from '../../../helpers/fetchJSON.js' import type { FungibleTokenAPI, TokenListAPI } from '../../../entry-types.js' +interface JupToken { + address: string + name: string + symbol: string + decimals: number + logoURI: string + tags: string[] + daily_volume: number + /** @example '2024-04-26T10:56:58.893768Z' */ + created_at: string + freeze_authority: null + mint_authority: null + permanent_delegate: null + minted_at: null +} + const fetchRaydiumTokenList = memoizePromise( memoize, async (url: string): Promise>> => { const tokenList = await fetchJSON(url, { cache: 'force-cache' }) - const tokens: Array> = [...tokenList.official, ...tokenList.unOfficial].map( - (token) => { - if (isSameAddress(token.mint, '11111111111111111111111111111111')) - return SolanaChainResolver.nativeCurrency(ChainId.Mainnet) - return { - id: token.mint, - chainId: ChainId.Mainnet, - type: TokenType.Fungible, - schema: SchemaType.Fungible, - address: token.mint, - name: token.name, - symbol: token.symbol, - decimals: token.decimals, - logoURL: token.icon, - } - }, - ) + const tokens: Array> = tokenList.data.mintList.map((token) => { + if (isSameAddress(token.address, '11111111111111111111111111111111')) + return SolanaChainResolver.nativeCurrency(ChainId.Mainnet) + return { + id: token.address, + chainId: ChainId.Mainnet, + type: TokenType.Fungible, + schema: SchemaType.Fungible, + address: token.address, + name: token.name, + symbol: token.symbol, + decimals: token.decimals, + logoURL: token.logoURI, + } + }) return tokens }, (url) => url, ) +const fetchJupTokenList = memoizePromise( + memoize, + async (url: string): Promise>> => { + const tokens = await fetchJSON(url, { + cache: 'force-cache', + }) + return tokens.map((token) => ({ + id: token.address, + runtime: NetworkPluginID.PLUGIN_SOLANA, + chainId: ChainId.Mainnet, + type: TokenType.Fungible, + schema: SchemaType.Fungible, + address: token.address, + name: token.name, + symbol: token.symbol, + decimals: token.decimals, + logoURL: token.logoURI, + })) + }, + (url) => url, +) + const fetchMaskTokenList = memoizePromise( memoize, async (url: string): Promise>> => { @@ -167,10 +210,15 @@ class SolanaFungibleTokenAPI async getFungibleTokenList(chainId: ChainId, urls?: string[]): Promise>> { if (chainId !== ChainId.Mainnet) return EMPTY_LIST const { FUNGIBLE_TOKEN_LISTS = EMPTY_LIST } = getTokenListConstants(chainId) - const maskTokenList = await fetchMaskTokenList(FUNGIBLE_TOKEN_LISTS[0]) - const raydiumTokenList = await fetchRaydiumTokenList(RAYDIUM_TOKEN_LIST) + const [maskTokenList, jupTokenList, raydiumTokenList] = await Promise.all([ + fetchMaskTokenList(FUNGIBLE_TOKEN_LISTS[0]), + fetchJupTokenList(JUP_TOKEN_LIST), + fetchRaydiumTokenList(RAYDIUM_TOKEN_LIST), + ]) - return uniqBy([...maskTokenList, ...raydiumTokenList], (x) => x.address).filter((x) => x.name && x.symbol) + return uniqBy([...jupTokenList, ...maskTokenList, ...raydiumTokenList], (x) => x.address).filter( + (x) => x.name && x.symbol, + ) } async getNonFungibleTokenList( diff --git a/packages/web3-providers/src/Web3/Solana/apis/NonFungibleTokenAPI.ts b/packages/web3-providers/src/Web3/Solana/apis/NonFungibleTokenAPI.ts index 171a7d97dcb5..c859f3566016 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/NonFungibleTokenAPI.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/NonFungibleTokenAPI.ts @@ -1,5 +1,5 @@ // cspell:ignore metaplex -import { Connection } from '@metaplex/js' +import * as SolanaWeb3 from /* webpackDefer: true */ '@solana/web3.js' import { Metadata } from '@metaplex-foundation/mpl-token-metadata' import { EMPTY_LIST, createIndicator, createPageable, type Pageable } from '@masknet/shared-base' import { type NonFungibleAsset, TokenType } from '@masknet/web3-shared-base' @@ -54,7 +54,7 @@ async function getNonFungibleAssets( ], }) if (!data.result?.length) return EMPTY_LIST - const connection = new Connection('mainnet-beta') + const connection = new SolanaWeb3.Connection('mainnet-beta') const nftTokens = data.result.filter((x) => x.account.data.parsed.info.tokenAmount.decimals === 0) const promises = nftTokens.map(async (x): Promise | null> => { const pda = await Metadata.getPDA(x.account.data.parsed.info.mint) diff --git a/packages/web3-providers/src/Web3/Solana/apis/TransferAPI.ts b/packages/web3-providers/src/Web3/Solana/apis/TransferAPI.ts index feabf6e83e66..f8f694dee773 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/TransferAPI.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/TransferAPI.ts @@ -4,6 +4,7 @@ import { createTransferInstruction } from './spl-token/createTransferInstruction import { SolanaWeb3API } from './Web3API.js' import { SolanaConnectionOptionsAPI } from './ConnectionOptionsAPI.js' import type { SolanaConnectionOptions } from '../types/index.js' +import type { Transaction } from '@masknet/web3-shared-solana' export class SolanaTransferAPI { constructor(private options?: SolanaConnectionOptions) { @@ -12,20 +13,17 @@ export class SolanaTransferAPI { } private Web3 private ConnectionOptions - private async attachRecentBlockHash(transaction: SolanaWeb3.Transaction, initial?: SolanaConnectionOptions) { - const connection = this.Web3.getConnection(initial) - const blockHash = await connection.getRecentBlockhash() - transaction.recentBlockhash = blockHash.blockhash - return transaction - } - private async signTransaction(transaction: SolanaWeb3.Transaction, initial?: SolanaConnectionOptions) { + private async signTransaction(transaction: Transaction, initial?: SolanaConnectionOptions) { return this.Web3.getProviderInstance(initial).signTransaction(transaction) } - private async sendTransaction(transaction: SolanaWeb3.Transaction, initial?: SolanaConnectionOptions) { + private async sendTransaction(transaction: Transaction, initial?: SolanaConnectionOptions) { const signedTransaction = await this.signTransaction(transaction) - return SolanaWeb3.sendAndConfirmRawTransaction(this.Web3.getConnection(initial), signedTransaction.serialize()) + return SolanaWeb3.sendAndConfirmRawTransaction( + this.Web3.getConnection(initial), + signedTransaction.serialize() as Buffer, + ) } async transferSol(recipient: string, amount: string, initial?: SolanaConnectionOptions) { @@ -33,15 +31,19 @@ export class SolanaTransferAPI { if (!options.account) throw new Error('No payer provides.') const payerPubkey = new SolanaWeb3.PublicKey(options.account) const recipientPubkey = new SolanaWeb3.PublicKey(recipient) - const transaction = new SolanaWeb3.Transaction().add( - SolanaWeb3.SystemProgram.transfer({ - fromPubkey: payerPubkey, - toPubkey: recipientPubkey, - lamports: Number.parseInt(amount, 10), - }), - ) - transaction.feePayer = payerPubkey - await this.attachRecentBlockHash(transaction) + const blockHash = await this.Web3.getConnection(initial).getLatestBlockhash() + const message = new SolanaWeb3.TransactionMessage({ + payerKey: payerPubkey, + recentBlockhash: blockHash.blockhash, + instructions: [ + SolanaWeb3.SystemProgram.transfer({ + fromPubkey: payerPubkey, + toPubkey: recipientPubkey, + lamports: Number.parseInt(amount, 10), + }), + ], + }).compileToV0Message() + const transaction = new SolanaWeb3.VersionedTransaction(message) return this.sendTransaction(transaction) } @@ -73,17 +75,20 @@ export class SolanaTransferAPI { recipientPubkey, signTransaction, ) - const transaction = new SolanaWeb3.Transaction().add( - createTransferInstruction( - formatTokenAccount.address, - toTokenAccount.address, - payerPubkey, - Number.parseInt(amount, 10), - ), + const instruction = createTransferInstruction( + formatTokenAccount.address, + toTokenAccount.address, + payerPubkey, + Number.parseInt(amount, 10), ) - const blockHash = await connection.getLatestBlockhash() - transaction.feePayer = payerPubkey - transaction.recentBlockhash = blockHash.blockhash - return this.sendTransaction(transaction) + + const blockHash = await this.Web3.getConnection(initial).getLatestBlockhash() + const message = new SolanaWeb3.TransactionMessage({ + payerKey: payerPubkey, + recentBlockhash: blockHash.blockhash, + instructions: [instruction], + }).compileToV0Message() + const tx = new SolanaWeb3.VersionedTransaction(message) + return this.sendTransaction(tx) } } diff --git a/packages/web3-providers/src/Web3/Solana/apis/spl-token/getAccountInfo.ts b/packages/web3-providers/src/Web3/Solana/apis/spl-token/getAccountInfo.ts index ac482e368756..b8d05f66e3e3 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/spl-token/getAccountInfo.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/spl-token/getAccountInfo.ts @@ -1,5 +1,6 @@ import { TOKEN_PROGRAM_ID, AccountLayout } from '@solana/spl-token' -import type { Connection, PublicKey, Commitment } from '@solana/web3.js' +import * as SolanaWeb3 from /* webpackDefer: true */ '@solana/web3.js' +import type { Connection, Commitment } from '@solana/web3.js' enum AccountState { Uninitialized = 0, @@ -9,7 +10,7 @@ enum AccountState { export async function getAccountInfo( connection: Connection, - address: PublicKey, + address: SolanaWeb3.PublicKey, commitment?: Commitment, programId = TOKEN_PROGRAM_ID, ) { @@ -22,8 +23,8 @@ export async function getAccountInfo( return { address, - mint: rawAccount.mint, - owner: rawAccount.owner, + mint: new SolanaWeb3.PublicKey(rawAccount.mint), + owner: new SolanaWeb3.PublicKey(rawAccount.owner), amount: rawAccount.amount, delegate: rawAccount.delegateOption ? rawAccount.delegate : null, delegatedAmount: rawAccount.delegatedAmount, diff --git a/packages/web3-providers/src/Web3/Solana/apis/spl-token/getOrCreateAssociatedTokenAccount.ts b/packages/web3-providers/src/Web3/Solana/apis/spl-token/getOrCreateAssociatedTokenAccount.ts index 9f09e9e610b1..8418e045c601 100644 --- a/packages/web3-providers/src/Web3/Solana/apis/spl-token/getOrCreateAssociatedTokenAccount.ts +++ b/packages/web3-providers/src/Web3/Solana/apis/spl-token/getOrCreateAssociatedTokenAccount.ts @@ -1,6 +1,7 @@ -import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token' +import type { Transaction } from '@masknet/web3-shared-solana' +import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token' +import type { Commitment, Connection, PublicKey } from '@solana/web3.js' import * as SolanaWeb3 from /* webpackDefer: true */ '@solana/web3.js' -import type { Connection, PublicKey, Commitment } from '@solana/web3.js' import { createAssociatedTokenAccountInstruction } from './createAssociatedTokenAccountInstruction.js' import { getAccountInfo } from './getAccountInfo.js' import { getAssociatedTokenAddress } from './getAssociatedTokenAddress.js' @@ -10,7 +11,7 @@ export async function getOrCreateAssociatedTokenAccount( payer: PublicKey, mint: PublicKey, owner: PublicKey, - signTransaction: (tx: SolanaWeb3.Transaction) => Promise, + signTransaction: (tx: Transaction) => Promise, allowOwnerOffCurve = false, commitment: Commitment = 'single', programId = TOKEN_PROGRAM_ID, @@ -36,21 +37,26 @@ export async function getOrCreateAssociatedTokenAccount( if (error.message === 'TokenAccountNotFoundError' || error.message === 'TokenInvalidAccountOwnerError') { // As this isn't atomic, it's possible others can create associated accounts meanwhile. try { - const transaction = new SolanaWeb3.Transaction().add( - createAssociatedTokenAccountInstruction( - payer, - associatedToken, - owner, - mint, - programId, - associatedTokenProgramId, - ), + const instruction = createAssociatedTokenAccountInstruction( + payer, + associatedToken, + owner, + mint, + programId, + associatedTokenProgramId, ) - const blockHash = await connection.getLatestBlockhash() + const transaction = new SolanaWeb3.Transaction().add(instruction) + const message = new SolanaWeb3.TransactionMessage({ + payerKey: payer, + recentBlockhash: blockHash.blockhash, + instructions: [instruction], + }).compileToV0Message() + const tx = new SolanaWeb3.VersionedTransaction(message) + transaction.feePayer = payer transaction.recentBlockhash = blockHash.blockhash - const signed = await signTransaction(transaction) + const signed = await signTransaction(tx) const signature = await connection.sendRawTransaction(signed.serialize()) @@ -71,8 +77,8 @@ export async function getOrCreateAssociatedTokenAccount( } } - if (!account.mint.equals(mint.toBuffer())) throw new Error('TokenInvalidMintError') - if (!account.owner.equals(owner.toBuffer())) throw new Error('TokenInvalidOwnerError') + if (!account.mint.equals(mint)) throw new Error('TokenInvalidMintError') + if (!account.owner.equals(owner)) throw new Error('TokenInvalidOwnerError') return account } diff --git a/packages/web3-providers/src/Web3/Solana/constants/index.ts b/packages/web3-providers/src/Web3/Solana/constants/index.ts index a3db5c08bed3..4c155f2dfebb 100644 --- a/packages/web3-providers/src/Web3/Solana/constants/index.ts +++ b/packages/web3-providers/src/Web3/Solana/constants/index.ts @@ -1,4 +1,5 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token' -export const RAYDIUM_TOKEN_LIST = 'https://api.raydium.io/v2/sdk/token/raydium.mainnet.json' +export const RAYDIUM_TOKEN_LIST = 'https://api-v3.raydium.io/mint/list' +export const JUP_TOKEN_LIST = 'https://tokens.jup.ag/tokens?tags=verified' export const SPL_TOKEN_PROGRAM_ID = TOKEN_PROGRAM_ID.toBase58() diff --git a/packages/web3-providers/src/Web3/Solana/providers/Base.ts b/packages/web3-providers/src/Web3/Solana/providers/Base.ts index acfe78f301cb..7d8c3c1ef5a8 100644 --- a/packages/web3-providers/src/Web3/Solana/providers/Base.ts +++ b/packages/web3-providers/src/Web3/Solana/providers/Base.ts @@ -1,7 +1,6 @@ -import type { Transaction } from '@solana/web3.js' +import { EMPTY_LIST, createConstantSubscription, type Account, type Wallet } from '@masknet/shared-base' +import { ChainId, type ProviderType, type Transaction, type Web3, type Web3Provider } from '@masknet/web3-shared-solana' import { Emitter } from '@servie/events' -import { type Account, type Wallet, EMPTY_LIST, createConstantSubscription } from '@masknet/shared-base' -import { ChainId, type ProviderType, type Web3, type Web3Provider } from '@masknet/web3-shared-solana' import type { WalletAPI } from '../../../entry-types.js' import type { SolanaWalletProvider } from './index.js' diff --git a/packages/web3-providers/src/Web3/Solana/providers/Coin98.ts b/packages/web3-providers/src/Web3/Solana/providers/Coin98.ts index 810d862f07c6..dc9f6fee58f9 100644 --- a/packages/web3-providers/src/Web3/Solana/providers/Coin98.ts +++ b/packages/web3-providers/src/Web3/Solana/providers/Coin98.ts @@ -1,8 +1,7 @@ import { first } from 'lodash-es' -import type { Transaction } from '@solana/web3.js' import { injectedCoin98SolanaProvider } from '@masknet/injected-script' import type { Account } from '@masknet/shared-base' -import { type ChainId, Coin98MethodType, ProviderType } from '@masknet/web3-shared-solana' +import { type ChainId, Coin98MethodType, ProviderType, type Transaction } from '@masknet/web3-shared-solana' import { SolanaInjectedWalletProvider } from './BaseInjected.js' export class SolanaCoin98Provider extends SolanaInjectedWalletProvider { diff --git a/packages/web3-providers/src/Web3/Solana/providers/Phantom.ts b/packages/web3-providers/src/Web3/Solana/providers/Phantom.ts index 10136667b0e1..72974b638387 100644 --- a/packages/web3-providers/src/Web3/Solana/providers/Phantom.ts +++ b/packages/web3-providers/src/Web3/Solana/providers/Phantom.ts @@ -1,8 +1,7 @@ -import bs58 from 'bs58' -import * as SolanaWeb3 from /* webpackDefer: true */ '@solana/web3.js' -import type { Transaction } from '@solana/web3.js' import { injectedPhantomProvider } from '@masknet/injected-script' -import { PhantomMethodType, ProviderType, type Web3Provider } from '@masknet/web3-shared-solana' +import { PhantomMethodType, ProviderType, type Transaction, type Web3Provider } from '@masknet/web3-shared-solana' +import * as SolanaWeb3 from /* webpackDefer: true */ '@solana/web3.js' +import bs58 from 'bs58' import { SolanaInjectedWalletProvider } from './BaseInjected.js' export class SolanaPhantomProvider extends SolanaInjectedWalletProvider { @@ -36,18 +35,21 @@ export class SolanaPhantomProvider extends SolanaInjectedWalletProvider { override async signTransaction(transaction: Transaction) { await this.validateSession() - const { publicKey, signature } = await this.bridge.request<{ - publicKey: string - signature: string + const result = await this.bridge.request<{ + message: SolanaWeb3.MessageV0 + signatures: Uint8Array[] }>({ method: PhantomMethodType.SIGN_TRANSACTION, params: { - message: bs58.encode(transaction.serializeMessage()), + message: bs58.encode(transaction.serialize()), }, }) - - transaction.addSignature(new SolanaWeb3.PublicKey(publicKey), Buffer.from(bs58.decode(signature))) - return transaction + const msg = new SolanaWeb3.MessageV0({ + ...result.message, + staticAccountKeys: result.message.staticAccountKeys.map((x) => new SolanaWeb3.PublicKey(x)), + }) + const message = SolanaWeb3.VersionedMessage.deserialize(msg.serialize()) + return new SolanaWeb3.VersionedTransaction(message, result.signatures) } override async signTransactions(transactions: Transaction[]) { @@ -56,7 +58,7 @@ export class SolanaPhantomProvider extends SolanaInjectedWalletProvider { method: 'signAllTransactions', params: { message: transactions.map((transaction) => { - return bs58.encode(transaction.serializeMessage()) + return bs58.encode(transaction.message.serialize()) }), }, }) diff --git a/packages/web3-providers/src/Web3/Solana/providers/SolflareProvider.ts b/packages/web3-providers/src/Web3/Solana/providers/SolflareProvider.ts index 0b7fadd76724..dd96e1b5848a 100644 --- a/packages/web3-providers/src/Web3/Solana/providers/SolflareProvider.ts +++ b/packages/web3-providers/src/Web3/Solana/providers/SolflareProvider.ts @@ -1,6 +1,5 @@ -import type { Transaction } from '@solana/web3.js' import { injectedSolflareProvider } from '@masknet/injected-script' -import { PhantomMethodType, ProviderType } from '@masknet/web3-shared-solana' +import { PhantomMethodType, ProviderType, type Transaction } from '@masknet/web3-shared-solana' import { SolanaInjectedWalletProvider } from './BaseInjected.js' export class SolanaSolflareProvider extends SolanaInjectedWalletProvider { diff --git a/packages/web3-providers/src/Web3/Solana/providers/Sollet.ts b/packages/web3-providers/src/Web3/Solana/providers/Sollet.ts deleted file mode 100644 index eb0c53a32abe..000000000000 --- a/packages/web3-providers/src/Web3/Solana/providers/Sollet.ts +++ /dev/null @@ -1,49 +0,0 @@ -import base58 from 'bs58' -import type { Transaction } from '@solana/web3.js' -import * as Wallet from /* webpackDefer: true */ '@project-serum/sol-wallet-adapter' -import { type ChainId, ProviderType } from '@masknet/web3-shared-solana' -import { BaseSolanaWalletProvider } from './Base.js' - -export class SolanaSolletProvider extends BaseSolanaWalletProvider { - private wallet: Wallet.default | null = null - private providerURL = 'https://www.sollet.io' - private get solanaProvider() { - if (!this.wallet) throw new Error('No sollet connection.') - return this.wallet - } - private set solanaProvider(newWallet: Wallet.default) { - this.wallet = newWallet - } - - override async signMessage(message: string) { - const data = new TextEncoder().encode(message) - const { signature } = await this.solanaProvider.sign(data, 'uft8') - return base58.encode(signature) - } - - override signTransaction(transaction: Transaction) { - return this.solanaProvider.signTransaction(transaction) - } - - override signTransactions(transactions: Transaction[]) { - return this.solanaProvider.signAllTransactions(transactions) - } - - override async connect(chainId: ChainId) { - this.solanaProvider = new Wallet.default(this.providerURL, '') - await this.solanaProvider.connect() - return { - chainId, - account: this.solanaProvider.publicKey?.toBase58() ?? '', - } - } - - override async disconnect() { - this.solanaProvider = new Wallet.default(this.providerURL, '') - await this.solanaProvider.disconnect() - this.emitter.emit('disconnect', ProviderType.Sollet) - - // clean the internal wallet - this.wallet = null - } -} diff --git a/packages/web3-providers/src/Web3/Solana/providers/index.ts b/packages/web3-providers/src/Web3/Solana/providers/index.ts index d970c98db580..3f5893e01378 100644 --- a/packages/web3-providers/src/Web3/Solana/providers/index.ts +++ b/packages/web3-providers/src/Web3/Solana/providers/index.ts @@ -1,10 +1,9 @@ import { ProviderType, type ChainId, type Transaction } from '@masknet/web3-shared-solana' -import { SolanaPhantomProvider } from './Phantom.js' +import type { WalletAPI } from '../../../entry-types.js' +import { SolanaCoin98Provider } from './Coin98.js' import { NoneProvider } from './None.js' +import { SolanaPhantomProvider } from './Phantom.js' import { SolanaSolflareProvider } from './SolflareProvider.js' -import { SolanaSolletProvider } from './Sollet.js' -import { SolanaCoin98Provider } from './Coin98.js' -import type { WalletAPI } from '../../../entry-types.js' export interface SolanaWalletProvider extends WalletAPI.Provider { /** Sign message */ @@ -21,7 +20,6 @@ export function createSolanaWalletProviders(): Record export type GetProgramAccountsResponse = RpcResponse -interface SplToken { - symbol: string +export interface MaskToken { + address: string name: string - mint: string - decimals: 3 - icon: string + symbol: string + logoURI: string + originLogoURI: string + decimals: number } -export interface RaydiumTokenList { +interface RaydiumToken { + address: string + chainId: number + decimals: number + logoURI: string name: string - timestamp: string - version: { - major: number - minor: number - patch: number - } - official: SplToken[] - unOfficial: SplToken[] + programId: string + symbol: string } -export interface MaskToken { +export interface JupToken { address: string + created_at: string + daily_volume: number + decimals: number + logoURI: string name: string symbol: string - logoURI: string - originLogoURI: string - decimals: number +} + +export interface RaydiumTokenList { + data: { + mintList: RaydiumToken[] + } + id: string + success: boolean } diff --git a/packages/web3-shared/base/src/specs/index.ts b/packages/web3-shared/base/src/specs/index.ts index f1837d63c4e4..c409af926172 100644 --- a/packages/web3-shared/base/src/specs/index.ts +++ b/packages/web3-shared/base/src/specs/index.ts @@ -300,6 +300,8 @@ export interface Token { type: TokenType schema: SchemaType address: string + /** It's newly added, keep it optional */ + runtime?: NetworkPluginID /** NFT has tokenId */ tokenId?: string /** Added by user */ diff --git a/packages/web3-shared/solana/src/constants/descriptors.ts b/packages/web3-shared/solana/src/constants/descriptors.ts index 6df9a319cca5..d0b7723e2022 100644 --- a/packages/web3-shared/solana/src/constants/descriptors.ts +++ b/packages/web3-shared/solana/src/constants/descriptors.ts @@ -1,4 +1,4 @@ -import { EnhanceableSiteList, ExtensionSiteList, NetworkPluginID } from '@masknet/shared-base' +import { EnhanceableSiteList, NetworkPluginID } from '@masknet/shared-base' import { type ChainDescriptor, createFungibleToken, @@ -176,19 +176,4 @@ export const PROVIDER_DESCRIPTORS: ReadonlyArray=16.0.0'} - '@metaplex-foundation/mpl-auction@0.0.2': - resolution: {integrity: sha512-4UDDi8OiQr+D6KrCNTRrqf/iDD6vi5kzRtMRtuNpywTyhX9hnbr1Zkc6Ncncbh9GZhbhcn+/h5wHgzh+xA6TnQ==} - '@metaplex-foundation/mpl-core@0.0.2': resolution: {integrity: sha512-UUJ4BlYiWdDegAWmjsNQiNehwYU3QfSFWs3sv4VX0J6/ZrQ28zqosGhQ+I2ZCTEy216finJ82sZWNjuwSWCYyQ==} deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. - '@metaplex-foundation/mpl-metaplex@0.0.5': - resolution: {integrity: sha512-VRt3fiO/7/jcHwN+gWvTtpp+7wYhIcEDzMG1lOeV3yYyhz9fAT0E3LqEl2moifNTAopGCE4zYa84JA/OW+1YvA==} - - '@metaplex-foundation/mpl-token-metadata@0.0.2': - resolution: {integrity: sha512-yKJPhFlX8MkNbSCi1iwHn4xKmguLK/xFhYa+RuYdL2seuT4CKXHj2CnR2AkcdQj46Za4/nR3jZcRFKq7QlnvBw==} - '@metaplex-foundation/mpl-token-metadata@1.1.0': resolution: {integrity: sha512-4tF+hO5H6eYJ49H72nvuID2nrD54X4yCxqKhbWLxqAI7v5vHSCH2QFVUnqbj3+P4ydxrNyof9MQm3qlzY8KU3g==} - '@metaplex-foundation/mpl-token-vault@0.0.2': - resolution: {integrity: sha512-JiVcow8OzUGW0KTs/E1QrAdmYGqE9EGKE6cc2gxNNBYqDeVdjYlgEa64IiGvNF9rvbI2g2Z3jw0mYuA9LD9S/A==} - - '@metaplex/js@4.11.7': - resolution: {integrity: sha512-/8X04VEHMfWF84H2DZwLY3yg0xq75vgt/VtLuChTm8iUHkj99Whnq0NLTe0OqfhiEV0qFvT5dbLFh7x2CZqrEQ==} - deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. - peerDependencies: - '@metaplex-foundation/mpl-auction': ^0.0.2 - '@metaplex-foundation/mpl-core': ^0.0.2 - '@metaplex-foundation/mpl-metaplex': ^0.0.5 - '@metaplex-foundation/mpl-token-metadata': ^0.0.2 - '@metaplex-foundation/mpl-token-vault': ^0.0.2 - '@solana/spl-token': ^0.1.8 - '@solana/web3.js': ^1.30.2 - '@module-federation/runtime-tools@0.5.1': resolution: {integrity: sha512-nfBedkoZ3/SWyO0hnmaxuz0R0iGPSikHZOAZ0N/dVSQaIzlffUo35B5nlC2wgWIc0JdMZfkwkjZRrnuuDIJbzg==} @@ -6354,19 +6327,78 @@ packages: engines: {node: '>=8.10'} hasBin: true + '@solana/buffer-layout-utils@0.2.0': + resolution: {integrity: sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==} + engines: {node: '>= 10'} + '@solana/buffer-layout@4.0.1': resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} engines: {node: '>=5.10'} + '@solana/codecs-core@2.0.0-rc.1': + resolution: {integrity: sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-data-structures@2.0.0-rc.1': + resolution: {integrity: sha512-rinCv0RrAVJ9rE/rmaibWJQxMwC5lSaORSZuwjopSUE6T0nb/MVg6Z1siNCXhh/HFTOg0l8bNvZHgBcN/yvXog==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-numbers@2.0.0-rc.1': + resolution: {integrity: sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ==} + peerDependencies: + typescript: '>=5' + + '@solana/codecs-strings@2.0.0-rc.1': + resolution: {integrity: sha512-9/wPhw8TbGRTt6mHC4Zz1RqOnuPTqq1Nb4EyuvpZ39GW6O2t2Q7Q0XxiB3+BdoEjwA2XgPw6e2iRfvYgqty44g==} + peerDependencies: + fastestsmallesttextencoderdecoder: ^1.0.22 + typescript: '>=5' + + '@solana/codecs@2.0.0-rc.1': + resolution: {integrity: sha512-qxoR7VybNJixV51L0G1RD2boZTcxmwUWnKCaJJExQ5qNKwbpSyDdWfFJfM5JhGyKe9DnPVOZB+JHWXnpbZBqrQ==} + peerDependencies: + typescript: '>=5' + + '@solana/errors@2.0.0-rc.1': + resolution: {integrity: sha512-ejNvQ2oJ7+bcFAYWj225lyRkHnixuAeb7RQCixm+5mH4n1IA4Qya/9Bmfy5RAAHQzxK43clu3kZmL5eF9VGtYQ==} + hasBin: true + peerDependencies: + typescript: '>=5' + + '@solana/options@2.0.0-rc.1': + resolution: {integrity: sha512-mLUcR9mZ3qfHlmMnREdIFPf9dpMc/Bl66tLSOOWxw4ml5xMT2ohFn7WGqoKcu/UHkT9CrC6+amEdqCNvUqI7AA==} + peerDependencies: + typescript: '>=5' + + '@solana/spl-token-group@0.0.7': + resolution: {integrity: sha512-V1N/iX7Cr7H0uazWUT2uk27TMqlqedpXHRqqAbVO2gvmJyT0E0ummMEAVQeXZ05ZhQ/xF39DLSdBp90XebWEug==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + + '@solana/spl-token-metadata@0.1.6': + resolution: {integrity: sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + '@solana/spl-token@0.1.8': resolution: {integrity: sha512-LZmYCKcPQDtJgecvWOgT/cnoIQPWjdH+QVyzPcFvyDUiT0DiRjZaam4aqNUyvchLFhzgunv3d9xOoyE34ofdoQ==} engines: {node: '>= 10'} + '@solana/spl-token@0.4.9': + resolution: {integrity: sha512-g3wbj4F4gq82YQlwqhPB0gHFXfgsC6UmyGMxtSLf/BozT/oKd59465DbnlUK8L8EcimKMavxsVAMoLcEdeCicg==} + engines: {node: '>=16'} + peerDependencies: + '@solana/web3.js': ^1.95.3 + '@solana/web3.js@1.75.0': resolution: {integrity: sha512-rHQgdo1EWfb+nPUpHe4O7i8qJPELHKNR5PAZRK+a7XxiykqOfbaAlPt5boDWAGPnYbSv0ziWZv5mq9DlFaQCxg==} - '@solana/web3.js@1.95.5': - resolution: {integrity: sha512-hU9cBrbg1z6gEjLH9vwIckGBVB78Ijm0iZFNk4ocm5OD82piPwuk3MeQ1rfiKD9YQtr95krrcaopb49EmQJlRg==} + '@solana/web3.js@1.98.0': + resolution: {integrity: sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA==} '@splinetool/runtime@0.9.342': resolution: {integrity: sha512-umHOjVbg+7UYPtRLGNAQwwviz631SermH8WzQlGUBpPq1XDwTCcvz1kdNvQvA1NNan+AqnDEUspGhnc4nSp1rg==} @@ -7752,9 +7784,6 @@ packages: axios@0.21.1: resolution: {integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==} - axios@0.25.0: - resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==} - babel-jest@28.1.3: resolution: {integrity: sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} @@ -8650,10 +8679,6 @@ packages: crypto-browserify@3.12.0: resolution: {integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==} - crypto-hash@1.3.0: - resolution: {integrity: sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==} - engines: {node: '>=8'} - crypto-js@4.1.1: resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==} @@ -9884,6 +9909,9 @@ packages: fastest-stable-stringify@2.0.2: resolution: {integrity: sha512-bijHueCGd0LqqNK9b5oCMHc0MluJAx0cwqASgbWMvkO01lCYgIhacVRLcaDz3QnyYIRNJRDwMb41VuT6pHJ91Q==} + fastestsmallesttextencoderdecoder@1.0.22: + resolution: {integrity: sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw==} + fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} @@ -16503,9 +16531,9 @@ snapshots: '@bonfida/name-offers@0.0.1(@solana/buffer-layout@4.0.1)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: - '@bonfida/spl-name-service': 0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@bonfida/spl-name-service': 0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) bn.js: 5.2.1 borsh: 0.6.0 bs58: 4.0.1 @@ -16515,28 +16543,28 @@ snapshots: - encoding - utf-8-validate - '@bonfida/spl-name-service@0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@4.12.0)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@bonfida/spl-name-service@0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@bonfida/name-offers': 0.0.1(@solana/buffer-layout@4.0.1)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@ethersproject/sha2': 5.7.0 '@solana/buffer-layout': 4.0.1 '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - bn.js: 4.12.0 + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + bn.js: 5.2.1 borsh: 0.6.0 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate - '@bonfida/spl-name-service@0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@5.2.1)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@bonfida/spl-name-service@0.1.50(@solana/buffer-layout@4.0.1)(@solana/spl-token@0.4.9(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(encoding@0.1.13)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10))(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bn.js@4.12.0)(borsh@0.6.0)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@bonfida/name-offers': 0.0.1(@solana/buffer-layout@4.0.1)(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@ethersproject/sha2': 5.7.0 '@solana/buffer-layout': 4.0.1 - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - bn.js: 5.2.1 + '@solana/spl-token': 0.4.9(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(encoding@0.1.13)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + bn.js: 4.12.0 borsh: 0.6.0 transitivePeerDependencies: - bufferutil @@ -19122,88 +19150,25 @@ snapshots: transitivePeerDependencies: - supports-color - '@metaplex-foundation/mpl-auction@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': - dependencies: - '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - '@metaplex-foundation/mpl-core@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) bs58: 4.0.1 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate - '@metaplex-foundation/mpl-metaplex@0.0.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': - dependencies: - '@metaplex-foundation/mpl-auction': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-token-metadata': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-token-vault': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - - '@metaplex-foundation/mpl-token-metadata@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': - dependencies: - '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - '@metaplex-foundation/mpl-token-metadata@1.1.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - encoding - utf-8-validate - '@metaplex-foundation/mpl-token-vault@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': - dependencies: - '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - transitivePeerDependencies: - - bufferutil - - encoding - - utf-8-validate - - '@metaplex/js@4.11.7(@metaplex-foundation/mpl-auction@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@metaplex-foundation/mpl-core@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@metaplex-foundation/mpl-metaplex@0.0.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@metaplex-foundation/mpl-token-metadata@1.1.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@metaplex-foundation/mpl-token-vault@0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))': - dependencies: - '@metaplex-foundation/mpl-auction': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-core': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-metaplex': 0.0.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-token-metadata': 1.1.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@metaplex-foundation/mpl-token-vault': 0.0.2(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/spl-token': 0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) - '@types/bs58': 4.0.4 - axios: 0.25.0 - bn.js: 5.2.1 - borsh: 0.4.0 - bs58: 4.0.1 - buffer: 6.0.3 - crypto-hash: 1.3.0 - form-data: 4.0.0 - transitivePeerDependencies: - - debug - '@module-federation/runtime-tools@0.5.1': dependencies: '@module-federation/runtime': 0.5.1 @@ -20496,14 +20461,95 @@ snapshots: ignore: 5.3.2 p-map: 4.0.0 + '@solana/buffer-layout-utils@0.2.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': + dependencies: + '@solana/buffer-layout': 4.0.1 + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + bigint-buffer: 1.1.5 + bignumber.js: 9.1.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + '@solana/buffer-layout@4.0.1': dependencies: buffer: 6.0.3 + '@solana/codecs-core@2.0.0-rc.1(typescript@5.7.2)': + dependencies: + '@solana/errors': 2.0.0-rc.1(typescript@5.7.2) + typescript: 5.7.2 + + '@solana/codecs-data-structures@2.0.0-rc.1(typescript@5.7.2)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.7.2) + '@solana/errors': 2.0.0-rc.1(typescript@5.7.2) + typescript: 5.7.2 + + '@solana/codecs-numbers@2.0.0-rc.1(typescript@5.7.2)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2) + '@solana/errors': 2.0.0-rc.1(typescript@5.7.2) + typescript: 5.7.2 + + '@solana/codecs-strings@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.7.2) + '@solana/errors': 2.0.0-rc.1(typescript@5.7.2) + fastestsmallesttextencoderdecoder: 1.0.22 + typescript: 5.7.2 + + '@solana/codecs@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/options': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + typescript: 5.7.2 + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + + '@solana/errors@2.0.0-rc.1(typescript@5.7.2)': + dependencies: + chalk: 5.3.0 + commander: 12.1.0 + typescript: 5.7.2 + + '@solana/options@2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)': + dependencies: + '@solana/codecs-core': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-data-structures': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-numbers': 2.0.0-rc.1(typescript@5.7.2) + '@solana/codecs-strings': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/errors': 2.0.0-rc.1(typescript@5.7.2) + typescript: 5.7.2 + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + + '@solana/spl-token-group@0.0.7(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)': + dependencies: + '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + - typescript + + '@solana/spl-token-metadata@0.1.6(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)': + dependencies: + '@solana/codecs': 2.0.0-rc.1(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - fastestsmallesttextencoderdecoder + - typescript + '@solana/spl-token@0.1.8(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@babel/runtime': 7.26.0 - '@solana/web3.js': 1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) bn.js: 5.2.1 buffer: 6.0.3 buffer-layout: 1.2.2 @@ -20513,6 +20559,21 @@ snapshots: - encoding - utf-8-validate + '@solana/spl-token@0.4.9(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(bufferutil@4.0.8)(encoding@0.1.13)(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2)(utf-8-validate@5.0.10)': + dependencies: + '@solana/buffer-layout': 4.0.1 + '@solana/buffer-layout-utils': 0.2.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + '@solana/spl-token-group': 0.0.7(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/spl-token-metadata': 0.1.6(@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10))(fastestsmallesttextencoderdecoder@1.0.22)(typescript@5.7.2) + '@solana/web3.js': 1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10) + buffer: 6.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - fastestsmallesttextencoderdecoder + - typescript + - utf-8-validate + '@solana/web3.js@1.75.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@babel/runtime': 7.26.0 @@ -20536,7 +20597,7 @@ snapshots: - encoding - utf-8-validate - '@solana/web3.js@1.95.5(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': + '@solana/web3.js@1.98.0(bufferutil@4.0.8)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@babel/runtime': 7.26.0 '@noble/curves': 1.7.0 @@ -22666,12 +22727,6 @@ snapshots: transitivePeerDependencies: - debug - axios@0.25.0: - dependencies: - follow-redirects: 1.15.9 - transitivePeerDependencies: - - debug - babel-jest@28.1.3(@babel/core@7.26.0): dependencies: '@babel/core': 7.26.0 @@ -23691,8 +23746,6 @@ snapshots: randombytes: 2.1.0 randomfill: 1.0.4 - crypto-hash@1.3.0: {} - crypto-js@4.1.1: {} crypto-js@4.2.0: {} @@ -25468,6 +25521,8 @@ snapshots: fastest-stable-stringify@2.0.2: {} + fastestsmallesttextencoderdecoder@1.0.22: {} + fastq@1.17.1: dependencies: reusify: 1.0.4