UNPKG

@ocap/statedb-qldb

Version:

OCAP statedb adapter that uses amazon qldb as backend statedb

25 lines (19 loc) 527 B
const QLDBTable = require('./base'); class RollupTable extends QLDBTable { constructor(...args) { super(...args); this.indexes.push('tokenAddress'); } async existByToken(token, { txn }) { if (!token) { return false; } const result = await txn.execute( `SELECT address FROM ${this.name} WHERE "tokenAddress" = ? AND paused = false`, token ); const item = result.getResultList(); return JSON.parse(JSON.stringify(item)).length > 0; } } module.exports = RollupTable;