hyperweb-io / hyperweb-io/ts-codegen
No query helpers generated for string queries
- 主要言語
- TypeScript
- スター
- 126
- フォーク
- 31
- 平均マージ
- 19分
- マージ済み PR(30日)
- 2
説明
If we have a query like this:
```rust
#[returns(Config)]
GetConfig,
```
The client will not generate a query helper for it, rather just ignore it (unless i missed an option for it)
Tho it will recognize it as a type in the types file:
```ts
export type QueryMsg = "get_admin" | "get_config" ...
```
But that doesn't help much, as the general query of the `SigningCosmWasmClient` function doesn't know those types, so its not really giving me any type checks.
1. The preferred way for me:
To generate a simple helpers for those queries as well, will make it a lot easier to use.
2. Less preferred way
Generate a general query message specific to the schema, this at least will give us some type checks as the general query function will accept the contract specific `QueryMsg` and not just `any`.
Something like:
```ts
query = async (msg: QueryMsg): Promise => {
return this.client.queryContractSmart(this.contractAddress, msg);
};
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
#[returns(Config)] エントリがどのように QueryMsg 型と生成されたクエリヘルパーになるかを追跡することから始め、次にその経路を SigningCosmWasmClient の queryContractSmart 呼び出しと比較します。string クエリにヘルパーを提供すべきか、それともスキーマ固有の QueryMsg クエリメソッドを提供すべきかを判断します。完了条件は、生成されたクライアントがこれらのクエリに型チェックされたアクセスを提供することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust, typescript
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100