Skip to content

Commit 02e63e1

Browse files
authored
Merge pull request #99 from Zetazzz/refactor
Refactor
2 parents 5760791 + d91a4f6 commit 02e63e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5987
-178
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
8+
import { Coin, StdFee } from "@cosmjs/amino";
9+
import { ExecuteMsg, Binary, InstantiateMsg, QueryMsg } from "./CwAdminFactory.types";
10+
export interface CwAdminFactoryReadOnlyInterface {
11+
contractAddress: string;
12+
}
13+
export class CwAdminFactoryQueryClient implements CwAdminFactoryReadOnlyInterface {
14+
client: CosmWasmClient;
15+
contractAddress: string;
16+
17+
constructor(client: CosmWasmClient, contractAddress: string) {
18+
this.client = client;
19+
this.contractAddress = contractAddress;
20+
}
21+
22+
}
23+
export interface CwAdminFactoryInterface {
24+
contractAddress: string;
25+
sender: string;
26+
instantiateContractWithSelfAdmin: ({
27+
codeId,
28+
instantiateMsg,
29+
label
30+
}: {
31+
codeId: number;
32+
instantiateMsg: Binary;
33+
label: string;
34+
}, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
35+
}
36+
export class CwAdminFactoryClient implements CwAdminFactoryInterface {
37+
client: SigningCosmWasmClient;
38+
sender: string;
39+
contractAddress: string;
40+
41+
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
42+
this.client = client;
43+
this.sender = sender;
44+
this.contractAddress = contractAddress;
45+
this.instantiateContractWithSelfAdmin = this.instantiateContractWithSelfAdmin.bind(this);
46+
}
47+
48+
instantiateContractWithSelfAdmin = async ({
49+
codeId,
50+
instantiateMsg,
51+
label
52+
}: {
53+
codeId: number;
54+
instantiateMsg: Binary;
55+
label: string;
56+
}, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
57+
return await this.client.execute(this.sender, this.contractAddress, {
58+
instantiate_contract_with_self_admin: {
59+
code_id: codeId,
60+
instantiate_msg: instantiateMsg,
61+
label
62+
}
63+
}, fee, memo, funds);
64+
};
65+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
import { Coin } from "@cosmjs/amino";
8+
import { MsgExecuteContractEncodeObject } from "cosmwasm";
9+
import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx";
10+
import { toUtf8 } from "@cosmjs/encoding";
11+
import { ExecuteMsg, Binary, InstantiateMsg, QueryMsg } from "./CwAdminFactory.types";
12+
export interface CwAdminFactoryMessage {
13+
contractAddress: string;
14+
sender: string;
15+
instantiateContractWithSelfAdmin: ({
16+
codeId,
17+
instantiateMsg,
18+
label
19+
}: {
20+
codeId: number;
21+
instantiateMsg: Binary;
22+
label: string;
23+
}, funds?: Coin[]) => MsgExecuteContractEncodeObject;
24+
}
25+
export class CwAdminFactoryMessageComposer implements CwAdminFactoryMessage {
26+
sender: string;
27+
contractAddress: string;
28+
29+
constructor(sender: string, contractAddress: string) {
30+
this.sender = sender;
31+
this.contractAddress = contractAddress;
32+
this.instantiateContractWithSelfAdmin = this.instantiateContractWithSelfAdmin.bind(this);
33+
}
34+
35+
instantiateContractWithSelfAdmin = ({
36+
codeId,
37+
instantiateMsg,
38+
label
39+
}: {
40+
codeId: number;
41+
instantiateMsg: Binary;
42+
label: string;
43+
}, funds?: Coin[]): MsgExecuteContractEncodeObject => {
44+
return {
45+
typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract",
46+
value: MsgExecuteContract.fromPartial({
47+
sender: this.sender,
48+
contract: this.contractAddress,
49+
msg: toUtf8(JSON.stringify({
50+
instantiate_contract_with_self_admin: {
51+
code_id: codeId,
52+
instantiate_msg: instantiateMsg,
53+
label
54+
}
55+
})),
56+
funds
57+
})
58+
};
59+
};
60+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
import { ExecuteMsg, Binary, InstantiateMsg, QueryMsg } from "./CwAdminFactory.types";
8+
import { CamelCasedProperties } from "type-fest";
9+
export abstract class CwAdminFactoryExecuteMsgBuilder {
10+
static instantiateContractWithSelfAdmin = ({
11+
codeId,
12+
instantiateMsg,
13+
label
14+
}: CamelCasedProperties<Extract<ExecuteMsg, {
15+
instantiate_contract_with_self_admin: unknown;
16+
}>["instantiate_contract_with_self_admin"]>): ExecuteMsg => {
17+
return {
18+
instantiate_contract_with_self_admin: ({
19+
code_id: codeId,
20+
instantiate_msg: instantiateMsg,
21+
label
22+
} as const)
23+
};
24+
};
25+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
import { UseQueryOptions } from "react-query";
8+
import { ExecuteMsg, Binary, InstantiateMsg, QueryMsg } from "./CwAdminFactory.types";
9+
import { CwAdminFactoryQueryClient } from "./CwAdminFactory.client";
10+
export interface CwAdminFactoryReactQuery<TResponse, TData = TResponse> {
11+
client: CwAdminFactoryQueryClient;
12+
options?: UseQueryOptions<TResponse, Error, TData>;
13+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
import { selectorFamily } from "recoil";
8+
import { cosmWasmClient } from "./chain";
9+
import { ExecuteMsg, Binary, InstantiateMsg, QueryMsg } from "./CwAdminFactory.types";
10+
import { CwAdminFactoryQueryClient } from "./CwAdminFactory.client";
11+
type QueryClientParams = {
12+
contractAddress: string;
13+
};
14+
export const queryClient = selectorFamily<CwAdminFactoryQueryClient, QueryClientParams>({
15+
key: "cwAdminFactoryQueryClient",
16+
get: ({
17+
contractAddress
18+
}) => ({
19+
get
20+
}) => {
21+
const client = get(cosmWasmClient);
22+
return new CwAdminFactoryQueryClient(client, contractAddress);
23+
}
24+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* This file was automatically generated by @cosmwasm/ts-codegen@latest.
3+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4+
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
5+
*/
6+
7+
export type ExecuteMsg = {
8+
instantiate_contract_with_self_admin: {
9+
code_id: number;
10+
instantiate_msg: Binary;
11+
label: string;
12+
[k: string]: unknown;
13+
};
14+
};
15+
export type Binary = string;
16+
export interface InstantiateMsg {
17+
[k: string]: unknown;
18+
}
19+
export type QueryMsg = string;

0 commit comments

Comments
 (0)