Skip to content

Commit

Permalink
Merge branch 'tx-revamp-dev' of https://github.com/crypto-org-chain/c…
Browse files Browse the repository at this point in the history
…hain-jslib into crypto-org-chain#278/MsgSend-AmountList
  • Loading branch information
cdc-Hitesh committed Jun 16, 2021
2 parents 35b4d60 + cc9a82c commit 916a1dc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/src/transaction/msg/gov/MsgSubmitProposal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ describe('Testing MsgSubmitProposal and its content types', function () {
expect(() => msgSubmitProposalCommunitySpend.toRawAminoMsg()).to.throw('Method not implemented.');
});
describe('fromCosmosJSON', function () {
it('should throw Error if the JSON is not a MsgDeposit', function () {
it('should throw Error if the JSON is not a MsgSubmitProposal', function () {
const json =
'{ "@type": "/cosmos.bank.v1beta1.MsgCreateValidator", "amount": [{ "denom": "basetcro", "amount": "3478499933290496" }], "from_address": "tcro1x07kkkepfj2hl8etlcuqhej7jj6myqrp48y4hg", "to_address": "tcro184lta2lsyu47vwyp2e8zmtca3k5yq85p6c4vp3" }';
expect(() => cro.gov.MsgSubmitProposal.fromCosmosMsgJSON(json, CroNetwork.Testnet)).to.throw(
'Expected /cosmos.gov.v1beta1.MsgSubmitProposal but got /cosmos.bank.v1beta1.MsgCreateValidator',
);
});

it('should return the MsgDeposit corresponding to the JSON', function () {
it('should return the MsgSubmitProposal corresponding to the JSON', function () {
const json =
'{"@type":"/cosmos.gov.v1beta1.MsgSubmitProposal","initial_deposit":[{"denom":"basetcro","amount":"12000000000"}],"content":{"@type":"/cosmos.params.v1beta1.ParameterChangeProposal","changes":[{"subspace":"staking","key":"MaxValidators","value":"12"}],"title":"Change a param to something more optimized","description":"Lorem Ipsum ... The param should be changed to something more optimized"},"proposer":"tcro14sh490wk79dltea4udk95k7mw40wmvf77p0l5a"}';
const MsgDeposit = cro.gov.MsgSubmitProposal.fromCosmosMsgJSON(json, CroNetwork.Testnet);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/transaction/msg/gov/MsgSubmitProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const msgSubmitProposal = function (config: InitConfigurations) {
}

if (!parsedMsg.initial_deposit || parsedMsg.initial_deposit.length !== 1) {
throw new Error('Invalid amount in the Msg.');
throw new Error('Invalid initial_deposit in the Msg.');
}

const cro = CroSDK({ network });
Expand Down
2 changes: 1 addition & 1 deletion lib/src/transaction/msg/staking/MsgBeginRedelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const msgBeginRedelegate = function (config: InitConfigurations) {
delegatorAddress: parsedMsg.delegator_address,
validatorDstAddress: parsedMsg.validator_dst_address,
validatorSrcAddress: parsedMsg.validator_src_address,
// TOdo: Handle the complete list
// TODO: Handle the complete list
amount: cro.Coin.fromCustomAmountDenom(parsedMsg.amount.amount, parsedMsg.amount.denom),
});
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/transaction/msg/staking/MsgCreateValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const msgCreateValidator = function (config: InitConfigurations) {
if (!parsedMsg.description || Object.keys(parsedMsg.description).length < 1) {
throw new Error('Invalid description in the Msg.');
}
// console.debug(parsedMsg.pubkey)

const parsedPubKey: { value?: { [key: string]: number } } = parsedMsg.pubkey as any;

Expand Down

0 comments on commit 916a1dc

Please sign in to comment.