Skip to content

Commit

Permalink
feat(bindings-ts): support multi-auth workflows
Browse files Browse the repository at this point in the history
- switch from `ts-tests/package.json` to an `initialize.sh` script that
  uses a `.env` if available or defaults to environment variables. As
  before, this will build, deploy, and generate bindings for the new
  contracts, plus creating an `alice` and `bob` identities and minting
  separate amounts of two separate tokens to each of them
- add eslint to catch missing `await`s
- update to latest stellar-sdk instead of soroban-client
- add transaction-rebuilding to increment transaction sequence numbers,
  so that all tests can pass when run in parallel
- add `atomic_swap` and `token` contracts from
  https://github.com/stellar/soroban-examples to `test-wasms`
- add tests for atomic swap functionality inspired by
  https://github.com/stellar/soroban-react-atomic-swap
- let this logic guide needed updates to `bindings typescript`-generated
  libraries:
  - don't return flat values
  - instead, return a `new AssembledTransaction`, a class that has a
    `result` getter that can be used to get the result of the simulation
    right away, or can be used to `await tx.signAndSend()`, which then
    returns a `SentTransaction`
  - `SentTransaction` contains all possibly-relevant fields
    from the logic it performs, such as `sendTransactionAll`
  - `AssembledTransaction` has a `needsNonInvokerSigningBy()` getter
    and a `signAuthEntries()` to facilitate multi-auth workflows.
  - Since assembling transactions may now take place across multiple
    users' browsers, you can also call `json = tx.toJSON()` on an
    `AssembledTransaction` and then `contract.fromJSON[method](json)` on
    the next machine to continue signing, as shown in `test-swap.ts`

Co-authored-by: Aristides Staffieri <[email protected]>
Co-authored-by: George <[email protected]>
  • Loading branch information
3 people committed Dec 7, 2023
1 parent 91a441f commit 0ecb92d
Show file tree
Hide file tree
Showing 58 changed files with 10,523 additions and 3,981 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ version = "20.0.0"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "822ce6cc3e461ccc925275b472d77b6ca35b2cd9"

[workspace.dependencies.soroban-token-sdk]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "822ce6cc3e461ccc925275b472d77b6ca35b2cd9"

[workspace.dependencies.soroban-ledger-snapshot]
version = "20.0.0"
git = "https://github.com/stellar/rs-soroban-sdk"
Expand Down

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

Loading

0 comments on commit 0ecb92d

Please sign in to comment.