Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative imports don't work in upward direction #73

Closed
defi-pickle opened this issue Oct 18, 2023 · 4 comments · Fixed by #125
Closed

Relative imports don't work in upward direction #73

defi-pickle opened this issue Oct 18, 2023 · 4 comments · Fixed by #125
Assignees
Labels
bug Something isn't working
Milestone

Comments

@defi-pickle
Copy link

I am encountering issues with relative imports, which don't seem to function intuitively, especially when I try to import files from a different directory. When I import files from the same directory using the syntax import "./other_file.tact";, everything operates smoothly. However, problems emerge when I attempt to import files from a parent or sibling directory with the syntax import "../other_file.tact";.

I have an extensive folder structure with many contracts, and my goal is to share some utility files among them while adhering to a standard folder structure. My folder structure is organized as follows:

contracts
|--utils
   |--some_file.tact
|--dex
   |--dex_file.tact

I aim to maintain this structure while facilitating the sharing of utility files across different contracts. However, the relative import issues are preventing me from achieving this. Question is: Can we achieve such imports in tact?

@defi-pickle
Copy link
Author

link to the same issue on blueprint ton-org/blueprint#59

@logvik
Copy link
Member

logvik commented Oct 18, 2023

Please, specify your OS

@defi-pickle
Copy link
Author

System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 4.87 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh

Also i am using @tact-lang/compiler@1.1.3 and @ton-community/blueprint@0.12.0

@defi-pickle
Copy link
Author

If you need a hand in adding this feature just let me know where should i start.

d0rich added a commit to d0rich/esprit that referenced this issue Nov 22, 2023
* Init contracts project

* Only one contracts repository

* Init new contracts

* Copy draft nft contracts

* Move NFT functionality to the traits

* Fix build errors

* Restructure contracts, becuase upward import doesn't work

tact-lang/tact#73

* Update node and fix lock file

* Build contracts before test

* Lint and test in single job

* Temporary hide tests

* Add build script

* Leave only one test

* Implement accounting trait

* Implement royalty extention

* Extraxt logic from transfer reciever

* Move get functions to the top

* Add custom function to get individual content for NFT item.

* Add getNftCollectionContent function to
NftCollection trait

* Refactor accounting functions to use more
descriptive names

* Add virtual function to calculate NFT item initial
balance.

* Add requireEnoughTonForMinting function to
NftCollection trait

* Fix semicolon in calculateNftItemInitalBalance()
function

* Refactor DSocialNetworkAccount and NftCollection
to use owner instead of owner_address

* Master contract draft

* Fix build errors

* Handle NFT custom internal content

* Handle account initialization

* Fix account registration

* Group NFT messages

* Try to store metadata on chain

* Use emptyMap() for map initialization

* Test accounts registration

* Create tests specifically for the account

* Change account parameters

* Create post

* Deploy test post to test how it looks like on getgems

* Add master contract address to account info

* Update social links to be stored as a JSON string

* Update metadata arrays to use empty cells instead
of JSON strings

* Refactor metadata arrays to use empty cells

* Store metadata in JSON string

* Don't convert metadata to cell

* Reuse similar messages

* v0.0.1-metadata-as-struct-no-convertation-to-cell

* v0.0.1-metadata-as-cells

* v0.0.1-no-maps-in-metadata

* Test parser for onchain metadata

* Correctly serialize metadata with native functions

* Correctly serialize dict fields

* Serialize nft content in collection

* Serialize nft collection metadata

* Prevent NFT serialiozation from other collections

* Add index validation in serializeNftContent
function

* Return standard metadata in 1 cell

* Update version and remove content_url

* Init d entities models

* Serialize post metadata to description

* Rework tests

* Refactor serialization of individual content in
NftItem trait

* Refactor serializeIndividualContent function to
remove unnecessary map initialization

* Comment test affected by library

ton-org/ton-core#16

* Resolve BitBuilder overflow issue

ton-org/ton-core#16

* Slightly refactor test

* Refactor DPost content field to contentMd

* Init d.d0rich.me

* Move models to frontend

* lintfix

* Refactor ignore-build.mjs files

* Add build task for d.d0rich.me

* Patch contracts wrappers imports

* Add eslint-disable to new-imports.ts

* Update DPostModel import in test-fixtures.ts

* Rename account to blog

* Update function name to get_blog_info()

* Refactor blog initialization to use blog metadata

* Add static covers images

* Add manifest file and update favicon.ico

* Fix sending amount calculation in contracts

* Fix initialization and editing of blog and post
metadata

* Include additional fees for actions

* Add StorageController trait to contracts

* Update version to v1
@anton-trunov anton-trunov linked a pull request Feb 9, 2024 that will close this issue
@anton-trunov anton-trunov self-assigned this Feb 9, 2024
@anton-trunov anton-trunov added the bug Something isn't working label Feb 9, 2024
@anton-trunov anton-trunov added this to the v1.2.0 milestone Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants