# Is there some analogue ow web3.js in Secret Network?

**URL:** https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035
**Category:** Developer Help
**Created:** [December 16, 2021, 8:55pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035 "2021-12-16T20:55:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![justToAsk](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@justToAsk](https://forum.scrt.network/u/justToAsk)
#### Post date: [December 16, 2021, 8:55pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/1 "2021-12-16T20:55:29Z")

</div>

is there some analogue ow web3.js in Secret Network? And if yes is there any example of how to get token balance? Thanks!

---

<div class="post-metadata">

### Author: ![deweloprela](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/deweloprela/32/3080_2.png) [@deweloprela](https://forum.scrt.network/u/deweloprela)
#### Post date: [February 15, 2022, 10:22pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/2 "2022-02-15T22:22:17Z")

</div>

i have created secretjs.js with browserify but when i trying to connect to node i get:  
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [https://api.secretapi.io/node\_info](https://api.secretapi.io/node_info). (Reason: CORS request did not succeed)

the code i use is

> const main = async () =\> {  
> // Create connection to DataHub Secret Network node  
> const client = new secretjs.CosmWasmClient(‘[https://api.secretapi.io/](https://api.secretapi.io/)’)
> 
> ```
> // Query chain ID
> const chainId = await client.getChainId()
> 
> // Query chain height
> const height = await client.getHeight()
> 
> console.log("ChainId:", chainId);
> console.log("Block height:", height);
> 
> console.log('Successfully connected to Secret Network');
> 
> ```
> 
> }
> 
> main().then(resp =\> {  
> console.log(resp);  
> }).catch(err =\> {  
> console.log(err);  
> })

what i can do?

---

<div class="post-metadata">

### Author: ![assafmo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/assafmo/32/440_2.png) [@assafmo](https://forum.scrt.network/u/assafmo)
#### Post date: [February 15, 2022, 10:44pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/3 "2022-02-15T22:44:24Z")

</div>

Hi guys, please checkout [GitHub - scrtlabs/secret.js: The JavaScript SDK for Secret Network](https://github.com/scrtlabs/secret.js)

CORS errors is something that you need to sort out with your node provider.

---

<div class="post-metadata">

### Author: ![deweloprela](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/deweloprela/32/3080_2.png) [@deweloprela](https://forum.scrt.network/u/deweloprela)
#### Post date: [February 17, 2022, 5:40pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/4 "2022-02-17T17:40:47Z")

</div>

Hello, Thanks for your answer. One more question is there any RPC service (like infura for ETH) that i can use? Thanks!

---

<div class="post-metadata">

### Author: ![assafmo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/assafmo/32/440_2.png) [@assafmo](https://forum.scrt.network/u/assafmo)
#### Post date: [February 17, 2022, 5:44pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/5 "2022-02-17T17:44:05Z")

</div>

Yes, [Secret Network DataHub - Figment - Building Web 3](https://www.figment.io/datahub/secret-network)

---

<div class="post-metadata">

### Author: ![deweloprela](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/deweloprela/32/3080_2.png) [@deweloprela](https://forum.scrt.network/u/deweloprela)
#### Post date: [February 18, 2022, 9:12pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/6 "2022-02-18T21:12:24Z")

</div>

Ok i give up, what i trying to achieve is simply check wallet balance with javascript to do so i trying to use this code:

> const main = async () =\> {  
> // Create connection to DataHub Secret Network node  
> console.log(‘before connection’);  
> const client = new secretjs.CosmWasmClient(‘[http://chainofsecrets.secrettestnet.io:26657/](http://chainofsecrets.secrettestnet.io:26657/)’)
> 
> console.log(‘after connection’);  
> // Query chain ID  
> const chainId = await client.getChainId()
> 
> ```
> // Query chain height
> const height = await client.getHeight()
> console.log(walletAddress);
> const account = await client.getAccount(walletAddress);
> 
> console.log("ChainId:", chainId);
> console.log("Block height:", height);
> console.log("Account", account);
> 
> console.log('Successfully connected to Secret Network');
> 
> ```
> 
> }
> 
> main().then(resp =\> {  
> console.log(resp);  
> }).catch(err =\> {  
> console.log(err);  
> })

i have tried every RPC url i can find on internet the only that worked was :[http://bootstrap.supernova.enigma.co:1317](http://bootstrap.supernova.enigma.co:1317)  
but this one for testnet. Where i can find mainnet RPC node url? Thanks!

---

<div class="post-metadata">

### Author: ![assafmo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/assafmo/32/440_2.png) [@assafmo](https://forum.scrt.network/u/assafmo)
#### Post date: [February 19, 2022, 7:21am UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/7 "2022-02-19T07:21:59Z")

</div>

With that version of secretjs you need to use the LCD endpoint, you got one in your figment account

---

<div class="post-metadata">

### Author: ![deweloprela](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/deweloprela/32/3080_2.png) [@deweloprela](https://forum.scrt.network/u/deweloprela)
#### Post date: [February 19, 2022, 1:37pm UTC](https://forum.scrt.network/t/is-there-some-analogue-ow-web3-js-in-secret-network/5035/8 "2022-02-19T13:37:55Z")

</div>

Works) THANKS Assafmo!
