Choosing the on-chain location of an external dependency

Right now to reference a package that has been published by someone else I am forking the repo for that package so that I can change the address in the Move.toml from 0x0 to the actual package object address. Is there an easier way to do this that doesn’t require forking the external repository?

We don’t currently have a way to override an address from another package, unless that package is explicitly given an ‘unassigned’ address, so that’s the first thing you could do (or request that the package owner does): Change the address they supply from 0x0 to "_", which means that you have to supply the address for that package from your package.

Long-term, we will be encouraging people to set the addresses that they have published their packages at in their repository so that you don’t have this issue, but short-term, with wipes being so common on devnet, this is not practical (the address is going to change week over week).

Short-term, I’m working on a feature that should let you publish a package along with all its unpublished (address set to 0x0) dependencies, so that you won’t have to fork external repositories and you also won’t have to go through a painful redeployment process on every wipe.

The downside is that there will be more duplicated packages uploaded, but in mainnet there will be a financial incentive to re-use packages rather than re-upload.

We also recognise that it’s important to be able to use a package but override its address so you can use a version published at another address, or re-publish it yourself – at the time of writing, this feature hasn’t been prioritised, but it’s on the radar.

14 Likes

Note that the short-term fix mentioned above has landed with Devnet 0.23.0 – you can now publish your package’s unpublished dependencies alongside it using the new --with-unpublished-dependencies flag, learn more about it in our docs.

1 Like