hyperweb-io / hyperweb-io/ts-codegen

No query helpers generated for string queries

Offen
#133 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
126
Forks
31
Ø Merge
19 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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);
};
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start by tracing how #[returns(Config)] entries become QueryMsg types and generated query helpers, then compare that path with the SigningCosmWasmClient queryContractSmart call. Decide whether string queries should receive helpers or a schema-specific QueryMsg query method; done means generated clients provide type-checked access for these queries.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, typescript
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.