Skip to content

Commit

Permalink
Merge pull request #291 from terra-money/fix/import-path
Browse files Browse the repository at this point in the history
fix import path
  • Loading branch information
Geoff Lee authored May 30, 2022
2 parents 66f3bfa + 84fbdfe commit bf03a63
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 68 deletions.
140 changes: 73 additions & 67 deletions src/core/ibc/applications/fee/IdentifiedPacketFee.ts
Original file line number Diff line number Diff line change
@@ -1,88 +1,94 @@
import { IdentifiedPacketFees as IdentifiedPacketFees_pb } from '@terra-money/terra.proto/ibc/applications/fee/v1/fee';
import { JSONSerializable } from '../../../../util/json';
import { PacketFee } from './PacketFee';
import { PacketId } from 'core/ibc/core/channel/PacketId';
import { PacketId } from '../../core/channel/PacketId';

/**
* IdentifiedPacketFees contains a list of type PacketFee and associated PacketId
*/
export class IdentifiedPacketFees extends JSONSerializable<
IdentifiedPacketFees.Amino,
IdentifiedPacketFees.Data,
IdentifiedPacketFees.Proto
IdentifiedPacketFees.Amino,
IdentifiedPacketFees.Data,
IdentifiedPacketFees.Proto
> {
/**
* @param packet_id unique packet identifier comprised of the channel ID, port ID and sequence
* @param packet_fees list of packet fees
*/
constructor(
public packet_id: PacketId | undefined,
public packet_fees: PacketFee[] = []
) {
super();
}
/**
* @param packet_id unique packet identifier comprised of the channel ID, port ID and sequence
* @param packet_fees list of packet fees
*/
constructor(
public packet_id: PacketId | undefined,
public packet_fees: PacketFee[] = []
) {
super();
}

public static fromAmino(data: IdentifiedPacketFees.Amino): IdentifiedPacketFees {
const { packet_id, packet_fees } = data;
return new IdentifiedPacketFees(
packet_id ? PacketId.fromAmino(packet_id) : undefined,
packet_fees.map(fee => PacketFee.fromAmino(fee))
);
}
public static fromAmino(
data: IdentifiedPacketFees.Amino
): IdentifiedPacketFees {
const { packet_id, packet_fees } = data;
return new IdentifiedPacketFees(
packet_id ? PacketId.fromAmino(packet_id) : undefined,
packet_fees.map(fee => PacketFee.fromAmino(fee))
);
}

public toAmino(): IdentifiedPacketFees.Amino {
const { packet_id, packet_fees } = this
const res: IdentifiedPacketFees.Amino = {
packet_id: packet_id?.toAmino(),
packet_fees: packet_fees.map(fee => fee.toAmino())
};
return res;
}
public toAmino(): IdentifiedPacketFees.Amino {
const { packet_id, packet_fees } = this;
const res: IdentifiedPacketFees.Amino = {
packet_id: packet_id?.toAmino(),
packet_fees: packet_fees.map(fee => fee.toAmino()),
};
return res;
}

public static fromData(data: IdentifiedPacketFees.Data): IdentifiedPacketFees {
const { packet_id, packet_fees } = data;
return new IdentifiedPacketFees(
packet_id ? PacketId.fromData(packet_id) : undefined,
packet_fees.map(fee => PacketFee.fromData(fee))
);
}
public static fromData(
data: IdentifiedPacketFees.Data
): IdentifiedPacketFees {
const { packet_id, packet_fees } = data;
return new IdentifiedPacketFees(
packet_id ? PacketId.fromData(packet_id) : undefined,
packet_fees.map(fee => PacketFee.fromData(fee))
);
}

public toData(): IdentifiedPacketFees.Data {
const { packet_id, packet_fees } = this
const res: IdentifiedPacketFees.Data = {
packet_id: packet_id?.toData(),
packet_fees: packet_fees.map(fee => fee.toData())
};
return res;
}
public toData(): IdentifiedPacketFees.Data {
const { packet_id, packet_fees } = this;
const res: IdentifiedPacketFees.Data = {
packet_id: packet_id?.toData(),
packet_fees: packet_fees.map(fee => fee.toData()),
};
return res;
}

public static fromProto(proto: IdentifiedPacketFees.Proto): IdentifiedPacketFees {
return new IdentifiedPacketFees(
proto.packetId ? PacketId.fromProto(proto.packetId) : undefined,
proto.packetFees.map(fee => PacketFee.fromProto(fee))
);
}
public static fromProto(
proto: IdentifiedPacketFees.Proto
): IdentifiedPacketFees {
return new IdentifiedPacketFees(
proto.packetId ? PacketId.fromProto(proto.packetId) : undefined,
proto.packetFees.map(fee => PacketFee.fromProto(fee))
);
}

public toProto(): IdentifiedPacketFees.Proto {
const { packet_id, packet_fees } = this
const res: IdentifiedPacketFees.Proto = {
packetId: packet_id?.toProto(),
packetFees: packet_fees.map(fee => fee.toProto())
};
return res;
}
public toProto(): IdentifiedPacketFees.Proto {
const { packet_id, packet_fees } = this;
const res: IdentifiedPacketFees.Proto = {
packetId: packet_id?.toProto(),
packetFees: packet_fees.map(fee => fee.toProto()),
};
return res;
}
}

export namespace IdentifiedPacketFees {
export interface Amino {
packet_id: PacketId.Amino | undefined;
packet_fees: PacketFee.Amino[];
}
export interface Amino {
packet_id: PacketId.Amino | undefined;
packet_fees: PacketFee.Amino[];
}

export interface Data {
packet_id: PacketId.Data | undefined;
packet_fees: PacketFee.Data[];
}
export interface Data {
packet_id: PacketId.Data | undefined;
packet_fees: PacketFee.Data[];
}

export type Proto = IdentifiedPacketFees_pb;
export type Proto = IdentifiedPacketFees_pb;
}
2 changes: 1 addition & 1 deletion src/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSONSerializable } from '../../../../../util/json';
import { Any } from '@terra-money/terra.proto/google/protobuf/any';
import { MsgPayPacketFeeAsync as MsgPayPacketFeeAsync_pb } from '@terra-money/terra.proto/ibc/applications/fee/v1/tx';
import { PacketId } from 'core/ibc/core/channel/PacketId';
import { PacketId } from '../../../core/channel/PacketId';
import { PacketFee } from '../PacketFee';

/**
Expand Down

0 comments on commit bf03a63

Please sign in to comment.