8000 feat(nodetime): add sta pkg and refactor by ilgooz · Pull Request #757 · ignite/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(nodetime): add sta pkg and refactor #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2021
Merged

Conversation

ilgooz
Copy link
Member
@ilgooz ilgooz commented Feb 14, 2021

a new pkg/ called nodetime added to host and use a single NodeJS runtime that has multiple CLIs bundled inside.

  • swagger-typescript-api (STA) CLI added alongside protobufjs CLI.

  • switched Starport's Go compiler to 1.16 beta to benefit from the new embed feature for binary embedding. it'll be switched to stable 1.16 release once it's available (likely this Feb). without this, it is a bit tricky to get nodetime's binary inside Starport.

Tools like go-bindata, generates Go code which multiplies the actual file size by two or three that exceeds Github's max file size limitation. OTOH, LFS does not work well with GP. Go's embed fits just right.

Please note that, STA will be used to generate client code for Query APIs. It generates code from the OpenAPI spec. What we essentially do is to generate an OpenAPI spec first from proto's gRPC Gateway definitions and then pass it to STA.

@ltacker can you please install https://golang.org/dl/#go1.16beta1 to your local once we merge this PR?

Another thing, to be able to scaffold an LP chain, we need to have GONAME=go1.15 env var set and go1.15 installed temporarily. This case is only needed for us, because pre-compiled Starport CLI users do not have multiple versions (beta) of Go installed.

@ilgooz ilgooz force-pushed the feat/add-sta branch 2 times, most recently from f7b536f to e50511e Compare February 14, 2021 07:51
@fadeev
Copy link
Contributor
fadeev commented Feb 14, 2021

Excited about embed! If I understand correctly, it will eventually allow us to replace statik and packr.

a new pkg/ called nodetime added to host and use a single NodeJS runtime
that has multiple CLIs bundled inside.

* `swagger-typescript-api` CLI added alongside `protobufjs` CLI.

* switched Starport's Go compiler to 1.16 beta to benefit from new the `embed` feature. it'll be switched to stable 1.16 release once it's available (likely this Feb).
@ilgooz
Copy link
Member Author
ilgooz commented Feb 14, 2021

Exactly. For now, we use it for nodetime, but others should be refactored ASAP! 🔥

@ilgooz
Copy link
Member Author
ilgooz commented Feb 14, 2021
Output of STA be like

/* tslint:disable */
/* eslint-disable */
/*
 * ---------------------------------------------------------------
 * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
 * ##                                                           ##
 * ## AUTHOR: acacode                                           ##
 * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
 * ---------------------------------------------------------------
 */

export interface BarQueryAllUserResponse {
  User?: BarUser[];

  /**
   * PageResponse is to be embedded in gRPC response messages where the
   * corresponding request message has used PageRequest.
   *
   *  message SomeResponse {
   *          repeated Bar results = 1;
   *          PageResponse page = 2;
   *  }
   */
  pagination?: V1Beta1PageResponse;
}

export interface BarQueryGetUserResponse {
  User?: BarUser;
}

export interface BarUser {
  creator?: string;
  id?: string;
  name?: string;
}

export interface ProtobufAny {
  typeUrl?: string;

  /** @format byte */
  value?: string;
}

export interface RpcStatus {
  /** @format int32 */
  code?: number;
  message?: string;
  details?: ProtobufAny[];
}

/**
* message SomeRequest {
         Foo some_parameter = 1;
         PageRequest pagination = 2;
 }
*/
export interface V1Beta1PageRequest {
  /**
   * key is a value returned in PageResponse.next_key to begin
   * querying the next page most efficiently. Only one of offset or key
   * should be set.
   * @format byte
   */
  key?: string;

  /**
   * offset is a numeric offset that can be used when key is unavailable.
   * It is less efficient than using key. Only one of offset or key should
   * be set.
   * @format uint64
   */
  offset?: string;

  /**
   * limit is the total number of results to be returned in the result page.
   * If left empty it will default to a value to be set by each app.
   * @format uint64
   */
  limit?: string;

  /**
   * count_total is set to true  to indicate that the result set should include
   * a count of the total number of items available for pagination in UIs.
   * count_total is only respected when offset is used. It is ignored when key
   * is set.
   */
  countTotal?: boolean;
}

/**
* PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.

 message SomeResponse {
         repeated Bar results = 1;
         PageResponse page = 2;
 }
*/
export interface V1Beta1PageResponse {
  /** @format byte */
  nextKey?: string;

  /** @format uint64 */
  total?: string;
}

export type QueryParamsType = Record<string | number, any>;
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;

export interface FullRequestParams extends Omit<RequestInit, "body"> {
  /** 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?: keyof Omit<Body, "body" | "bodyUsed">;
  /** request body */
  body?: unknown;
  /** base url */
  baseUrl?: string;
  /** request cancellation token */
  cancelToken?: CancelToken;
}

export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;

interface ApiConfig<SecurityDataType = unknown> {
  baseUrl?: string;
  baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
  securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
}

interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
  data: D;
  error: E;
}

type CancelToken = Symbol | string | number;

export enum ContentType {
  Json = "application/json",
  FormData = "multipart/form-data",
  UrlEncoded = "application/x-www-form-urlencoded",
}

export class HttpClient<SecurityDataType = unknown> {
  public baseUrl: string = "";
  private securityData: SecurityDataType = null as any;
  private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
  private abortControllers = new Map<CancelToken, AbortController>();

  private baseApiParams: RequestParams = {
    credentials: "same-origin",
    headers: {},
    redirect: "follow",
    referrerPolicy: "no-referrer",
  };

  constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
    Object.assign(this, apiConfig);
  }

  public setSecurityData = (data: SecurityDataType) => {
    this.securityData = data;
  };

  private addQueryParam(query: QueryParamsType, key: string) {
    const value = query[key];

    return (
      encodeURIComponent(key) +
      "=" +
      encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
    );
  }

  protected toQueryString(rawQuery?: QueryParamsType): string {
    const query = rawQuery || {};
    const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
    return keys
      .map((key) =>
        typeof query[key] === "object" && !Array.isArray(query[key])
          ? this.toQueryString(query[key] as QueryParamsType)
          : this.addQueryParam(query, key),
      )
      .join("&");
  }

  protected addQueryParams(rawQuery?: QueryParamsType): string {
    const queryString = this.toQueryString(rawQuery);
    return queryString ? `?${queryString}` : "";
  }

  private contentFormatters: Record<ContentType, (input: any) => any> = {
    [ContentType.Json]: (input: any) => (input !== null && typeof input === "object" ? JSON.stringify(input) : input),
    [ContentType.FormData]: (input: any) =>
      Object.keys(input || {}).reduce((data, key) => {
        data.append(key, input[key]);
        return data;
      }, new FormData()),
    [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
  };

  private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
    return {
      ...this.baseApiParams,
      ...params1,
      ...(params2 || {}),
      headers: {
        ...(this.baseApiParams.headers || {}),
        ...(params1.headers || {}),
        ...((params2 && params2.headers) || {}),
      },
    };
  }

  private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
    if (this.abortControllers.has(cancelToken)) {
      const abortController = this.abortControllers.get(cancelToken);
      if (abortController) {
        return abortController.signal;
      }
      return void 0;
    }

    const abortController = new AbortController();
    this.abortControllers.set(cancelToken, abortController);
    return abortController.signal;
  };

  public abortRequest = (cancelToken: CancelToken) => {
    const abortController = this.abortControllers.get(cancelToken);

    if (abortController) {
      abortController.abort();
      this.abortControllers.delete(cancelToken);
    }
  };

  public request = <T = any, E = any>({
    body,
    secure,
    path,
    type,
    query,
    format = "json",
    baseUrl,
    cancelToken,
    ...params
  }: FullRequestParams): Promise<HttpResponse<T, E>> => {
    const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
    const requestParams = this.mergeRequestParams(params, secureParams);
    const queryString = query && this.toQueryString(query);
    const payloadFormatter = this.contentFormatters[type || ContentType.Json];

    return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
      headers: {
        ...(type ? { "Content-Type": type } : {}),
        ...(requestParams.headers || {}),
      },
      ...requestParams,
      signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
      body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
    }).then(async (response) => {
      const r = response as HttpResponse<T, E>;
      r.data = (null as unknown) as T;
      r.error = (null as unknown) as E;

      const data = await response[format]()
        .then((data) => {
          if (r.ok) {
            r.data = data;
          } else {
            r.error = data;
          }
          return r;
        })
        .catch((e) => {
          r.error = e;
          return r;
        });

      if (cancelToken) {
        this.abortControllers.delete(cancelToken);
      }

      if (!response.ok) throw data;
      return data;
    });
  };
}

/**
 * @title bar/query.proto
 * @version version not set
 */
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
  foo = {
    /**
     * No description
     *
     * @tags Query
     * @name QueryUserAll
     * @request GET:/foo/bar/bar/user
     */
    queryUserAll: (
      query?: {
        "pagination.key"?: string;
        "pagination.offset"?: string;
        "pagination.limit"?: string;
        "pagination.countTotal"?: boolean;
      },
      params: RequestParams = {},
    ) =>
      this.request<BarQueryAllUserResponse, RpcStatus>({
        path: `/foo/bar/bar/user`,
        method: "GET",
        query: query,
        format: "json",
        ...params,
      }),

    /**
     * No description
     *
     * @tags Query
     * @name QueryUser
     * @summary this line is used by starport scaffolding # 2
     * @request GET:/foo/bar/bar/user/{id}
     */
    queryUser: (id: string, params: RequestParams = {}) =>
      this.request<BarQueryGetUserResponse, RpcStatus>({
        path: `/foo/bar/bar/user/${id}`,
        method: "GET",
        format: "json",
        ...params,
      }),
  };
}

@ilgooz ilgooz force-pushed the feat/add-sta branch 2 times, most recently from d4e62f7 to 133d35c Compare February 14, 2021 09:23
@ilgooz ilgooz marked this pull request as ready for review February 14, 2021 09:33
@ilgooz ilgooz requested review from fadeev and lumtis as code owners February 14, 2021 09:33
@ilgooz ilgooz merged commit 2eddc71 into feat/codegen-fx Feb 17, 2021
@ilgooz ilgooz deleted the feat/add-sta branch February 17, 2021 04:43
ilgooz added a commit that referenced this pull request Mar 16, 2021
* empty commit

* feat: sdk msg discovery from app source (#734)

* feat: sdk msg discovery from app source

* `pkg/cosmosanalysis/msg.Discover()` discovers types that implements sdk.Msg.
* added `pkg/protoanalysis` for proto file analysis.

* fix linter

* docs

* docs

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* feat: add pkg/protobufjs (#744)

* feat: add pkg/protobufjs

protobufjs is made available for use as a Go pkg with the high level Generate() API.

protobufjs binaries statically added to Starport's source code and they are instantly available.

only the relavent protobufjs binary included to the final binary of Starport dependending on the OS. for Linux, it adds 17MB to the total binary size of Starport.

* ci: enable lfs

* fix lint

* cleanup & docs

* cleanup & an attempt to add ts defs for generated js

* gitpod: install git-lfs

* ci(pi): disable them temp because high LFS usage

* rm pi files

* gitpod: fix lfs

* gitpod: fix lfs

* gitpod: fix lfs

* gitpod: fix lfs

* docs: manual installation

* gitpod: fix lfs

* fix gitpod (#754)

* fix(gitpod): drop lfs (#755)

* fix(gitpod): drop lfs

compress protobufjs binary manually instead of relying on go-bindata's.

generated files now under 100MB.

* tidy

* cleanup

* feat(pkg/cosmosanalysis): add more detailed msg info (#752)

* feat(pkg/cosmosanalysis): add more detailed msg info

most importantly, msg urls added to the analysis output.

* docs

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* feat(nodetime): add sta pkg and refactor (#757)

* feat(nodetime): add sta pkg and refactor

a new pkg/ called nodetime added to host and use a single NodeJS runtime
that has multiple CLIs bundled inside.

* `swagger-typescript-api` CLI added alongside `protobufjs` CLI.

* switched Starport's Go compiler to 1.16 beta to benefit from new the `embed` feature. it'll be switched to stable 1.16 release once it's available (likely this Feb).

* fix integration tests

* fix gitpod

* feat: upgrade to stable Go 1.16 (#765)

* fix: integration tests (#766)

* feat: enable js proto generation (#751)

* refactor(protoc): wrap protoc cmd as a pkg

* enable js code generation for build & server

out dir can be configured via `build.proto.js.out`.

* generate js per module

* change cosmosprotoc name to cosmosproto

* docs

* fix linter

* chore(integration): disable parallel run to not bottleneck the CI

* feat(codegen): generate rest client for js (#771)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen/ts-proto): generate app types with ts-proto (#795)

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* feat(codegen): generated js client (the wrapper) (#772)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen): generated js client (the wrapper)

it wraps generated protobufjs types and rest client, uses cosmjs and exports high level `txClient()` and `queryClient()` funcs for:

* creating messages, signing and broadcasting them,
* querying.

js client created individually for each module. within Vuex, it can be used like in below:

```js
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { txClient, queryClient } from "./store/tendermint/mars/mars/module";

async function main() {
    const wallet = await DirectSecp256k1HdWallet.fromMnemonic("alfa romeo...");

    const t = await txClient(wallet);
    const q = await queryClient();

    console.log(await t.signAndBroadcast([ t.msgCreateUser({ name: "mars", creator: wallet.address }) ]));
    console.log(await q.queryUserAll());
}

main()

```

* fix(sta): sdk module name

* docs

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* migrate wrapper to ts(-proto) and new version of cosmjs

* several code generation improvements made.

* add customizable fee

* fix default amount

* feat(codegen): add code generation for 3rd party modules (#797)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen): generated js client (the wrapper)

it wraps generated protobufjs types and rest client, uses cosmjs and exports high level `txClient()` and `queryClient()` funcs for:

* creating messages, signing and broadcasting them,
* querying.

js client created individually for each module. within Vuex, it can be used like in below:

```js
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { txClient, queryClient } from "./store/tendermint/mars/mars/module";

async function main() {
    const wallet = await DirectSecp256k1HdWallet.fromMnemonic("alfa romeo...");

    const t = await txClient(wallet);
    const q = await queryClient();

    console.log(await t.signAndBroadcast([ t.msgCreateUser({ name: "mars", creator: wallet.address }) ]));
    console.log(await q.queryUserAll());
}

main()

```

* fix(sta): sdk module name

* docs

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* migrate wrapper to ts(-proto) and new version of cosmjs

* several code generation improvements made.

* feat(codegen): add code generation for dependency modules

optionally enable js related code code generation for the 3rd party modules -including the sdk- that used by an app.

* several improvements mode on code generation logic.

* fix lint & err checking

* fix go codegen

* scaffolding(stargate): add generated 3rd party js clients

* enable code gen for 3rd party modules on demand

* docs

* fix: add chain to path (#802)

Co-authored-by: Alex Megalokonomos <alex@clockwork.gr>

* chore: sync stargate scaffolding for new js gen path (#803)

* feat: Updated vue template for codegen (#807)

* feat: Updated vue template

* package.json fixes

* chrore(ui): update versions , add plain eslint config (#812)

* feat: (codegen/vuex): add Vuex code generation & refactor (#824)

* codegen(vuex): add Vuex code generation & refactor

code generation related packages.

* fix err handling & linter errors

* fix err handling

* fix msg discovery

* cosmosanalysis: add metadata about grpc gateway

* docs: fix typo

* fix linter err

* feat: provide more tpl data to loader & add user-side warnings (#857)

* feat: provide more tpl data to loader & add user-side warnings

about not modifying generated dirs/files.

* cosmetic

* fix: Template updates (#825)

* fix: Template updates

* feat: sendMsg*  actions, Msg* message creation

* feat: Add true Error()s

* fix: Change `chain` to `generated`

* fix: tsc ignore imported dependency

* Updated generated JS/TS for SDK modules

* feat: Add get all pages option to queries

* fiix: Pass all option to subscription

* feat: Add query returns from store

* WIP v0.15 Layout

* Regenerated JS/TS

* fix: stale state, return from getters

* Regenerated TS/JS

* JS Template changes

* Regenerated JS/TS

* Additional template changes

* fix: Template changes

* Regenerated TS/JS

* templates: sync pre generated js

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Co-authored-by: Alex Megalokonomos <alex@clockwork.gr>
ilgooz added a commit that referenced this pull request May 10, 2021
* feat(nodetime): add sta pkg and refactor

a new pkg/ called nodetime added to host and use a single NodeJS runtime
that has multiple CLIs bundled inside.

* `swagger-typescript-api` CLI added alongside `protobufjs` CLI.

* switched Starport's Go compiler to 1.16 beta to benefit from new the `embed` feature. it'll be switched to stable 1.16 release once it's available (likely this Feb).

* fix integration tests

* fix gitpod
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
* empty commit

* feat: sdk msg discovery from app source (ignite#734)

* feat: sdk msg discovery from app source

* `pkg/cosmosanalysis/msg.Discover()` discovers types that implements sdk.Msg.
* added `pkg/protoanalysis` for proto file analysis.

* fix linter

* docs

* docs

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* feat: add pkg/protobufjs (ignite#744)

* feat: add pkg/protobufjs

protobufjs is made available for use as a Go pkg with the high level Generate() API.

protobufjs binaries statically added to Starport's source code and they are instantly available.

only the relavent protobufjs binary included to the final binary of Starport dependending on the OS. for Linux, it adds 17MB to the total binary size of Starport.

* ci: enable lfs

* fix lint

* cleanup & docs

* cleanup & an attempt to add ts defs for generated js

* gitpod: install git-lfs

* ci(pi): disable them temp because high LFS usage

* rm pi files

* gitpod: fix lfs

* gitpod: fix lfs

* gitpod: fix lfs

* gitpod: fix lfs

* docs: manual installation

* gitpod: fix lfs

* fix gitpod (ignite#754)

* fix(gitpod): drop lfs (ignite#755)

* fix(gitpod): drop lfs

compress protobufjs binary manually instead of relying on go-bindata's.

generated files now under 100MB.

* tidy

* cleanup

* feat(pkg/cosmosanalysis): add more detailed msg info (ignite#752)

* feat(pkg/cosmosanalysis): add more detailed msg info

most importantly, msg urls added to the analysis output.

* docs

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* feat(nodetime): add sta pkg and refactor (ignite#757)

* feat(nodetime): add sta pkg and refactor

a new pkg/ called nodetime added to host and use a single NodeJS runtime
that has multiple CLIs bundled inside.

* `swagger-typescript-api` CLI added alongside `protobufjs` CLI.

* switched Starport's Go compiler to 1.16 beta to benefit from new the `embed` feature. it'll be switched to stable 1.16 release once it's available (likely this Feb).

* fix integration tests

* fix gitpod

* feat: upgrade to stable Go 1.16 (ignite#765)

* fix: integration tests (ignite#766)

* feat: enable js proto generation (ignite#751)

* refactor(protoc): wrap protoc cmd as a pkg

* enable js code generation for build & server

out dir can be configured via `build.proto.js.out`.

* generate js per module

* change cosmosprotoc name to cosmosproto

* docs

* fix linter

* chore(integration): disable parallel run to not bottleneck the CI

* feat(codegen): generate rest client for js (ignite#771)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen/ts-proto): generate app types with ts-proto (ignite#795)

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* feat(codegen): generated js client (the wrapper) (ignite#772)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen): generated js client (the wrapper)

it wraps generated protobufjs types and rest client, uses cosmjs and exports high level `txClient()` and `queryClient()` funcs for:

* creating messages, signing and broadcasting them,
* querying.

js client created individually for each module. within Vuex, it can be used like in below:

```js
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { txClient, queryClient } from "./store/tendermint/mars/mars/module";

async function main() {
    const wallet = await DirectSecp256k1HdWallet.fromMnemonic("alfa romeo...");

    const t = await txClient(wallet);
    const q = await queryClient();

    console.log(await t.signAndBroadcast([ t.msgCreateUser({ name: "mars", creator: wallet.address }) ]));
    console.log(await q.queryUserAll());
}

main()

```

* fix(sta): sdk module name

* docs

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* migrate wrapper to ts(-proto) and new version of cosmjs

* several code generation improvements made.

* add customizable fee

* fix default amount

* feat(codegen): add code generation for 3rd party modules (ignite#797)

* feat(codegen): generate rest client for js

* fix Go codegen

* feat(codegen): generated js client (the wrapper)

it wraps generated protobufjs types and rest client, uses cosmjs and exports high level `txClient()` and `queryClient()` funcs for:

* creating messages, signing and broadcasting them,
* querying.

js client created individually for each module. within Vuex, it can be used like in below:

```js
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { txClient, queryClient } from "./store/tendermint/mars/mars/module";

async function main() {
    const wallet = await DirectSecp256k1HdWallet.fromMnemonic("alfa romeo...");

    const t = await txClient(wallet);
    const q = await queryClient();

    console.log(await t.signAndBroadcast([ t.msgCreateUser({ name: "mars", creator: wallet.address }) ]));
    console.log(await q.queryUserAll());
}

main()

```

* fix(sta): sdk module name

* docs

* feat(codegen/ts-proto): generate app types with ts-proto

previously, we were using `protobufjs` to generate app types.
now, we have switched to `ts-proto` but also kept js support by placing `.js` and `.d.ts` files next to the generated `.ts` files.

* refactored `nodetime` packaging.
* added more detailed info to `pkg/cosmosanalysis/module.Discover()` output.
* added more detailed info to `pkg/protoanalysis.DiscoverPackages()` output.
* added plugin binary configurability option to `pkg/protoc` pkg.
* improved `pkg/cosmosgen`'s public API.
* added `pkg/nodetime/tsc`, `pkg/nodetime/ts-proto` and removed `pkg/nodetime/protobufjs`.

* fix lint

* fix err check

* migrate wrapper to ts(-proto) and new version of cosmjs

* several code generation improvements made.

* feat(codegen): add code generation for dependency modules

optionally enable js related code code generation for the 3rd party modules -including the sdk- that used by an app.

* several improvements mode on code generation logic.

* fix lint & err checking

* fix go codegen

* scaffolding(stargate): add generated 3rd party js clients

* enable code gen for 3rd party modules on demand

* docs

* fix: add chain to path (ignite#802)

Co-authored-by: Alex Megalokonomos <alex@clockwork.gr>

* chore: sync stargate scaffolding for new js gen path (ignite#803)

* feat: Updated vue template for codegen (ignite#807)

* feat: Updated vue template

* package.json fixes

* chrore(ui): update versions , add plain eslint config (ignite#812)

* feat: (codegen/vuex): add Vuex code generation & refactor (ignite#824)

* codegen(vuex): add Vuex code generation & refactor

code generation related packages.

* fix err handling & linter errors

* fix err handling

* fix msg discovery

* cosmosanalysis: add metadata about grpc gateway

* docs: fix typo

* fix linter err

* feat: provide more tpl data to loader & add user-side warnings (ignite#857)

* feat: provide more tpl data to loader & add user-side warnings

about not modifying generated dirs/files.

* cosmetic

* fix: Template updates (ignite#825)

* fix: Template updates

* feat: sendMsg*  actions, Msg* message creation

* feat: Add true Error()s

* fix: Change `chain` to `generated`

* fix: tsc ignore imported dependency

* Updated generated JS/TS for SDK modules

* feat: Add get all pages option to queries

* fiix: Pass all option to subscription

* feat: Add query returns from store

* WIP v0.15 Layout

* Regenerated JS/TS

* fix: stale state, return from getters

* Regenerated TS/JS

* JS Template changes

* Regenerated JS/TS

* Additional template changes

* fix: Template changes

* Regenerated TS/JS

* templates: sync pre generated js

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Co-authored-by: Alex Megalokonomos <alex@clockwork.gr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0