cosmwasm / cosmwasmjs Goto Github PK
View Code? Open in Web Editor NEWSource of the cosmwasm npm package
Home Page: https://cosmwasm.github.io/CosmWasmJS/
License: Apache License 2.0
Source of the cosmwasm npm package
Home Page: https://cosmwasm.github.io/CosmWasmJS/
License: Apache License 2.0
Those are not the focus of this project
There's been a lot of updates since the last release, including pretty core functionality like executeMultiple()
Gentle reminder to release with upgraded deps :)
(my use case for this isn't so much the stated goal of the Readme which is "to help new developers get started with their first dApps", but rather to import the JS needed in a project that loads the JS via regular script tag and doesn't have a bundler)
I have cosmwasm smart contracts on the Osmosis side chain. I want to be able to interact with the contract from my Javascript application using the contract abi. the docs provide a way to query the read only methods using the CosmWasm client, but I don't see a way to instantiate the contract in my Javascript app using the abi and listen or subscribe to events emitted by the contract.
Please help or point to the right docs that helps me does this.
Having an UMD module allows web developers to get started with a plain HTML page and a script tag. No bundler needed. Since we have a single package here (in conntrast to CosmJS), it would be great to try this out.
This has been requested at cosmos/cosmjs#998. Also Terra.js in the browser shows how this can be offered to the user. Being able to use CosmWasmJS in a jsfiddle seems like an interesting opportunity we get with this.
It would be great to have all exported symbols of the package visible in one file. For this, can we make the *s in
Lines 1 to 13 in a2a013a
Maybe we should remove all the .ts files that only re-export CosmJS types and do that in the main index file directly.
basic example in docs goes:
const rpcEndpoint = "https://rpc.cliffnet.cosmwasm.com:443/";
async function main() {
const client = await CosmWasmClient.connect(rpcEndpoint);
console.log(client);
}
I've tried to log const height = await client.getBlock()
and got 386,152.
According to https://gaia.bigdipper.live , block height of stargate-final (testnet) is 2,832,763 and https://cosmos.bigdipper.live shows 9,506,024 for cosmoshub-4 mainnet. What am I missing? What's this "386,152"?
What endpoint should I use for testnet? For mainnet? I've found that https://stargate.cosmos.network/testnet states that public RPC endpoint is 34.71.170.158:26657. I've tried both const rpcEndpoint = "http://34.71.170.158:26657/";
and https version and got Error: connect ECONNREFUSED 34.71.170.158:26657
for each.
bufferutil pulls in node-gyp-build, which is for building native code. Most likely we don't want any of those in here.
It was added in #27. Was that on purpose?
We try to use the newest CosmWasmJS (1.1.1) to connect to newest Wasmd (taken from main branch). Transaction gets committed successfully on chain but as a response we get this error in the client:
/Users/msedzinski/git/client/node_modules/base64-js/index.js:26
[1] throw new Error('Invalid string. Length must be a multiple of 4')
I think the error is related to those issues (already closed):
cosmos/cosmos-sdk#11997
ping-pub/faucet#4
Solution, mentioned there, is to update cosmjs client.
Are there any plans to do that anytime soon?
CosmWasmJS 1.1.1
Wasmd - main branch
CosmJS - 0.28 (which seems to be to old)
1] /Users/msedzinski/git/wasp-viaterna-client/node_modules/base64-js/index.js:26
[1] throw new Error('Invalid string. Length must be a multiple of 4')
[1] ^
[1]
[1] Error: Invalid string. Length must be a multiple of 4
[1] at getLens (/Users/msedzinski/git/wasp-viaterna-client/node_modules/base64-js/index.js:26:11)
[1] at Object.toByteArray (/Users/msedzinski/git/wasp-viaterna-client/node_modules/base64-js/index.js:55:14)
[1] at fromBase64 (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/encoding/build/base64.js:32:21)
[1] at decodeAttribute (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:40:40)
[1] at Array.map (<anonymous>)
[1] at decodeAttributes (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:45:53)
[1] at decodeEvent (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:50:40)
[1] at Array.map (<anonymous>)
[1] at decodeEvents (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:55:49)
[1] at decodeTxData (/Users/msedzinski/git/wasp-viaterna-client/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:63:31)
It should be in https://github.com/CosmWasm to make clear this is part of the CosmWasm story.
This probably means the repo needs to become public
While the provided example is very simple to understand,
I think this page is missing the configuration to make it run from a browser (webpack etc).
Could someone publish the tsconfig.json, webpack.config.js and the command to run this from a browser? Then it will really be beginner friendly.
After #48
I am getting this error gRPC requires HTTP/2
when trying to connect to a normal RPC endpoint using the following code:
CosmWasmClient.connect(this.network.chainInfo.rpc);
ideally something that can be started with npx cosmwasm
Here's what I've tried:
const rpcEndpoint = "https://rpc.cosmos.network/";
const client = CosmWasmClient.connect(rpcEndpoint);
const someAddressFromMainnet = "cosmos1l0znsvddllw9knha3yx2svnlxny676d8ns7uys";
const txs = await client.searchTx({
sentFromOrTo: someAddressFromMainnet,
});
Explorer shows that the account exists and has participated a number of txs, but I'm getting the 502 error.
Is it me doing something wrongly or CosmWasmJS/mainnet public RPC/explorer's problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.