Skip to content
This repository has been archived by the owner on Apr 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #29 from cosmostation/develop
Browse files Browse the repository at this point in the history
bug fixed
  • Loading branch information
Booyoun authored Jan 13, 2020
2 parents e91553f + 66f4b6d commit f459698
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: [
Expand All @@ -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: [
Expand Down
29 changes: 19 additions & 10 deletions test/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f459698

Please sign in to comment.