@hyperweb/telescope 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1529 -0
- package/main/build.js +183 -0
- package/main/builder.js +229 -0
- package/main/bundle.js +162 -0
- package/main/bundler.js +100 -0
- package/main/cli.js +71 -0
- package/main/cmds.js +28 -0
- package/main/commands/download.js +122 -0
- package/main/commands/generate.js +151 -0
- package/main/commands/install.js +143 -0
- package/main/commands/transpile.js +197 -0
- package/main/contracts/generate.js +31 -0
- package/main/contracts/install.js +107 -0
- package/main/contracts/message-composer.js +31 -0
- package/main/contracts/react-query.js +31 -0
- package/main/contracts/recoil.js +31 -0
- package/main/file.js +20 -0
- package/main/generators/create-aggregated-lcd-client.js +87 -0
- package/main/generators/create-all-stargate-clients.js +96 -0
- package/main/generators/create-amino-converters.js +43 -0
- package/main/generators/create-bundle.js +83 -0
- package/main/generators/create-cosmwasm-bundle.js +15 -0
- package/main/generators/create-custom-stargate-clients.js +100 -0
- package/main/generators/create-helpers.js +119 -0
- package/main/generators/create-index.js +75 -0
- package/main/generators/create-lcd-client-all.js +116 -0
- package/main/generators/create-lcd-client-scoped.js +89 -0
- package/main/generators/create-lcd-clients.js +78 -0
- package/main/generators/create-mcp-server.js +1853 -0
- package/main/generators/create-mobx-bundle.js +52 -0
- package/main/generators/create-msg-funcs.js +132 -0
- package/main/generators/create-pinia-store-bundle.js +50 -0
- package/main/generators/create-pinia-store.js +90 -0
- package/main/generators/create-query-funcs.js +133 -0
- package/main/generators/create-react-query-bundle.js +103 -0
- package/main/generators/create-registries.js +49 -0
- package/main/generators/create-root-readme.js +259 -0
- package/main/generators/create-rpc-msg-client-all.js +135 -0
- package/main/generators/create-rpc-msg-client-scoped.js +114 -0
- package/main/generators/create-rpc-msg-clients.js +116 -0
- package/main/generators/create-rpc-ops-bundle.js +119 -0
- package/main/generators/create-rpc-query-client-all.js +137 -0
- package/main/generators/create-rpc-query-client-scoped.js +110 -0
- package/main/generators/create-rpc-query-clients.js +198 -0
- package/main/generators/create-sdk-module-stargate-clients.js +95 -0
- package/main/generators/create-stargate-clients.js +96 -0
- package/main/generators/create-types.js +164 -0
- package/main/generators/customize-utils.js +50 -0
- package/main/helpers/__test__/internalTimestamp.js +49 -0
- package/main/helpers/__test__/internalTimestampBigint.js +45 -0
- package/main/helpers/binary-coder.js +535 -0
- package/main/helpers/decimals.js +111 -0
- package/main/helpers/external-comet.js +52 -0
- package/main/helpers/external-icjs.js +36 -0
- package/main/helpers/external.js +31 -0
- package/main/helpers/grpc-gateway.js +348 -0
- package/main/helpers/grpc-web.js +14 -0
- package/main/helpers/helper-func-types-interface.js +106 -0
- package/main/helpers/helper-func-types.js +93 -0
- package/main/helpers/index.js +38 -0
- package/main/helpers/internal-for-bigint.js +259 -0
- package/main/helpers/internal.js +240 -0
- package/main/helpers/json-safe.js +12 -0
- package/main/helpers/mobx.js +80 -0
- package/main/helpers/pinia-endpoint.js +20 -0
- package/main/helpers/react-query-hooks-icjs.js +223 -0
- package/main/helpers/react-query-hooks.js +258 -0
- package/main/helpers/react-query.js +93 -0
- package/main/helpers/registry-helper.js +229 -0
- package/main/helpers/types-helper.js +165 -0
- package/main/helpers/utf8-helper.js +146 -0
- package/main/helpers/varint.js +486 -0
- package/main/helpers/vue-query-hooks.js +226 -0
- package/main/imports.js +416 -0
- package/main/index.js +24 -0
- package/main/parse.js +194 -0
- package/main/prompt.js +64 -0
- package/main/protod/bufbuild.js +87 -0
- package/main/protod/config.js +30 -0
- package/main/protod/git-repo.js +58 -0
- package/main/protod/index.js +17 -0
- package/main/protod/recursive.js +134 -0
- package/main/protod/types.js +2 -0
- package/main/protod/utils.js +91 -0
- package/main/telescope.js +10 -0
- package/main/types.js +2 -0
- package/main/utils/common-create-bundle.js +29 -0
- package/main/utils/contracts.js +39 -0
- package/main/utils/files.js +138 -0
- package/main/utils/index.js +163 -0
- package/main/utils/unused.js +73 -0
- package/module/build.js +176 -0
- package/module/builder.js +222 -0
- package/module/bundle.js +128 -0
- package/module/bundler.js +96 -0
- package/module/cli.js +44 -0
- package/module/cmds.js +22 -0
- package/module/commands/download.js +94 -0
- package/module/commands/generate.js +123 -0
- package/module/commands/install.js +141 -0
- package/module/commands/transpile.js +169 -0
- package/module/contracts/generate.js +29 -0
- package/module/contracts/install.js +105 -0
- package/module/contracts/message-composer.js +29 -0
- package/module/contracts/react-query.js +29 -0
- package/module/contracts/recoil.js +29 -0
- package/module/file.js +18 -0
- package/module/generators/create-aggregated-lcd-client.js +83 -0
- package/module/generators/create-all-stargate-clients.js +92 -0
- package/module/generators/create-amino-converters.js +39 -0
- package/module/generators/create-bundle.js +79 -0
- package/module/generators/create-cosmwasm-bundle.js +11 -0
- package/module/generators/create-custom-stargate-clients.js +96 -0
- package/module/generators/create-helpers.js +112 -0
- package/module/generators/create-index.js +45 -0
- package/module/generators/create-lcd-client-all.js +89 -0
- package/module/generators/create-lcd-client-scoped.js +62 -0
- package/module/generators/create-lcd-clients.js +74 -0
- package/module/generators/create-mcp-server.js +1849 -0
- package/module/generators/create-mobx-bundle.js +25 -0
- package/module/generators/create-msg-funcs.js +128 -0
- package/module/generators/create-pinia-store-bundle.js +23 -0
- package/module/generators/create-pinia-store.js +86 -0
- package/module/generators/create-query-funcs.js +129 -0
- package/module/generators/create-react-query-bundle.js +76 -0
- package/module/generators/create-registries.js +45 -0
- package/module/generators/create-root-readme.js +255 -0
- package/module/generators/create-rpc-msg-client-all.js +108 -0
- package/module/generators/create-rpc-msg-client-scoped.js +87 -0
- package/module/generators/create-rpc-msg-clients.js +112 -0
- package/module/generators/create-rpc-ops-bundle.js +92 -0
- package/module/generators/create-rpc-query-client-all.js +110 -0
- package/module/generators/create-rpc-query-client-scoped.js +83 -0
- package/module/generators/create-rpc-query-clients.js +198 -0
- package/module/generators/create-sdk-module-stargate-clients.js +91 -0
- package/module/generators/create-stargate-clients.js +92 -0
- package/module/generators/create-types.js +137 -0
- package/module/generators/customize-utils.js +46 -0
- package/module/helpers/__test__/internalTimestamp.js +39 -0
- package/module/helpers/__test__/internalTimestampBigint.js +38 -0
- package/module/helpers/binary-coder.js +531 -0
- package/module/helpers/decimals.js +108 -0
- package/module/helpers/external-comet.js +49 -0
- package/module/helpers/external-icjs.js +33 -0
- package/module/helpers/external.js +28 -0
- package/module/helpers/grpc-gateway.js +345 -0
- package/module/helpers/grpc-web.js +11 -0
- package/module/helpers/helper-func-types-interface.js +102 -0
- package/module/helpers/helper-func-types.js +89 -0
- package/module/helpers/index.js +22 -0
- package/module/helpers/internal-for-bigint.js +255 -0
- package/module/helpers/internal.js +236 -0
- package/module/helpers/json-safe.js +9 -0
- package/module/helpers/mobx.js +77 -0
- package/module/helpers/pinia-endpoint.js +17 -0
- package/module/helpers/react-query-hooks-icjs.js +219 -0
- package/module/helpers/react-query-hooks.js +254 -0
- package/module/helpers/react-query.js +89 -0
- package/module/helpers/registry-helper.js +225 -0
- package/module/helpers/types-helper.js +161 -0
- package/module/helpers/utf8-helper.js +143 -0
- package/module/helpers/varint.js +483 -0
- package/module/helpers/vue-query-hooks.js +222 -0
- package/module/imports.js +382 -0
- package/module/index.js +8 -0
- package/module/parse.js +185 -0
- package/module/prompt.js +58 -0
- package/module/protod/bufbuild.js +76 -0
- package/module/protod/config.js +27 -0
- package/module/protod/git-repo.js +54 -0
- package/module/protod/index.js +1 -0
- package/module/protod/recursive.js +125 -0
- package/module/protod/types.js +1 -0
- package/module/protod/utils.js +77 -0
- package/module/telescope.js +8 -0
- package/module/types.js +1 -0
- package/module/utils/common-create-bundle.js +25 -0
- package/module/utils/contracts.js +33 -0
- package/module/utils/files.js +106 -0
- package/module/utils/index.js +143 -0
- package/module/utils/unused.js +47 -0
- package/package.json +115 -0
- package/src/build.ts +255 -0
- package/src/builder.ts +302 -0
- package/src/bundle.ts +160 -0
- package/src/bundler.ts +153 -0
- package/src/cli.js +51 -0
- package/src/cmds.js +25 -0
- package/src/commands/download.ts +120 -0
- package/src/commands/generate.ts +156 -0
- package/src/commands/install.ts +154 -0
- package/src/commands/transpile.ts +198 -0
- package/src/contracts/generate.ts +33 -0
- package/src/contracts/install.ts +118 -0
- package/src/contracts/message-composer.ts +34 -0
- package/src/contracts/react-query.ts +33 -0
- package/src/contracts/recoil.ts +32 -0
- package/src/file.js +20 -0
- package/src/generators/create-aggregated-lcd-client.ts +133 -0
- package/src/generators/create-all-stargate-clients.ts +121 -0
- package/src/generators/create-amino-converters.ts +62 -0
- package/src/generators/create-bundle.ts +97 -0
- package/src/generators/create-cosmwasm-bundle.ts +17 -0
- package/src/generators/create-custom-stargate-clients.ts +128 -0
- package/src/generators/create-helpers.ts +196 -0
- package/src/generators/create-index.ts +72 -0
- package/src/generators/create-lcd-client-all.ts +139 -0
- package/src/generators/create-lcd-client-scoped.ts +109 -0
- package/src/generators/create-lcd-clients.ts +108 -0
- package/src/generators/create-mcp-server.ts +1902 -0
- package/src/generators/create-mobx-bundle.ts +31 -0
- package/src/generators/create-msg-funcs.ts +219 -0
- package/src/generators/create-pinia-store-bundle.ts +35 -0
- package/src/generators/create-pinia-store.ts +121 -0
- package/src/generators/create-query-funcs.ts +224 -0
- package/src/generators/create-react-query-bundle.ts +111 -0
- package/src/generators/create-registries.ts +70 -0
- package/src/generators/create-root-readme.ts +316 -0
- package/src/generators/create-rpc-msg-client-all.ts +167 -0
- package/src/generators/create-rpc-msg-client-scoped.ts +147 -0
- package/src/generators/create-rpc-msg-clients.ts +165 -0
- package/src/generators/create-rpc-ops-bundle.ts +155 -0
- package/src/generators/create-rpc-query-client-all.ts +173 -0
- package/src/generators/create-rpc-query-client-scoped.ts +142 -0
- package/src/generators/create-rpc-query-clients.ts +304 -0
- package/src/generators/create-sdk-module-stargate-clients.ts +120 -0
- package/src/generators/create-stargate-clients.ts +123 -0
- package/src/generators/create-types.ts +236 -0
- package/src/generators/customize-utils.ts +54 -0
- package/src/helpers/__test__/internalTimestamp.test.ts +79 -0
- package/src/helpers/__test__/internalTimestamp.ts +58 -0
- package/src/helpers/__test__/internalTimestampBigint.test.ts +78 -0
- package/src/helpers/__test__/internalTimestampBigint.ts +58 -0
- package/src/helpers/binary-coder.ts +533 -0
- package/src/helpers/decimals.ts +108 -0
- package/src/helpers/external-comet.ts +49 -0
- package/src/helpers/external-icjs.ts +33 -0
- package/src/helpers/external.ts +28 -0
- package/src/helpers/grpc-gateway.ts +345 -0
- package/src/helpers/grpc-web.ts +11 -0
- package/src/helpers/helper-func-types-interface.ts +104 -0
- package/src/helpers/helper-func-types.ts +91 -0
- package/src/helpers/index.ts +22 -0
- package/src/helpers/internal-for-bigint.ts +257 -0
- package/src/helpers/internal.ts +238 -0
- package/src/helpers/json-safe.ts +11 -0
- package/src/helpers/mobx.ts +77 -0
- package/src/helpers/pinia-endpoint.ts +17 -0
- package/src/helpers/react-query-hooks-icjs.ts +223 -0
- package/src/helpers/react-query-hooks.ts +266 -0
- package/src/helpers/react-query.ts +101 -0
- package/src/helpers/registry-helper.ts +227 -0
- package/src/helpers/types-helper.ts +169 -0
- package/src/helpers/utf8-helper.ts +143 -0
- package/src/helpers/varint.ts +483 -0
- package/src/helpers/vue-query-hooks.ts +224 -0
- package/src/imports.ts +499 -0
- package/src/index.ts +12 -0
- package/src/parse.ts +243 -0
- package/src/prompt.js +65 -0
- package/src/protod/bufbuild.spec.ts +80 -0
- package/src/protod/bufbuild.ts +95 -0
- package/src/protod/config.ts +30 -0
- package/src/protod/git-repo.ts +74 -0
- package/src/protod/index.ts +1 -0
- package/src/protod/recursive.spec.ts +164 -0
- package/src/protod/recursive.ts +180 -0
- package/src/protod/test-data/.protod.config.json +42 -0
- package/src/protod/test-data/buf.lock +23 -0
- package/src/protod/test-data/buf.yaml +25 -0
- package/src/protod/test-data/buf2.yaml +20 -0
- package/src/protod/test-data/cosmos/buf.lock +23 -0
- package/src/protod/test-data/cosmos/crypto/secp256k1/keys.proto +38 -0
- package/src/protod/test-data/model.proto +101 -0
- package/src/protod/types.ts +55 -0
- package/src/protod/utils.spec.ts +68 -0
- package/src/protod/utils.ts +90 -0
- package/src/telescope.js +9 -0
- package/src/types.ts +46 -0
- package/src/utils/common-create-bundle.ts +62 -0
- package/src/utils/contracts.ts +37 -0
- package/src/utils/files.ts +145 -0
- package/src/utils/index.ts +150 -0
- package/src/utils/unused.ts +52 -0
- package/types/build.d.ts +41 -0
- package/types/builder.d.ts +50 -0
- package/types/bundle.d.ts +30 -0
- package/types/bundler.d.ts +31 -0
- package/types/cli.d.ts +1 -0
- package/types/cmds.d.ts +11 -0
- package/types/commands/download.d.ts +5 -0
- package/types/commands/generate.d.ts +2 -0
- package/types/commands/install.d.ts +2 -0
- package/types/commands/transpile.d.ts +4 -0
- package/types/contracts/generate.d.ts +2 -0
- package/types/contracts/install.d.ts +2 -0
- package/types/contracts/message-composer.d.ts +2 -0
- package/types/contracts/react-query.d.ts +2 -0
- package/types/contracts/recoil.d.ts +2 -0
- package/types/file.d.ts +2 -0
- package/types/generators/create-aggregated-lcd-client.d.ts +2 -0
- package/types/generators/create-all-stargate-clients.d.ts +3 -0
- package/types/generators/create-amino-converters.d.ts +3 -0
- package/types/generators/create-bundle.d.ts +3 -0
- package/types/generators/create-combined-stargate-clients.d.ts +3 -0
- package/types/generators/create-cosmwasm-bundle.d.ts +2 -0
- package/types/generators/create-custom-stargate-clients.d.ts +3 -0
- package/types/generators/create-helpers.d.ts +2 -0
- package/types/generators/create-index.d.ts +2 -0
- package/types/generators/create-lcd-client-all.d.ts +3 -0
- package/types/generators/create-lcd-client-scoped.d.ts +3 -0
- package/types/generators/create-lcd-clients.d.ts +3 -0
- package/types/generators/create-mcp-server.d.ts +3 -0
- package/types/generators/create-mobx-bundle.d.ts +2 -0
- package/types/generators/create-msg-funcs.d.ts +3 -0
- package/types/generators/create-pinia-store-bundle.d.ts +2 -0
- package/types/generators/create-pinia-store.d.ts +3 -0
- package/types/generators/create-query-funcs.d.ts +3 -0
- package/types/generators/create-react-query-bundle.d.ts +2 -0
- package/types/generators/create-registries.d.ts +3 -0
- package/types/generators/create-root-readme.d.ts +2 -0
- package/types/generators/create-rpc-msg-client-all.d.ts +3 -0
- package/types/generators/create-rpc-msg-client-scoped.d.ts +3 -0
- package/types/generators/create-rpc-msg-clients.d.ts +3 -0
- package/types/generators/create-rpc-ops-bundle.d.ts +2 -0
- package/types/generators/create-rpc-query-client-all.d.ts +3 -0
- package/types/generators/create-rpc-query-client-scoped.d.ts +3 -0
- package/types/generators/create-rpc-query-clients.d.ts +3 -0
- package/types/generators/create-scoped-stargate-clients.d.ts +3 -0
- package/types/generators/create-sdk-module-stargate-clients.d.ts +3 -0
- package/types/generators/create-stargate-clients.d.ts +3 -0
- package/types/generators/create-types.d.ts +3 -0
- package/types/generators/create-unified-stargate-clients.d.ts +3 -0
- package/types/generators/customize-utils.d.ts +2 -0
- package/types/helpers/__test__/internalTimestamp.d.ts +21 -0
- package/types/helpers/__test__/internalTimestampBigint.d.ts +20 -0
- package/types/helpers/binary-coder.d.ts +2 -0
- package/types/helpers/decimals.d.ts +1 -0
- package/types/helpers/external-comet.d.ts +1 -0
- package/types/helpers/external-icjs.d.ts +1 -0
- package/types/helpers/external.d.ts +1 -0
- package/types/helpers/generated-type.d.ts +1 -0
- package/types/helpers/grpc-gateway.d.ts +1 -0
- package/types/helpers/grpc-web.d.ts +1 -0
- package/types/helpers/helper-func-types-interface.d.ts +2 -0
- package/types/helpers/helper-func-types.d.ts +2 -0
- package/types/helpers/index.d.ts +22 -0
- package/types/helpers/internal-for-bigint.d.ts +2 -0
- package/types/helpers/internal.d.ts +2 -0
- package/types/helpers/internalForBigInt.d.ts +1 -0
- package/types/helpers/json-safe.d.ts +1 -0
- package/types/helpers/mobx.d.ts +1 -0
- package/types/helpers/pinia-endpoint.d.ts +1 -0
- package/types/helpers/react-query-hooks-icjs.d.ts +2 -0
- package/types/helpers/react-query-hooks.d.ts +2 -0
- package/types/helpers/react-query.d.ts +2 -0
- package/types/helpers/registry-helper.d.ts +2 -0
- package/types/helpers/types-helper.d.ts +2 -0
- package/types/helpers/types.d.ts +1 -0
- package/types/helpers/utf8-helper.d.ts +1 -0
- package/types/helpers/varint.d.ts +1 -0
- package/types/helpers/vue-query-hooks.d.ts +2 -0
- package/types/helpers/vue-query.d.ts +2 -0
- package/types/imports.d.ts +17 -0
- package/types/index.d.ts +6 -0
- package/types/parse.d.ts +15 -0
- package/types/prompt.d.ts +3 -0
- package/types/protod/bufbuild.d.ts +6 -0
- package/types/protod/config.d.ts +7 -0
- package/types/protod/git-repo.d.ts +11 -0
- package/types/protod/index.d.ts +1 -0
- package/types/protod/proto-download.d.ts +2 -0
- package/types/protod/recursive.d.ts +4 -0
- package/types/protod/types.d.ts +49 -0
- package/types/protod/utils.d.ts +11 -0
- package/types/telescope.d.ts +2 -0
- package/types/types.d.ts +43 -0
- package/types/utils/common-create-bundle.d.ts +18 -0
- package/types/utils/contracts.d.ts +6 -0
- package/types/utils/files.d.ts +5 -0
- package/types/utils/index.d.ts +16 -0
- package/types/utils/unused.d.ts +5 -0
package/types/build.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ProtoRef, TelescopeOptions } from '@cosmology/types';
|
|
2
|
+
import { ProtoStore } from '@cosmology/proto-parser';
|
|
3
|
+
import { AminoParseContext, GenericParseContext, ProtoParseContext } from '@cosmology/ast';
|
|
4
|
+
import { ServiceMutation, ServiceQuery } from '@cosmology/types';
|
|
5
|
+
export declare const getMutations: (mutations: ServiceMutation[]) => {
|
|
6
|
+
typeUrl: string;
|
|
7
|
+
TypeName: string;
|
|
8
|
+
methodName: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const getAminoProtos: (mutations: ServiceMutation[], store: ProtoStore) => any[];
|
|
11
|
+
export declare const buildBaseTypeScriptClass: (context: TelescopeParseContext, name: string, obj: any) => void;
|
|
12
|
+
export declare const buildBaseTypeScriptInterface: (context: TelescopeParseContext, name: string, obj: any) => void;
|
|
13
|
+
export declare const buildEnums: (context: TelescopeParseContext, name: string, obj: any) => void;
|
|
14
|
+
export interface TelescopeParseContext {
|
|
15
|
+
options: TelescopeOptions;
|
|
16
|
+
generic: GenericParseContext;
|
|
17
|
+
proto: ProtoParseContext;
|
|
18
|
+
amino: AminoParseContext;
|
|
19
|
+
store: ProtoStore;
|
|
20
|
+
ref: ProtoRef;
|
|
21
|
+
parsedImports: Record<string, any>;
|
|
22
|
+
body: any[];
|
|
23
|
+
mutations: ServiceMutation[];
|
|
24
|
+
queries: any[];
|
|
25
|
+
services: any[];
|
|
26
|
+
types: any[];
|
|
27
|
+
}
|
|
28
|
+
export declare class TelescopeParseContext implements TelescopeParseContext {
|
|
29
|
+
constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions);
|
|
30
|
+
hasMutations(): boolean;
|
|
31
|
+
addType(name: string, obj: any, isNested: boolean): void;
|
|
32
|
+
addMutation(mutation: ServiceMutation): void;
|
|
33
|
+
addQuery(query: ServiceQuery): void;
|
|
34
|
+
addService(query: any): void;
|
|
35
|
+
buildBase(): void;
|
|
36
|
+
buildRegistry(): void;
|
|
37
|
+
buildRegistryLoader(): void;
|
|
38
|
+
buildAminoInterfaces(): void;
|
|
39
|
+
buildAminoConverter(): void;
|
|
40
|
+
buildHelperObject(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ProtoStore } from '@cosmology/proto-parser';
|
|
2
|
+
import { TelescopeParseContext } from './build';
|
|
3
|
+
import { TelescopeOptions } from '@cosmology/types';
|
|
4
|
+
import { BundlerFile, TelescopeInput } from './types';
|
|
5
|
+
export declare class TelescopeBuilder {
|
|
6
|
+
store: ProtoStore;
|
|
7
|
+
protoDirs: string[];
|
|
8
|
+
outPath: string;
|
|
9
|
+
options: TelescopeOptions;
|
|
10
|
+
contexts: TelescopeParseContext[];
|
|
11
|
+
files: string[];
|
|
12
|
+
readonly converters: BundlerFile[];
|
|
13
|
+
readonly lcdClients: BundlerFile[];
|
|
14
|
+
readonly rpcQueryClients: BundlerFile[];
|
|
15
|
+
readonly rpcMsgClients: BundlerFile[];
|
|
16
|
+
readonly registries: BundlerFile[];
|
|
17
|
+
readonly stateManagers: Record<string, BundlerFile[]>;
|
|
18
|
+
readonly functionMappings: Record<string, Record<string, Record<string, {
|
|
19
|
+
functionName: string;
|
|
20
|
+
hookName: string;
|
|
21
|
+
comment?: string;
|
|
22
|
+
requestType: string;
|
|
23
|
+
responseType: string;
|
|
24
|
+
sourceFilename?: string;
|
|
25
|
+
hookSourceFilename?: string;
|
|
26
|
+
typeSourceFilename?: string;
|
|
27
|
+
}>>>;
|
|
28
|
+
constructor({ protoDirs, outPath, store, options, }: TelescopeInput & {
|
|
29
|
+
store?: ProtoStore;
|
|
30
|
+
});
|
|
31
|
+
context(ref: any): TelescopeParseContext;
|
|
32
|
+
addFunctionMapping(packageName: string, serviceName: string, methodName: string, functionName: string, hookName: string, comment?: string, requestType?: string, responseType?: string, sourceFilename?: string, hookSourceFilename?: string, typeSourceFilename?: string): void;
|
|
33
|
+
getFunctionMappings(): Record<string, Record<string, Record<string, {
|
|
34
|
+
functionName: string;
|
|
35
|
+
hookName: string;
|
|
36
|
+
comment?: string;
|
|
37
|
+
requestType: string;
|
|
38
|
+
responseType: string;
|
|
39
|
+
sourceFilename?: string;
|
|
40
|
+
hookSourceFilename?: string;
|
|
41
|
+
typeSourceFilename?: string;
|
|
42
|
+
}>>>;
|
|
43
|
+
addStateManagers(type: string, files: BundlerFile[]): void;
|
|
44
|
+
addRPCQueryClients(files: BundlerFile[]): void;
|
|
45
|
+
addRPCMsgClients(files: BundlerFile[]): void;
|
|
46
|
+
addLCDClients(files: BundlerFile[]): void;
|
|
47
|
+
addRegistries(files: BundlerFile[]): void;
|
|
48
|
+
addConverters(files: BundlerFile[]): void;
|
|
49
|
+
build(): Promise<void>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProtoStore } from '@cosmology/proto-parser';
|
|
2
|
+
import { TelescopeBuilder } from './index';
|
|
3
|
+
import { TelescopeParseContext } from './build';
|
|
4
|
+
import { TelescopeOptions } from '@cosmology/types';
|
|
5
|
+
export declare const getPackages: (store: ProtoStore) => {};
|
|
6
|
+
export declare const getPackagesBundled: (store: ProtoStore) => {};
|
|
7
|
+
export declare const bundlePackages: (store: ProtoStore) => {
|
|
8
|
+
bundleVariables: {};
|
|
9
|
+
bundleFile: string;
|
|
10
|
+
importPaths: any[];
|
|
11
|
+
base: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const bundleRegistries: (telescope: TelescopeBuilder) => {
|
|
14
|
+
package: string;
|
|
15
|
+
contexts: unknown;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const bundleBaseRegistries: (telescope: TelescopeBuilder) => {
|
|
18
|
+
base: string;
|
|
19
|
+
pkgs: {
|
|
20
|
+
package: string;
|
|
21
|
+
contexts: any;
|
|
22
|
+
}[];
|
|
23
|
+
}[];
|
|
24
|
+
export declare const parseContextsForRegistry: (contexts: TelescopeParseContext[]) => {
|
|
25
|
+
filename: string;
|
|
26
|
+
imports: {};
|
|
27
|
+
objects: any[];
|
|
28
|
+
}[];
|
|
29
|
+
export declare const parsePackage: (options: TelescopeOptions, obj: any, bundleFile: any, importPaths: any, bundleVariables: any) => void;
|
|
30
|
+
export declare const createFileBundle: (options: TelescopeOptions, pkg: any, filename: any, bundleFile: any, importPaths: any, bundleVariables: any) => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import { TelescopeParseContext } from "./build";
|
|
3
|
+
import { TelescopeBuilder } from "./builder";
|
|
4
|
+
import { ProtoRef } from "@cosmology/types";
|
|
5
|
+
import { Bundle, BundlerFile } from "./types";
|
|
6
|
+
export declare class Bundler {
|
|
7
|
+
builder: TelescopeBuilder;
|
|
8
|
+
contexts: TelescopeParseContext[];
|
|
9
|
+
bundle: Bundle;
|
|
10
|
+
files: string[];
|
|
11
|
+
readonly converters: BundlerFile[];
|
|
12
|
+
readonly lcdClients: BundlerFile[];
|
|
13
|
+
readonly rpcQueryClients: BundlerFile[];
|
|
14
|
+
readonly rpcMsgClients: BundlerFile[];
|
|
15
|
+
readonly registries: BundlerFile[];
|
|
16
|
+
readonly stateManagers: Record<string, BundlerFile[]>;
|
|
17
|
+
constructor(builder: TelescopeBuilder, bundle: Bundle);
|
|
18
|
+
addStateManagers(type: string, files: BundlerFile[]): void;
|
|
19
|
+
addLCDClients(files: BundlerFile[]): void;
|
|
20
|
+
addRPCQueryClients(files: BundlerFile[]): void;
|
|
21
|
+
addRPCMsgClients(files: BundlerFile[]): void;
|
|
22
|
+
addRegistries(files: BundlerFile[]): void;
|
|
23
|
+
addConverters(files: BundlerFile[]): void;
|
|
24
|
+
getFreshContext(context: TelescopeParseContext): TelescopeParseContext;
|
|
25
|
+
getLocalFilename(ref: ProtoRef, suffix?: string): string;
|
|
26
|
+
getFilename(localname: string): string;
|
|
27
|
+
writeAst(program: t.Statement[], filename: string): void;
|
|
28
|
+
addToBundle(context: TelescopeParseContext, localname: string): void;
|
|
29
|
+
addToBundleToPackage(packagename: string, localname: string): void;
|
|
30
|
+
addExportObjToBundle(pkg: string, localname: string, exportedIdentifiers: string[], isHelperFunc?: boolean): void;
|
|
31
|
+
}
|
package/types/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function cli(argv: any): Promise<void>;
|
package/types/cmds.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export namespace Commands {
|
|
2
|
+
export { _commands_generate as generate };
|
|
3
|
+
export { _commands_install as install };
|
|
4
|
+
export { _commands_download as download };
|
|
5
|
+
export { _commands_transpile as transpile };
|
|
6
|
+
}
|
|
7
|
+
export const Contracts: typeof Contracts;
|
|
8
|
+
import _commands_generate from './commands/generate';
|
|
9
|
+
import _commands_install from './commands/install';
|
|
10
|
+
import _commands_download from './commands/download';
|
|
11
|
+
import _commands_transpile from './commands/transpile';
|
package/types/file.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Long from 'long';
|
|
2
|
+
interface Timestamp {
|
|
3
|
+
/**
|
|
4
|
+
* Represents seconds of UTC time since Unix epoch
|
|
5
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
6
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
7
|
+
*/
|
|
8
|
+
seconds: Long;
|
|
9
|
+
/**
|
|
10
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
11
|
+
* second values with fractions must still have non-negative nanos values
|
|
12
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
13
|
+
* inclusive.
|
|
14
|
+
*/
|
|
15
|
+
nanos: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function isSet(value: any): boolean;
|
|
18
|
+
export declare function toTimestamp(date: Date): Timestamp;
|
|
19
|
+
export declare function fromTimestamp(t: Timestamp): Date;
|
|
20
|
+
export declare function fromJsonTimestamp(o: any): Timestamp;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface Timestamp {
|
|
2
|
+
/**
|
|
3
|
+
* Represents seconds of UTC time since Unix epoch
|
|
4
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
5
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
6
|
+
*/
|
|
7
|
+
seconds: bigint;
|
|
8
|
+
/**
|
|
9
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
10
|
+
* second values with fractions must still have non-negative nanos values
|
|
11
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
12
|
+
* inclusive.
|
|
13
|
+
*/
|
|
14
|
+
nanos: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function isSet(value: any): boolean;
|
|
17
|
+
export declare function toTimestamp(date: Date): Timestamp;
|
|
18
|
+
export declare function fromTimestamp(t: Timestamp): Date;
|
|
19
|
+
export declare function fromJsonTimestamp(o: any): Timestamp;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decimal = "\n// The largest value we need is 18 (Ether).\nconst maxFractionalDigits = 30;\n/**\n * A type for arbitrary precision, non-negative decimals.\n *\n * Instances of this class are immutable.\n */\nexport class Decimal {\n public static fromUserInput(\n input: string,\n fractionalDigits: number\n ): Decimal {\n Decimal.verifyFractionalDigits(fractionalDigits);\n const badCharacter = input.match(/[^0-9.]/);\n if (badCharacter) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n throw new Error(\n `Invalid character at position ${badCharacter.index! + 1}`\n );\n }\n let whole: string;\n let fractional: string;\n if (input === \"\") {\n whole = \"0\";\n fractional = \"\";\n } else if (input.search(/\\./) === -1) {\n // integer format, no separator\n whole = input;\n fractional = \"\";\n } else {\n const parts = input.split(\".\");\n switch (parts.length) {\n case 0:\n case 1:\n throw new Error(\n \"Fewer than two elements in split result. This must not happen here.\"\n );\n case 2:\n if (!parts[1]) throw new Error(\"Fractional part missing\");\n whole = parts[0];\n fractional = parts[1].replace(/0+$/, \"\");\n break;\n default:\n throw new Error(\"More than one separator found\");\n }\n }\n if (fractional.length > fractionalDigits) {\n throw new Error(\"Got more fractional digits than supported\");\n }\n const quantity = `${whole}${fractional.padEnd(fractionalDigits, \"0\")}`;\n return new Decimal(quantity, fractionalDigits);\n }\n public static fromAtomics(\n atomics: string,\n fractionalDigits: number\n ): Decimal {\n Decimal.verifyFractionalDigits(fractionalDigits);\n return new Decimal(atomics, fractionalDigits);\n }\n private static verifyFractionalDigits(fractionalDigits: number): void {\n if (!Number.isInteger(fractionalDigits))\n throw new Error(\"Fractional digits is not an integer\");\n if (fractionalDigits < 0)\n throw new Error(\"Fractional digits must not be negative\");\n if (fractionalDigits > maxFractionalDigits) {\n throw new Error(\n `Fractional digits must not exceed ${maxFractionalDigits}`\n );\n }\n }\n public get atomics(): string {\n return this.data.atomics.toString();\n }\n public get fractionalDigits(): number {\n return this.data.fractionalDigits;\n }\n private readonly data: {\n readonly atomics: bigint;\n readonly fractionalDigits: number;\n };\n private constructor(atomics: string, fractionalDigits: number) {\n if (!atomics.match(/^[0-9]+$/)) {\n throw new Error(\n \"Invalid string format. Only non-negative integers in decimal representation supported.\"\n );\n }\n this.data = {\n atomics: BigInt(atomics),\n fractionalDigits: fractionalDigits,\n };\n }\n public toString(): string {\n const factor = BigInt(10) ** BigInt(this.data.fractionalDigits);\n const whole = this.data.atomics / factor;\n const fractional = this.data.atomics % factor;\n if (fractional === 0n) {\n return whole.toString();\n } else {\n const fullFractionalPart = fractional\n .toString()\n .padStart(this.data.fractionalDigits, \"0\");\n const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, \"\");\n return `${whole.toString()}.${trimmedFractionalPart}`;\n }\n }\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const externalComet = "import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate'\nimport { connectComet, Tendermint34Client, HttpEndpoint } from \"@cosmjs/tendermint-rpc\";\n\nconst _rpcClients: Record<string, ProtobufRpcClient> = {};\n\nexport const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => {\n if (typeof rpcEndpoint === 'string') {\n return rpcEndpoint;\n } else if (!!rpcEndpoint) {\n //@ts-ignore\n return rpcEndpoint.url;\n }\n}\n\nexport const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const key = getRpcEndpointKey(rpcEndpoint);\n if (!key) return;\n if (_rpcClients.hasOwnProperty(key)) {\n return _rpcClients[key];\n }\n const cometClient = await connectComet(rpcEndpoint);\n //@ts-ignore\n const client = new QueryClient(cometClient);\n const rpc = createProtobufRpcClient(client);\n _rpcClients[key] = rpc;\n return rpc;\n}\n\nexport const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const cometClient = await connectComet(rpcEndpoint);\n //@ts-ignore\n const client = new QueryClient(cometClient);\n const rpc = createProtobufRpcClient(client);\n\n return rpc;\n}\n\nexport const createTm34QueryClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const tmClient = await Tendermint34Client.connect(rpcEndpoint);\n //@ts-ignore\n return new QueryClient(tmClient);\n}\n\nexport const createConnectCometQueryClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const cometClient = await connectComet(rpcEndpoint);\n //@ts-ignore\n return new QueryClient(cometClient);\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const externalIcJs = "\nimport { HttpEndpoint } from \"@interchainjs/types\";\nimport {\n createQueryRpc,\n} from '@interchainjs/utils';\nimport { Rpc } from \"./helpers\";\n\nconst _rpcClients: Record<string, Rpc> = {};\n\nexport const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => {\n if (typeof rpcEndpoint === 'string') {\n return rpcEndpoint;\n } else if (!!rpcEndpoint) {\n //@ts-ignore\n return rpcEndpoint.url;\n }\n}\n\nexport const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const key = getRpcEndpointKey(rpcEndpoint);\n if (!key) return;\n if (_rpcClients.hasOwnProperty(key)) {\n return _rpcClients[key];\n }\n const rpc = await createRpcClient(rpcEndpoint);\n _rpcClients[key] = rpc;\n return rpc;\n}\n\nexport const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {\n return createQueryRpc(rpcEndpoint)\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const external = "import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate'\nimport { Tendermint34Client, HttpEndpoint } from \"@cosmjs/tendermint-rpc\";\n\nconst _rpcClients: Record<string, ProtobufRpcClient> = {};\n\nexport const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => {\n if (typeof rpcEndpoint === 'string') {\n return rpcEndpoint;\n } else if (!!rpcEndpoint) {\n //@ts-ignore\n return rpcEndpoint.url;\n }\n}\n\nexport const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => {\n const key = getRpcEndpointKey(rpcEndpoint);\n if (!key) return;\n if (_rpcClients.hasOwnProperty(key)) {\n return _rpcClients[key];\n }\n const tmClient = await Tendermint34Client.connect(rpcEndpoint);\n //@ts-ignore\n const client = new QueryClient(tmClient);\n const rpc = createProtobufRpcClient(client);\n _rpcClients[key] = rpc;\n return rpc;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generatedType = "import { BinaryReader, BinaryWriter } from \"../../../binary\";\n\n/**\n * A type generated by Telescope 1.0.\n */\nexport interface TelescopeGeneratedType {\n readonly typeUrl: string;\n readonly encode: (\n message:\n | any\n | {\n [k: string]: any;\n },\n writer?: BinaryWriter\n ) => BinaryWriter;\n readonly decode: (input: BinaryReader | Uint8Array, length?: number) => any;\n readonly fromPartial: (object: any) => any;\n}\n\nexport type GeneratedType = TelescopeGeneratedType;\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const grpcGateway = "\n\n/**\n * base64 encoder and decoder\n * Copied and adapted from https://github.com/protobufjs/protobuf.js/blob/master/lib/base64/index.js\n */\n// Base64 encoding table\nconst b64 = new Array(64);\n\n// Base64 decoding table\nconst s64 = new Array(123);\n\n// 65..90, 97..122, 48..57, 43, 47\nfor (let i = 0; i < 64;)\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\n\nexport function b64Encode(buffer: Uint8Array, start: number, end: number): string {\n\tlet parts: string[] = null;\n const chunk = [];\n let i = 0, // output index\n j = 0, // goto index\n t; // temporary\n while (start < end) {\n const b = buffer[start++];\n switch (j) {\n case 0:\n chunk[i++] = b64[b >> 2];\n t = (b & 3) << 4;\n j = 1;\n break;\n case 1:\n chunk[i++] = b64[t | b >> 4];\n t = (b & 15) << 2;\n j = 2;\n break;\n case 2:\n chunk[i++] = b64[t | b >> 6];\n chunk[i++] = b64[b & 63];\n j = 0;\n break;\n }\n if (i > 8191) {\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\n i = 0;\n }\n }\n if (j) {\n chunk[i++] = b64[t];\n chunk[i++] = 61;\n if (j === 1)\n chunk[i++] = 61;\n }\n if (parts) {\n if (i)\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\n return parts.join(\"\");\n }\n return String.fromCharCode.apply(String, chunk.slice(0, i));\n}\n\nconst invalidEncoding = \"invalid encoding\";\n\nexport function b64Decode(s: string): Uint8Array {\n\tconst buffer = [];\n\tlet offset = 0;\n let j = 0, // goto index\n t; // temporary\n for (let i = 0; i < s.length;) {\n let c = s.charCodeAt(i++);\n if (c === 61 && j > 1)\n break;\n if ((c = s64[c]) === undefined)\n throw Error(invalidEncoding);\n switch (j) {\n case 0:\n t = c;\n j = 1;\n break;\n case 1:\n buffer[offset++] = t << 2 | (c & 48) >> 4;\n t = c;\n j = 2;\n break;\n case 2:\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\n t = c;\n j = 3;\n break;\n case 3:\n buffer[offset++] = (t & 3) << 6 | c;\n j = 0;\n break;\n }\n }\n if (j === 1)\n throw Error(invalidEncoding);\n return new Uint8Array(buffer);\n}\n\nfunction b64Test(s: string): boolean {\n\treturn /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s);\n}\n\nexport interface InitReq extends RequestInit {\n pathPrefix?: string\n}\n\nexport function replacer(key: any, value: any): any {\n if(value && value.constructor === Uint8Array) {\n return b64Encode(value, 0, value.length);\n }\n\n return value;\n}\n\nexport function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {\n const {pathPrefix, ...req} = init || {}\n\n const url = pathPrefix ? `${pathPrefix}${path}` : path\n\n return fetch(url, req).then(r => r.json().then((body: O) => {\n if (!r.ok) { throw body; }\n return body;\n })) as Promise<O>\n}\n\n// NotifyStreamEntityArrival is a callback that will be called on streaming entity arrival\nexport type NotifyStreamEntityArrival<T> = (resp: T) => void\n\n/**\n * fetchStreamingRequest is able to handle grpc-gateway server side streaming call\n * it takes NotifyStreamEntityArrival that lets users respond to entity arrival during the call\n * all entities will be returned as an array after the call finishes.\n **/\nexport async function fetchStreamingRequest<S, R>(path: string, callback?: NotifyStreamEntityArrival<R>, init?: InitReq) {\n const {pathPrefix, ...req} = init || {}\n const url = pathPrefix ? `${pathPrefix}${path}` : path\n const result = await fetch(url, req)\n // needs to use the .ok to check the status of HTTP status code\n // http other than 200 will not throw an error, instead the .ok will become false.\n // see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#\n if (!result.ok) {\n const resp = await result.json()\n const errMsg = resp.error && resp.error.message ? resp.error.message : \"\"\n throw new Error(errMsg)\n }\n\n if (!result.body) {\n throw new Error(\"response doesnt have a body\")\n }\n\n await result.body\n .pipeThrough(new TextDecoderStream())\n .pipeThrough<R>(getNewLineDelimitedJSONDecodingStream<R>())\n .pipeTo(getNotifyEntityArrivalSink((e: R) => {\n if (callback) {\n callback(e)\n }\n }))\n\n // wait for the streaming to finish and return the success respond\n return\n}\n\n/**\n * JSONStringStreamController represents the transform controller that's able to transform the incoming\n * new line delimited json content stream into entities and able to push the entity to the down stream\n */\ninterface JSONStringStreamController<T> extends TransformStreamDefaultController {\n buf?: string\n pos?: number\n enqueue: (s: T) => void\n}\n\n/**\n * getNewLineDelimitedJSONDecodingStream returns a TransformStream that's able to handle new line delimited json stream content into parsed entities\n */\nfunction getNewLineDelimitedJSONDecodingStream<T>(): TransformStream<string, T> {\n return new TransformStream({\n start(controller: JSONStringStreamController<T>) {\n controller.buf = ''\n controller.pos = 0\n },\n\n transform(chunk: string, controller: JSONStringStreamController<T>) {\n if (controller.buf === undefined) {\n controller.buf = ''\n }\n if (controller.pos === undefined) {\n controller.pos = 0\n }\n controller.buf += chunk\n while (controller.pos < controller.buf.length) {\n if (controller.buf[controller.pos] === '\\n') {\n const line = controller.buf.substring(0, controller.pos)\n const response = JSON.parse(line)\n controller.enqueue(response.result)\n controller.buf = controller.buf.substring(controller.pos + 1)\n controller.pos = 0\n } else {\n ++controller.pos\n }\n }\n }\n })\n\n}\n\n/**\n * getNotifyEntityArrivalSink takes the NotifyStreamEntityArrival callback and return\n * a sink that will call the callback on entity arrival\n * @param notifyCallback\n */\nfunction getNotifyEntityArrivalSink<T>(notifyCallback: NotifyStreamEntityArrival<T>) {\n return new WritableStream<T>({\n write(entity: T) {\n notifyCallback(entity)\n }\n })\n}\n\ntype Primitive = string | boolean | number;\ntype RequestPayload = Record<string, unknown>;\ntype FlattenedRequestPayload = Record<string, Primitive | Array<Primitive>>;\n\n/**\n * Checks if given value is a plain object\n * Logic copied and adapted from below source: \n * https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js\n * @param {unknown} value\n * @return {boolean}\n */\nfunction isPlainObject(value: unknown): boolean {\n const isObject =\n Object.prototype.toString.call(value).slice(8, -1) === \"Object\";\n const isObjLike = value !== null && isObject;\n\n if (!isObjLike || !isObject) {\n return false;\n }\n\n const proto = Object.getPrototypeOf(value);\n\n const hasObjectConstructor =\n typeof proto === \"object\" &&\n proto.constructor === Object.prototype.constructor;\n\n return hasObjectConstructor;\n}\n\n/**\n * Checks if given value is of a primitive type\n * @param {unknown} value\n * @return {boolean}\n */\nfunction isPrimitive(value: unknown): boolean {\n return [\"string\", \"number\", \"boolean\"].some(t => typeof value === t);\n}\n\n/**\n * Checks if given primitive is zero-value\n * @param {Primitive} value\n * @return {boolean}\n */\nfunction isZeroValuePrimitive(value: Primitive): boolean {\n return value === false || value === 0 || value === \"\";\n}\n\n/**\n * Flattens a deeply nested request payload and returns an object\n * with only primitive values and non-empty array of primitive values\n * as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto\n * @param {RequestPayload} requestPayload\n * @param {String} path\n * @return {FlattenedRequestPayload>}\n */\nfunction flattenRequestPayload<T extends RequestPayload>(\n requestPayload: T,\n path: string = \"\"\n): FlattenedRequestPayload {\n return Object.keys(requestPayload).reduce(\n (acc: T, key: string): T => {\n const value = requestPayload[key];\n const newPath = path ? [path, key].join(\".\") : key;\n\n const isNonEmptyPrimitiveArray =\n Array.isArray(value) &&\n value.every(v => isPrimitive(v)) &&\n value.length > 0;\n\n const isNonZeroValuePrimitive =\n isPrimitive(value) && !isZeroValuePrimitive(value as Primitive);\n\n let objectToMerge = {};\n\n if (isPlainObject(value)) {\n objectToMerge = flattenRequestPayload(value as RequestPayload, newPath);\n } else if (value && value.constructor === Uint8Array) {\n objectToMerge = {\n [newPath]: b64Encode(value, 0, value.length),\n };\n } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) {\n objectToMerge = { [newPath]: value };\n }\n\n return { ...acc, ...objectToMerge };\n },\n {} as T\n ) as FlattenedRequestPayload;\n}\n\n/**\n * Renders a deeply nested request payload into a string of URL search\n * parameters by first flattening the request payload and then removing keys\n * which are already present in the URL path.\n * @param {RequestPayload} requestPayload\n * @param {string[]} urlPathParams\n * @return {string}\n */\nexport function renderURLSearchParams<T extends RequestPayload>(\n requestPayload: T,\n urlPathParams: string[] = []\n): string {\n const flattenedRequestPayload = flattenRequestPayload(requestPayload);\n\n const urlSearchParams = Object.keys(flattenedRequestPayload).reduce(\n (acc: string[][], key: string): string[][] => {\n // key should not be present in the url path as a parameter\n const value = flattenedRequestPayload[key];\n if (urlPathParams.find(f => f === key)) {\n return acc;\n }\n return Array.isArray(value)\n ? [...acc, ...value.map(m => [key, m.toString()])]\n : (acc = [...acc, [key, value.toString()]]);\n },\n [] as string[][]\n );\n\n // react-native's URLSearchParams doesn't like working with array of arrays\n return urlSearchParams\n .map((x) => new URLSearchParams({ [x[0]]: x[1] }).toString())\n .join(\"&\");\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const grpcWeb = "import { grpc } from \"@improbable-eng/grpc-web\";\n\nexport interface UnaryMethodDefinitionishR\n extends grpc.UnaryMethodDefinition<any, any> {\n requestStream: any;\n responseStream: any;\n}\n\nexport type UnaryMethodDefinitionish = UnaryMethodDefinitionishR;\n\n";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './external';
|
|
2
|
+
export * from './external-comet';
|
|
3
|
+
export * from './external-icjs';
|
|
4
|
+
export * from './internal';
|
|
5
|
+
export * from './internal-for-bigint';
|
|
6
|
+
export * from './react-query';
|
|
7
|
+
export * from './react-query-hooks';
|
|
8
|
+
export * from './react-query-hooks-icjs';
|
|
9
|
+
export * from './mobx';
|
|
10
|
+
export * from './grpc-gateway';
|
|
11
|
+
export * from './grpc-web';
|
|
12
|
+
export * from './pinia-endpoint';
|
|
13
|
+
export * from './varint';
|
|
14
|
+
export * from './utf8-helper';
|
|
15
|
+
export * from './binary-coder';
|
|
16
|
+
export * from './types-helper';
|
|
17
|
+
export * from './registry-helper';
|
|
18
|
+
export * from './json-safe';
|
|
19
|
+
export * from './decimals';
|
|
20
|
+
export * from './helper-func-types';
|
|
21
|
+
export * from './helper-func-types-interface';
|
|
22
|
+
export * from './vue-query-hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const internalForBigInt = "\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault<T extends string | number | bigint>(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial<T> = T extends Builtin\n ? T\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<\n Exclude<keyof I, KeysOfUnion<P>>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise<Uint8Array>;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(Math.trunc(number));\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const jsonSafe = "\nexport type JsonSafe<T> = T extends Uint8Array | bigint | Date\n ? string\n : T extends Array<infer U>\n ? Array<JsonSafe<U>>\n : T extends object\n ? { [K in keyof T]: JsonSafe<T[K]> }\n : T;\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mobx = "\nimport {\n makeAutoObservable,\n runInAction\n} from 'mobx';\n\nimport { QueryStatus } from '@tanstack/react-query';\n\nexport interface MobxResponse<T> {\n data: T | undefined;\n isSuccess: boolean;\n isLoading: boolean;\n refetch: () => Promise<void>;\n}\n\nexport class QueryStore<Request, Response> {\n state?: QueryStatus;\n request?: Request;\n response?: Response;\n fetchFunc?: (request: Request) => Promise<Response>;\n\n constructor(fetchFunc?: (request: Request) => Promise<Response>) {\n this.fetchFunc = fetchFunc;\n makeAutoObservable(this)\n }\n\n get isLoading() {\n return this.state === 'loading';\n }\n\n get isSuccess() {\n return this.state === 'success';\n }\n\n refetch = async (): Promise<void> => {\n runInAction(() => {\n this.response = void 0;\n this.state = 'loading';\n });\n try {\n if (!this.fetchFunc)\n throw new Error(\n 'Query Service not initialized or request function not implemented'\n );\n if (!this.request) throw new Error('Request not provided');\n const response = await this.fetchFunc(this.request);\n runInAction(() => {\n this.response = response;\n this.state = 'success';\n });\n console.log(\n '%cquery.rpc.Query.ts line:572 this.state',\n 'color: #007acc;',\n this.state,\n this.response\n );\n } catch (e) {\n console.error(e);\n runInAction(() => {\n this.state = 'error';\n });\n }\n }\n\n getData(request?: Request): MobxResponse<Response> {\n runInAction(() => {\n this.request = request;\n });\n return {\n data: this.response,\n isSuccess: this.isSuccess,\n isLoading: this.isLoading,\n refetch: this.refetch,\n };\n }\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pinia = "\nimport { defineStore } from \"pinia\";\nimport type { LCDClient } from '@cosmology/lcd';\n\nexport const useEndpoint = defineStore('pinia.endpoint', {\n state: () => {\n return {\n restClient: {} as LCDClient,\n }\n },\n actions: {\n setRestClient(client: LCDClient) {\n this.restClient = client\n }\n }\n})\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const types = "import { BinaryReader, BinaryWriter } from \"../../../binary\";\n\n/**\n * A type generated by Telescope 1.0.\n */\nexport interface TelescopeGeneratedType {\n readonly typeUrl: string;\n readonly encode: (\n message:\n | any\n | {\n [k: string]: any;\n },\n writer?: BinaryWriter\n ) => BinaryWriter;\n readonly decode: (input: BinaryReader | Uint8Array, length?: number) => any;\n readonly fromPartial: (object: any) => any;\n}\n\nexport type GeneratedType = TelescopeGeneratedType;\n";
|