-
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.
Merge branch 'feat/nova-visualizer/randomize-amplitude' into feat/nov…
…a-visualizer/add-emitter-tilting
- Loading branch information
Showing
14 changed files
with
299 additions
and
7 deletions.
There are no files selected for viewing
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,11 @@ | ||
export interface ICongestionRequest { | ||
/** | ||
* The network to search on. | ||
*/ | ||
network: string; | ||
|
||
/** | ||
* The account id to get the congestion for. | ||
*/ | ||
accountId: string; | ||
} |
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,11 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
import { CongestionResponse } from "@iota/sdk-nova"; | ||
import { IResponse } from "./IResponse"; | ||
|
||
export interface ICongestionResponse extends IResponse { | ||
/** | ||
* The Account Congestion. | ||
*/ | ||
congestion?: CongestionResponse; | ||
} |
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,30 @@ | ||
import { ServiceFactory } from "../../../../factories/serviceFactory"; | ||
import { ICongestionRequest } from "../../../../models/api/nova/ICongestionRequest"; | ||
import { ICongestionResponse } from "../../../../models/api/nova/ICongestionResponse"; | ||
import { IConfiguration } from "../../../../models/configuration/IConfiguration"; | ||
import { NOVA } from "../../../../models/db/protocolVersion"; | ||
import { NetworkService } from "../../../../services/networkService"; | ||
import { NovaApiService } from "../../../../services/nova/novaApiService"; | ||
import { ValidationHelper } from "../../../../utils/validationHelper"; | ||
|
||
/** | ||
* Get Congestion for Account address | ||
* @param config The configuration. | ||
* @param request The request. | ||
* @returns The response. | ||
*/ | ||
export async function get(config: IConfiguration, request: ICongestionRequest): Promise<ICongestionResponse> { | ||
const networkService = ServiceFactory.get<NetworkService>("network"); | ||
const networks = networkService.networkNames(); | ||
ValidationHelper.oneOf(request.network, networks, "network"); | ||
ValidationHelper.string(request.accountId, "accountId"); | ||
|
||
const networkConfig = networkService.get(request.network); | ||
|
||
if (networkConfig.protocolVersion !== NOVA) { | ||
return {}; | ||
} | ||
|
||
const novaApiService = ServiceFactory.get<NovaApiService>(`api-service-${networkConfig.network}`); | ||
return novaApiService.getAccountCongestion(request.accountId); | ||
} |
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
14 changes: 14 additions & 0 deletions
14
client/src/app/components/nova/address/section/account/AccountBlockIssuanceSection.scss
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,14 @@ | ||
@import "../../../../../../scss/mixins.scss"; | ||
|
||
.block-issuance--card { | ||
border: none !important; | ||
margin-bottom: 48px; | ||
|
||
.field { | ||
margin-bottom: 8px; | ||
|
||
.card--label { | ||
@include font-size(14px, 21px); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
client/src/app/components/nova/address/section/account/AccountBlockIssuanceSection.tsx
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,46 @@ | ||
import React from "react"; | ||
import { BlockIssuerFeature, CongestionResponse, Ed25519PublicKeyHashBlockIssuerKey } from "@iota/sdk-wasm-nova/web"; | ||
import TruncatedId from "~/app/components/stardust/TruncatedId"; | ||
import "./AccountBlockIssuanceSection.scss"; | ||
|
||
interface AccountBlockIssuanceSectionProps { | ||
readonly blockIssuerFeature: BlockIssuerFeature | null; | ||
readonly congestion: CongestionResponse | null; | ||
} | ||
|
||
const AccountBlockIssuanceSection: React.FC<AccountBlockIssuanceSectionProps> = ({ blockIssuerFeature, congestion }) => { | ||
return ( | ||
<div className="section transaction--section"> | ||
<div className="card block-issuance--card"> | ||
<div className="field"> | ||
<div className="card--label margin-b-t">Current Slot</div> | ||
<div className="card--value">{congestion?.slot}</div> | ||
</div> | ||
<div className="field"> | ||
<div className="card--label margin-b-t">Block Issuance Credit</div> | ||
<div className="card--value">{congestion?.blockIssuanceCredits.toString()}</div> | ||
</div> | ||
<div className="field"> | ||
<div className="card--label margin-b-t">Referenced Mana Cost</div> | ||
<div className="card--value">{congestion?.referenceManaCost.toString()}</div> | ||
</div> | ||
<div className="field"> | ||
<div className="card--label margin-b-t">Expiry Slot</div> | ||
<div className="card--value">{blockIssuerFeature?.expirySlot}</div> | ||
</div> | ||
<div className="field"> | ||
{blockIssuerFeature?.blockIssuerKeys.map((key) => ( | ||
<React.Fragment key={(key as Ed25519PublicKeyHashBlockIssuerKey).pubKeyHash}> | ||
<span className="card--label margin-b-t">Public Key:</span> | ||
<div className="card--value public-key"> | ||
<TruncatedId id={(key as Ed25519PublicKeyHashBlockIssuerKey).pubKeyHash} showCopyButton /> | ||
</div> | ||
</React.Fragment> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AccountBlockIssuanceSection; |
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,11 @@ | ||
{ | ||
"title": "Block Issuance Credit", | ||
"description": "<p>(BIC) is the form of Mana used as an anti-spam mechanism to the block issuance process.</p>", | ||
"links": [ | ||
{ | ||
"label": "Read more", | ||
"href": "https://wiki.iota.org/learn/protocols/iota2.0/core-concepts/mana/#block-issuance-credits-bic", | ||
"isExternal": true | ||
} | ||
] | ||
} |
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.