-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5,108 changed files
with
2,046,246 additions
and
11 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Module from './module'; | ||
import { txClient, queryClient, registry } from './module'; | ||
import { msgTypes } from './registry'; | ||
|
||
export * from "./types"; | ||
export { Module, msgTypes, txClient, queryClient, registry }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Generated by Ignite ignite.com/cli | ||
|
||
import { StdFee } from "@cosmjs/launchpad"; | ||
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate"; | ||
import { EncodeObject, GeneratedType, OfflineSigner, Registry } from "@cosmjs/proto-signing"; | ||
import { msgTypes } from './registry'; | ||
import { IgniteClient } from "../client" | ||
import { MissingWalletError } from "../helpers" | ||
import { Api } from "./rest"; | ||
|
||
import { Params as typeParams} from "./types" | ||
|
||
export { }; | ||
|
||
|
||
|
||
export const registry = new Registry(msgTypes); | ||
|
||
type Field = { | ||
name: string; | ||
type: unknown; | ||
} | ||
function getStructure(template) { | ||
const structure: {fields: Field[]} = { fields: [] } | ||
for (let [key, value] of Object.entries(template)) { | ||
let field = { name: key, type: typeof value } | ||
structure.fields.push(field) | ||
} | ||
return structure | ||
} | ||
const defaultFee = { | ||
amount: [], | ||
gas: "200000", | ||
}; | ||
|
||
interface TxClientOptions { | ||
addr: string | ||
prefix: string | ||
signer?: OfflineSigner | ||
} | ||
|
||
export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "http://localhost:26657", prefix: "cosmos" }) => { | ||
|
||
return { | ||
|
||
|
||
} | ||
}; | ||
|
||
interface QueryClientOptions { | ||
addr: string | ||
} | ||
|
||
export const queryClient = ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => { | ||
return new Api({ baseURL: addr }); | ||
}; | ||
|
||
class SDKModule { | ||
public query: ReturnType<typeof queryClient>; | ||
public tx: ReturnType<typeof txClient>; | ||
public structure: Record<string,unknown>; | ||
public registry: Array<[string, GeneratedType]> = []; | ||
|
||
constructor(client: IgniteClient) { | ||
|
||
this.query = queryClient({ addr: client.env.apiURL }); | ||
this.updateTX(client); | ||
this.structure = { | ||
Params: getStructure(typeParams.fromPartial({})), | ||
|
||
}; | ||
client.on('signer-changed',(signer) => { | ||
this.updateTX(client); | ||
}) | ||
} | ||
updateTX(client: IgniteClient) { | ||
const methods = txClient({ | ||
signer: client.signer, | ||
addr: client.env.rpcURL, | ||
prefix: client.env.prefix ?? "cosmos", | ||
}) | ||
|
||
this.tx = methods; | ||
for (let m in methods) { | ||
this.tx[m] = methods[m].bind(this.tx); | ||
} | ||
} | ||
}; | ||
|
||
const Module = (test: IgniteClient) => { | ||
return { | ||
module: { | ||
CheckerzCheckerz: new SDKModule(test) | ||
}, | ||
registry: msgTypes | ||
} | ||
} | ||
export default Module; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { GeneratedType } from "@cosmjs/proto-signing"; | ||
|
||
const msgTypes: Array<[string, GeneratedType]> = [ | ||
|
||
]; | ||
|
||
export { msgTypes } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
/* | ||
* --------------------------------------------------------------- | ||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## | ||
* ## ## | ||
* ## AUTHOR: acacode ## | ||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ## | ||
* --------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Params defines the parameters for the module. | ||
*/ | ||
export type CheckerzParams = object; | ||
|
||
/** | ||
* QueryParamsResponse is response type for the Query/Params RPC method. | ||
*/ | ||
export interface CheckerzQueryParamsResponse { | ||
/** params holds all the parameters of this module. */ | ||
params?: CheckerzParams; | ||
} | ||
|
||
export interface ProtobufAny { | ||
"@type"?: string; | ||
} | ||
|
||
export interface RpcStatus { | ||
/** @format int32 */ | ||
code?: number; | ||
message?: string; | ||
details?: ProtobufAny[]; | ||
} | ||
|
||
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios"; | ||
|
||
export type QueryParamsType = Record<string | number, any>; | ||
|
||
export interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> { | ||
/** set parameter to `true` for call `securityWorker` for this request */ | ||
secure?: boolean; | ||
/** request path */ | ||
path: string; | ||
/** content type of request body */ | ||
type?: ContentType; | ||
/** query params */ | ||
query?: QueryParamsType; | ||
/** format of response (i.e. response.json() -> format: "json") */ | ||
format?: ResponseType; | ||
/** request body */ | ||
body?: unknown; | ||
} | ||
|
||
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">; | ||
|
||
export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> { | ||
securityWorker?: ( | ||
securityData: SecurityDataType | null, | ||
) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void; | ||
secure?: boolean; | ||
format?: ResponseType; | ||
} | ||
|
||
export enum ContentType { | ||
Json = "application/json", | ||
FormData = "multipart/form-data", | ||
UrlEncoded = "application/x-www-form-urlencoded", | ||
} | ||
|
||
export class HttpClient<SecurityDataType = unknown> { | ||
public instance: AxiosInstance; | ||
private securityData: SecurityDataType | null = null; | ||
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"]; | ||
private secure?: boolean; | ||
private format?: ResponseType; | ||
|
||
constructor({ securityWorker, secure, format, ...axiosConfig }: ApiConfig<SecurityDataType> = {}) { | ||
this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "" }); | ||
this.secure = secure; | ||
this.format = format; | ||
this.securityWorker = securityWorker; | ||
} | ||
|
||
public setSecurityData = (data: SecurityDataType | null) => { | ||
this.securityData = data; | ||
}; | ||
|
||
private mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig { | ||
return { | ||
...this.instance.defaults, | ||
...params1, | ||
...(params2 || {}), | ||
headers: { | ||
...(this.instance.defaults.headers || {}), | ||
...(params1.headers || {}), | ||
...((params2 && params2.headers) || {}), | ||
}, | ||
}; | ||
} | ||
|
||
private createFormData(input: Record<string, unknown>): FormData { | ||
return Object.keys(input || {}).reduce((formData, key) => { | ||
const property = input[key]; | ||
formData.append( | ||
key, | ||
property instanceof Blob | ||
? property | ||
: typeof property === "object" && property !== null | ||
? JSON.stringify(property) | ||
: `${property}`, | ||
); | ||
return formData; | ||
}, new FormData()); | ||
} | ||
|
||
public request = async <T = any, _E = any>({ | ||
secure, | ||
path, | ||
type, | ||
query, | ||
format, | ||
body, | ||
...params | ||
}: FullRequestParams): Promise<AxiosResponse<T>> => { | ||
const secureParams = | ||
((typeof secure === "boolean" ? secure : this.secure) && | ||
this.securityWorker && | ||
(await this.securityWorker(this.securityData))) || | ||
{}; | ||
const requestParams = this.mergeRequestParams(params, secureParams); | ||
const responseFormat = (format && this.format) || void 0; | ||
|
||
if (type === ContentType.FormData && body && body !== null && typeof body === "object") { | ||
requestParams.headers.common = { Accept: "*/*" }; | ||
requestParams.headers.post = {}; | ||
requestParams.headers.put = {}; | ||
|
||
body = this.createFormData(body as Record<string, unknown>); | ||
} | ||
|
||
return this.instance.request({ | ||
...requestParams, | ||
headers: { | ||
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), | ||
...(requestParams.headers || {}), | ||
}, | ||
params: query, | ||
responseType: responseFormat, | ||
data: body, | ||
url: path, | ||
}); | ||
}; | ||
} | ||
|
||
/** | ||
* @title checkerz/checkerz/genesis.proto | ||
* @version version not set | ||
*/ | ||
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> { | ||
/** | ||
* No description | ||
* | ||
* @tags Query | ||
* @name QueryParams | ||
* @summary Parameters queries the parameters of the module. | ||
* @request GET:/zetazzz/checker-z/checkerz/params | ||
*/ | ||
queryParams = (params: RequestParams = {}) => | ||
this.request<CheckerzQueryParamsResponse, RpcStatus>({ | ||
path: `/zetazzz/checker-z/checkerz/params`, | ||
method: "GET", | ||
format: "json", | ||
...params, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Params } from "./types/checkerz/checkerz/params" | ||
|
||
|
||
export { | ||
Params, | ||
|
||
} |
74 changes: 74 additions & 0 deletions
74
ts-client/checkerz.checkerz/types/checkerz/checkerz/genesis.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* eslint-disable */ | ||
import _m0 from "protobufjs/minimal"; | ||
import { Params } from "./params"; | ||
|
||
export const protobufPackage = "checkerz.checkerz"; | ||
|
||
/** GenesisState defines the checkerz module's genesis state. */ | ||
export interface GenesisState { | ||
params: Params | undefined; | ||
} | ||
|
||
function createBaseGenesisState(): GenesisState { | ||
return { params: undefined }; | ||
} | ||
|
||
export const GenesisState = { | ||
encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { | ||
if (message.params !== undefined) { | ||
Params.encode(message.params, writer.uint32(10).fork()).ldelim(); | ||
} | ||
return writer; | ||
}, | ||
|
||
decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { | ||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseGenesisState(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.params = Params.decode(reader, reader.uint32()); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
|
||
fromJSON(object: any): GenesisState { | ||
return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; | ||
}, | ||
|
||
toJSON(message: GenesisState): unknown { | ||
const obj: any = {}; | ||
message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); | ||
return obj; | ||
}, | ||
|
||
fromPartial<I extends Exact<DeepPartial<GenesisState>, I>>(object: I): GenesisState { | ||
const message = createBaseGenesisState(); | ||
message.params = (object.params !== undefined && object.params !== null) | ||
? Params.fromPartial(object.params) | ||
: undefined; | ||
return message; | ||
}, | ||
}; | ||
|
||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; | ||
|
||
export type DeepPartial<T> = T extends Builtin ? T | ||
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> | ||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } | ||
: Partial<T>; | ||
|
||
type KeysOfUnion<T> = T extends T ? keyof T : never; | ||
export type Exact<P, I extends P> = P extends Builtin ? P | ||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; | ||
|
||
function isSet(value: any): boolean { | ||
return value !== null && value !== undefined; | ||
} |
Oops, something went wrong.