@aurora-is-near/intents-swap-widget 3.18.3 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AllNetworksIcon.js +11 -0
- package/dist/components/AllNetworksIcon.js.map +1 -0
- package/dist/components/ChainShortcut.d.ts +15 -0
- package/dist/components/ChainShortcut.js +57 -0
- package/dist/components/ChainShortcut.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +21 -17
- package/dist/components/index.js.map +1 -1
- package/dist/{config-BMvXuF1-.js → config-C47AYcMK.js} +913 -898
- package/dist/config-C47AYcMK.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -2
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/ChainItem.d.ts +1 -0
- package/dist/features/ChainsDropdown/ChainItem.js +23 -14
- package/dist/features/ChainsDropdown/ChainItem.js.map +1 -1
- package/dist/features/ChainsDropdown/index.js +61 -94
- package/dist/features/ChainsDropdown/index.js.map +1 -1
- package/dist/features/ChainsSelector/index.d.ts +15 -0
- package/dist/features/ChainsSelector/index.js +108 -0
- package/dist/features/ChainsSelector/index.js.map +1 -0
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +4 -3
- package/dist/features/ExternalDeposit.js.map +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +62 -64
- package/dist/features/TokensModal.js.map +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +5 -4
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js.map +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.d.ts +3 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/index.js +74 -70
- package/dist/index.js.map +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/localisation.d.ts +1 -1
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/utils/tokens/sort.d.ts +2 -1
- package/dist/utils/tokens/sort.js +55 -24
- package/dist/utils/tokens/sort.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +2 -2
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +2 -2
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +2 -2
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +1 -1
- package/src/components/AllNetworksIcon.tsx +8 -0
- package/src/components/ChainShortcut.tsx +67 -0
- package/src/components/index.ts +2 -0
- package/src/config.tsx +13 -0
- package/src/features/ChainsDropdown/ChainItem.tsx +17 -4
- package/src/features/ChainsDropdown/index.tsx +10 -41
- package/src/features/ChainsSelector/index.tsx +113 -0
- package/src/features/TokensList/TokensList.tsx +2 -1
- package/src/features/TokensModal.tsx +29 -29
- package/src/hooks/useTokensFiltered.ts +4 -0
- package/src/types/config.ts +8 -0
- package/src/types/localisation.ts +1 -0
- package/src/utils/tokens/sort.ts +107 -20
- package/dist/config-BMvXuF1-.js.map +0 -1
- package/dist/features/ChainsDropdown/AllNetworksIcon.js +0 -7
- package/dist/features/ChainsDropdown/AllNetworksIcon.js.map +0 -1
- package/src/features/ChainsDropdown/AllNetworksIcon.tsx +0 -7
- /package/dist/{features/ChainsDropdown → components}/AllNetworksIcon.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalDeposit.js","sources":["../../src/features/ExternalDeposit.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { QRCodeSVG } from 'qrcode.react';\nimport { GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript';\nimport { ProgressActivityW700 as ProgressActivity } from '@material-symbols-svg/react-rounded/icons/progress-activity';\n\nimport { notReachable } from '@/utils';\nimport { CHAIN_IDS_MAP } from '@/constants/chains';\nimport { useExternalDepositStatus } from '@/hooks';\nimport { useTypedTranslation } from '@/localisation';\nimport { CopyButton, StatusWidget } from '@/components';\nimport {\n fireEvent,\n guardStates,\n moveTo,\n useComputedSnapshot,\n useUnsafeSnapshot,\n} from '@/machine';\nimport { formatAddressTruncate } from '@/utils/formatters/formatAddressTruncate';\nimport { getTransactionLink } from '@/utils/formatters/getTransactionLink';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { TransferResult } from '@/types';\n\ntype Msg =\n | { type: 'on_transaction_received' }\n | { type: 'on_successful_transfer'; transferResult: TransferResult };\n\ntype Props = {\n onMsg: (msg: Msg) => void;\n};\n\nconst QrCode = ({ address }: { address: string }) => (\n <div className=\"flex flex-col gap-sw-2xl items-center\">\n <div className=\"p-sw-lg m-sw-lg mx-auto w-fit rounded-sw-md bg-[#fff]\">\n <QRCodeSVG size={156} value={address} fgColor=\"#161926\" />\n </div>\n <div className=\"py-sw-lg px-sw-lg w-full flex items-center justify-between rounded-sw-md bg-sw-gray-800\">\n <span className=\"text-sw-label-md text-sw-gray-100\">\n {formatAddressTruncate(address, 38)}\n </span>\n <CopyButton value={address} />\n </div>\n </div>\n);\n\nconst Skeleton = () => {\n const { t } = useTypedTranslation();\n const { ctx } = useUnsafeSnapshot();\n\n return (\n <div className=\"flex flex-col gap-sw-2xl items-center\">\n <div className=\"bg-sw-gray-800 h-[180px] w-[180px] animate-pulse rounded-sw-md\" />\n <div className=\"bg-sw-gray-800 h-[44px] w-full animate-pulse rounded-sw-md flex items-center justify-center gap-sw-sm\">\n <ProgressActivity className=\"animate-spin text-sw-gray-100 h-sw-lg w-sw-lg\" />\n <span className=\"text-sw-gray-100 text-sw-label-sm\">\n {!isNotEmptyAmount(ctx.sourceTokenAmount)\n ? t('deposit.external.loading.waiting', 'Waiting for token amount')\n : t('deposit.external.loading.fetching', 'Fetching new address')}\n </span>\n </div>\n </div>\n );\n};\n\nexport const ExternalDeposit = ({ onMsg }: Props) => {\n const { t } = useTypedTranslation();\n const { ctx } = useUnsafeSnapshot();\n const { isNativeNearDeposit } = useComputedSnapshot();\n\n const isValidState = guardStates(ctx, [\n 'quote_success_external',\n 'quote_success_internal',\n ]);\n\n const isBridgePoaDeposit =\n (isNativeNearDeposit && ctx.isDepositFromExternalWallet) ||\n (!isNativeNearDeposit &&\n ctx.sourceToken?.assetId === ctx.targetToken?.assetId);\n\n const depositStatusQuery = useExternalDepositStatus({\n depositAddress: isValidState ? ctx.quote.depositAddress : '',\n depositAddressType: isBridgePoaDeposit ? 'poa' : 'one_click',\n });\n\n useEffect(() => {\n const status = depositStatusQuery.data?.status;\n\n if (!depositStatusQuery.data) {\n return;\n }\n\n switch (status) {\n case GetExecutionStatusResponse.status.SUCCESS: {\n const txHash =\n depositStatusQuery.data.swapDetails.destinationChainTxHashes[0]?.hash;\n\n fireEvent('transferSetStatus', { status: 'success' });\n moveTo('transfer_success');\n\n onMsg({\n type: 'on_successful_transfer',\n transferResult: {\n hash: txHash ?? '',\n intent: depositStatusQuery.data.swapDetails.intentHashes[0],\n transactionLink:\n (ctx.sourceToken &&\n txHash &&\n getTransactionLink(\n CHAIN_IDS_MAP[ctx.sourceToken.blockchain],\n txHash,\n )) ??\n '',\n },\n });\n break;\n }\n\n case GetExecutionStatusResponse.status.FAILED:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_FAILED' });\n break;\n case GetExecutionStatusResponse.status.INCOMPLETE_DEPOSIT:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_INCOMPLETE' });\n break;\n case GetExecutionStatusResponse.status.REFUNDED:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_REFUNDED' });\n break;\n case GetExecutionStatusResponse.status.PROCESSING:\n case GetExecutionStatusResponse.status.KNOWN_DEPOSIT_TX:\n // Transaction was received from external wallet\n fireEvent('externalDepositTxSet', true);\n onMsg({ type: 'on_transaction_received' });\n break;\n case GetExecutionStatusResponse.status.PENDING_DEPOSIT:\n case undefined:\n // No action needed - waiting for deposit\n break;\n default:\n notReachable(status);\n }\n // do not include onMsg to avoid infinite loop\n }, [depositStatusQuery.data, ctx.sourceToken]);\n\n if (!isValidState) {\n return <Skeleton />;\n }\n\n if (!depositStatusQuery.data) {\n return <QrCode address={ctx.quote.depositAddress} />;\n }\n\n switch (depositStatusQuery.status) {\n case 'error':\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.noStatus',\n 'Unable to check transfer status',\n )}\n />\n );\n\n case 'success': {\n switch (depositStatusQuery.data.status) {\n case GetExecutionStatusResponse.status.FAILED:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.noStatus',\n 'Unable to check transfer status',\n )}\n />\n );\n case GetExecutionStatusResponse.status.INCOMPLETE_DEPOSIT:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.incomplete',\n 'Incomplete deposit',\n )}\n />\n );\n case GetExecutionStatusResponse.status.REFUNDED:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.failed',\n 'Deposit failed. You were refunded.',\n )}\n />\n );\n case GetExecutionStatusResponse.status.PROCESSING:\n case GetExecutionStatusResponse.status.KNOWN_DEPOSIT_TX:\n return <StatusWidget.Success />;\n case GetExecutionStatusResponse.status.PENDING_DEPOSIT:\n return <QrCode address={ctx.quote.depositAddress} />;\n case GetExecutionStatusResponse.status.SUCCESS:\n return <StatusWidget.Success />;\n default:\n return null;\n }\n }\n\n default:\n return notReachable(depositStatusQuery);\n }\n};\n"],"names":["QrCode","address","jsxs","jsx","QRCodeSVG","formatAddressTruncate","CopyButton","Skeleton","t","useTypedTranslation","ctx","useUnsafeSnapshot","ProgressActivity","isNotEmptyAmount","ExternalDeposit","onMsg","isNativeNearDeposit","useComputedSnapshot","isValidState","guardStates","isBridgePoaDeposit","depositStatusQuery","useExternalDepositStatus","useEffect","status","GetExecutionStatusResponse","txHash","fireEvent","moveTo","getTransactionLink","CHAIN_IDS_MAP","notReachable","StatusWidget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAS,CAAC,EAAE,SAAAC,QAChB,gBAAAC,EAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,yDACb,UAAA,gBAA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;AACE,iBAAO;AAAA,MAAA;AAAA,IAIb;AACE,aAAOD,EAAaV,CAAkB;AAAA,EAAA;AAE5C;"}
|
|
1
|
+
{"version":3,"file":"ExternalDeposit.js","sources":["../../src/features/ExternalDeposit.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { QRCodeSVG } from 'qrcode.react';\nimport { GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript';\nimport { ProgressActivityW700 as ProgressActivity } from '@material-symbols-svg/react-rounded/icons/progress-activity';\n\nimport { notReachable } from '@/utils';\nimport { CHAIN_IDS_MAP } from '@/constants/chains';\nimport { useExternalDepositStatus } from '@/hooks';\nimport { useTypedTranslation } from '@/localisation';\nimport { CopyButton, StatusWidget } from '@/components';\nimport {\n fireEvent,\n guardStates,\n moveTo,\n useComputedSnapshot,\n useUnsafeSnapshot,\n} from '@/machine';\nimport { formatAddressTruncate } from '@/utils/formatters/formatAddressTruncate';\nimport { getTransactionLink } from '@/utils/formatters/getTransactionLink';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport type { TransferResult } from '@/types';\n\ntype Msg =\n | { type: 'on_transaction_received' }\n | { type: 'on_successful_transfer'; transferResult: TransferResult };\n\ntype Props = {\n onMsg: (msg: Msg) => void;\n};\n\nconst QrCode = ({ address }: { address: string }) => (\n <div className=\"flex flex-col gap-sw-2xl items-center\">\n <div className=\"p-sw-lg m-sw-lg mx-auto w-fit rounded-sw-md bg-[#fff]\">\n <QRCodeSVG size={156} value={address} fgColor=\"#161926\" />\n </div>\n <div className=\"py-sw-lg px-sw-lg w-full flex items-center justify-between rounded-sw-md bg-sw-gray-800\">\n <span className=\"text-sw-label-md text-sw-gray-100\">\n {formatAddressTruncate(address, 38)}\n </span>\n <CopyButton value={address} />\n </div>\n </div>\n);\n\nconst Skeleton = () => {\n const { t } = useTypedTranslation();\n const { ctx } = useUnsafeSnapshot();\n\n return (\n <div className=\"flex flex-col gap-sw-2xl items-center\">\n <div className=\"bg-sw-gray-800 h-[180px] w-[180px] animate-pulse rounded-sw-md\" />\n <div className=\"bg-sw-gray-800 h-[44px] w-full animate-pulse rounded-sw-md flex items-center justify-center gap-sw-sm\">\n <ProgressActivity className=\"animate-spin text-sw-gray-100 h-sw-lg w-sw-lg\" />\n <span className=\"text-sw-gray-100 text-sw-label-sm\">\n {!isNotEmptyAmount(ctx.sourceTokenAmount)\n ? t('deposit.external.loading.waiting', 'Waiting for token amount')\n : t('deposit.external.loading.fetching', 'Fetching new address')}\n </span>\n </div>\n </div>\n );\n};\n\nexport const ExternalDeposit = ({ onMsg }: Props) => {\n const { t } = useTypedTranslation();\n const { ctx } = useUnsafeSnapshot();\n const { isNativeNearDeposit } = useComputedSnapshot();\n\n const isValidState = guardStates(ctx, [\n 'quote_success_external',\n 'quote_success_internal',\n ]);\n\n const isBridgePoaDeposit =\n (isNativeNearDeposit && ctx.isDepositFromExternalWallet) ||\n (!isNativeNearDeposit &&\n ctx.sourceToken?.assetId === ctx.targetToken?.assetId);\n\n const depositStatusQuery = useExternalDepositStatus({\n depositAddress: isValidState ? ctx.quote.depositAddress : '',\n depositAddressType: isBridgePoaDeposit ? 'poa' : 'one_click',\n });\n\n useEffect(() => {\n const status = depositStatusQuery.data?.status;\n\n if (!depositStatusQuery.data) {\n return;\n }\n\n switch (status) {\n case GetExecutionStatusResponse.status.SUCCESS: {\n const txHash =\n depositStatusQuery.data.swapDetails.destinationChainTxHashes[0]?.hash;\n\n fireEvent('transferSetStatus', { status: 'success' });\n moveTo('transfer_success');\n\n onMsg({\n type: 'on_successful_transfer',\n transferResult: {\n hash: txHash ?? '',\n intent: depositStatusQuery.data.swapDetails.intentHashes[0],\n transactionLink:\n (ctx.sourceToken &&\n txHash &&\n getTransactionLink(\n CHAIN_IDS_MAP[ctx.sourceToken.blockchain],\n txHash,\n )) ??\n '',\n },\n });\n break;\n }\n\n case GetExecutionStatusResponse.status.FAILED:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_FAILED' });\n break;\n case GetExecutionStatusResponse.status.INCOMPLETE_DEPOSIT:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_INCOMPLETE' });\n break;\n case GetExecutionStatusResponse.status.REFUNDED:\n fireEvent('transferSetStatus', { status: 'error' });\n fireEvent('errorSet', { code: 'EXTERNAL_TRANSFER_REFUNDED' });\n break;\n case GetExecutionStatusResponse.status.PROCESSING:\n case GetExecutionStatusResponse.status.KNOWN_DEPOSIT_TX:\n // Transaction was received from external wallet\n fireEvent('externalDepositTxSet', true);\n onMsg({ type: 'on_transaction_received' });\n break;\n case GetExecutionStatusResponse.status.PENDING_DEPOSIT:\n case undefined:\n // No action needed - waiting for deposit\n break;\n default:\n notReachable(status);\n }\n // do not include onMsg to avoid infinite loop\n }, [depositStatusQuery.data, ctx.sourceToken]);\n\n if (!isValidState) {\n return <Skeleton />;\n }\n\n if (!depositStatusQuery.data) {\n return <QrCode address={ctx.quote.depositAddress} />;\n }\n\n switch (depositStatusQuery.status) {\n case 'error':\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.noStatus',\n 'Unable to check transfer status',\n )}\n />\n );\n\n case 'success': {\n switch (depositStatusQuery.data.status) {\n case GetExecutionStatusResponse.status.FAILED:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.noStatus',\n 'Unable to check transfer status',\n )}\n />\n );\n case GetExecutionStatusResponse.status.INCOMPLETE_DEPOSIT:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.incomplete',\n 'Incomplete deposit',\n )}\n />\n );\n case GetExecutionStatusResponse.status.REFUNDED:\n return (\n <StatusWidget.Error\n message={t(\n 'deposit.external.error.failed',\n 'Deposit failed. You were refunded.',\n )}\n />\n );\n case GetExecutionStatusResponse.status.PROCESSING:\n case GetExecutionStatusResponse.status.KNOWN_DEPOSIT_TX:\n return <StatusWidget.Success />;\n case GetExecutionStatusResponse.status.PENDING_DEPOSIT:\n return <QrCode address={ctx.quote.depositAddress} />;\n case GetExecutionStatusResponse.status.SUCCESS:\n return <StatusWidget.Success />;\n default:\n return null;\n }\n }\n\n default:\n return notReachable(depositStatusQuery);\n }\n};\n"],"names":["QrCode","address","jsxs","jsx","QRCodeSVG","formatAddressTruncate","CopyButton","Skeleton","t","useTypedTranslation","ctx","useUnsafeSnapshot","ProgressActivity","isNotEmptyAmount","ExternalDeposit","onMsg","isNativeNearDeposit","useComputedSnapshot","isValidState","guardStates","isBridgePoaDeposit","depositStatusQuery","useExternalDepositStatus","useEffect","status","GetExecutionStatusResponse","txHash","fireEvent","moveTo","getTransactionLink","CHAIN_IDS_MAP","notReachable","StatusWidget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAS,CAAC,EAAE,SAAAC,QAChB,gBAAAC,EAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,yDACb,UAAA,gBAAAA,EAACC,GAAA,EAAU,MAAM,KAAK,OAAOH,GAAS,SAAQ,UAAA,CAAU,GAC1D;AAAA,EACA,gBAAAC,EAAC,OAAA,EAAI,WAAU,2FACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,UAAK,WAAU,qCACb,UAAAE,EAAsBJ,GAAS,EAAE,GACpC;AAAA,IACA,gBAAAE,EAACG,GAAA,EAAW,OAAOL,EAAA,CAAS;AAAA,EAAA,EAAA,CAC9B;AAAA,GACF,GAGIM,IAAW,MAAM;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,EAAE,KAAAC,EAAA,IAAQC,EAAA;AAEhB,SACE,gBAAAT,EAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,iEAAA,CAAiE;AAAA,IAChF,gBAAAD,EAAC,OAAA,EAAI,WAAU,yGACb,UAAA;A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F;AAAA,UAAA;AAAA,QAGN,KAAKiB,EAA2B,OAAO;AACrC,iBACE,gBAAAtB;AAAA,YAAC6B,EAAa;AAAA,YAAb;AAAA,cACC,SAASxB;AAAA,gBACP;AAAA,gBACA;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAGN,KAAKiB,EAA2B,OAAO;AACrC,iBACE,gBAAAtB;AAAA,YAAC6B,EAAa;AAAA,YAAb;AAAA,cACC,SAASxB;AAAA,gBACP;AAAA,gBACA;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAGN,KAAKiB,EAA2B,OAAO;AAAA,QACvC,KAAKA,EAA2B,OAAO;AACrC,iBAAO,gBAAAtB,EAAC6B,EAAa,SAAb,EAAqB;AAAA,QAC/B,KAAKP,EAA2B,OAAO;AACrC,iBAAO,gBAAAtB,EAACH,GAAA,EAAO,SAASU,EAAI,MAAM,gBAAgB;AAAA,QACpD,KAAKe,EAA2B,OAAO;AACrC,iBAAO,gBAAAtB,EAAC6B,EAAa,SAAb,EAAqB;AAAA,QAC/B;AACE,iBAAO;AAAA,MAAA;AAAA,IAIb;AACE,aAAOD,EAAaV,CAAkB;AAAA,EAAA;AAE5C;"}
|
|
@@ -11,7 +11,7 @@ import "../../constants/chains.js";
|
|
|
11
11
|
import "viem";
|
|
12
12
|
import "ethers";
|
|
13
13
|
import { cn as M } from "../../utils/cn.js";
|
|
14
|
-
import { b as V, y as _ } from "../../config-
|
|
14
|
+
import { b as V, y as _ } from "../../config-C47AYcMK.js";
|
|
15
15
|
import "../../machine/machine.js";
|
|
16
16
|
import { fireEvent as d } from "../../machine/events/utils/fireEvent.js";
|
|
17
17
|
import { useTypedTranslation as j } from "../../localisation.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo as o } from "react";
|
|
2
|
-
import { b as d, y as l } from "../../config-
|
|
2
|
+
import { b as d, y as l } from "../../config-C47AYcMK.js";
|
|
3
3
|
import { useTypedTranslation as c } from "../../localisation.js";
|
|
4
4
|
import { getIntentsAccountId as u } from "../../utils/intents/getIntentsAccountId.js";
|
|
5
5
|
import { CHAINS_LIST as f, EVM_CHAINS as m } from "../../constants/chains.js";
|
|
@@ -3,7 +3,7 @@ import "react-i18next";
|
|
|
3
3
|
import "../../components/Button.js";
|
|
4
4
|
import "../../components/TinyNumber.js";
|
|
5
5
|
import "../../components/ErrorMessage.js";
|
|
6
|
-
import { S as b } from "../../config-
|
|
6
|
+
import { S as b } from "../../config-C47AYcMK.js";
|
|
7
7
|
import "../../localisation.js";
|
|
8
8
|
import "../../utils/checkers/isNotEmptyAmount.js";
|
|
9
9
|
export {
|
|
@@ -8,7 +8,7 @@ import { Button as h } from "../../components/Button.js";
|
|
|
8
8
|
import { CloseButton as C } from "../../components/CloseButton.js";
|
|
9
9
|
import { Accordion as F } from "../../components/Accordion.js";
|
|
10
10
|
import { guardStates as _ } from "../../machine/guards/index.js";
|
|
11
|
-
import { b as q } from "../../config-
|
|
11
|
+
import { b as q } from "../../config-C47AYcMK.js";
|
|
12
12
|
import { formatUsdAmount as B } from "../../utils/formatters/formatUsdAmount.js";
|
|
13
13
|
import { formatTinyNumber as E } from "../../utils/formatters/formatTinyNumber.js";
|
|
14
14
|
import { formatBigToHuman as g } from "../../utils/formatters/formatBigToHuman.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo as r } from "react";
|
|
2
2
|
import { guardStates as m } from "../../machine/guards/index.js";
|
|
3
|
-
import { b as n } from "../../config-
|
|
3
|
+
import { b as n } from "../../config-C47AYcMK.js";
|
|
4
4
|
const i = (t) => {
|
|
5
5
|
const { ctx: s } = n(), o = m(s, ["transfer_success"]);
|
|
6
6
|
return r(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { DirectionSwitcher as r } from "../components/DirectionSwitcher.js";
|
|
3
|
-
import { b as i } from "../config-
|
|
3
|
+
import { b as i } from "../config-C47AYcMK.js";
|
|
4
4
|
import "ethers";
|
|
5
5
|
import "../machine/machine.js";
|
|
6
6
|
import { fireEvent as n } from "../machine/events/utils/fireEvent.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "./SwapQuoteSkeleton.js";
|
|
3
|
-
import { a4 as s } from "../../config-
|
|
3
|
+
import { a4 as s } from "../../config-C47AYcMK.js";
|
|
4
4
|
import "../../components/Notes.js";
|
|
5
5
|
import "../../components/Accordion.js";
|
|
6
6
|
import "../../utils/formatters/formatUsdAmount.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { a6 as I } from "../../config-
|
|
3
|
+
import { a6 as I } from "../../config-C47AYcMK.js";
|
|
4
4
|
import "./utils/getBalancePortion.js";
|
|
5
5
|
import "./utils/getUsdDisplayAmount.js";
|
|
6
6
|
import "./TokenInputHeading.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../utils/cn.js";
|
|
3
|
-
import { ab as a } from "../../config-
|
|
3
|
+
import { ab as a } from "../../config-C47AYcMK.js";
|
|
4
4
|
import "../../components/TokenIcon.js";
|
|
5
5
|
import "../../components/TinyNumber.js";
|
|
6
6
|
import "../../utils/formatters/getUsdDisplayBalance.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "virtua";
|
|
3
3
|
import "react";
|
|
4
|
-
import { ac as g } from "../../config-
|
|
4
|
+
import { ac as g } from "../../config-C47AYcMK.js";
|
|
5
5
|
import "./hooks/useFocusOnList.js";
|
|
6
6
|
import "./TokensListPlaceholder.js";
|
|
7
7
|
import "./constants.js";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { b as
|
|
5
|
-
import { ChainsDropdown as B } from "./ChainsDropdown/index.js";
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as j, useState as f } from "react";
|
|
3
|
+
import { SearchW700 as I } from "@material-symbols-svg/react-rounded/icons/search";
|
|
4
|
+
import { b as M, y as R, d as A, q as B } from "../config-C47AYcMK.js";
|
|
6
5
|
import "@tanstack/react-query";
|
|
7
6
|
import "@defuse-protocol/one-click-sdk-typescript";
|
|
8
7
|
import "../constants/chains.js";
|
|
9
8
|
import "ethers";
|
|
10
9
|
import "../machine/machine.js";
|
|
11
|
-
import { notReachable as
|
|
10
|
+
import { notReachable as u } from "../utils/notReachable.js";
|
|
12
11
|
import "zod";
|
|
13
12
|
import "../utils/near/rpc.js";
|
|
14
13
|
import "../index-DEq3oXQF.js";
|
|
@@ -20,101 +19,100 @@ import "../index-xuotMAFm.js";
|
|
|
20
19
|
import "axios";
|
|
21
20
|
import "../network.js";
|
|
22
21
|
import "viem";
|
|
23
|
-
import { cn as
|
|
22
|
+
import { cn as E } from "../utils/cn.js";
|
|
24
23
|
import "viem/chains";
|
|
25
24
|
import "browser-or-node";
|
|
26
|
-
import { useHandleKeyDown as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
25
|
+
import { useHandleKeyDown as h } from "../hooks/useHandleKeyDown.js";
|
|
26
|
+
import { ChainsSelector as H } from "./ChainsSelector/index.js";
|
|
27
|
+
import { Hr as q } from "../components/Hr.js";
|
|
28
|
+
import { Card as D } from "../components/Card.js";
|
|
29
|
+
import { Input as K } from "../components/Input.js";
|
|
30
|
+
import { Banner as L } from "../components/Banner.js";
|
|
31
|
+
import { CloseButton as O } from "../components/CloseButton.js";
|
|
32
|
+
import { useTypedTranslation as U } from "../localisation.js";
|
|
33
|
+
const ye = ({
|
|
34
34
|
variant: n,
|
|
35
35
|
showBalances: w,
|
|
36
36
|
showChainsSelector: x,
|
|
37
|
-
chainsFilter:
|
|
37
|
+
chainsFilter: a,
|
|
38
38
|
groupTokens: C,
|
|
39
|
-
className:
|
|
39
|
+
className: y,
|
|
40
40
|
onMsg: p
|
|
41
41
|
}) => {
|
|
42
|
-
const { t:
|
|
43
|
-
|
|
42
|
+
const { t: S } = U(), { ctx: k } = M(), { walletSupportedChains: _ } = R(), c = j(null), [r, s] = f(""), l = A(n), m = () => p({ type: "on_dismiss_tokens_modal" });
|
|
43
|
+
h(
|
|
44
44
|
"Escape",
|
|
45
45
|
() => {
|
|
46
46
|
r ? s("") : m();
|
|
47
47
|
},
|
|
48
48
|
[r]
|
|
49
|
-
),
|
|
49
|
+
), h("Alphanumeric", (e) => {
|
|
50
50
|
s((N) => N + e), c.current?.focus();
|
|
51
51
|
});
|
|
52
|
-
const b =
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
52
|
+
const b = l.length === 1 && l[0]?.id ? l[0]?.id : "all", [o, g] = f(b), d = o !== "all" && o !== "intents" && a.external !== "all" && !_.includes(o);
|
|
53
|
+
return /* @__PURE__ */ i(
|
|
54
|
+
D,
|
|
55
55
|
{
|
|
56
56
|
padding: "none",
|
|
57
|
-
className:
|
|
57
|
+
className: E(
|
|
58
58
|
"w-full gap-sw-xl flex flex-col px-sw-2xl pt-sw-2xl",
|
|
59
|
-
|
|
59
|
+
y
|
|
60
60
|
),
|
|
61
61
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ i("header", { className: "flex items-center justify-between", children: [
|
|
63
63
|
/* @__PURE__ */ t("h2", { className: "text-sw-label-lg text-sw-gray-50", children: "Select token" }),
|
|
64
|
-
/* @__PURE__ */ t(
|
|
64
|
+
/* @__PURE__ */ t(O, { onClick: m })
|
|
65
65
|
] }),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
h(e.type, { throwError: !1 });
|
|
92
|
-
}
|
|
66
|
+
/* @__PURE__ */ t(
|
|
67
|
+
K,
|
|
68
|
+
{
|
|
69
|
+
focusOnMount: !0,
|
|
70
|
+
icon: I,
|
|
71
|
+
ref: c,
|
|
72
|
+
defaultValue: r,
|
|
73
|
+
className: "w-full",
|
|
74
|
+
placeholder: "Search or paste address",
|
|
75
|
+
onChange: (e) => s(e.target.value.trim())
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
x && /* @__PURE__ */ t(
|
|
79
|
+
H,
|
|
80
|
+
{
|
|
81
|
+
variant: n,
|
|
82
|
+
chainsFilter: a,
|
|
83
|
+
selectedChain: o,
|
|
84
|
+
onMsg: (e) => {
|
|
85
|
+
switch (e.type) {
|
|
86
|
+
case "on_select_chain":
|
|
87
|
+
g(e.chain);
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
u(e.type);
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
d && !!
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
d && !!k.walletAddress && /* @__PURE__ */ i(T, { children: [
|
|
98
96
|
/* @__PURE__ */ t(
|
|
99
|
-
|
|
97
|
+
L,
|
|
100
98
|
{
|
|
101
99
|
variant: "error",
|
|
102
|
-
message:
|
|
100
|
+
message: S(
|
|
103
101
|
"wallet.connected.error.notSupportedChain",
|
|
104
102
|
"This network isn’t supported by your wallet."
|
|
105
103
|
)
|
|
106
104
|
}
|
|
107
105
|
),
|
|
108
|
-
/* @__PURE__ */ t(
|
|
106
|
+
/* @__PURE__ */ t(q, {})
|
|
109
107
|
] }),
|
|
110
108
|
/* @__PURE__ */ t(
|
|
111
|
-
|
|
109
|
+
B,
|
|
112
110
|
{
|
|
113
111
|
variant: n,
|
|
114
112
|
search: r,
|
|
115
113
|
groupTokens: C,
|
|
116
114
|
showBalances: w,
|
|
117
|
-
chainsFilter:
|
|
115
|
+
chainsFilter: a,
|
|
118
116
|
selectedChain: o,
|
|
119
117
|
chainIsNotSupported: d,
|
|
120
118
|
onMsg: (e) => {
|
|
@@ -126,7 +124,7 @@ const ke = ({
|
|
|
126
124
|
p(e);
|
|
127
125
|
break;
|
|
128
126
|
default:
|
|
129
|
-
|
|
127
|
+
u(e, { throwError: !1 });
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
}
|
|
@@ -136,6 +134,6 @@ const ke = ({
|
|
|
136
134
|
);
|
|
137
135
|
};
|
|
138
136
|
export {
|
|
139
|
-
|
|
137
|
+
ye as TokensModal
|
|
140
138
|
};
|
|
141
139
|
//# sourceMappingURL=TokensModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokensModal.js","sources":["../../src/features/TokensModal.tsx"],"sourcesContent":["import { SearchW700 as Search } from '@material-symbols-svg/react-rounded/icons/search';\nimport {
|
|
1
|
+
{"version":3,"file":"TokensModal.js","sources":["../../src/features/TokensModal.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { SearchW700 as Search } from '@material-symbols-svg/react-rounded/icons/search';\n\nimport { useChains } from '../hooks';\nimport { TokensList } from './TokensList';\nimport { ChainsSelector } from './ChainsSelector';\n\nimport { Hr } from '@/components/Hr';\nimport { Card } from '@/components/Card';\nimport { Input } from '@/components/Input';\nimport { Banner } from '@/components/Banner';\nimport { CloseButton } from '@/components/CloseButton';\n\nimport { cn } from '@/utils/cn';\nimport { useConfig } from '@/config';\nimport { useHandleKeyDown } from '@/hooks';\nimport { useUnsafeSnapshot } from '@/machine/snap';\nimport { notReachable } from '@/utils/notReachable';\nimport { useTypedTranslation } from '@/localisation';\nimport type { Chains, ChainsFilter } from '@/types/chain';\nimport type { Token } from '@/types/token';\n\ntype Msg =\n | { type: 'on_select_token'; token: Token }\n | { type: 'on_dismiss_tokens_modal' };\n\ntype Props = {\n variant: 'source' | 'target';\n groupTokens: boolean;\n showBalances: boolean;\n showChainsSelector: boolean;\n chainsFilter: ChainsFilter;\n className?: string;\n onMsg: (msg: Msg) => void;\n};\n\nexport const TokensModal = ({\n variant,\n showBalances,\n showChainsSelector,\n chainsFilter,\n groupTokens,\n className,\n onMsg,\n}: Props) => {\n const { t } = useTypedTranslation();\n const { ctx } = useUnsafeSnapshot();\n const { walletSupportedChains } = useConfig();\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n const [search, setSearch] = useState('');\n const chains = useChains(variant);\n\n const handleClose = () => onMsg({ type: 'on_dismiss_tokens_modal' });\n\n useHandleKeyDown(\n 'Escape',\n () => {\n if (search) {\n setSearch('');\n } else {\n handleClose();\n }\n },\n [search],\n );\n\n useHandleKeyDown('Alphanumeric', (key) => {\n setSearch((s) => s + key);\n searchInputRef.current?.focus();\n });\n\n // If there is only one chain available, select it by default\n const defaultChain =\n chains.length === 1 && chains[0]?.id ? chains[0]?.id : 'all';\n\n const [selectedChain, setSelectedChain] = useState<\n 'all' | 'intents' | Chains\n >(defaultChain);\n\n // selected chain is not supported by connected wallet\n const chainIsNotSupported =\n selectedChain !== 'all' &&\n selectedChain !== 'intents' &&\n chainsFilter.external !== 'all' &&\n !walletSupportedChains.includes(selectedChain);\n\n return (\n <Card\n padding=\"none\"\n className={cn(\n 'w-full gap-sw-xl flex flex-col px-sw-2xl pt-sw-2xl',\n className,\n )}>\n <header className=\"flex items-center justify-between\">\n <h2 className=\"text-sw-label-lg text-sw-gray-50\">Select token</h2>\n <CloseButton onClick={handleClose} />\n </header>\n\n <Input\n focusOnMount\n icon={Search}\n ref={searchInputRef}\n defaultValue={search}\n className=\"w-full\"\n placeholder=\"Search or paste address\"\n onChange={(e) => setSearch(e.target.value.trim())}\n />\n\n {showChainsSelector && (\n <ChainsSelector\n variant={variant}\n chainsFilter={chainsFilter}\n selectedChain={selectedChain}\n onMsg={(msg) => {\n switch (msg.type) {\n case 'on_select_chain':\n setSelectedChain(msg.chain);\n break;\n default:\n notReachable(msg.type);\n }\n }}\n />\n )}\n\n {chainIsNotSupported && !!ctx.walletAddress && (\n <>\n <Banner\n variant=\"error\"\n message={t(\n 'wallet.connected.error.notSupportedChain',\n 'This network isn’t supported by your wallet.',\n )}\n />\n <Hr />\n </>\n )}\n\n <TokensList\n variant={variant}\n search={search}\n groupTokens={groupTokens}\n showBalances={showBalances}\n chainsFilter={chainsFilter}\n selectedChain={selectedChain}\n chainIsNotSupported={chainIsNotSupported}\n onMsg={(msg) => {\n switch (msg.type) {\n case 'on_reset_search':\n setSearch('');\n break;\n case 'on_select_token':\n onMsg(msg);\n break;\n default:\n notReachable(msg, { throwError: false });\n }\n }}\n />\n </Card>\n );\n};\n"],"names":["TokensModal","variant","showBalances","showChainsSelector","chainsFilter","groupTokens","className","onMsg","t","useTypedTranslation","ctx","useUnsafeSnapshot","walletSupportedChains","useConfig","searchInputRef","useRef","search","setSearch","useState","chains","useChains","handleClose","useHandleKeyDown","key","s","defaultChain","selectedChain","setSelectedChain","chainIsNotSupported","jsxs","Card","cn","jsx","CloseButton","Input","Search","ChainsSelector","msg","notReachable","Fragment","Banner","Hr","TokensList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAMA,KAAc,CAAC;AAAA,EAC1B,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AACF,MAAa;AACX,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,EAAE,KAAAC,EAAA,IAAQC,EAAA,GACV,EAAE,uBAAAC,EAAA,IAA0BC,EAAA,GAE5BC,IAAiBC,EAAyB,IAAI,GAC9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AAA,YACC,SAAAnC;AAAA,YACA,cAAAG;AAAA,YACA,eAAAsB;AAAA,YACA,OAAO,CAACW,MAAQ;AACd,sBAAQA,EAAI,MAAA;AAAA,gBACV,KAAK;AACH,kBAAAV,EAAiBU,EAAI,KAAK;AAC1B;AAAA,gBACF;AACE,kBAAAC,EAAaD,EAAI,IAAI;AAAA,cAAA;AAAA,YAE3B;AAAA,UAAA;AAAA,QAAA;AAAA,QAIHT,KAAuB,CAAC,CAAClB,EAAI,iBAC5B,gBAAAmB,EAAAU,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAP;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,SAAShC;AAAA,gBACP;AAAA,gBACA;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,4BAEDiC,GAAA,CAAA,CAAG;AAAA,QAAA,GACN;AAAA,QAGF,gBAAAT;AAAA,UAACU;AAAA,UAAA;AAAA,YACC,SAAAzC;AAAA,YACA,QAAAe;AAAA,YACA,aAAAX;AAAA,YACA,cAAAH;AAAA,YACA,cAAAE;AAAA,YACA,eAAAsB;AAAA,YACA,qBAAAE;AAAA,YACA,OAAO,CAACS,MAAQ;AACd,sBAAQA,EAAI,MAAA;AAAA,gBACV,KAAK;AACH,kBAAApB,EAAU,EAAE;AACZ;AAAA,gBACF,KAAK;AACH,kBAAAV,EAAM8B,CAAG;AACT;AAAA,gBACF;AACE,kBAAAC,EAAaD,GAAK,EAAE,YAAY,GAAA,CAAO;AAAA,cAAA;AAAA,YAE7C;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -14,7 +14,7 @@ import "ethers";
|
|
|
14
14
|
import "../../utils/cn.js";
|
|
15
15
|
import "@tanstack/react-query";
|
|
16
16
|
import "@defuse-protocol/one-click-sdk-typescript";
|
|
17
|
-
import { af as
|
|
17
|
+
import { af as X, ae as Y, z as Z } from "../../config-C47AYcMK.js";
|
|
18
18
|
import "../../machine/machine.js";
|
|
19
19
|
import "zod";
|
|
20
20
|
import "../../utils/near/rpc.js";
|
|
@@ -45,9 +45,10 @@ import "../../components/Input.js";
|
|
|
45
45
|
import "../../components/InputAmount.js";
|
|
46
46
|
import "../../components/Notes.js";
|
|
47
47
|
import "../../components/CloseButton.js";
|
|
48
|
+
import "../../components/ChainShortcut.js";
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
X as ErrorView,
|
|
51
|
+
Y as Initial,
|
|
52
|
+
Z as WalletCompatibilityModal
|
|
52
53
|
};
|
|
53
54
|
//# sourceMappingURL=WalletCompatibilityModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletCompatibilityModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WalletCompatibilityModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as r } from "react";
|
|
3
|
-
import { b, z as n } from "../../config-
|
|
3
|
+
import { b, z as n } from "../../config-C47AYcMK.js";
|
|
4
4
|
import "ethers";
|
|
5
5
|
import "../../machine/machine.js";
|
|
6
6
|
import { notReachable as l } from "../../utils/notReachable.js";
|
package/dist/features/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as r, S as t, o as p, p as a, T as s, q as n } from "../config-
|
|
1
|
+
import { B as r, S as t, o as p, p as a, T as s, q as n } from "../config-C47AYcMK.js";
|
|
2
2
|
import { ChainsDropdown as m } from "./ChainsDropdown/index.js";
|
|
3
3
|
import { SendAddress as c } from "./SendAddress/index.js";
|
|
4
4
|
import { SuccessScreen as S } from "./SuccessScreen/index.js";
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as a, d as r, f as o, g as t, h as n, j as u, i as f, k as l, l as m, n as k, m as p } from "../config-
|
|
1
|
+
import { e as a, d as r, f as o, g as t, h as n, j as u, i as f, k as l, l as m, n as k, m as p } from "../config-C47AYcMK.js";
|
|
2
2
|
import { useMakeEvmTransfer as T } from "./useMakeEvmTransfer.js";
|
|
3
3
|
import { useMakeSolanaTransfer as M } from "./useMakeSolanaTransfer.js";
|
|
4
4
|
import { useTokenInputPair as c } from "./useTokenInputPair.js";
|
package/dist/hooks/useChains.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState as f } from "react";
|
|
2
2
|
import { B as l } from "../index-DEq3oXQF.js";
|
|
3
3
|
import { verifyWalletSignature as N, walletVerificationMessageFactory as p } from "../utils/intents/walletCompatibilityVerification.js";
|
|
4
|
-
import { y, w as o } from "../config-
|
|
4
|
+
import { y, w as o } from "../config-C47AYcMK.js";
|
|
5
5
|
import { notReachable as A } from "../utils/notReachable.js";
|
|
6
6
|
import { getIntentsAccountId as S } from "../utils/intents/getIntentsAccountId.js";
|
|
7
7
|
import { localStorageTyped as u } from "../utils/localstorage.js";
|
|
@@ -5,7 +5,7 @@ import "ethers";
|
|
|
5
5
|
import "../../utils/cn.js";
|
|
6
6
|
import { notReachable as l } from "../../utils/notReachable.js";
|
|
7
7
|
import { useOneClickExternalDepositStatus as p } from "./useOneClickExternalDepositStatus.js";
|
|
8
|
-
import { b as c, u as m, A as S, v as f } from "../../config-
|
|
8
|
+
import { b as c, u as m, A as S, v as f } from "../../config-C47AYcMK.js";
|
|
9
9
|
import { WNEAR_ASSET_ID as D } from "../../constants/tokens.js";
|
|
10
10
|
import { guardStates as h } from "../../machine/guards/index.js";
|
|
11
11
|
import "../../machine/machine.js";
|
|
@@ -4,7 +4,7 @@ import "change-case";
|
|
|
4
4
|
import "../utils/near/getRandomBytes.js";
|
|
5
5
|
import "../utils/intents/signers/solana.js";
|
|
6
6
|
import "../logger.js";
|
|
7
|
-
import { g as b } from "../config-
|
|
7
|
+
import { g as b } from "../config-C47AYcMK.js";
|
|
8
8
|
import "../constants/chains.js";
|
|
9
9
|
import "../constants/intents.js";
|
|
10
10
|
import "../utils/notReachable.js";
|