diff --git a/package.json b/package.json index 5076a09..942a192 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cosmostation/cosmosjs", - "version": "0.5.0", + "version": "0.5.1", "description": "A JavasSript Open Source Library for Cosmos Network, IRISnet and Kava", "main": "./src/index.js", "repository": { diff --git a/src/index.js b/src/index.js index f5dc9c8..efc875c 100644 --- a/src/index.js +++ b/src/index.js @@ -114,7 +114,7 @@ Cosmos.prototype.newStdMsg = function(input) { stdSignMsg.json = input; // Exception - if (input.msg[0].type == "irishub/bank/Send") { + if (input.msgs[0].type == "irishub/bank/Send") { stdSignMsg.jsonForSigningIrisTx = { msgs: [ @@ -149,7 +149,7 @@ Cosmos.prototype.newStdMsg = function(input) { account_number: input.msgs[0].account_number, sequence: input.msgs[0].sequence } - } else if (input.msg[0].type == "irishub/stake/BeginUnbonding") { + } else if (input.msgs[0].type == "irishub/stake/BeginUnbonding") { stdSignMsg.jsonForSigningIrisTx = { msgs: [ @@ -165,7 +165,7 @@ Cosmos.prototype.newStdMsg = function(input) { account_number: input.msgs[0].account_number, sequence: input.msgs[0].sequence } - } else if (input.msg[0].type == "irishub/stake/BeginRedelegate") { + } else if (input.msgs[0].type == "irishub/stake/BeginRedelegate") { stdSignMsg.jsonForSigningIrisTx = { msgs: [ diff --git a/test/test.spec.js b/test/test.spec.js index 85eb4e1..cda076c 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -24,17 +24,26 @@ describe("sign", function () { ecpairPriv = cosmos.getECPairPriv(mnemonic); let stdSignMsg = cosmos.newStdMsg({ - type: "cosmos-sdk/MsgSend", - from_address: address, - to_address: "cosmos18vhdczjut44gpsy804crfhnd5nq003nz0nf20v", - amountDenom: "uatom", - amount: 100000, // 6 decimal places (1000000 uatom = 1 ATOM) - feeDenom: "uatom", - fee: 5000, - gas: 200000, + msgs: [ + { + type: "cosmos-sdk/MsgSend", + value: { + amount: [ + { + amount: String(100000), // 6 decimal places (1000000 uatom = 1 ATOM) + denom: "uatom" + } + ], + from_address: address, + to_address: "cosmos18vhdczjut44gpsy804crfhnd5nq003nz0nf20v" + } + } + ], + chain_id: chainId, + fee: { amount: [ { amount: String(5000), denom: "uatom" } ], gas: String(200000) }, memo: "", - account_number: 5711, - sequence: 4 + account_number: String(5711), + sequence: String(4) }); signedTx = cosmos.sign(stdSignMsg, ecpairPriv);