Skip to content

Commit

Permalink
feat(bindings-ts)!: require configuring network settings (stellar#852)
Browse files Browse the repository at this point in the history
* 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 <willem@ahalabs.dev>
  • Loading branch information
chadoh and willemneal committed Aug 21, 2023
1 parent 2966e7a commit 325cf4f
Show file tree
Hide file tree
Showing 46 changed files with 5,919 additions and 4,718 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ lint:
typescript-bindings-fixtures: build-test-wasms
cargo run -- contract bindings typescript \
--wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm \
--contract-name test_custom_types \
--contract-id CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE \
--contract-id CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4 \
--network futurenet \
--output-dir ./cmd/crates/soroban-spec-typescript/fixtures
--output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types \
--overwrite


# PHONY lists all the targets that aren't file names, so that make would skip the timestamp based check.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 325cf4f

Please sign in to comment.