-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add infrastructure for nova mqtt feed (#920)
* feat: Add support for NovaFeed in subscribe/unsubscribe endpoint * feat: Add infrastructure for nova (nodeInfo, novaApiClient, novaFeedClient) * chore(local-nova-sdk): Add step in script to rename the nodejs&wasm bindings packages before install * feat: Fix instantiation of sdk Client from new version * feat: novaFeedClient works [WiP]. Visualizer 2.0 switched to nova networks. * feat: Move stardust NodeInfoService to stardust folder * feat: Add separate nodeInfoService for nova * fix: Fix imports and build * fix: Fix NetworkSwitcher enum
- Loading branch information
Showing
28 changed files
with
495 additions
and
65 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { INodeInfo } from "@iota/sdk-nova"; | ||
import { IResponse } from "../IResponse"; | ||
|
||
/** | ||
* The response with node info for a specific network. | ||
*/ | ||
export type INodeInfoResponse = INodeInfo & IResponse; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Block } from "@iota/sdk-nova"; | ||
|
||
type IFeedBlockUpdate = Block; | ||
|
||
export interface IFeedUpdate { | ||
subscriptionId: string; | ||
block?: IFeedBlockUpdate; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Client, INodeInfo } from "@iota/sdk-nova"; | ||
import { NodeInfoError } from "../../errors/nodeInfoError"; | ||
import { ServiceFactory } from "../../factories/serviceFactory"; | ||
import { INetwork } from "../../models/db/INetwork"; | ||
|
||
/** | ||
* Class to handle Nova protocol node info. | ||
*/ | ||
export class NodeInfoService { | ||
/** | ||
* The network configuration. | ||
*/ | ||
protected readonly _network: INetwork; | ||
|
||
/** | ||
* The node and token info. | ||
*/ | ||
protected _nodeInfo: INodeInfo; | ||
|
||
/** | ||
* Create a new instance of NodeInfoService. | ||
* @param network The network config. | ||
* @param nodeInfo The fetched node info | ||
*/ | ||
private constructor(network: INetwork, nodeInfo: INodeInfo) { | ||
this._network = network; | ||
this._nodeInfo = nodeInfo; | ||
} | ||
|
||
public static async build(network: INetwork): Promise<NodeInfoService> { | ||
const apiClient = ServiceFactory.get<Client>(`client-${network.network}`); | ||
|
||
try { | ||
const response = await apiClient.getInfo(); | ||
return new NodeInfoService(network, response.nodeInfo); | ||
} catch (err) { | ||
throw new NodeInfoError(`Failed to fetch node info for "${network.network}" with error:\n${err}`); | ||
} | ||
} | ||
|
||
public getNodeInfo(): INodeInfo { | ||
return this._nodeInfo; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.