getModules
Lists module deploys indexed by the connected Bitcoin Computer Node.
Type
type ModuleRecord = {
mod: string
ept: string
storageType: 'multisig' | 'taproot'
blockHash?: string | null
blockHeight?: number | null
timestamp?: string | number
}
type ModuleQuery = {
verbosity?: number
limit?: number
offset?: number
order?: 'ASC' | 'DESC'
storageType?: 'multisig' | 'taproot'
isConfirmed?: boolean
}
async getModules(q?: ModuleQuery & { verbosity?: 0 }): Promise<string[]>
async getModules(q: ModuleQuery & { verbosity: 1 }): Promise<ModuleRecord[]>
async getModules(q?: ModuleQuery): Promise<string[] | ModuleRecord[]>
Parameters
query (optional)
Return Value
- verbosity 0 —
string[]of module specifiers (<txId>:0) - verbosity 1 —
ModuleRecord[]with source text and confirmation fields
Description
Calls the node’s GET /modules endpoint. The node indexes module deploys (multisig cleartext { ept } or taproot BC witness) into its Module table when they appear in the mempool or a block.
This method does not evaluate modules. Use load to import exports in a SES compartment. Use getModule for a single known specifier.
After deploy, allow a short delay (or poll) until the indexer has the row. Confirmation fields are set when the deploy is in a block; they are cleared on reorg.
Example
const mod = await computer.deploy(`export const x = 1`)
// Specifiers only
const mods = await computer.getModules({ limit: 50 })
expect(mods.includes(mod)).to.equal(true)
// Full rows, filter by storage type
const rows = await computer.getModules({
verbosity: 1,
storageType: 'taproot',
isConfirmed: true,
limit: 20,
})
for (const row of rows) {
console.log(row.mod, row.ept.slice(0, 40))
}
See also
- getModule — one module by specifier
- deploy / load
- Node modules API
- Empty index / schema / auth: Operate & Troubleshoot