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: patch-diff.githubusercontent.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:5d9c51ce-3beb-cd22-e28e-5f098ec334d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC4C:12F068:813C68:A4EEBA:69913A1A |
| html-safe-nonce | 9d73d2d72852f7699b820c98262e82965594807282336e38bb9a17ff1127a054 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzRDOjEyRjA2ODo4MTNDNjg6QTRFRUJBOjY5OTEzQTFBIiwidmlzaXRvcl9pZCI6IjE2NjA1Nzg0MDczMTI4NjU4MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7348db309a6e81afa3a6b6ea3ece730a0c9100ccbc67acb8d23bf517d50f6398 |
| 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 | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width