Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use isClassic flag inside of packAny() and unpackAny() #319

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/core/auth/BaseAccount.ts
Original file line number Diff line number Diff line change
@@ -120,17 +120,18 @@ export class BaseAccount extends JSONSerializable<
);
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.auth.v1beta1.BaseAccount',
value: BaseAccount_pb.encode(this.toProto()).finish(),
value: BaseAccount_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(pubkeyAny: Any, _?: boolean): BaseAccount {
_;
return BaseAccount.fromProto(BaseAccount_pb.decode(pubkeyAny.value));
public static unpackAny(pubkeyAny: Any, isClassic?: boolean): BaseAccount {
return BaseAccount.fromProto(
BaseAccount_pb.decode(pubkeyAny.value),
isClassic
);
}
}

7 changes: 5 additions & 2 deletions src/core/auth/ContinuousVestingAccount.ts
Original file line number Diff line number Diff line change
@@ -136,7 +136,9 @@ export class ContinuousVestingAccount extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/cosmos.vesting.v1beta1.ContinuousVestingAccount',
value: ContinuousVestingAccount_pb.encode(this.toProto()).finish(),
value: ContinuousVestingAccount_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

@@ -148,7 +150,8 @@ export class ContinuousVestingAccount extends JSONSerializable<
throw new Error('Not supported for the network');
}
return ContinuousVestingAccount.fromProto(
ContinuousVestingAccount_pb.decode(pubkeyAny.value)
ContinuousVestingAccount_pb.decode(pubkeyAny.value),
isClassic
);
}
}
5 changes: 3 additions & 2 deletions src/core/auth/DelayedVestingAccount.ts
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ export class DelayedVestingAccount extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/cosmos.vesting.v1beta1.DelayedVestingAccount',
value: DelayedVestingAccount_pb.encode(this.toProto()).finish(),
value: DelayedVestingAccount_pb.encode(this.toProto(isClassic)).finish(),
});
}

@@ -130,7 +130,8 @@ export class DelayedVestingAccount extends JSONSerializable<
throw new Error('Not supported for the network');
}
return DelayedVestingAccount.fromProto(
DelayedVestingAccount_pb.decode(pubkeyAny.value)
DelayedVestingAccount_pb.decode(pubkeyAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/auth/LazyGradedVestingAccount.ts
Original file line number Diff line number Diff line change
@@ -129,21 +129,22 @@ export class LazyGradedVestingAccount extends JSONSerializable<
);
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/terra.vesting.v1beta1.LazyGradedVestingAccount',
value: LazyGradedVestingAccount_pb.encode(this.toProto()).finish(),
value: LazyGradedVestingAccount_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(
pubkeyAny: Any,
_?: boolean
isClassic?: boolean
): LazyGradedVestingAccount {
_;
return LazyGradedVestingAccount.fromProto(
LazyGradedVestingAccount_pb.decode(pubkeyAny.value)
LazyGradedVestingAccount_pb.decode(pubkeyAny.value),
isClassic
);
}
}
5 changes: 3 additions & 2 deletions src/core/auth/PeriodicVestingAccount.ts
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ export class PeriodicVestingAccount extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/cosmos.vesting.v1beta1.PeriodicVestingAccount',
value: PeriodicVestingAccount_pb.encode(this.toProto()).finish(),
value: PeriodicVestingAccount_pb.encode(this.toProto(isClassic)).finish(),
});
}

@@ -160,7 +160,8 @@ export class PeriodicVestingAccount extends JSONSerializable<
throw new Error('Not supported for the network');
}
return PeriodicVestingAccount.fromProto(
PeriodicVestingAccount_pb.decode(pubkeyAny.value)
PeriodicVestingAccount_pb.decode(pubkeyAny.value),
isClassic
);
}
}
14 changes: 8 additions & 6 deletions src/core/authz/authorizations/GenericAuthorization.ts
Original file line number Diff line number Diff line change
@@ -63,18 +63,20 @@ export class GenericAuthorization extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.authz.v1beta1.GenericAuthorization',
value: GenericAuthorization_pb.encode(this.toProto()).finish(),
value: GenericAuthorization_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): GenericAuthorization {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): GenericAuthorization {
return GenericAuthorization.fromProto(
GenericAuthorization_pb.decode(msgAny.value)
GenericAuthorization_pb.decode(msgAny.value),
isClassic
);
}
}
11 changes: 5 additions & 6 deletions src/core/authz/authorizations/SendAuthorization.ts
Original file line number Diff line number Diff line change
@@ -66,18 +66,17 @@ export class SendAuthorization extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.bank.v1beta1.SendAuthorization',
value: SendAuthorization_pb.encode(this.toProto()).finish(),
value: SendAuthorization_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): SendAuthorization {
_;
public static unpackAny(msgAny: Any, isClassic?: boolean): SendAuthorization {
return SendAuthorization.fromProto(
SendAuthorization_pb.decode(msgAny.value)
SendAuthorization_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/bank/msgs/MsgMultiSend.ts
Original file line number Diff line number Diff line change
@@ -127,17 +127,18 @@ export class MsgMultiSend extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.bank.v1beta1.MsgMultiSend',
value: MsgMultiSend_pb.encode(this.toProto()).finish(),
value: MsgMultiSend_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgMultiSend {
_;
return MsgMultiSend.fromProto(MsgMultiSend_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgMultiSend {
return MsgMultiSend.fromProto(
MsgMultiSend_pb.decode(msgAny.value),
isClassic
);
}
}

10 changes: 4 additions & 6 deletions src/core/bank/msgs/MsgSend.ts
Original file line number Diff line number Diff line change
@@ -90,17 +90,15 @@ export class MsgSend extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.bank.v1beta1.MsgSend',
value: MsgSend_pb.encode(this.toProto()).finish(),
value: MsgSend_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgSend {
_;
return MsgSend.fromProto(MsgSend_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgSend {
return MsgSend.fromProto(MsgSend_pb.decode(msgAny.value), isClassic);
}
}

29 changes: 20 additions & 9 deletions src/core/crisis/MsgVerifyInvariant.ts
Original file line number Diff line number Diff line change
@@ -25,7 +25,10 @@ export class MsgVerifyInvariant extends JSONSerializable<
super();
}

public static fromAmino(data: MsgVerifyInvariant.Amino, _?: boolean): MsgVerifyInvariant {
public static fromAmino(
data: MsgVerifyInvariant.Amino,
_?: boolean
): MsgVerifyInvariant {
_;
const {
value: { sender, invariantModuleName, invariantRoute },
@@ -38,7 +41,10 @@ export class MsgVerifyInvariant extends JSONSerializable<
throw new Error('MsgVerifyInvarant is not allowed to send');
}

public static fromData(data: MsgVerifyInvariant.Data, _?: boolean): MsgVerifyInvariant {
public static fromData(
data: MsgVerifyInvariant.Data,
_?: boolean
): MsgVerifyInvariant {
_;
const { sender, invariantModuleName, invariantRoute } = data;
return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute);
@@ -55,7 +61,10 @@ export class MsgVerifyInvariant extends JSONSerializable<
};
}

public static fromProto(proto: MsgVerifyInvariant.Proto, _?: boolean): MsgVerifyInvariant {
public static fromProto(
proto: MsgVerifyInvariant.Proto,
_?: boolean
): MsgVerifyInvariant {
_;
return new MsgVerifyInvariant(
proto.sender,
@@ -69,18 +78,20 @@ export class MsgVerifyInvariant extends JSONSerializable<
throw new Error('MsgVerifyInvarant is not allowed to send');
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.crisis.v1beta1.MsgVerifyInvariant',
value: MsgVerifyInvariant_pb.encode(this.toProto()).finish(),
value: MsgVerifyInvariant_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgVerifyInvariant {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): MsgVerifyInvariant {
return MsgVerifyInvariant.fromProto(
MsgVerifyInvariant_pb.decode(msgAny.value)
MsgVerifyInvariant_pb.decode(msgAny.value),
isClassic
);
}
}
14 changes: 8 additions & 6 deletions src/core/distribution/msgs/MsgFundCommunityPool.ts
Original file line number Diff line number Diff line change
@@ -84,18 +84,20 @@ export class MsgFundCommunityPool extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.distribution.v1beta1.MsgFundCommunityPool',
value: MsgFundCommunityPool_pb.encode(this.toProto()).finish(),
value: MsgFundCommunityPool_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgFundCommunityPool {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): MsgFundCommunityPool {
return MsgFundCommunityPool.fromProto(
MsgFundCommunityPool_pb.decode(msgAny.value)
MsgFundCommunityPool_pb.decode(msgAny.value),
isClassic
);
}
}
14 changes: 8 additions & 6 deletions src/core/distribution/msgs/MsgSetWithdrawAddress.ts
Original file line number Diff line number Diff line change
@@ -89,18 +89,20 @@ export class MsgSetWithdrawAddress extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress',
value: MsgSetWithdrawAddress_pb.encode(this.toProto()).finish(),
value: MsgSetWithdrawAddress_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgSetWithdrawAddress {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): MsgSetWithdrawAddress {
return MsgSetWithdrawAddress.fromProto(
MsgSetWithdrawAddress_pb.decode(msgAny.value)
MsgSetWithdrawAddress_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/distribution/msgs/MsgWithdrawDelegatorReward.ts
Original file line number Diff line number Diff line change
@@ -91,21 +91,22 @@ export class MsgWithdrawDelegatorReward extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
value: MsgWithdrawDelegatorReward_pb.encode(this.toProto()).finish(),
value: MsgWithdrawDelegatorReward_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(
msgAny: Any,
_?: boolean
isClassic?: boolean
): MsgWithdrawDelegatorReward {
_;
return MsgWithdrawDelegatorReward.fromProto(
MsgWithdrawDelegatorReward_pb.decode(msgAny.value)
MsgWithdrawDelegatorReward_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/distribution/msgs/MsgWithdrawValidatorCommission.ts
Original file line number Diff line number Diff line change
@@ -77,21 +77,22 @@ export class MsgWithdrawValidatorCommission extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission',
value: MsgWithdrawValidatorCommission_pb.encode(this.toProto()).finish(),
value: MsgWithdrawValidatorCommission_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(
msgAny: Any,
_?: boolean
isClassic?: boolean
): MsgWithdrawValidatorCommission {
_;
return MsgWithdrawValidatorCommission.fromProto(
MsgWithdrawValidatorCommission_pb.decode(msgAny.value)
MsgWithdrawValidatorCommission_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/distribution/proposals/CommunityPoolSpendProposal.ts
Original file line number Diff line number Diff line change
@@ -113,21 +113,22 @@ export class CommunityPoolSpendProposal extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal',
value: CommunityPoolSpendProposal_pb.encode(this.toProto()).finish(),
value: CommunityPoolSpendProposal_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(
msgAny: Any,
_?: boolean
isClassic?: boolean
): CommunityPoolSpendProposal {
_;
return CommunityPoolSpendProposal.fromProto(
CommunityPoolSpendProposal_pb.decode(msgAny.value)
CommunityPoolSpendProposal_pb.decode(msgAny.value),
isClassic
);
}
}
26 changes: 13 additions & 13 deletions src/core/feegrant/allowances/AllowedMsgAllowance.ts
Original file line number Diff line number Diff line change
@@ -82,39 +82,39 @@ export class AllowedMsgAllowance extends JSONSerializable<

public static fromProto(
proto: AllowedMsgAllowance.Proto,
_?: boolean
isClassic?: boolean
): AllowedMsgAllowance {
_;
const allowance = proto.allowance as Any;
return new AllowedMsgAllowance(
allowance?.typeUrl === '/cosmos.feegrant.v1beta1.BasicAllowance'
? BasicAllowance.unpackAny(allowance)
: PeriodicAllowance.unpackAny(allowance),
? BasicAllowance.unpackAny(allowance, isClassic)
: PeriodicAllowance.unpackAny(allowance, isClassic),
proto.allowedMessages
);
}

public toProto(_?: boolean): AllowedMsgAllowance.Proto {
_;
public toProto(isClassic?: boolean): AllowedMsgAllowance.Proto {
const { allowance, allowed_messages } = this;
return AllowedMsgAllowance_pb.fromPartial({
allowance: allowance.packAny(),
allowance: allowance.packAny(isClassic),
allowedMessages: allowed_messages,
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.feegrant.v1beta1.AllowedMsgAllowance',
value: AllowedMsgAllowance_pb.encode(this.toProto()).finish(),
value: AllowedMsgAllowance_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): AllowedMsgAllowance {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): AllowedMsgAllowance {
return AllowedMsgAllowance.fromProto(
AllowedMsgAllowance_pb.decode(msgAny.value)
AllowedMsgAllowance_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/feegrant/allowances/BasicAllowance.ts
Original file line number Diff line number Diff line change
@@ -109,17 +109,18 @@ export class BasicAllowance extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance',
value: BasicAllowance_pb.encode(this.toProto()).finish(),
value: BasicAllowance_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): BasicAllowance {
_;
return BasicAllowance.fromProto(BasicAllowance_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): BasicAllowance {
return BasicAllowance.fromProto(
BasicAllowance_pb.decode(msgAny.value),
isClassic
);
}
}

11 changes: 5 additions & 6 deletions src/core/feegrant/allowances/PeriodicAllowance.ts
Original file line number Diff line number Diff line change
@@ -154,18 +154,17 @@ export class PeriodicAllowance extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.feegrant.v1beta1.PeriodicAllowance',
value: PeriodicAllowance_pb.encode(this.toProto()).finish(),
value: PeriodicAllowance_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): PeriodicAllowance {
_;
public static unpackAny(msgAny: Any, isClassic?: boolean): PeriodicAllowance {
return PeriodicAllowance.fromProto(
PeriodicAllowance_pb.decode(msgAny.value)
PeriodicAllowance_pb.decode(msgAny.value),
isClassic
);
}
}
17 changes: 13 additions & 4 deletions src/core/gov/Vote.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ export class Vote extends JSONSerializable<Vote.Amino, Vote.Data, Vote.Proto> {
/**
* @param proposal_id ID of proposal to vote on
* @param voter voter's account address
* @param option one of voting options
* @param options voting options
*/
constructor(
public proposal_id: number,
@@ -122,7 +122,10 @@ export class WeightedVoteOption extends JSONSerializable<
this.weight = new Dec(weight);
}

public static fromAmino(data: WeightedVoteOption.Amino, _?: boolean): WeightedVoteOption {
public static fromAmino(
data: WeightedVoteOption.Amino,
_?: boolean
): WeightedVoteOption {
_;
const { option, weight } = data;
return new WeightedVoteOption(option, weight);
@@ -137,7 +140,10 @@ export class WeightedVoteOption extends JSONSerializable<
};
}

public static fromData(data: WeightedVoteOption.Data, _?: boolean): WeightedVoteOption {
public static fromData(
data: WeightedVoteOption.Data,
_?: boolean
): WeightedVoteOption {
_;
const { option, weight } = data;
return new WeightedVoteOption(option, weight);
@@ -152,7 +158,10 @@ export class WeightedVoteOption extends JSONSerializable<
};
}

public static fromProto(proto: WeightedVoteOption.Proto, _?: boolean): WeightedVoteOption {
public static fromProto(
proto: WeightedVoteOption.Proto,
_?: boolean
): WeightedVoteOption {
_;
return new WeightedVoteOption(proto.option, proto.weight);
}
79 changes: 0 additions & 79 deletions src/core/ibc-transfer/DenomTrace.ts

This file was deleted.

96 changes: 0 additions & 96 deletions src/core/ibc-transfer/msgs/MsgTransfer.spec.ts

This file was deleted.

234 changes: 0 additions & 234 deletions src/core/ibc-transfer/msgs/MsgTransfer.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/core/ibc-transfer/msgs/index.ts

This file was deleted.

13 changes: 7 additions & 6 deletions src/core/ibc/applications/transfer/v1/msgs/MsgTransfer.ts
Original file line number Diff line number Diff line change
@@ -201,17 +201,18 @@ export class MsgTransfer extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/ibc.applications.transfer.v1.MsgTransfer',
value: MsgTransfer_pb.encode(this.toProto()).finish(),
value: MsgTransfer_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgTransfer {
_;
return MsgTransfer.fromProto(MsgTransfer_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgTransfer {
return MsgTransfer.fromProto(
MsgTransfer_pb.decode(msgAny.value),
isClassic
);
}
}

4 changes: 2 additions & 2 deletions src/core/market/msgs/MsgSwap.ts
Original file line number Diff line number Diff line change
@@ -82,15 +82,15 @@ export class MsgSwap extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/terra.market.v1beta1.MsgSwap',
value: MsgSwap_pb.encode(this.toProto()).finish(),
value: MsgSwap_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, isClassic?: boolean): MsgSwap {
if (!isClassic) {
throw new Error('Not supported for the network');
}
return MsgSwap.fromProto(MsgSwap_pb.decode(msgAny.value));
return MsgSwap.fromProto(MsgSwap_pb.decode(msgAny.value), isClassic);
}

public static fromData(data: MsgSwap.Data, isClassic?: boolean): MsgSwap {
7 changes: 5 additions & 2 deletions src/core/market/msgs/MsgSwapSend.ts
Original file line number Diff line number Diff line change
@@ -98,15 +98,18 @@ export class MsgSwapSend extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/terra.market.v1beta1.MsgSwapSend',
value: MsgSwapSend_pb.encode(this.toProto()).finish(),
value: MsgSwapSend_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, isClassic?: boolean): MsgSwapSend {
if (!isClassic) {
throw new Error('Not supported for the network');
}
return MsgSwapSend.fromProto(MsgSwapSend_pb.decode(msgAny.value));
return MsgSwapSend.fromProto(
MsgSwapSend_pb.decode(msgAny.value),
isClassic
);
}

public static fromData(
7 changes: 5 additions & 2 deletions src/core/oracle/msgs/MsgAggregateExchangeRatePrevote.ts
Original file line number Diff line number Diff line change
@@ -115,7 +115,9 @@ export class MsgAggregateExchangeRatePrevote extends JSONSerializable<

return Any.fromPartial({
typeUrl: '/terra.oracle.v1beta1.MsgAggregateExchangeRatePrevote',
value: MsgAggregateExchangeRatePrevote_pb.encode(this.toProto()).finish(),
value: MsgAggregateExchangeRatePrevote_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

@@ -128,7 +130,8 @@ export class MsgAggregateExchangeRatePrevote extends JSONSerializable<
}

return MsgAggregateExchangeRatePrevote.fromProto(
MsgAggregateExchangeRatePrevote_pb.decode(msgAny.value)
MsgAggregateExchangeRatePrevote_pb.decode(msgAny.value),
isClassic
);
}
}
14 changes: 14 additions & 0 deletions src/core/oracle/msgs/MsgAggregateExchangeRateVote.spec.ts
Original file line number Diff line number Diff line change
@@ -17,4 +17,18 @@ describe('MsgAggregateExchangeRateVote', () => {
'7929908433e7399845fa60f9ef70ef7f2bb8f01b'
);
});
it('conversion', () => {
const msg = new MsgAggregateExchangeRateVote(
{
ukrw: '245.000',
uusd: '0.2242',
usdr: '0.182',
},
'salt',
'terra1krj7amhhagjnyg2tkkuh6l0550y733jnjulzjh',
'terravaloper1krj7amhhagjnyg2tkkuh6l0550y733jnjnnlzy'
);
const anyObj = msg.packAny(true);
expect(MsgAggregateExchangeRateVote.unpackAny(anyObj, true)).toBeDefined();
});
});
7 changes: 5 additions & 2 deletions src/core/oracle/msgs/MsgAggregateExchangeRateVote.ts
Original file line number Diff line number Diff line change
@@ -166,7 +166,9 @@ export class MsgAggregateExchangeRateVote extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/terra.oracle.v1beta1.MsgAggregateExchangeRateVote',
value: MsgAggregateExchangeRateVote_pb.encode(this.toProto()).finish(),
value: MsgAggregateExchangeRateVote_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

@@ -178,7 +180,8 @@ export class MsgAggregateExchangeRateVote extends JSONSerializable<
throw new Error('Not supported for the network');
}
return MsgAggregateExchangeRateVote.fromProto(
MsgAggregateExchangeRateVote_pb.decode(msgAny.value)
MsgAggregateExchangeRateVote_pb.decode(msgAny.value),
isClassic
);
}
}
5 changes: 3 additions & 2 deletions src/core/oracle/msgs/MsgDelegateFeedConsent.ts
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ export class MsgDelegateFeedConsent extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/terra.oracle.v1beta1.MsgDelegateFeedConsent',
value: MsgDelegateFeedConsent_pb.encode(this.toProto()).finish(),
value: MsgDelegateFeedConsent_pb.encode(this.toProto(isClassic)).finish(),
});
}

@@ -119,7 +119,8 @@ export class MsgDelegateFeedConsent extends JSONSerializable<
throw new Error('Not supported for the network');
}
return MsgDelegateFeedConsent.fromProto(
MsgDelegateFeedConsent_pb.decode(msgAny.value)
MsgDelegateFeedConsent_pb.decode(msgAny.value),
isClassic
);
}
}
10 changes: 4 additions & 6 deletions src/core/slashing/msgs/MsgUnjail.ts
Original file line number Diff line number Diff line change
@@ -69,17 +69,15 @@ export class MsgUnjail extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.slashing.v1beta1.MsgUnjail',
value: MsgUnjail_pb.encode(this.toProto()).finish(),
value: MsgUnjail_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgUnjail {
_;
return MsgUnjail.fromProto(MsgUnjail_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgUnjail {
return MsgUnjail.fromProto(MsgUnjail_pb.decode(msgAny.value), isClassic);
}
}

14 changes: 8 additions & 6 deletions src/core/staking/msgs/MsgBeginRedelegate.ts
Original file line number Diff line number Diff line change
@@ -137,18 +137,20 @@ export class MsgBeginRedelegate extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.staking.v1beta1.MsgBeginRedelegate',
value: MsgBeginRedelegate_pb.encode(this.toProto()).finish(),
value: MsgBeginRedelegate_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgBeginRedelegate {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): MsgBeginRedelegate {
return MsgBeginRedelegate.fromProto(
MsgBeginRedelegate_pb.decode(msgAny.value)
MsgBeginRedelegate_pb.decode(msgAny.value),
isClassic
);
}
}
14 changes: 8 additions & 6 deletions src/core/staking/msgs/MsgCreateValidator.ts
Original file line number Diff line number Diff line change
@@ -183,18 +183,20 @@ export class MsgCreateValidator extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.staking.v1beta1.MsgCreateValidator',
value: MsgCreateValidator_pb.encode(this.toProto()).finish(),
value: MsgCreateValidator_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgCreateValidator {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): MsgCreateValidator {
return MsgCreateValidator.fromProto(
MsgCreateValidator_pb.decode(msgAny.value)
MsgCreateValidator_pb.decode(msgAny.value),
isClassic
);
}
}
13 changes: 7 additions & 6 deletions src/core/staking/msgs/MsgDelegate.ts
Original file line number Diff line number Diff line change
@@ -71,17 +71,18 @@ export class MsgDelegate extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.staking.v1beta1.MsgDelegate',
value: MsgDelegate_pb.encode(this.toProto()).finish(),
value: MsgDelegate_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgDelegate {
_;
return MsgDelegate.fromProto(MsgDelegate_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgDelegate {
return MsgDelegate.fromProto(
MsgDelegate_pb.decode(msgAny.value),
isClassic
);
}

public static fromData(data: MsgDelegate.Data, _?: boolean): MsgDelegate {
13 changes: 7 additions & 6 deletions src/core/staking/msgs/MsgEditValidator.ts
Original file line number Diff line number Diff line change
@@ -113,17 +113,18 @@ export class MsgEditValidator extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.staking.v1beta1.MsgEditValidator',
value: MsgEditValidator_pb.encode(this.toProto()).finish(),
value: MsgEditValidator_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgEditValidator {
_;
return MsgEditValidator.fromProto(MsgEditValidator_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgEditValidator {
return MsgEditValidator.fromProto(
MsgEditValidator_pb.decode(msgAny.value),
isClassic
);
}

public static fromData(
13 changes: 7 additions & 6 deletions src/core/staking/msgs/MsgUndelegate.ts
Original file line number Diff line number Diff line change
@@ -78,17 +78,18 @@ export class MsgUndelegate extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.staking.v1beta1.MsgUndelegate',
value: MsgUndelegate_pb.encode(this.toProto()).finish(),
value: MsgUndelegate_pb.encode(this.toProto(isClassic)).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): MsgUndelegate {
_;
return MsgUndelegate.fromProto(MsgUndelegate_pb.decode(msgAny.value));
public static unpackAny(msgAny: Any, isClassic?: boolean): MsgUndelegate {
return MsgUndelegate.fromProto(
MsgUndelegate_pb.decode(msgAny.value),
isClassic
);
}

public static fromData(data: MsgUndelegate.Data, _?: boolean): MsgUndelegate {
13 changes: 7 additions & 6 deletions src/core/upgrade/proposals/CancelSoftwareUpgradeProposal.ts
Original file line number Diff line number Diff line change
@@ -79,21 +79,22 @@ export class CancelSoftwareUpgradeProposal extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal',
value: CancelSoftwareUpgradeProposal_pb.encode(this.toProto()).finish(),
value: CancelSoftwareUpgradeProposal_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(
msgAny: Any,
_?: boolean
isClassic?: boolean
): CancelSoftwareUpgradeProposal {
_;
return CancelSoftwareUpgradeProposal.fromProto(
CancelSoftwareUpgradeProposal_pb.decode(msgAny.value)
CancelSoftwareUpgradeProposal_pb.decode(msgAny.value),
isClassic
);
}
}
16 changes: 10 additions & 6 deletions src/core/upgrade/proposals/SoftwareUpgradeProposal.ts
Original file line number Diff line number Diff line change
@@ -100,18 +100,22 @@ export class SoftwareUpgradeProposal extends JSONSerializable<
});
}

public packAny(_?: boolean): Any {
_;
public packAny(isClassic?: boolean): Any {
return Any.fromPartial({
typeUrl: '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal',
value: SoftwareUpgradeProposal_pb.encode(this.toProto()).finish(),
value: SoftwareUpgradeProposal_pb.encode(
this.toProto(isClassic)
).finish(),
});
}

public static unpackAny(msgAny: Any, _?: boolean): SoftwareUpgradeProposal {
_;
public static unpackAny(
msgAny: Any,
isClassic?: boolean
): SoftwareUpgradeProposal {
return SoftwareUpgradeProposal.fromProto(
SoftwareUpgradeProposal_pb.decode(msgAny.value)
SoftwareUpgradeProposal_pb.decode(msgAny.value),
isClassic
);
}
}
5 changes: 3 additions & 2 deletions src/core/wasm/msgs/MsgMigrateCode.ts
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ export class MsgMigrateCode extends JSONSerializable<
}
return Any.fromPartial({
typeUrl: '/terra.wasm.v1beta1.MsgMigrateCode',
value: MsgMigrateCode_legacy_pb.encode(this.toProto()).finish(),
value: MsgMigrateCode_legacy_pb.encode(this.toProto(isClassic)).finish(),
});
}

@@ -91,7 +91,8 @@ export class MsgMigrateCode extends JSONSerializable<
throw new Error('Not supported for the network');
}
return MsgMigrateCode.fromProto(
MsgMigrateCode_legacy_pb.decode(msgAny.value)
MsgMigrateCode_legacy_pb.decode(msgAny.value),
isClassic
);
}