{"id":346854,"date":"2023-03-16T15:04:25","date_gmt":"2023-03-16T15:04:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346854"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2023-03-16T15:04:25","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346854","title":{"rendered":"<span>Ethers js \u2014 \u043e\u0441\u043d\u043e\u0432\u044b<\/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<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<br \/>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c \u0432 javascript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043b\u0430\u043d\u043e\u043c\u0435\u0440\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ethers. \u0427\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0441 \u0440\u0430\u0437\u0434\u0435\u043b.<\/p>\n<h2>\u041a\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430, \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u0430\u043c\u0430\u0441\u043a \u0438 \u0432\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043b\u0430\u0434\u0435\u0435\u0442\u0435 javascript, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Provider<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 <em>MetaMask<\/em><\/p>\n<\/li>\n<li>\n<p>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Contract<\/em><\/p>\n<\/li>\n<li>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <em>ERC-20<\/em> \u0442\u043e\u043a\u0435\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u043d\u043e\u043c<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c \u0432 \u043d\u0430\u0448\u0438\u0445 javascript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0431\u0443\u0434\u044c \u0442\u043e react, vue \u0438\u043b\u0438 \u0436\u0435 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u0439 javascript, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 ethers, \u0447\u0442\u043e \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<blockquote>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ethers.js \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0439 \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c Ethereum \u0438 \u0435\u0433\u043e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439.<\/p>\n<\/blockquote>\n<p>\u0421\u0430\u043c\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <strong>JSON-RPC<\/strong> \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c.<\/p>\n<blockquote>\n<p><strong>JSON-RPC &#8212;<\/strong>\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%BE%D1%82%D0%BE%D0%BA%D0%BE%D0%BB_%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B8_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b<\/a>\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D0%B4%D0%B0%D0%BB%D1%91%D0%BD%D0%BD%D1%8B%D0%B9_%D0%B2%D1%8B%D0%B7%D0%BE%D0%B2_%D0%BF%D1%80%D0%BE%D1%86%D0%B5%D0%B4%D1%83%D1%80\" rel=\"noopener noreferrer nofollow\">\u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/JSON\" rel=\"noopener noreferrer nofollow\">JSON<\/a>\u00a0\u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b (\u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/XML-RPC\" rel=\"noopener noreferrer nofollow\">XML-RPC<\/a>), \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434. JSON-RPC \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430) \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.\u043e\u0442\u0432\u0435\u0442\u0430) \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443, \u0442\u043e \u0438\u0434\u0435\u0442 \u0442\u043e \u0436\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0443\u0447\u0438 \u0435\u043d\u0434-\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438 \u043c\u044b \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<h2>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c Provider<\/h2>\n<blockquote>\n<p>Provider &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430.<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c &#171;\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f&#187; \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u0447\u0435\u0440\u0435\u0437 rpc-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<p>\u0412 ethers \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 &#8212; <strong>JsonRpcProvider, Web3Provider.<\/strong><\/p>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">new ethers.providers.JsonRpcProvider(UrlORConnectionInfo)<\/code><\/pre>\n<p><em>JsonRpcProvider<\/em> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 JSON-RPC HTTP API \u0438\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443 ( api \u043a\u043b\u044e\u0447 \u0438 \u0442. \u0434. ). \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438 \u0442. \u0434. <\/p>\n<pre><code class=\"javascript\">new ethers.providers.Web3Provider(externalProvider)<\/code><\/pre>\n<p><em>Web3Provider<\/em> &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043d\u0438\u043c\u0438. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0435\u0442\u044c.<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 MetaMask<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c  \u043a\u043e\u0448\u0435\u043b\u0435\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>connect<\/em>:<\/p>\n<pre><code class=\"javascript\">import { ethers } from 'ethers'  let web3 = null let provider = null  async connect () {     if (window.ethereum) { \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u043e\u0448\u0435\u043b\u0435\u043a       provider = window.ethereum \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c provider       try {         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430         await window.ethereum.request({ method: 'eth_requestAccounts' })       } catch (e) {         console.error(e)         if (e.code === 4001) return       }     } else if (window.web3) {       provider = window.web3.currentProvider     }     if (provider) {         \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0437\u0438\u0440\u0443\u0435\u043c web3 provider         web3 = new ethers.providers.Web3Provider(provider, 'any')       }   }  <\/code><\/pre>\n<p><em>window.ethereum &#8212; <\/em>\u044d\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0435\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d MetaMask \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0448\u0435\u043b\u0435\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0441 evm(ethereum virtual machine) \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430\u043c\u0438.<\/p>\n<p><em>window.web3<\/em> \u2014 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043a\u043e\u0448\u0435\u043b\u0435\u043a, \u043d\u043e \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u043b\u0438 \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 \u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c).<br \/>\u0414\u043b\u044f \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>loadProvider<\/em>:<\/p>\n<pre><code class=\"javascript\">let userAccount = null \/\/ \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0435 let userAccounts = [] \/\/ \u0432\u0441\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 let userChain = null \/\/ \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0435\u0442\u044c async loadProvider () {     try {       \/\/ \u043e\u0442\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442 \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c       if (provider.removeAllListeners) provider.removeAllListeners()        \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f       if (provider.on) {         \/\/ \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438         provider.on('chainChanged', async (chainId) => {           \/*             \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0441\u0435\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e            \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e \u0430\u0439\u0434\u0438           *\/           userChain = await provider.getNetwork();         })         \/\/ \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430         provider.on('accountsChanged', async (accounts) => {           if (accounts.length !== 0) {             userAccount = accounts[0]             userAccounts = accounts             \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430             await connect()           } else {             \/\/ \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435             userAccount = ''             userAccounts = []           }         })       }       let network, accounts       try {         [chain, accounts] = await Promise.all([           web3.getNetwork(), \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0441\u0435\u0442\u044c           web3.listAccounts() \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430         ])         userAccounts = accounts         userChain = chain       } catch (e) {         console.log(e)       }     } catch (e) {       account = ''       return Promise.reject(e)     }   }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0432\u044b\u0448\u0435 \u0443 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0441\u043c\u0435\u043d\u0443 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0441\u043c\u0435\u043d\u0443 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f c\u0435\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <em>userChain.name. <\/em>\u0422\u0430\u043a \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <em>id <\/em>\u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041a\u0430\u043a \u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u0443 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0441\u0435\u0442\u044b \u0441\u0435\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">const networks = {     1: {       name: 'Ethereum Mainnet',       shortName: 'ethereum',       chainId: 1,       network: 'ethereum',       rpc: 'https:\/\/rpc.ankr.com\/eth',       explorer: 'https:\/\/etherscan.io'     }     \/\/... }<\/code><\/pre>\n<p><em>rpc <\/em>&#8212; \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<br \/><em>explorer &#8212;<\/em> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 etherscan.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u043d\u0443 \u0441\u0435\u0442\u0438 \u0441 \u043f\u0440\u0435\u0441\u0435\u0442\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>handleChainChanged<\/em> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0435 <em>chain.id <\/em>\u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u0433\u0434\u0435 \u043c\u044b \u044f\u0432\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<em> chain:<\/em><\/p>\n<pre><code class=\"javascript\">async handleChainChanged (chainId) {     \/\/ \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0441\u0435\u0442\u0430 \u043d\u0435\u0442, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435     if (!networks[chainId]) {       const chain = (await web3.getNetwork())       networks[chain.id] = chain     }     userChain = networks[chainId] }<\/code><\/pre>\n<h2>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c Contract<\/h2>\n<blockquote>\n<p>Contract &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435. <\/p>\n<\/blockquote>\n<p>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0422\u043e\u043a\u0435\u043d\u044b, \u0444\u0430\u0440\u043c\u0438\u043b\u043a\u0438, \u0438 \u0442.\u0434. <\/p>\n<p>Ethers js \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043f\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"javascript\">new ethers.Contract( address , abi , signerOrProvider )<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ol>\n<li>\n<p>address &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0434\u043b\u044f \u044d\u0444\u0438\u0440\u0438\u0443\u043c\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/etherscan.io\/\" rel=\"noopener noreferrer nofollow\">https:\/\/etherscan.io<\/a> \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c explorer \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0442\u0435\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0430\u0434\u0440\u0435\u0441 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 USDT \u0432 \u0441\u0435\u0442\u0438 \u044d\u0444\u0438\u0440\u0438\u0443\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<\/li>\n<\/ol>\n<pre><code>0xdAC17F958D2ee523a2206206994597C13D831ec7<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>abi &#8212; \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043c\u043e\u0433\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438 \u0438 \u0432 \u0441\u0435\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 abi \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f name \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"javascript\">[     {         \"constant\": true,         \"inputs\": [], \/\/ \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b         \"name\": \"name\", \/\/ \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430         \"outputs\": [ \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b             {                 \"name\": \"\",                 \"type\": \"string\"             }         ],         \"payable\": false, \/\/ \u0435\u0441\u043b\u0438 true - \u0432\u0437\u044b\u043c\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d\u044b         \"stateMutability\": \"view\",         \"type\": \"function\"     } ]<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p><em>signerOrProvider<\/em> &#8212; <em>signer<\/em>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 (\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0441\u043d\u044f\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u044b \u0438 \u0442 \u0434),  \u0438\u043b\u0438 <em>provider<\/em>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0438 \u0442 \u0434 ).<\/p>\n<p><em>signer<\/em> &#8212; \u044d\u0442\u043e \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 Ethereum, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0432 \u0441\u0435\u0442\u044c Ethereum, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435.<\/p>\n<p> <em>provider<\/em> &#8212; \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c ERC-20 \u0442\u043e\u043a\u0435\u043d\u0430<\/h2>\n<p><em>ERC-20<\/em> &#8212; \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0442\u043e\u043a\u0435\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p><em>balanceOf<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p><em>approve<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0434\u0430\u0447\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443<\/p>\n<\/li>\n<li>\n<p><em>transfer<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441<\/p>\n<p>\u0418 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <em>ERC-20<\/em> \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 <em>DAI<\/em> \u0432 \u0441\u0435\u0442\u0438 <em>polygon<\/em>.<\/p>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"javascript\">import { ethers } from 'ethers'  const BALANCEOF_ABI =[   {         inputs: [             {                 \"internalType\": \"address\",                 \"name\": \"owner\",                 \"type\": \"address\"             }         ],         name: \"balanceOf\",         outputs: [             {                 internalType: \"uint256\",                 name: \"\",                 type: \"uint256\"             }         ],         stateMutability: \"view\",         type: \"function\"     }, ] const DAI_ADDRESS = \"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063\" const DAI_DECIMALS = 18 const POLYGON_RPC_URL = \"https:\/\/polygon-rpc.com\"  const provider = new ethers.providers.JsonRpcProvider(POLYGON_RPC_URL) const web3 = new ethers.providers.Web3Provider(window.ethereum, 'any')  const userAccount = (await web3.listAccounts())[0]  const DAI = new ethers.Contract(DAI_ADDRESS, BALANCEOF_ABI, provider)  const DAIBalanceBigInt = await DAI.balanceOf(owner.address) const DAIBalanceNumber = ethers.utils.formatUnits(   DAIBalanceBigInt.toString(),   DAI_DECIMALS )<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0437\u0430\u0434\u0430\u0435\u043c <em>abi<\/em>, <em>address<\/em> \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 DAI \u0438 <em>decimals<\/em> (\u043a\u043e\u043b-\u0432\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0445 \u0434\u0440\u043e\u0431\u0435\u0439, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0431\u0430\u043b\u0430\u043d\u0441 \u043a \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u043c\u0443 \u0432\u0438\u0434\u0443).<br \/>\u0412\u0441\u0435 \u044d\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438\u043b\u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 etherscan.io \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c explorer \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c <em>provider<\/em> \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 <em>web3<\/em> \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041a\u0430\u043a \u044d\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u0430 <em>DAI<\/em>. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0443 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043a\u0430 \u043c\u0435\u0442\u043e\u0434 <em>balanceOf<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0430\u0434\u0440\u0435\u0441 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441. \u0410 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 BigInt.<\/p>\n<p>\u0418 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c BigInt \u0432 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0432\u0438\u0434 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b ethers <em>formatUnits<\/em>.<\/p>\n<h3>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h3>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b-\u0432\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432. \u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u043e\u0432 <em>ERC-20<\/em> \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0432 \u0441\u0435\u0442\u0438 <em>polygon<\/em>.<\/p>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438-\u043a\u043e\u043b\u043b \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u0441 \u043d\u0438\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u0442\u0438. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <em>ethcall.<\/em><\/p>\n<p><em>Ethcall <\/em>\u0438\u043c\u0435\u0435\u0442 \u0441\u0445\u043e\u0436\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441 <em>ethers<\/em> &#8212; <em>Contract<\/em> \u0438 <em>Provider. <\/em>\u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u043a\u0430\u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0435\u0439:<\/p>\n<pre><code class=\"javascript\">import { Provider, Contract } from 'ethcall' import { ethers } from 'ethers'  const BALANCEOF_ABI =[   {         inputs: [             {                 \"internalType\": \"address\",                 \"name\": \"owner\",                 \"type\": \"address\"             }         ],         name: \"balanceOf\",         outputs: [             {                 internalType: \"uint256\",                 name: \"\",                 type: \"uint256\"             }         ],         stateMutability: \"view\",         type: \"function\"     }, ]  const POLYGON_RPC_URL = \"https:\/\/polygon-rpc.com\"  const tokens = [   {     symbol: 'USDT',     address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',     decimals: 6   },   {     symbol: 'USDC',     address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',     decimals: 6   },   {     symbol: 'DAI',     address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063',     decimals: 18   } ]   const provider = new ethers.providers.JsonRpcProvider(POLYGON_RPC_URL) const web3 = new ethers.providers.Web3Provider(window.ethereum, 'any')  const multicallProvider = new Provider() await multicallProvider.init(provider)  const userAccount = (await web3.listAccounts())[0]  const calls = tokens.map((token) => {  const tokenContract = new Contract(token.address, BALANCEOF_ABI)  return tokenContract.balanceOf(userAccount) })  const tokenBalancesBigInt = await multicallProvider.all(calls)  const tokenBalancesNumber = tokenBalancesBigInt.map((tokenBalanceBI, index) => {   return ethers.utils.formatUnits(     tokenBalanceBI.toString(),     tokens[index].decimals   ) })<\/code><\/pre>\n<p>\u0427\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043a\u043e\u0434 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u0440\u0430\u043d\u0435\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f.<\/p>\n<p>\u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Provider<\/em> ethcall<em> <\/em>\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0430\u0447\u0435. \u041c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438\u0441\u044c \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <em>init<\/em> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ethers.<\/p>\n<p>\u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Contract<\/em> ethcall<em> \u0442<\/em>\u0430\u043a\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442<em> <\/em>ethers<em> Contract <\/em>\u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 3 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. <br \/>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u043b\u0438 \u0432\u0435\u0441\u044c \u043d\u0430\u0448 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445, \u0443 \u044d\u0442\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0432\u0438\u0434\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <em>all <\/em>\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 ethcall, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c&#187; \u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u043a \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u043c\u0443\u043b\u044c\u0442\u0438-\u043a\u043e\u043b \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c.<\/p>\n<p>\u0418 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0432 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434<\/h2>\n<p>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433\u0438, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e ethers \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c. \u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b, \u043d\u043e \u043d\u0430 \u0434\u0435\u043b\u0435 \u0438\u0445 \u0432 \u0440\u0430\u0437\u044b \u0431\u043e\u043b\u044c\u0448\u0435. <br \/>\u041d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0432\u0430\u043c \u043f\u043e\u043b\u0435\u0437\u043d\u0430. <\/p>\n<\/p>\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\/post\/722816\/\"> https:\/\/habr.com\/ru\/post\/722816\/<\/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<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<br \/>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c \u0432 javascript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043b\u0430\u043d\u043e\u043c\u0435\u0440\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 ethers. \u0427\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0441 \u0440\u0430\u0437\u0434\u0435\u043b.<\/p>\n<h2>\u041a\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f?<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430, \u0443 \u0432\u0430\u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043c\u0435\u0442\u0430\u043c\u0430\u0441\u043a \u0438 \u0432\u044b \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043b\u0430\u0434\u0435\u0435\u0442\u0435 javascript, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Provider<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 <em>MetaMask<\/em><\/p>\n<\/li>\n<li>\n<p>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c <em>Contract<\/em><\/p>\n<\/li>\n<li>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <em>ERC-20<\/em> \u0442\u043e\u043a\u0435\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u043d\u043e\u043c<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c \u0432 \u043d\u0430\u0448\u0438\u0445 javascript \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0431\u0443\u0434\u044c \u0442\u043e react, vue \u0438\u043b\u0438 \u0436\u0435 \u0432\u0430\u043d\u0438\u043b\u044c\u043d\u044b\u0439 javascript, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 ethers, \u0447\u0442\u043e \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<blockquote>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 ethers.js \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0439 \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c Ethereum \u0438 \u0435\u0433\u043e \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439.<\/p>\n<\/blockquote>\n<p>\u0421\u0430\u043c\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <strong>JSON-RPC<\/strong> \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c.<\/p>\n<blockquote>\n<p><strong>JSON-RPC &#8212;<\/strong>\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%BE%D1%82%D0%BE%D0%BA%D0%BE%D0%BB_%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B8_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b<\/a>\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D0%B4%D0%B0%D0%BB%D1%91%D0%BD%D0%BD%D1%8B%D0%B9_%D0%B2%D1%8B%D0%B7%D0%BE%D0%B2_%D0%BF%D1%80%D0%BE%D1%86%D0%B5%D0%B4%D1%83%D1%80\" rel=\"noopener noreferrer nofollow\">\u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/JSON\" rel=\"noopener noreferrer nofollow\">JSON<\/a>\u00a0\u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b (\u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430\u00a0<a href=\"https:\/\/ru.wikipedia.org\/wiki\/XML-RPC\" rel=\"noopener noreferrer nofollow\">XML-RPC<\/a>), \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043a\u043e\u043c\u0430\u043d\u0434. JSON-RPC \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430) \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.\u043e\u0442\u0432\u0435\u0442\u0430) \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443, \u0442\u043e \u0438\u0434\u0435\u0442 \u0442\u043e \u0436\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0443\u0447\u0438 \u0435\u043d\u0434-\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438 \u043c\u044b \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<h2>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c Provider<\/h2>\n<blockquote>\n<p>Provider &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430.<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c &#171;\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f&#187; \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u0447\u0435\u0440\u0435\u0437 rpc-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<\/p>\n<p>\u0412 ethers \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 &#8212; <strong>JsonRpcProvider, Web3Provider.<\/strong><\/p>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">new ethers.providers.JsonRpcProvider(UrlORConnectionInfo)<\/code><\/pre>\n<p><em>JsonRpcProvider<\/em> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0441\u0441\u044b\u043b\u043a\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 JSON-RPC HTTP API \u0438\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443 ( api \u043a\u043b\u044e\u0447 \u0438 \u0442. \u0434. ). \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0438 \u0442. \u0434. <\/p>\n<pre><code class=\"javascript\">new ethers.providers.Web3Provider(externalProvider)<\/code><\/pre>\n<p><em>Web3Provider<\/em> &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043d\u0438\u043c\u0438. \u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0435\u0442\u044c.<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 MetaMask<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c  \u043a\u043e\u0448\u0435\u043b\u0435\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>connect<\/em>:<\/p>\n<pre><code class=\"javascript\">import { ethers } from 'ethers'  let web3 = null let provider = null  async connect () {     if (window.ethereum) { \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u043e\u0448\u0435\u043b\u0435\u043a       provider = window.ethereum \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c provider       try {         \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430         await window.ethereum.request({ method: 'eth_requestAccounts' })       } catch (e) {         console.error(e)         if (e.code === 4001) return       }     } else if (window.web3) {       provider = window.web3.currentProvider     }     if (provider) {         \/\/ \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0437\u0438\u0440\u0443\u0435\u043c web3 provider         web3 = new ethers.providers.Web3Provider(provider, 'any')       }   }  <\/code><\/pre>\n<p><em>window.ethereum &#8212; <\/em>\u044d\u0442\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0435\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d MetaMask \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0448\u0435\u043b\u0435\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0441 evm(ethereum virtual machine) \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430\u043c\u0438.<\/p>\n<p><em>window.web3<\/em> \u2014 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0441\u0435 \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043a\u043e\u0448\u0435\u043b\u0435\u043a, \u043d\u043e \u043c\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u043b\u0438 \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 \u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c).<br \/>\u0414\u043b\u044f \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>loadProvider<\/em>:<\/p>\n<pre><code class=\"javascript\">let userAccount = null \/\/ \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0435 let userAccounts = [] \/\/ \u0432\u0441\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 let userChain = null \/\/ \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0435\u0442\u044c async loadProvider () {     try {       \/\/ \u043e\u0442\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442 \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c       if (provider.removeAllListeners) provider.removeAllListeners()        \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f       if (provider.on) {         \/\/ \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438         provider.on('chainChanged', async (chainId) => {           \/*             \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0441\u0435\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0441\u0435\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e            \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e \u0430\u0439\u0434\u0438           *\/           userChain = await provider.getNetwork();         })         \/\/ \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430         provider.on('accountsChanged', async (accounts) => {           if (accounts.length !== 0) {             userAccount = accounts[0]             userAccounts = accounts             \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430             await connect()           } else {             \/\/ \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435             userAccount = ''             userAccounts = []           }         })       }       let network, accounts       try {         [chain, accounts] = await Promise.all([           web3.getNetwork(), \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0441\u0435\u0442\u044c           web3.listAccounts() \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430         ])         userAccounts = accounts         userChain = chain       } catch (e) {         console.log(e)       }     } catch (e) {       account = ''       return Promise.reject(e)     }   }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0432\u044b\u0448\u0435 \u0443 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u0441\u043c\u0435\u043d\u0443 \u0443\u0447\u0435\u0442\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0441\u043c\u0435\u043d\u0443 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043d\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f c\u0435\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c <em>userChain.name. <\/em>\u0422\u0430\u043a \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <em>id <\/em>\u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041a\u0430\u043a \u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u0443 \u0432\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0441\u0435\u0442\u044b \u0441\u0435\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">const networks = {     1: {       name: 'Ethereum Mainnet',       shortName: 'ethereum',       chainId: 1,       network: 'ethereum',       rpc: 'https:\/\/rpc.ankr.com\/eth',       explorer: 'https:\/\/etherscan.io'     }     \/\/... }<\/code><\/pre>\n<p><em>rpc <\/em>&#8212; \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430.<br \/><em>explorer &#8212;<\/em> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 etherscan.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u043d\u0443 \u0441\u0435\u0442\u0438 \u0441 \u043f\u0440\u0435\u0441\u0435\u0442\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>handleChainChanged<\/em> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0435 <em>chain.id <\/em>\u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u0433\u0434\u0435 \u043c\u044b \u044f\u0432\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e<em> chain:<\/em><\/p>\n<pre><code class=\"javascript\">async handleChainChanged (chainId) {     \/\/ \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0441\u0435\u0442\u0430 \u043d\u0435\u0442, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435     if (!networks[chainId]) {       const chain = (await web3.getNetwork())       networks[chain.id] = chain     }     userChain = networks[chainId] }<\/code><\/pre>\n<h2>C\u0443\u0449\u043d\u043e\u0441\u0442\u044c Contract<\/h2>\n<blockquote>\n<p>Contract &#8212; \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435. <\/p>\n<\/blockquote>\n<p>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u0422\u043e\u043a\u0435\u043d\u044b, \u0444\u0430\u0440\u043c\u0438\u043b\u043a\u0438, \u0438 \u0442.\u0434. <\/p>\n<p>Ethers js \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043f\u043e\u0434 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"javascript\">new ethers.Contract( address , abi , signerOrProvider )<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ol>\n<li>\n<p>address &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430, \u0434\u043b\u044f \u044d\u0444\u0438\u0440\u0438\u0443\u043c\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/etherscan.io\/\" rel=\"noopener noreferrer nofollow\">https:\/\/etherscan.io<\/a> \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c explorer \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0442\u0435\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0430\u0434\u0440\u0435\u0441 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 USDT \u0432 \u0441\u0435\u0442\u0438 \u044d\u0444\u0438\u0440\u0438\u0443\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<\/li>\n<\/ol>\n<pre><code>0xdAC17F958D2ee523a2206206994597C13D831ec7<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>abi &#8212; \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043c\u043e\u0433\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438 \u0438 \u0432 \u0441\u0435\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 abi \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f name \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"javascript\">[     {         \"constant\": true,         \"inputs\": [], \/\/ \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b         \"name\": \"name\", \/\/ \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430         \"outputs\": [ \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b             {                 \"name\": \"\",                 \"type\": \"string\"             }         ],         \"payable\": false, \/\/ \u0435\u0441\u043b\u0438 true - \u0432\u0437\u044b\u043c\u0430\u0435\u0442 \u0442\u043e\u043a\u0435\u043d\u044b         \"stateMutability\": \"view\",         \"type\": \"function\"     } ]<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p><em>signerOrProvider<\/em> &#8212; <em>signer<\/em>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0435 (\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0441\u043d\u044f\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u044b \u0438 \u0442 \u0434),  \u0438\u043b\u0438 <em>provider<\/em>, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0438 \u0442 \u0434 ).<\/p>\n<p><em>signer<\/em> &#8212; \u044d\u0442\u043e \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 Ethereum, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0432 \u0441\u0435\u0442\u044c Ethereum, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435.<\/p>\n<p> <em>provider<\/em> &#8212; \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c ERC-20 \u0442\u043e\u043a\u0435\u043d\u0430<\/h2>\n<p><em>ERC-20<\/em> &#8212; \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0442\u043e\u043a\u0435\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p><em>balanceOf<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p><em>approve<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0434\u0430\u0447\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443<\/p>\n<\/li>\n<li>\n<p><em>transfer<\/em> &#8212; \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441<\/p>\n<p>\u0418 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043e \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c <em>ERC-20<\/em> \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 <em>DAI<\/em> \u0432 \u0441\u0435\u0442\u0438 <em>polygon<\/em>.<\/p>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"javascript\">import { ethers } from 'ethers'  const BALANCEOF_ABI =[   {         inputs: [             {                 \"internalType\": \"address\",                 \"name\": \"owner\",                 \"type\": \"address\"             }         ],         name: \"balanceOf\",         outputs: [             {                 internalType: \"uint256\",                 name: \"\",                 type: \"uint256\"             }         ],         stateMutability: \"view\",         type: \"function\"     }, ] const DAI_ADDRESS = \"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063\" const DAI_DECIMALS = 18 const POLYGON_RPC_URL = \"https:\/\/polygon-rpc.com\"  const provider = new ethers.providers.JsonRpcProvider(POLYGON_RPC_URL) const web3 = new ethers.providers.Web3Provider(window.ethereum, 'any')  const userAccount = (await web3.listAccounts())[0]  const DAI = new ethers.Contract(DAI_ADDRESS, BALANCEOF_ABI,<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-346854","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346854","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=346854"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346854\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}