Insert a new wallet record, leaving any existing row for the same id untouched.
Data for the new wallet.
True when a row was inserted, false when the id already existed.
Retrieve a wallet by its ID.
Identifier of the wallet to fetch.
The wallet record, or undefined when absent.
List all wallet records.
An array of wallet records.
Delete a wallet by ID, cascading to its dependent rows.
Identifier of the wallet to delete.
Normalized count of deleted wallet rows (0 or 1).
Insert a note, normalizing its token and ignoring conflicts on an existing note identity.
Note data to insert.
Batch-insert notes, normalizing tokens and enriching existing rows with
previously-null optional fields on conflict. An empty batch is a no-op and
returns 0.
Array of notes to insert.
Normalized count of affected rows.
Retrieve all unspent notes for a wallet/chain pair.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Unspent notes for the wallet on the chain.
Retrieve unspent notes filtered by normalized token for a wallet/chain pair.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Token identifier to filter by, in any case.
Unspent notes for the wallet/chain/token.
Fetch a note by its wallet/chain/commitment identity.
Wallet, chain, and commitment to search for.
The note record, or undefined.
Fetch a note by its chain/nullifier/tree identity.
Chain, nullifier, and tree number to search for.
The note record, or undefined.
Mark a note as spent and record its spending transaction provenance.
Wallet, chain, and commitment of the note to update.
Transaction ID that spent the note.
Block containing the spending transaction.
Timestamp of the spending block, or null when the
data source does not carry one for this transaction.
Normalized count of updated rows.
Mark multiple notes as spent atomically. An empty list is a no-op and
returns 0.
Note identities to update.
Transaction ID that spent the notes.
Block containing the spending transaction.
Timestamp of the spending block, or null when the
data source does not carry one for this transaction.
Normalized count of updated rows.
Return all notes belonging to a wallet on a given chain.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Note records for the wallet on the chain.
Return received notes whose PPOI status needs refreshing: notes with no
persisted status, or with at least one required list whose status is not
Valid.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
PPOI list keys that must all be Valid.
Notes with no PPOI status or a non-Valid required-list status.
Atomically merge a note's PPOI tags and persist its blinded commitment.
Wallet, chain, and commitment of the note to update.
Derived PPOI lookup key.
Tags to merge. Omitted keys stay unchanged. A per-key
null removes that tag; whole-map null clears all tags to pending.
Normalized count of updated rows.
Persist PPOI status updates for multiple notes atomically. An empty list is
a no-op and returns 0.
Note PPOI updates.
Normalized count of updated rows.
Batch-insert sender-side commitments, normalizing tokens and ignoring an
existing row for the same identity. An empty batch is a no-op and returns
0.
Sent commitments to insert.
Normalized count of inserted rows.
Return every sender-side commitment a wallet created on a chain. These are the outputs the wallet itself produced, including the ones another wallet owns, so a caller can report what a transaction sent.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Sent commitment rows for the wallet on the chain.
Read persisted per-list PPOI results for sent outputs and unshields.
Wallet whose output results to read.
Chain and RAILGUN version to read.
Stored results; an absent output or list has no known status.
Atomically insert or replace per-list output PPOI results. Omitted lists stay unchanged. Storage does not classify statuses or validate node responses.
Results scoped to wallet, deployment, output type, key, and list.
Number of written rows, or zero for an empty batch.
Retrieve the scan state for a wallet on a particular chain.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
The scan state, or undefined when absent.
Insert or update the scan state for a wallet/chain pair.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Latest block height scanned.
Remove what every wallet of a deployment learned above a block, in one
transaction. Deletes notes and sent commitments above toHeight, clears
the spend fields of notes spent above it, and lowers every scan cursor
above it to toHeight. Creates no scan state row. PPOI statuses,
transaction history and ephemeral indexes stay unchanged. Stop decryption
for the deployment first: updateScanState writes a cursor as given.
Deployment (chain and RAILGUN version) to roll back.
Highest block to keep.
Allocate the next ephemeral index for a wallet/chain pair and advance the stored counter by one, atomically. Concurrent callers on the same database can never receive the same index.
Identifier of the wallet.
Chain identifier.
The allocated index, or undefined when the counter is
exhausted: the stored next index has reached 2147483647, is left
unchanged, and the largest index ever returned is 2147483646.
Read the next ephemeral index available to allocate for a wallet/chain pair, writing nothing.
Identifier of the wallet.
Chain identifier.
The stored next available index, or 0 when no counter row exists.
Raise the stored next ephemeral index for a wallet/chain pair to the given value. The counter never moves down.
Identifier of the wallet.
Chain identifier.
New next available index. Must be an integer in
[0, 2147483647].
Add a transaction history entry, ignoring duplicates.
Transaction history record to insert.
Batch-insert transaction history entries, ignoring duplicates. An empty
batch is a no-op and returns 0.
Transaction history records.
Normalized count of inserted rows.
Retrieve recent transaction history for a wallet on a chain, ordered descending by block number.
Identifier of the wallet.
Deployment (chain and RAILGUN version).
Optionallimit: number
Maximum number of rows to return. Omit for all of them.
Transaction history rows ordered by block descending.
Fetch a transaction history entry by its ID.
Transaction ID to look up.
The history record, or undefined.
Compute aggregate statistics for a wallet.
Identifier of the wallet.
Total notes, unspent note count, and transaction count.
Wallet-specific storage operations.