Skip to content
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

build: CI test bindings typescript-generated libs #874

Closed
wants to merge 8 commits into from

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Aug 19, 2023

What

Add CI test to run the tests in cmd/crates/soroban-spec-typescript/ts-tests

Why

This will ensure that the generated typescript libraries continue to work as they should.

Known limitations

You can see that right now this workflow needs to install soroban-cli 0.9.4 rather than the one from the repo itself. This is because the repo itself is currently broken with the quickstart Docker image. Once we start keeping main in a working state with quickstart, we can fix this.

willemneal and others added 6 commits August 9, 2023 11:27
…th (stellar#833)

* feat(CLI): Each generated contract method adds <contract-arg>-file-path

This allows passing file paths in place of arguments.  Files are read as strings for all types except Bytes and BytesN where the file is read as raw bytes.

The info about the new args is in the help doc header for each subcommand, otherwise the new args are hidden to not clog up the help documentation.

* fix: docs

* feat: add conflicts_with to arg-file for normal arg

---------

Co-authored-by: Paul Bellamy <[email protected]>
* feat(CLI): add output type to contract inspect

Now it can also output base64 xdr of the spec and an array of entries each encoded as base64  xdr.

* fix: move array to spec definition

---------

Co-authored-by: Tsachi Herman <[email protected]>
…ar#828)

* feat: fund command

* feat: move `config identity`

Also use `network` on `config identity generate`

* fix: allow for https and provide better errors

* fix: docs and fmt

* fix: get url from rpc and add openssl

* fix: docs

* fix: skip https on windows for now

* fix: prevent windows in cargo.toml
Fixes stellar#752

Removes the `--contract-name` argument from `bindings typescript`, since
this was often confused with `--output-dir` and, really, just using the
file path from the end of `--output-dir` is sufficient.

Adds `--overwrite`. If you specify an `--output-dir` that already
exists, by default it will not be overwritten. Instead, a descriptive error
will be thrown, letting you know that you can add `--overwrite` to
overwrite the directory.

Previously, if you specified an `--output-dir` that already existed, it
would create a new directory with the same name inside this directory,
which can lead to confusing bugs.

Co-authored-by: Tsachi Herman <[email protected]>
* fix(CLI): make aliases visible in help doc

* fix: Move extra arg docs to long about so top help is more readable
chadoh and others added 2 commits August 21, 2023 15:35
* feat(bindings-ts)!: require configuring network settings

Generated libraries now export a `Contract` class that needs to be
instantiated by the user with RPC URL, Network Passphrase, and contract
ID.

* feat(bindings-ts): add test config for generated fixtures

* feat: test drive error-parsing in client libs

this logic was totally broken! thanks for showing us, tests.

* chore: add failing custom type test

* chore: demonstrate complex enum shortcomings

you can see here that

- the input needs the `as const`
- but to make that work for complex types, a `readonly` is needed in the
  typing

additionally, the input and output are typed differently:

- the input needs to be wrapped in an array
- the output does not

also, for enums that do not have `values`, you still need to specify
`values: undefined`

* chore: demonstrate many struct encoding problems

* chore: demonstrate many struct encoding problems

* feat: no more need for `Method` suffix

When we exported functions for each method, we needed to make sure we
only used safe JS words. This no longer matters, since they're exposed
as methods on the `Contract` class.

Since this change required rebuilding the snapshot, I also made sure the
`readonly` settings were added to the source, rather than manually to
the snapshot.

* chore: finish testing all custom_type methods

* chore: remove placeholder signing machinery

* feat: add `networks` export to generated library

* chore: update generated README

* chore: fix formatting of generated file

* build: appease clippy

* docs: remove outdated '--name' from example

* docs: fix example in doc comment

Re: https://typedoc.org/tags/example/, it is best to use both `@example`
and the triple-backtick code block

* build: update snapshot build command

* docs: improve method-options TSDoc

---------

Co-authored-by: Willem Wyndham <[email protected]>
@chadoh
Copy link
Contributor Author

chadoh commented Aug 22, 2023

retargeting at #853 in AhaLabs#11; will re-open in this repo once the target branch is merged

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.

2 participants