Title: Add documentation for package importing AST gotcha · Issue #234 · nullstack/nullstack.github.io · GitHub
Open Graph Title: Add documentation for package importing AST gotcha · Issue #234 · nullstack/nullstack.github.io
X Title: Add documentation for package importing AST gotcha · Issue #234 · nullstack/nullstack.github.io
Description: When using mono repo style dependencies and possibly other dependencies, it is possible that the built AST does not properly include an imported package. The following example failed to include "@starving/contracts/dist/typechain-types" ...
Open Graph Description: When using mono repo style dependencies and possibly other dependencies, it is possible that the built AST does not properly include an imported package. The following example failed to include "@s...
X Description: When using mono repo style dependencies and possibly other dependencies, it is possible that the built AST does not properly include an imported package. The following example failed to include &qu...
Opengraph URL: https://github.com/nullstack/nullstack.github.io/issues/234
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add documentation for package importing AST gotcha ","articleBody":"***When using mono repo style dependencies and possibly other dependencies, it is possible that the built AST does not properly include an imported package.***\r\n\r\n**The following example failed to include \"@starving/contracts/dist/typechain-types\"** \r\n```\r\nimport Nullstack from \"nullstack\";\r\nimport base from \"@starving/contracts/dist/typechain-types\";\r\nimport ethers from \"ethers\";\r\nclass Account extends Nullstack {\r\n hydrate() {\r\n this.connectWallet();\r\n }\r\n async connectWallet() {\r\n console.log(base.ERC165__factory);\r\n const factory = await new base.Tap__factory();\r\n\r\n factory.attach(\"\").requestTokens();\r\n const fact = await factory.deploy();\r\n\r\n const provider = new ethers.providers.JsonRpcProvider();\r\n const tokenContract = new tap(nftAddress, NFT.abi, provider);\r\n const marketContract = new ethers.Contract(\r\n nftMarketAddress,\r\n Market.abi,\r\n provider\r\n );\r\n const data = await marketContract.fetchMarketItems();\r\n }\r\n getTap() {\r\n return 1.354;\r\n }\r\n\r\n getAddress() {\r\n return \"0x5a773...6f57c0\";\r\n }\r\n\r\n render() {\r\n return (\r\n \u003cdiv style=\"\" class=\"flex justify-end\"\u003e\r\n \u003cdiv class=\"flex items-center\"\u003e\r\n \u003cdiv class=\"max-w-[14px] max-h-[17px]\"\u003e\r\n \u003cimg src=\"tap.png\" class=\"object-cover\"\u003e\u003c/img\u003e\r\n \u003c/div\u003e\r\n \u003cdiv class=\"pl-2 text-sm flex flex-col items-center\"\u003e\r\n \u003cspan class=\"font-bold\"\u003e\r\n {this.getTap()}{\" \"}\r\n \u003cspan class=\"text-shadow-white font-medium\"\u003eTAP\u003c/span\u003e\r\n \u003c/span\u003e\r\n \u003cdiv\u003e\r\n \u003cspan class=\"text-shadow-white\"\u003e{this.getAddress()}\u003c/span\u003e\r\n \u003c/div\u003e\r\n \u003c/div\u003e\r\n \u003c/div\u003e\r\n \u003cdiv class=\"flex items-center pl-10\"\u003e\r\n \u003cdiv class=\"max-w-[14px] max-h-[17px]\"\u003e\r\n \u003cimg src=\"account_circle.png\" class=\"object-cover\"\u003e\u003c/img\u003e\r\n \u003c/div\u003e\r\n \u003cspan class=\"pl-2 font-bold\"\u003e My account\u003c/span\u003e\r\n \u003c/div\u003e\r\n \u003c/div\u003e\r\n );\r\n }\r\n}\r\n\r\nexport default Account;\r\n```\r\n\r\n**This was fixed by importing @starving/contracts/dist/typechain-types in the server.js file** \r\n\r\n```\r\nimport Nullstack from \"nullstack\";\r\nimport Application from \"./src/Application\";\r\nimport { StavingChildrenNft__factory } from \"@starving/contracts/dist/typechain-types/factories/contracts/Nft.sol/StavingChildrenNft__factory\";\r\n\r\nconst context = Nullstack.start(Application);\r\n\r\ncontext.start = async function start() {\r\n console.log(StavingChildrenNft__factory);\r\n // https://nullstack.app/application-startup\r\n};\r\n\r\nexport default context;\r\n\r\n```","author":{"url":"https://github.com/robGetsTheJobDoneAE","@type":"Person","name":"robGetsTheJobDoneAE"},"datePublished":"2022-07-15T17:49:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/234/nullstack.github.io/issues/234"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:edab85d9-1ae8-a762-0f7e-38102ae05d46 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EF8:1BFEB3:738587:936ED0:698FCC7A |
| html-safe-nonce | ef884c6a592248aa47a7e992999a01efba743ca28351568bf74ac47e5493b556 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUY4OjFCRkVCMzo3Mzg1ODc6OTM2RUQwOjY5OEZDQzdBIiwidmlzaXRvcl9pZCI6Ijg1MzA5MDY5MzQwNzY3NTUwNjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c77a8a554d1ac683a061a48a558de11f4bbc22ae4089d03ff9333710f34ee7bf |
| hovercard-subject-tag | issue:1306323378 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nullstack/nullstack.github.io/234/issue_layout |
| twitter:image | https://opengraph.githubassets.com/003fc4c09a6994f436ccad59b97f90760ce5840a51c520c2cf8538149bfc43c0/nullstack/nullstack.github.io/issues/234 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/003fc4c09a6994f436ccad59b97f90760ce5840a51c520c2cf8538149bfc43c0/nullstack/nullstack.github.io/issues/234 |
| og:image:alt | When using mono repo style dependencies and possibly other dependencies, it is possible that the built AST does not properly include an imported package. The following example failed to include "@s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | robGetsTheJobDoneAE |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/nullstack/nullstack.github.io git https://github.com/nullstack/nullstack.github.io.git |
| octolytics-dimension-user_id | 63256628 |
| octolytics-dimension-user_login | nullstack |
| octolytics-dimension-repository_id | 316980656 |
| octolytics-dimension-repository_nwo | nullstack/nullstack.github.io |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 316980656 |
| octolytics-dimension-repository_network_root_nwo | nullstack/nullstack.github.io |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 00bbb8945a3943b287e04c68aff13cb5878ddde7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width