carbon-js-sdk 0.8.4 → 0.8.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import { QueryClientImpl as NativeBankQueryClient } from "../codec/Switcheo/carb
9
9
  import { ServiceClientImpl as CosmosTmClient } from "../codec/cosmos/base/tendermint/v1beta1/query";
10
10
  import { QueryClientImpl as DistributionQueryClient } from "../codec/cosmos/distribution/v1beta1/query";
11
11
  import { QueryClientImpl as EvidenceQueryClient } from "../codec/cosmos/evidence/v1beta1/query";
12
- import { QueryClientImpl as GovQueryClient } from "../codec/cosmos/gov/v1beta1/query";
12
+ import { QueryClientImpl as GovQueryClient } from "../codec/cosmos/gov/v1/query";
13
13
  import { QueryClientImpl as GroupQueryClient } from "../codec/cosmos/group/v1/query";
14
14
  import { QueryClientImpl as MintQueryClient } from "../codec/cosmos/mint/v1beta1/query";
15
15
  import { QueryClientImpl as ParamsQueryClient } from "../codec/cosmos/params/v1beta1/query";
@@ -14,7 +14,7 @@ const query_8 = require("../codec/Switcheo/carbon/bank/query");
14
14
  const query_9 = require("../codec/cosmos/base/tendermint/v1beta1/query");
15
15
  const query_10 = require("../codec/cosmos/distribution/v1beta1/query");
16
16
  const query_11 = require("../codec/cosmos/evidence/v1beta1/query");
17
- const query_12 = require("../codec/cosmos/gov/v1beta1/query");
17
+ const query_12 = require("../codec/cosmos/gov/v1/query");
18
18
  const query_13 = require("../codec/cosmos/group/v1/query");
19
19
  const query_14 = require("../codec/cosmos/mint/v1beta1/query");
20
20
  const query_15 = require("../codec/cosmos/params/v1beta1/query");
@@ -57,8 +57,9 @@ const tx_23 = require("./ibc/applications/transfer/v1/tx");
57
57
  const tx_24 = require("./ibc/applications/interchain_accounts/controller/v1/tx");
58
58
  const tx_25 = require("./ethermint/feemarket/v1/tx");
59
59
  const tx_26 = require("./ethermint/evm/v1/tx");
60
- const gov_1 = require("./cosmos/gov/v1beta1/gov");
60
+ const gov_1 = require("./cosmos/gov/v1/gov");
61
61
  const client_1 = require("./ibc/core/client/v1/client");
62
+ const gov_2 = require("./cosmos/gov/v1beta1/gov");
62
63
  __exportStar(require("./cosmos-models"), exports);
63
64
  exports.IBC = __importStar(require("./ibc-models"));
64
65
  const PolyNetwork = __importStar(require("./polynetwork-models"));
@@ -533,6 +534,7 @@ exports.registry.register("/cosmos.gov.v1.MsgDeposit", tx_17.MsgDeposit);
533
534
  exports.registry.register("/cosmos.gov.v1.MsgDepositResponse", tx_17.MsgDepositResponse);
534
535
  exports.registry.register("/cosmos.gov.v1.MsgUpdateParams", tx_17.MsgUpdateParams);
535
536
  exports.registry.register("/cosmos.gov.v1.MsgUpdateParamsResponse", tx_17.MsgUpdateParamsResponse);
537
+ exports.registry.register("/cosmos.gov.v1.Proposal", gov_1.Proposal);
536
538
  exports.registry.register("/cosmos.gov.v1beta1.MsgSubmitProposal", tx_18.MsgSubmitProposal);
537
539
  exports.registry.register("/cosmos.gov.v1beta1.MsgSubmitProposalResponse", tx_18.MsgSubmitProposalResponse);
538
540
  exports.registry.register("/cosmos.gov.v1beta1.MsgVote", tx_18.MsgVote);
@@ -541,8 +543,7 @@ exports.registry.register("/cosmos.gov.v1beta1.MsgVoteWeighted", tx_18.MsgVoteWe
541
543
  exports.registry.register("/cosmos.gov.v1beta1.MsgVoteWeightedResponse", tx_18.MsgVoteWeightedResponse);
542
544
  exports.registry.register("/cosmos.gov.v1beta1.MsgDeposit", tx_18.MsgDeposit);
543
545
  exports.registry.register("/cosmos.gov.v1beta1.MsgDepositResponse", tx_18.MsgDepositResponse);
544
- exports.registry.register("/cosmos.gov.v1beta1.TextProposal", gov_1.TextProposal);
545
- exports.registry.register("/cosmos.gov.v1beta1.Proposal", gov_1.Proposal);
546
+ exports.registry.register("/cosmos.gov.v1beta1.TextProposal", gov_2.TextProposal);
546
547
  exports.registry.register("/ibc.core.connection.v1.MsgConnectionOpenInit", tx_19.MsgConnectionOpenInit);
547
548
  exports.registry.register("/ibc.core.connection.v1.MsgConnectionOpenInitResponse", tx_19.MsgConnectionOpenInitResponse);
548
549
  exports.registry.register("/ibc.core.connection.v1.MsgConnectionOpenTry", tx_19.MsgConnectionOpenTry);
@@ -1083,7 +1084,7 @@ exports.TxTypes = {
1083
1084
  "MsgDeposit": "/cosmos.gov.v1beta1.MsgDeposit",
1084
1085
  "MsgDepositResponse": "/cosmos.gov.v1beta1.MsgDepositResponse",
1085
1086
  "TextProposal": "/cosmos.gov.v1beta1.TextProposal",
1086
- "Proposal": "/cosmos.gov.v1beta1.Proposal",
1087
+ "Proposal": "/cosmos.gov.v1.Proposal",
1087
1088
  "MsgConnectionOpenInit": "/ibc.core.connection.v1.MsgConnectionOpenInit",
1088
1089
  "MsgConnectionOpenInitResponse": "/ibc.core.connection.v1.MsgConnectionOpenInitResponse",
1089
1090
  "MsgConnectionOpenTry": "/ibc.core.connection.v1.MsgConnectionOpenTry",
@@ -1221,10 +1222,10 @@ var alliance_1 = require("./alliance/alliance/alliance");
1221
1222
  Object.defineProperty(exports, "RewardWeightRange", { enumerable: true, get: function () { return alliance_1.RewardWeightRange; } });
1222
1223
  Object.defineProperty(exports, "AllianceAsset", { enumerable: true, get: function () { return alliance_1.AllianceAsset; } });
1223
1224
  Object.defineProperty(exports, "RewardWeightChangeSnapshot", { enumerable: true, get: function () { return alliance_1.RewardWeightChangeSnapshot; } });
1224
- var gov_2 = require("./alliance/alliance/gov");
1225
- Object.defineProperty(exports, "MsgCreateAllianceProposal", { enumerable: true, get: function () { return gov_2.MsgCreateAllianceProposal; } });
1226
- Object.defineProperty(exports, "MsgUpdateAllianceProposal", { enumerable: true, get: function () { return gov_2.MsgUpdateAllianceProposal; } });
1227
- Object.defineProperty(exports, "MsgDeleteAllianceProposal", { enumerable: true, get: function () { return gov_2.MsgDeleteAllianceProposal; } });
1225
+ var gov_3 = require("./alliance/alliance/gov");
1226
+ Object.defineProperty(exports, "MsgCreateAllianceProposal", { enumerable: true, get: function () { return gov_3.MsgCreateAllianceProposal; } });
1227
+ Object.defineProperty(exports, "MsgUpdateAllianceProposal", { enumerable: true, get: function () { return gov_3.MsgUpdateAllianceProposal; } });
1228
+ Object.defineProperty(exports, "MsgDeleteAllianceProposal", { enumerable: true, get: function () { return gov_3.MsgDeleteAllianceProposal; } });
1228
1229
  var tx_27 = require("./alliance/alliance/tx");
1229
1230
  Object.defineProperty(exports, "MsgDelegate", { enumerable: true, get: function () { return tx_27.MsgDelegate; } });
1230
1231
  Object.defineProperty(exports, "MsgDelegateResponse", { enumerable: true, get: function () { return tx_27.MsgDelegateResponse; } });
@@ -36,6 +36,7 @@ export declare namespace GovModule {
36
36
  interface VoteParams {
37
37
  proposalId: number;
38
38
  option: VoteOption;
39
+ metadata?: string;
39
40
  }
40
41
  type CosmosProposalMsg = ParameterChangeProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | TextProposal | CommunityPoolSpendProposal;
41
42
  type ProposalTypeParams = AdminModule.CreateTokenParams | AdminModule.SetMsgGasCostParams | AdminModule.SetMinGasPriceParams | AdminModule.LinkPoolParams | AdminModule.UnlinkPoolParams | AdminModule.SetRewardCurveParams | AdminModule.SetCommitmentCurveParams | AdminModule.SetRewardsWeightsParams | AdminModule.UpdatePoolParams | AdminModule.ChangeNumQuotesParams | AdminModule.CreateMarketParams | MarketModule.UpdateMarketParams | AdminModule.CreateOracleParams | SettlementPriceParams;
@@ -16,7 +16,7 @@ exports.GovModule = void 0;
16
16
  const proposal_1 = require("../codec/Switcheo/carbon/coin/proposal");
17
17
  const distribution_1 = require("../codec/cosmos/distribution/v1beta1/distribution");
18
18
  const gov_1 = require("../codec/cosmos/gov/v1beta1/gov");
19
- const tx_1 = require("../codec/cosmos/gov/v1beta1/tx");
19
+ const tx_1 = require("../codec/cosmos/gov/v1/tx");
20
20
  const params_1 = require("../codec/cosmos/params/v1beta1/params");
21
21
  const upgrade_1 = require("../codec/cosmos/upgrade/v1beta1/upgrade");
22
22
  const proposal_2 = require("../codec/Switcheo/carbon/fee/proposal");
@@ -63,6 +63,7 @@ class GovModule extends base_1.default {
63
63
  proposalId: new long_1.default(params.proposalId),
64
64
  voter: wallet.bech32Address,
65
65
  option: params.option,
66
+ metadata: params.metadata,
66
67
  });
67
68
  return yield wallet.sendTx({
68
69
  typeUrl: util_1.CarbonTx.Types.MsgVote,
package/lib/util/gov.d.ts CHANGED
@@ -5,29 +5,46 @@ export declare enum ProposalTypes {
5
5
  CancelSoftwareUpgrade = "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal",
6
6
  CommunityPoolSpend = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal",
7
7
  Text = "/cosmos.gov.v1beta1.TextProposal",
8
- SetMsgGasCost = "/Switcheo.carbon.fee.MsgSetGasCost",
9
- SetMinGasPrice = "/Switcheo.carbon.fee.MsgSetMinGasPrice",
10
- RemoveMsgGasCost = "/Switcheo.carbon.fee.MsgRemoveGasCost",
11
- RemoveMinGasPrice = "/Switcheo.carbon.fee.MsgRemoveMinGasPrice",
12
- CreateToken = "/Switcheo.carbon.coin.CreateTokenProposal",
13
- CreateOracle = "/Switcheo.carbon.oracle.MsgCreateOracle",
14
- UpdatePool = "/Switcheo.carbon.liquiditypool.MsgUpdatePool",
15
- SetRewardCurve = "/Switcheo.carbon.liquiditypool.MsgSetRewardCurve",
16
- SetRewardsWeights = "/Switcheo.carbon.liquiditypool.MsgSetRewardsWeights",
17
- SetCommitmentCurve = "/Switcheo.carbon.liquiditypool.MsgSetCommitmentCurve",
18
- UpdateMarket = "/Switcheo.carbon.market.MsgUpdateMarket",
19
- SettlementPrice = "/Switcheo.carbon.pricing.MsgUpdateSettlementPrice",
8
+ CommunityPoolSpendV2 = "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend",
9
+ SoftwareUpgradeV2 = "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
10
+ CancelSoftwareUpgradeV2 = "/cosmos.upgrade.v1beta1.MsgCancelUpgrade",
11
+ CreateAlliance = "/alliance.alliance.MsgCreateAllianceProposal",
12
+ UpdateAlliance = "/alliance.alliance.MsgUpdateAllianceProposal",
13
+ DeleteAlliance = "/alliance.alliance.MsgDeleteAllianceProposal",
14
+ CreateAllianceV2 = "/alliance.alliance.MsgCreateAlliance",
15
+ UpdateAllianceV2 = "/alliance.alliance.MsgUpdateAlliance",
16
+ DeleteAllianceV2 = "/alliance.alliance.MsgDeleteAlliance",
20
17
  ClientUpdateProposal = "/ibc.core.client.v1.ClientUpdateProposal",
18
+ UpdateMarket = "/Switcheo.carbon.market.UpdateMarketProposal",
19
+ UpdateMarketV2 = "/Switcheo.carbon.market.MsgUpdateMarket",
20
+ SetMsgGasCost = "/Switcheo.carbon.fee.SetMsgGasCostProposal",
21
+ SetMinGasPrice = "/Switcheo.carbon.fee.SetMinGasPriceProposal",
22
+ RemoveMsgGasCost = "/Switcheo.carbon.fee.RemoveMsgGasCostProposal",
23
+ RemoveMinGasPrice = "/Switcheo.carbon.fee.RemoveMinGasPriceProposal",
24
+ SetMsgGasCostV2 = "/Switcheo.carbon.fee.MsgSetGasCost",
25
+ SetMinGasPriceV2 = "/Switcheo.carbon.fee.MsgSetMinGasPrice",
26
+ RemoveMsgGasCostV2 = "/Switcheo.carbon.fee.MsgRemoveGasCost",
27
+ RemoveMinGasPriceV2 = "/Switcheo.carbon.fee.MsgRemoveMinGasPrice",
28
+ UpdatePool = "/Switcheo.carbon.liquiditypool.UpdatePoolProposal",
29
+ SetRewardCurve = "/Switcheo.carbon.liquiditypool.SetRewardCurveProposal",
30
+ SetRewardsWeights = "/Switcheo.carbon.liquiditypool.SetRewardsWeightsProposal",
31
+ SetCommitmentCurve = "/Switcheo.carbon.liquiditypool.SetCommitmentCurveProposal",
32
+ UpdatePoolV2 = "/Switcheo.carbon.liquiditypool.MsgUpdatePool",
33
+ SetRewardCurveV2 = "/Switcheo.carbon.liquiditypool.MsgSetRewardCurve",
34
+ SetRewardsWeightsV2 = "/Switcheo.carbon.liquiditypool.MsgSetRewardsWeights",
35
+ SetCommitmentCurveV2 = "/Switcheo.carbon.liquiditypool.MsgSetCommitmentCurve",
36
+ SettlementPrice = "/Switcheo.carbon.pricing.SettlementPriceProposal",
37
+ SettlementPriceV2 = "/Switcheo.carbon.pricing.MsgUpdateSettlementPrice",
38
+ CreateOracle = "/Switcheo.carbon.oracle.CreateOracleProposal",
39
+ CreateOracleV2 = "/Switcheo.carbon.oracle.MsgCreateOracle",
40
+ CreateToken = "/Switcheo.carbon.coin.CreateTokenProposal",
21
41
  CreateGroup = "/Switcheo.carbon.coin.CreateGroupProposal",
22
42
  UpdateGroup = "/Switcheo.carbon.coin.UpdateGroupProposal",
23
43
  RegisterToGroup = "/Switcheo.carbon.coin.RegisterToGroupProposal",
24
44
  DeregisterFromGroup = "/Switcheo.carbon.coin.DeregisterFromGroupProposal",
25
45
  DepositToGroup = "/Switcheo.carbon.coin.DepositToGroupProposal",
26
46
  WithdrawFromGroup = "/Switcheo.carbon.coin.WithdrawFromGroupProposal",
27
- UpdateGroupTokenConfig = "/Switcheo.carbon.coin.UpdateGroupTokenConfigProposal",
28
- CreateAlliance = "/alliance.alliance.MsgCreateAllianceProposal",
29
- UpdateAlliance = "/alliance.alliance.MsgUpdateAllianceProposal",
30
- DeleteAlliance = "/alliance.alliance.MsgDeleteAllianceProposal"
47
+ UpdateGroupTokenConfig = "/Switcheo.carbon.coin.UpdateGroupTokenConfigProposal"
31
48
  }
32
49
  export interface PropDecoded {
33
50
  typeUrl: string;
package/lib/util/gov.js CHANGED
@@ -2,31 +2,73 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decodeContent = exports.emptyProposal = exports.ProposalTypes = void 0;
4
4
  const CarbonSDK_1 = require("../CarbonSDK");
5
+ const tx_1 = require("../codec/Switcheo/carbon/fee/tx");
5
6
  const distribution_1 = require("../codec/cosmos/distribution/v1beta1/distribution");
7
+ const tx_2 = require("../codec/cosmos/distribution/v1beta1/tx");
8
+ const tx_3 = require("../codec/cosmos/gov/v1/tx");
6
9
  const gov_1 = require("../codec/cosmos/gov/v1beta1/gov");
7
10
  const params_1 = require("../codec/cosmos/params/v1beta1/params");
11
+ const tx_4 = require("../codec/cosmos/upgrade/v1beta1/tx");
8
12
  const upgrade_1 = require("../codec/cosmos/upgrade/v1beta1/upgrade");
9
13
  const client_1 = require("../codec/ibc/core/client/v1/client");
10
14
  var ProposalTypes;
11
15
  (function (ProposalTypes) {
16
+ // cosmos v1
12
17
  ProposalTypes["ParameterChange"] = "/cosmos.params.v1beta1.ParameterChangeProposal";
13
18
  ProposalTypes["SoftwareUpgrade"] = "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal";
14
19
  ProposalTypes["CancelSoftwareUpgrade"] = "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal";
15
20
  ProposalTypes["CommunityPoolSpend"] = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal";
16
21
  ProposalTypes["Text"] = "/cosmos.gov.v1beta1.TextProposal";
17
- ProposalTypes["SetMsgGasCost"] = "/Switcheo.carbon.fee.MsgSetGasCost";
18
- ProposalTypes["SetMinGasPrice"] = "/Switcheo.carbon.fee.MsgSetMinGasPrice";
19
- ProposalTypes["RemoveMsgGasCost"] = "/Switcheo.carbon.fee.MsgRemoveGasCost";
20
- ProposalTypes["RemoveMinGasPrice"] = "/Switcheo.carbon.fee.MsgRemoveMinGasPrice";
21
- ProposalTypes["CreateToken"] = "/Switcheo.carbon.coin.CreateTokenProposal";
22
- ProposalTypes["CreateOracle"] = "/Switcheo.carbon.oracle.MsgCreateOracle";
23
- ProposalTypes["UpdatePool"] = "/Switcheo.carbon.liquiditypool.MsgUpdatePool";
24
- ProposalTypes["SetRewardCurve"] = "/Switcheo.carbon.liquiditypool.MsgSetRewardCurve";
25
- ProposalTypes["SetRewardsWeights"] = "/Switcheo.carbon.liquiditypool.MsgSetRewardsWeights";
26
- ProposalTypes["SetCommitmentCurve"] = "/Switcheo.carbon.liquiditypool.MsgSetCommitmentCurve";
27
- ProposalTypes["UpdateMarket"] = "/Switcheo.carbon.market.MsgUpdateMarket";
28
- ProposalTypes["SettlementPrice"] = "/Switcheo.carbon.pricing.MsgUpdateSettlementPrice";
22
+ // cosmos v2
23
+ ProposalTypes["CommunityPoolSpendV2"] = "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend";
24
+ ProposalTypes["SoftwareUpgradeV2"] = "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade";
25
+ ProposalTypes["CancelSoftwareUpgradeV2"] = "/cosmos.upgrade.v1beta1.MsgCancelUpgrade";
26
+ // alliance v1
27
+ ProposalTypes["CreateAlliance"] = "/alliance.alliance.MsgCreateAllianceProposal";
28
+ ProposalTypes["UpdateAlliance"] = "/alliance.alliance.MsgUpdateAllianceProposal";
29
+ ProposalTypes["DeleteAlliance"] = "/alliance.alliance.MsgDeleteAllianceProposal";
30
+ // alliance v2
31
+ ProposalTypes["CreateAllianceV2"] = "/alliance.alliance.MsgCreateAlliance";
32
+ ProposalTypes["UpdateAllianceV2"] = "/alliance.alliance.MsgUpdateAlliance";
33
+ ProposalTypes["DeleteAllianceV2"] = "/alliance.alliance.MsgDeleteAlliance";
34
+ // ibc v1
29
35
  ProposalTypes["ClientUpdateProposal"] = "/ibc.core.client.v1.ClientUpdateProposal";
36
+ // ibc v2
37
+ // to be added in next cosmos upgrade
38
+ // market v1
39
+ ProposalTypes["UpdateMarket"] = "/Switcheo.carbon.market.UpdateMarketProposal";
40
+ // market v2
41
+ ProposalTypes["UpdateMarketV2"] = "/Switcheo.carbon.market.MsgUpdateMarket";
42
+ // fee v1
43
+ ProposalTypes["SetMsgGasCost"] = "/Switcheo.carbon.fee.SetMsgGasCostProposal";
44
+ ProposalTypes["SetMinGasPrice"] = "/Switcheo.carbon.fee.SetMinGasPriceProposal";
45
+ ProposalTypes["RemoveMsgGasCost"] = "/Switcheo.carbon.fee.RemoveMsgGasCostProposal";
46
+ ProposalTypes["RemoveMinGasPrice"] = "/Switcheo.carbon.fee.RemoveMinGasPriceProposal";
47
+ // fee v2
48
+ ProposalTypes["SetMsgGasCostV2"] = "/Switcheo.carbon.fee.MsgSetGasCost";
49
+ ProposalTypes["SetMinGasPriceV2"] = "/Switcheo.carbon.fee.MsgSetMinGasPrice";
50
+ ProposalTypes["RemoveMsgGasCostV2"] = "/Switcheo.carbon.fee.MsgRemoveGasCost";
51
+ ProposalTypes["RemoveMinGasPriceV2"] = "/Switcheo.carbon.fee.MsgRemoveMinGasPrice";
52
+ // lp v1
53
+ ProposalTypes["UpdatePool"] = "/Switcheo.carbon.liquiditypool.UpdatePoolProposal";
54
+ ProposalTypes["SetRewardCurve"] = "/Switcheo.carbon.liquiditypool.SetRewardCurveProposal";
55
+ ProposalTypes["SetRewardsWeights"] = "/Switcheo.carbon.liquiditypool.SetRewardsWeightsProposal";
56
+ ProposalTypes["SetCommitmentCurve"] = "/Switcheo.carbon.liquiditypool.SetCommitmentCurveProposal";
57
+ // lp v2
58
+ ProposalTypes["UpdatePoolV2"] = "/Switcheo.carbon.liquiditypool.MsgUpdatePool";
59
+ ProposalTypes["SetRewardCurveV2"] = "/Switcheo.carbon.liquiditypool.MsgSetRewardCurve";
60
+ ProposalTypes["SetRewardsWeightsV2"] = "/Switcheo.carbon.liquiditypool.MsgSetRewardsWeights";
61
+ ProposalTypes["SetCommitmentCurveV2"] = "/Switcheo.carbon.liquiditypool.MsgSetCommitmentCurve";
62
+ // pricing v1
63
+ ProposalTypes["SettlementPrice"] = "/Switcheo.carbon.pricing.SettlementPriceProposal";
64
+ // pricing v2
65
+ ProposalTypes["SettlementPriceV2"] = "/Switcheo.carbon.pricing.MsgUpdateSettlementPrice";
66
+ // oracle v1
67
+ ProposalTypes["CreateOracle"] = "/Switcheo.carbon.oracle.CreateOracleProposal";
68
+ // oracle v2
69
+ ProposalTypes["CreateOracleV2"] = "/Switcheo.carbon.oracle.MsgCreateOracle";
70
+ // coin v1
71
+ ProposalTypes["CreateToken"] = "/Switcheo.carbon.coin.CreateTokenProposal";
30
72
  ProposalTypes["CreateGroup"] = "/Switcheo.carbon.coin.CreateGroupProposal";
31
73
  ProposalTypes["UpdateGroup"] = "/Switcheo.carbon.coin.UpdateGroupProposal";
32
74
  ProposalTypes["RegisterToGroup"] = "/Switcheo.carbon.coin.RegisterToGroupProposal";
@@ -34,9 +76,6 @@ var ProposalTypes;
34
76
  ProposalTypes["DepositToGroup"] = "/Switcheo.carbon.coin.DepositToGroupProposal";
35
77
  ProposalTypes["WithdrawFromGroup"] = "/Switcheo.carbon.coin.WithdrawFromGroupProposal";
36
78
  ProposalTypes["UpdateGroupTokenConfig"] = "/Switcheo.carbon.coin.UpdateGroupTokenConfigProposal";
37
- ProposalTypes["CreateAlliance"] = "/alliance.alliance.MsgCreateAllianceProposal";
38
- ProposalTypes["UpdateAlliance"] = "/alliance.alliance.MsgUpdateAllianceProposal";
39
- ProposalTypes["DeleteAlliance"] = "/alliance.alliance.MsgDeleteAllianceProposal";
40
79
  })(ProposalTypes = exports.ProposalTypes || (exports.ProposalTypes = {}));
41
80
  exports.emptyProposal = {
42
81
  typeUrl: "",
@@ -46,49 +85,207 @@ const decodeContent = (content) => {
46
85
  if (!content) {
47
86
  return exports.emptyProposal;
48
87
  }
49
- switch (content.typeUrl) {
88
+ let url = content.typeUrl;
89
+ let value = content.value;
90
+ if (url == CarbonSDK_1.CarbonTx.Types.MsgGovExecLegacyContent) {
91
+ // wrapper msg for legacy prop, actual proposal is nested within this
92
+ const wrapperMsg = tx_3.MsgExecLegacyContent.decode(content.value);
93
+ url = wrapperMsg.content.typeUrl;
94
+ value = wrapperMsg.content.value;
95
+ }
96
+ switch (url) {
50
97
  case ProposalTypes.ParameterChange:
51
- return Object.assign(Object.assign({}, content), { value: params_1.ParameterChangeProposal.decode(content.value) });
98
+ return {
99
+ typeUrl: url,
100
+ value: params_1.ParameterChangeProposal.decode(value),
101
+ };
52
102
  case ProposalTypes.SoftwareUpgrade:
53
- return Object.assign(Object.assign({}, content), { value: upgrade_1.SoftwareUpgradeProposal.decode(content.value) });
103
+ return {
104
+ typeUrl: url,
105
+ value: upgrade_1.SoftwareUpgradeProposal.decode(value),
106
+ };
54
107
  case ProposalTypes.CancelSoftwareUpgrade:
55
- return Object.assign(Object.assign({}, content), { value: upgrade_1.CancelSoftwareUpgradeProposal.decode(content.value) });
108
+ return {
109
+ typeUrl: url,
110
+ value: upgrade_1.CancelSoftwareUpgradeProposal.decode(value),
111
+ };
56
112
  case ProposalTypes.CommunityPoolSpend:
57
- return Object.assign(Object.assign({}, content), { value: distribution_1.CommunityPoolSpendProposal.decode(content.value) });
113
+ return {
114
+ typeUrl: url,
115
+ value: distribution_1.CommunityPoolSpendProposal.decode(value),
116
+ };
58
117
  case ProposalTypes.Text:
59
- return Object.assign(Object.assign({}, content), { value: gov_1.TextProposal.decode(content.value) });
118
+ return {
119
+ typeUrl: url,
120
+ value: gov_1.TextProposal.decode(value),
121
+ };
60
122
  case ProposalTypes.UpdatePool:
61
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Liquiditypool.UpdatePoolProposal.decode(content.value) });
123
+ return {
124
+ typeUrl: url,
125
+ value: CarbonSDK_1.Carbon.Liquiditypool.UpdatePoolProposal.decode(value),
126
+ };
62
127
  case ProposalTypes.CreateOracle:
63
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Oracle.CreateOracleProposal.decode(content.value) });
128
+ return {
129
+ typeUrl: url,
130
+ value: CarbonSDK_1.Carbon.Oracle.CreateOracleProposal.decode(value),
131
+ };
64
132
  case ProposalTypes.CreateToken:
65
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Coin.CreateTokenProposal.decode(content.value) });
133
+ return {
134
+ typeUrl: url,
135
+ value: CarbonSDK_1.Carbon.Coin.CreateTokenProposal.decode(value),
136
+ };
66
137
  case ProposalTypes.SetCommitmentCurve:
67
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Liquiditypool.SetCommitmentCurveProposal.decode(content.value) });
138
+ return {
139
+ typeUrl: url,
140
+ value: CarbonSDK_1.Carbon.Liquiditypool.SetCommitmentCurveProposal.decode(value),
141
+ };
68
142
  case ProposalTypes.SetMsgGasCost:
69
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Fee.SetMsgGasCostProposal.decode(content.value) });
143
+ return {
144
+ typeUrl: url,
145
+ value: CarbonSDK_1.Carbon.Fee.SetMsgGasCostProposal.decode(value),
146
+ };
70
147
  case ProposalTypes.SetMinGasPrice:
71
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Fee.SetMinGasPriceProposal.decode(content.value) });
148
+ return {
149
+ typeUrl: url,
150
+ value: CarbonSDK_1.Carbon.Fee.SetMinGasPriceProposal.decode(value),
151
+ };
72
152
  case ProposalTypes.RemoveMsgGasCost:
73
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Fee.RemoveMsgGasCostProposal.decode(content.value) });
153
+ return {
154
+ typeUrl: url,
155
+ value: CarbonSDK_1.Carbon.Fee.RemoveMsgGasCostProposal.decode(value),
156
+ };
74
157
  case ProposalTypes.RemoveMinGasPrice:
75
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Fee.RemoveMinGasPriceProposal.decode(content.value) });
158
+ return {
159
+ typeUrl: url,
160
+ value: CarbonSDK_1.Carbon.Fee.RemoveMinGasPriceProposal.decode(value),
161
+ };
76
162
  case ProposalTypes.SetRewardCurve:
77
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Liquiditypool.SetRewardCurveProposal.decode(content.value) });
163
+ return {
164
+ typeUrl: url,
165
+ value: CarbonSDK_1.Carbon.Liquiditypool.SetRewardCurveProposal.decode(value),
166
+ };
78
167
  case ProposalTypes.SetRewardsWeights:
79
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Liquiditypool.SetRewardsWeightsProposal.decode(content.value) });
168
+ return {
169
+ typeUrl: url,
170
+ value: CarbonSDK_1.Carbon.Liquiditypool.SetRewardsWeightsProposal.decode(value),
171
+ };
80
172
  case ProposalTypes.SettlementPrice:
81
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Pricing.SettlementPriceProposal.decode(content.value) });
173
+ return {
174
+ typeUrl: url,
175
+ value: CarbonSDK_1.Carbon.Pricing.SettlementPriceProposal.decode(value),
176
+ };
82
177
  case ProposalTypes.UpdateMarket:
83
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Market.UpdateMarketProposal.decode(content.value) });
178
+ return {
179
+ typeUrl: url,
180
+ value: CarbonSDK_1.Carbon.Market.UpdateMarketProposal.decode(value),
181
+ };
84
182
  case ProposalTypes.ClientUpdateProposal:
85
- return Object.assign(Object.assign({}, content), { value: client_1.ClientUpdateProposal.decode(content.value) });
183
+ return {
184
+ typeUrl: url,
185
+ value: client_1.ClientUpdateProposal.decode(value),
186
+ };
86
187
  case ProposalTypes.CreateAlliance:
87
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Alliance.MsgCreateAllianceProposal.decode(content.value) });
188
+ return {
189
+ typeUrl: url,
190
+ value: CarbonSDK_1.Carbon.Alliance.MsgCreateAllianceProposal.decode(value),
191
+ };
88
192
  case ProposalTypes.UpdateAlliance:
89
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Alliance.MsgUpdateAllianceProposal.decode(content.value) });
193
+ return {
194
+ typeUrl: url,
195
+ value: CarbonSDK_1.Carbon.Alliance.MsgUpdateAllianceProposal.decode(value),
196
+ };
90
197
  case ProposalTypes.DeleteAlliance:
91
- return Object.assign(Object.assign({}, content), { value: CarbonSDK_1.Carbon.Alliance.MsgDeleteAllianceProposal.decode(content.value) });
198
+ return {
199
+ typeUrl: url,
200
+ value: CarbonSDK_1.Carbon.Alliance.MsgDeleteAllianceProposal.decode(value),
201
+ };
202
+ // update with new proposal messages
203
+ case ProposalTypes.SetMsgGasCostV2:
204
+ return {
205
+ typeUrl: url,
206
+ value: CarbonSDK_1.Carbon.Fee.MsgSetGasCost.decode(value),
207
+ };
208
+ case ProposalTypes.SetMinGasPriceV2:
209
+ return {
210
+ typeUrl: url,
211
+ value: CarbonSDK_1.Carbon.Fee.MsgSetMinGasPrice.decode(value),
212
+ };
213
+ case ProposalTypes.RemoveMsgGasCostV2:
214
+ return {
215
+ typeUrl: url,
216
+ value: CarbonSDK_1.Carbon.Fee.MsgRemoveGasCost.decode(value),
217
+ };
218
+ case ProposalTypes.RemoveMinGasPriceV2:
219
+ return {
220
+ typeUrl: url,
221
+ value: tx_1.MsgRemoveMinGasPrice.decode(value),
222
+ };
223
+ case ProposalTypes.CommunityPoolSpendV2:
224
+ return {
225
+ typeUrl: url,
226
+ value: tx_2.MsgCommunityPoolSpend.decode(value),
227
+ };
228
+ case ProposalTypes.SoftwareUpgradeV2:
229
+ return {
230
+ typeUrl: url,
231
+ value: tx_4.MsgSoftwareUpgrade.decode(value),
232
+ };
233
+ case ProposalTypes.CancelSoftwareUpgradeV2:
234
+ return {
235
+ typeUrl: url,
236
+ value: tx_4.MsgCancelUpgrade.decode(value),
237
+ };
238
+ case ProposalTypes.CreateAllianceV2:
239
+ return {
240
+ typeUrl: url,
241
+ value: CarbonSDK_1.Carbon.Alliance.MsgCreateAlliance.decode(value),
242
+ };
243
+ case ProposalTypes.UpdateAllianceV2:
244
+ return {
245
+ typeUrl: url,
246
+ value: CarbonSDK_1.Carbon.Alliance.MsgUpdateAlliance.decode(value),
247
+ };
248
+ case ProposalTypes.DeleteAllianceV2:
249
+ return {
250
+ typeUrl: url,
251
+ value: CarbonSDK_1.Carbon.Alliance.MsgDeleteAlliance.decode(value),
252
+ };
253
+ case ProposalTypes.UpdateMarketV2:
254
+ return {
255
+ typeUrl: url,
256
+ value: CarbonSDK_1.Carbon.Market.MsgUpdateMarket.decode(value),
257
+ };
258
+ case ProposalTypes.UpdatePoolV2:
259
+ return {
260
+ typeUrl: url,
261
+ value: CarbonSDK_1.Carbon.Liquiditypool.MsgUpdatePool.decode(value),
262
+ };
263
+ case ProposalTypes.SetRewardCurveV2:
264
+ return {
265
+ typeUrl: url,
266
+ value: CarbonSDK_1.Carbon.Liquiditypool.MsgSetRewardCurve.decode(value),
267
+ };
268
+ case ProposalTypes.SetRewardsWeightsV2:
269
+ return {
270
+ typeUrl: url,
271
+ value: CarbonSDK_1.Carbon.Liquiditypool.MsgSetRewardsWeights.decode(value),
272
+ };
273
+ case ProposalTypes.SetCommitmentCurveV2:
274
+ return {
275
+ typeUrl: url,
276
+ value: CarbonSDK_1.Carbon.Liquiditypool.MsgSetCommitmentCurve.decode(value),
277
+ };
278
+ // TODO: update this in next PR once codec has been regenerated
279
+ // case ProposalTypes.SettlementPriceV2:
280
+ // return {
281
+ // typeUrl: url,
282
+ // value: Carbon.Pricing.MsgUpdateSettlementPrice.decode(value),
283
+ // }
284
+ case ProposalTypes.CreateOracleV2:
285
+ return {
286
+ typeUrl: url,
287
+ value: CarbonSDK_1.Carbon.Oracle.MsgCreateOracle.decode(value),
288
+ };
92
289
  default:
93
290
  return exports.emptyProposal;
94
291
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.5-beta.1",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",