@ton/appkit-react 0.0.1-alpha.2 → 0.0.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 +211 -1
- package/dist/components/block/block.d.ts +13 -0
- package/dist/components/block/block.d.ts.map +1 -0
- package/dist/components/block/block.js +18 -0
- package/dist/components/block/block.js.map +1 -0
- package/dist/components/block/block.mjs +11 -0
- package/dist/components/block/block.mjs.map +1 -0
- package/dist/components/block/block.module.css +13 -0
- package/dist/components/block/block.module.css.map +1 -0
- package/dist/components/block/block.stories.d.ts +15 -0
- package/dist/components/block/block.stories.d.ts.map +1 -0
- package/dist/components/block/block.stories.js +45 -0
- package/dist/components/block/block.stories.js.map +1 -0
- package/dist/components/block/block.stories.mjs +39 -0
- package/dist/components/block/block.stories.mjs.map +1 -0
- package/dist/components/block/index.d.ts +9 -0
- package/dist/components/block/index.d.ts.map +1 -0
- package/dist/components/block/index.js +14 -0
- package/dist/components/block/index.js.map +1 -0
- package/dist/components/block/index.mjs +3 -0
- package/dist/components/block/index.mjs.map +1 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +18 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/button.mjs +11 -0
- package/dist/components/button/button.mjs.map +1 -0
- package/dist/components/button/button.module.css +33 -0
- package/dist/components/button/button.module.css.map +1 -0
- package/dist/components/button/button.stories.d.ts +16 -0
- package/dist/components/button/button.stories.d.ts.map +1 -0
- package/dist/components/button/button.stories.js +53 -0
- package/dist/components/button/button.stories.js.map +1 -0
- package/dist/components/button/button.stories.mjs +46 -0
- package/dist/components/button/button.stories.mjs.map +1 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +12 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button/index.mjs +3 -0
- package/dist/components/button/index.mjs.map +1 -0
- package/dist/components/circle-icon/circle-icon.d.ts +16 -0
- package/dist/components/circle-icon/circle-icon.d.ts.map +1 -0
- package/dist/components/circle-icon/circle-icon.js +22 -0
- package/dist/components/circle-icon/circle-icon.js.map +1 -0
- package/dist/components/circle-icon/circle-icon.mjs +15 -0
- package/dist/components/circle-icon/circle-icon.mjs.map +1 -0
- package/dist/components/circle-icon/circle-icon.module.css +31 -0
- package/dist/components/circle-icon/circle-icon.module.css.map +1 -0
- package/dist/components/circle-icon/circle-icon.stories.d.ts +18 -0
- package/dist/components/circle-icon/circle-icon.stories.d.ts.map +1 -0
- package/dist/components/circle-icon/circle-icon.stories.js +62 -0
- package/dist/components/circle-icon/circle-icon.stories.js.map +1 -0
- package/dist/components/circle-icon/circle-icon.stories.mjs +53 -0
- package/dist/components/circle-icon/circle-icon.stories.mjs.map +1 -0
- package/dist/components/circle-icon/index.d.ts +9 -0
- package/dist/components/circle-icon/index.d.ts.map +1 -0
- package/dist/components/circle-icon/index.js +14 -0
- package/dist/components/circle-icon/index.js.map +1 -0
- package/dist/components/circle-icon/index.mjs +3 -0
- package/dist/components/circle-icon/index.mjs.map +1 -0
- package/dist/components/ton-icon/index.d.ts +9 -0
- package/dist/components/ton-icon/index.d.ts.map +1 -0
- package/dist/components/ton-icon/index.js +16 -0
- package/dist/components/ton-icon/index.js.map +1 -0
- package/dist/components/ton-icon/index.mjs +3 -0
- package/dist/components/ton-icon/index.mjs.map +1 -0
- package/dist/components/ton-icon/ton-icon.d.ts +14 -0
- package/dist/components/ton-icon/ton-icon.d.ts.map +1 -0
- package/dist/components/ton-icon/ton-icon.js +39 -0
- package/dist/components/ton-icon/ton-icon.js.map +1 -0
- package/dist/components/ton-icon/ton-icon.mjs +36 -0
- package/dist/components/ton-icon/ton-icon.mjs.map +1 -0
- package/dist/components/ton-icon/ton-icon.stories.d.ts +20 -0
- package/dist/components/ton-icon/ton-icon.stories.d.ts.map +1 -0
- package/dist/components/ton-icon/ton-icon.stories.js +71 -0
- package/dist/components/ton-icon/ton-icon.stories.js.map +1 -0
- package/dist/components/ton-icon/ton-icon.stories.mjs +60 -0
- package/dist/components/ton-icon/ton-icon.stories.mjs.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.d.ts +21 -0
- package/dist/features/balances/components/balance-badge/balance-badge.d.ts.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.js +41 -0
- package/dist/features/balances/components/balance-badge/balance-badge.js.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.mjs +34 -0
- package/dist/features/balances/components/balance-badge/balance-badge.mjs.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.module.css +19 -0
- package/dist/features/balances/components/balance-badge/balance-badge.module.css.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.d.ts +16 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.d.ts.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.js +59 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.js.map +1 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.mjs +51 -0
- package/dist/features/balances/components/balance-badge/balance-badge.stories.mjs.map +1 -0
- package/dist/features/balances/components/balance-badge/index.d.ts +9 -0
- package/dist/features/balances/components/balance-badge/index.d.ts.map +1 -0
- package/dist/features/balances/components/balance-badge/index.js +12 -0
- package/dist/features/balances/components/balance-badge/index.js.map +1 -0
- package/dist/features/balances/components/balance-badge/index.mjs +3 -0
- package/dist/features/balances/components/balance-badge/index.mjs.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.d.ts +17 -0
- package/dist/features/balances/components/currency-item/currency-item.d.ts.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.js +44 -0
- package/dist/features/balances/components/currency-item/currency-item.js.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.mjs +37 -0
- package/dist/features/balances/components/currency-item/currency-item.mjs.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.module.css +69 -0
- package/dist/features/balances/components/currency-item/currency-item.module.css.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.d.ts +19 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.d.ts.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.js +89 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.js.map +1 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.mjs +79 -0
- package/dist/features/balances/components/currency-item/currency-item.stories.mjs.map +1 -0
- package/dist/features/balances/components/currency-item/index.d.ts +9 -0
- package/dist/features/balances/components/currency-item/index.d.ts.map +1 -0
- package/dist/features/balances/components/currency-item/index.js +14 -0
- package/dist/features/balances/components/currency-item/index.js.map +1 -0
- package/dist/features/balances/components/currency-item/index.mjs +3 -0
- package/dist/features/balances/components/currency-item/index.mjs.map +1 -0
- package/dist/features/balances/components/send-jetton-button/index.d.ts +9 -0
- package/dist/features/balances/components/send-jetton-button/index.d.ts.map +1 -0
- package/dist/features/balances/components/send-jetton-button/index.js +14 -0
- package/dist/features/balances/components/send-jetton-button/index.js.map +1 -0
- package/dist/features/balances/components/send-jetton-button/index.mjs +3 -0
- package/dist/features/balances/components/send-jetton-button/index.mjs.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.d.ts +21 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.d.ts.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.js +56 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.js.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.mjs +54 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.mjs.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.d.ts +22 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.d.ts.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.js +58 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.js.map +1 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.mjs +49 -0
- package/dist/features/balances/components/send-jetton-button/send-jetton-button.stories.mjs.map +1 -0
- package/dist/features/balances/components/send-ton-button/index.d.ts +9 -0
- package/dist/features/balances/components/send-ton-button/index.d.ts.map +1 -0
- package/dist/features/balances/components/send-ton-button/index.js +14 -0
- package/dist/features/balances/components/send-ton-button/index.js.map +1 -0
- package/dist/features/balances/components/send-ton-button/index.mjs +3 -0
- package/dist/features/balances/components/send-ton-button/index.mjs.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.d.ts +16 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.d.ts.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.js +33 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.js.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.mjs +31 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.mjs.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.d.ts +21 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.d.ts.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.js +52 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.js.map +1 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.mjs +44 -0
- package/dist/features/balances/components/send-ton-button/send-ton-button.stories.mjs.map +1 -0
- package/dist/features/balances/hooks/use-balance-by-address.d.ts +16 -0
- package/dist/features/balances/hooks/use-balance-by-address.d.ts.map +1 -0
- package/dist/features/balances/hooks/use-balance-by-address.js +14 -0
- package/dist/features/balances/hooks/use-balance-by-address.js.map +1 -0
- package/dist/features/balances/hooks/use-balance-by-address.mjs +12 -0
- package/dist/features/balances/hooks/use-balance-by-address.mjs.map +1 -0
- package/dist/features/balances/hooks/use-balance.d.ts +16 -0
- package/dist/features/balances/hooks/use-balance.d.ts.map +1 -0
- package/dist/features/balances/hooks/use-balance.js +13 -0
- package/dist/features/balances/hooks/use-balance.js.map +1 -0
- package/dist/features/balances/hooks/use-balance.mjs +11 -0
- package/dist/features/balances/hooks/use-balance.mjs.map +1 -0
- package/dist/features/balances/index.d.ts +14 -0
- package/dist/features/balances/index.d.ts.map +1 -0
- package/dist/features/balances/index.js +49 -0
- package/dist/features/balances/index.js.map +1 -0
- package/dist/features/balances/index.mjs +8 -0
- package/dist/features/balances/index.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.d.ts +16 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.js +14 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.js.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.mjs +12 -0
- package/dist/features/jettons/hooks/use-jetton-balance-by-address.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-info.d.ts +16 -0
- package/dist/features/jettons/hooks/use-jetton-info.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-info.js +14 -0
- package/dist/features/jettons/hooks/use-jetton-info.js.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-info.mjs +12 -0
- package/dist/features/jettons/hooks/use-jetton-info.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.d.ts +16 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.js +14 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.js.map +1 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.mjs +12 -0
- package/dist/features/jettons/hooks/use-jetton-wallet-address.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.d.ts +16 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.js +14 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.js.map +1 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.mjs +12 -0
- package/dist/features/jettons/hooks/use-jettons-by-address.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-jettons.d.ts +16 -0
- package/dist/features/jettons/hooks/use-jettons.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-jettons.js +13 -0
- package/dist/features/jettons/hooks/use-jettons.js.map +1 -0
- package/dist/features/jettons/hooks/use-jettons.mjs +11 -0
- package/dist/features/jettons/hooks/use-jettons.mjs.map +1 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.d.ts +14 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.d.ts.map +1 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.js +14 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.js.map +1 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.mjs +12 -0
- package/dist/features/jettons/hooks/use-transfer-jetton.mjs.map +1 -0
- package/dist/features/jettons/index.d.ts +14 -0
- package/dist/features/jettons/index.d.ts.map +1 -0
- package/dist/features/jettons/index.js +49 -0
- package/dist/features/jettons/index.js.map +1 -0
- package/dist/features/jettons/index.mjs +8 -0
- package/dist/features/jettons/index.mjs.map +1 -0
- package/dist/features/network/hooks/use-network.d.ts +14 -0
- package/dist/features/network/hooks/use-network.d.ts.map +1 -0
- package/dist/features/network/hooks/use-network.js +13 -0
- package/dist/features/network/hooks/use-network.js.map +1 -0
- package/dist/features/network/hooks/use-network.mjs +11 -0
- package/dist/features/network/hooks/use-network.mjs.map +1 -0
- package/dist/features/network/hooks/use-networks.d.ts +14 -0
- package/dist/features/network/hooks/use-networks.d.ts.map +1 -0
- package/dist/features/network/hooks/use-networks.js +23 -0
- package/dist/features/network/hooks/use-networks.js.map +1 -0
- package/dist/features/network/hooks/use-networks.mjs +21 -0
- package/dist/features/network/hooks/use-networks.mjs.map +1 -0
- package/dist/features/network/index.d.ts +10 -0
- package/dist/features/network/index.d.ts.map +1 -0
- package/dist/features/network/index.js +17 -0
- package/dist/features/network/index.js.map +1 -0
- package/dist/features/network/index.mjs +4 -0
- package/dist/features/network/index.mjs.map +1 -0
- package/dist/features/nft/components/nft-item/index.d.ts +9 -0
- package/dist/features/nft/components/nft-item/index.d.ts.map +1 -0
- package/dist/features/nft/components/nft-item/index.js +14 -0
- package/dist/features/nft/components/nft-item/index.js.map +1 -0
- package/dist/features/nft/components/nft-item/index.mjs +3 -0
- package/dist/features/nft/components/nft-item/index.mjs.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.d.ts +14 -0
- package/dist/features/nft/components/nft-item/nft-item.d.ts.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.js +43 -0
- package/dist/features/nft/components/nft-item/nft-item.js.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.mjs +36 -0
- package/dist/features/nft/components/nft-item/nft-item.mjs.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.module.css +65 -0
- package/dist/features/nft/components/nft-item/nft-item.module.css.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.d.ts +25 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.d.ts.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.js +124 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.js.map +1 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.mjs +110 -0
- package/dist/features/nft/components/nft-item/nft-item.stories.mjs.map +1 -0
- package/dist/features/nft/hooks/use-nft.d.ts +16 -0
- package/dist/features/nft/hooks/use-nft.d.ts.map +1 -0
- package/dist/features/nft/hooks/use-nft.js +14 -0
- package/dist/features/nft/hooks/use-nft.js.map +1 -0
- package/dist/features/nft/hooks/use-nft.mjs +12 -0
- package/dist/features/nft/hooks/use-nft.mjs.map +1 -0
- package/dist/features/nft/hooks/use-nfts-by-address.d.ts +16 -0
- package/dist/features/nft/hooks/use-nfts-by-address.d.ts.map +1 -0
- package/dist/features/nft/hooks/use-nfts-by-address.js +14 -0
- package/dist/features/nft/hooks/use-nfts-by-address.js.map +1 -0
- package/dist/features/nft/hooks/use-nfts-by-address.mjs +12 -0
- package/dist/features/nft/hooks/use-nfts-by-address.mjs.map +1 -0
- package/dist/features/nft/hooks/use-nfts.d.ts +16 -0
- package/dist/features/nft/hooks/use-nfts.d.ts.map +1 -0
- package/dist/features/nft/hooks/use-nfts.js +13 -0
- package/dist/features/nft/hooks/use-nfts.js.map +1 -0
- package/dist/features/nft/hooks/use-nfts.mjs +11 -0
- package/dist/features/nft/hooks/use-nfts.mjs.map +1 -0
- package/dist/features/nft/hooks/use-transfer-nft.d.ts +14 -0
- package/dist/features/nft/hooks/use-transfer-nft.d.ts.map +1 -0
- package/dist/features/nft/hooks/use-transfer-nft.js +14 -0
- package/dist/features/nft/hooks/use-transfer-nft.js.map +1 -0
- package/dist/features/nft/hooks/use-transfer-nft.mjs +12 -0
- package/dist/features/nft/hooks/use-transfer-nft.mjs.map +1 -0
- package/dist/features/nft/index.d.ts +13 -0
- package/dist/features/nft/index.d.ts.map +1 -0
- package/dist/features/nft/index.js +42 -0
- package/dist/features/nft/index.js.map +1 -0
- package/dist/features/nft/index.mjs +7 -0
- package/dist/features/nft/index.mjs.map +1 -0
- package/dist/features/signing/hooks/use-sign-binary.d.ts +25 -0
- package/dist/features/signing/hooks/use-sign-binary.d.ts.map +1 -0
- package/dist/features/signing/hooks/use-sign-binary.js +14 -0
- package/dist/features/signing/hooks/use-sign-binary.js.map +1 -0
- package/dist/features/signing/hooks/use-sign-binary.mjs +12 -0
- package/dist/features/signing/hooks/use-sign-binary.mjs.map +1 -0
- package/dist/features/signing/hooks/use-sign-cell.d.ts +26 -0
- package/dist/features/signing/hooks/use-sign-cell.d.ts.map +1 -0
- package/dist/features/signing/hooks/use-sign-cell.js +14 -0
- package/dist/features/signing/hooks/use-sign-cell.js.map +1 -0
- package/dist/features/signing/hooks/use-sign-cell.mjs +12 -0
- package/dist/features/signing/hooks/use-sign-cell.mjs.map +1 -0
- package/dist/features/signing/hooks/use-sign-text.d.ts +25 -0
- package/dist/features/signing/hooks/use-sign-text.d.ts.map +1 -0
- package/dist/features/signing/hooks/use-sign-text.js +14 -0
- package/dist/features/signing/hooks/use-sign-text.js.map +1 -0
- package/dist/features/signing/hooks/use-sign-text.mjs +12 -0
- package/dist/features/signing/hooks/use-sign-text.mjs.map +1 -0
- package/dist/features/signing/index.d.ts +11 -0
- package/dist/features/signing/index.d.ts.map +1 -0
- package/dist/features/signing/index.js +28 -0
- package/dist/features/signing/index.js.map +1 -0
- package/dist/features/signing/index.mjs +5 -0
- package/dist/features/signing/index.mjs.map +1 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.d.ts +13 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.d.ts.map +1 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.js +14 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.js.map +1 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.mjs +12 -0
- package/dist/features/swap/hooks/use-build-swap-transaction.mjs.map +1 -0
- package/dist/features/swap/hooks/use-swap-quote.d.ts +13 -0
- package/dist/features/swap/hooks/use-swap-quote.d.ts.map +1 -0
- package/dist/features/swap/hooks/use-swap-quote.js +14 -0
- package/dist/features/swap/hooks/use-swap-quote.js.map +1 -0
- package/dist/features/swap/hooks/use-swap-quote.mjs +12 -0
- package/dist/features/swap/hooks/use-swap-quote.mjs.map +1 -0
- package/dist/features/swap/index.d.ts +10 -0
- package/dist/features/swap/index.d.ts.map +1 -0
- package/dist/features/swap/index.js +21 -0
- package/dist/features/swap/index.js.map +1 -0
- package/dist/features/swap/index.mjs +4 -0
- package/dist/features/swap/index.mjs.map +1 -0
- package/dist/features/transaction/components/transaction/index.d.ts +10 -0
- package/dist/features/transaction/components/transaction/index.d.ts.map +1 -0
- package/dist/features/transaction/components/transaction/index.js +12 -0
- package/dist/features/transaction/components/transaction/index.js.map +1 -0
- package/dist/features/transaction/components/transaction/index.mjs +3 -0
- package/dist/features/transaction/components/transaction/index.mjs.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.d.ts +30 -0
- package/dist/features/transaction/components/transaction/transaction.d.ts.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.js +49 -0
- package/dist/features/transaction/components/transaction/transaction.js.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.mjs +47 -0
- package/dist/features/transaction/components/transaction/transaction.mjs.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.stories.d.ts +23 -0
- package/dist/features/transaction/components/transaction/transaction.stories.d.ts.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.stories.js +64 -0
- package/dist/features/transaction/components/transaction/transaction.stories.js.map +1 -0
- package/dist/features/transaction/components/transaction/transaction.stories.mjs +54 -0
- package/dist/features/transaction/components/transaction/transaction.stories.mjs.map +1 -0
- package/dist/features/transaction/components/transaction-provider/index.d.ts +10 -0
- package/dist/features/transaction/components/transaction-provider/index.d.ts.map +1 -0
- package/dist/features/transaction/components/transaction-provider/index.js +20 -0
- package/dist/features/transaction/components/transaction-provider/index.js.map +1 -0
- package/dist/features/transaction/components/transaction-provider/index.mjs +3 -0
- package/dist/features/transaction/components/transaction-provider/index.mjs.map +1 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.d.ts +36 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.d.ts.map +1 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.js +76 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.js.map +1 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.mjs +72 -0
- package/dist/features/transaction/components/transaction-provider/transaction-provider.mjs.map +1 -0
- package/dist/features/transaction/hooks/use-send-transaction.d.ts +14 -0
- package/dist/features/transaction/hooks/use-send-transaction.d.ts.map +1 -0
- package/dist/features/transaction/hooks/use-send-transaction.js +14 -0
- package/dist/features/transaction/hooks/use-send-transaction.js.map +1 -0
- package/dist/features/transaction/hooks/use-send-transaction.mjs +12 -0
- package/dist/features/transaction/hooks/use-send-transaction.mjs.map +1 -0
- package/dist/features/transaction/hooks/use-transfer-ton.d.ts +14 -0
- package/dist/features/transaction/hooks/use-transfer-ton.d.ts.map +1 -0
- package/dist/features/transaction/hooks/use-transfer-ton.js +14 -0
- package/dist/features/transaction/hooks/use-transfer-ton.js.map +1 -0
- package/dist/features/transaction/hooks/use-transfer-ton.mjs +12 -0
- package/dist/features/transaction/hooks/use-transfer-ton.mjs.map +1 -0
- package/dist/features/transaction/index.d.ts +11 -0
- package/dist/features/transaction/index.d.ts.map +1 -0
- package/dist/features/transaction/index.js +28 -0
- package/dist/features/transaction/index.js.map +1 -0
- package/dist/features/transaction/index.mjs +5 -0
- package/dist/features/transaction/index.mjs.map +1 -0
- package/dist/features/wallets/components/connect-button/index.d.ts +9 -0
- package/dist/features/wallets/components/connect-button/index.d.ts.map +1 -0
- package/dist/features/wallets/components/connect-button/index.js +12 -0
- package/dist/features/wallets/components/connect-button/index.js.map +1 -0
- package/dist/features/wallets/components/connect-button/index.mjs +3 -0
- package/dist/features/wallets/components/connect-button/index.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-address.d.ts +13 -0
- package/dist/features/wallets/hooks/use-address.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-address.js +13 -0
- package/dist/features/wallets/hooks/use-address.js.map +1 -0
- package/dist/features/wallets/hooks/use-address.mjs +11 -0
- package/dist/features/wallets/hooks/use-address.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-connect.d.ts +14 -0
- package/dist/features/wallets/hooks/use-connect.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-connect.js +14 -0
- package/dist/features/wallets/hooks/use-connect.js.map +1 -0
- package/dist/features/wallets/hooks/use-connect.mjs +12 -0
- package/dist/features/wallets/hooks/use-connect.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-connected-wallets.d.ts +11 -0
- package/dist/features/wallets/hooks/use-connected-wallets.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-connected-wallets.js +23 -0
- package/dist/features/wallets/hooks/use-connected-wallets.js.map +1 -0
- package/dist/features/wallets/hooks/use-connected-wallets.mjs +21 -0
- package/dist/features/wallets/hooks/use-connected-wallets.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-connector-by-id.d.ts +10 -0
- package/dist/features/wallets/hooks/use-connector-by-id.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-connector-by-id.js +23 -0
- package/dist/features/wallets/hooks/use-connector-by-id.js.map +1 -0
- package/dist/features/wallets/hooks/use-connector-by-id.mjs +21 -0
- package/dist/features/wallets/hooks/use-connector-by-id.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-connectors.d.ts +11 -0
- package/dist/features/wallets/hooks/use-connectors.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-connectors.js +23 -0
- package/dist/features/wallets/hooks/use-connectors.js.map +1 -0
- package/dist/features/wallets/hooks/use-connectors.mjs +21 -0
- package/dist/features/wallets/hooks/use-connectors.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-disconnect.d.ts +14 -0
- package/dist/features/wallets/hooks/use-disconnect.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-disconnect.js +14 -0
- package/dist/features/wallets/hooks/use-disconnect.js.map +1 -0
- package/dist/features/wallets/hooks/use-disconnect.mjs +12 -0
- package/dist/features/wallets/hooks/use-disconnect.mjs.map +1 -0
- package/dist/features/wallets/hooks/use-selected-wallet.d.ts +14 -0
- package/dist/features/wallets/hooks/use-selected-wallet.d.ts.map +1 -0
- package/dist/features/wallets/hooks/use-selected-wallet.js +30 -0
- package/dist/features/wallets/hooks/use-selected-wallet.js.map +1 -0
- package/dist/features/wallets/hooks/use-selected-wallet.mjs +28 -0
- package/dist/features/wallets/hooks/use-selected-wallet.mjs.map +1 -0
- package/dist/features/wallets/index.d.ts +16 -0
- package/dist/features/wallets/index.d.ts.map +1 -0
- package/dist/features/wallets/index.js +63 -0
- package/dist/features/wallets/index.js.map +1 -0
- package/dist/features/wallets/index.mjs +10 -0
- package/dist/features/wallets/index.mjs.map +1 -0
- package/dist/global.d.js +4 -0
- package/dist/global.d.js.map +1 -0
- package/dist/global.d.mjs +3 -0
- package/dist/global.d.mjs.map +1 -0
- package/dist/hooks/use-app-kit-theme.d.ts +10 -0
- package/dist/hooks/use-app-kit-theme.d.ts.map +1 -0
- package/dist/hooks/use-app-kit-theme.js +16 -0
- package/dist/hooks/use-app-kit-theme.js.map +1 -0
- package/dist/hooks/use-app-kit-theme.mjs +14 -0
- package/dist/hooks/use-app-kit-theme.mjs.map +1 -0
- package/dist/hooks/use-app-kit.d.ts +9 -0
- package/dist/hooks/use-app-kit.d.ts.map +1 -0
- package/dist/hooks/use-app-kit.js +16 -0
- package/dist/hooks/use-app-kit.js.map +1 -0
- package/dist/hooks/use-app-kit.mjs +14 -0
- package/dist/hooks/use-app-kit.mjs.map +1 -0
- package/dist/hooks/use-i18n.d.ts +9 -0
- package/dist/hooks/use-i18n.d.ts.map +1 -0
- package/dist/hooks/use-i18n.js +16 -0
- package/dist/hooks/use-i18n.js.map +1 -0
- package/dist/hooks/use-i18n.mjs +14 -0
- package/dist/hooks/use-i18n.mjs.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +20 -0
- package/dist/index.mjs.map +1 -0
- package/dist/libs/i18n.d.ts +34 -0
- package/dist/libs/i18n.d.ts.map +1 -0
- package/dist/libs/i18n.js +22 -0
- package/dist/libs/i18n.js.map +1 -0
- package/dist/libs/i18n.mjs +11 -0
- package/dist/libs/i18n.mjs.map +1 -0
- package/dist/libs/query.d.ts +26 -0
- package/dist/libs/query.d.ts.map +1 -0
- package/dist/libs/query.js +20 -0
- package/dist/libs/query.js.map +1 -0
- package/dist/libs/query.mjs +15 -0
- package/dist/libs/query.mjs.map +1 -0
- package/dist/locales/en.d.ts +29 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/en.js +30 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/en.mjs +28 -0
- package/dist/locales/en.mjs.map +1 -0
- package/dist/providers/app-kit-provider.d.ts +15 -0
- package/dist/providers/app-kit-provider.d.ts.map +1 -0
- package/dist/providers/app-kit-provider.js +16 -0
- package/dist/providers/app-kit-provider.js.map +1 -0
- package/dist/providers/app-kit-provider.mjs +13 -0
- package/dist/providers/app-kit-provider.mjs.map +1 -0
- package/dist/providers/i18n-provider.d.ts +22 -0
- package/dist/providers/i18n-provider.d.ts.map +1 -0
- package/dist/providers/i18n-provider.js +55 -0
- package/dist/providers/i18n-provider.js.map +1 -0
- package/dist/providers/i18n-provider.mjs +52 -0
- package/dist/providers/i18n-provider.mjs.map +1 -0
- package/dist/styles/index.css +73 -0
- package/dist/styles/index.css.map +1 -0
- package/dist/styles/typography.module.css +79 -0
- package/dist/styles/typography.module.css.map +1 -0
- package/dist/tonconnect/tonconnect-bridge.d.ts +19 -0
- package/dist/tonconnect/tonconnect-bridge.d.ts.map +1 -0
- package/dist/tonconnect/tonconnect-bridge.js +23 -0
- package/dist/tonconnect/tonconnect-bridge.js.map +1 -0
- package/dist/tonconnect/tonconnect-bridge.mjs +21 -0
- package/dist/tonconnect/tonconnect-bridge.mjs.map +1 -0
- package/package.json +63 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getSwapQuoteQueryOptions } from '@ton/appkit/queries';
|
|
2
|
+
import { useAppKit } from '../../../hooks/use-app-kit';
|
|
3
|
+
import { useQuery } from '../../../libs/query';
|
|
4
|
+
|
|
5
|
+
const useSwapQuote = (parameters = {}) => {
|
|
6
|
+
const appKit = useAppKit();
|
|
7
|
+
return useQuery(getSwapQuoteQueryOptions(appKit, parameters));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useSwapQuote };
|
|
11
|
+
//# sourceMappingURL=use-swap-quote.mjs.map
|
|
12
|
+
//# sourceMappingURL=use-swap-quote.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/swap/hooks/use-swap-quote.ts"],"names":[],"mappings":";;;;AAwBO,MAAM,YAAA,GAAe,CACxB,UAAA,GAAiD,EAAC,KACb;AACrC,EAAA,MAAM,SAAS,SAAA,EAAU;AAEzB,EAAA,OAAO,QAAA,CAAS,wBAAA,CAAyB,MAAA,EAAQ,UAAU,CAAC,CAAA;AAChE","file":"use-swap-quote.mjs","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use client';\n\nimport { getSwapQuoteQueryOptions } from '@ton/appkit/queries';\nimport type { GetSwapQuoteData, GetSwapQuoteErrorType, GetSwapQuoteQueryConfig } from '@ton/appkit/queries';\n\nimport { useAppKit } from '../../../hooks/use-app-kit';\nimport { useQuery } from '../../../libs/query';\nimport type { UseQueryReturnType } from '../../../libs/query';\n\nexport type UseSwapQuoteParameters<selectData = GetSwapQuoteData> = GetSwapQuoteQueryConfig<selectData>;\n\nexport type UseSwapQuoteReturnType<selectData = GetSwapQuoteData> = UseQueryReturnType<\n selectData,\n GetSwapQuoteErrorType\n>;\n\nexport const useSwapQuote = <selectData = GetSwapQuoteData>(\n parameters: UseSwapQuoteParameters<selectData> = {},\n): UseSwapQuoteReturnType<selectData> => {\n const appKit = useAppKit();\n\n return useQuery(getSwapQuoteQueryOptions(appKit, parameters));\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 * from './hooks/use-swap-quote';
|
|
9
|
+
export * from './hooks/use-build-swap-transaction';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/swap/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useSwapQuote = require('./hooks/use-swap-quote');
|
|
4
|
+
var useBuildSwapTransaction = require('./hooks/use-build-swap-transaction');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.keys(useSwapQuote).forEach(function (k) {
|
|
9
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return useSwapQuote[k]; }
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
Object.keys(useBuildSwapTransaction).forEach(function (k) {
|
|
15
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return useBuildSwapTransaction[k]; }
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { Transaction } from './transaction';
|
|
9
|
+
export type { TransactionProps, TransactionRenderProps } from './transaction';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/transaction/components/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var transaction = require('./transaction');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "Transaction", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return transaction.Transaction; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import type { FC, ReactNode, ComponentProps } from 'react';
|
|
9
|
+
import type { SendTransactionParameters, SendTransactionReturnType } from '@ton/appkit';
|
|
10
|
+
export interface TransactionRenderProps {
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
onSubmit: () => void;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
text: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export type TransactionRequest = SendTransactionParameters | Promise<SendTransactionParameters> | (() => SendTransactionParameters) | (() => Promise<SendTransactionParameters>);
|
|
17
|
+
export interface TransactionProps extends Omit<ComponentProps<'button'>, 'children' | 'onError'> {
|
|
18
|
+
/** The transaction request parameters */
|
|
19
|
+
request: TransactionRequest;
|
|
20
|
+
/** Callback when an error occurs */
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
/** Callback when the transaction is successful */
|
|
23
|
+
onSuccess?: (response: SendTransactionReturnType) => void;
|
|
24
|
+
/** Custom button text */
|
|
25
|
+
text?: ReactNode;
|
|
26
|
+
/** Custom render function */
|
|
27
|
+
children?: (props: TransactionRenderProps) => ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare const Transaction: FC<TransactionProps>;
|
|
30
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/transaction/components/transaction/transaction.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAMxF,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,MAAM,kBAAkB,GACxB,yBAAyB,GACzB,OAAO,CAAC,yBAAyB,CAAC,GAClC,CAAC,MAAM,yBAAyB,CAAC,GACjC,CAAC,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC5F,yCAAyC;IACzC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,kDAAkD;IAClD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAC1D,yBAAyB;IACzB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,SAAS,CAAC;CAC3D;AA+CD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAiB5C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var transactionProvider = require('../transaction-provider');
|
|
6
|
+
var useI18n = require('../../../../hooks/use-i18n');
|
|
7
|
+
var button = require('../../../../components/button');
|
|
8
|
+
|
|
9
|
+
const TransactionContent = ({ text, children, ...props }) => {
|
|
10
|
+
const { isLoading, onSubmit, disabled } = transactionProvider.useTransactionContext();
|
|
11
|
+
const { t } = useI18n.useI18n();
|
|
12
|
+
const isDisabled = disabled || isLoading;
|
|
13
|
+
const handleSubmit = react.useCallback(() => {
|
|
14
|
+
if (!isDisabled) {
|
|
15
|
+
onSubmit();
|
|
16
|
+
}
|
|
17
|
+
}, [isDisabled, onSubmit]);
|
|
18
|
+
const buttonText = react.useMemo(() => {
|
|
19
|
+
if (isLoading) {
|
|
20
|
+
return t("transaction.processing");
|
|
21
|
+
}
|
|
22
|
+
return text ?? t("transaction.sendTransaction");
|
|
23
|
+
}, [isLoading, text, t]);
|
|
24
|
+
if (children) {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({
|
|
26
|
+
isLoading,
|
|
27
|
+
onSubmit: handleSubmit,
|
|
28
|
+
disabled: isDisabled,
|
|
29
|
+
text: buttonText
|
|
30
|
+
}) });
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { onClick: handleSubmit, disabled: isDisabled, ...props, children: buttonText });
|
|
33
|
+
};
|
|
34
|
+
const Transaction = ({
|
|
35
|
+
request,
|
|
36
|
+
children,
|
|
37
|
+
className,
|
|
38
|
+
onError,
|
|
39
|
+
onSuccess,
|
|
40
|
+
disabled = false,
|
|
41
|
+
text,
|
|
42
|
+
...props
|
|
43
|
+
}) => {
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(transactionProvider.TransactionProvider, { request, onError, onSuccess, disabled, children: /* @__PURE__ */ jsxRuntime.jsx(TransactionContent, { className, text, ...props, children }) });
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.Transaction = Transaction;
|
|
48
|
+
//# sourceMappingURL=transaction.js.map
|
|
49
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/transaction/components/transaction/transaction.tsx"],"names":["useTransactionContext","useI18n","useCallback","useMemo","jsx","Button","TransactionProvider"],"mappings":";;;;;;;;AA+CA,MAAM,qBAAkD,CAAC,EAAE,MAAM,QAAA,EAAU,GAAG,OAAM,KAAM;AACtF,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,QAAA,KAAaA,yCAAA,EAAsB;AAChE,EAAA,MAAM,EAAE,CAAA,EAAE,GAAIC,eAAA,EAAQ;AAEtB,EAAA,MAAM,aAAa,QAAA,IAAY,SAAA;AAE/B,EAAA,MAAM,YAAA,GAAeC,kBAAY,MAAM;AACnC,IAAA,IAAI,CAAC,UAAA,EAAY;AACb,MAAA,QAAA,EAAS;AAAA,IACb;AAAA,EACJ,CAAA,EAAG,CAAC,UAAA,EAAY,QAAQ,CAAC,CAAA;AAEzB,EAAA,MAAM,UAAA,GAAaC,cAAQ,MAAM;AAC7B,IAAA,IAAI,SAAA,EAAW;AACX,MAAA,OAAO,EAAE,wBAAwB,CAAA;AAAA,IACrC;AAEA,IAAA,OAAO,IAAA,IAAQ,EAAE,6BAA6B,CAAA;AAAA,EAClD,CAAA,EAAG,CAAC,SAAA,EAAW,IAAA,EAAM,CAAC,CAAC,CAAA;AAEvB,EAAA,IAAI,QAAA,EAAU;AACV,IAAA,6DAES,QAAA,EAAA,QAAA,CAAS;AAAA,MACN,SAAA;AAAA,MACA,QAAA,EAAU,YAAA;AAAA,MACV,QAAA,EAAU,UAAA;AAAA,MACV,IAAA,EAAM;AAAA,KACT,CAAA,EACL,CAAA;AAAA,EAER;AAEA,EAAA,uBACIC,cAAA,CAACC,iBAAO,OAAA,EAAS,YAAA,EAAc,UAAU,UAAA,EAAa,GAAG,OACpD,QAAA,EAAA,UAAA,EACL,CAAA;AAER,CAAA;AAEO,MAAM,cAAoC,CAAC;AAAA,EAC9C,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,GAAW,KAAA;AAAA,EACX,IAAA;AAAA,EACA,GAAG;AACP,CAAA,KAAM;AACF,EAAA,uBACID,cAAA,CAACE,uCAAA,EAAA,EAAoB,OAAA,EAAkB,OAAA,EAAkB,SAAA,EAAsB,QAAA,EAC3E,QAAA,kBAAAF,cAAA,CAAC,kBAAA,EAAA,EAAmB,SAAA,EAAsB,IAAA,EAAa,GAAG,KAAA,EACrD,UACL,CAAA,EACJ,CAAA;AAER","file":"transaction.js","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useCallback, useMemo } from 'react';\nimport type { FC, ReactNode, ComponentProps } from 'react';\nimport type { SendTransactionParameters, SendTransactionReturnType } from '@ton/appkit';\n\nimport { TransactionProvider, useTransactionContext } from '../transaction-provider';\nimport { useI18n } from '../../../../hooks/use-i18n';\nimport { Button } from '../../../../components/button';\n\nexport interface TransactionRenderProps {\n isLoading: boolean;\n onSubmit: () => void;\n disabled: boolean;\n text: ReactNode;\n}\n\nexport type TransactionRequest =\n | SendTransactionParameters\n | Promise<SendTransactionParameters>\n | (() => SendTransactionParameters)\n | (() => Promise<SendTransactionParameters>);\n\nexport interface TransactionProps extends Omit<ComponentProps<'button'>, 'children' | 'onError'> {\n /** The transaction request parameters */\n request: TransactionRequest;\n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n /** Callback when the transaction is successful */\n onSuccess?: (response: SendTransactionReturnType) => void;\n /** Custom button text */\n text?: ReactNode;\n /** Custom render function */\n children?: (props: TransactionRenderProps) => ReactNode;\n}\n\ninterface TransactionContentProps extends Omit<ComponentProps<'button'>, 'children'> {\n text?: ReactNode;\n children?: (props: TransactionRenderProps) => ReactNode;\n}\n\nconst TransactionContent: FC<TransactionContentProps> = ({ text, children, ...props }) => {\n const { isLoading, onSubmit, disabled } = useTransactionContext();\n const { t } = useI18n();\n\n const isDisabled = disabled || isLoading;\n\n const handleSubmit = useCallback(() => {\n if (!isDisabled) {\n onSubmit();\n }\n }, [isDisabled, onSubmit]);\n\n const buttonText = useMemo(() => {\n if (isLoading) {\n return t('transaction.processing');\n }\n\n return text ?? t('transaction.sendTransaction');\n }, [isLoading, text, t]);\n\n if (children) {\n return (\n <>\n {children({\n isLoading,\n onSubmit: handleSubmit,\n disabled: isDisabled,\n text: buttonText,\n })}\n </>\n );\n }\n\n return (\n <Button onClick={handleSubmit} disabled={isDisabled} {...props}>\n {buttonText}\n </Button>\n );\n};\n\nexport const Transaction: FC<TransactionProps> = ({\n request,\n children,\n className,\n onError,\n onSuccess,\n disabled = false,\n text,\n ...props\n}) => {\n return (\n <TransactionProvider request={request} onError={onError} onSuccess={onSuccess} disabled={disabled}>\n <TransactionContent className={className} text={text} {...props}>\n {children}\n </TransactionContent>\n </TransactionProvider>\n );\n};\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { TransactionProvider, useTransactionContext } from '../transaction-provider';
|
|
4
|
+
import { useI18n } from '../../../../hooks/use-i18n';
|
|
5
|
+
import { Button } from '../../../../components/button';
|
|
6
|
+
|
|
7
|
+
const TransactionContent = ({ text, children, ...props }) => {
|
|
8
|
+
const { isLoading, onSubmit, disabled } = useTransactionContext();
|
|
9
|
+
const { t } = useI18n();
|
|
10
|
+
const isDisabled = disabled || isLoading;
|
|
11
|
+
const handleSubmit = useCallback(() => {
|
|
12
|
+
if (!isDisabled) {
|
|
13
|
+
onSubmit();
|
|
14
|
+
}
|
|
15
|
+
}, [isDisabled, onSubmit]);
|
|
16
|
+
const buttonText = useMemo(() => {
|
|
17
|
+
if (isLoading) {
|
|
18
|
+
return t("transaction.processing");
|
|
19
|
+
}
|
|
20
|
+
return text ?? t("transaction.sendTransaction");
|
|
21
|
+
}, [isLoading, text, t]);
|
|
22
|
+
if (children) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children({
|
|
24
|
+
isLoading,
|
|
25
|
+
onSubmit: handleSubmit,
|
|
26
|
+
disabled: isDisabled,
|
|
27
|
+
text: buttonText
|
|
28
|
+
}) });
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsx(Button, { onClick: handleSubmit, disabled: isDisabled, ...props, children: buttonText });
|
|
31
|
+
};
|
|
32
|
+
const Transaction = ({
|
|
33
|
+
request,
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
onError,
|
|
37
|
+
onSuccess,
|
|
38
|
+
disabled = false,
|
|
39
|
+
text,
|
|
40
|
+
...props
|
|
41
|
+
}) => {
|
|
42
|
+
return /* @__PURE__ */ jsx(TransactionProvider, { request, onError, onSuccess, disabled, children: /* @__PURE__ */ jsx(TransactionContent, { className, text, ...props, children }) });
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { Transaction };
|
|
46
|
+
//# sourceMappingURL=transaction.mjs.map
|
|
47
|
+
//# sourceMappingURL=transaction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/transaction/components/transaction/transaction.tsx"],"names":[],"mappings":";;;;;;AA+CA,MAAM,qBAAkD,CAAC,EAAE,MAAM,QAAA,EAAU,GAAG,OAAM,KAAM;AACtF,EAAA,MAAM,EAAE,SAAA,EAAW,QAAA,EAAU,QAAA,KAAa,qBAAA,EAAsB;AAChE,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,OAAA,EAAQ;AAEtB,EAAA,MAAM,aAAa,QAAA,IAAY,SAAA;AAE/B,EAAA,MAAM,YAAA,GAAe,YAAY,MAAM;AACnC,IAAA,IAAI,CAAC,UAAA,EAAY;AACb,MAAA,QAAA,EAAS;AAAA,IACb;AAAA,EACJ,CAAA,EAAG,CAAC,UAAA,EAAY,QAAQ,CAAC,CAAA;AAEzB,EAAA,MAAM,UAAA,GAAa,QAAQ,MAAM;AAC7B,IAAA,IAAI,SAAA,EAAW;AACX,MAAA,OAAO,EAAE,wBAAwB,CAAA;AAAA,IACrC;AAEA,IAAA,OAAO,IAAA,IAAQ,EAAE,6BAA6B,CAAA;AAAA,EAClD,CAAA,EAAG,CAAC,SAAA,EAAW,IAAA,EAAM,CAAC,CAAC,CAAA;AAEvB,EAAA,IAAI,QAAA,EAAU;AACV,IAAA,uCAES,QAAA,EAAA,QAAA,CAAS;AAAA,MACN,SAAA;AAAA,MACA,QAAA,EAAU,YAAA;AAAA,MACV,QAAA,EAAU,UAAA;AAAA,MACV,IAAA,EAAM;AAAA,KACT,CAAA,EACL,CAAA;AAAA,EAER;AAEA,EAAA,uBACI,GAAA,CAAC,UAAO,OAAA,EAAS,YAAA,EAAc,UAAU,UAAA,EAAa,GAAG,OACpD,QAAA,EAAA,UAAA,EACL,CAAA;AAER,CAAA;AAEO,MAAM,cAAoC,CAAC;AAAA,EAC9C,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,GAAW,KAAA;AAAA,EACX,IAAA;AAAA,EACA,GAAG;AACP,CAAA,KAAM;AACF,EAAA,uBACI,GAAA,CAAC,mBAAA,EAAA,EAAoB,OAAA,EAAkB,OAAA,EAAkB,SAAA,EAAsB,QAAA,EAC3E,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,SAAA,EAAsB,IAAA,EAAa,GAAG,KAAA,EACrD,UACL,CAAA,EACJ,CAAA;AAER","file":"transaction.mjs","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useCallback, useMemo } from 'react';\nimport type { FC, ReactNode, ComponentProps } from 'react';\nimport type { SendTransactionParameters, SendTransactionReturnType } from '@ton/appkit';\n\nimport { TransactionProvider, useTransactionContext } from '../transaction-provider';\nimport { useI18n } from '../../../../hooks/use-i18n';\nimport { Button } from '../../../../components/button';\n\nexport interface TransactionRenderProps {\n isLoading: boolean;\n onSubmit: () => void;\n disabled: boolean;\n text: ReactNode;\n}\n\nexport type TransactionRequest =\n | SendTransactionParameters\n | Promise<SendTransactionParameters>\n | (() => SendTransactionParameters)\n | (() => Promise<SendTransactionParameters>);\n\nexport interface TransactionProps extends Omit<ComponentProps<'button'>, 'children' | 'onError'> {\n /** The transaction request parameters */\n request: TransactionRequest;\n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n /** Callback when the transaction is successful */\n onSuccess?: (response: SendTransactionReturnType) => void;\n /** Custom button text */\n text?: ReactNode;\n /** Custom render function */\n children?: (props: TransactionRenderProps) => ReactNode;\n}\n\ninterface TransactionContentProps extends Omit<ComponentProps<'button'>, 'children'> {\n text?: ReactNode;\n children?: (props: TransactionRenderProps) => ReactNode;\n}\n\nconst TransactionContent: FC<TransactionContentProps> = ({ text, children, ...props }) => {\n const { isLoading, onSubmit, disabled } = useTransactionContext();\n const { t } = useI18n();\n\n const isDisabled = disabled || isLoading;\n\n const handleSubmit = useCallback(() => {\n if (!isDisabled) {\n onSubmit();\n }\n }, [isDisabled, onSubmit]);\n\n const buttonText = useMemo(() => {\n if (isLoading) {\n return t('transaction.processing');\n }\n\n return text ?? t('transaction.sendTransaction');\n }, [isLoading, text, t]);\n\n if (children) {\n return (\n <>\n {children({\n isLoading,\n onSubmit: handleSubmit,\n disabled: isDisabled,\n text: buttonText,\n })}\n </>\n );\n }\n\n return (\n <Button onClick={handleSubmit} disabled={isDisabled} {...props}>\n {buttonText}\n </Button>\n );\n};\n\nexport const Transaction: FC<TransactionProps> = ({\n request,\n children,\n className,\n onError,\n onSuccess,\n disabled = false,\n text,\n ...props\n}) => {\n return (\n <TransactionProvider request={request} onError={onError} onSuccess={onSuccess} disabled={disabled}>\n <TransactionContent className={className} text={text} {...props}>\n {children}\n </TransactionContent>\n </TransactionProvider>\n );\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
+
declare const TransactionButtonPreview: ({ text, isLoading, disabled, }: {
|
|
10
|
+
text?: string;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const meta: Meta<typeof TransactionButtonPreview>;
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof TransactionButtonPreview>;
|
|
17
|
+
export declare const Default: Story;
|
|
18
|
+
export declare const CustomText: Story;
|
|
19
|
+
export declare const Loading: Story;
|
|
20
|
+
export declare const Disabled: Story;
|
|
21
|
+
export declare const SendTonButton: Story;
|
|
22
|
+
export declare const SendJettonButton: Story;
|
|
23
|
+
//# sourceMappingURL=transaction.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.stories.d.ts","sourceRoot":"","sources":["../../../../../src/features/transaction/components/transaction/transaction.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,QAAA,MAAM,wBAAwB,GAAI,gCAI/B;IACC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,4CAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,CAO/C,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEvD,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAIxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAI3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAI9B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var button = require('../../../../components/button');
|
|
7
|
+
|
|
8
|
+
const TransactionButtonPreview = ({
|
|
9
|
+
text = "Send Transaction",
|
|
10
|
+
isLoading = false,
|
|
11
|
+
disabled = false
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(button.Button, { disabled: disabled || isLoading, children: isLoading ? "Processing..." : text });
|
|
14
|
+
};
|
|
15
|
+
const meta = {
|
|
16
|
+
title: "Public/Features/Transaction/Transaction",
|
|
17
|
+
component: TransactionButtonPreview,
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: "centered"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var transaction_stories_default = meta;
|
|
24
|
+
const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
text: "Send Transaction"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const CustomText = {
|
|
30
|
+
args: {
|
|
31
|
+
text: "Send 1.5 TON"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const Loading = {
|
|
35
|
+
args: {
|
|
36
|
+
isLoading: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const Disabled = {
|
|
40
|
+
args: {
|
|
41
|
+
text: "Send Transaction",
|
|
42
|
+
disabled: true
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const SendTonButton = {
|
|
46
|
+
args: {
|
|
47
|
+
text: "Send 10 TON"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const SendJettonButton = {
|
|
51
|
+
args: {
|
|
52
|
+
text: "Send 100 USDT"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.CustomText = CustomText;
|
|
57
|
+
exports.Default = Default;
|
|
58
|
+
exports.Disabled = Disabled;
|
|
59
|
+
exports.Loading = Loading;
|
|
60
|
+
exports.SendJettonButton = SendJettonButton;
|
|
61
|
+
exports.SendTonButton = SendTonButton;
|
|
62
|
+
exports.default = transaction_stories_default;
|
|
63
|
+
//# sourceMappingURL=transaction.stories.js.map
|
|
64
|
+
//# sourceMappingURL=transaction.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/transaction/components/transaction/transaction.stories.tsx"],"names":["Button"],"mappings":";;;;;;;AAaA,MAAM,2BAA2B,CAAC;AAAA,EAC9B,IAAA,GAAO,kBAAA;AAAA,EACP,SAAA,GAAY,KAAA;AAAA,EACZ,QAAA,GAAW;AACf,CAAA,KAIM;AACF,EAAA,sCAAQA,aAAA,EAAA,EAAO,QAAA,EAAU,YAAY,SAAA,EAAY,QAAA,EAAA,SAAA,GAAY,kBAAkB,IAAA,EAAK,CAAA;AACxF,CAAA;AAEA,MAAM,IAAA,GAA8C;AAAA,EAChD,KAAA,EAAO,yCAAA;AAAA,EACP,SAAA,EAAW,wBAAA;AAAA,EACX,IAAA,EAAM,CAAC,UAAU,CAAA;AAAA,EACjB,UAAA,EAAY;AAAA,IACR,MAAA,EAAQ;AAAA;AAEhB,CAAA;AAEA,IAAO,2BAAA,GAAQ;AAIR,MAAM,OAAA,GAAiB;AAAA,EAC1B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,UAAA,GAAoB;AAAA,EAC7B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,OAAA,GAAiB;AAAA,EAC1B,IAAA,EAAM;AAAA,IACF,SAAA,EAAW;AAAA;AAEnB;AAEO,MAAM,QAAA,GAAkB;AAAA,EAC3B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM,kBAAA;AAAA,IACN,QAAA,EAAU;AAAA;AAElB;AAEO,MAAM,aAAA,GAAuB;AAAA,EAChC,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,gBAAA,GAA0B;AAAA,EACnC,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd","file":"transaction.stories.js","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { Meta, StoryObj } from '@storybook/react';\n\nimport { Button } from '../../../../components/button';\n\n// Create a preview component that doesn't depend on context\nconst TransactionButtonPreview = ({\n text = 'Send Transaction',\n isLoading = false,\n disabled = false,\n}: {\n text?: string;\n isLoading?: boolean;\n disabled?: boolean;\n}) => {\n return <Button disabled={disabled || isLoading}>{isLoading ? 'Processing...' : text}</Button>;\n};\n\nconst meta: Meta<typeof TransactionButtonPreview> = {\n title: 'Public/Features/Transaction/Transaction',\n component: TransactionButtonPreview,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof TransactionButtonPreview>;\n\nexport const Default: Story = {\n args: {\n text: 'Send Transaction',\n },\n};\n\nexport const CustomText: Story = {\n args: {\n text: 'Send 1.5 TON',\n },\n};\n\nexport const Loading: Story = {\n args: {\n isLoading: true,\n },\n};\n\nexport const Disabled: Story = {\n args: {\n text: 'Send Transaction',\n disabled: true,\n },\n};\n\nexport const SendTonButton: Story = {\n args: {\n text: 'Send 10 TON',\n },\n};\n\nexport const SendJettonButton: Story = {\n args: {\n text: 'Send 100 USDT',\n },\n};\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '../../../../components/button';
|
|
3
|
+
|
|
4
|
+
const TransactionButtonPreview = ({
|
|
5
|
+
text = "Send Transaction",
|
|
6
|
+
isLoading = false,
|
|
7
|
+
disabled = false
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(Button, { disabled: disabled || isLoading, children: isLoading ? "Processing..." : text });
|
|
10
|
+
};
|
|
11
|
+
const meta = {
|
|
12
|
+
title: "Public/Features/Transaction/Transaction",
|
|
13
|
+
component: TransactionButtonPreview,
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "centered"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var transaction_stories_default = meta;
|
|
20
|
+
const Default = {
|
|
21
|
+
args: {
|
|
22
|
+
text: "Send Transaction"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const CustomText = {
|
|
26
|
+
args: {
|
|
27
|
+
text: "Send 1.5 TON"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const Loading = {
|
|
31
|
+
args: {
|
|
32
|
+
isLoading: true
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const Disabled = {
|
|
36
|
+
args: {
|
|
37
|
+
text: "Send Transaction",
|
|
38
|
+
disabled: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const SendTonButton = {
|
|
42
|
+
args: {
|
|
43
|
+
text: "Send 10 TON"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const SendJettonButton = {
|
|
47
|
+
args: {
|
|
48
|
+
text: "Send 100 USDT"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { CustomText, Default, Disabled, Loading, SendJettonButton, SendTonButton, transaction_stories_default as default };
|
|
53
|
+
//# sourceMappingURL=transaction.stories.mjs.map
|
|
54
|
+
//# sourceMappingURL=transaction.stories.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/transaction/components/transaction/transaction.stories.tsx"],"names":[],"mappings":";;;AAaA,MAAM,2BAA2B,CAAC;AAAA,EAC9B,IAAA,GAAO,kBAAA;AAAA,EACP,SAAA,GAAY,KAAA;AAAA,EACZ,QAAA,GAAW;AACf,CAAA,KAIM;AACF,EAAA,2BAAQ,MAAA,EAAA,EAAO,QAAA,EAAU,YAAY,SAAA,EAAY,QAAA,EAAA,SAAA,GAAY,kBAAkB,IAAA,EAAK,CAAA;AACxF,CAAA;AAEA,MAAM,IAAA,GAA8C;AAAA,EAChD,KAAA,EAAO,yCAAA;AAAA,EACP,SAAA,EAAW,wBAAA;AAAA,EACX,IAAA,EAAM,CAAC,UAAU,CAAA;AAAA,EACjB,UAAA,EAAY;AAAA,IACR,MAAA,EAAQ;AAAA;AAEhB,CAAA;AAEA,IAAO,2BAAA,GAAQ;AAIR,MAAM,OAAA,GAAiB;AAAA,EAC1B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,UAAA,GAAoB;AAAA,EAC7B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,OAAA,GAAiB;AAAA,EAC1B,IAAA,EAAM;AAAA,IACF,SAAA,EAAW;AAAA;AAEnB;AAEO,MAAM,QAAA,GAAkB;AAAA,EAC3B,IAAA,EAAM;AAAA,IACF,IAAA,EAAM,kBAAA;AAAA,IACN,QAAA,EAAU;AAAA;AAElB;AAEO,MAAM,aAAA,GAAuB;AAAA,EAChC,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd;AAEO,MAAM,gBAAA,GAA0B;AAAA,EACnC,IAAA,EAAM;AAAA,IACF,IAAA,EAAM;AAAA;AAEd","file":"transaction.stories.mjs","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { Meta, StoryObj } from '@storybook/react';\n\nimport { Button } from '../../../../components/button';\n\n// Create a preview component that doesn't depend on context\nconst TransactionButtonPreview = ({\n text = 'Send Transaction',\n isLoading = false,\n disabled = false,\n}: {\n text?: string;\n isLoading?: boolean;\n disabled?: boolean;\n}) => {\n return <Button disabled={disabled || isLoading}>{isLoading ? 'Processing...' : text}</Button>;\n};\n\nconst meta: Meta<typeof TransactionButtonPreview> = {\n title: 'Public/Features/Transaction/Transaction',\n component: TransactionButtonPreview,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof TransactionButtonPreview>;\n\nexport const Default: Story = {\n args: {\n text: 'Send Transaction',\n },\n};\n\nexport const CustomText: Story = {\n args: {\n text: 'Send 1.5 TON',\n },\n};\n\nexport const Loading: Story = {\n args: {\n isLoading: true,\n },\n};\n\nexport const Disabled: Story = {\n args: {\n text: 'Send Transaction',\n disabled: true,\n },\n};\n\nexport const SendTonButton: Story = {\n args: {\n text: 'Send 10 TON',\n },\n};\n\nexport const SendJettonButton: Story = {\n args: {\n text: 'Send 100 USDT',\n },\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { TransactionProvider, useTransactionContext, TransactionContext } from './transaction-provider';
|
|
9
|
+
export type { TransactionContextType } from './transaction-provider';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/transaction/components/transaction-provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxG,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var transactionProvider = require('./transaction-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "TransactionContext", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return transactionProvider.TransactionContext; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "TransactionProvider", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return transactionProvider.TransactionProvider; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "useTransactionContext", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return transactionProvider.useTransactionContext; }
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
9
|
+
import type { SendTransactionReturnType } from '@ton/appkit';
|
|
10
|
+
import type { TransactionRequest } from '../transaction/transaction';
|
|
11
|
+
export interface TransactionContextType {
|
|
12
|
+
/** Function to submit the transaction */
|
|
13
|
+
onSubmit: () => void;
|
|
14
|
+
/** Whether the transaction is currently loading */
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
/** The error object if the transaction failed */
|
|
17
|
+
error?: Error | null;
|
|
18
|
+
/** The receipt of the successful transaction */
|
|
19
|
+
receipt?: SendTransactionReturnType | null;
|
|
20
|
+
/** Disable the button/interaction */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const TransactionContext: import("react").Context<TransactionContextType>;
|
|
24
|
+
export declare function useTransactionContext(): TransactionContextType;
|
|
25
|
+
export interface TransactionProviderProps extends PropsWithChildren {
|
|
26
|
+
/** The transaction request parameters */
|
|
27
|
+
request: TransactionRequest;
|
|
28
|
+
/** Callback when an error occurs */
|
|
29
|
+
onError?: (error: Error) => void;
|
|
30
|
+
/** Callback when the transaction is successful */
|
|
31
|
+
onSuccess?: (response: SendTransactionReturnType) => void;
|
|
32
|
+
/** Disable the button/interaction */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare const TransactionProvider: FC<TransactionProviderProps>;
|
|
36
|
+
//# sourceMappingURL=transaction-provider.d.ts.map
|
package/dist/features/transaction/components/transaction-provider/transaction-provider.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-provider.d.ts","sourceRoot":"","sources":["../../../../../src/features/transaction/components/transaction-provider/transaction-provider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACnC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,gDAAgD;IAChD,OAAO,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC3C,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,iDAK7B,CAAC;AAEH,wBAAgB,qBAAqB,2BAIpC;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D,yCAAyC;IACzC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,kDAAkD;IAClD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAC1D,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CA6D5D,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var useSendTransaction = require('../../hooks/use-send-transaction');
|
|
6
|
+
|
|
7
|
+
const TransactionContext = react.createContext({
|
|
8
|
+
onSubmit: () => {
|
|
9
|
+
throw new Error("onSubmit is not defined");
|
|
10
|
+
},
|
|
11
|
+
isLoading: false
|
|
12
|
+
});
|
|
13
|
+
function useTransactionContext() {
|
|
14
|
+
const context = react.useContext(TransactionContext);
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
const TransactionProvider = ({
|
|
18
|
+
children,
|
|
19
|
+
request,
|
|
20
|
+
onError,
|
|
21
|
+
onSuccess,
|
|
22
|
+
disabled = false
|
|
23
|
+
}) => {
|
|
24
|
+
const [receipt, setReceipt] = react.useState(null);
|
|
25
|
+
const [isPreparing, setIsPreparing] = react.useState(false);
|
|
26
|
+
const {
|
|
27
|
+
mutateAsync: sendTransaction,
|
|
28
|
+
isPending,
|
|
29
|
+
error: mutationError
|
|
30
|
+
} = useSendTransaction.useSendTransaction({
|
|
31
|
+
mutation: {
|
|
32
|
+
onSuccess: (data) => {
|
|
33
|
+
setReceipt(data);
|
|
34
|
+
onSuccess?.(data);
|
|
35
|
+
},
|
|
36
|
+
onError: (err) => {
|
|
37
|
+
onError?.(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const handleSubmit = react.useCallback(async () => {
|
|
42
|
+
if (disabled || isPreparing || isPending) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
setIsPreparing(true);
|
|
46
|
+
try {
|
|
47
|
+
const transactionRequest = typeof request === "function" ? await request() : await request;
|
|
48
|
+
if (!transactionRequest) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
await sendTransaction(transactionRequest);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
54
|
+
onError?.(error);
|
|
55
|
+
} finally {
|
|
56
|
+
setIsPreparing(false);
|
|
57
|
+
}
|
|
58
|
+
}, [sendTransaction, request, disabled, isPreparing, isPending, onError]);
|
|
59
|
+
const value = react.useMemo(
|
|
60
|
+
() => ({
|
|
61
|
+
error: mutationError,
|
|
62
|
+
isLoading: isPreparing || isPending,
|
|
63
|
+
onSubmit: handleSubmit,
|
|
64
|
+
receipt,
|
|
65
|
+
disabled
|
|
66
|
+
}),
|
|
67
|
+
[mutationError, isPreparing, isPending, handleSubmit, receipt, disabled]
|
|
68
|
+
);
|
|
69
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TransactionContext.Provider, { value, children });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.TransactionContext = TransactionContext;
|
|
73
|
+
exports.TransactionProvider = TransactionProvider;
|
|
74
|
+
exports.useTransactionContext = useTransactionContext;
|
|
75
|
+
//# sourceMappingURL=transaction-provider.js.map
|
|
76
|
+
//# sourceMappingURL=transaction-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/transaction/components/transaction-provider/transaction-provider.tsx"],"names":["createContext","useContext","useState","useSendTransaction","useCallback","useMemo","jsx"],"mappings":";;;;;;AA4BO,MAAM,qBAAqBA,mBAAA,CAAsC;AAAA,EACpE,UAAU,MAAM;AACZ,IAAA,MAAM,IAAI,MAAM,yBAAyB,CAAA;AAAA,EAC7C,CAAA;AAAA,EACA,SAAA,EAAW;AACf,CAAC;AAEM,SAAS,qBAAA,GAAwB;AACpC,EAAA,MAAM,OAAA,GAAUC,iBAAW,kBAAkB,CAAA;AAE7C,EAAA,OAAO,OAAA;AACX;AAaO,MAAM,sBAAoD,CAAC;AAAA,EAC9D,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,GAAW;AACf,CAAA,KAAM;AACF,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAIC,eAA2C,IAAI,CAAA;AAC7E,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAIA,eAAS,KAAK,CAAA;AAEpD,EAAA,MAAM;AAAA,IACF,WAAA,EAAa,eAAA;AAAA,IACb,SAAA;AAAA,IACA,KAAA,EAAO;AAAA,MACPC,qCAAA,CAAmB;AAAA,IACnB,QAAA,EAAU;AAAA,MACN,SAAA,EAAW,CAAC,IAAA,KAAS;AACjB,QAAA,UAAA,CAAW,IAAI,CAAA;AACf,QAAA,SAAA,GAAY,IAAI,CAAA;AAAA,MACpB,CAAA;AAAA,MACA,OAAA,EAAS,CAAC,GAAA,KAAQ;AACd,QAAA,OAAA,GAAU,GAAG,CAAA;AAAA,MACjB;AAAA;AACJ,GACH,CAAA;AAED,EAAA,MAAM,YAAA,GAAeC,kBAAY,YAAY;AACzC,IAAA,IAAI,QAAA,IAAY,eAAe,SAAA,EAAW;AACtC,MAAA;AAAA,IACJ;AAEA,IAAA,cAAA,CAAe,IAAI,CAAA;AAEnB,IAAA,IAAI;AACA,MAAA,MAAM,qBAAqB,OAAO,OAAA,KAAY,aAAa,MAAM,OAAA,KAAY,MAAM,OAAA;AAEnF,MAAA,IAAI,CAAC,kBAAA,EAAoB;AACrB,QAAA;AAAA,MACJ;AAEA,MAAA,MAAM,gBAAgB,kBAAkB,CAAA;AAAA,IAC5C,SAAS,CAAA,EAAG;AACR,MAAA,MAAM,KAAA,GAAQ,aAAa,KAAA,GAAQ,CAAA,GAAI,IAAI,KAAA,CAAM,MAAA,CAAO,CAAC,CAAC,CAAA;AAC1D,MAAA,OAAA,GAAU,KAAK,CAAA;AAAA,IACnB,CAAA,SAAE;AACE,MAAA,cAAA,CAAe,KAAK,CAAA;AAAA,IACxB;AAAA,EACJ,CAAA,EAAG,CAAC,eAAA,EAAiB,OAAA,EAAS,UAAU,WAAA,EAAa,SAAA,EAAW,OAAO,CAAC,CAAA;AAExE,EAAA,MAAM,KAAA,GAAQC,aAAA;AAAA,IACV,OAAO;AAAA,MACH,KAAA,EAAO,aAAA;AAAA,MACP,WAAW,WAAA,IAAe,SAAA;AAAA,MAC1B,QAAA,EAAU,YAAA;AAAA,MACV,OAAA;AAAA,MACA;AAAA,KACJ,CAAA;AAAA,IACA,CAAC,aAAA,EAAe,WAAA,EAAa,SAAA,EAAW,YAAA,EAAc,SAAS,QAAQ;AAAA,GAC3E;AAEA,EAAA,uBAAOC,cAAA,CAAC,kBAAA,CAAmB,QAAA,EAAnB,EAA4B,OAAe,QAAA,EAAS,CAAA;AAChE","file":"transaction-provider.js","sourcesContent":["/**\n * Copyright (c) TonTech.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { createContext, useCallback, useContext, useMemo, useState } from 'react';\nimport type { FC, PropsWithChildren } from 'react';\nimport type { SendTransactionReturnType } from '@ton/appkit';\n\nimport { useSendTransaction } from '../../hooks/use-send-transaction';\nimport type { TransactionRequest } from '../transaction/transaction';\n\nexport interface TransactionContextType {\n /** Function to submit the transaction */\n onSubmit: () => void;\n /** Whether the transaction is currently loading */\n isLoading: boolean;\n /** The error object if the transaction failed */\n error?: Error | null;\n /** The receipt of the successful transaction */\n receipt?: SendTransactionReturnType | null;\n /** Disable the button/interaction */\n disabled?: boolean;\n}\n\nexport const TransactionContext = createContext<TransactionContextType>({\n onSubmit: () => {\n throw new Error('onSubmit is not defined');\n },\n isLoading: false,\n});\n\nexport function useTransactionContext() {\n const context = useContext(TransactionContext);\n\n return context;\n}\n\nexport interface TransactionProviderProps extends PropsWithChildren {\n /** The transaction request parameters */\n request: TransactionRequest;\n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n /** Callback when the transaction is successful */\n onSuccess?: (response: SendTransactionReturnType) => void;\n /** Disable the button/interaction */\n disabled?: boolean;\n}\n\nexport const TransactionProvider: FC<TransactionProviderProps> = ({\n children,\n request,\n onError,\n onSuccess,\n disabled = false,\n}) => {\n const [receipt, setReceipt] = useState<SendTransactionReturnType | null>(null);\n const [isPreparing, setIsPreparing] = useState(false);\n\n const {\n mutateAsync: sendTransaction,\n isPending,\n error: mutationError,\n } = useSendTransaction({\n mutation: {\n onSuccess: (data) => {\n setReceipt(data);\n onSuccess?.(data);\n },\n onError: (err) => {\n onError?.(err);\n },\n },\n });\n\n const handleSubmit = useCallback(async () => {\n if (disabled || isPreparing || isPending) {\n return;\n }\n\n setIsPreparing(true);\n\n try {\n const transactionRequest = typeof request === 'function' ? await request() : await request;\n\n if (!transactionRequest) {\n return;\n }\n\n await sendTransaction(transactionRequest);\n } catch (e) {\n const error = e instanceof Error ? e : new Error(String(e));\n onError?.(error);\n } finally {\n setIsPreparing(false);\n }\n }, [sendTransaction, request, disabled, isPreparing, isPending, onError]);\n\n const value = useMemo(\n () => ({\n error: mutationError,\n isLoading: isPreparing || isPending,\n onSubmit: handleSubmit,\n receipt,\n disabled,\n }),\n [mutationError, isPreparing, isPending, handleSubmit, receipt, disabled],\n );\n\n return <TransactionContext.Provider value={value}>{children}</TransactionContext.Provider>;\n};\n"]}
|