Skip to content

Transactions Query Language

adamant-al edited this page Sep 2, 2019 · 53 revisions

To expand opportunities of getting transactions use parametres to filter results, and options.

Available filters (may be specific to endpoint):

Filters available for endponts:

You can use limit, offset, orderBy and withoutDirectTransfers options: [#Available options].

Filters and options can be joined: [#Combine filters and options].

Available options

Options can be joined.

limit

Limits returned items count. Default is 100 for transactions and 25 for chatrooms.

Example: https://endless.adamant.im/api/transactions?limit=2

offset

Offset value for results, integer. Default is 0.

Example: https://endless.adamant.im/api/transactions?offset=100

orderBy

Ordering request results by fieldname.

Example: https://endless.adamant.im/api/transactions?orderBy=timestamp:desc

withoutDirectTransfers

When set to true, excludes type 0 transactions (direct token transfers) from results. Default is false.

NOTE: Available for /api/chatrooms endpont only.

Example: https://endless.adamant.im/api/chatrooms/U2707535059340134112?withoutDirectTransfers=true

Combine filters and options

You can filter by single parameter, or by multiple parameters. Default condition and or or differs for endpoint:

  • /api/transactions: default is or; to set and use and:
  • /api/chats/get: default is and
  • /api/chatrooms:
  • /api/states/get: default is and

Options always joined with and condition.

Examples:

https://endless.adamant.im/api/transactions?fromHeight=1336065&blockId=7917597195203393333

Get transactions where height greater than 1336065 or blockId = 7917597195203393333

https://endless.adamant.im/api/transactions?fromHeight=1336065&and:senderId=U15423595369615486571&limit=2&orderBy=timestamp:asc

Get transactions where height greater than 1336065 and senderId = U15423595369615486571, order by timestamp ascending and limit results by 2 transactions

Available filter parameters

blockId

Purpose: get all transactions in specific block

Type: String

Example: http://endless.adamant.im/api/transactions?blockId=7917597195203393333

fromHeight

Purpose: to show transactions starting from block with height

Type: Integer

Example: http://endless.adamant.im/api/transactions?fromHeight=10336065

toHeight

Purpose: to show transactions ending at block with height

Type: Integer

Example: http://endless.adamant.im/api/transactions?toHeight=11

minAmount

Purpose: to show transactions with amount not less than specified

Type: Integer value of 1/10^8 tokens (1 ADM = 100000000).

Example: http://endless.adamant.im/api/transactions?minAmount=1000000000000001

maxAmount

Purpose: to show transactions with amount not more than specified.

Type: Integer value of 1/10^8 tokens (1 ADM = 100000000).

Example: http://endless.adamant.im/api/transactions?maxAmount=50000000

senderId

Purpose: to show transactions sent from specified address

Type: String.

Example: http://endless.adamant.im/api/transactions?senderId=U15423595369615486571

recipientId

Purpose: to show transactions sent to specified address

Type: String.

Example: http://endless.adamant.im/api/transactions?recipientId=U15423595369615486571

inId

Purpose: to show transactions sent to or from specified address

Type: String.

Example: http://endless.adamant.im/api/transactions?inId=U100739400829575109

type

Purpose: to show transactions with specified type or

Type: Number.


NOTE If type is not set, query will choose all types of transactions. You can learn more about ADAMANT transaction types in API-10.


Example: http://endless.adamant.im/api/transactions?type=8


NOTE If type is not set, query will choose all types of messages. Learn more about ADAMANT messages types.


Example #1: http://endless.adamant.im/api/chats/get?type=2

Example #2: https://endless.adamant.im/api/chatrooms/U17362714543155685887/U17819800352812315500?type=2

Available parameters for States Filter

key

Purpose: to show transactions with specified key of KVS

Type: String

Example: http://endless.adamant.im/api/states/get?key=eth:address

type

Purpose: to show transactions with specified type of state (KVS)

Type: Integer

Example: http://endless.adamant.im/api/states/get?type=0

senderId

Purpose: to show transactions with asset = state sent from specified address

Type: String.

Example: http://endless.adamant.im/api/states/get?senderId=U5517006347330072401

Clone this wiki locally