getModule
Returns one module row indexed by the node, including the source text.
Type
type ModuleRecord = {
mod: string
ept: string
storageType: 'multisig' | 'taproot'
blockHash?: string | null
blockHeight?: number | null
timestamp?: string | number
}
async getModule(mod: string): Promise<ModuleRecord>
Parameters
mod
Module specifier of the form <transaction-id>:<output-number> (typically <txId>:0 from deploy).
Return Value
A ModuleRecord with the stored source (ept), storage type, and optional confirmation fields.
Throws if the specifier is invalid or the node has no row for that module (not found).
Description
Calls the node’s GET /module/:mod endpoint. This returns the indexed source string; it does not evaluate the module. Use load to obtain exports.
Prefer this when you already know the specifier and need the source or confirmation metadata without listing all modules. Use getModules to discover deploys.
Example
const mod = await computer.deploy(`export const n = 42`)
// after the node has indexed the deploy:
const row = await computer.getModule(mod)
expect(row.ept).to.equal(`export const n = 42`)
expect(row.storageType).to.be.oneOf(['multisig', 'taproot'])
const { n } = await computer.load(mod)
expect(n).to.equal(42)
See also
- getModules
- load
- Node module API
- Empty index / schema / auth: Operate & Troubleshoot