Closes the storage adapter and releases all resources. After closing, this instance cannot be used again. Create a new instance to reopen the database.
Promise that resolves when the storage is closed
Deletes unspent output data from storage.
The transaction hash of the outpoint
The index of the outpoint
Promise that resolves when the unspent output data is deleted
Sets the reservation status of an unspent output for a specific invitation.
The outpoints to reserve, containing an outpointTransactionHash and an outpointIndex
Whether the output should be reserved
The invitation identifier to associate with the reservation
Promise that resolves when the output reservation status is set
Retrieves an invitation from storage by its identifier.
Identifier for the invitation
Promise that resolves to the invitation data, or undefined if not found
Gets the last derivative index used for standard lockingBytecodes. Filters by templateIdentifier and outputIdentifier, and optionally by invitationIdentifier.
The template identifier to filter by
The output identifier to filter by
OptionalinvitationIdentifier: stringOptional invitation identifier to filter by (if provided, only looks at locking bytecodes for that invitation)
Promise that resolves to the last derivative index as a string, or null if none found
Retrieves script hash data from storage by its script hash.
The script hash to look up
Promise that resolves to the script hash data, or undefined if not found
Retrieves a template from storage by its identifier.
Identifier for the template
Promise that resolves to the template data, or undefined if not found
Retrieves unspent output data from storage.
The transaction hash of the outpoint
The index of the outpoint
Promise that resolves to the unspent output data, or undefined if not found
Initializes the storage adapter. Must be called before using any other methods.
Promise that resolves when initialization is complete
Lists event data matching the provided query.
Query to apply (e.g. eventType)
Promise that resolves to an array of events matching the query
Lists script hash data matching the provided query.
Query to apply (e.g. templateIdentifier, scriptHash, or invitationIdentifier)
Promise that resolves to an array of script hash data matching the query
Lists all templates stored in the storage.
Promise that resolves to an array of all templates
Lists unspent output data matching the provided query and optional filter.
Optionalquery: UnspentOutputDataQueryQuery to apply (e.g. templateIdentifier, reservedBy, lockingBytecode, or status)
Optionalfilter: UnspentOutputDataFilterOptional filter to apply (e.g. reserved)
Promise that resolves to an array of unspent output data matching the query and filter
Stores an event in storage.
Identifier for the event
Type of the event
Event data
Optionaltimestamp: numberOptional timestamp (defaults to current time)
Promise that resolves when the event is stored
Stores an invitation in storage.
Identifier for the invitation
The invitation data to store
Promise that resolves when the invitation is stored
Stores script hash data in storage.
The script hash data to store
Promise that resolves when the data is stored
Stores a template in storage.
The template data to store
Promise that resolves when the template is stored
Stores unspent output data in storage.
The unspent output data to store
Promise that resolves when the unspent output data is stored
Updates the status of existing unspent output data in storage.
The transaction hash of the outpoint
The index of the outpoint
The new status to set ('confirmed' or 'pending')
Promise that resolves when the status is updated
Abstract storage adapter interface.
This interface hides ALL implementation details of the underlying database. All storage implementations (IndexedDB, SQLite, PostgreSQL, etc.) must implement this interface. The implementation details are completely hidden from consumers.
Example