Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
remove helper type per requested change on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeseese committed Feb 5, 2021
1 parent d77e8d0 commit 96a633a
Show file tree
Hide file tree
Showing 17 changed files with 126 additions and 112 deletions.
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/beacon-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ interface BeaconEntryConfig {
};
}

type C = BeaconEntryConfig;

class BeaconEntry
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<BeaconEntryConfig>
implements DeserializedObject<BeaconEntryConfig> {
get config(): Definitions<BeaconEntryConfig> {
return {
round: {
deserializedName: "round",
Expand All @@ -46,7 +44,9 @@ class BeaconEntry
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<BeaconEntryConfig>>
| Partial<DeserializedObject<BeaconEntryConfig>>
) {
super();

Expand All @@ -58,6 +58,6 @@ class BeaconEntry
data: Buffer;
}

type SerializedBeaconEntry = SerializedObject<C>;
type SerializedBeaconEntry = SerializedObject<BeaconEntryConfig>;

export { BeaconEntry, SerializedBeaconEntry };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/block-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ interface BlockHeaderConfig {
};
}

type C = BlockHeaderConfig;

class BlockHeader
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<BlockHeaderConfig>
implements DeserializedObject<BlockHeaderConfig> {
get config(): Definitions<BlockHeaderConfig> {
return {
miner: {
deserializedName: "miner",
Expand Down Expand Up @@ -199,7 +197,9 @@ class BlockHeader
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<BlockHeaderConfig>>
| Partial<DeserializedObject<BlockHeaderConfig>>
) {
super();

Expand Down Expand Up @@ -286,6 +286,6 @@ class BlockHeader
}
}

type SerializedBlockHeader = SerializedObject<C>;
type SerializedBlockHeader = SerializedObject<BlockHeaderConfig>;

export { BlockHeader, SerializedBlockHeader };
14 changes: 8 additions & 6 deletions src/chains/filecoin/filecoin/src/things/channel-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ type ChannelIDConfig = {
};
};

type C = ChannelIDConfig;

class ChannelID extends SerializableObject<C> implements DeserializedObject<C> {
get config(): Definitions<C> {
class ChannelID
extends SerializableObject<ChannelIDConfig>
implements DeserializedObject<ChannelIDConfig> {
get config(): Definitions<ChannelIDConfig> {
return {
initiator: {
deserializedName: "initiator",
Expand All @@ -51,7 +51,9 @@ class ChannelID extends SerializableObject<C> implements DeserializedObject<C> {
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<ChannelIDConfig>>
| Partial<DeserializedObject<ChannelIDConfig>>
) {
super();

Expand All @@ -65,6 +67,6 @@ class ChannelID extends SerializableObject<C> implements DeserializedObject<C> {
id: number;
}

type SerializedChannelID = SerializedObject<C>;
type SerializedChannelID = SerializedObject<ChannelIDConfig>;

export { ChannelID, SerializedChannelID };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/data-transfer-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ type DataTransferChannelConfig = {
};
};

type C = DataTransferChannelConfig;

class DataTransferChannel
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<DataTransferChannelConfig>
implements DeserializedObject<DataTransferChannelConfig> {
get config(): Definitions<DataTransferChannelConfig> {
return {
transferId: {
deserializedName: "transferId",
Expand Down Expand Up @@ -115,7 +113,9 @@ class DataTransferChannel
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<DataTransferChannelConfig>>
| Partial<DeserializedObject<DataTransferChannelConfig>>
) {
super();

Expand All @@ -141,6 +141,6 @@ class DataTransferChannel
transferred: number;
}

type SerializedDataTransferChannel = SerializedObject<C>;
type SerializedDataTransferChannel = SerializedObject<DataTransferChannelConfig>;

export { DataTransferChannel, SerializedDataTransferChannel };
14 changes: 8 additions & 6 deletions src/chains/filecoin/filecoin/src/things/deal-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ type DealInfoConfig = {
};
};

type C = DealInfoConfig;

class DealInfo extends SerializableObject<C> implements DeserializedObject<C> {
get config(): Definitions<C> {
class DealInfo
extends SerializableObject<DealInfoConfig>
implements DeserializedObject<DealInfoConfig> {
get config(): Definitions<DealInfoConfig> {
return {
proposalCid: {
deserializedName: "proposalCid",
Expand Down Expand Up @@ -175,7 +175,9 @@ class DealInfo extends SerializableObject<C> implements DeserializedObject<C> {
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<DealInfoConfig>>
| Partial<DeserializedObject<DealInfoConfig>>
) {
super();

Expand Down Expand Up @@ -227,6 +229,6 @@ class DealInfo extends SerializableObject<C> implements DeserializedObject<C> {
}
}

type SerializedDealInfo = SerializedObject<C>;
type SerializedDealInfo = SerializedObject<DealInfoConfig>;

export { DealInfo, SerializedDealInfo };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/election-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ interface ElectionProofConfig {
};
}

type C = ElectionProofConfig;

class ElectionProof
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<ElectionProofConfig>
implements DeserializedObject<ElectionProofConfig> {
get config(): Definitions<ElectionProofConfig> {
return {
winCount: {
deserializedName: "winCount",
Expand All @@ -46,7 +44,9 @@ class ElectionProof
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<ElectionProofConfig>>
| Partial<DeserializedObject<ElectionProofConfig>>
) {
super();

Expand All @@ -58,6 +58,6 @@ class ElectionProof
vrfProof: Buffer;
}

type SerializedElectionProof = SerializedObject<C>;
type SerializedElectionProof = SerializedObject<ElectionProofConfig>;

export { ElectionProof, SerializedElectionProof };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/head-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ interface HeadChangeConfig {
};
}

type C = HeadChangeConfig;

class HeadChange
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<HeadChangeConfig>
implements DeserializedObject<HeadChangeConfig> {
get config(): Definitions<HeadChangeConfig> {
return {
type: {
deserializedName: "type",
Expand All @@ -44,7 +42,9 @@ class HeadChange
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<HeadChangeConfig>>
| Partial<DeserializedObject<HeadChangeConfig>>
) {
super();

Expand All @@ -56,7 +56,7 @@ class HeadChange
val: Tipset;
}

type SerializedHeadChange = SerializedObject<C>;
type SerializedHeadChange = SerializedObject<HeadChangeConfig>;

// Retrieved these from https://git.io/Jtvke
export enum HeadChangeType {
Expand Down
14 changes: 8 additions & 6 deletions src/chains/filecoin/filecoin/src/things/post-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ interface PoStProofConfig {
};
}

type C = PoStProofConfig;

class PoStProof extends SerializableObject<C> implements DeserializedObject<C> {
get config(): Definitions<C> {
class PoStProof
extends SerializableObject<PoStProofConfig>
implements DeserializedObject<PoStProofConfig> {
get config(): Definitions<PoStProofConfig> {
return {
postProof: {
deserializedName: "postProof",
Expand All @@ -44,7 +44,9 @@ class PoStProof extends SerializableObject<C> implements DeserializedObject<C> {
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<PoStProofConfig>>
| Partial<DeserializedObject<PoStProofConfig>>
) {
super();

Expand All @@ -56,6 +58,6 @@ class PoStProof extends SerializableObject<C> implements DeserializedObject<C> {
proofBytes: Buffer;
}

type SerializedPoStProof = SerializedObject<C>;
type SerializedPoStProof = SerializedObject<PoStProofConfig>;

export { PoStProof, SerializedPoStProof };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/query-offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ type QueryOfferConfig = {
};
};

type C = QueryOfferConfig;

class QueryOffer
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<QueryOfferConfig>
implements DeserializedObject<QueryOfferConfig> {
get config(): Definitions<QueryOfferConfig> {
return {
err: {
deserializedName: "err",
Expand Down Expand Up @@ -125,7 +123,9 @@ class QueryOffer
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<QueryOfferConfig>>
| Partial<DeserializedObject<QueryOfferConfig>>
) {
super();

Expand Down Expand Up @@ -159,6 +159,6 @@ class QueryOffer
minerPeer: RetrievalPeer;
}

type SerializedQueryOffer = SerializedObject<C>;
type SerializedQueryOffer = SerializedObject<QueryOfferConfig>;

export { QueryOffer, SerializedQueryOffer };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/retrieval-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ type RetrievalOrderConfig = {
};
};

type C = RetrievalOrderConfig;

class RetrievalOrder
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<RetrievalOrderConfig>
implements DeserializedObject<RetrievalOrderConfig> {
get config(): Definitions<RetrievalOrderConfig> {
return {
root: {
deserializedName: "root",
Expand Down Expand Up @@ -125,7 +123,9 @@ class RetrievalOrder
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<RetrievalOrderConfig>>
| Partial<DeserializedObject<RetrievalOrderConfig>>
) {
super();

Expand Down Expand Up @@ -159,6 +159,6 @@ class RetrievalOrder
minerPeer: RetrievalPeer;
}

type SerializedRetrievalOrder = SerializedObject<C>;
type SerializedRetrievalOrder = SerializedObject<RetrievalOrderConfig>;

export { RetrievalOrder, SerializedRetrievalOrder };
14 changes: 7 additions & 7 deletions src/chains/filecoin/filecoin/src/things/retrieval-peer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ type RetrievalPeerConfig = {
};
};

type C = RetrievalPeerConfig;

class RetrievalPeer
extends SerializableObject<C>
implements DeserializedObject<C> {
get config(): Definitions<C> {
extends SerializableObject<RetrievalPeerConfig>
implements DeserializedObject<RetrievalPeerConfig> {
get config(): Definitions<RetrievalPeerConfig> {
return {
address: {
deserializedName: "address",
Expand All @@ -54,7 +52,9 @@ class RetrievalPeer
}

constructor(
options?: Partial<SerializedObject<C>> | Partial<DeserializedObject<C>>
options?:
| Partial<SerializedObject<RetrievalPeerConfig>>
| Partial<DeserializedObject<RetrievalPeerConfig>>
) {
super();

Expand All @@ -68,6 +68,6 @@ class RetrievalPeer
pieceCID: RootCID;
}

type SerializedRetrievalPeer = SerializedObject<C>;
type SerializedRetrievalPeer = SerializedObject<RetrievalPeerConfig>;

export { RetrievalPeer, SerializedRetrievalPeer };
Loading

0 comments on commit 96a633a

Please sign in to comment.