Skip to content

Commit

Permalink
Merge pull request #156 from Concordium/add-missing-docs
Browse files Browse the repository at this point in the history
Add missing docs
  • Loading branch information
shjortConcordium authored Apr 11, 2023
2 parents 1030ceb + b0655f2 commit ed830cb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
File renamed without changes.
13 changes: 10 additions & 3 deletions docs/gRPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -867,19 +867,26 @@ If a blockhash is not supplied it will pick the latest finalized block. An optio
```js
const blockHash = "39122a9c720cae643b999d93dd7bf09bcf50e99bb716767dd35c39690390db54";
const pendingUpdates: AsyncIterable<PendingUpdate> = this.client.getBlockSpecialEvents(blockHash);
const pendingUpdates: AsyncIterable<PendingUpdate> = this.client.getBlockPendingUpdates(blockHash);

for await (const pendingUpdate of pendingUpdates) {
console.log(pendingUpdate);
}
```
## getBlockFinalizationSummary
Get the summary of the finalization data in a given block.
Get the summary of the finalization data in a given block. Only finalized blocks will return a finalization summary, if the summary is requested for a non-finalized block, this will return an object with only the tag field, with value "none".
If a blockhash is not supplied it will pick the latest finalized block.
```js
const blockHash = "fe88ff35454079c3df11d8ae13d5777babd61f28be58494efe51b6593e30716e";
const pendingUpdates: BlockFinalizationSummary = await this.client.getBlockSpecialEvents(blockHash);
const blockFinalizationSummary: BlockFinalizationSummary = await this.client.getBlockFinalizationSummary(blockHash);

if (blockFinalizationSummary.tag === "record") {
// Response contains finalization summary for the given block:
const { block, index, delay, finalizers} = blockFinalizationSummary.record;
} else {
// Given block has not been finalized.
}
```
25 changes: 23 additions & 2 deletions docs/grpc-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,31 @@ Blockhash inputs are now optional, and if given must be given as a hex encoded s

## GetBlockSummary

The `getBlockSummary` endpoint has been split up.
The `getBlockSummary` endpoint has been split up in the following endpoints:

To access the chain parameters, use the `getBlockChainParameters` endpoint, which corresponds to the `blockSummary.updates.chainParameters`,
- getBlockChainParameters
- getBlockSpecialEvents
- getBlockFinalizationSummary
- getBlockTransactionEvents
- getBlockPendingUpdates
- getNextUpdateSequenceNumbers

To access the chain parameters, use the `getBlockChainParameters` endpoint, which corresponds to the `blockSummary.updates.chainParameters` field,
except that the foundationAccountIndex field is no longer present, instead the foundationAccount field is present and contains the account address of the foundation account instead of the account index,
Note that this also contains the `blockSummary.updates.keys` field.

To access any pending updates at the time of the block, use the `getBlockPendingUpdates` endpoint, which corresponds to the `blockSummary.updates.updateQueues.*.queue` fields.
Note that this endpoint now returns a stream of the pending updates in block.

To access the next sequence number for any updates, use the `getNextUpdateSequenceNumbers` endpoint, which corresponds to `blockSummary.updates.updateQueues.*.nextSequenceNumber` fields.

To access the special events from the block, use the 'getBlockSpecialEvents', which corresponds to the `blockSummary.specialEvents` field.
Note that this endpoint now returns a stream of the special events in the block.

To access the finalization data, which was previously found in the `blockSummary.finalizationData` field, use the `getBlockFinalizationSummary` endpoints.
Note that the structure of the data has been changed, both how it is wrapped and the field names.

To access the events generated from the transactions in the block, use the `getBlockTransactionEvents` endpoint. This replaces the `blockSummary.transactionSummaries`, but note that structure is different.

## GetPoolStatus

Expand Down

0 comments on commit ed830cb

Please sign in to comment.