-
Discord user IDNo response Describe your question in detail.Been experimenting with this and seem to be hitting some walls with it. If a module depends on 2 packages (they both have same code), can the single package can't be reused? Having to do this:
b and c are the same code, just different at objects. My goal is to only have 1 package folder locally which I use to deploy to two distinct object addresses, and then link to and use in a third object address package. My approaches so far are as follows. On a local network spun up with:
I have a contract A which lives at object address 0xa which imports 2 contracts B and C, which live at object addresses 0xb, and 0xc respectively. There were all deployed by the same deployer account D. Contracts B and C are identical at the source code level. I have experimented with naming the top level package name of C though. So far I have been able to deploy contract B, then C, and then A successfully (in that order). But only if I locally duplicate the package folder for B and make a new C package, where I then change the package name just to make it different. I also then have to import 2 dependencies in package As
The project directory is:
The deploy for a works with the command:
This works, but requires a folder for B and C, even though they are basically the same thing. I instead want to only have 1 package folder locally B. And then deploy B twice to two different addresses. Then link them both to A at contract As compile time. I tried to first just see if I can get away with symlinking the source folder of B to C. But that runs into this kind of error when compiling contract A:
So when it tries to deploy A, it checks both source codes and finds an naming collision error unfortunately. I would hope there is an easy way to not let a naming collision be a blocker on two separate instances of the same contract. Next I tried to see if I can delete the duplicate package folder C entirely, and so now I have just folders A and B. And now the project directory is:
If I try this and then make contract As
But I get the following error (I think importing the same package seems to be disallowed):
If I instead try just:
I get errors of the form:
Implying it doesn't know about C anymore. Even though C is now published on chain and A was given Cs address as a named-address. It should be able to pull C from onchain and match just based on When I pull the contracts info with I have also tried experimenting with using Anyway help would be greatly appreciated! Thanks all. What error, if any, are you getting?No response What have you tried or looked at? Or how can we reproduce the error?No response Which operating system are you using?macOS Which SDK or tool are you using? (if any)Python SDK Describe your environment or tooling in detail
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @cawthorne, thanks for bringing this up! Currently our package system lacks these two critical features:
I know it's not ideal, but for now the best workaround is indeed to duplicate the source package. I'm currently working on a new package system and it is part of the plan to get these properly supported, so stay tuned. Also please let me know if you run into other package-related issues. I'd like to get those fixed as part of the revamp as well. |
Beta Was this translation helpful? Give feedback.
Hi @cawthorne, thanks for bringing this up!
Currently our package system lacks these two critical features:
C = { local = "../B" }
), you get an error complaining that the names mismatchC = { local = "../B", rename = "C" }
addr_subst
syntax, but I investigated it a few days ago, and can confirm it's broken.I know it's not ideal, but for now the best workaround is indeed to duplicate the source package.
I'm currently working on a new package system and it is part of the plan to get these properly supported, so stay tuned.
Also please let m…