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

fix utxoDiffSincePoint #392

Merged
merged 9 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
// byron addresses, bech32 address, bech32 stake addresses or addr_vkh
addresses: Array<string>,
untilBlockHash: string, // only transactions up to this block (including it) will be considered for generating the diff
afterPoint?: {
// when starting to call this endpoint, the client should set the `blockHash` field. Then the client should pass the returned `lastDiffPointSelected` as `afterPoint` for the next page.
afterPoint: {
blockHash: string, // only transactions AFTER this clock will be considered for generating the diff
itemIndex?: number // if `itemIndex` is supplied, we will also consider transactions from `blockHash`, but only the outputs which have a bigger index than `itemIndex`
...
},
afterBestBlocks?: Array<string> // only transactions after the latest block from this array will be included. The inclusion of `afterBestBlocks` in the request will also add 2 new fields to the response (see the response bellow for more details)
diffLimit: number // number of diff items to return
}
```

Expand All @@ -160,6 +162,8 @@ We recommend querying using payment key hashes (`addr_vkh`) when possible (other
assets?: Asset[], // only included for outputs
block_num?: number // only included for outputs
}>,
// An opaque object to mark the end of the returned page (whose size is limited by `diffLimit` of the input). The client should pass this object as the `afterPoint` input for the next page.
lastDiffPointSelected: Object,
lastFoundBestBlock?: string, // only included if `afterBestBlocks` was supplied. This will be the latest found block from `afterBestBlocks`
lastFoundSafeBlock?: string // only included if `afterBestBlocks` was supplied. This will be the latest safe block from `afterBestBlocks`, safe block being the block with the highest depth up to a maximum, determined at runtime by configuration
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yoroi-cardano-backend",
"version": "3.0.2",
"version": "3.0.3",
"description": "Wrapped for cardano-db-sync and cardano-graphql with endpoints useful for light wallets",
"main": "src/index.ts",
"scripts": {
Expand Down
74 changes: 62 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,43 @@ const routes: Route[] = [
handler: handleGetRewardHistory(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{ path: "/v2.1/pool/info", method: "post", handler: handlePoolInfo(pool), interceptor: middleware.handleCamelCaseResponse },
{
path: "/v2.1/pool/info",
method: "post",
handler: handlePoolInfo(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/pool/delegationHistory",
method: "post",
handler: poolDelegationHistory(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{ path: "/v2.1/bestblock", method: "get", handler: bestBlock(pool), interceptor: middleware.handleCamelCaseResponse },
{ path: "/v2.1/tipStatus", method: "get", handler: handleTipStatusGet(pool), interceptor: middleware.handleCamelCaseResponse },
{ path: "/v2.1/tipStatus", method: "post", handler: handleTipStatusPost(pool), interceptor: middleware.handleCamelCaseResponse },
{ path: "/v2.1/txs/utxoAtPoint", method: "post", handler: utxoAtPoint(pool), interceptor: middleware.handleCamelCaseResponse },
{
{
path: "/v2.1/bestblock",
method: "get",
handler: bestBlock(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/tipStatus",
method: "get",
handler: handleTipStatusGet(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/tipStatus",
method: "post",
handler: handleTipStatusPost(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/txs/utxoAtPoint",
method: "post",
handler: utxoAtPoint(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/txs/utxoDiffSincePoint",
method: "post",
handler: handleUtxoDiffSincePoint(pool),
Expand Down Expand Up @@ -521,21 +546,41 @@ const routes: Route[] = [
handler: utxoSumForAddresses,
interceptor: middleware.handleCamelCaseResponse,
},
{ path: "/v2.1/txs/history", method: "post", handler: txHistory, interceptor: middleware.handleCamelCaseResponse },
{ path: "/v2.1/txs/io/:tx_hash", method: "get", handler: handleGetTxIO(pool), interceptor: middleware.handleCamelCaseResponse },
{
path: "/v2.1/txs/history",
method: "post",
handler: txHistory,
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/txs/io/:tx_hash",
method: "get",
handler: handleGetTxIO(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/txs/io/:tx_hash/o/:index",
method: "get",
handler: handleGetTxOutput(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{ path: "/v2.1/txs/get", method: "post", handler: handleGetTransactions(pool), interceptor: middleware.handleCamelCaseResponse },
{ path: "/v2.1/txs/signed", method: "post", handler: handleSignedTx, interceptor: middleware.handleCamelCaseResponse },
{
path: "/v2.1/txs/get",
method: "post",
handler: handleGetTransactions(pool),
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/txs/signed",
method: "post",
handler: handleSignedTx,
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/messages/getMessageBoard",
method: "post",
handler: handleMessageBoard(pool),
interceptor: middleware.handleCamelCaseResponse
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/messages/getMessageDirect",
Expand Down Expand Up @@ -613,7 +658,12 @@ const routes: Route[] = [
},
interceptor: middleware.handleCamelCaseResponse,
},
{ path: "/v2.1/status", method: "get", handler: getStatus, interceptor: middleware.handleCamelCaseResponse },
{
path: "/v2.1/status",
method: "get",
handler: getStatus,
interceptor: middleware.handleCamelCaseResponse,
},
{
path: "/v2.1/catalyst/fundInfo",
method: "get",
Expand Down
Loading