📡 Interacting with External Modules
If you need to interact with external modules (i.e., modules not deployed from your Scaffold Move repo), add their addresses to your Move.toml file.
Edit Move.toml
Add the addresses of the external modules to the [addresses] section of your packages/move/Move.toml file. After each yarn deploy, the deploy script fetches the modules published at every address in [addresses] that is not '_' (the address that is deployed to the network's account) and writes them to packages/nextjs/modules/externalModules.ts, next to the chain id of the network you deployed to. The module hooks and the Debug Modules page can then use them like your own modules.
The externalModules.ts file is autogenerated, so manual edits are overwritten on the next deployment. To skip loading external modules, set loadExternalModules to false in packages/move/move.config.ts.
[package]
name = 'onchain_bio'
version = '1.0.0'
[dependencies.AptosFramework]
git = "https://github.com/movement-network/aptos-core.git"
rev = "m1"
subdir = "aptos-move/framework/aptos-framework"
[addresses]
deployment_addr = '_'
OtherModule = '0x0a596e253fe1584d6c04bbc9c662faaa1e41a6141f2a458f52d5e5512e38fb9a'
This is an example of a Move.toml file that includes a reference to an external module. The deployment_addr address is for the modules deployed from this Scaffold Move repo, while OtherModule represents an external module. You can add multiple external module addresses here, ensuring each name is unique. The names you choose (like "OtherModule") are for your reference only; the actual module names are fetched from the blockchain when updating the externalModules.ts file.
The external address must have its modules published on the network you deploy to. The address is fetched from that network only, so the same address on another network is not loaded.