@ton/appkit 0.0.5-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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +144 -0
- package/README.md +8 -7
- package/dist/cjs/actions/connectors/watch-connector-by-id.d.ts.map +1 -1
- package/dist/cjs/actions/connectors/watch-connector-by-id.js +8 -3
- package/dist/cjs/actions/connectors/watch-connectors.d.ts.map +1 -1
- package/dist/cjs/actions/connectors/watch-connectors.js +8 -3
- package/dist/cjs/actions/index.d.ts +8 -0
- package/dist/cjs/actions/index.d.ts.map +1 -1
- package/dist/cjs/actions/index.js +18 -2
- package/dist/cjs/actions/jettons/create-transfer-jetton-transaction.d.ts +1 -1
- package/dist/cjs/actions/jettons/create-transfer-jetton-transaction.d.ts.map +1 -1
- package/dist/cjs/actions/jettons/create-transfer-jetton-transaction.js +17 -5
- package/dist/cjs/actions/jettons/get-jetton-balance.d.ts +1 -1
- package/dist/cjs/actions/jettons/get-jetton-balance.d.ts.map +1 -1
- package/dist/cjs/actions/jettons/get-jetton-balance.js +8 -3
- package/dist/cjs/actions/jettons/get-jetton-info.d.ts.map +1 -1
- package/dist/cjs/actions/jettons/get-jetton-info.js +15 -6
- package/dist/cjs/actions/jettons/get-jetton-wallet-address.d.ts +1 -1
- package/dist/cjs/actions/jettons/get-jetton-wallet-address.d.ts.map +1 -1
- package/dist/cjs/actions/jettons/get-jetton-wallet-address.js +15 -4
- package/dist/cjs/actions/nft/get-nft.d.ts +1 -1
- package/dist/cjs/actions/nft/get-nft.d.ts.map +1 -1
- package/dist/cjs/actions/providers/register-provider.d.ts +2 -1
- package/dist/cjs/actions/providers/register-provider.d.ts.map +1 -1
- package/dist/cjs/actions/staking/get-staking-provider-metadata.d.ts +19 -0
- package/dist/cjs/actions/staking/get-staking-provider-metadata.d.ts.map +1 -0
- package/dist/cjs/actions/staking/get-staking-provider-metadata.js +18 -0
- package/dist/cjs/actions/staking/get-staking-provider.d.ts +21 -0
- package/dist/cjs/actions/staking/get-staking-provider.d.ts.map +1 -0
- package/dist/cjs/actions/staking/get-staking-provider.js +17 -0
- package/dist/cjs/actions/staking/get-staking-providers.d.ts +3 -2
- package/dist/cjs/actions/staking/get-staking-providers.d.ts.map +1 -1
- package/dist/cjs/actions/staking/get-staking-providers.js +2 -2
- package/dist/cjs/actions/staking/set-default-staking-provider.d.ts +18 -0
- package/dist/cjs/actions/staking/set-default-staking-provider.d.ts.map +1 -0
- package/dist/cjs/actions/staking/set-default-staking-provider.js +18 -0
- package/dist/cjs/actions/staking/watch-staking-providers.d.ts +17 -0
- package/dist/cjs/actions/staking/watch-staking-providers.d.ts.map +1 -0
- package/dist/cjs/actions/staking/watch-staking-providers.js +28 -0
- package/dist/cjs/actions/swap/get-swap-provider.d.ts +15 -0
- package/dist/cjs/actions/swap/get-swap-provider.d.ts.map +1 -0
- package/dist/cjs/actions/swap/get-swap-provider.js +14 -0
- package/dist/cjs/actions/swap/get-swap-providers.d.ts +15 -0
- package/dist/cjs/actions/swap/get-swap-providers.d.ts.map +1 -0
- package/dist/cjs/actions/swap/get-swap-providers.js +17 -0
- package/dist/cjs/actions/swap/get-swap-quote.d.ts.map +1 -1
- package/dist/cjs/actions/swap/get-swap-quote.js +6 -1
- package/dist/cjs/actions/swap/set-default-swap-provider.d.ts +18 -0
- package/dist/cjs/actions/swap/set-default-swap-provider.d.ts.map +1 -0
- package/dist/cjs/actions/swap/set-default-swap-provider.js +18 -0
- package/dist/cjs/actions/swap/watch-swap-providers.d.ts +17 -0
- package/dist/cjs/actions/swap/watch-swap-providers.d.ts.map +1 -0
- package/dist/cjs/actions/swap/watch-swap-providers.js +29 -0
- package/dist/cjs/connectors/tonconnect/connectors/ton-connect-connector.d.ts +1 -2
- package/dist/cjs/connectors/tonconnect/connectors/ton-connect-connector.d.ts.map +1 -1
- package/dist/cjs/connectors/tonconnect/connectors/ton-connect-connector.js +16 -18
- package/dist/cjs/core/app-kit/constants/events.d.ts +3 -8
- package/dist/cjs/core/app-kit/constants/events.d.ts.map +1 -1
- package/dist/cjs/core/app-kit/constants/events.js +4 -9
- package/dist/cjs/core/app-kit/index.d.ts +2 -2
- package/dist/cjs/core/app-kit/index.d.ts.map +1 -1
- package/dist/cjs/core/app-kit/index.js +1 -2
- package/dist/cjs/core/app-kit/services/app-kit.d.ts +5 -2
- package/dist/cjs/core/app-kit/services/app-kit.d.ts.map +1 -1
- package/dist/cjs/core/app-kit/services/app-kit.js +12 -4
- package/dist/cjs/core/app-kit/types/config.d.ts +6 -3
- package/dist/cjs/core/app-kit/types/config.d.ts.map +1 -1
- package/dist/cjs/core/app-kit/types/events.d.ts +13 -13
- package/dist/cjs/core/app-kit/types/events.d.ts.map +1 -1
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.d.ts +20 -0
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.d.ts.map +1 -0
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.js +32 -0
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.test.d.ts +9 -0
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.test.d.ts.map +1 -0
- package/dist/cjs/core/cache/adapters/lru-app-kit-cache.test.js +68 -0
- package/dist/cjs/core/cache/index.d.ts +11 -0
- package/dist/cjs/core/cache/index.d.ts.map +1 -0
- package/dist/cjs/core/cache/index.js +14 -0
- package/dist/cjs/core/cache/types/app-kit-cache.d.ts +14 -0
- package/dist/cjs/core/cache/types/app-kit-cache.d.ts.map +1 -0
- package/dist/cjs/core/cache/types/app-kit-cache.js +9 -0
- package/dist/cjs/core/cache/utils/get-cache-key.d.ts +9 -0
- package/dist/cjs/core/cache/utils/get-cache-key.d.ts.map +1 -0
- package/dist/cjs/core/cache/utils/get-cache-key.js +12 -0
- package/dist/cjs/core/cache/utils/get-cache-key.test.d.ts +9 -0
- package/dist/cjs/core/cache/utils/get-cache-key.test.d.ts.map +1 -0
- package/dist/cjs/core/cache/utils/get-cache-key.test.js +30 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/queries/balances/get-balance-by-address.d.ts.map +1 -1
- package/dist/cjs/queries/balances/get-balance-by-address.js +9 -3
- package/dist/cjs/queries/index.d.ts +0 -1
- package/dist/cjs/queries/index.d.ts.map +1 -1
- package/dist/cjs/queries/index.js +1 -3
- package/dist/cjs/queries/jettons/get-jetton-balance-by-address.d.ts.map +1 -1
- package/dist/cjs/queries/jettons/get-jetton-balance-by-address.js +11 -11
- package/dist/cjs/queries/jettons/get-jetton-info.d.ts.map +1 -1
- package/dist/cjs/queries/jettons/get-jetton-info.js +5 -1
- package/dist/cjs/queries/jettons/get-jetton-wallet-address.d.ts.map +1 -1
- package/dist/cjs/queries/jettons/get-jetton-wallet-address.js +6 -1
- package/dist/cjs/queries/jettons/get-jettons-by-address.d.ts.map +1 -1
- package/dist/cjs/queries/jettons/get-jettons-by-address.js +9 -3
- package/dist/cjs/queries/nft/get-nft.d.ts +1 -1
- package/dist/cjs/queries/nft/get-nft.d.ts.map +1 -1
- package/dist/cjs/queries/nft/get-nft.js +5 -1
- package/dist/cjs/queries/nft/get-nfts-by-address.d.ts.map +1 -1
- package/dist/cjs/queries/nft/get-nfts-by-address.js +5 -1
- package/dist/cjs/queries/staking/get-staked-balance.d.ts +1 -1
- package/dist/cjs/queries/staking/get-staked-balance.d.ts.map +1 -1
- package/dist/cjs/queries/staking/get-staked-balance.js +7 -1
- package/dist/cjs/queries/staking/get-staking-provider-info.d.ts +1 -1
- package/dist/cjs/queries/staking/get-staking-provider-info.d.ts.map +1 -1
- package/dist/cjs/queries/staking/get-staking-provider-info.js +3 -1
- package/dist/cjs/queries/staking/get-staking-quote.d.ts +1 -1
- package/dist/cjs/queries/staking/get-staking-quote.d.ts.map +1 -1
- package/dist/cjs/queries/staking/get-staking-quote.js +8 -2
- package/dist/cjs/queries/swap/get-swap-quote.d.ts.map +1 -1
- package/dist/cjs/queries/swap/get-swap-quote.js +1 -1
- package/dist/cjs/staking/index.d.ts +2 -2
- package/dist/cjs/staking/index.d.ts.map +1 -1
- package/dist/cjs/staking/index.js +3 -1
- package/dist/cjs/swap/index.d.ts +2 -1
- package/dist/cjs/swap/index.d.ts.map +1 -1
- package/dist/cjs/swap/index.js +8 -0
- package/dist/cjs/types/connector.d.ts +0 -6
- package/dist/cjs/types/connector.d.ts.map +1 -1
- package/dist/cjs/types/primitives.d.ts +1 -1
- package/dist/cjs/types/primitives.d.ts.map +1 -1
- package/dist/cjs/types/provider.d.ts +3 -3
- package/dist/cjs/types/provider.d.ts.map +1 -1
- package/dist/cjs/utils/address/is-valid-address.d.ts +11 -0
- package/dist/cjs/utils/address/is-valid-address.d.ts.map +1 -0
- package/dist/cjs/utils/address/is-valid-address.js +38 -0
- package/dist/cjs/utils/address/to-bounceble-address.d.ts +11 -0
- package/dist/cjs/utils/address/to-bounceble-address.d.ts.map +1 -0
- package/dist/cjs/utils/address/to-bounceble-address.js +36 -0
- package/dist/cjs/utils/address/to-non-bounceble-address.d.ts +11 -0
- package/dist/cjs/utils/address/to-non-bounceble-address.d.ts.map +1 -0
- package/dist/cjs/utils/address/to-non-bounceble-address.js +36 -0
- package/dist/cjs/utils/amount/calc-fiat-value.d.ts +13 -0
- package/dist/cjs/utils/amount/calc-fiat-value.d.ts.map +1 -0
- package/dist/cjs/utils/amount/calc-fiat-value.js +22 -0
- package/dist/cjs/utils/amount/calc-fiat-value.test.d.ts +9 -0
- package/dist/cjs/utils/amount/calc-fiat-value.test.d.ts.map +1 -0
- package/dist/cjs/utils/amount/calc-fiat-value.test.js +39 -0
- package/dist/cjs/utils/amount/format-large-value.d.ts +9 -0
- package/dist/cjs/utils/amount/format-large-value.d.ts.map +1 -0
- package/dist/cjs/utils/amount/format-large-value.js +40 -0
- package/dist/cjs/utils/amount/format-large-value.test.d.ts +9 -0
- package/dist/cjs/utils/amount/format-large-value.test.d.ts.map +1 -0
- package/dist/cjs/utils/amount/format-large-value.test.js +43 -0
- package/dist/cjs/utils/amount/truncate-decimals.d.ts +9 -0
- package/dist/cjs/utils/amount/truncate-decimals.d.ts.map +1 -0
- package/dist/cjs/utils/amount/truncate-decimals.js +59 -0
- package/dist/cjs/utils/amount/truncate-decimals.test.d.ts +9 -0
- package/dist/cjs/utils/amount/truncate-decimals.test.d.ts.map +1 -0
- package/dist/cjs/utils/amount/truncate-decimals.test.js +83 -0
- package/dist/cjs/utils/balance/calc-max-spendable.d.ts +33 -0
- package/dist/cjs/utils/balance/calc-max-spendable.d.ts.map +1 -0
- package/dist/cjs/utils/balance/calc-max-spendable.js +29 -0
- package/dist/cjs/utils/balance/calc-max-spendable.test.d.ts +9 -0
- package/dist/cjs/utils/balance/calc-max-spendable.test.d.ts.map +1 -0
- package/dist/cjs/utils/balance/calc-max-spendable.test.js +38 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.d.ts +58 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.d.ts.map +1 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.js +46 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.test.d.ts +9 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.test.d.ts.map +1 -0
- package/dist/cjs/utils/balance/get-ton-shortfall.test.js +133 -0
- package/dist/cjs/utils/functions/debounce.d.ts +80 -0
- package/dist/cjs/utils/functions/debounce.d.ts.map +1 -0
- package/dist/cjs/utils/functions/debounce.js +107 -0
- package/dist/cjs/utils/index.d.ts +10 -0
- package/dist/cjs/utils/index.d.ts.map +1 -1
- package/dist/cjs/utils/index.js +10 -0
- package/dist/cjs/utils/jetton/jetton-info.d.ts +2 -1
- package/dist/cjs/utils/jetton/jetton-info.d.ts.map +1 -1
- package/dist/cjs/utils/jetton/jetton-info.js +11 -1
- package/dist/cjs/utils/jetton/jetton-info.test.d.ts +9 -0
- package/dist/cjs/utils/jetton/jetton-info.test.d.ts.map +1 -0
- package/dist/cjs/utils/jetton/jetton-info.test.js +54 -0
- package/dist/cjs/utils/predicate/is-number.d.ts +9 -0
- package/dist/cjs/utils/predicate/is-number.d.ts.map +1 -0
- package/dist/cjs/utils/predicate/is-number.js +20 -0
- package/dist/cjs/utils/predicate/is-string.d.ts +1 -1
- package/dist/cjs/utils/predicate/is-string.d.ts.map +1 -1
- package/dist/cjs/utils/predicate/is-string.js +4 -3
- package/dist/esm/actions/connectors/watch-connector-by-id.d.ts.map +1 -1
- package/dist/esm/actions/connectors/watch-connector-by-id.js +8 -3
- package/dist/esm/actions/connectors/watch-connectors.d.ts.map +1 -1
- package/dist/esm/actions/connectors/watch-connectors.js +8 -3
- package/dist/esm/actions/index.d.ts +8 -0
- package/dist/esm/actions/index.d.ts.map +1 -1
- package/dist/esm/actions/index.js +8 -0
- package/dist/esm/actions/jettons/create-transfer-jetton-transaction.d.ts +1 -1
- package/dist/esm/actions/jettons/create-transfer-jetton-transaction.d.ts.map +1 -1
- package/dist/esm/actions/jettons/create-transfer-jetton-transaction.js +17 -5
- package/dist/esm/actions/jettons/get-jetton-balance.d.ts +1 -1
- package/dist/esm/actions/jettons/get-jetton-balance.d.ts.map +1 -1
- package/dist/esm/actions/jettons/get-jetton-balance.js +7 -2
- package/dist/esm/actions/jettons/get-jetton-info.d.ts.map +1 -1
- package/dist/esm/actions/jettons/get-jetton-info.js +15 -6
- package/dist/esm/actions/jettons/get-jetton-wallet-address.d.ts +1 -1
- package/dist/esm/actions/jettons/get-jetton-wallet-address.d.ts.map +1 -1
- package/dist/esm/actions/jettons/get-jetton-wallet-address.js +15 -4
- package/dist/esm/actions/nft/get-nft.d.ts +1 -1
- package/dist/esm/actions/nft/get-nft.d.ts.map +1 -1
- package/dist/esm/actions/providers/register-provider.d.ts +2 -1
- package/dist/esm/actions/providers/register-provider.d.ts.map +1 -1
- package/dist/esm/actions/staking/get-staking-provider-metadata.d.ts +19 -0
- package/dist/esm/actions/staking/get-staking-provider-metadata.d.ts.map +1 -0
- package/dist/esm/actions/staking/get-staking-provider-metadata.js +14 -0
- package/dist/esm/actions/staking/get-staking-provider.d.ts +21 -0
- package/dist/esm/actions/staking/get-staking-provider.d.ts.map +1 -0
- package/dist/esm/actions/staking/get-staking-provider.js +13 -0
- package/dist/esm/actions/staking/get-staking-providers.d.ts +3 -2
- package/dist/esm/actions/staking/get-staking-providers.d.ts.map +1 -1
- package/dist/esm/actions/staking/get-staking-providers.js +2 -2
- package/dist/esm/actions/staking/set-default-staking-provider.d.ts +18 -0
- package/dist/esm/actions/staking/set-default-staking-provider.d.ts.map +1 -0
- package/dist/esm/actions/staking/set-default-staking-provider.js +14 -0
- package/dist/esm/actions/staking/watch-staking-providers.d.ts +17 -0
- package/dist/esm/actions/staking/watch-staking-providers.d.ts.map +1 -0
- package/dist/esm/actions/staking/watch-staking-providers.js +24 -0
- package/dist/esm/actions/swap/get-swap-provider.d.ts +15 -0
- package/dist/esm/actions/swap/get-swap-provider.d.ts.map +1 -0
- package/dist/esm/actions/swap/get-swap-provider.js +10 -0
- package/dist/esm/actions/swap/get-swap-providers.d.ts +15 -0
- package/dist/esm/actions/swap/get-swap-providers.d.ts.map +1 -0
- package/dist/esm/actions/swap/get-swap-providers.js +13 -0
- package/dist/esm/actions/swap/get-swap-quote.d.ts.map +1 -1
- package/dist/esm/actions/swap/get-swap-quote.js +6 -1
- package/dist/esm/actions/swap/set-default-swap-provider.d.ts +18 -0
- package/dist/esm/actions/swap/set-default-swap-provider.d.ts.map +1 -0
- package/dist/esm/actions/swap/set-default-swap-provider.js +14 -0
- package/dist/esm/actions/swap/watch-swap-providers.d.ts +17 -0
- package/dist/esm/actions/swap/watch-swap-providers.d.ts.map +1 -0
- package/dist/esm/actions/swap/watch-swap-providers.js +25 -0
- package/dist/esm/connectors/tonconnect/connectors/ton-connect-connector.d.ts +1 -2
- package/dist/esm/connectors/tonconnect/connectors/ton-connect-connector.d.ts.map +1 -1
- package/dist/esm/connectors/tonconnect/connectors/ton-connect-connector.js +16 -18
- package/dist/esm/core/app-kit/constants/events.d.ts +3 -8
- package/dist/esm/core/app-kit/constants/events.d.ts.map +1 -1
- package/dist/esm/core/app-kit/constants/events.js +3 -8
- package/dist/esm/core/app-kit/index.d.ts +2 -2
- package/dist/esm/core/app-kit/index.d.ts.map +1 -1
- package/dist/esm/core/app-kit/index.js +1 -1
- package/dist/esm/core/app-kit/services/app-kit.d.ts +5 -2
- package/dist/esm/core/app-kit/services/app-kit.d.ts.map +1 -1
- package/dist/esm/core/app-kit/services/app-kit.js +12 -4
- package/dist/esm/core/app-kit/types/config.d.ts +6 -3
- package/dist/esm/core/app-kit/types/config.d.ts.map +1 -1
- package/dist/esm/core/app-kit/types/events.d.ts +13 -13
- package/dist/esm/core/app-kit/types/events.d.ts.map +1 -1
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.d.ts +20 -0
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.d.ts.map +1 -0
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.js +28 -0
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.test.d.ts +9 -0
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.test.d.ts.map +1 -0
- package/dist/esm/core/cache/adapters/lru-app-kit-cache.test.js +66 -0
- package/dist/esm/core/cache/index.d.ts +11 -0
- package/dist/esm/core/cache/index.d.ts.map +1 -0
- package/dist/esm/core/cache/index.js +9 -0
- package/dist/esm/core/cache/types/app-kit-cache.d.ts +14 -0
- package/dist/esm/core/cache/types/app-kit-cache.d.ts.map +1 -0
- package/dist/esm/core/cache/types/app-kit-cache.js +8 -0
- package/dist/esm/core/cache/utils/get-cache-key.d.ts +9 -0
- package/dist/esm/core/cache/utils/get-cache-key.d.ts.map +1 -0
- package/dist/esm/core/cache/utils/get-cache-key.js +8 -0
- package/dist/esm/core/cache/utils/get-cache-key.test.d.ts +9 -0
- package/dist/esm/core/cache/utils/get-cache-key.test.d.ts.map +1 -0
- package/dist/esm/core/cache/utils/get-cache-key.test.js +28 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/queries/balances/get-balance-by-address.d.ts.map +1 -1
- package/dist/esm/queries/balances/get-balance-by-address.js +10 -4
- package/dist/esm/queries/index.d.ts +0 -1
- package/dist/esm/queries/index.d.ts.map +1 -1
- package/dist/esm/queries/index.js +0 -1
- package/dist/esm/queries/jettons/get-jetton-balance-by-address.d.ts.map +1 -1
- package/dist/esm/queries/jettons/get-jetton-balance-by-address.js +12 -12
- package/dist/esm/queries/jettons/get-jetton-info.d.ts.map +1 -1
- package/dist/esm/queries/jettons/get-jetton-info.js +6 -2
- package/dist/esm/queries/jettons/get-jetton-wallet-address.d.ts.map +1 -1
- package/dist/esm/queries/jettons/get-jetton-wallet-address.js +7 -2
- package/dist/esm/queries/jettons/get-jettons-by-address.d.ts.map +1 -1
- package/dist/esm/queries/jettons/get-jettons-by-address.js +10 -4
- package/dist/esm/queries/nft/get-nft.d.ts +1 -1
- package/dist/esm/queries/nft/get-nft.d.ts.map +1 -1
- package/dist/esm/queries/nft/get-nft.js +6 -2
- package/dist/esm/queries/nft/get-nfts-by-address.d.ts.map +1 -1
- package/dist/esm/queries/nft/get-nfts-by-address.js +6 -2
- package/dist/esm/queries/staking/get-staked-balance.d.ts +1 -1
- package/dist/esm/queries/staking/get-staked-balance.d.ts.map +1 -1
- package/dist/esm/queries/staking/get-staked-balance.js +8 -2
- package/dist/esm/queries/staking/get-staking-provider-info.d.ts +1 -1
- package/dist/esm/queries/staking/get-staking-provider-info.d.ts.map +1 -1
- package/dist/esm/queries/staking/get-staking-provider-info.js +4 -2
- package/dist/esm/queries/staking/get-staking-quote.d.ts +1 -1
- package/dist/esm/queries/staking/get-staking-quote.d.ts.map +1 -1
- package/dist/esm/queries/staking/get-staking-quote.js +9 -3
- package/dist/esm/queries/swap/get-swap-quote.d.ts.map +1 -1
- package/dist/esm/queries/swap/get-swap-quote.js +1 -1
- package/dist/esm/staking/index.d.ts +2 -2
- package/dist/esm/staking/index.d.ts.map +1 -1
- package/dist/esm/staking/index.js +1 -1
- package/dist/esm/swap/index.d.ts +2 -1
- package/dist/esm/swap/index.d.ts.map +1 -1
- package/dist/esm/swap/index.js +1 -1
- package/dist/esm/types/connector.d.ts +0 -6
- package/dist/esm/types/connector.d.ts.map +1 -1
- package/dist/esm/types/primitives.d.ts +1 -1
- package/dist/esm/types/primitives.d.ts.map +1 -1
- package/dist/esm/types/provider.d.ts +3 -3
- package/dist/esm/types/provider.d.ts.map +1 -1
- package/dist/esm/utils/address/is-valid-address.d.ts +11 -0
- package/dist/esm/utils/address/is-valid-address.d.ts.map +1 -0
- package/dist/esm/utils/address/is-valid-address.js +33 -0
- package/dist/esm/utils/address/to-bounceble-address.d.ts +11 -0
- package/dist/esm/utils/address/to-bounceble-address.d.ts.map +1 -0
- package/dist/esm/utils/address/to-bounceble-address.js +31 -0
- package/dist/esm/utils/address/to-non-bounceble-address.d.ts +11 -0
- package/dist/esm/utils/address/to-non-bounceble-address.d.ts.map +1 -0
- package/dist/esm/utils/address/to-non-bounceble-address.js +31 -0
- package/dist/esm/utils/amount/calc-fiat-value.d.ts +13 -0
- package/dist/esm/utils/amount/calc-fiat-value.d.ts.map +1 -0
- package/dist/esm/utils/amount/calc-fiat-value.js +19 -0
- package/dist/esm/utils/amount/calc-fiat-value.test.d.ts +9 -0
- package/dist/esm/utils/amount/calc-fiat-value.test.d.ts.map +1 -0
- package/dist/esm/utils/amount/calc-fiat-value.test.js +37 -0
- package/dist/esm/utils/amount/format-large-value.d.ts +9 -0
- package/dist/esm/utils/amount/format-large-value.d.ts.map +1 -0
- package/dist/esm/utils/amount/format-large-value.js +36 -0
- package/dist/esm/utils/amount/format-large-value.test.d.ts +9 -0
- package/dist/esm/utils/amount/format-large-value.test.d.ts.map +1 -0
- package/dist/esm/utils/amount/format-large-value.test.js +41 -0
- package/dist/esm/utils/amount/truncate-decimals.d.ts +9 -0
- package/dist/esm/utils/amount/truncate-decimals.d.ts.map +1 -0
- package/dist/esm/utils/amount/truncate-decimals.js +55 -0
- package/dist/esm/utils/amount/truncate-decimals.test.d.ts +9 -0
- package/dist/esm/utils/amount/truncate-decimals.test.d.ts.map +1 -0
- package/dist/esm/utils/amount/truncate-decimals.test.js +81 -0
- package/dist/esm/utils/balance/calc-max-spendable.d.ts +33 -0
- package/dist/esm/utils/balance/calc-max-spendable.d.ts.map +1 -0
- package/dist/esm/utils/balance/calc-max-spendable.js +25 -0
- package/dist/esm/utils/balance/calc-max-spendable.test.d.ts +9 -0
- package/dist/esm/utils/balance/calc-max-spendable.test.d.ts.map +1 -0
- package/dist/esm/utils/balance/calc-max-spendable.test.js +36 -0
- package/dist/esm/utils/balance/get-ton-shortfall.d.ts +58 -0
- package/dist/esm/utils/balance/get-ton-shortfall.d.ts.map +1 -0
- package/dist/esm/utils/balance/get-ton-shortfall.js +42 -0
- package/dist/esm/utils/balance/get-ton-shortfall.test.d.ts +9 -0
- package/dist/esm/utils/balance/get-ton-shortfall.test.d.ts.map +1 -0
- package/dist/esm/utils/balance/get-ton-shortfall.test.js +131 -0
- package/dist/esm/utils/functions/debounce.d.ts +80 -0
- package/dist/esm/utils/functions/debounce.d.ts.map +1 -0
- package/dist/esm/utils/functions/debounce.js +103 -0
- package/dist/esm/utils/index.d.ts +10 -0
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +10 -0
- package/dist/esm/utils/jetton/jetton-info.d.ts +2 -1
- package/dist/esm/utils/jetton/jetton-info.d.ts.map +1 -1
- package/dist/esm/utils/jetton/jetton-info.js +9 -0
- package/dist/esm/utils/jetton/jetton-info.test.d.ts +9 -0
- package/dist/esm/utils/jetton/jetton-info.test.d.ts.map +1 -0
- package/dist/esm/utils/jetton/jetton-info.test.js +52 -0
- package/dist/esm/utils/predicate/is-number.d.ts +9 -0
- package/dist/esm/utils/predicate/is-number.d.ts.map +1 -0
- package/dist/esm/utils/predicate/is-number.js +16 -0
- package/dist/esm/utils/predicate/is-string.d.ts +1 -1
- package/dist/esm/utils/predicate/is-string.d.ts.map +1 -1
- package/dist/esm/utils/predicate/is-string.js +2 -2
- package/docs/actions.md +64 -15
- package/docs/connectors.md +5 -25
- package/docs/staking.md +7 -6
- package/docs/swap.md +11 -10
- package/package.json +4 -3
- package/src/actions/connectors/watch-connector-by-id.ts +9 -3
- package/src/actions/connectors/watch-connectors.ts +9 -3
- package/src/actions/index.ts +32 -0
- package/src/actions/jettons/create-transfer-jetton-transaction.ts +22 -6
- package/src/actions/jettons/get-jetton-balance.ts +10 -3
- package/src/actions/jettons/get-jetton-info.ts +18 -6
- package/src/actions/jettons/get-jetton-wallet-address.ts +19 -5
- package/src/actions/nft/get-nft.ts +1 -1
- package/src/actions/providers/register-provider.ts +2 -1
- package/src/actions/staking/get-staking-provider-metadata.ts +32 -0
- package/src/actions/staking/get-staking-provider.ts +30 -0
- package/src/actions/staking/get-staking-providers.ts +5 -3
- package/src/actions/staking/set-default-staking-provider.ts +26 -0
- package/src/actions/staking/watch-staking-providers.ts +39 -0
- package/src/actions/swap/get-swap-provider.ts +21 -0
- package/src/actions/swap/get-swap-providers.ts +20 -0
- package/src/actions/swap/get-swap-quote.ts +7 -1
- package/src/actions/swap/set-default-swap-provider.ts +26 -0
- package/src/actions/swap/watch-swap-providers.ts +38 -0
- package/src/connectors/tonconnect/connectors/ton-connect-connector.ts +22 -20
- package/src/core/app-kit/constants/events.ts +3 -9
- package/src/core/app-kit/index.ts +4 -4
- package/src/core/app-kit/services/app-kit.ts +18 -7
- package/src/core/app-kit/types/config.ts +6 -3
- package/src/core/app-kit/types/events.ts +13 -15
- package/src/core/cache/adapters/lru-app-kit-cache.test.ts +77 -0
- package/src/core/cache/adapters/lru-app-kit-cache.ts +38 -0
- package/src/core/cache/index.ts +12 -0
- package/src/core/cache/types/app-kit-cache.ts +14 -0
- package/src/core/cache/utils/get-cache-key.test.ts +34 -0
- package/src/core/cache/utils/get-cache-key.ts +12 -0
- package/src/index.ts +1 -0
- package/src/queries/balances/get-balance-by-address.ts +11 -4
- package/src/queries/index.ts +0 -6
- package/src/queries/jettons/get-jetton-balance-by-address.ts +13 -12
- package/src/queries/jettons/get-jetton-info.ts +6 -2
- package/src/queries/jettons/get-jetton-wallet-address.ts +7 -2
- package/src/queries/jettons/get-jettons-by-address.ts +18 -4
- package/src/queries/nft/get-nft.ts +7 -3
- package/src/queries/nft/get-nfts-by-address.ts +6 -2
- package/src/queries/staking/get-staked-balance.ts +10 -3
- package/src/queries/staking/get-staking-provider-info.ts +5 -2
- package/src/queries/staking/get-staking-quote.ts +13 -4
- package/src/queries/swap/get-swap-quote.ts +3 -1
- package/src/staking/index.ts +10 -1
- package/src/swap/index.ts +2 -4
- package/src/types/connector.ts +0 -8
- package/src/types/primitives.ts +1 -1
- package/src/types/provider.ts +3 -3
- package/src/utils/address/is-valid-address.ts +40 -0
- package/src/utils/address/to-bounceble-address.ts +35 -0
- package/src/utils/address/to-non-bounceble-address.ts +35 -0
- package/src/utils/amount/calc-fiat-value.test.ts +46 -0
- package/src/utils/amount/calc-fiat-value.ts +18 -0
- package/src/utils/amount/format-large-value.test.ts +50 -0
- package/src/utils/amount/format-large-value.ts +43 -0
- package/src/utils/amount/truncate-decimals.test.ts +97 -0
- package/src/utils/amount/truncate-decimals.ts +56 -0
- package/src/utils/balance/calc-max-spendable.test.ts +46 -0
- package/src/utils/balance/calc-max-spendable.ts +44 -0
- package/src/utils/balance/get-ton-shortfall.test.ts +148 -0
- package/src/utils/balance/get-ton-shortfall.ts +82 -0
- package/src/utils/functions/debounce.ts +169 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/jetton/jetton-info.test.ts +65 -0
- package/src/utils/jetton/jetton-info.ts +12 -1
- package/src/utils/predicate/is-number.ts +19 -0
- package/src/utils/predicate/is-string.ts +2 -2
- package/dist/cjs/queries/staking/get-staking-providers.d.ts +0 -20
- package/dist/cjs/queries/staking/get-staking-providers.d.ts.map +0 -1
- package/dist/cjs/queries/staking/get-staking-providers.js +0 -25
- package/dist/esm/queries/staking/get-staking-providers.d.ts +0 -20
- package/dist/esm/queries/staking/get-staking-providers.d.ts.map +0 -1
- package/dist/esm/queries/staking/get-staking-providers.js +0 -20
- package/src/queries/staking/get-staking-providers.ts +0 -52
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export const isNumber = (value) => {
|
|
9
|
+
if (typeof value !== 'number') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (Number.isNaN(value)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return Number.isFinite(value);
|
|
16
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,
|
|
1
|
+
{"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/predicate/is-string.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC"}
|
package/docs/actions.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This file is auto-generated. Do not edit manually.
|
|
3
|
-
Changes will be overwritten when running the docs update script.
|
|
4
|
-
Source template: template/packages/appkit/docs/actions.md
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
1
|
# Actions
|
|
8
2
|
|
|
9
3
|
AppKit provides a set of actions to interact with the blockchain and wallets.
|
|
@@ -202,7 +196,6 @@ if (!selectedWallet) {
|
|
|
202
196
|
const balance = await getJettonBalance(appKit, {
|
|
203
197
|
jettonAddress: 'EQDBE420tTQIkoWcZ9pEOTKY63WVmwyIl3hH6yWl0r_h51Tl',
|
|
204
198
|
ownerAddress: selectedWallet.getAddress(),
|
|
205
|
-
jettonDecimals: 6,
|
|
206
199
|
});
|
|
207
200
|
console.log('Jetton Balance:', balance.toString());
|
|
208
201
|
```
|
|
@@ -246,7 +239,6 @@ const tx = await createTransferJettonTransaction(appKit, {
|
|
|
246
239
|
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
|
|
247
240
|
amount: '100', // 100 USDT
|
|
248
241
|
comment: 'Hello Jetton',
|
|
249
|
-
jettonDecimals: 6,
|
|
250
242
|
});
|
|
251
243
|
console.log('Transfer Transaction:', tx);
|
|
252
244
|
```
|
|
@@ -260,7 +252,6 @@ const result = await transferJetton(appKit, {
|
|
|
260
252
|
jettonAddress: 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs',
|
|
261
253
|
recipientAddress: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c',
|
|
262
254
|
amount: '100',
|
|
263
|
-
jettonDecimals: 6,
|
|
264
255
|
});
|
|
265
256
|
console.log('Transfer Result:', result);
|
|
266
257
|
```
|
|
@@ -445,11 +436,12 @@ console.log('NFT Transfer Result:', result);
|
|
|
445
436
|
Register a custom provider in AppKit (e.g., Swap or Streaming).
|
|
446
437
|
|
|
447
438
|
```ts
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
439
|
+
registerProvider(
|
|
440
|
+
appKit,
|
|
441
|
+
createOmnistonProvider({
|
|
442
|
+
defaultSlippageBps: 100, // 1%
|
|
443
|
+
}),
|
|
444
|
+
);
|
|
453
445
|
```
|
|
454
446
|
|
|
455
447
|
## Signing
|
|
@@ -502,6 +494,45 @@ Get the `SwapManager` instance to interact with swap providers directly.
|
|
|
502
494
|
const swapManager = getSwapManager(appKit);
|
|
503
495
|
```
|
|
504
496
|
|
|
497
|
+
### `getSwapProvider`
|
|
498
|
+
|
|
499
|
+
Get a specific swap provider by its ID.
|
|
500
|
+
|
|
501
|
+
```ts
|
|
502
|
+
const swapProvider = getSwapProvider(appKit, { id: 'stonfi' });
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### `getSwapProviders`
|
|
506
|
+
|
|
507
|
+
Get all registered swap providers. The returned array keeps a stable reference until the provider list changes.
|
|
508
|
+
|
|
509
|
+
```ts
|
|
510
|
+
const swapProviders = getSwapProviders(appKit);
|
|
511
|
+
console.log(
|
|
512
|
+
'Registered providers:',
|
|
513
|
+
swapProviders.map((p) => p.providerId),
|
|
514
|
+
);
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### `setDefaultSwapProvider`
|
|
518
|
+
|
|
519
|
+
Set the default swap provider. Subsequent quote and swap-transaction calls will use this provider when none is specified.
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
setDefaultSwapProvider(appKit, { providerId: 'stonfi' });
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### `watchSwapProviders`
|
|
526
|
+
|
|
527
|
+
Watch for new swap providers registration.
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
const unsubscribe = watchSwapProviders(appKit, {
|
|
531
|
+
onChange: () => console.log('Swap providers updated'),
|
|
532
|
+
});
|
|
533
|
+
unsubscribe();
|
|
534
|
+
```
|
|
535
|
+
|
|
505
536
|
### `getSwapQuote`
|
|
506
537
|
|
|
507
538
|
Get a swap quote from registered providers.
|
|
@@ -546,7 +577,7 @@ console.log('Available Staking Providers:', providers);
|
|
|
546
577
|
|
|
547
578
|
### `getStakingProviderInfo`
|
|
548
579
|
|
|
549
|
-
Get information about a specific staking provider.
|
|
580
|
+
Get dynamic information about a specific staking provider (e.g. APY, rate).
|
|
550
581
|
|
|
551
582
|
```ts
|
|
552
583
|
const providerInfo = await getStakingProviderInfo(appKit, {
|
|
@@ -555,6 +586,17 @@ const providerInfo = await getStakingProviderInfo(appKit, {
|
|
|
555
586
|
console.log('Provider Info:', providerInfo);
|
|
556
587
|
```
|
|
557
588
|
|
|
589
|
+
### `getStakingProviderMetadata`
|
|
590
|
+
|
|
591
|
+
Get static metadata about a specific staking provider.
|
|
592
|
+
|
|
593
|
+
```ts
|
|
594
|
+
const providerMetadata = getStakingProviderMetadata(appKit, {
|
|
595
|
+
providerId: 'tonstakers',
|
|
596
|
+
});
|
|
597
|
+
console.log('Provider Metadata:', providerMetadata);
|
|
598
|
+
```
|
|
599
|
+
|
|
558
600
|
### `getStakingQuote`
|
|
559
601
|
|
|
560
602
|
Get a staking or unstaking quote.
|
|
@@ -703,3 +745,10 @@ const unsubscribe = watchSelectedWallet(appKit, {
|
|
|
703
745
|
|
|
704
746
|
// Later: unsubscribe();
|
|
705
747
|
```
|
|
748
|
+
|
|
749
|
+
<!--
|
|
750
|
+
This file is auto-generated. Do not edit manually.
|
|
751
|
+
Changes will be overwritten when running the docs update script.
|
|
752
|
+
Source template: template/packages/appkit/docs/actions.md
|
|
753
|
+
-->
|
|
754
|
+
|
package/docs/connectors.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This file is auto-generated. Do not edit manually.
|
|
3
|
-
Changes will be overwritten when running the docs update script.
|
|
4
|
-
Source template: template/packages/appkit/docs/connectors.md
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
1
|
# Connectors
|
|
8
2
|
|
|
9
3
|
AppKit supports wallet connections through connectors. The primary connector is `TonConnect`.
|
|
@@ -116,26 +110,12 @@ interface TonConnectConnectorConfig {
|
|
|
116
110
|
* @default 'tonconnect'
|
|
117
111
|
*/
|
|
118
112
|
id?: string;
|
|
119
|
-
/**
|
|
120
|
-
* Connector metadata
|
|
121
|
-
*/
|
|
122
|
-
metadata?: ConnectorMetadata;
|
|
123
113
|
}
|
|
124
114
|
```
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
<!--
|
|
117
|
+
This file is auto-generated. Do not edit manually.
|
|
118
|
+
Changes will be overwritten when running the docs update script.
|
|
119
|
+
Source template: template/packages/appkit/docs/connectors.md
|
|
120
|
+
-->
|
|
129
121
|
|
|
130
|
-
```typescript
|
|
131
|
-
interface ConnectorMetadata {
|
|
132
|
-
/**
|
|
133
|
-
* Connector name
|
|
134
|
-
*/
|
|
135
|
-
name: string;
|
|
136
|
-
/**
|
|
137
|
-
* Connector icon URL
|
|
138
|
-
*/
|
|
139
|
-
iconUrl?: string;
|
|
140
|
-
}
|
|
141
|
-
```
|
package/docs/staking.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This file is auto-generated. Do not edit manually.
|
|
3
|
-
Changes will be overwritten when running the docs update script.
|
|
4
|
-
Source template: template/packages/appkit/docs/staking.md
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
1
|
# Staking
|
|
8
2
|
|
|
9
3
|
AppKit supports staking through various providers. Available providers:
|
|
@@ -56,3 +50,10 @@ registerProvider(appKit, createTonstakersProvider());
|
|
|
56
50
|
## Configuration
|
|
57
51
|
|
|
58
52
|
- **Tonstakers**: [Tonstakers documentation](https://docs.tonstakers.com) and [provider README](https://github.com/ton-connect/kit/blob/main/packages/walletkit/src/defi/staking/tonstakers/README.md)
|
|
53
|
+
|
|
54
|
+
<!--
|
|
55
|
+
This file is auto-generated. Do not edit manually.
|
|
56
|
+
Changes will be overwritten when running the docs update script.
|
|
57
|
+
Source template: template/packages/appkit/docs/staking.md
|
|
58
|
+
-->
|
|
59
|
+
|
package/docs/swap.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
This file is auto-generated. Do not edit manually.
|
|
3
|
-
Changes will be overwritten when running the docs update script.
|
|
4
|
-
Source template: template/packages/appkit/docs/swap.md
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
1
|
# Swap
|
|
8
2
|
|
|
9
3
|
AppKit supports swapping assets through the `SwapProvider` interface. Available providers:
|
|
@@ -37,11 +31,11 @@ const appKit = new AppKit({
|
|
|
37
31
|
},
|
|
38
32
|
},
|
|
39
33
|
providers: [
|
|
40
|
-
|
|
34
|
+
createOmnistonProvider({
|
|
41
35
|
apiUrl: 'https://api.ston.fi',
|
|
42
36
|
defaultSlippageBps: 100, // 1%
|
|
43
37
|
}),
|
|
44
|
-
|
|
38
|
+
createDeDustProvider({
|
|
45
39
|
defaultSlippageBps: 100,
|
|
46
40
|
referralAddress: 'EQ...', // Optional
|
|
47
41
|
}),
|
|
@@ -67,11 +61,18 @@ const appKit = new AppKit({
|
|
|
67
61
|
});
|
|
68
62
|
|
|
69
63
|
// 2. Register swap providers
|
|
70
|
-
registerProvider(appKit,
|
|
71
|
-
registerProvider(appKit,
|
|
64
|
+
registerProvider(appKit, createOmnistonProvider({ defaultSlippageBps: 100 }));
|
|
65
|
+
registerProvider(appKit, createDeDustProvider({ defaultSlippageBps: 100 }));
|
|
72
66
|
```
|
|
73
67
|
|
|
74
68
|
## Configuration
|
|
75
69
|
|
|
76
70
|
- **Omniston**: [Omniston SDK documentation](https://docs.ston.org/docs/developer-section/sdk/omniston-sdk) and [provider README](https://github.com/ton-connect/kit/blob/main/packages/walletkit/src/defi/swap/omniston/README.md)
|
|
77
71
|
- **DeDust**: [provider README](https://github.com/ton-connect/kit/blob/main/packages/walletkit/src/defi/swap/dedust/README.md)
|
|
72
|
+
|
|
73
|
+
<!--
|
|
74
|
+
This file is auto-generated. Do not edit manually.
|
|
75
|
+
Changes will be overwritten when running the docs update script.
|
|
76
|
+
Source template: template/packages/appkit/docs/swap.md
|
|
77
|
+
-->
|
|
78
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/appkit",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,7 +79,8 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"
|
|
82
|
+
"lru-cache": "11.3.5",
|
|
83
|
+
"@ton/walletkit": "1.0.0-alpha.1"
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
86
|
"@tanstack/query-core": ">=5.0.0",
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
"devDependencies": {
|
|
105
106
|
"@tanstack/query-core": "5.99.0",
|
|
106
107
|
"@ton/core": "0.63.1",
|
|
107
|
-
"@tonconnect/ui": "2.
|
|
108
|
+
"@tonconnect/ui": "2.5.0-alpha.0",
|
|
108
109
|
"typescript": "~5.9.3",
|
|
109
110
|
"vitest": "^4.1.4"
|
|
110
111
|
},
|
|
@@ -27,9 +27,15 @@ export const watchConnectorById = (
|
|
|
27
27
|
): WatchConnectorByIdReturnType => {
|
|
28
28
|
const { id, onChange } = parameters;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const handler = (): void => {
|
|
31
31
|
onChange(getConnectorById(appKit, { id }));
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const unsubscribeAdded = appKit.emitter.on(CONNECTOR_EVENTS.ADDED, handler);
|
|
35
|
+
const unsubscribeRemoved = appKit.emitter.on(CONNECTOR_EVENTS.REMOVED, handler);
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
unsubscribeAdded();
|
|
39
|
+
unsubscribeRemoved();
|
|
40
|
+
};
|
|
35
41
|
};
|
|
@@ -23,9 +23,15 @@ export type WatchConnectorsReturnType = () => void;
|
|
|
23
23
|
export const watchConnectors = (appKit: AppKit, parameters: WatchConnectorsParameters): WatchConnectorsReturnType => {
|
|
24
24
|
const { onChange } = parameters;
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const handler = (): void => {
|
|
27
27
|
onChange(getConnectors(appKit));
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const unsubscribeAdded = appKit.emitter.on(CONNECTOR_EVENTS.ADDED, handler);
|
|
31
|
+
const unsubscribeRemoved = appKit.emitter.on(CONNECTOR_EVENTS.REMOVED, handler);
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
unsubscribeAdded();
|
|
35
|
+
unsubscribeRemoved();
|
|
36
|
+
};
|
|
31
37
|
};
|
package/src/actions/index.ts
CHANGED
|
@@ -115,7 +115,19 @@ export { signCell, type SignCellParameters, type SignCellReturnType } from './si
|
|
|
115
115
|
|
|
116
116
|
// Swap
|
|
117
117
|
export { getSwapManager, type GetSwapManagerReturnType } from './swap/get-swap-manager';
|
|
118
|
+
export { getSwapProvider, type GetSwapProviderOptions, type GetSwapProviderReturnType } from './swap/get-swap-provider';
|
|
119
|
+
export { getSwapProviders, type GetSwapProvidersReturnType } from './swap/get-swap-providers';
|
|
120
|
+
export {
|
|
121
|
+
setDefaultSwapProvider,
|
|
122
|
+
type SetDefaultSwapProviderParameters,
|
|
123
|
+
type SetDefaultSwapProviderReturnType,
|
|
124
|
+
} from './swap/set-default-swap-provider';
|
|
118
125
|
export { getSwapQuote, type GetSwapQuoteOptions, type GetSwapQuoteReturnType } from './swap/get-swap-quote';
|
|
126
|
+
export {
|
|
127
|
+
watchSwapProviders,
|
|
128
|
+
type WatchSwapProvidersParameters,
|
|
129
|
+
type WatchSwapProvidersReturnType,
|
|
130
|
+
} from './swap/watch-swap-providers';
|
|
119
131
|
export {
|
|
120
132
|
buildSwapTransaction,
|
|
121
133
|
type BuildSwapTransactionOptions,
|
|
@@ -125,6 +137,21 @@ export {
|
|
|
125
137
|
// Staking
|
|
126
138
|
export { getStakingManager, type GetStakingManagerReturnType } from './staking/get-staking-manager';
|
|
127
139
|
export { getStakingProviders, type GetStakingProvidersReturnType } from './staking/get-staking-providers';
|
|
140
|
+
export {
|
|
141
|
+
getStakingProvider,
|
|
142
|
+
type GetStakingProviderOptions,
|
|
143
|
+
type GetStakingProviderReturnType,
|
|
144
|
+
} from './staking/get-staking-provider';
|
|
145
|
+
export {
|
|
146
|
+
setDefaultStakingProvider,
|
|
147
|
+
type SetDefaultStakingProviderParameters,
|
|
148
|
+
type SetDefaultStakingProviderReturnType,
|
|
149
|
+
} from './staking/set-default-staking-provider';
|
|
150
|
+
export {
|
|
151
|
+
watchStakingProviders,
|
|
152
|
+
type WatchStakingProvidersParameters,
|
|
153
|
+
type WatchStakingProvidersReturnType,
|
|
154
|
+
} from './staking/watch-staking-providers';
|
|
128
155
|
export {
|
|
129
156
|
getStakingQuote,
|
|
130
157
|
type GetStakingQuoteOptions,
|
|
@@ -145,6 +172,11 @@ export {
|
|
|
145
172
|
type GetStakingProviderInfoOptions,
|
|
146
173
|
type GetStakingProviderInfoReturnType,
|
|
147
174
|
} from './staking/get-staking-provider-info';
|
|
175
|
+
export {
|
|
176
|
+
getStakingProviderMetadata,
|
|
177
|
+
type GetStakingProviderMetadataOptions,
|
|
178
|
+
type GetStakingProviderMetadataReturnType,
|
|
179
|
+
} from './staking/get-staking-provider-metadata';
|
|
148
180
|
|
|
149
181
|
// Transactions
|
|
150
182
|
export {
|
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
import type { TransactionRequest } from '../../types/transaction';
|
|
18
18
|
import type { AppKit } from '../../core/app-kit';
|
|
19
19
|
import { getSelectedWallet } from '../wallets/get-selected-wallet';
|
|
20
|
+
import { getJettonInfo } from './get-jetton-info';
|
|
21
|
+
import { isNumber } from '../../utils';
|
|
20
22
|
|
|
21
23
|
export interface CreateTransferJettonTransactionParameters {
|
|
22
24
|
jettonAddress: string;
|
|
23
25
|
recipientAddress: string;
|
|
24
26
|
amount: string;
|
|
25
|
-
jettonDecimals
|
|
27
|
+
jettonDecimals?: number;
|
|
26
28
|
comment?: string;
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -44,16 +46,30 @@ export const createTransferJettonTransaction = async (
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
// Get client from network manager
|
|
47
|
-
const
|
|
49
|
+
const network = wallet.getNetwork();
|
|
50
|
+
const client = appKit.networkManager.getClient(network);
|
|
48
51
|
|
|
49
52
|
// Get jetton wallet address
|
|
50
|
-
const
|
|
53
|
+
const ownerAddress = wallet.getAddress();
|
|
54
|
+
const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress);
|
|
55
|
+
|
|
56
|
+
let decimals = jettonDecimals;
|
|
57
|
+
|
|
58
|
+
if (!isNumber(decimals)) {
|
|
59
|
+
const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network });
|
|
60
|
+
|
|
61
|
+
if (!isNumber(jettonInfo?.decimals)) {
|
|
62
|
+
throw new Error(`Jetton decimals not found for address ${jettonAddress}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
decimals = jettonInfo.decimals;
|
|
66
|
+
}
|
|
51
67
|
|
|
52
68
|
// Create jetton transfer payload
|
|
53
69
|
const jettonPayload = createJettonTransferPayload({
|
|
54
|
-
amount: parseUnits(amount,
|
|
70
|
+
amount: parseUnits(amount, decimals),
|
|
55
71
|
destination: recipientAddress,
|
|
56
|
-
responseDestination:
|
|
72
|
+
responseDestination: ownerAddress,
|
|
57
73
|
comment,
|
|
58
74
|
});
|
|
59
75
|
|
|
@@ -62,6 +78,6 @@ export const createTransferJettonTransaction = async (
|
|
|
62
78
|
targetAddress: jettonWalletAddress,
|
|
63
79
|
amount: DEFAULT_JETTON_GAS_FEE,
|
|
64
80
|
payload: jettonPayload,
|
|
65
|
-
fromAddress:
|
|
81
|
+
fromAddress: ownerAddress,
|
|
66
82
|
});
|
|
67
83
|
};
|
|
@@ -11,13 +11,14 @@ import type { TokenAmount, UserFriendlyAddress } from '@ton/walletkit';
|
|
|
11
11
|
|
|
12
12
|
import type { AppKit } from '../../core/app-kit';
|
|
13
13
|
import { getJettonWalletAddress } from './get-jetton-wallet-address';
|
|
14
|
-
import {
|
|
14
|
+
import { getJettonInfo } from './get-jetton-info';
|
|
15
|
+
import { isNumber, resolveNetwork } from '../../utils';
|
|
15
16
|
import type { Network } from '../../types/network';
|
|
16
17
|
|
|
17
18
|
export interface GetJettonBalanceOptions {
|
|
18
19
|
jettonAddress: UserFriendlyAddress;
|
|
19
20
|
ownerAddress: UserFriendlyAddress;
|
|
20
|
-
jettonDecimals
|
|
21
|
+
jettonDecimals?: number;
|
|
21
22
|
network?: Network;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -38,5 +39,11 @@ export const getJettonBalance = async (
|
|
|
38
39
|
});
|
|
39
40
|
const balance = await getJettonBalanceFromClient(client, jettonWalletAddress);
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
if (isNumber(jettonDecimals)) {
|
|
43
|
+
return formatUnits(balance, jettonDecimals);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const jettonInfo = await getJettonInfo(appKit, { address: jettonAddress, network });
|
|
47
|
+
|
|
48
|
+
return formatUnits(balance, jettonInfo?.decimals ?? 0);
|
|
42
49
|
};
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
import type { JettonInfo } from '@ton/walletkit';
|
|
10
10
|
|
|
11
11
|
import type { AppKit } from '../../core/app-kit';
|
|
12
|
-
import { resolveNetwork } from '../../utils
|
|
12
|
+
import { toBounceableAddress, resolveNetwork, isJettonInfo } from '../../utils';
|
|
13
13
|
import type { Network } from '../../types/network';
|
|
14
|
+
import { getCacheKey } from '../../core/cache';
|
|
14
15
|
|
|
15
16
|
export interface GetJettonInfoOptions {
|
|
16
17
|
address: string;
|
|
@@ -19,16 +20,23 @@ export interface GetJettonInfoOptions {
|
|
|
19
20
|
|
|
20
21
|
export type GetJettonInfoReturnType = JettonInfo | null;
|
|
21
22
|
|
|
23
|
+
const getJettonInfoCacheKey = getCacheKey('jetton-info');
|
|
24
|
+
|
|
22
25
|
export const getJettonInfo = async (
|
|
23
26
|
appKit: AppKit,
|
|
24
27
|
options: GetJettonInfoOptions,
|
|
25
28
|
): Promise<GetJettonInfoReturnType> => {
|
|
26
|
-
const
|
|
29
|
+
const address = toBounceableAddress(options.address);
|
|
30
|
+
const network = resolveNetwork(appKit, options.network);
|
|
31
|
+
const cacheKey = getJettonInfoCacheKey(address, network.chainId);
|
|
32
|
+
|
|
33
|
+
const cached = await appKit.cache.get(cacheKey);
|
|
34
|
+
if (cached && isJettonInfo(cached)) return cached;
|
|
27
35
|
|
|
28
|
-
const client = appKit.networkManager.getClient(
|
|
36
|
+
const client = appKit.networkManager.getClient(network);
|
|
29
37
|
|
|
30
38
|
const response = await client.jettonsByAddress({
|
|
31
|
-
address
|
|
39
|
+
address,
|
|
32
40
|
offset: 0,
|
|
33
41
|
limit: 1,
|
|
34
42
|
});
|
|
@@ -61,13 +69,17 @@ export const getJettonInfo = async (
|
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
const result: GetJettonInfoReturnType = {
|
|
73
|
+
address,
|
|
65
74
|
decimals,
|
|
66
|
-
address: jetton.jetton,
|
|
67
75
|
name: tokenInfo?.name ?? '',
|
|
68
76
|
symbol: tokenInfo?.symbol ?? '',
|
|
69
77
|
description: tokenInfo?.description ?? '',
|
|
70
78
|
image: tokenInfo?.image,
|
|
71
79
|
uri: tokenInfo?.extra?.uri,
|
|
72
80
|
};
|
|
81
|
+
|
|
82
|
+
await appKit.cache.set(cacheKey, result);
|
|
83
|
+
|
|
84
|
+
return result;
|
|
73
85
|
};
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { getJettonWalletAddressFromClient } from '@ton/walletkit';
|
|
10
|
-
import type { UserFriendlyAddress } from '@ton/walletkit';
|
|
11
10
|
|
|
11
|
+
import type { UserFriendlyAddress } from '../../types/primitives';
|
|
12
12
|
import type { AppKit } from '../../core/app-kit';
|
|
13
|
-
import { resolveNetwork } from '../../utils/network/resolve-network';
|
|
14
13
|
import type { Network } from '../../types/network';
|
|
14
|
+
import { getCacheKey } from '../../core/cache';
|
|
15
|
+
import { isFriendlyTonAddress, resolveNetwork, toBounceableAddress } from '../../utils';
|
|
15
16
|
|
|
16
17
|
export interface GetJettonWalletAddressOptions {
|
|
17
18
|
jettonAddress: UserFriendlyAddress;
|
|
@@ -21,13 +22,26 @@ export interface GetJettonWalletAddressOptions {
|
|
|
21
22
|
|
|
22
23
|
export type GetJettonWalletAddressReturnType = UserFriendlyAddress;
|
|
23
24
|
|
|
25
|
+
const getJettonWalletCacheKey = getCacheKey('jetton-wallet-address');
|
|
26
|
+
|
|
24
27
|
export const getJettonWalletAddress = async (
|
|
25
28
|
appKit: AppKit,
|
|
26
29
|
options: GetJettonWalletAddressOptions,
|
|
27
30
|
): Promise<GetJettonWalletAddressReturnType> => {
|
|
28
|
-
const
|
|
31
|
+
const ownerAddress = toBounceableAddress(options.ownerAddress);
|
|
32
|
+
const jettonAddress = toBounceableAddress(options.jettonAddress);
|
|
33
|
+
const network = resolveNetwork(appKit, options.network);
|
|
34
|
+
|
|
35
|
+
const cacheKey = getJettonWalletCacheKey(network.chainId, ownerAddress, jettonAddress);
|
|
36
|
+
|
|
37
|
+
const cached = await appKit.cache.get(cacheKey);
|
|
38
|
+
if (cached && isFriendlyTonAddress(cached)) {
|
|
39
|
+
return cached;
|
|
40
|
+
}
|
|
29
41
|
|
|
30
|
-
const client = appKit.networkManager.getClient(
|
|
42
|
+
const client = appKit.networkManager.getClient(network);
|
|
43
|
+
const jettonWalletAddress = await getJettonWalletAddressFromClient(client, jettonAddress, ownerAddress);
|
|
44
|
+
await appKit.cache.set(cacheKey, jettonWalletAddress);
|
|
31
45
|
|
|
32
|
-
return
|
|
46
|
+
return jettonWalletAddress;
|
|
33
47
|
};
|
|
@@ -19,7 +19,7 @@ export interface GetNftOptions {
|
|
|
19
19
|
network?: Network;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export type GetNftReturnType = NFT |
|
|
22
|
+
export type GetNftReturnType = NFT | undefined;
|
|
23
23
|
|
|
24
24
|
export const getNft = async (appKit: AppKit, options: GetNftOptions): Promise<GetNftReturnType> => {
|
|
25
25
|
const { address, network } = options;
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import type { ProviderInput } from '@ton/walletkit';
|
|
10
10
|
|
|
11
|
+
import type { AppKitProvider } from '../../types/provider';
|
|
11
12
|
import type { AppKit } from '../../core/app-kit';
|
|
12
13
|
|
|
13
|
-
export type RegisterProviderOptions = ProviderInput
|
|
14
|
+
export type RegisterProviderOptions = ProviderInput<AppKitProvider>;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Register provider
|
|
@@ -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 type { StakingProviderMetadata, Network } from '@ton/walletkit';
|
|
10
|
+
|
|
11
|
+
import { resolveNetwork } from '../../utils';
|
|
12
|
+
import type { AppKit } from '../../core/app-kit';
|
|
13
|
+
|
|
14
|
+
export type GetStakingProviderMetadataOptions = {
|
|
15
|
+
network?: Network;
|
|
16
|
+
providerId?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type GetStakingProviderMetadataReturnType = StakingProviderMetadata;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get staking provider static metadata
|
|
23
|
+
*/
|
|
24
|
+
export const getStakingProviderMetadata = (
|
|
25
|
+
appKit: AppKit,
|
|
26
|
+
options: GetStakingProviderMetadataOptions = {},
|
|
27
|
+
): GetStakingProviderMetadataReturnType => {
|
|
28
|
+
return appKit.stakingManager.getStakingProviderMetadata(
|
|
29
|
+
resolveNetwork(appKit, options.network),
|
|
30
|
+
options.providerId,
|
|
31
|
+
);
|
|
32
|
+
};
|