Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core-api): search transactions by asset #2618

Merged
merged 1 commit into from May 25, 2019
Merged

feat(core-api): search transactions by asset #2618

merged 1 commit into from May 25, 2019

Conversation

spkjp
Copy link
Contributor

@spkjp spkjp commented May 25, 2019

Summary

The /transactions/search endpoint now accepts an asset object.

Internally it uses the @> (contains) operator for comparing the payload against the jsonb column.
For example this payload:

{"asset": {} }

returns all transactions with an asset.

Whereas this one:

{"asset": {"delegate": {} } }

only returns type 2 transactions.

And lastly this

{"asset": {"delegate": { "username": "boldninja" } } }

returns one matching transaction.

Note: Due to how @> works it is not possible to e.g. search for all assets with a username starting with "b" or with a number greater or equal something. Another limiting factor is our used sql query builder which makes it difficult to impossible to express more sophisticated statements.

What kind of change does this PR introduce?

  • Bugfix
  • New feature
  • Refactoring / Performance Improvements
  • Build-related changes
  • Documentation
  • Tests / Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
    • All tests are passing
    • All benchmarks are passing without any major regressions
    • Sync from 0 works on mainnet
    • Sync from 0 works on devnet
    • Starting a new network and forging on it work
    • Explorer is fully functional
    • Wallets are fully functional
  • No

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@codecov-io
Copy link

codecov-io commented May 25, 2019

Codecov Report

Merging #2618 into 2.5 will increase coverage by 0.17%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##              2.5    #2618      +/-   ##
==========================================
+ Coverage   64.53%   64.71%   +0.17%     
==========================================
  Files         383      367      -16     
  Lines        8347     8218     -129     
  Branches      417      378      -39     
==========================================
- Hits         5387     5318      -69     
+ Misses       2916     2862      -54     
+ Partials       44       38       -6
Impacted Files Coverage Δ
...kages/core-api/src/handlers/transactions/schema.ts 100% <ø> (ø) ⬆️
...s/core-database-postgres/src/models/transaction.ts 100% <ø> (ø) ⬆️
...c/repositories/utils/search-parameter-converter.ts 93.61% <0%> (-4.17%) ⬇️
packages/core-api/src/handlers/utils.ts 77.27% <0%> (ø) ⬆️
packages/core-logger-winston/src/formatter.ts 41.66% <0%> (ø) ⬆️
...es/core-blockchain/src/replay/replay-blockchain.ts 0% <0%> (ø) ⬆️
...s/core-interfaces/src/core-database/event-types.ts
packages/core-transaction-pool/src/plugin.ts
packages/core-blockchain/src/plugin.ts
packages/core-wallet-api/src/plugin.ts
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b94e419...b19100e. Read the comment docs.

@faustbrian faustbrian merged commit 6f810ca into ArkEcosystem:2.5 May 25, 2019
@spkjp spkjp mentioned this pull request Jul 9, 2019
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants