@ton/appkit-react 0.0.6-alpha.3 → 1.0.0-alpha.1
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/README.md +47 -15
- package/dist/esm/components/shared/amount-presets/amount-presets.js +8 -0
- package/dist/esm/components/shared/amount-presets/amount-presets.js.map +1 -0
- package/dist/esm/components/shared/amount-presets/amount-presets.module.css +20 -0
- package/dist/esm/{features/balances/components/balance-badge → components/shared/amount-presets}/index.js +1 -1
- package/dist/esm/components/shared/amount-presets/index.js.map +1 -0
- package/dist/esm/components/shared/button-with-connect/button-with-connect.js +16 -0
- package/dist/esm/components/shared/button-with-connect/button-with-connect.js.map +1 -0
- package/dist/esm/components/shared/button-with-connect/index.js +9 -0
- package/dist/esm/components/shared/button-with-connect/index.js.map +1 -0
- package/dist/esm/components/{ton-icon → shared/low-balance-modal}/index.js +1 -1
- package/dist/esm/components/shared/low-balance-modal/index.js.map +1 -0
- package/dist/esm/components/shared/low-balance-modal/low-balance-modal.js +11 -0
- package/dist/esm/components/shared/low-balance-modal/low-balance-modal.js.map +1 -0
- package/dist/esm/components/shared/low-balance-modal/low-balance-modal.module.css +21 -0
- package/dist/esm/components/shared/option-switcher/index.js +9 -0
- package/dist/esm/components/shared/option-switcher/index.js.map +1 -0
- package/dist/esm/components/shared/option-switcher/option-switcher.js +14 -0
- package/dist/esm/components/shared/option-switcher/option-switcher.js.map +1 -0
- package/dist/esm/components/shared/option-switcher/option-switcher.module.css +18 -0
- package/dist/esm/components/shared/settings-button/index.js +9 -0
- package/dist/esm/components/shared/settings-button/index.js.map +1 -0
- package/dist/esm/components/shared/settings-button/settings-button.js +9 -0
- package/dist/esm/components/shared/settings-button/settings-button.js.map +1 -0
- package/dist/esm/components/shared/settings-button/settings-button.module.css +11 -0
- package/dist/esm/components/shared/token-select-modal/index.js +9 -0
- package/dist/esm/components/shared/token-select-modal/index.js.map +1 -0
- package/dist/esm/components/shared/token-select-modal/token-select-modal.js +36 -0
- package/dist/esm/components/shared/token-select-modal/token-select-modal.js.map +1 -0
- package/dist/esm/components/shared/token-select-modal/token-select-modal.module.css +27 -0
- package/dist/esm/components/ui/amount-reversed/amount-reversed.js +13 -0
- package/dist/esm/components/ui/amount-reversed/amount-reversed.js.map +1 -0
- package/dist/esm/components/ui/amount-reversed/amount-reversed.module.css +34 -0
- package/dist/esm/components/ui/amount-reversed/index.js +9 -0
- package/dist/esm/components/ui/amount-reversed/index.js.map +1 -0
- package/dist/esm/components/ui/block/block.js.map +1 -0
- package/dist/esm/components/{block → ui/block}/block.module.css +1 -1
- package/dist/esm/components/ui/block/index.js.map +1 -0
- package/dist/esm/components/ui/button/button.js +31 -0
- package/dist/esm/components/ui/button/button.js.map +1 -0
- package/dist/esm/components/ui/button/button.module.css +137 -0
- package/dist/esm/components/ui/button/index.js.map +1 -0
- package/dist/esm/components/ui/centered-amount-input/centered-amount-input.js +51 -0
- package/dist/esm/components/ui/centered-amount-input/centered-amount-input.js.map +1 -0
- package/dist/esm/components/ui/centered-amount-input/centered-amount-input.module.css +69 -0
- package/dist/esm/components/ui/centered-amount-input/index.js +9 -0
- package/dist/esm/components/ui/centered-amount-input/index.js.map +1 -0
- package/dist/esm/components/ui/collapsible/collapsible.js +34 -0
- package/dist/esm/components/ui/collapsible/collapsible.js.map +1 -0
- package/dist/esm/components/ui/collapsible/collapsible.module.css +4 -0
- package/dist/esm/components/ui/collapsible/index.js +9 -0
- package/dist/esm/components/ui/collapsible/index.js.map +1 -0
- package/dist/esm/components/ui/dialog/dialog.js +67 -0
- package/dist/esm/components/ui/dialog/dialog.js.map +1 -0
- package/dist/esm/components/ui/dialog/index.js +9 -0
- package/dist/esm/components/ui/dialog/index.js.map +1 -0
- package/dist/esm/components/ui/dialog/use-dialog-context.js +16 -0
- package/dist/esm/components/ui/dialog/use-dialog-context.js.map +1 -0
- package/dist/esm/components/ui/icons/chevron-down-icon.js +4 -0
- package/dist/esm/components/ui/icons/chevron-down-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/chevrons-icon.js +4 -0
- package/dist/esm/components/ui/icons/chevrons-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/close-icon.js +4 -0
- package/dist/esm/components/ui/icons/close-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/failed-icon.js +4 -0
- package/dist/esm/components/ui/icons/failed-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/flip-icon.js +4 -0
- package/dist/esm/components/ui/icons/flip-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/image-icon.js +4 -0
- package/dist/esm/components/ui/icons/image-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/index.js +21 -0
- package/dist/esm/components/ui/icons/index.js.map +1 -0
- package/dist/esm/components/ui/icons/search-icon.js +4 -0
- package/dist/esm/components/ui/icons/search-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/sliders-icon.js +4 -0
- package/dist/esm/components/ui/icons/sliders-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/spinner-icon.js +4 -0
- package/dist/esm/components/ui/icons/spinner-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/success-icon.js +4 -0
- package/dist/esm/components/ui/icons/success-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/ton-icon.js +5 -0
- package/dist/esm/components/ui/icons/ton-icon.js.map +1 -0
- package/dist/esm/components/ui/icons/types.js +10 -0
- package/dist/esm/components/ui/icons/types.js.map +1 -0
- package/dist/esm/components/ui/icons/verified-icon.js +4 -0
- package/dist/esm/components/ui/icons/verified-icon.js.map +1 -0
- package/dist/esm/components/ui/info-block/index.js +9 -0
- package/dist/esm/components/ui/info-block/index.js.map +1 -0
- package/dist/esm/components/ui/info-block/info-block.js +31 -0
- package/dist/esm/components/ui/info-block/info-block.js.map +1 -0
- package/dist/esm/components/ui/info-block/info-block.module.css +30 -0
- package/dist/esm/components/ui/input/index.js +9 -0
- package/dist/esm/components/ui/input/index.js.map +1 -0
- package/dist/esm/components/ui/input/input.js +62 -0
- package/dist/esm/components/ui/input/input.js.map +1 -0
- package/dist/esm/components/ui/input/input.module.css +147 -0
- package/dist/esm/components/ui/input/use-input-resize.js +56 -0
- package/dist/esm/components/ui/input/use-input-resize.js.map +1 -0
- package/dist/esm/components/ui/logo/index.js +9 -0
- package/dist/esm/components/ui/logo/index.js.map +1 -0
- package/dist/esm/components/ui/logo/logo.js +54 -0
- package/dist/esm/components/ui/logo/logo.js.map +1 -0
- package/dist/esm/components/{circle-icon/circle-icon.module.css → ui/logo/logo.module.css} +6 -6
- package/dist/esm/components/ui/logo/use-image-loading-status.js +44 -0
- package/dist/esm/components/ui/logo/use-image-loading-status.js.map +1 -0
- package/dist/esm/components/ui/modal/index.js +9 -0
- package/dist/esm/components/ui/modal/index.js.map +1 -0
- package/dist/esm/components/ui/modal/modal.js +9 -0
- package/dist/esm/components/ui/modal/modal.js.map +1 -0
- package/dist/esm/components/ui/modal/modal.module.css +71 -0
- package/dist/esm/components/ui/select/index.js +9 -0
- package/dist/esm/components/ui/select/index.js.map +1 -0
- package/dist/esm/components/ui/select/select.js +147 -0
- package/dist/esm/components/ui/select/select.js.map +1 -0
- package/dist/esm/components/ui/select/select.module.css +37 -0
- package/dist/esm/components/ui/select/use-select-context.js +16 -0
- package/dist/esm/components/ui/select/use-select-context.js.map +1 -0
- package/dist/esm/components/ui/skeleton/index.js +9 -0
- package/dist/esm/components/ui/skeleton/index.js.map +1 -0
- package/dist/esm/components/ui/skeleton/skeleton.js +16 -0
- package/dist/esm/components/ui/skeleton/skeleton.js.map +1 -0
- package/dist/esm/components/ui/skeleton/skeleton.module.css +25 -0
- package/dist/esm/components/ui/tabs/index.js +9 -0
- package/dist/esm/components/ui/tabs/index.js.map +1 -0
- package/dist/esm/components/ui/tabs/tabs.js +43 -0
- package/dist/esm/components/ui/tabs/tabs.js.map +1 -0
- package/dist/esm/components/ui/tabs/tabs.module.css +32 -0
- package/dist/esm/features/balances/components/currency-item/currency-item.js +3 -2
- package/dist/esm/features/balances/components/currency-item/currency-item.js.map +1 -1
- package/dist/esm/features/balances/components/currency-item/currency-item.module.css +5 -11
- package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js +4 -5
- package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js.map +1 -1
- package/dist/esm/features/balances/components/send-ton-button/send-ton-button.js +1 -2
- package/dist/esm/features/balances/components/send-ton-button/send-ton-button.js.map +1 -1
- package/dist/esm/features/balances/hooks/use-balance-by-address.js +4 -2
- package/dist/esm/features/balances/hooks/use-balance-by-address.js.map +1 -1
- package/dist/esm/features/balances/hooks/use-watch-balance-by-address.js +1 -1
- package/dist/esm/features/balances/hooks/use-watch-balance-by-address.js.map +1 -1
- package/dist/esm/features/balances/index.js +0 -1
- package/dist/esm/features/balances/index.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-jetton-balance-by-address.js +4 -2
- package/dist/esm/features/jettons/hooks/use-jetton-balance-by-address.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-jetton-info.js +4 -2
- package/dist/esm/features/jettons/hooks/use-jetton-info.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-jetton-wallet-address.js +4 -2
- package/dist/esm/features/jettons/hooks/use-jetton-wallet-address.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-jettons-by-address.js +4 -2
- package/dist/esm/features/jettons/hooks/use-jettons-by-address.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-transfer-jetton.js +1 -1
- package/dist/esm/features/jettons/hooks/use-transfer-jetton.js.map +1 -1
- package/dist/esm/features/jettons/hooks/use-watch-jettons-by-address.js +1 -1
- package/dist/esm/features/jettons/hooks/use-watch-jettons-by-address.js.map +1 -1
- package/dist/esm/features/network/hooks/use-block-number.js +4 -2
- package/dist/esm/features/network/hooks/use-block-number.js.map +1 -1
- package/dist/esm/features/network/hooks/use-default-network.js +1 -1
- package/dist/esm/features/network/hooks/use-default-network.js.map +1 -1
- package/dist/esm/features/network/hooks/use-networks.js +1 -1
- package/dist/esm/features/network/hooks/use-networks.js.map +1 -1
- package/dist/esm/features/nft/components/nft-item/nft-item.js +3 -3
- package/dist/esm/features/nft/components/nft-item/nft-item.js.map +1 -1
- package/dist/esm/features/nft/components/nft-item/nft-item.module.css +4 -6
- package/dist/esm/features/nft/hooks/use-nft.js +4 -2
- package/dist/esm/features/nft/hooks/use-nft.js.map +1 -1
- package/dist/esm/features/nft/hooks/use-nfts-by-address.js +4 -2
- package/dist/esm/features/nft/hooks/use-nfts-by-address.js.map +1 -1
- package/dist/esm/features/nft/hooks/use-transfer-nft.js +1 -1
- package/dist/esm/features/nft/hooks/use-transfer-nft.js.map +1 -1
- package/dist/esm/features/settings/hooks/use-app-kit-theme.js.map +1 -0
- package/dist/esm/{hooks → features/settings/hooks}/use-app-kit.js +1 -1
- package/dist/esm/features/settings/hooks/use-app-kit.js.map +1 -0
- package/dist/esm/{hooks → features/settings/hooks}/use-i18n.js +1 -1
- package/dist/esm/features/settings/hooks/use-i18n.js.map +1 -0
- package/dist/esm/features/settings/index.js +11 -0
- package/dist/esm/features/settings/index.js.map +1 -0
- package/dist/esm/features/signing/hooks/use-sign-binary.js +1 -1
- package/dist/esm/features/signing/hooks/use-sign-binary.js.map +1 -1
- package/dist/esm/features/signing/hooks/use-sign-cell.js +1 -1
- package/dist/esm/features/signing/hooks/use-sign-cell.js.map +1 -1
- package/dist/esm/features/signing/hooks/use-sign-text.js +1 -1
- package/dist/esm/features/signing/hooks/use-sign-text.js.map +1 -1
- package/dist/esm/features/staking/components/select-unstake-mode/index.js +9 -0
- package/dist/esm/features/staking/components/select-unstake-mode/index.js.map +1 -0
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js +56 -0
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js.map +1 -0
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.module.css +111 -0
- package/dist/esm/features/staking/components/staking-balance-block/index.js +9 -0
- package/dist/esm/features/staking/components/staking-balance-block/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-balance-block/staking-balance-block.js +25 -0
- package/dist/esm/features/staking/components/staking-balance-block/staking-balance-block.js.map +1 -0
- package/dist/esm/features/staking/components/staking-balance-block/staking-balance-block.module.css +40 -0
- package/dist/esm/features/staking/components/staking-info/index.js +9 -0
- package/dist/esm/features/staking/components/staking-info/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-info/staking-info.js +13 -0
- package/dist/esm/features/staking/components/staking-info/staking-info.js.map +1 -0
- package/dist/esm/features/staking/components/staking-info/utils.js +13 -0
- package/dist/esm/features/staking/components/staking-info/utils.js.map +1 -0
- package/dist/esm/features/staking/components/staking-settings-modal/index.js +9 -0
- package/dist/esm/features/staking/components/staking-settings-modal/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-settings-modal/staking-settings-modal.js +38 -0
- package/dist/esm/features/staking/components/staking-settings-modal/staking-settings-modal.js.map +1 -0
- package/dist/esm/features/staking/components/staking-settings-modal/staking-settings-modal.module.css +24 -0
- package/dist/esm/features/staking/components/staking-widget/index.js +9 -0
- package/dist/esm/features/staking/components/staking-widget/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget/staking-widget.js +21 -0
- package/dist/esm/features/staking/components/staking-widget/staking-widget.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-provider/index.js +9 -0
- package/dist/esm/features/staking/components/staking-widget-provider/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-provider/staking-widget-provider.js +274 -0
- package/dist/esm/features/staking/components/staking-widget-provider/staking-widget-provider.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-provider/use-staking-validation.js +48 -0
- package/dist/esm/features/staking/components/staking-widget-provider/use-staking-validation.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-ui/index.js +9 -0
- package/dist/esm/features/staking/components/staking-widget-ui/index.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js +36 -0
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js.map +1 -0
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.module.css +35 -0
- package/dist/esm/features/staking/hooks/use-build-stake-transaction.js +1 -1
- package/dist/esm/features/staking/hooks/use-build-stake-transaction.js.map +1 -1
- package/dist/esm/features/staking/hooks/use-staked-balance.js +4 -2
- package/dist/esm/features/staking/hooks/use-staked-balance.js.map +1 -1
- package/dist/esm/features/staking/hooks/use-staking-provider-info.js +10 -2
- package/dist/esm/features/staking/hooks/use-staking-provider-info.js.map +1 -1
- package/dist/esm/features/staking/hooks/use-staking-provider-metadata.js +28 -0
- package/dist/esm/features/staking/hooks/use-staking-provider-metadata.js.map +1 -0
- package/dist/esm/features/staking/hooks/use-staking-provider.js +30 -0
- package/dist/esm/features/staking/hooks/use-staking-provider.js.map +1 -0
- package/dist/esm/features/staking/hooks/use-staking-providers.js +12 -6
- package/dist/esm/features/staking/hooks/use-staking-providers.js.map +1 -1
- package/dist/esm/features/staking/hooks/use-staking-quote.js +4 -2
- package/dist/esm/features/staking/hooks/use-staking-quote.js.map +1 -1
- package/dist/esm/features/staking/index.js +10 -1
- package/dist/esm/features/staking/index.js.map +1 -1
- package/dist/esm/features/staking/utils/map-staking-error.js +25 -0
- package/dist/esm/features/staking/utils/map-staking-error.js.map +1 -0
- package/dist/esm/features/swap/components/swap-field/index.js +9 -0
- package/dist/esm/features/swap/components/swap-field/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-field/swap-field.js +17 -0
- package/dist/esm/features/swap/components/swap-field/swap-field.js.map +1 -0
- package/dist/esm/features/swap/components/swap-field/swap-field.module.css +65 -0
- package/dist/esm/features/swap/components/swap-flip-button/index.js +9 -0
- package/dist/esm/features/swap/components/swap-flip-button/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-flip-button/swap-flip-button.js +9 -0
- package/dist/esm/features/swap/components/swap-flip-button/swap-flip-button.js.map +1 -0
- package/dist/esm/features/swap/components/swap-flip-button/swap-flip-button.module.css +32 -0
- package/dist/esm/features/swap/components/swap-info/index.js +9 -0
- package/dist/esm/features/swap/components/swap-info/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-info/swap-info.js +12 -0
- package/dist/esm/features/swap/components/swap-info/swap-info.js.map +1 -0
- package/dist/esm/features/swap/components/swap-settings-modal/index.js +9 -0
- package/dist/esm/features/swap/components/swap-settings-modal/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-settings-modal/swap-settings-modal.js +41 -0
- package/dist/esm/features/swap/components/swap-settings-modal/swap-settings-modal.js.map +1 -0
- package/dist/esm/features/swap/components/swap-settings-modal/swap-settings-modal.module.css +24 -0
- package/dist/esm/features/swap/components/swap-token-select-modal/index.js +9 -0
- package/dist/esm/features/swap/components/swap-token-select-modal/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-token-select-modal/swap-token-select-modal.js +8 -0
- package/dist/esm/features/swap/components/swap-token-select-modal/swap-token-select-modal.js.map +1 -0
- package/dist/esm/features/swap/components/swap-token-select-modal/swap-token-select-modal.module.css +67 -0
- package/dist/esm/{components/circle-icon → features/swap/components/swap-widget}/index.js +1 -1
- package/dist/esm/features/swap/components/swap-widget/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget/swap-widget.js +21 -0
- package/dist/esm/features/swap/components/swap-widget/swap-widget.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-provider/index.js +9 -0
- package/dist/esm/features/swap/components/swap-widget-provider/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-provider/swap-widget-provider.js +237 -0
- package/dist/esm/features/swap/components/swap-widget-provider/swap-widget-provider.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-balances.js +38 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-balances.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-token-state.js +62 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-token-state.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-validation.js +28 -0
- package/dist/esm/features/swap/components/swap-widget-provider/use-swap-validation.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-ui/index.js +9 -0
- package/dist/esm/features/swap/components/swap-widget-ui/index.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-ui/swap-widget-ui.js +49 -0
- package/dist/esm/features/swap/components/swap-widget-ui/swap-widget-ui.js.map +1 -0
- package/dist/esm/features/swap/components/swap-widget-ui/swap-widget-ui.module.css +51 -0
- package/dist/esm/features/swap/components/token-selector/index.js +9 -0
- package/dist/esm/features/swap/components/token-selector/index.js.map +1 -0
- package/dist/esm/features/swap/components/token-selector/token-selector.js +13 -0
- package/dist/esm/features/swap/components/token-selector/token-selector.js.map +1 -0
- package/dist/esm/features/swap/components/token-selector/token-selector.module.css +12 -0
- package/dist/esm/features/swap/hooks/use-build-swap-transaction.js +4 -1
- package/dist/esm/features/swap/hooks/use-build-swap-transaction.js.map +1 -1
- package/dist/esm/features/swap/hooks/use-swap-provider.js +34 -0
- package/dist/esm/features/swap/hooks/use-swap-provider.js.map +1 -0
- package/dist/esm/features/swap/hooks/use-swap-providers.js +24 -0
- package/dist/esm/features/swap/hooks/use-swap-providers.js.map +1 -0
- package/dist/esm/features/swap/hooks/use-swap-quote.js +7 -2
- package/dist/esm/features/swap/hooks/use-swap-quote.js.map +1 -1
- package/dist/esm/features/swap/index.js +8 -0
- package/dist/esm/features/swap/index.js.map +1 -1
- package/dist/esm/features/swap/utils/get-display-amount.js +19 -0
- package/dist/esm/features/swap/utils/get-display-amount.js.map +1 -0
- package/dist/esm/features/swap/utils/map-swap-error.js +29 -0
- package/dist/esm/features/swap/utils/map-swap-error.js.map +1 -0
- package/dist/esm/features/swap/utils/map-swap-widget-tokens.js +26 -0
- package/dist/esm/features/swap/utils/map-swap-widget-tokens.js.map +1 -0
- package/dist/esm/features/transaction/components/transaction/send.js +2 -2
- package/dist/esm/features/transaction/components/transaction/send.js.map +1 -1
- package/dist/esm/features/transaction/components/transaction-progress/transaction-progress-icons.js +7 -8
- package/dist/esm/features/transaction/components/transaction-progress/transaction-progress-icons.js.map +1 -1
- package/dist/esm/features/transaction/components/transaction-progress/transaction-progress.js +1 -1
- package/dist/esm/features/transaction/components/transaction-progress/transaction-progress.js.map +1 -1
- package/dist/esm/features/transaction/components/transaction-progress/transaction-progress.module.css +3 -3
- package/dist/esm/features/transaction/hooks/use-send-transaction.js +1 -1
- package/dist/esm/features/transaction/hooks/use-send-transaction.js.map +1 -1
- package/dist/esm/features/transaction/hooks/use-transaction-status.js +4 -2
- package/dist/esm/features/transaction/hooks/use-transaction-status.js.map +1 -1
- package/dist/esm/features/transaction/hooks/use-transfer-ton.js +1 -1
- package/dist/esm/features/transaction/hooks/use-transfer-ton.js.map +1 -1
- package/dist/esm/features/transaction/hooks/use-watch-transactions-by-address.js +1 -1
- package/dist/esm/features/transaction/hooks/use-watch-transactions-by-address.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-connect.js +1 -1
- package/dist/esm/features/wallets/hooks/use-connect.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-connected-wallets.js +1 -1
- package/dist/esm/features/wallets/hooks/use-connected-wallets.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-connector-by-id.js +1 -1
- package/dist/esm/features/wallets/hooks/use-connector-by-id.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-connectors.js +1 -1
- package/dist/esm/features/wallets/hooks/use-connectors.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-disconnect.js +1 -1
- package/dist/esm/features/wallets/hooks/use-disconnect.js.map +1 -1
- package/dist/esm/features/wallets/hooks/use-selected-wallet.js +1 -1
- package/dist/esm/features/wallets/hooks/use-selected-wallet.js.map +1 -1
- package/dist/esm/hooks/use-debounce-callback.js +41 -0
- package/dist/esm/hooks/use-debounce-callback.js.map +1 -0
- package/dist/esm/hooks/use-debounce-value.js +23 -0
- package/dist/esm/hooks/use-debounce-value.js.map +1 -0
- package/dist/esm/hooks/use-unmount.js +14 -0
- package/dist/esm/hooks/use-unmount.js.map +1 -0
- package/dist/esm/index.js +19 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/locales/en.js +75 -0
- package/dist/esm/locales/en.js.map +1 -1
- package/dist/esm/styles/index.css +106 -60
- package/dist/esm/styles/typography.module.css +104 -54
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/{src/components/ton-icon/index.ts → dist/esm/types/appkit-ui-token.js} +2 -2
- package/dist/esm/types/appkit-ui-token.js.map +1 -0
- package/dist/esm/utils/map-defi-error.js +34 -0
- package/dist/esm/utils/map-defi-error.js.map +1 -0
- package/dist/esm/utils/validate-amount.js +30 -0
- package/dist/esm/utils/validate-amount.js.map +1 -0
- package/dist/types/components/shared/amount-presets/amount-presets.d.ts +20 -0
- package/dist/types/components/shared/amount-presets/amount-presets.d.ts.map +1 -0
- package/dist/types/components/shared/amount-presets/index.d.ts +10 -0
- package/dist/types/components/shared/amount-presets/index.d.ts.map +1 -0
- package/dist/types/components/shared/button-with-connect/button-with-connect.d.ts +11 -0
- package/dist/types/components/shared/button-with-connect/button-with-connect.d.ts.map +1 -0
- package/dist/types/components/{ton-icon → shared/button-with-connect}/index.d.ts +1 -1
- package/dist/types/components/shared/button-with-connect/index.d.ts.map +1 -0
- package/dist/types/components/shared/low-balance-modal/index.d.ts +10 -0
- package/dist/types/components/shared/low-balance-modal/index.d.ts.map +1 -0
- package/dist/types/components/shared/low-balance-modal/low-balance-modal.d.ts +23 -0
- package/dist/types/components/shared/low-balance-modal/low-balance-modal.d.ts.map +1 -0
- package/dist/types/components/shared/option-switcher/index.d.ts +9 -0
- package/dist/types/components/shared/option-switcher/index.d.ts.map +1 -0
- package/dist/types/components/shared/option-switcher/option-switcher.d.ts +28 -0
- package/dist/types/components/shared/option-switcher/option-switcher.d.ts.map +1 -0
- package/dist/types/components/shared/settings-button/index.d.ts +9 -0
- package/dist/types/components/shared/settings-button/index.d.ts.map +1 -0
- package/dist/types/components/shared/settings-button/settings-button.d.ts +14 -0
- package/dist/types/components/shared/settings-button/settings-button.d.ts.map +1 -0
- package/dist/types/components/shared/token-select-modal/index.d.ts +10 -0
- package/dist/types/components/shared/token-select-modal/index.d.ts.map +1 -0
- package/dist/types/components/shared/token-select-modal/token-select-modal.d.ts +19 -0
- package/dist/types/components/shared/token-select-modal/token-select-modal.d.ts.map +1 -0
- package/dist/types/components/ui/amount-reversed/amount-reversed.d.ts +19 -0
- package/dist/types/components/ui/amount-reversed/amount-reversed.d.ts.map +1 -0
- package/dist/types/components/ui/amount-reversed/index.d.ts +10 -0
- package/dist/types/components/ui/amount-reversed/index.d.ts.map +1 -0
- package/dist/types/components/ui/block/block.d.ts.map +1 -0
- package/dist/types/components/ui/block/index.d.ts.map +1 -0
- package/dist/types/components/ui/button/button.d.ts +31 -0
- package/dist/types/components/ui/button/button.d.ts.map +1 -0
- package/dist/types/components/ui/button/index.d.ts +10 -0
- package/dist/types/components/ui/button/index.d.ts.map +1 -0
- package/dist/types/components/ui/centered-amount-input/centered-amount-input.d.ts +17 -0
- package/dist/types/components/ui/centered-amount-input/centered-amount-input.d.ts.map +1 -0
- package/dist/types/components/ui/centered-amount-input/index.d.ts +10 -0
- package/dist/types/components/ui/centered-amount-input/index.d.ts.map +1 -0
- package/dist/types/components/{button/button.d.ts → ui/collapsible/collapsible.d.ts} +5 -2
- package/dist/types/components/ui/collapsible/collapsible.d.ts.map +1 -0
- package/dist/types/components/ui/collapsible/index.d.ts +10 -0
- package/dist/types/components/ui/collapsible/index.d.ts.map +1 -0
- package/dist/types/components/ui/dialog/dialog.d.ts +27 -0
- package/dist/types/components/ui/dialog/dialog.d.ts.map +1 -0
- package/dist/types/components/ui/dialog/index.d.ts +9 -0
- package/dist/types/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/types/components/ui/dialog/use-dialog-context.d.ts +15 -0
- package/dist/types/components/ui/dialog/use-dialog-context.d.ts.map +1 -0
- package/dist/types/components/ui/icons/chevron-down-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/chevron-down-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/chevrons-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/chevrons-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/close-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/close-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/failed-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/failed-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/flip-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/flip-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/image-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/image-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/index.d.ts +21 -0
- package/dist/types/components/ui/icons/index.d.ts.map +1 -0
- package/dist/types/components/ui/icons/search-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/search-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/sliders-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/sliders-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/spinner-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/spinner-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/success-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/success-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/ton-icon.d.ts +12 -0
- package/dist/types/components/ui/icons/ton-icon.d.ts.map +1 -0
- package/dist/types/components/ui/icons/types.d.ts +20 -0
- package/dist/types/components/ui/icons/types.d.ts.map +1 -0
- package/dist/types/components/ui/icons/verified-icon.d.ts +11 -0
- package/dist/types/components/ui/icons/verified-icon.d.ts.map +1 -0
- package/dist/types/components/ui/info-block/index.d.ts +9 -0
- package/dist/types/components/ui/info-block/index.d.ts.map +1 -0
- package/dist/types/components/ui/info-block/info-block.d.ts +18 -0
- package/dist/types/components/ui/info-block/info-block.d.ts.map +1 -0
- package/dist/types/components/ui/input/index.d.ts +9 -0
- package/dist/types/components/ui/input/index.d.ts.map +1 -0
- package/dist/types/components/ui/input/input.d.ts +40 -0
- package/dist/types/components/ui/input/input.d.ts.map +1 -0
- package/dist/types/components/ui/input/use-input-resize.d.ts +31 -0
- package/dist/types/components/ui/input/use-input-resize.d.ts.map +1 -0
- package/dist/types/components/ui/logo/index.d.ts +9 -0
- package/dist/types/components/ui/logo/index.d.ts.map +1 -0
- package/dist/types/components/ui/logo/logo.d.ts +16 -0
- package/dist/types/components/ui/logo/logo.d.ts.map +1 -0
- package/dist/types/components/ui/logo/use-image-loading-status.d.ts +10 -0
- package/dist/types/components/ui/logo/use-image-loading-status.d.ts.map +1 -0
- package/dist/types/components/ui/modal/index.d.ts +9 -0
- package/dist/types/components/ui/modal/index.d.ts.map +1 -0
- package/dist/types/components/ui/modal/modal.d.ts +32 -0
- package/dist/types/components/ui/modal/modal.d.ts.map +1 -0
- package/dist/types/components/ui/select/index.d.ts +9 -0
- package/dist/types/components/ui/select/index.d.ts.map +1 -0
- package/dist/types/components/ui/select/select.d.ts +44 -0
- package/dist/types/components/ui/select/select.d.ts.map +1 -0
- package/dist/types/components/ui/select/use-select-context.d.ts +20 -0
- package/dist/types/components/ui/select/use-select-context.d.ts.map +1 -0
- package/dist/types/components/ui/skeleton/index.d.ts +10 -0
- package/dist/types/components/ui/skeleton/index.d.ts.map +1 -0
- package/dist/types/components/ui/skeleton/skeleton.d.ts +14 -0
- package/dist/types/components/ui/skeleton/skeleton.d.ts.map +1 -0
- package/dist/types/components/ui/tabs/index.d.ts +10 -0
- package/dist/types/components/ui/tabs/index.d.ts.map +1 -0
- package/dist/types/components/ui/tabs/tabs.d.ts +30 -0
- package/dist/types/components/ui/tabs/tabs.d.ts.map +1 -0
- package/dist/types/features/balances/components/currency-item/currency-item.d.ts.map +1 -1
- package/dist/types/features/balances/components/send-jetton-button/send-jetton-button.d.ts.map +1 -1
- package/dist/types/features/balances/components/send-ton-button/send-ton-button.d.ts.map +1 -1
- package/dist/types/features/balances/hooks/use-balance-by-address.d.ts.map +1 -1
- package/dist/types/features/balances/index.d.ts +0 -1
- package/dist/types/features/balances/index.d.ts.map +1 -1
- package/dist/types/features/jettons/hooks/use-jetton-balance-by-address.d.ts.map +1 -1
- package/dist/types/features/jettons/hooks/use-jetton-info.d.ts.map +1 -1
- package/dist/types/features/jettons/hooks/use-jetton-wallet-address.d.ts.map +1 -1
- package/dist/types/features/jettons/hooks/use-jettons-by-address.d.ts.map +1 -1
- package/dist/types/features/network/hooks/use-block-number.d.ts.map +1 -1
- package/dist/types/features/nft/components/nft-item/nft-item.d.ts.map +1 -1
- package/dist/types/features/nft/hooks/use-nft.d.ts.map +1 -1
- package/dist/types/features/nft/hooks/use-nfts-by-address.d.ts.map +1 -1
- package/dist/types/features/settings/hooks/use-app-kit-theme.d.ts.map +1 -0
- package/dist/types/features/settings/hooks/use-app-kit.d.ts.map +1 -0
- package/dist/types/{hooks → features/settings/hooks}/use-i18n.d.ts +1 -1
- package/dist/types/features/settings/hooks/use-i18n.d.ts.map +1 -0
- package/dist/types/features/settings/index.d.ts +11 -0
- package/dist/types/features/settings/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/select-unstake-mode/index.d.ts +10 -0
- package/dist/types/features/staking/components/select-unstake-mode/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/select-unstake-mode/select-unstake-mode.d.ts +17 -0
- package/dist/types/features/staking/components/select-unstake-mode/select-unstake-mode.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-balance-block/index.d.ts +9 -0
- package/dist/types/features/staking/components/staking-balance-block/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-balance-block/staking-balance-block.d.ts +21 -0
- package/dist/types/features/staking/components/staking-balance-block/staking-balance-block.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-info/index.d.ts +10 -0
- package/dist/types/features/staking/components/staking-info/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-info/staking-info.d.ts +21 -0
- package/dist/types/features/staking/components/staking-info/staking-info.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-info/utils.d.ts +9 -0
- package/dist/types/features/staking/components/staking-info/utils.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-settings-modal/index.d.ts +9 -0
- package/dist/types/features/staking/components/staking-settings-modal/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-settings-modal/staking-settings-modal.d.ts +19 -0
- package/dist/types/features/staking/components/staking-settings-modal/staking-settings-modal.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget/index.d.ts +9 -0
- package/dist/types/features/staking/components/staking-widget/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget/staking-widget.d.ts +30 -0
- package/dist/types/features/staking/components/staking-widget/staking-widget.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget-provider/index.d.ts +9 -0
- package/dist/types/features/staking/components/staking-widget-provider/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget-provider/staking-widget-provider.d.ts +98 -0
- package/dist/types/features/staking/components/staking-widget-provider/staking-widget-provider.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget-provider/use-staking-validation.d.ts +26 -0
- package/dist/types/features/staking/components/staking-widget-provider/use-staking-validation.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget-ui/index.d.ts +9 -0
- package/dist/types/features/staking/components/staking-widget-ui/index.d.ts.map +1 -0
- package/dist/types/features/staking/components/staking-widget-ui/staking-widget-ui.d.ts +12 -0
- package/dist/types/features/staking/components/staking-widget-ui/staking-widget-ui.d.ts.map +1 -0
- package/dist/types/features/staking/hooks/use-staked-balance.d.ts.map +1 -1
- package/dist/types/features/staking/hooks/use-staking-provider-info.d.ts.map +1 -1
- package/dist/types/features/staking/hooks/use-staking-provider-metadata.d.ts +15 -0
- package/dist/types/features/staking/hooks/use-staking-provider-metadata.d.ts.map +1 -0
- package/dist/types/features/staking/hooks/use-staking-provider.d.ts +14 -0
- package/dist/types/features/staking/hooks/use-staking-provider.d.ts.map +1 -0
- package/dist/types/features/staking/hooks/use-staking-providers.d.ts +4 -6
- package/dist/types/features/staking/hooks/use-staking-providers.d.ts.map +1 -1
- package/dist/types/features/staking/hooks/use-staking-quote.d.ts.map +1 -1
- package/dist/types/features/staking/index.d.ts +10 -1
- package/dist/types/features/staking/index.d.ts.map +1 -1
- package/dist/types/features/staking/utils/map-staking-error.d.ts +13 -0
- package/dist/types/features/staking/utils/map-staking-error.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-field/index.d.ts +9 -0
- package/dist/types/features/swap/components/swap-field/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-field/swap-field.d.ts +25 -0
- package/dist/types/features/swap/components/swap-field/swap-field.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-flip-button/index.d.ts +9 -0
- package/dist/types/features/swap/components/swap-flip-button/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-flip-button/swap-flip-button.d.ts +14 -0
- package/dist/types/features/swap/components/swap-flip-button/swap-flip-button.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-info/index.d.ts +9 -0
- package/dist/types/features/swap/components/swap-info/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-info/swap-info.d.ts +20 -0
- package/dist/types/features/swap/components/swap-info/swap-info.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-settings-modal/index.d.ts +10 -0
- package/dist/types/features/swap/components/swap-settings-modal/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-settings-modal/swap-settings-modal.d.ts +20 -0
- package/dist/types/features/swap/components/swap-settings-modal/swap-settings-modal.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-token-select-modal/index.d.ts +10 -0
- package/dist/types/features/swap/components/swap-token-select-modal/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-token-select-modal/swap-token-select-modal.d.ts +12 -0
- package/dist/types/features/swap/components/swap-token-select-modal/swap-token-select-modal.d.ts.map +1 -0
- package/dist/types/{components/circle-icon → features/swap/components/swap-widget}/index.d.ts +1 -1
- package/dist/types/features/swap/components/swap-widget/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget/swap-widget.d.ts +31 -0
- package/dist/types/features/swap/components/swap-widget/swap-widget.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-provider/index.d.ts +9 -0
- package/dist/types/features/swap/components/swap-widget-provider/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-provider/swap-widget-provider.d.ts +106 -0
- package/dist/types/features/swap/components/swap-widget-provider/swap-widget-provider.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-balances.d.ts +23 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-balances.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-token-state.d.ts +24 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-token-state.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-validation.d.ts +23 -0
- package/dist/types/features/swap/components/swap-widget-provider/use-swap-validation.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-ui/index.d.ts +9 -0
- package/dist/types/features/swap/components/swap-widget-ui/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/swap-widget-ui/swap-widget-ui.d.ts +12 -0
- package/dist/types/features/swap/components/swap-widget-ui/swap-widget-ui.d.ts.map +1 -0
- package/dist/types/features/swap/components/token-selector/index.d.ts +9 -0
- package/dist/types/features/swap/components/token-selector/index.d.ts.map +1 -0
- package/dist/types/features/swap/components/token-selector/token-selector.d.ts +15 -0
- package/dist/types/features/swap/components/token-selector/token-selector.d.ts.map +1 -0
- package/dist/types/features/swap/hooks/use-build-swap-transaction.d.ts +3 -0
- package/dist/types/features/swap/hooks/use-build-swap-transaction.d.ts.map +1 -1
- package/dist/types/features/swap/hooks/use-swap-provider.d.ts +15 -0
- package/dist/types/features/swap/hooks/use-swap-provider.d.ts.map +1 -0
- package/dist/types/features/swap/hooks/use-swap-providers.d.ts +14 -0
- package/dist/types/features/swap/hooks/use-swap-providers.d.ts.map +1 -0
- package/dist/types/features/swap/hooks/use-swap-quote.d.ts +3 -0
- package/dist/types/features/swap/hooks/use-swap-quote.d.ts.map +1 -1
- package/dist/types/features/swap/index.d.ts +8 -0
- package/dist/types/features/swap/index.d.ts.map +1 -1
- package/dist/types/features/swap/utils/get-display-amount.d.ts +13 -0
- package/dist/types/features/swap/utils/get-display-amount.d.ts.map +1 -0
- package/dist/types/features/swap/utils/map-swap-error.d.ts +13 -0
- package/dist/types/features/swap/utils/map-swap-error.d.ts.map +1 -0
- package/dist/types/features/swap/utils/map-swap-widget-tokens.d.ts +10 -0
- package/dist/types/features/swap/utils/map-swap-widget-tokens.d.ts.map +1 -0
- package/dist/types/features/transaction/components/transaction/send.d.ts +3 -2
- package/dist/types/features/transaction/components/transaction/send.d.ts.map +1 -1
- package/dist/types/features/transaction/components/transaction-progress/transaction-progress-icons.d.ts.map +1 -1
- package/dist/types/features/transaction/hooks/use-transaction-status.d.ts.map +1 -1
- package/dist/types/hooks/use-debounce-callback.d.ts +17 -0
- package/dist/types/hooks/use-debounce-callback.d.ts.map +1 -0
- package/dist/types/hooks/use-debounce-value.d.ts +15 -0
- package/dist/types/hooks/use-debounce-value.d.ts.map +1 -0
- package/dist/types/hooks/use-unmount.d.ts +9 -0
- package/dist/types/hooks/use-unmount.d.ts.map +1 -0
- package/dist/types/index.d.ts +19 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/libs/i18n.d.ts +70 -0
- package/dist/types/libs/i18n.d.ts.map +1 -1
- package/dist/types/locales/en.d.ts +70 -0
- package/dist/types/locales/en.d.ts.map +1 -1
- package/dist/types/types/appkit-ui-token.d.ts +25 -0
- package/dist/types/types/appkit-ui-token.d.ts.map +1 -0
- package/dist/types/utils/map-defi-error.d.ts +14 -0
- package/dist/types/utils/map-defi-error.d.ts.map +1 -0
- package/dist/types/utils/validate-amount.d.ts +18 -0
- package/dist/types/utils/validate-amount.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/shared/amount-presets/amount-presets.tsx +50 -0
- package/src/components/shared/amount-presets/index.ts +10 -0
- package/src/components/shared/button-with-connect/button-with-connect.tsx +37 -0
- package/src/components/shared/button-with-connect/index.ts +9 -0
- package/src/components/shared/low-balance-modal/index.ts +10 -0
- package/src/components/shared/low-balance-modal/low-balance-modal.tsx +58 -0
- package/src/components/{button → shared/option-switcher}/index.ts +1 -1
- package/src/components/shared/option-switcher/option-switcher.tsx +55 -0
- package/src/{features/balances/components/balance-badge → components/shared/settings-button}/index.ts +1 -1
- package/src/components/shared/settings-button/settings-button.tsx +33 -0
- package/src/components/shared/token-select-modal/index.ts +10 -0
- package/src/components/shared/token-select-modal/token-select-modal.tsx +103 -0
- package/src/components/ui/amount-reversed/amount-reversed.tsx +65 -0
- package/src/components/ui/amount-reversed/index.ts +10 -0
- package/src/components/ui/button/button.tsx +100 -0
- package/{dist/types/components/button/index.d.ts → src/components/ui/button/index.ts} +2 -1
- package/src/components/ui/centered-amount-input/centered-amount-input.tsx +118 -0
- package/src/components/ui/centered-amount-input/index.ts +10 -0
- package/src/components/ui/collapsible/collapsible.tsx +54 -0
- package/src/components/ui/collapsible/index.ts +10 -0
- package/src/components/ui/dialog/dialog.tsx +105 -0
- package/src/components/{circle-icon → ui/dialog}/index.ts +1 -1
- package/src/components/ui/dialog/use-dialog-context.ts +23 -0
- package/src/components/ui/icons/chevron-down-icon.tsx +26 -0
- package/src/components/ui/icons/chevrons-icon.tsx +39 -0
- package/src/components/ui/icons/close-icon.tsx +32 -0
- package/src/components/ui/icons/failed-icon.tsx +32 -0
- package/src/components/ui/icons/flip-icon.tsx +39 -0
- package/src/components/ui/icons/image-icon.tsx +32 -0
- package/src/components/ui/icons/index.ts +21 -0
- package/src/components/ui/icons/search-icon.tsx +29 -0
- package/src/components/ui/icons/sliders-icon.tsx +31 -0
- package/src/components/ui/icons/spinner-icon.tsx +30 -0
- package/src/components/ui/icons/success-icon.tsx +31 -0
- package/src/components/ui/icons/ton-icon.tsx +50 -0
- package/src/components/ui/icons/types.ts +22 -0
- package/src/components/ui/icons/verified-icon.tsx +30 -0
- package/src/components/ui/info-block/index.ts +9 -0
- package/src/components/ui/info-block/info-block.tsx +47 -0
- package/src/components/ui/input/index.ts +9 -0
- package/src/components/ui/input/input.tsx +194 -0
- package/src/components/ui/input/use-input-resize.ts +96 -0
- package/src/components/ui/logo/index.ts +9 -0
- package/src/components/ui/logo/logo.tsx +106 -0
- package/src/components/ui/logo/use-image-loading-status.ts +50 -0
- package/src/components/ui/modal/index.ts +9 -0
- package/src/components/ui/modal/modal.tsx +57 -0
- package/src/components/ui/select/index.ts +9 -0
- package/src/components/ui/select/select.tsx +274 -0
- package/src/components/ui/select/use-select-context.ts +28 -0
- package/src/components/ui/skeleton/index.ts +10 -0
- package/src/components/ui/skeleton/skeleton.tsx +33 -0
- package/src/components/ui/tabs/index.ts +10 -0
- package/src/components/ui/tabs/tabs.tsx +116 -0
- package/src/features/balances/components/currency-item/currency-item.tsx +12 -15
- package/src/features/balances/components/send-jetton-button/send-jetton-button.tsx +4 -5
- package/src/features/balances/components/send-ton-button/send-ton-button.tsx +1 -2
- package/src/features/balances/hooks/use-balance-by-address.ts +6 -2
- package/src/features/balances/hooks/use-watch-balance-by-address.ts +1 -1
- package/src/features/balances/index.ts +0 -1
- package/src/features/jettons/hooks/use-jetton-balance-by-address.ts +6 -2
- package/src/features/jettons/hooks/use-jetton-info.ts +4 -2
- package/src/features/jettons/hooks/use-jetton-wallet-address.ts +6 -2
- package/src/features/jettons/hooks/use-jettons-by-address.ts +6 -2
- package/src/features/jettons/hooks/use-transfer-jetton.ts +1 -1
- package/src/features/jettons/hooks/use-watch-jettons-by-address.ts +1 -1
- package/src/features/network/hooks/use-block-number.ts +6 -2
- package/src/features/network/hooks/use-default-network.ts +1 -1
- package/src/features/network/hooks/use-networks.ts +1 -1
- package/src/features/nft/components/nft-item/nft-item.tsx +3 -13
- package/src/features/nft/hooks/use-nft.ts +4 -2
- package/src/features/nft/hooks/use-nfts-by-address.ts +4 -2
- package/src/features/nft/hooks/use-transfer-nft.ts +1 -1
- package/src/{hooks → features/settings/hooks}/use-app-kit.ts +1 -1
- package/src/{hooks → features/settings/hooks}/use-i18n.ts +1 -1
- package/src/features/settings/index.ts +11 -0
- package/src/features/signing/hooks/use-sign-binary.ts +1 -1
- package/src/features/signing/hooks/use-sign-cell.ts +1 -1
- package/src/features/signing/hooks/use-sign-text.ts +1 -1
- package/src/features/staking/components/select-unstake-mode/index.ts +10 -0
- package/src/features/staking/components/select-unstake-mode/select-unstake-mode.tsx +136 -0
- package/src/features/staking/components/staking-balance-block/index.ts +9 -0
- package/src/features/staking/components/staking-balance-block/staking-balance-block.tsx +90 -0
- package/src/features/staking/components/staking-info/index.ts +10 -0
- package/src/features/staking/components/staking-info/staking-info.tsx +95 -0
- package/src/features/staking/components/staking-info/utils.ts +15 -0
- package/src/features/staking/components/staking-settings-modal/index.ts +9 -0
- package/src/features/staking/components/staking-settings-modal/staking-settings-modal.tsx +76 -0
- package/src/features/staking/components/staking-widget/index.ts +9 -0
- package/src/features/staking/components/staking-widget/staking-widget.tsx +54 -0
- package/src/features/staking/components/staking-widget-provider/index.ts +9 -0
- package/src/features/staking/components/staking-widget-provider/staking-widget-provider.tsx +421 -0
- package/src/features/staking/components/staking-widget-provider/use-staking-validation.ts +79 -0
- package/src/features/staking/components/staking-widget-ui/index.ts +9 -0
- package/src/features/staking/components/staking-widget-ui/staking-widget-ui.tsx +200 -0
- package/src/features/staking/hooks/use-build-stake-transaction.ts +1 -1
- package/src/features/staking/hooks/use-staked-balance.ts +7 -2
- package/src/features/staking/hooks/use-staking-provider-info.ts +13 -2
- package/src/features/staking/hooks/use-staking-provider-metadata.ts +34 -0
- package/src/features/staking/hooks/use-staking-provider.ts +42 -0
- package/src/features/staking/hooks/use-staking-providers.ts +20 -20
- package/src/features/staking/hooks/use-staking-quote.ts +7 -2
- package/src/features/staking/index.ts +15 -5
- package/src/features/staking/utils/map-staking-error.ts +28 -0
- package/src/features/swap/components/swap-field/index.ts +9 -0
- package/src/features/swap/components/swap-field/swap-field.tsx +114 -0
- package/src/features/swap/components/swap-flip-button/index.ts +9 -0
- package/src/features/swap/components/swap-flip-button/swap-flip-button.tsx +29 -0
- package/src/features/swap/components/swap-info/index.ts +9 -0
- package/src/features/swap/components/swap-info/swap-info.tsx +48 -0
- package/src/features/swap/components/swap-settings-modal/index.ts +10 -0
- package/src/features/swap/components/swap-settings-modal/swap-settings-modal.tsx +92 -0
- package/src/features/swap/components/swap-token-select-modal/index.ts +10 -0
- package/src/features/swap/components/swap-token-select-modal/swap-token-select-modal.tsx +21 -0
- package/src/features/swap/components/swap-widget/index.ts +9 -0
- package/src/features/swap/components/swap-widget/swap-widget.tsx +70 -0
- package/src/features/swap/components/swap-widget-provider/index.ts +9 -0
- package/src/features/swap/components/swap-widget-provider/swap-widget-provider.tsx +379 -0
- package/src/features/swap/components/swap-widget-provider/use-swap-balances.ts +53 -0
- package/src/features/swap/components/swap-widget-provider/use-swap-token-state.ts +96 -0
- package/src/features/swap/components/swap-widget-provider/use-swap-validation.ts +51 -0
- package/src/features/swap/components/swap-widget-ui/index.ts +9 -0
- package/src/features/swap/components/swap-widget-ui/swap-widget-ui.tsx +168 -0
- package/src/features/swap/components/token-selector/index.ts +9 -0
- package/src/features/swap/components/token-selector/token-selector.tsx +35 -0
- package/src/features/swap/hooks/use-build-swap-transaction.ts +4 -1
- package/src/features/swap/hooks/use-swap-provider.ts +49 -0
- package/src/features/swap/hooks/use-swap-providers.ts +35 -0
- package/src/features/swap/hooks/use-swap-quote.ts +7 -2
- package/src/features/swap/index.ts +9 -0
- package/src/features/swap/utils/get-display-amount.ts +21 -0
- package/src/features/swap/utils/map-swap-error.ts +32 -0
- package/src/features/swap/utils/map-swap-widget-tokens.ts +34 -0
- package/src/features/transaction/components/transaction/send.tsx +6 -5
- package/src/features/transaction/components/transaction-progress/transaction-progress-icons.tsx +13 -57
- package/src/features/transaction/components/transaction-progress/transaction-progress.tsx +1 -1
- package/src/features/transaction/hooks/use-send-transaction.ts +1 -1
- package/src/features/transaction/hooks/use-transaction-status.ts +6 -2
- package/src/features/transaction/hooks/use-transfer-ton.ts +1 -1
- package/src/features/transaction/hooks/use-watch-transactions-by-address.ts +1 -1
- package/src/features/wallets/hooks/use-connect.ts +1 -1
- package/src/features/wallets/hooks/use-connected-wallets.ts +1 -1
- package/src/features/wallets/hooks/use-connector-by-id.ts +1 -1
- package/src/features/wallets/hooks/use-connectors.ts +1 -1
- package/src/features/wallets/hooks/use-disconnect.ts +1 -1
- package/src/features/wallets/hooks/use-selected-wallet.ts +1 -1
- package/src/hooks/use-debounce-callback.ts +69 -0
- package/src/hooks/use-debounce-value.ts +38 -0
- package/src/hooks/use-unmount.ts +16 -0
- package/src/index.ts +20 -7
- package/src/locales/en.ts +82 -0
- package/src/storybook/fixtures/tokens.ts +88 -0
- package/src/types/appkit-ui-token.ts +26 -0
- package/src/utils/map-defi-error.ts +35 -0
- package/src/utils/validate-amount.ts +28 -0
- package/dist/esm/components/block/block.js.map +0 -1
- package/dist/esm/components/block/index.js.map +0 -1
- package/dist/esm/components/button/button.js +0 -7
- package/dist/esm/components/button/button.js.map +0 -1
- package/dist/esm/components/button/button.module.css +0 -38
- package/dist/esm/components/button/index.js.map +0 -1
- package/dist/esm/components/circle-icon/circle-icon.js +0 -8
- package/dist/esm/components/circle-icon/circle-icon.js.map +0 -1
- package/dist/esm/components/circle-icon/index.js.map +0 -1
- package/dist/esm/components/ton-icon/index.js.map +0 -1
- package/dist/esm/components/ton-icon/ton-icon.js +0 -8
- package/dist/esm/components/ton-icon/ton-icon.js.map +0 -1
- package/dist/esm/features/balances/components/balance-badge/balance-badge.js +0 -33
- package/dist/esm/features/balances/components/balance-badge/balance-badge.js.map +0 -1
- package/dist/esm/features/balances/components/balance-badge/balance-badge.module.css +0 -21
- package/dist/esm/features/balances/components/balance-badge/index.js.map +0 -1
- package/dist/esm/hooks/use-app-kit-theme.js.map +0 -1
- package/dist/esm/hooks/use-app-kit.js.map +0 -1
- package/dist/esm/hooks/use-i18n.js.map +0 -1
- package/dist/types/components/block/block.d.ts.map +0 -1
- package/dist/types/components/block/index.d.ts.map +0 -1
- package/dist/types/components/button/button.d.ts.map +0 -1
- package/dist/types/components/button/index.d.ts.map +0 -1
- package/dist/types/components/circle-icon/circle-icon.d.ts +0 -16
- package/dist/types/components/circle-icon/circle-icon.d.ts.map +0 -1
- package/dist/types/components/circle-icon/index.d.ts.map +0 -1
- package/dist/types/components/ton-icon/index.d.ts.map +0 -1
- package/dist/types/components/ton-icon/ton-icon.d.ts +0 -14
- package/dist/types/components/ton-icon/ton-icon.d.ts.map +0 -1
- package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts +0 -21
- package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts.map +0 -1
- package/dist/types/features/balances/components/balance-badge/index.d.ts +0 -9
- package/dist/types/features/balances/components/balance-badge/index.d.ts.map +0 -1
- package/dist/types/hooks/use-app-kit-theme.d.ts.map +0 -1
- package/dist/types/hooks/use-app-kit.d.ts.map +0 -1
- package/dist/types/hooks/use-i18n.d.ts.map +0 -1
- package/src/components/button/button.tsx +0 -16
- package/src/components/circle-icon/circle-icon.tsx +0 -34
- package/src/components/ton-icon/ton-icon.tsx +0 -46
- package/src/features/balances/components/balance-badge/balance-badge.tsx +0 -47
- /package/dist/esm/components/{block → ui/block}/block.js +0 -0
- /package/dist/esm/components/{block → ui/block}/index.js +0 -0
- /package/dist/esm/components/{button → ui/button}/index.js +0 -0
- /package/dist/esm/{hooks → features/settings/hooks}/use-app-kit-theme.js +0 -0
- /package/dist/types/components/{block → ui/block}/block.d.ts +0 -0
- /package/dist/types/components/{block → ui/block}/index.d.ts +0 -0
- /package/dist/types/{hooks → features/settings/hooks}/use-app-kit-theme.d.ts +0 -0
- /package/dist/types/{hooks → features/settings/hooks}/use-app-kit.d.ts +0 -0
- /package/src/components/{block → ui/block}/block.tsx +0 -0
- /package/src/components/{block → ui/block}/index.ts +0 -0
- /package/src/{hooks → features/settings/hooks}/use-app-kit-theme.ts +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Network } from '@ton/appkit';
|
|
10
|
+
|
|
11
|
+
import { useBalance } from '../../../balances/hooks/use-balance';
|
|
12
|
+
import { useJettonBalanceByAddress } from '../../../jettons/hooks/use-jetton-balance-by-address';
|
|
13
|
+
import type { AppkitUIToken } from '../../../../types/appkit-ui-token';
|
|
14
|
+
|
|
15
|
+
interface UseSwapBalancesOptions {
|
|
16
|
+
fromToken: AppkitUIToken | null;
|
|
17
|
+
toToken: AppkitUIToken | null;
|
|
18
|
+
ownerAddress: string | undefined;
|
|
19
|
+
network: Network | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function useSwapBalances({ fromToken, toToken, ownerAddress, network }: UseSwapBalancesOptions) {
|
|
23
|
+
const isFromNative = fromToken?.address === 'ton';
|
|
24
|
+
const isToNative = toToken?.address === 'ton';
|
|
25
|
+
|
|
26
|
+
const { data: tonBalance, isLoading: isTonBalanceLoading } = useBalance({
|
|
27
|
+
network,
|
|
28
|
+
query: { refetchInterval: 5000 },
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const { data: fromJettonBalance, isLoading: isFromJettonBalanceLoading } = useJettonBalanceByAddress({
|
|
32
|
+
jettonAddress: fromToken?.address,
|
|
33
|
+
ownerAddress,
|
|
34
|
+
jettonDecimals: fromToken?.decimals,
|
|
35
|
+
network,
|
|
36
|
+
query: { enabled: !isFromNative && !!fromToken, refetchInterval: 5000 },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const { data: toJettonBalance, isLoading: isToJettonBalanceLoading } = useJettonBalanceByAddress({
|
|
40
|
+
jettonAddress: toToken?.address,
|
|
41
|
+
ownerAddress,
|
|
42
|
+
jettonDecimals: toToken?.decimals,
|
|
43
|
+
network,
|
|
44
|
+
query: { enabled: !isToNative && !!toToken, refetchInterval: 5000 },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
fromBalance: isFromNative ? tonBalance : fromJettonBalance,
|
|
49
|
+
toBalance: isToNative ? tonBalance : toJettonBalance,
|
|
50
|
+
isFromBalanceLoading: isFromNative ? isTonBalanceLoading : isFromJettonBalanceLoading,
|
|
51
|
+
isToBalanceLoading: isToNative ? isTonBalanceLoading : isToJettonBalanceLoading,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
10
|
+
import { validateNumericString, truncateDecimals } from '@ton/appkit';
|
|
11
|
+
|
|
12
|
+
import type { AppkitUIToken } from '../../../../types/appkit-ui-token';
|
|
13
|
+
|
|
14
|
+
interface UseSwapTokenStateOptions {
|
|
15
|
+
mappedTokens: AppkitUIToken[];
|
|
16
|
+
defaultFromSymbol?: string;
|
|
17
|
+
defaultToSymbol?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const pickFromToken = (tokens: AppkitUIToken[], defaultSymbol?: string): AppkitUIToken | null =>
|
|
21
|
+
tokens.find((t) => t.symbol.toLowerCase() === defaultSymbol?.toLowerCase()) ?? tokens[0] ?? null;
|
|
22
|
+
|
|
23
|
+
const pickToToken = (tokens: AppkitUIToken[], defaultSymbol?: string): AppkitUIToken | null =>
|
|
24
|
+
tokens.find((t) => t.symbol.toLowerCase() === defaultSymbol?.toLowerCase()) ?? tokens[1] ?? null;
|
|
25
|
+
|
|
26
|
+
export const useSwapTokenState = ({ mappedTokens, defaultFromSymbol, defaultToSymbol }: UseSwapTokenStateOptions) => {
|
|
27
|
+
const [fromToken, setFromToken] = useState<AppkitUIToken | null>(() =>
|
|
28
|
+
pickFromToken(mappedTokens, defaultFromSymbol),
|
|
29
|
+
);
|
|
30
|
+
const [toToken, setToToken] = useState<AppkitUIToken | null>(() => pickToToken(mappedTokens, defaultToSymbol));
|
|
31
|
+
const [fromAmount, setFromAmountRaw] = useState('');
|
|
32
|
+
|
|
33
|
+
// Re-select tokens whenever the available list changes (e.g. wallet network switches and
|
|
34
|
+
// `mappedTokens` is filtered down to a different set). Keep the current selection if it's still
|
|
35
|
+
// valid; otherwise fall back to defaults.
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setFromToken((prev) =>
|
|
38
|
+
prev && mappedTokens.some((t) => t.address === prev.address)
|
|
39
|
+
? prev
|
|
40
|
+
: pickFromToken(mappedTokens, defaultFromSymbol),
|
|
41
|
+
);
|
|
42
|
+
setToToken((prev) =>
|
|
43
|
+
prev && mappedTokens.some((t) => t.address === prev.address)
|
|
44
|
+
? prev
|
|
45
|
+
: pickToToken(mappedTokens, defaultToSymbol),
|
|
46
|
+
);
|
|
47
|
+
}, [mappedTokens, defaultFromSymbol, defaultToSymbol]);
|
|
48
|
+
|
|
49
|
+
const setFromAmount = useCallback(
|
|
50
|
+
(value: string) => {
|
|
51
|
+
if (value === '' || validateNumericString(value, fromToken?.decimals)) {
|
|
52
|
+
setFromAmountRaw(value);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[fromToken?.decimals],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const handleSetFromToken = useCallback(
|
|
59
|
+
(token: AppkitUIToken) => {
|
|
60
|
+
if (toToken && token.address === toToken.address) {
|
|
61
|
+
setToToken(fromToken);
|
|
62
|
+
}
|
|
63
|
+
setFromToken(token);
|
|
64
|
+
setFromAmountRaw((prev) => truncateDecimals(prev, token.decimals));
|
|
65
|
+
},
|
|
66
|
+
[fromToken, toToken],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const handleSetToToken = useCallback(
|
|
70
|
+
(token: AppkitUIToken) => {
|
|
71
|
+
if (fromToken && token.address === fromToken.address) {
|
|
72
|
+
setFromToken(toToken);
|
|
73
|
+
}
|
|
74
|
+
setToToken(token);
|
|
75
|
+
},
|
|
76
|
+
[fromToken, toToken],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const onFlip = useCallback(() => {
|
|
80
|
+
setFromToken(toToken);
|
|
81
|
+
setToToken(fromToken);
|
|
82
|
+
if (toToken) {
|
|
83
|
+
setFromAmountRaw((prev) => truncateDecimals(prev, toToken.decimals));
|
|
84
|
+
}
|
|
85
|
+
}, [fromToken, toToken]);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
fromToken,
|
|
89
|
+
toToken,
|
|
90
|
+
fromAmount,
|
|
91
|
+
setFromToken: handleSetFromToken,
|
|
92
|
+
setToToken: handleSetToToken,
|
|
93
|
+
setFromAmount,
|
|
94
|
+
onFlip,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useMemo } from 'react';
|
|
10
|
+
|
|
11
|
+
import type { AppkitUIToken } from '../../../../types/appkit-ui-token';
|
|
12
|
+
import { hasTooManyDecimals, isAmountExceedingBalance } from '../../../../utils/validate-amount';
|
|
13
|
+
import { mapSwapError } from '../../utils/map-swap-error';
|
|
14
|
+
|
|
15
|
+
interface UseSwapValidationOptions {
|
|
16
|
+
fromAmount: string;
|
|
17
|
+
fromAmountDebounced: string;
|
|
18
|
+
fromToken: AppkitUIToken | null;
|
|
19
|
+
toToken: AppkitUIToken | null;
|
|
20
|
+
fromBalance: string | undefined;
|
|
21
|
+
quoteError: Error | null;
|
|
22
|
+
isNetworkSupported: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function useSwapValidation({
|
|
26
|
+
fromAmount,
|
|
27
|
+
fromAmountDebounced,
|
|
28
|
+
fromToken,
|
|
29
|
+
toToken,
|
|
30
|
+
fromBalance,
|
|
31
|
+
quoteError,
|
|
32
|
+
isNetworkSupported,
|
|
33
|
+
}: UseSwapValidationOptions) {
|
|
34
|
+
const error: string | null = useMemo(() => {
|
|
35
|
+
if (!isNetworkSupported) return 'defi.unsupportedNetwork';
|
|
36
|
+
|
|
37
|
+
if ((parseFloat(fromAmount) || 0) <= 0) return null;
|
|
38
|
+
|
|
39
|
+
if (hasTooManyDecimals(fromAmount, fromToken?.decimals)) return 'swap.tooManyDecimals';
|
|
40
|
+
|
|
41
|
+
if (isAmountExceedingBalance(fromAmount, fromBalance)) return 'swap.insufficientBalance';
|
|
42
|
+
|
|
43
|
+
if (quoteError && fromAmountDebounced) return mapSwapError(quoteError);
|
|
44
|
+
|
|
45
|
+
return null;
|
|
46
|
+
}, [isNetworkSupported, fromAmount, fromToken, fromBalance, quoteError, fromAmountDebounced]);
|
|
47
|
+
|
|
48
|
+
const canSubmit = (parseFloat(fromAmount) || 0) > 0 && fromToken !== null && toToken !== null && error === null;
|
|
49
|
+
|
|
50
|
+
return { error, canSubmit };
|
|
51
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
10
|
+
import type { FC, ComponentProps } from 'react';
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
|
|
13
|
+
import { useI18n } from '../../../settings/hooks/use-i18n';
|
|
14
|
+
import { useSelectedWallet } from '../../../wallets';
|
|
15
|
+
import { SwapField } from '../swap-field';
|
|
16
|
+
import { SwapFlipButton } from '../swap-flip-button';
|
|
17
|
+
import { SwapInfo } from '../swap-info';
|
|
18
|
+
import { SwapSettingsModal } from '../swap-settings-modal';
|
|
19
|
+
import { SwapTokenSelectModal } from '../swap-token-select-modal';
|
|
20
|
+
import { LowBalanceModal } from '../../../../components/shared/low-balance-modal';
|
|
21
|
+
import styles from './swap-widget-ui.module.css';
|
|
22
|
+
import type { SwapContextType } from '../swap-widget-provider';
|
|
23
|
+
import { ButtonWithConnect } from '../../../../components/shared/button-with-connect';
|
|
24
|
+
import { SettingsButton } from '../../../../components/shared/settings-button';
|
|
25
|
+
|
|
26
|
+
export type SwapWidgetRenderProps = SwapContextType & ComponentProps<'div'>;
|
|
27
|
+
|
|
28
|
+
export const SwapWidgetUI: FC<SwapWidgetRenderProps> = ({
|
|
29
|
+
fromToken,
|
|
30
|
+
toToken,
|
|
31
|
+
tokens,
|
|
32
|
+
fromAmount,
|
|
33
|
+
toAmount,
|
|
34
|
+
fiatSymbol,
|
|
35
|
+
fromBalance,
|
|
36
|
+
toBalance,
|
|
37
|
+
isFromBalanceLoading,
|
|
38
|
+
isToBalanceLoading,
|
|
39
|
+
canSubmit,
|
|
40
|
+
quote,
|
|
41
|
+
isQuoteLoading,
|
|
42
|
+
error,
|
|
43
|
+
slippage,
|
|
44
|
+
swapProvider,
|
|
45
|
+
swapProviders,
|
|
46
|
+
setSwapProviderId,
|
|
47
|
+
onFlip,
|
|
48
|
+
onMaxClick,
|
|
49
|
+
setFromAmount,
|
|
50
|
+
setFromToken,
|
|
51
|
+
setToToken,
|
|
52
|
+
setSlippage,
|
|
53
|
+
sendSwapTransaction,
|
|
54
|
+
isSendingTransaction,
|
|
55
|
+
isLowBalanceWarningOpen,
|
|
56
|
+
lowBalanceMode,
|
|
57
|
+
lowBalanceRequiredTon,
|
|
58
|
+
onLowBalanceChange,
|
|
59
|
+
onLowBalanceCancel,
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}) => {
|
|
63
|
+
const [wallet] = useSelectedWallet();
|
|
64
|
+
const isWalletConnected = wallet !== null;
|
|
65
|
+
|
|
66
|
+
const { t } = useI18n();
|
|
67
|
+
|
|
68
|
+
const [activeField, setActiveField] = useState<'from' | 'to' | null>(null);
|
|
69
|
+
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
|
|
70
|
+
const [isFlipped, setIsFlipped] = useState(false);
|
|
71
|
+
|
|
72
|
+
const handleFlip = useCallback(() => {
|
|
73
|
+
setIsFlipped((prev) => !prev);
|
|
74
|
+
onFlip();
|
|
75
|
+
}, [onFlip]);
|
|
76
|
+
|
|
77
|
+
const buttonText = useMemo(() => {
|
|
78
|
+
if (error) return t(error);
|
|
79
|
+
if (!fromToken || !toToken) return t('swap.selectToken');
|
|
80
|
+
if (canSubmit) return t('swap.continue');
|
|
81
|
+
return t('swap.enterAmount');
|
|
82
|
+
}, [error, fromToken, toToken, canSubmit, t]);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className={clsx(styles.widget, className)} {...props}>
|
|
86
|
+
<div className={styles.fieldsContainer}>
|
|
87
|
+
<SwapField
|
|
88
|
+
type="pay"
|
|
89
|
+
token={fromToken ?? undefined}
|
|
90
|
+
amount={fromAmount}
|
|
91
|
+
onAmountChange={setFromAmount}
|
|
92
|
+
balance={fromBalance}
|
|
93
|
+
isBalanceLoading={isFromBalanceLoading}
|
|
94
|
+
onMaxClick={onMaxClick}
|
|
95
|
+
onTokenSelectorClick={() => setActiveField('from')}
|
|
96
|
+
isWalletConnected={isWalletConnected}
|
|
97
|
+
fiatSymbol={fiatSymbol}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<div className={styles.flipButtonWrapper}>
|
|
101
|
+
<div className={styles.flipButtonSeparator} />
|
|
102
|
+
<SwapFlipButton className={styles.flipButton} onClick={handleFlip} rotated={isFlipped} />
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<SwapField
|
|
106
|
+
type="receive"
|
|
107
|
+
token={toToken ?? undefined}
|
|
108
|
+
amount={toAmount}
|
|
109
|
+
balance={toBalance}
|
|
110
|
+
isBalanceLoading={isToBalanceLoading}
|
|
111
|
+
onTokenSelectorClick={() => setActiveField('to')}
|
|
112
|
+
loading={isQuoteLoading}
|
|
113
|
+
isWalletConnected={isWalletConnected}
|
|
114
|
+
fiatSymbol={fiatSymbol}
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<SwapTokenSelectModal
|
|
119
|
+
open={activeField !== null}
|
|
120
|
+
onClose={() => setActiveField(null)}
|
|
121
|
+
tokens={tokens}
|
|
122
|
+
onSelect={(token) => {
|
|
123
|
+
if (activeField === 'from') setFromToken(token);
|
|
124
|
+
else setToToken(token);
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<SwapSettingsModal
|
|
129
|
+
open={isSettingsOpen}
|
|
130
|
+
onClose={() => setIsSettingsOpen(false)}
|
|
131
|
+
slippage={slippage}
|
|
132
|
+
onSlippageChange={setSlippage}
|
|
133
|
+
provider={swapProvider}
|
|
134
|
+
providers={swapProviders}
|
|
135
|
+
onProviderChange={setSwapProviderId}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
<LowBalanceModal
|
|
139
|
+
open={isLowBalanceWarningOpen}
|
|
140
|
+
mode={lowBalanceMode}
|
|
141
|
+
requiredTon={lowBalanceRequiredTon}
|
|
142
|
+
onChange={onLowBalanceChange}
|
|
143
|
+
onCancel={onLowBalanceCancel}
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<div className={styles.actions}>
|
|
147
|
+
<ButtonWithConnect
|
|
148
|
+
variant="fill"
|
|
149
|
+
size="l"
|
|
150
|
+
fullWidth
|
|
151
|
+
disabled={!canSubmit || isQuoteLoading || isSendingTransaction}
|
|
152
|
+
onClick={sendSwapTransaction}
|
|
153
|
+
>
|
|
154
|
+
{buttonText}
|
|
155
|
+
</ButtonWithConnect>
|
|
156
|
+
<SettingsButton onClick={() => setIsSettingsOpen(true)} />
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<SwapInfo
|
|
160
|
+
quote={quote}
|
|
161
|
+
provider={swapProvider}
|
|
162
|
+
toToken={toToken}
|
|
163
|
+
slippage={slippage}
|
|
164
|
+
isQuoteLoading={isQuoteLoading}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { FC } from 'react';
|
|
10
|
+
|
|
11
|
+
import styles from './token-selector.module.css';
|
|
12
|
+
import { Button } from '../../../../components/ui/button';
|
|
13
|
+
import { ChevronDownIcon } from '../../../../components/ui/icons';
|
|
14
|
+
import { Logo } from '../../../../components/ui/logo';
|
|
15
|
+
import { useI18n } from '../../../settings/hooks/use-i18n';
|
|
16
|
+
|
|
17
|
+
export interface TokenSelectorProps {
|
|
18
|
+
symbol?: string;
|
|
19
|
+
icon?: string;
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const TokenSelector: FC<TokenSelectorProps> = ({ symbol, icon, onClick }) => {
|
|
24
|
+
const { t } = useI18n();
|
|
25
|
+
const label = symbol ?? t('swap.selectToken');
|
|
26
|
+
const fallback = symbol?.[0] ?? '?';
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Button className={styles.tokenSelector} onClick={onClick} variant="gray" size="s">
|
|
30
|
+
{symbol && <Logo size={24} src={icon} fallback={fallback} alt={symbol} />}
|
|
31
|
+
<span style={{ lineHeight: '24px' }}>{label}</span>
|
|
32
|
+
<ChevronDownIcon size={16} className={styles.chevron} />
|
|
33
|
+
</Button>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
BuildSwapTransactionVariables,
|
|
18
18
|
} from '@ton/appkit/queries';
|
|
19
19
|
|
|
20
|
-
import { useAppKit } from '
|
|
20
|
+
import { useAppKit } from '../../settings';
|
|
21
21
|
import { useMutation } from '../../../libs/query';
|
|
22
22
|
|
|
23
23
|
export type UseBuildSwapTransactionParameters<context = unknown> = BuildSwapTransactionMutationOptions<context>;
|
|
@@ -29,6 +29,9 @@ export type UseBuildSwapTransactionReturnType<context = unknown> = UseMutationRe
|
|
|
29
29
|
context
|
|
30
30
|
>;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Hook to build a swap transaction from a previously fetched quote.
|
|
34
|
+
*/
|
|
32
35
|
export const useBuildSwapTransaction = <context = unknown>(
|
|
33
36
|
parameters?: UseBuildSwapTransactionParameters<context>,
|
|
34
37
|
): UseBuildSwapTransactionReturnType<context> => {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useSyncExternalStore, useCallback } from 'react';
|
|
10
|
+
import { getSwapProvider, setDefaultSwapProvider, watchSwapProviders } from '@ton/appkit';
|
|
11
|
+
import type { GetSwapProviderReturnType } from '@ton/appkit';
|
|
12
|
+
|
|
13
|
+
import { useAppKit } from '../../settings/hooks/use-app-kit';
|
|
14
|
+
|
|
15
|
+
export type UseSwapProviderReturnType = readonly [GetSwapProviderReturnType | undefined, (providerId: string) => void];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to get and set the currently selected swap provider.
|
|
19
|
+
* Mirrors the tuple shape of `useSelectedWallet`.
|
|
20
|
+
*/
|
|
21
|
+
export const useSwapProvider = (): UseSwapProviderReturnType => {
|
|
22
|
+
const appKit = useAppKit();
|
|
23
|
+
|
|
24
|
+
const subscribe = useCallback(
|
|
25
|
+
(onChange: () => void) => {
|
|
26
|
+
return watchSwapProviders(appKit, { onChange });
|
|
27
|
+
},
|
|
28
|
+
[appKit],
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const getSnapshot = useCallback(() => {
|
|
32
|
+
try {
|
|
33
|
+
return getSwapProvider(appKit);
|
|
34
|
+
} catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}, [appKit]);
|
|
38
|
+
|
|
39
|
+
const provider = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
40
|
+
|
|
41
|
+
const setProviderId = useCallback(
|
|
42
|
+
(providerId: string) => {
|
|
43
|
+
setDefaultSwapProvider(appKit, { providerId });
|
|
44
|
+
},
|
|
45
|
+
[appKit],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return [provider, setProviderId] as const;
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useSyncExternalStore, useCallback } from 'react';
|
|
10
|
+
import { getSwapProviders, watchSwapProviders } from '@ton/appkit';
|
|
11
|
+
import type { GetSwapProvidersReturnType } from '@ton/appkit';
|
|
12
|
+
|
|
13
|
+
import { useAppKit } from '../../settings/hooks/use-app-kit';
|
|
14
|
+
|
|
15
|
+
export type UseSwapProvidersReturnType = GetSwapProvidersReturnType;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to get all registered swap providers.
|
|
19
|
+
*/
|
|
20
|
+
export const useSwapProviders = (): UseSwapProvidersReturnType => {
|
|
21
|
+
const appKit = useAppKit();
|
|
22
|
+
|
|
23
|
+
const subscribe = useCallback(
|
|
24
|
+
(onChange: () => void) => {
|
|
25
|
+
return watchSwapProviders(appKit, { onChange });
|
|
26
|
+
},
|
|
27
|
+
[appKit],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const getSnapshot = useCallback(() => {
|
|
31
|
+
return getSwapProviders(appKit);
|
|
32
|
+
}, [appKit]);
|
|
33
|
+
|
|
34
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
35
|
+
};
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
import { getSwapQuoteQueryOptions } from '@ton/appkit/queries';
|
|
12
12
|
import type { GetSwapQuoteData, GetSwapQuoteErrorType, GetSwapQuoteQueryConfig } from '@ton/appkit/queries';
|
|
13
13
|
|
|
14
|
-
import { useAppKit } from '
|
|
14
|
+
import { useAppKit } from '../../settings';
|
|
15
15
|
import { useQuery } from '../../../libs/query';
|
|
16
16
|
import type { UseQueryReturnType } from '../../../libs/query';
|
|
17
|
+
import { useNetwork } from '../../network';
|
|
17
18
|
|
|
18
19
|
export type UseSwapQuoteParameters<selectData = GetSwapQuoteData> = GetSwapQuoteQueryConfig<selectData>;
|
|
19
20
|
|
|
@@ -22,10 +23,14 @@ export type UseSwapQuoteReturnType<selectData = GetSwapQuoteData> = UseQueryRetu
|
|
|
22
23
|
GetSwapQuoteErrorType
|
|
23
24
|
>;
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Hook to get a swap quote for the given token pair and amount.
|
|
28
|
+
*/
|
|
25
29
|
export const useSwapQuote = <selectData = GetSwapQuoteData>(
|
|
26
30
|
parameters: UseSwapQuoteParameters<selectData> = {},
|
|
27
31
|
): UseSwapQuoteReturnType<selectData> => {
|
|
28
32
|
const appKit = useAppKit();
|
|
33
|
+
const walletNetwork = useNetwork();
|
|
29
34
|
|
|
30
|
-
return useQuery(getSwapQuoteQueryOptions(appKit, parameters));
|
|
35
|
+
return useQuery(getSwapQuoteQueryOptions(appKit, { ...parameters, network: parameters.network ?? walletNetwork }));
|
|
31
36
|
};
|
|
@@ -6,5 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
export * from './components/swap-widget';
|
|
10
|
+
export * from './components/swap-widget-ui';
|
|
11
|
+
export * from './components/swap-widget-provider';
|
|
12
|
+
export * from './components/swap-field';
|
|
13
|
+
export * from './components/swap-flip-button';
|
|
14
|
+
export * from './components/swap-info';
|
|
15
|
+
|
|
9
16
|
export * from './hooks/use-swap-quote';
|
|
10
17
|
export * from './hooks/use-build-swap-transaction';
|
|
18
|
+
export * from './hooks/use-swap-provider';
|
|
19
|
+
export * from './hooks/use-swap-providers';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { formatLargeValue } from '@ton/appkit';
|
|
10
|
+
|
|
11
|
+
/** Cap for fractional digits shown in the swap UI. */
|
|
12
|
+
const MAX_DISPLAY_DECIMALS = 5;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Format a token amount for display in the swap UI.
|
|
16
|
+
* Caps fractional digits at {@link MAX_DISPLAY_DECIMALS}, or at the token's own decimals when lower.
|
|
17
|
+
*/
|
|
18
|
+
export const getDisplayAmount = (amount: string | undefined, tokenDecimals?: number): string => {
|
|
19
|
+
const decimals = Math.min(tokenDecimals ?? MAX_DISPLAY_DECIMALS, MAX_DISPLAY_DECIMALS);
|
|
20
|
+
return formatLargeValue(amount || '0', decimals);
|
|
21
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { SwapError, SwapErrorCode } from '@ton/appkit';
|
|
10
|
+
|
|
11
|
+
import { mapDefiError } from '../../../utils/map-defi-error';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Map a thrown swap error to an i18n key. Tries swap-specific codes first, falls back to the
|
|
15
|
+
* shared {@link mapDefiError} for base DeFi codes, and finally to a generic `swap.quoteError`.
|
|
16
|
+
*/
|
|
17
|
+
export const mapSwapError = (error: unknown): string => {
|
|
18
|
+
if (error instanceof SwapError) {
|
|
19
|
+
switch (error.code) {
|
|
20
|
+
case SwapErrorCode.InvalidQuote:
|
|
21
|
+
return 'swap.invalidQuote';
|
|
22
|
+
case SwapErrorCode.InsufficientLiquidity:
|
|
23
|
+
return 'swap.insufficientLiquidity';
|
|
24
|
+
case SwapErrorCode.QuoteExpired:
|
|
25
|
+
return 'swap.quoteExpired';
|
|
26
|
+
case SwapErrorCode.BuildTxFailed:
|
|
27
|
+
return 'swap.buildTxFailed';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return mapDefiError(error) ?? 'swap.quoteError';
|
|
32
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) TonTech.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { tryToNonBounceableAddress } from '@ton/appkit';
|
|
10
|
+
|
|
11
|
+
import type { AppkitUIToken } from '../../../types/appkit-ui-token';
|
|
12
|
+
|
|
13
|
+
export const mapSwapWidgetTokens = (tokens: AppkitUIToken[]): AppkitUIToken[] => {
|
|
14
|
+
const mapped = tokens.reduce((acc, token) => {
|
|
15
|
+
if (token.address === 'ton') {
|
|
16
|
+
acc.push({ ...token, address: 'ton' });
|
|
17
|
+
|
|
18
|
+
return acc;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const friendlyAddress = tryToNonBounceableAddress(token.address);
|
|
22
|
+
|
|
23
|
+
if (!friendlyAddress) return acc;
|
|
24
|
+
|
|
25
|
+
acc.push({
|
|
26
|
+
...token,
|
|
27
|
+
address: friendlyAddress,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return acc;
|
|
31
|
+
}, [] as AppkitUIToken[]);
|
|
32
|
+
|
|
33
|
+
return mapped;
|
|
34
|
+
};
|