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

feat(jellyfish-api-core): add getBlockTemplate RPC #1993

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

Conversation

DocteurPing
Copy link

What this PR does / why we need it:

Adds getBlockTemplate RPC, tests and documentation.

Which issue(s) does this PR fixes?:

Fixes part of #48

Additional comments?:

@codeclimate
Copy link

codeclimate bot commented Jan 20, 2023

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

View more on Code Climate.

@netlify
Copy link

netlify bot commented Jan 20, 2023

Deploy Preview for jellyfishsdk ready!

Name Link
🔨 Latest commit d63ece2
🔍 Latest deploy log https://app.netlify.com/sites/jellyfishsdk/deploys/63d9f611c5cb6a0008c4cc25
😎 Deploy Preview https://deploy-preview-1993--jellyfishsdk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Base: 59.81% // Head: 85.53% // Increases project coverage by +25.72% 🎉

Coverage data is based on head (d63ece2) compared to base (e07aad2).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1993       +/-   ##
===========================================
+ Coverage   59.81%   85.53%   +25.72%     
===========================================
  Files         290      358       +68     
  Lines        9331    10795     +1464     
  Branches     1251     1410      +159     
===========================================
+ Hits         5581     9234     +3653     
+ Misses       3528     1483     -2045     
+ Partials      222       78      -144     
Impacted Files Coverage Δ
packages/jellyfish-api-core/src/category/mining.ts 86.66% <100.00%> (+2.05%) ⬆️
...atus-api/src/controllers/OracleStatusController.ts 19.56% <0.00%> (-78.27%) ⬇️
...nsaction-builder/src/txn/txn_builder_masternode.ts 13.33% <0.00%> (-66.67%) ⬇️
packages/whale-api-client/src/api/consortium.ts 33.33% <0.00%> (-16.67%) ⬇️
...t-core/src/saga/AddressParser/UtxoAddressParser.ts 91.66% <0.00%> (-8.34%) ⬇️
apps/whale-api/src/module.api/rawtx.controller.ts 71.64% <0.00%> (-2.99%) ⬇️
packages/whale-api-client/src/index.ts 100.00% <0.00%> (ø)
packages/jellyfish-address/src/script/P2SH.ts 45.45% <0.00%> (ø)
...s/whale-api/src/module.model/script.aggregation.ts 78.94% <0.00%> (ø)
... and 254 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Jan 20, 2023

Docker build preview for jellyfish/apps is ready!

Built with commit 083d745

  • ghcr.io/jellyfishsdk/legacy-api:pr-1993
  • ghcr.io/jellyfishsdk/playground-api:pr-1993
  • ghcr.io/jellyfishsdk/status-api:pr-1993
  • ghcr.io/jellyfishsdk/whale-api:pr-1993

You can also get an immutable image with the commit hash

  • ghcr.io/jellyfishsdk/legacy-api:083d7457fe3ab34542acdfb5d61a028ea95b0187
  • ghcr.io/jellyfishsdk/playground-api:083d7457fe3ab34542acdfb5d61a028ea95b0187
  • ghcr.io/jellyfishsdk/status-api:083d7457fe3ab34542acdfb5d61a028ea95b0187
  • ghcr.io/jellyfishsdk/whale-api:083d7457fe3ab34542acdfb5d61a028ea95b0187

packages/jellyfish-api-core/src/category/mining.ts Outdated Show resolved Hide resolved
docs/node/CATEGORIES/02-mining.md Outdated Show resolved Hide resolved
packages/jellyfish-api-core/src/category/mining.ts Outdated Show resolved Hide resolved
Comment on lines 57 to 63
* @param {TemplateRquest} templateRequest A json object in the following spec
* @param {string} mode This must be set to 'template', 'proposal' (see BIP 23), or omitted
* @param {string[]} capabilities client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'
* @param {string[]} rules A list of strings
* @returns {Promise<void>}
*/
async getBlockTemplate (templateRequest: TemplateRquest): Promise<JSON> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Promise<JSON>? It should be typed.


```ts title="client.mining.getBlockTemplate()"
interface mining {
getBlockTemplate (templateRequest: TemplateRequest): Promise<JSON>
Copy link
Contributor

Choose a reason for hiding this comment

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

BlockTemplate

and docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants