-
Notifications
You must be signed in to change notification settings - Fork 3
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
Implement transactions by address endpoint #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import {getClient} from './elastic' | ||
import {getCheckpointBlocksHandler, getSnapshotHandler, getTransactionsBySnapshotHandler, getTransactionsHandler} from './service' | ||
import { | ||
getCheckpointBlocksHandler, | ||
getSnapshotHandler, | ||
getTransactionsByAddressHandler, | ||
getTransactionsByReceiverHandler, | ||
getTransactionsBySenderHandler, | ||
getTransactionsBySnapshotHandler, | ||
getTransactionsHandler | ||
} from './service' | ||
|
||
const client = getClient() | ||
|
||
export const snapshots = async event => getSnapshotHandler(event, client)() | ||
export const checkpointBlocks = async event => getCheckpointBlocksHandler(event, client)() | ||
export const transactions = async event => getTransactionsHandler(event, client)() | ||
export const transactionsBySnapshot = async event => getTransactionsBySnapshotHandler(event, client)() | ||
export const transactionsByAddress = async event => getTransactionsByAddressHandler(event, client)() | ||
export const transactionsBySender = async event => getTransactionsBySenderHandler(event, client)() | ||
export const transactionsByReceiver = async event => getTransactionsByReceiverHandler(event, client)() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ export enum SortOrder { | |
} | ||
|
||
export type Sort<T> = { | ||
field: keyof T | ||
field: keyof T | string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kpudlik I want to sort by ordinal which is nested There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typescript doesn't allow that :< You can technically use something like lenses/path from Ramda: https://ramdajs.com/docs/#path here you can read more: microsoft/TypeScript#12290 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general you could potentially make But it wont give you such string:
|
||
order: SortOrder | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to keep it type safe, you can combine
keyof
andPick
there:Pick<Transaction, 'sender' | 'receiver'>
gives you a type:and using
keyof
on this gives you'sender' | 'receiver'