Giter Club home page Giter Club logo

cosmosjs's People

Contributors

allcontributors[bot] avatar atmoner avatar dependabot[bot] avatar jaybxyz avatar levackt avatar okwme avatar pgrimaud avatar scottburch avatar soaryong-c avatar tonyfeung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cosmosjs's Issues

Internal error with codespace undefined while broadcasting transaction

Hi,

We get an internal error while broadcasting a tx.

Here is our signedTx :

signedTx = {
"tx": {
"msg": stdSignMsg.msg,
"fee": stdSignMsg.fee,
"signatures": [
{
"signature": signatureBase64,
"pub_key": getPubKeyBase64(ecpairPriv)
}
],
"memo": stdSignMsg.memo
},
"mode": "block"
}

The response while broadcasting is:

{
height: '0',
txhash: '6EC99CB505644B8B515B5D130A693FD84F8FCF122BE720F114D93E91D773CABE',
codespace: 'undefined',
code: 111222,
raw_log: 'internal error',
gas_used: '6408'
}

returning checkTx false

Can we get same pub_key from the blockchain and CosmosJS for a signedTx? Right now, we are getting 2 different keys listed as below:

from CosmosJS {"pub_key":"A3LntVjxVBwPyMV1hSi3iFdlAj1mKRtsicozGzqkP5g8"}
from the blockchain {"pub_key":"61rphyEDcue1WPFUHA/IxXWFKLeIV2UCPWYpG2yJyjMbOqQ/mDw="}

'unauthorized: signature verification failed; verify correct account sequence and chain-id

I am using your lib in one of my projects and randomly get

'unauthorized: signature verification failed; verify correct account sequence and chain-id

I get the sequence by


    cosmos.getAccounts(address).then(data => {




     const stdSignMsg = cosmos.newStdMsg({
        msgs: [{
            type: "veroblockchain/CreateOrder",
            value: {
                ID: String(mysql_id),
                creator: String(address),
                company_id: String(company_id),
                user_id:String( user_id),
                data: String(jsonData)
            }
        }
        ],
        chain_id: chainId,
        fee: { amount: [{ amount: String(11), denom: "token" }], gas: String(200000) },
        memo: "",
        account_number: String(data.result.value.account_number),
        sequence: String(data.result.value.sequence)
    });

  

What can be the reason? Too fast sending the requests for the same account?

Iris send signing

Hello 👋

I am trying to create a send transaction on the irishub with cosmosjs.
On the example it shows how to create a transaction
https://github.com/cosmostation/cosmosjs/blob/master/example/irishub.js

let stdSignMsg = iris.newStdMsg({
	msgs: [
		{
			type: "irishub/bank/Send",
			value: {
				inputs: [
					{
						address: address,
						coins: [
							{
								denom: "iris-atto",
								amount: String(1000000000000000000)		// 18 decimal places
							}
						]
					}
				],
				outputs: [
					{
						address: "iaa12g4vfyq65yf5cds4v5pr3jmdd4v6s40fkaaxtf",
						coins: [
							{
								denom: "iris-atto",
								amount: String(1000000000000000000)
							}
						]
					}
				]
			}
		}
	],
	chain_id: chainId,
	fee: { amount: [ { amount: String(400000000000000000), denom: "iris-atto" } ], gas: String(50000) }, 
        // ☝️  Fee is outside of msgs
	memo: "",
	account_number: String(data.result.value.account_number),
	sequence: String(data.result.value.sequence)
});

In the source code index.js the fee is referenced as part of the msgs array first object

fee: { amount: [ { amount: input.msgs[0].fee.amount[0].amount, denom: input.msgs[0].fee.amount[0].denom } ], gas: input.msgs[0].fee.gas },

Therefore trying to use the example throws

TypeError: Cannot read property 'amount' of undefined
at Cosmos.newStdMsg (node_modules/@cosmostation/cosmosjs/src/index.js:150:49)

One of the approaches seem to be off, could you adapt the example or the code to the correct case? Or am I doing something wrong? Thank you

Hi I how can I test this in testnet?

I've a testnet address cosmos199uttp2xjt90zl5t2unu289ghmt5yt536u2vkz can you please tell me what will be lcdUrl and chain-id?

Can I generate or derive addresses from a public key (HD wallet) using this library?

Thanks

README Deprecation

Hello, this is deprecated within the README

Cosmostation offers LCD url(https://lcd-cosmos-free.cosmostation.io).

This rest server URL may be disabled at any time. In order to maintain stable blockchain service, it is recommended to prepare your rest server.
Setting up the rest server: (https://hub.cosmos.network/master/resources/service-providers.html#setting-up-the-rest-server)

Crypto has been deprecated

This package is still using the crypto package from npm, which has been replaced by a builtin module and is deprecated.

Unable to Broasdcast StdTX

let stdSignMsg = cosmos.newStdMsg({
msgs: [
{
type: 'cosmos-sdk/MsgSend',
value: {
amount: [
{
amount: '10',
denom: 'fmt',
},
],
from_address: ffHubAddress,
to_address: ffHubAddress,
},
},
],
chain_id: chainId,
fee: {
amount: [{
amount: '10',
denom: 'fmt',
}],
gas: '200',
},
memo: '',
account_number: {"${decoded.value.account_number}"},
sequence: {"${decoded.value.sequence}"},
});

Response:

code: 18
codespace: "sdk"
gas_used: "6408"
height: "0"
raw_log: "must contain at least one message: invalid request"
txhash: "127F087017E3D4ED59D06F536B0168224E910AB20AC07E966B9D3FB43023FB4F"

How to sign a tx which is base64 encoded

for e.g I have tx

{"tx":"dCgoFqkKQqijYZoKFCl4tYVGksrxfotXJ8UcqL7XQi6REhRXZEl+uFUvJYKj/5RMcBx+RvPu4hoQCgV1bW91bhIHMjAwMDAwMBIRCgsKBXVtb3VuEgI1MBDAmgwiF1NlbnQgdmlhIENvc21vcyBWb3lhZ2Vy"}

how to sign it or is there any method to decode it and then use parameters in sign.

Sort object before converting sign msg to bytes

I noticed that I ran into a signing verification error when my msg contains an object (like sdk.Coins, which is an array of objects). Because JSON'ifying an object is non-deterministic, the bytes array isn't deterministic when signing a message.

The binance chain JS code sorts the object as seen here. https://github.com/binance-chain/javascript-sdk/blob/75d955eecb6357940f4b3085821a1edbe22513b5/src/encoder/index.js#L72

Maybe this code base should do something similar.

Decode unconfirmed txs

Is there any way,in js, to decode transactions from mempool (base64)? by get request .../unconfirmed_txs?limit=10000.

txs: [ 0AEoKBapCjCMTXENChS7INS+K/6dQM0sSyiD8DeTauS5VxIUuyDUviv+nUDNLEsog/A3k2rkuVcKGs0ydLMKFLsg1L4r/p1AzSxLKIPwN5Nq5LlXEhAKCgoFdWF0b20SATEQwJoMGmoKJuta6YchAsz2BVSsf/5JQzFzxwvlmvKkl58M6ezWciRoF3XKo3pcEkAuhLiloqCWyw5bcLgzdWthQ6pt5GmbRKjTw4bWdGMTfSQ1rmv7Xx+PH8HS7O8K/TeLeAI6of2F9BUYfaSfeUe6 " ]

Problem with bip39

Hello and thank you for your lib!
I have encountered a problem since the update to 0.10, there is a problem with the bip39 class, the call made by the Cosmos class to bip39 returns this error:

Screenshot_20210514_184919

When I look in the source of src/index.js, line 38, I do a console.log(bip39), like:

Screenshot_20210514_185359

I have this result:

Screenshot_20210514_185628

I notice right away that the class starts with "Default", just add default to each call of bip39, bip32 and bech32
Like this:

Screenshot_20210514_185812

I forked the project, I made the changes and everything works (atmoner@ead38c0)!
Do you want me to do a pull request?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.