Skip to content

Commit

Permalink
Merge pull request #446 from zajko/sse_events_fix
Browse files Browse the repository at this point in the history
Sse events fix
  • Loading branch information
zajko authored Jun 25, 2024
2 parents 21deef7 + 8444bdd commit aca0511
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ This release candidate is compatible with [#node RC2](https://github.com/casper-
- UniqAddress
- DeployHeader
- Deploy
- variants `TransactionProcessed`, `TransactionExpired` and `TransactionAccepted` of enum `EventName` in `EventStream.ts`

### Changed

Expand All @@ -64,6 +65,7 @@ This release candidate is compatible with [#node RC2](https://github.com/casper-
- `BalanceServiceByJsonRPC` class
- `execution_results` field in `GetDeployResult` was removed. This affects `CasperServiceByJsonRPC.getDeployInfo` method return types.
- field `block` of `GetBlockResult`. This change affects `CasperServiceByJsonRPC.getBlockInfo` method return type
- variants `DeployProcessed` and `DeployAccepted` of enum `EventName` in `EventStream.ts`

## [2.15.5] - 2024-04-18

Expand Down
8 changes: 4 additions & 4 deletions resources/migration-guide_v2-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ This method is used to send a `Transaction` for execution. A `Transaction` is a

This service was removed from 3.0.0 release. It has only one method - `getAccountBalance`. Please use `CasperServiceByJsonRPC.getAccountBalance` instead.

## Speculative endpoints
## EventName

#TODO
Enum `EventName` lost two values: `DeployProcessed` and `DeployAccepted`. `TransactionAccepted`, `TransactionProcessed` and `TransactionExpired` were added. Deploys stopped being a first-entity in favor of Transactions, so they all Deploys will be, in the SSE streams, communicated as `Transaction*` events. Please bear in mind that the internal structure of the events did change significantly.

```
## Speculative endpoints

```
Speculative endpoints are currently not supported by the JS SDK
13 changes: 5 additions & 8 deletions src/services/EventStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class DeployWatcher {
}

start() {
this.es.subscribe(EventName.DeployProcessed, result => {
const deployHash = result.body.DeployProcessed.deploy_hash;
this.es.subscribe(EventName.TransactionProcessed, result => {
const deployHash = result.body.TransactionProcessed.deploy_hash;
const pendingDeploy = this.watchList.find(
d => d.deployHash === deployHash
);
Expand All @@ -55,14 +55,11 @@ export class DeployWatcher {
type EventHandlerFn = (result: any) => void;

export enum EventName {
/** Can be fetched in `/events/main` path */
BlockAdded = 'BlockAdded',
/** Can be fetched in `/events/main` path */
DeployProcessed = 'DeployProcessed',
/** Can be fetched in `/events/deploys` path */
DeployAccepted = 'DeployAccepted',
TransactionProcessed = 'TransactionProcessed',
TransactionAccepted = 'TransactionAccepted',
TransactionExpired = 'TransactionExpired',
BlockFinalized = 'BlockFinalized',
/** Can be fetched in `/events/sigs` path */
FinalitySignature = 'FinalitySignature',
Fault = 'Fault'
}
Expand Down

0 comments on commit aca0511

Please sign in to comment.