Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

feat(controller): anchors API service #719

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

siradji
Copy link
Contributor

@siradji siradji commented Jan 20, 2022

Signed-off-by: Suraj Auwal [email protected]

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

Expose anchors endpoint

Which issue(s) does this PR fixes?:

Fixes BirthdayResearch/jellyfishsdk#1488

Additional comments?:

Signed-off-by: Suraj Auwal <[email protected]>
@defichain-bot defichain-bot added the needs/kind Needs kind label label Jan 20, 2022
@defichain-bot
Copy link
Contributor

@siradji: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind fix
  • /kind chore
  • /kind docs
  • /kind refactor
  • /kind dependencies
Details

I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository.

@codeclimate
Copy link

codeclimate bot commented Jan 20, 2022

Code Climate has analyzed commit 0d81172 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #719 (1ad54db) into main (6434ccd) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #719      +/-   ##
==========================================
+ Coverage   92.31%   92.37%   +0.05%     
==========================================
  Files         121      123       +2     
  Lines        3163     3187      +24     
  Branches      384      386       +2     
==========================================
+ Hits         2920     2944      +24     
  Misses        234      234              
  Partials        9        9              
Impacted Files Coverage Δ
packages/whale-api-client/src/api/anchors.ts 100.00% <100.00%> (ø)
packages/whale-api-client/src/index.ts 100.00% <100.00%> (ø)
packages/whale-api-client/src/whale.api.client.ts 79.76% <100.00%> (+0.49%) ⬆️
src/module.api/_module.ts 100.00% <100.00%> (ø)
src/module.api/anchors.controller.ts 100.00% <100.00%> (ø)

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 6434ccd...1ad54db. Read the comment docs.

@siradji siradji added kind/feature New feature request and removed needs/kind Needs kind label labels Jan 21, 2022
@siradji
Copy link
Contributor Author

siradji commented Jan 21, 2022

Adding on top of what @canonbrother mentioned here , using startBtcHeight for pagination won't work. Got it to work using limit and maxBtcHeight

@siradji siradji marked this pull request as ready for review January 21, 2022 12:25
@siradji siradji self-assigned this Jan 21, 2022
@fuxingloh fuxingloh changed the title Anchors controller feat(controller): anchors API service Jan 23, 2022
@fuxingloh fuxingloh mentioned this pull request Jan 23, 2022
@fuxingloh fuxingloh added the priority/urgent-now Urgent fix, as fast as possible label Jan 24, 2022
ivan-zynesis
ivan-zynesis previously approved these changes Jan 24, 2022
Signed-off-by: Suraj Auwal <[email protected]>
await tGroup.get(0).container.call('spv_setlastheight', [1])
const anchor1 = await createAnchor()
await tGroup.get(0).generate(1)
await tGroup.waitForSync()
Copy link
Contributor

@canonbrother canonbrother Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor impr

  1. remove waitForSync() since the test only use 1 node
  2. test create 2 anchors within a block which just
await createAnchor()
await createAnchor()
await generate(1) // 2 anchors in 1 block

why do we need this because the current query would not handle this data..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@canonbrother i am a little bit confused here. Could you provide more clarification?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just updated the fixture which contain 2 anchors within a btc block
the query is needed to handle this scenario

@fuxingloh
Copy link
Contributor

@siradji please resolve the comments and fix the test

@fuxingloh fuxingloh marked this pull request as draft January 31, 2022 05:20
Signed-off-by: Suraj Auwal <[email protected]>
@canonbrother
Copy link
Contributor

canonbrother commented Jan 31, 2022

@siradji
we need solve the scenario on commit 0d81172

@siradji
Copy link
Contributor Author

siradji commented Jan 31, 2022

@siradji please resolve the comments and fix the test

@fuxingloh i will be fixing it today. Found out a new issue with the query.

@siradji
Copy link
Contributor Author

siradji commented Feb 4, 2022

Initially, i thought that using startBtcHeight will be ideal for pagination but due to how the anchors are listed (from top to genesis) that would be impossible. The only option left is to use maxBtcHeight which worked out fine till @canonbrother pointed out a scenario where there is more than one anchor in a block.

@fuxingloh fuxingloh removed the priority/urgent-now Urgent fix, as fast as possible label Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/anchors endpoint
6 participants