Skip to content

Commit

Permalink
search and txs by identity fix
Browse files Browse the repository at this point in the history
  • Loading branch information
owl352 committed Nov 7, 2024
1 parent 4fd87d9 commit 3125028
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ GET /identities/GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec/transactions?page=1
timestamp: "2024-03-18T10:13:54.150Z",
gasUsed: 1337000,
status: "SUCCESS",
error: null
error: null,
owner: "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"
}, ...
]
}
Expand Down
5 changes: 3 additions & 2 deletions packages/api/src/dao/IdentitiesDAO.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,15 @@ module.exports = class IdentitiesDAO {
const subquery = this.knex('state_transitions')
.select('state_transitions.id as state_transition_id', 'state_transitions.hash as tx_hash',
'state_transitions.index as index', 'state_transitions.type as type', 'state_transitions.block_hash as block_hash',
'state_transitions.gas_used as gas_used', 'state_transitions.status as status', 'state_transitions.error as error'
'state_transitions.gas_used as gas_used', 'state_transitions.status as status', 'state_transitions.error as error',
'state_transitions.owner as owner'
)
.select(this.knex.raw(`rank() over (order by state_transitions.id ${order}) rank`))
.where('state_transitions.owner', '=', identifier)

const rows = await this.knex.with('with_alias', subquery)
.select('state_transition_id', 'tx_hash', 'index', 'block_hash', 'type', 'rank',
'gas_used', 'status', 'gas_used',
'gas_used', 'status', 'gas_used', 'owner',
'blocks.timestamp as timestamp', 'blocks.height as block_height')
.select(this.knex('with_alias').count('*').as('total_count'))
.leftJoin('blocks', 'blocks.hash', 'block_hash')
Expand Down
12 changes: 8 additions & 4 deletions packages/api/test/integration/identities.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,8 @@ describe('Identities routes', () => {
timestamp: _transaction.block.timestamp.toISOString(),
gasUsed: _transaction.transaction.gas_used,
status: _transaction.transaction.status,
error: _transaction.transaction.error
error: _transaction.transaction.error,
owner: _transaction.transaction.owner
}))

assert.deepEqual(body.resultSet, expectedTransactions)
Expand Down Expand Up @@ -929,7 +930,8 @@ describe('Identities routes', () => {
timestamp: _transaction.block.timestamp.toISOString(),
gasUsed: _transaction.transaction.gas_used,
status: _transaction.transaction.status,
error: _transaction.transaction.error
error: _transaction.transaction.error,
owner: _transaction.transaction.owner
}))

assert.deepEqual(body.resultSet, expectedTransactions)
Expand Down Expand Up @@ -972,7 +974,8 @@ describe('Identities routes', () => {
timestamp: _transaction.block.timestamp.toISOString(),
gasUsed: _transaction.transaction.gas_used,
status: _transaction.transaction.status,
error: _transaction.transaction.error
error: _transaction.transaction.error,
owner: _transaction.transaction.owner
}))

assert.deepEqual(body.resultSet, expectedTransactions)
Expand Down Expand Up @@ -1015,7 +1018,8 @@ describe('Identities routes', () => {
timestamp: _transaction.block.timestamp.toISOString(),
gasUsed: _transaction.transaction.gas_used,
status: _transaction.transaction.status,
error: _transaction.transaction.error
error: _transaction.transaction.error,
owner: _transaction.transaction.owner
}))

assert.deepEqual(body.resultSet, expectedTransactions)
Expand Down
3 changes: 2 additions & 1 deletion packages/api/test/integration/main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ describe('Other routes', () => {
timestamp: block.timestamp.toISOString(),
gasUsed: dataContractTransaction.gas_used,
status: dataContractTransaction.status,
error: dataContractTransaction.error
error: dataContractTransaction.error,
owner: dataContractTransaction.owner
}

assert.deepEqual({ transaction: expectedTransaction }, body)
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/app/api/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ GET /identities/GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec/transactions?page=1
timestamp: "2024-03-18T10:13:54.150Z",
gasUsed: 1337000,
status: "SUCCESS",
error: null
error: null,
owner: "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec"
}, ...
]
}
Expand Down

0 comments on commit 3125028

Please sign in to comment.