{"id":459426,"date":"2025-05-13T03:03:46","date_gmt":"2025-05-13T03:03:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=459426"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=459426","title":{"rendered":"<span>\u041a\u0430\u043a \u043c\u044b \u043f\u0440\u0438\u0440\u0443\u0447\u0430\u043b\u0438 mini\u2011app telegram:\u202f15\u00a0\u0431\u043e\u0435\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438\u00a0\u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0438\u0445\u00a0\u0440\u0435\u0448\u0438\u0442\u044c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3><\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0434 Telegram\u2011\u043c\u0438\u043d\u0438\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u00ab\u043a\u0430\u043f\u0435\u043b\u044c\u043d\u044b\u0445\u00bb (stream)\u202fTON\u2011\u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u044f\u0441\u043d\u043e: \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CRUD\u2011\u0444\u0440\u043e\u043d\u0442 \u0442\u0443\u0442 \u043d\u0435\u00a0\u0432\u044b\u0436\u0438\u0432\u0435\u0442. \u0421\u0440\u0430\u0437\u0443 \u043d\u0430\u043a\u0440\u044b\u043b\u0430 \u0432\u043e\u043b\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u00a0\u2014 \u043e\u0442\u00a0\u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043e\u043d\u0431\u043e\u0440\u0434\u0438\u043d\u0433\u0430 \u0432\u00a0Web\u2011App \u0434\u043e\u00a0\u0431\u043e\u0440\u044c\u0431\u044b \u0441\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 API\u2011\u043a\u043b\u044e\u0447\u0435\u0439 \u0438\u00a0\u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0TON\u00a0SDK \u0432\u043e\u00a0\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 Telegram. \u041a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434\u0430, \u043d\u043e\u00a0\u0438\u00a0\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0440\u0438\u0451\u043c\u043e\u0432, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0443 \u0433\u0440\u043e\u0437\u0438\u043b\u0438 \u0434\u0443\u0431\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u00ab\u0431\u0435\u043b\u044b\u0435 \u044d\u043a\u0440\u0430\u043d\u044b\u00bb \u0438\u00a0\u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f\u00a0\u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u043f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u00ab\u0431\u043e\u0435\u0432\u044b\u0445\u00bb \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a\u0438\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u043c\u044b\u202f\u0438\u0445\u202f\u0443\u043a\u0440\u043e\u0449\u0430\u043b\u0438, \u0438\u00a0\u043a\u0430\u043a\u043e\u0439 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u043e\u0434\u0436\u0438\u0434\u0430\u043b \u0437\u0430\u00a0\u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c. \u042d\u0442\u043e \u043d\u0435\u00a0\u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0430\u00a0\u0432\u044b\u0436\u0438\u043c\u043a\u0430 \u0438\u0437\u202f\u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432 \u0438\u00a0\u043d\u043e\u0447\u043d\u044b\u0445 \u0434\u0435\u0431\u0430\u0433\u2011\u0441\u0435\u0441\u0441\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u0440\u043e\u0438\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 Telegram, TON \u0438\u00a0React.<\/p>\n<hr\/>\n<h4>1. \u0420\u0443\u0447\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u043f\u043e\u0436\u0430\u0442\u0438\u0435 \u0441\u00a0Telegram Web\u2011App<\/h4>\n<p>Telegram \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>ready()<\/code> \u0438\u00a0<code>expand()<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041c\u044b\u00a0\u0437\u0430\u0432\u0435\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 <code>useEffect<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"typescript\">useEffect(() =&gt; {   if (window.Telegram?.WebApp) {     window.Telegram.WebApp.ready();     window.Telegram.WebApp.expand();   } }, []);<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lifecycle hook \/ Template Method.<\/strong> \u0427\u0451\u0442\u043a\u043e \u043e\u0442\u0434\u0435\u043b\u044f\u0435\u043c \u00ab\u0444\u0430\u0437\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u00bb \u043e\u0442\u00a0\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0God\u00a0Effect.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u00a0\u043e\u0434\u0438\u043d <code>useEffect<\/code> \u0441\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u00a0\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u00a0SDK, \u0438\u00a0\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u00a0\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u00a0DOM\u2011\u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>2. \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u00ab\u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430\u00bb \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u0440\u0435\u043d\u0434\u0435\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043c\u043e\u0433 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0<code>\/api\/add-user<\/code>. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 <code>useRef<\/code>\u2011\u0444\u043b\u0430\u0433 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u00a0Singleton\u2011guard:<\/p>\n<pre><code class=\"typescript\">const hasFetched = useRef(false);  const initializeUser = async () =&gt; {   if (hasFetched.current) return;   hasFetched.current = true;   \/* \u2026\u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0451\u0442 fetch\u2026 *\/ };<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Singleton\u00a0+\u00a0Guard Clause.<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Double Initialization<\/strong>, \u0438\u0437\u2011\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u00a0\u0431\u044d\u043a\u0435\u043d\u0434 \u043b\u0435\u0442\u044f\u0442 \u0434\u0443\u0431\u043b\u0438, \u0430\u00a0\u0443\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u0435\u0440\u0446\u0430\u0435\u0442 UI.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>3. Deep\u2011link \u00ab\/start\u202f+\u202fcontract\u00bb \u043f\u0440\u044f\u043c\u043e \u0432\u00a0\u0434\u0435\u0442\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430<\/h4>\n<p>\u0418\u0437\u00a0\u0447\u0430\u0442\u0430 \u0431\u043e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>tgWebAppStartParam<\/code>. \u041f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435 \u043c\u044b\u00a0\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u043b\u044c, \u0438\u0449\u0435\u043c ID \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u043e\u00a0\u0430\u0434\u0440\u0435\u0441\u0443 \u0438\u00a0\u0441\u0440\u0430\u0437\u0443 \u0440\u043e\u0443\u0442\u0438\u043c:<\/p>\n<pre><code class=\"typescript\">const startParam = urlParams.get(\"tgWebAppStartParam\"); if (startParam &amp;&amp; res.data.role === \"Employee\") {   const { id } = await axios.get(\"\/api\/get-contract-by-address\", { params:{ contractAddress:startParam }});   navigate(`\/contract\/${id}`); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Front Controller (Router).<\/strong> \u0412 \u0435\u0434\u0438\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 intercept\u2011\u0438\u043c url\u2011\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u00a0\u0440\u0435\u0448\u0430\u0435\u043c, \u043a\u0443\u0434\u0430 \u0438\u0434\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Spaghetti Navigation<\/strong> (\u0440\u0443\u0447\u043d\u044b\u0435 <code>window.location<\/code> \u0432\u00a0\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445).<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>4. \u041f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 TON \u0431\u0435\u0437 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u0430\u0441\u043a\u0430\u0434\u043e\u0432<\/h4>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u2011\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441\u0430\u043c \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442 endpoint \u0438\u00a0API\u2011key:<\/p>\n<pre><code class=\"typescript\">export function useTonClient() {   return useAsyncInitialize(async () =&gt; {     let endpoint = await getHttpEndpoint({ network: process.env.REACT_APP_NETWORK ?? \"testnet\" });     if (process.env.REACT_APP_NETWORK === \"testnet\") {       endpoint = \"https:\/\/testnet.toncenter.com\/api\/v2\/jsonRPC\";     } else {       endpoint = \"https:\/\/toncenter.com\/api\/v2\/jsonRPC\";     }     return new TonClient({ endpoint });   }); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Strategy.<\/strong> \u0421\u0435\u0442\u044c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c, \u043a\u043e\u0434 \u043d\u0435\u00a0\u0442\u0440\u043e\u0433\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Hard\u2011coded config.<\/strong> \u041a\u043e\u0433\u0434\u0430 URL \u043c\u0435\u043d\u044f\u044e\u0442 \u0440\u0443\u043a\u0430\u043c\u0438 \u0432\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u043f\u0435\u0440\u0435\u0434 \u0440\u0435\u043b\u0438\u0437\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>5. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u0443\u043a\u2011\u0444\u0430\u0431\u0440\u0438\u043a\u0430 useAsyncInitialize<\/h4>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u043d\u0438\u0432\u043e \u0438\u00a0\u0435\u0434\u0438\u043d\u043e\u0436\u0434\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e\u00a0\u2014 SDK, foreign API, \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442:<\/p>\n<pre><code class=\"typescript\">export function useAsyncInitialize&lt;T&gt;(fn: () =&gt; Promise&lt;T&gt;, deps:any[]=[]){   const [state,setState] = useState&lt;T&gt;()   useEffect(()=&gt;{ (async()=&gt;setState(await fn()))() }, deps)   return state; } <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lazy Factory.<\/strong> \u042d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043a\u043e\u0434 \u0438\u00a0\u043f\u0430\u043c\u044f\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Async\u202fCall\u202fin\u202fRender<\/strong>, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u00abCannot\u00a0update\u00a0a\u00a0component while rendering\u2026\u00bb.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>6. \u0410\u0434\u0430\u043f\u0442\u0435\u0440 \u043a\u00a0Ton\u00a0Connect: \u043e\u0434\u043d\u043e \u043b\u0438\u0446\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u0440\u0451\u0445 SDK<\/h4>\n<p>\u0412\u202fUI \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434 <code>send()<\/code>, \u0430\u00a0\u043d\u0435\u00a0\u0432\u0441\u044f \u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0430\u044f \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430:<\/p>\n<pre><code class=\"typescript\">export function useTonConnect(): { sender:Sender } {   const [tonConnectUI] = useTonConnectUI();   return {     sender: {       send: async (args) =&gt; {         tonConnectUI.sendTransaction({ messages:[{\/* ... *\/}], validUntil: Date.now()+5*60*1000 });       },     },   }; } <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Adapter.<\/strong> UI \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c SDK.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Leaky Abstraction.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0432\u043d\u0438\u0437 \u043f\u0440\u043e\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e\u0442 \u00ab\u0441\u044b\u0440\u044b\u0435\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u044b SDK.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>7. \u041e\u0442\u0441\u0435\u0447\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430\u00a0\u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h4>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0439\u0442\u0438; pending\u00a0TX \u0442\u043e\u0433\u0434\u0430 \u00ab\u0432\u0438\u0441\u0438\u0442\u00bb \u0432\u0435\u0447\u043d\u043e. \u041c\u044b\u00a0\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>validUntil<\/code>:<\/p>\n<pre><code class=\"typescript\">validUntil: Date.now() + 5 * 60 * 1000 \/\/ 5\u202f\u043c\u0438\u043d\u0443\u0442 <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Timeout \/ Expiry.<\/strong> \u0414\u0435\u043b\u0430\u0435\u0442 UX \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u0438\u00a0\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Infinite Pending Promise.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u00a0UI \u043d\u0435\u00a0\u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>8. \u0428\u0438\u043c Buffer \u0432\u00a0\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/h4>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 crypto \u0438\u0437\u00a0Node \u0442\u0440\u0435\u0431\u0443\u044e\u0442 <code>global.Buffer<\/code>. \u041e\u0434\u0438\u043d shim \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<pre><code class=\"typescript\">declare global { interface Window { Buffer: typeof Buffer } } window.Buffer = Buffer; <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Polyfill \/ Shim.<\/strong> \u0426\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Monkey\u2011patch Chaos<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\/\u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c Buffer.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>9. \u0415\u0434\u0438\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0445\u0430\u043e\u0441\u0430<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u043b\u0438 <code>ThemeProvider<\/code> \u0438\u00a0\u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"typescript\">const theme = createTheme({   palette:{ primary:{ main:\"#1976d2\"}, mode:\"light\"},   typography:{ fontFamily:\"Roboto, Arial, sans-serif\"}, });<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Abstract Factory (Theme\u00a0Object).<\/strong> \u041c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u0440\u043c\u0435\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442\u202f\u2014\u00a0\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0451.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Hard\u2011coded colors<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0430\u043b\u0438\u0442\u0440\u0443, \u0430\u00a0\u0444\u0440\u043e\u043d\u0442 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>10. \u00ab\u0420\u0430\u043a\u043e\u0432\u0438\u043d\u0430\u00bb\u2011shell \u0438\u00a0\u0447\u0438\u0441\u0442\u044b\u0435 \u0431\u0438\u0437\u043d\u0435\u0441\u2011\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/h4>\n<p>\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u00a0\u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0440\u0430\u043d \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u00a0\u0441\u0432\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">&lt;Routes&gt;   &lt;Route path=\"\/\" element={!roleSelected ? &lt;WelcomePage\/&gt; : \u2026}\/&gt;   &lt;Route path=\"\/contracts\" element={&lt;AllContractsPage user={user}\/&gt;}\/&gt;   &lt;Route path=\"\/contract\/:id\" element={&lt;ContractDetailPage\/&gt;}\/&gt; &lt;\/Routes&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Page Controller (MVVM \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435).<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 on\u2011boarding \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0God Component<\/strong> \u043d\u0430\u202f1000 \u0441\u0442\u0440\u043e\u043a JSX.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>11. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439: \u0440\u043e\u043b\u044c\u202f\u2192\u202f\u043a\u043e\u0448\u0435\u043b\u0451\u043a\u202f\u2192\u202f\u0433\u043b\u0430\u0432\u043d\u0430\u044f<\/h4>\n<p>\u0422\u0440\u0438 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0444\u043b\u0430\u0433\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0434\u0432\u0430 \u00ab\u0447\u0438\u0441\u0442\u044b\u0445\u00bb \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/p>\n<pre><code class=\"typescript\">!roleSelected       \/\/ \u0435\u0449\u0451 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0440\u043e\u043b\u044c !user.walletAddress \/\/ \u043a\u043e\u0448\u0435\u043b\u0451\u043a \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \/* \u0438\u043d\u0430\u0447\u0435 \u2014 \u0433\u043b\u0430\u0432\u043d\u0430\u044f *\/<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0State Machine.<\/strong> \u041d\u0435\u0442 \u00ab\u043f\u043e\u043b\u0443\u0442\u043e\u043d\u043e\u0432\u00bb (\u043a\u043e\u0448\u0435\u043b\u0451\u043a \u0435\u0441\u0442\u044c, \u043d\u043e\u00a0\u0440\u043e\u043b\u044c \u043d\u0435\u00a0\u0432\u044b\u0431\u0440\u0430\u043d\u0430).<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Boolean State Explosion.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f, \u043e\u202f\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0438\u043a\u0442\u043e \u043d\u0435\u202f\u043f\u043e\u0434\u0443\u043c\u0430\u043b.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>12. \u0413\u0440\u0430\u0446\u0438\u043e\u0437\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u043b \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u0435\u043b\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/h4>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0435\u0442\u0438 \u043d\u0430\u00a0\u0441\u0442\u0430\u0440\u0442\u0435 \u043d\u0435\u00a0\u0440\u043e\u043d\u044f\u0435\u0442 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"typescript\">catch (error) {   console.error(\"Error initializing user:\", error); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Graceful Degradation \/ Fail\u2011safe.<\/strong> \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u00a0Welcome\u2011\u044d\u043a\u0440\u0430\u043d, \u0430\u00a0\u043d\u0435\u00a0\u0432\u0438\u0434\u0438\u0442 \u00abNothing was returned\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Fail\u2011Fast Crash<\/strong>, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u00a0\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c webview.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>13. Gateway \u043a\u202f\u0441\u043c\u0430\u0440\u0442\u2011\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u0437\u00a0React<\/h4>\n<pre><code class=\"typescript\">export function useContract(addr:string){   const client = useTonClient();   const finance = useAsyncInitialize(async()=&gt;{     if(!client) return;     return client.open(new Finance(Address.parse(addr)));   },[client]);    return { getConfig: () =&gt; finance?.getConfig() }; }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Repository \/ Gateway.<\/strong> \u041c\u0435\u043d\u044f\u0435\u043c ABI\u202f\u2014\u00a0\u043f\u0440\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Anemic Model.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0440\u0430\u0437\u043c\u0430\u0437\u0430\u043d\u044b \u043f\u043e\u00a0\u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>14. \u00ab\u041f\u043e\u0434\u043d\u044f\u0442\u044c\u00bb state, \u0430\u00a0\u043d\u0435\u00a0\u0440\u0430\u0437\u0434\u0430\u0432\u0430\u0442\u044c Context \u043d\u0430\u043f\u0440\u0430\u0432\u043e\u2011\u043d\u0430\u043b\u0435\u0432\u043e<\/h4>\n<p><code>user<\/code> \u0438\u00a0<code>role<\/code> \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u00a0<code>App<\/code>, \u0430\u00a0\u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0438\u0445\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e:<\/p>\n<pre><code class=\"typescript\">&lt;AllContractsPage user={user} role={role}\/&gt; <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lifting State\u00a0Up.<\/strong> \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u00a0\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c prop\u2011drilling \u0433\u043b\u0443\u0431\u0436\u0435 \u0442\u0440\u0451\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Global Mutable Singleton<\/strong> (<code>window.user<\/code> \u0438\u043b\u0438 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e \u043e\u0431\u0449\u0438\u0439 React\u202fContext).<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>15. \u0422\u0430\u0439\u043d\u0430\u044f \u0436\u0438\u0437\u043d\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432: \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u00ab\u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u00bb Finance<\/h4>\n<p>\u0421\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0438\u0432\u043e, \u0430\u00a0\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>getConfig()<\/code>\u202f\u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \/ \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 UI:<\/p>\n<p><em>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432\u00a0\u043f\u0443\u043d\u043a\u0442\u0435\u00a013.<\/em><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Facade.<\/strong> \u0414\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0438\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u044b \u0437\u0430\u00a0\u00ab\u043e\u0434\u043d\u043e\u0439 \u0440\u0443\u0447\u043a\u043e\u0439\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Leaking Encapsulation<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0432\u00a0UI \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0430\u0440\u0441\u0438\u0442\u044c BOC\u2011\u0431\u0430\u0439\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432:<\/h3>\n<ul>\n<li>\n<p><strong>\u0427\u0451\u0442\u043a\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 =  \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441\u2011\u043b\u043e\u0433\u0438\u043a\u0443.<\/strong><br \/> \u00a0\u2014 \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0438 (<code>testnet\u202f\u2194\u202fmainnet<\/code>) \u0437\u0430\u043d\u044f\u043b\u043e \u043c\u0438\u043d\u0443\u0442\u044b, \u0430\u202f\u043d\u0435\u202f\u0434\u043d\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0TON \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0432\u202fStrategy\u2011\u0441\u043b\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0430\u0448\u043b\u0430 \u00ab\u0438\u043c\u044f\u00bb (\u043f\u0430\u0442\u0442\u0435\u0440\u043d)\u202f\u2014 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0432\u044c\u044e \u0438\u202f\u043e\u043d\u0431\u043e\u0440\u0434\u0438\u043d\u0433.<\/strong><br \/> \u00a0\u2014 \u041d\u043e\u0432\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c <code>useAsyncInitialize<\/code>, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u00a0\u0432\u0438\u0434\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u202fLazy\u00a0Factory, \u0430\u202f\u043d\u0435\u202f\u0434\u043e\u043c\u043e\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u044c\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b\u202f\u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0447\u0435\u043a\u2011\u043b\u0438\u0441\u0442 \u0434\u043b\u044f code\u2011review.<\/strong><br \/> \u00a0\u2014 \u041c\u044b\u00a0\u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043f\u043e\u00a0\u0441\u043f\u0438\u0441\u043a\u0443: \u00ab\u041d\u0435\u00a0\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c \u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441?\u00bb, \u00ab\u041d\u0435\u00a0\u0443\u0442\u0435\u043a\u043b\u0430 \u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f?\u00bb, \u00ab\u0410\u00a0\u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0441\u0435\u0442\u044c \u0443\u043f\u0430\u0434\u0451\u0442?\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong>\u202f\u2014 \u0444\u0440\u043e\u043d\u0442 \u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0438\u00a0\u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u00ab\u043f\u0430\u0434\u0435\u043d\u0438\u044f\u00bb \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0431\u0435\u0437 \u0431\u0435\u043b\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430. \u0412\u0441\u0451 \u044d\u0442\u043e\u00a0\u2014 \u0441\u00a0\u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u043a\u043e\u0434\u0430\u2011\u043a\u043b\u043e\u043d\u043e\u0432 \u0438\u00a0\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0414\u043b\u044f\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/h3>\n<p><strong>Driptonbot<\/strong>\u00a0\u2014 \u044d\u0442\u043e Telegram\u2011\u0431\u043e\u0442 \u0438 \u0441\u043c\u0430\u0440\u0442\u2011\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u0438 <strong>TON<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043f\u043e\u0447\u0430\u0441\u043e\u0432\u0443\u044e \u043e\u043f\u043b\u0430\u0442\u0443 \u0432\u00a0\u043f\u043e\u0442\u043e\u043a <strong>\u043c\u0438\u043d\u0438\u0432\u044b\u043f\u043b\u0430\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong>. \u0420\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043f\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0430 \u0434\u0435\u043d\u044c\u0433\u0438 \u00ab\u043a\u0430\u043f\u0430\u044e\u0442\u00bb \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0443 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443. \u041e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u00a0% \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u00a0\u0430\u0434\u0440\u0435\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h3><\/h3>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/908454\/\"> https:\/\/habr.com\/ru\/articles\/908454\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3><\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0434 Telegram\u2011\u043c\u0438\u043d\u0438\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u00ab\u043a\u0430\u043f\u0435\u043b\u044c\u043d\u044b\u0445\u00bb (stream)\u202fTON\u2011\u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043b\u043e \u044f\u0441\u043d\u043e: \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CRUD\u2011\u0444\u0440\u043e\u043d\u0442 \u0442\u0443\u0442 \u043d\u0435\u00a0\u0432\u044b\u0436\u0438\u0432\u0435\u0442. \u0421\u0440\u0430\u0437\u0443 \u043d\u0430\u043a\u0440\u044b\u043b\u0430 \u0432\u043e\u043b\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u00a0\u2014 \u043e\u0442\u00a0\u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043e\u043d\u0431\u043e\u0440\u0434\u0438\u043d\u0433\u0430 \u0432\u00a0Web\u2011App \u0434\u043e\u00a0\u0431\u043e\u0440\u044c\u0431\u044b \u0441\u00a0\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 API\u2011\u043a\u043b\u044e\u0447\u0435\u0439 \u0438\u00a0\u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0TON\u00a0SDK \u0432\u043e\u00a0\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 Telegram. \u041a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434\u0430, \u043d\u043e\u00a0\u0438\u00a0\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0440\u0438\u0451\u043c\u043e\u0432, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0443 \u0433\u0440\u043e\u0437\u0438\u043b\u0438 \u0434\u0443\u0431\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u00ab\u0431\u0435\u043b\u044b\u0435 \u044d\u043a\u0440\u0430\u043d\u044b\u00bb \u0438\u00a0\u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f\u00a0\u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u043f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u044b\u0445 \u00ab\u0431\u043e\u0435\u0432\u044b\u0445\u00bb \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a\u0438\u043c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c \u043c\u044b\u202f\u0438\u0445\u202f\u0443\u043a\u0440\u043e\u0449\u0430\u043b\u0438, \u0438\u00a0\u043a\u0430\u043a\u043e\u0439 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u043e\u0434\u0436\u0438\u0434\u0430\u043b \u0437\u0430\u00a0\u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043e\u043c. \u042d\u0442\u043e \u043d\u0435\u00a0\u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0430\u00a0\u0432\u044b\u0436\u0438\u043c\u043a\u0430 \u0438\u0437\u202f\u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432 \u0438\u00a0\u043d\u043e\u0447\u043d\u044b\u0445 \u0434\u0435\u0431\u0430\u0433\u2011\u0441\u0435\u0441\u0441\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u0440\u043e\u0438\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 Telegram, TON \u0438\u00a0React.<\/p>\n<hr\/>\n<h4>1. \u0420\u0443\u0447\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u043f\u043e\u0436\u0430\u0442\u0438\u0435 \u0441\u00a0Telegram Web\u2011App<\/h4>\n<p>Telegram \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>ready()<\/code> \u0438\u00a0<code>expand()<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041c\u044b\u00a0\u0437\u0430\u0432\u0435\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 <code>useEffect<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"typescript\">useEffect(() =&gt; {   if (window.Telegram?.WebApp) {     window.Telegram.WebApp.ready();     window.Telegram.WebApp.expand();   } }, []);<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lifecycle hook \/ Template Method.<\/strong> \u0427\u0451\u0442\u043a\u043e \u043e\u0442\u0434\u0435\u043b\u044f\u0435\u043c \u00ab\u0444\u0430\u0437\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u00bb \u043e\u0442\u00a0\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0God\u00a0Effect.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u00a0\u043e\u0434\u0438\u043d <code>useEffect<\/code> \u0441\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u00a0\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u00a0SDK, \u0438\u00a0\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u00a0\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u00a0DOM\u2011\u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>2. \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442\u00a0\u00ab\u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430\u00bb \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h4>\n<p>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0435\u0440\u0435\u043d\u0434\u0435\u0440\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043c\u043e\u0433 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0<code>\/api\/add-user<\/code>. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 <code>useRef<\/code>\u2011\u0444\u043b\u0430\u0433 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u00a0Singleton\u2011guard:<\/p>\n<pre><code class=\"typescript\">const hasFetched = useRef(false);  const initializeUser = async () =&gt; {   if (hasFetched.current) return;   hasFetched.current = true;   \/* \u2026\u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0451\u0442 fetch\u2026 *\/ };<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Singleton\u00a0+\u00a0Guard Clause.<\/strong> \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Double Initialization<\/strong>, \u0438\u0437\u2011\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u00a0\u0431\u044d\u043a\u0435\u043d\u0434 \u043b\u0435\u0442\u044f\u0442 \u0434\u0443\u0431\u043b\u0438, \u0430\u00a0\u0443\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u0435\u0440\u0446\u0430\u0435\u0442 UI.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>3. Deep\u2011link \u00ab\/start\u202f+\u202fcontract\u00bb \u043f\u0440\u044f\u043c\u043e \u0432\u00a0\u0434\u0435\u0442\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430<\/h4>\n<p>\u0418\u0437\u00a0\u0447\u0430\u0442\u0430 \u0431\u043e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>tgWebAppStartParam<\/code>. \u041f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435 \u043c\u044b\u00a0\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u043b\u044c, \u0438\u0449\u0435\u043c ID \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u043e\u00a0\u0430\u0434\u0440\u0435\u0441\u0443 \u0438\u00a0\u0441\u0440\u0430\u0437\u0443 \u0440\u043e\u0443\u0442\u0438\u043c:<\/p>\n<pre><code class=\"typescript\">const startParam = urlParams.get(\"tgWebAppStartParam\"); if (startParam &amp;&amp; res.data.role === \"Employee\") {   const { id } = await axios.get(\"\/api\/get-contract-by-address\", { params:{ contractAddress:startParam }});   navigate(`\/contract\/${id}`); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Front Controller (Router).<\/strong> \u0412 \u0435\u0434\u0438\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 intercept\u2011\u0438\u043c url\u2011\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u00a0\u0440\u0435\u0448\u0430\u0435\u043c, \u043a\u0443\u0434\u0430 \u0438\u0434\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Spaghetti Navigation<\/strong> (\u0440\u0443\u0447\u043d\u044b\u0435 <code>window.location<\/code> \u0432\u00a0\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445).<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>4. \u041f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u0442\u0438 TON \u0431\u0435\u0437 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u0430\u0441\u043a\u0430\u0434\u043e\u0432<\/h4>\n<p>\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u2011\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0441\u0430\u043c \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442 endpoint \u0438\u00a0API\u2011key:<\/p>\n<pre><code class=\"typescript\">export function useTonClient() {   return useAsyncInitialize(async () =&gt; {     let endpoint = await getHttpEndpoint({ network: process.env.REACT_APP_NETWORK ?? \"testnet\" });     if (process.env.REACT_APP_NETWORK === \"testnet\") {       endpoint = \"https:\/\/testnet.toncenter.com\/api\/v2\/jsonRPC\";     } else {       endpoint = \"https:\/\/toncenter.com\/api\/v2\/jsonRPC\";     }     return new TonClient({ endpoint });   }); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Strategy.<\/strong> \u0421\u0435\u0442\u044c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c, \u043a\u043e\u0434 \u043d\u0435\u00a0\u0442\u0440\u043e\u0433\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Hard\u2011coded config.<\/strong> \u041a\u043e\u0433\u0434\u0430 URL \u043c\u0435\u043d\u044f\u044e\u0442 \u0440\u0443\u043a\u0430\u043c\u0438 \u0432\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u043f\u0435\u0440\u0435\u0434 \u0440\u0435\u043b\u0438\u0437\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>5. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u0443\u043a\u2011\u0444\u0430\u0431\u0440\u0438\u043a\u0430 useAsyncInitialize<\/h4>\n<p>\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u043d\u0438\u0432\u043e \u0438\u00a0\u0435\u0434\u0438\u043d\u043e\u0436\u0434\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e\u00a0\u2014 SDK, foreign API, \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442:<\/p>\n<pre><code class=\"typescript\">export function useAsyncInitialize&lt;T&gt;(fn: () =&gt; Promise&lt;T&gt;, deps:any[]=[]){   const [state,setState] = useState&lt;T&gt;()   useEffect(()=&gt;{ (async()=&gt;setState(await fn()))() }, deps)   return state; } <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lazy Factory.<\/strong> \u042d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043a\u043e\u0434 \u0438\u00a0\u043f\u0430\u043c\u044f\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Async\u202fCall\u202fin\u202fRender<\/strong>, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u00abCannot\u00a0update\u00a0a\u00a0component while rendering\u2026\u00bb.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>6. \u0410\u0434\u0430\u043f\u0442\u0435\u0440 \u043a\u00a0Ton\u00a0Connect: \u043e\u0434\u043d\u043e \u043b\u0438\u0446\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u0440\u0451\u0445 SDK<\/h4>\n<p>\u0412\u202fUI \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434 <code>send()<\/code>, \u0430\u00a0\u043d\u0435\u00a0\u0432\u0441\u044f \u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0430\u044f \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430:<\/p>\n<pre><code class=\"typescript\">export function useTonConnect(): { sender:Sender } {   const [tonConnectUI] = useTonConnectUI();   return {     sender: {       send: async (args) =&gt; {         tonConnectUI.sendTransaction({ messages:[{\/* ... *\/}], validUntil: Date.now()+5*60*1000 });       },     },   }; } <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Adapter.<\/strong> UI \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c SDK.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Leaky Abstraction.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0432\u043d\u0438\u0437 \u043f\u0440\u043e\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e\u0442 \u00ab\u0441\u044b\u0440\u044b\u0435\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u044b SDK.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>7. \u041e\u0442\u0441\u0435\u0447\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430\u00a0\u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h4>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0443\u0439\u0442\u0438; pending\u00a0TX \u0442\u043e\u0433\u0434\u0430 \u00ab\u0432\u0438\u0441\u0438\u0442\u00bb \u0432\u0435\u0447\u043d\u043e. \u041c\u044b\u00a0\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>validUntil<\/code>:<\/p>\n<pre><code class=\"typescript\">validUntil: Date.now() + 5 * 60 * 1000 \/\/ 5\u202f\u043c\u0438\u043d\u0443\u0442 <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Timeout \/ Expiry.<\/strong> \u0414\u0435\u043b\u0430\u0435\u0442 UX \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u0438\u00a0\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Infinite Pending Promise.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u00a0UI \u043d\u0435\u00a0\u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>8. \u0428\u0438\u043c Buffer \u0432\u00a0\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435<\/h4>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 crypto \u0438\u0437\u00a0Node \u0442\u0440\u0435\u0431\u0443\u044e\u0442 <code>global.Buffer<\/code>. \u041e\u0434\u0438\u043d shim \u0432\u043e \u0432\u0441\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438:<\/p>\n<pre><code class=\"typescript\">declare global { interface Window { Buffer: typeof Buffer } } window.Buffer = Buffer; <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Polyfill \/ Shim.<\/strong> \u0426\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Monkey\u2011patch Chaos<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\/\u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c Buffer.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>9. \u0415\u0434\u0438\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0445\u0430\u043e\u0441\u0430<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u043b\u0438 <code>ThemeProvider<\/code> \u0438\u00a0\u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"typescript\">const theme = createTheme({   palette:{ primary:{ main:\"#1976d2\"}, mode:\"light\"},   typography:{ fontFamily:\"Roboto, Arial, sans-serif\"}, });<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Abstract Factory (Theme\u00a0Object).<\/strong> \u041c\u0435\u043d\u044f\u0435\u043c \u0444\u0438\u0440\u043c\u0435\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442\u202f\u2014\u00a0\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0451.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Hard\u2011coded colors<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0430\u043b\u0438\u0442\u0440\u0443, \u0430\u00a0\u0444\u0440\u043e\u043d\u0442 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>10. \u00ab\u0420\u0430\u043a\u043e\u0432\u0438\u043d\u0430\u00bb\u2011shell \u0438\u00a0\u0447\u0438\u0441\u0442\u044b\u0435 \u0431\u0438\u0437\u043d\u0435\u0441\u2011\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/h4>\n<p>\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u00a0\u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0440\u0430\u043d \u0437\u043d\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u00a0\u0441\u0432\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">&lt;Routes&gt;   &lt;Route path=\"\/\" element={!roleSelected ? &lt;WelcomePage\/&gt; : \u2026}\/&gt;   &lt;Route path=\"\/contracts\" element={&lt;AllContractsPage user={user}\/&gt;}\/&gt;   &lt;Route path=\"\/contract\/:id\" element={&lt;ContractDetailPage\/&gt;}\/&gt; &lt;\/Routes&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Page Controller (MVVM \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435).<\/strong> \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442 on\u2011boarding \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0God Component<\/strong> \u043d\u0430\u202f1000 \u0441\u0442\u0440\u043e\u043a JSX.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>11. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439: \u0440\u043e\u043b\u044c\u202f\u2192\u202f\u043a\u043e\u0448\u0435\u043b\u0451\u043a\u202f\u2192\u202f\u0433\u043b\u0430\u0432\u043d\u0430\u044f<\/h4>\n<p>\u0422\u0440\u0438 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0444\u043b\u0430\u0433\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0434\u0432\u0430 \u00ab\u0447\u0438\u0441\u0442\u044b\u0445\u00bb \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/p>\n<pre><code class=\"typescript\">!roleSelected       \/\/ \u0435\u0449\u0451 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0440\u043e\u043b\u044c !user.walletAddress \/\/ \u043a\u043e\u0448\u0435\u043b\u0451\u043a \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \/* \u0438\u043d\u0430\u0447\u0435 \u2014 \u0433\u043b\u0430\u0432\u043d\u0430\u044f *\/<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0State Machine.<\/strong> \u041d\u0435\u0442 \u00ab\u043f\u043e\u043b\u0443\u0442\u043e\u043d\u043e\u0432\u00bb (\u043a\u043e\u0448\u0435\u043b\u0451\u043a \u0435\u0441\u0442\u044c, \u043d\u043e\u00a0\u0440\u043e\u043b\u044c \u043d\u0435\u00a0\u0432\u044b\u0431\u0440\u0430\u043d\u0430).<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Boolean State Explosion.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f, \u043e\u202f\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0438\u043a\u0442\u043e \u043d\u0435\u202f\u043f\u043e\u0434\u0443\u043c\u0430\u043b.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>12. \u0413\u0440\u0430\u0446\u0438\u043e\u0437\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u043b \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u0435\u043b\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/h4>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0435\u0442\u0438 \u043d\u0430\u00a0\u0441\u0442\u0430\u0440\u0442\u0435 \u043d\u0435\u00a0\u0440\u043e\u043d\u044f\u0435\u0442 \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"typescript\">catch (error) {   console.error(\"Error initializing user:\", error); }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Graceful Degradation \/ Fail\u2011safe.<\/strong> \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u00a0Welcome\u2011\u044d\u043a\u0440\u0430\u043d, \u0430\u00a0\u043d\u0435\u00a0\u0432\u0438\u0434\u0438\u0442 \u00abNothing was returned\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Fail\u2011Fast Crash<\/strong>, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u00a0\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c webview.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>13. Gateway \u043a\u202f\u0441\u043c\u0430\u0440\u0442\u2011\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438\u0437\u00a0React<\/h4>\n<pre><code class=\"typescript\">export function useContract(addr:string){   const client = useTonClient();   const finance = useAsyncInitialize(async()=&gt;{     if(!client) return;     return client.open(new Finance(Address.parse(addr)));   },[client]);    return { getConfig: () =&gt; finance?.getConfig() }; }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Repository \/ Gateway.<\/strong> \u041c\u0435\u043d\u044f\u0435\u043c ABI\u202f\u2014\u00a0\u043f\u0440\u0430\u0432\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Anemic Model.<\/strong> \u041a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0440\u0430\u0437\u043c\u0430\u0437\u0430\u043d\u044b \u043f\u043e\u00a0\u0440\u0430\u0437\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>14. \u00ab\u041f\u043e\u0434\u043d\u044f\u0442\u044c\u00bb state, \u0430\u00a0\u043d\u0435\u00a0\u0440\u0430\u0437\u0434\u0430\u0432\u0430\u0442\u044c Context \u043d\u0430\u043f\u0440\u0430\u0432\u043e\u2011\u043d\u0430\u043b\u0435\u0432\u043e<\/h4>\n<p><code>user<\/code> \u0438\u00a0<code>role<\/code> \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432\u00a0<code>App<\/code>, \u0430\u00a0\u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0438\u0445\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e:<\/p>\n<pre><code class=\"typescript\">&lt;AllContractsPage user={user} role={role}\/&gt; <\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Lifting State\u00a0Up.<\/strong> \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u00a0\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c prop\u2011drilling \u0433\u043b\u0443\u0431\u0436\u0435 \u0442\u0440\u0451\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Global Mutable Singleton<\/strong> (<code>window.user<\/code> \u0438\u043b\u0438 \u0447\u0440\u0435\u0437\u043c\u0435\u0440\u043d\u043e \u043e\u0431\u0449\u0438\u0439 React\u202fContext).<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>15. \u0422\u0430\u0439\u043d\u0430\u044f \u0436\u0438\u0437\u043d\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432: \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u00ab\u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u00bb Finance<\/h4>\n<p>\u0421\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0438\u0432\u043e, \u0430\u00a0\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0442\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>getConfig()<\/code>\u202f\u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \/ \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 UI:<\/p>\n<p><em>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432\u00a0\u043f\u0443\u043d\u043a\u0442\u0435\u00a013.<\/em><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Facade.<\/strong> \u0414\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0438\u00a0\u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u044b \u0437\u0430\u00a0\u00ab\u043e\u0434\u043d\u043e\u0439 \u0440\u0443\u0447\u043a\u043e\u0439\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u202f\u2014\u00a0Leaking Encapsulation<\/strong>, \u043a\u043e\u0433\u0434\u0430 \u0432\u00a0UI \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0430\u0440\u0441\u0438\u0442\u044c BOC\u2011\u0431\u0430\u0439\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432:<\/h3>\n<ul>\n<li>\n<p><strong>\u0427\u0451\u0442\u043a\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 =  \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043c\u0435\u043d\u044f\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441\u2011\u043b\u043e\u0433\u0438\u043a\u0443.<\/strong><br \/> \u00a0\u2014 \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0438 (<code>testnet\u202f\u2194\u202fmainnet<\/code>) \u0437\u0430\u043d\u044f\u043b\u043e \u043c\u0438\u043d\u0443\u0442\u044b, \u0430\u202f\u043d\u0435\u202f\u0434\u043d\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0TON \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0432\u202fStrategy\u2011\u0441\u043b\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0430\u0448\u043b\u0430 \u00ab\u0438\u043c\u044f\u00bb (\u043f\u0430\u0442\u0442\u0435\u0440\u043d)\u202f\u2014 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0435\u0432\u044c\u044e \u0438\u202f\u043e\u043d\u0431\u043e\u0440\u0434\u0438\u043d\u0433.<\/strong><br \/> \u00a0\u2014 \u041d\u043e\u0432\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043b\u0435\u0433\u0447\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c <code>useAsyncInitialize<\/code>, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u00a0\u0432\u0438\u0434\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430\u202fLazy\u00a0Factory, \u0430\u202f\u043d\u0435\u202f\u0434\u043e\u043c\u043e\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u044c\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b\u202f\u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0447\u0435\u043a\u2011\u043b\u0438\u0441\u0442 \u0434\u043b\u044f code\u2011review.<\/strong><br \/> \u00a0\u2014 \u041c\u044b\u00a0\u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043f\u043e\u00a0\u0441\u043f\u0438\u0441\u043a\u0443: \u00ab\u041d\u0435\u00a0\u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u043c \u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441?\u00bb, \u00ab\u041d\u0435\u00a0\u0443\u0442\u0435\u043a\u043b\u0430 \u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f?\u00bb, \u00ab\u0410\u00a0\u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0441\u0435\u0442\u044c \u0443\u043f\u0430\u0434\u0451\u0442?\u00bb.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong>\u202f\u2014 \u0444\u0440\u043e\u043d\u0442 \u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0438\u00a0\u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u00ab\u043f\u0430\u0434\u0435\u043d\u0438\u044f\u00bb \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0431\u0435\u0437 \u0431\u0435\u043b\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430. \u0412\u0441\u0451 \u044d\u0442\u043e\u00a0\u2014 \u0441\u00a0\u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u043a\u043e\u0434\u0430\u2011\u043a\u043b\u043e\u043d\u043e\u0432 \u0438\u00a0\u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0414\u043b\u044f\u00a0\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/h3>\n<p><strong>Driptonbot<\/strong>\u00a0\u2014 \u044d\u0442\u043e Telegram\u2011\u0431\u043e\u0442 \u0438 \u0441\u043c\u0430\u0440\u0442\u2011\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u0438 <strong>TON<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u043f\u043e\u0447\u0430\u0441\u043e\u0432\u0443\u044e \u043e\u043f\u043b\u0430\u0442\u0443 \u0432\u00a0\u043f\u043e\u0442\u043e\u043a <strong>\u043c\u0438\u043d\u0438\u0432\u044b\u043f\u043b\u0430\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong>. \u0420\u0430\u0431\u043e\u0442\u043e\u0434\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043f\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0430 \u0434\u0435\u043d\u044c\u0433\u0438 \u00ab\u043a\u0430\u043f\u0430\u044e\u0442\u00bb \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0443 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443. \u041e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u00a0% \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u00a0\u0430\u0434\u0440\u0435\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0442\u0435\u043b\u044f.<\/p>\n<h3><\/h3>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/908454\/\"> https:\/\/habr.com\/ru\/articles\/908454\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-459426","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=459426"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459426\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}