Skip to content

Commit 03b9416

Browse files
committed
fix: Add all stardust Output types and Output details
1 parent b35d088 commit 03b9416

21 files changed

+639
-189
lines changed

src/app/components/plugins/Participation.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ class Participation extends AsyncComponent<unknown, ParticipationState> {
425425
undefined,
426426
Participation.buildAuthHeaders());
427427

428-
if (response.data && response.data.eventIds) {
428+
if (response?.data?.eventIds) {
429429
this.setState({
430430
eventIds: response.data.eventIds
431431
});
@@ -531,7 +531,6 @@ class Participation extends AsyncComponent<unknown, ParticipationState> {
531531
dialogStatus: `Failed to add event: ${error.message}`
532532
});
533533
}
534-
535534
}
536535
}
537536
}
@@ -584,7 +583,6 @@ class Participation extends AsyncComponent<unknown, ParticipationState> {
584583
dialogStatus: `Failed to add event: ${error.message}`
585584
});
586585
}
587-
588586
}
589587
});
590588
}

src/app/components/plugins/Spammer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class Spammer extends AsyncComponent<unknown, SpammerState> {
7070
description: string;
7171
settings: ReactNode;
7272
} | undefined {
73-
7473
if (Spammer._isAvailable) {
7574
return {
7675
title: Spammer.PLUGIN_TITLE,
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { ALIAS_ADDRESS_TYPE, ED25519_ADDRESS_TYPE, NFT_ADDRESS_TYPE } from "@iota/iota.js";
2+
import React, { Component, ReactNode } from "react";
3+
import { AddressProps } from "./AddressProps";
4+
5+
/**
6+
* Component which will display an address.
7+
*/
8+
class Address extends Component<AddressProps> {
9+
10+
/**
11+
* Render the component.
12+
* @returns The node to render.
13+
*/
14+
public render(): ReactNode {
15+
return (
16+
<div className="address-type">
17+
{this.props.address.type === ED25519_ADDRESS_TYPE && (
18+
<React.Fragment>
19+
<div className="card--label">
20+
Public key hash:
21+
</div>
22+
<div className="card--value row">
23+
{this.props.address.pubKeyHash}
24+
</div>
25+
</React.Fragment>
26+
)}
27+
{this.props.address.type === ALIAS_ADDRESS_TYPE && (
28+
<React.Fragment>
29+
<div className="card--label">
30+
Alias Id:
31+
</div>
32+
<div className="card--value row">
33+
{this.props.address.aliasId}
34+
</div>
35+
</React.Fragment>
36+
)}
37+
{this.props.address.type === NFT_ADDRESS_TYPE && (
38+
<React.Fragment>
39+
<div className="card--label">
40+
Nft Id:
41+
</div>
42+
<div className="card--value row">
43+
{this.props.address.nftId}
44+
</div>
45+
</React.Fragment>
46+
)}
47+
</div>
48+
);
49+
}
50+
}
51+
52+
export default Address;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { AddressTypes } from "@iota/iota.js";
2+
3+
export interface AddressProps {
4+
/**
5+
* The address.
6+
*/
7+
address: AddressTypes;
8+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { ISSUER_FEATURE_BLOCK_TYPE, METADATA_FEATURE_BLOCK_TYPE, SENDER_FEATURE_BLOCK_TYPE, serializeMessage, TAG_FEATURE_BLOCK_TYPE } from "@iota/iota.js";
2+
import { Converter } from "@iota/util.js";
3+
import React, { Component, ReactNode } from "react";
4+
import { NameHelper } from "../../../utils/nameHelper";
5+
import Address from "./Address";
6+
import { FeatureBlockProps } from "./FeatureBlockProps";
7+
8+
/**
9+
* Component which will display an Feature Block.
10+
*/
11+
class FeatureBlock extends Component<FeatureBlockProps> {
12+
/**
13+
* Create a new instance of Feature Block.
14+
* @param props The props.
15+
*/
16+
constructor(props: FeatureBlockProps) {
17+
super(props);
18+
}
19+
20+
/**
21+
* Render the component.
22+
* @returns The node to render.
23+
*/
24+
public render(): ReactNode {
25+
return (
26+
<div className="feature-block">
27+
<h3>{NameHelper.getFeatureBlockTypeName(this.props.featureBlock.type)}</h3>
28+
29+
{this.props.featureBlock.type === SENDER_FEATURE_BLOCK_TYPE && (
30+
<React.Fragment>
31+
<div className="card--label">
32+
Address
33+
</div>
34+
<Address
35+
address={this.props.featureBlock.address}
36+
/>
37+
</React.Fragment>
38+
)}
39+
{this.props.featureBlock.type === ISSUER_FEATURE_BLOCK_TYPE && (
40+
<React.Fragment>
41+
<div className="card--label">
42+
Address
43+
</div>
44+
<Address
45+
address={this.props.featureBlock.address}
46+
/>
47+
</React.Fragment>
48+
)}
49+
{this.props.featureBlock.type === METADATA_FEATURE_BLOCK_TYPE && (
50+
<React.Fragment>
51+
<div className="card--label">
52+
Data:
53+
</div>
54+
<div className="card--value row">
55+
{this.props.featureBlock.data}
56+
</div>
57+
</React.Fragment>
58+
)}
59+
{this.props.featureBlock.type === TAG_FEATURE_BLOCK_TYPE && (
60+
<React.Fragment>
61+
<div className="card--label">
62+
Tag:
63+
</div>
64+
<div className="card--value row">
65+
{this.props.featureBlock.tag}
66+
</div>
67+
</React.Fragment>
68+
)}
69+
</div>
70+
);
71+
}
72+
}
73+
74+
export default FeatureBlock;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { FeatureBlockTypes } from "@iota/iota.js";
2+
3+
export interface FeatureBlockProps {
4+
/**
5+
* The feature block.
6+
*/
7+
featureBlock: FeatureBlockTypes;
8+
}

src/app/components/tangle/IndexationPayload.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class IndexationPayload extends Component<TaggedDataPayloadProps, TaggedDataPayl
1717
constructor(props: TaggedDataPayloadProps) {
1818
super(props);
1919

20-
const utf8Index = props.payload.tag ? Converter.hexToUtf8(props.payload.tag) : "";
20+
const utf8Index = props.payload.tag ? Converter.hexToUtf8(props.payload.tag) : "";
2121
const matchHexIndex = props.payload.tag ? props.payload.tag.match(/.{1,2}/g) : "";
22-
const hexIndex = matchHexIndex ? matchHexIndex.join(" ") : props.payload.tag ? props.payload.tag : "" ;
22+
const hexIndex = matchHexIndex ? matchHexIndex.join(" ") : (props.payload.tag ? props.payload.tag : "");
2323

2424
let hexData;
2525
let utf8Data;

0 commit comments

Comments
 (0)