hyperweb-io / hyperweb-io/cosmos-kit
`getCosmWasmClient` throws error on custom chain
- Dominant language
- TypeScript
- Stars
- 201
- Forks
- 159
- PR merge metrics
- No merged PRs in 30d
Description
Hello. I am facing an issue with the method `getCosmWasmClient` from the `useChain` hook.
For starters, I am using my own chain with a custom config.
Here's the ChainProvider code (obfuscated):
```typescript
{
return {
aminoTypes: myAminoTypes,
registry: registry,
gasPrice: GasPrice.fromString(`${DEFAULT_GAS_PRICE}${MY_DENOM}`),
};
},
signingCosmwasm: () => {
return {
gasPrice: GasPrice.fromString(`${DEFAULT_GAS_PRICE}${MY_DENOM}`),
};
},
preferredSignType: () => "amino",
}}
endpointOptions={{
endpoints: {
[MY_CHAIN.chain_name]: {
rpc: [MY_CHAIN.apis!.rpc![0].address],
rest: [MY_CHAIN.apis!.rest![0].address],
},
},
}}
>
{children}
```
Calling `const { getCosmWasmClient } = useChain(MY_CHAIN.chain_name);` from the component and then trying to use `getCosmWasmClient` does not work. I get the following error:
```log
Uncaught (in promise) Something wrong! Probably no valid RPC endpoint for chain my-chain
```
The interesting part is that `getStargateClient` works perfectly fine. It connects to my endpoints and I can even sign transactions normally. The problem is only with the `getCosmWasmClient`. It also throws a lot (hundreds) of errors like this:
```log
Access to XMLHttpRequest at 'https://rpc.cosmos.directory/my-chain' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
```
It appears it is not using the endpoints I configured for cosmwasm, only for the regular stargate.
I am using v2.18.0.
Any help is much appreciated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.