-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from cosmology-tech/fix-dots-in-type
Fix dots in type
- Loading branch information
Showing
33 changed files
with
2,559 additions
and
130 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,33 @@ | ||
/** | ||
* This file and any referenced files were automatically generated by @cosmology/telescope@latest | ||
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain | ||
* and run the transpile command or yarn proto command to regenerate this bundle. | ||
*/ | ||
|
||
import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' | ||
import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; | ||
|
||
const _rpcClients: Record<string, ProtobufRpcClient> = {}; | ||
|
||
export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { | ||
if (typeof rpcEndpoint === 'string') { | ||
return rpcEndpoint; | ||
} else if (!!rpcEndpoint) { | ||
//@ts-ignore | ||
return rpcEndpoint.url; | ||
} | ||
} | ||
|
||
export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { | ||
const key = getRpcEndpointKey(rpcEndpoint); | ||
if (!key) return; | ||
if (_rpcClients.hasOwnProperty(key)) { | ||
return _rpcClients[key]; | ||
} | ||
const tmClient = await Tendermint34Client.connect(rpcEndpoint); | ||
//@ts-ignore | ||
const client = new QueryClient(tmClient); | ||
const rpc = createProtobufRpcClient(client); | ||
_rpcClients[key] = rpc; | ||
return rpc; | ||
} |
223 changes: 223 additions & 0 deletions
223
__fixtures__/misc/output/google/api/expr/v1alpha1/eval.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,223 @@ | ||
import { BinaryReader, BinaryWriter } from "../../../../binary"; | ||
import { DeepPartial, isSet } from "../../../../helpers"; | ||
export const protobufPackage = "google.api.expr.v1alpha1"; | ||
export interface ExprValue { | ||
/** The ids of the expressions with unknown values. */ | ||
exprs: IdRef[]; | ||
} | ||
export interface ExprValueProtoMsg { | ||
typeUrl: "/google.api.expr.v1alpha1.ExprValue"; | ||
value: Uint8Array; | ||
} | ||
export interface ExprValueAmino { | ||
/** The ids of the expressions with unknown values. */ | ||
exprs: IdRefAmino[]; | ||
} | ||
export interface ExprValueAminoMsg { | ||
type: "/google.api.expr.v1alpha1.ExprValue"; | ||
value: ExprValueAmino; | ||
} | ||
export interface ExprValueSDKType { | ||
exprs: IdRefSDKType[]; | ||
} | ||
export interface IdRef { | ||
/** The expression id. */ | ||
id: number; | ||
} | ||
export interface IdRefProtoMsg { | ||
typeUrl: "/google.api.expr.v1alpha1.IdRef"; | ||
value: Uint8Array; | ||
} | ||
export interface IdRefAmino { | ||
/** The expression id. */ | ||
id: number; | ||
} | ||
export interface IdRefAminoMsg { | ||
type: "/google.api.expr.v1alpha1.IdRef"; | ||
value: IdRefAmino; | ||
} | ||
export interface IdRefSDKType { | ||
id: number; | ||
} | ||
function createBaseExprValue(): ExprValue { | ||
return { | ||
exprs: [] | ||
}; | ||
} | ||
export const ExprValue = { | ||
encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { | ||
for (const v of message.exprs) { | ||
IdRef.encode(v!, writer.uint32(10).fork()).ldelim(); | ||
} | ||
return writer; | ||
}, | ||
decode(input: BinaryReader | Uint8Array, length?: number): ExprValue { | ||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseExprValue(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.exprs.push(IdRef.decode(reader, reader.uint32())); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
fromJSON(object: any): ExprValue { | ||
return { | ||
exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromJSON(e)) : [] | ||
}; | ||
}, | ||
toJSON(message: ExprValue): unknown { | ||
const obj: any = {}; | ||
if (message.exprs) { | ||
obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); | ||
} else { | ||
obj.exprs = []; | ||
} | ||
return obj; | ||
}, | ||
fromPartial(object: DeepPartial<ExprValue>): ExprValue { | ||
const message = createBaseExprValue(); | ||
message.exprs = object.exprs?.map(e => IdRef.fromPartial(e)) || []; | ||
return message; | ||
}, | ||
fromSDK(object: ExprValueSDKType): ExprValue { | ||
return { | ||
exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromSDK(e)) : [] | ||
}; | ||
}, | ||
fromSDKJSON(object: any): ExprValueSDKType { | ||
return { | ||
exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromSDKJSON(e)) : [] | ||
}; | ||
}, | ||
toSDK(message: ExprValue): ExprValueSDKType { | ||
const obj: any = {}; | ||
if (message.exprs) { | ||
obj.exprs = message.exprs.map(e => e ? IdRef.toSDK(e) : undefined); | ||
} else { | ||
obj.exprs = []; | ||
} | ||
return obj; | ||
}, | ||
fromAmino(object: ExprValueAmino): ExprValue { | ||
return { | ||
exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromAmino(e)) : [] | ||
}; | ||
}, | ||
toAmino(message: ExprValue): ExprValueAmino { | ||
const obj: any = {}; | ||
if (message.exprs) { | ||
obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); | ||
} else { | ||
obj.exprs = []; | ||
} | ||
return obj; | ||
}, | ||
fromAminoMsg(object: ExprValueAminoMsg): ExprValue { | ||
return ExprValue.fromAmino(object.value); | ||
}, | ||
fromProtoMsg(message: ExprValueProtoMsg): ExprValue { | ||
return ExprValue.decode(message.value); | ||
}, | ||
toProto(message: ExprValue): Uint8Array { | ||
return ExprValue.encode(message).finish(); | ||
}, | ||
toProtoMsg(message: ExprValue): ExprValueProtoMsg { | ||
return { | ||
typeUrl: "/google.api.expr.v1alpha1.ExprValue", | ||
value: ExprValue.encode(message).finish() | ||
}; | ||
} | ||
}; | ||
function createBaseIdRef(): IdRef { | ||
return { | ||
id: 0 | ||
}; | ||
} | ||
export const IdRef = { | ||
encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { | ||
if (message.id !== 0) { | ||
writer.uint32(8).int32(message.id); | ||
} | ||
return writer; | ||
}, | ||
decode(input: BinaryReader | Uint8Array, length?: number): IdRef { | ||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseIdRef(); | ||
while (reader.pos < end) { | ||
const tag = reader.uint32(); | ||
switch (tag >>> 3) { | ||
case 1: | ||
message.id = reader.int32(); | ||
break; | ||
default: | ||
reader.skipType(tag & 7); | ||
break; | ||
} | ||
} | ||
return message; | ||
}, | ||
fromJSON(object: any): IdRef { | ||
return { | ||
id: isSet(object.id) ? Number(object.id) : 0 | ||
}; | ||
}, | ||
toJSON(message: IdRef): unknown { | ||
const obj: any = {}; | ||
message.id !== undefined && (obj.id = Math.round(message.id)); | ||
return obj; | ||
}, | ||
fromPartial(object: DeepPartial<IdRef>): IdRef { | ||
const message = createBaseIdRef(); | ||
message.id = object.id ?? 0; | ||
return message; | ||
}, | ||
fromSDK(object: IdRefSDKType): IdRef { | ||
return { | ||
id: object?.id | ||
}; | ||
}, | ||
fromSDKJSON(object: any): IdRefSDKType { | ||
return { | ||
id: isSet(object.id) ? Number(object.id) : 0 | ||
}; | ||
}, | ||
toSDK(message: IdRef): IdRefSDKType { | ||
const obj: any = {}; | ||
obj.id = message.id; | ||
return obj; | ||
}, | ||
fromAmino(object: IdRefAmino): IdRef { | ||
return { | ||
id: object.id | ||
}; | ||
}, | ||
toAmino(message: IdRef): IdRefAmino { | ||
const obj: any = {}; | ||
obj.id = message.id; | ||
return obj; | ||
}, | ||
fromAminoMsg(object: IdRefAminoMsg): IdRef { | ||
return IdRef.fromAmino(object.value); | ||
}, | ||
fromProtoMsg(message: IdRefProtoMsg): IdRef { | ||
return IdRef.decode(message.value); | ||
}, | ||
toProto(message: IdRef): Uint8Array { | ||
return IdRef.encode(message).finish(); | ||
}, | ||
toProtoMsg(message: IdRef): IdRefProtoMsg { | ||
return { | ||
typeUrl: "/google.api.expr.v1alpha1.IdRef", | ||
value: IdRef.encode(message).finish() | ||
}; | ||
} | ||
}; |
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,10 @@ | ||
import * as _0 from "./api/expr/v1alpha1/eval"; | ||
export namespace google { | ||
export namespace api { | ||
export namespace expr { | ||
export const v1alpha1 = { | ||
..._0 | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.