-
Notifications
You must be signed in to change notification settings - Fork 285
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
refactor(core-state): wallet repository search #3911
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ghost
added
Complexity: Undetermined
labels
Jul 23, 2020
Codecov Report
@@ Coverage Diff @@
## develop #3911 +/- ##
============================================
+ Coverage 13.69% 85.72% +72.02%
============================================
Files 628 628
Lines 14531 14693 +162
Branches 1728 1784 +56
============================================
+ Hits 1990 12595 +10605
+ Misses 12426 1896 -10530
- Partials 115 202 +87
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
ghost
mentioned this pull request
Jul 26, 2020
1 task
ghost
removed
the
Status: In Progress
label
Aug 5, 2020
ghost
mentioned this pull request
Aug 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Work in progress, fixes #3591. More changes and description to follow.
Wallet.getAttributes
method is replaced withWallet.attributes
property./wallets
endpoints for both raw and transformed API responses return only 5 properties (address
,publicKey
,balance
,nonce
,attributes
)TODO
mentioning that those should be removed in v3).It's now possible to extract any information from wallet repository through
/wallets/search
endpoint.Syntax for
/wallets/search
endpoint closely resembles one used in/transactions/search
with a small difference that it extends deeper than a single level. It's possible to filter down to a particular range of values in attribute, something that is not possible with transactionasset
due to postgres's@>
operator limitations.Additionally GET endpoints also allow building criteria object by using dot notation (e.g.
/wallets?attributes.delegate.resigned=false
). There is no request schema anymore, it requires knowing precise layout ofattributes
which isn't available.String properties
String property criteria may include
%
wildcard, similar to SQL'sLIKE
:Boolean properties
Boolean values are additionally compared to
"true"
and"false"
string literals, because criteria built from query string will contain string values only.Numeric properties
Similarly when comparing numeric value (
number
,BigInt
,Utils.BigNumber
) criteria may be an object with either or bothfrom
andto
properties and may also usestring
to specify number.Properties as
AND
expressionThis very natural syntax:
Wildcard property
To match any object property special wildcard
*
criteria property can be used:Arrays as
OR
expressionHere is an actual code that is used to find wallet by either
address
,publicKey
, orattributes.delegate.username
:Another example is from tests. Previously there was
addresses
criteria which is now replaced by sending array inaddress
criteria:Same syntax can be used for any attribute:
I expect this syntax to be good enough for most applications to the point that no-one should bother implementing their own endpoints.