CosmWasm / ts-codegen

Convert your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
https://cosmology.zone/products/ts-codegen
Apache License 2.0
116 stars 29 forks source link

Mapping between QueryMsg and QueryResponse #125

Open adairrr opened 1 year ago

adairrr commented 1 year ago

It would be great if we could generate a nice mapping between the query messages and their responses for use in libraries leveraging ts inference.

Example:

export type QueryMsg = {
  simulate_swap: {
    ask_asset: AssetEntry
    dex?: string | null
    offer_asset: AnsAsset
  }
}

export interface SimulateSwapResponse {
  commission: [AssetEntry, Uint128]
  pool: DexAssetPairing
  return_amount: Uint128
  spread_amount: Uint128
}

export type QueryMsgResponses = {
  simulate_swap: SimulateSwapResponse
}