Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 247 additions & 0 deletions __fixtures__/issues/98/out/98.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
import { StdFee } from "@cosmjs/amino";
import { Uint128, InstantiateMsg, Coin, ExecuteMsg, InstallableExecMsg, Binary, ExecMsg, QueryMsg, InstallableQueryMsg, QueryMsg1, ConfigResponse, NullablePlugin, CanonicalAddr, Plugin, PluginsResponse } from "./98.types";
export interface 98ReadOnlyInterface {
contractAddress: string;
getConfig: () => Promise<ConfigResponse>;
getPlugins: ({
limit,
startAfter
}: {
limit?: number;
startAfter?: number;
}) => Promise<PluginsResponse>;
getPluginById: ({
id
}: {
id: number;
}) => Promise<NullablePlugin>;
}
export class 98QueryClient implements 98ReadOnlyInterface {
client: CosmWasmClient;
contractAddress: string;

constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client;
this.contractAddress = contractAddress;
this.getConfig = this.getConfig.bind(this);
this.getPlugins = this.getPlugins.bind(this);
this.getPluginById = this.getPluginById.bind(this);
}

getConfig = async (): Promise<ConfigResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_config: {}
});
};
getPlugins = async ({
limit,
startAfter
}: {
limit?: number;
startAfter?: number;
}): Promise<PluginsResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_plugins: {
limit,
start_after: startAfter
}
});
};
getPluginById = async ({
id
}: {
id: number;
}): Promise<NullablePlugin> => {
return this.client.queryContractSmart(this.contractAddress, {
get_plugin_by_id: {
id
}
});
};
}
export interface 98Interface extends 98ReadOnlyInterface {
contractAddress: string;
sender: string;
proxyInstallPlugin: ({
id,
instantiateMsg
}: {
id: number;
instantiateMsg: Binary;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
registerPlugin: ({
checksum,
codeId,
creator,
ipfsHash,
name,
version
}: {
checksum: string;
codeId: number;
creator: string;
ipfsHash: string;
name: string;
version: string;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
unregisterPlugin: ({
id
}: {
id: number;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
updatePlugin: ({
checksum,
codeId,
creator,
id,
ipfsHash,
name,
version
}: {
checksum?: string;
codeId?: number;
creator?: string;
id: number;
ipfsHash?: string;
name?: string;
version?: string;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
updateRegistryFee: ({
newFee
}: {
newFee: Coin;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
updateDaoAddr: ({
newAddr
}: {
newAddr: string;
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
}
export class 98Client extends 98QueryClient implements 98Interface {
client: SigningCosmWasmClient;
sender: string;
contractAddress: string;

constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress);
this.client = client;
this.sender = sender;
this.contractAddress = contractAddress;
this.proxyInstallPlugin = this.proxyInstallPlugin.bind(this);
this.registerPlugin = this.registerPlugin.bind(this);
this.unregisterPlugin = this.unregisterPlugin.bind(this);
this.updatePlugin = this.updatePlugin.bind(this);
this.updateRegistryFee = this.updateRegistryFee.bind(this);
this.updateDaoAddr = this.updateDaoAddr.bind(this);
}

proxyInstallPlugin = async ({
id,
instantiateMsg
}: {
id: number;
instantiateMsg: Binary;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
proxy_install_plugin: {
id,
instantiate_msg: instantiateMsg
}
}, fee, memo, funds);
};
registerPlugin = async ({
checksum,
codeId,
creator,
ipfsHash,
name,
version
}: {
checksum: string;
codeId: number;
creator: string;
ipfsHash: string;
name: string;
version: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
register_plugin: {
checksum,
code_id: codeId,
creator,
ipfs_hash: ipfsHash,
name,
version
}
}, fee, memo, funds);
};
unregisterPlugin = async ({
id
}: {
id: number;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
unregister_plugin: {
id
}
}, fee, memo, funds);
};
updatePlugin = async ({
checksum,
codeId,
creator,
id,
ipfsHash,
name,
version
}: {
checksum?: string;
codeId?: number;
creator?: string;
id: number;
ipfsHash?: string;
name?: string;
version?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_plugin: {
checksum,
code_id: codeId,
creator,
id,
ipfs_hash: ipfsHash,
name,
version
}
}, fee, memo, funds);
};
updateRegistryFee = async ({
newFee
}: {
newFee: Coin;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_registry_fee: {
new_fee: newFee
}
}, fee, memo, funds);
};
updateDaoAddr = async ({
newAddr
}: {
newAddr: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_dao_addr: {
new_addr: newAddr
}
}, fee, memo, funds);
};
}
50 changes: 50 additions & 0 deletions __fixtures__/issues/98/out/98.react-query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import { UseQueryOptions, useQuery } from "react-query";
import { Uint128, InstantiateMsg, Coin, ExecuteMsg, InstallableExecMsg, Binary, ExecMsg, QueryMsg, InstallableQueryMsg, QueryMsg1, ConfigResponse, NullablePlugin, CanonicalAddr, Plugin, PluginsResponse } from "./98.types";
import { 98QueryClient } from "./98.client";
export interface 98ReactQuery<TResponse, TData = TResponse> {
client: 98QueryClient;
options?: UseQueryOptions<TResponse, Error, TData>;
}
export interface 98GetPluginByIdQuery<TData> extends 98ReactQuery<NullablePlugin, TData> {
args: {
id: number;
};
}
export function use98GetPluginByIdQuery<TData = NullablePlugin>({
client,
args,
options
}: 98GetPluginByIdQuery<TData>) {
return useQuery<NullablePlugin, Error, TData>(["98GetPluginById", client.contractAddress, JSON.stringify(args)], () => client.getPluginById({
id: args.id
}), options);
}
export interface 98GetPluginsQuery<TData> extends 98ReactQuery<PluginsResponse, TData> {
args: {
limit?: number;
startAfter?: number;
};
}
export function use98GetPluginsQuery<TData = PluginsResponse>({
client,
args,
options
}: 98GetPluginsQuery<TData>) {
return useQuery<PluginsResponse, Error, TData>(["98GetPlugins", client.contractAddress, JSON.stringify(args)], () => client.getPlugins({
limit: args.limit,
startAfter: args.startAfter
}), options);
}
export interface 98GetConfigQuery<TData> extends 98ReactQuery<ConfigResponse, TData> {}
export function use98GetConfigQuery<TData = ConfigResponse>({
client,
options
}: 98GetConfigQuery<TData>) {
return useQuery<ConfigResponse, Error, TData>(["98GetConfig", client.contractAddress], () => client.getConfig(), options);
}
Loading