How to add dependency?

How does dependency work in Move?

  1. Is a dependency staticly linked or dynamicly linked?

  2. If it is staticly linked, why does it require the referenced package to contain published-at field?

  3. How can I specify different networks for published-at?

  4. Is there any decent document about package dependency? Or is there any working example?

Thanks.

1 Like

Linkage on Sui is a mix of static and dynamic linkage.

Every package chooses the linkage it uses when its functions are used as entrypoints (called directly from a PTB) statically – this cannot change once the package has been published.

But a package can also choose to override its dependencies’ dependencies (with some constraints, like it can only upgrade their versions, not downgrade them).

Docs: I think the best resource we have at the moment is - move-book [dot] com/reference/packages.html#movetoml