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

feat!: export ContractClient et al. in contract; rename SorobanRpc to rpc #962

Merged
merged 2 commits into from
May 15, 2024

Commits on May 15, 2024

  1. chore(contract-client): appease eslint

    This includes some fixes and updates to eslint configuration to make it
    work as expected
    
    - Extended `airbnb-typescript/base` to get it to stop yelling at me
      about importing files without file extension. Saw this recommended as
      the fix on StackOverflow [[1]]. And it makes sense to me that if we are
      extending Airbnb's lint rules and using TypeScript, we probably want
      their TypeScript-specific lint rules, too.
    - Added the `eslint-plugin-jsdoc` plugin because the old `valid-jsdoc`
      rule we were using has been deprecated [[2]], and this plugin is the new
      way. Previously we had `valid-jsdoc: 1` (with some extra customization),
      and my guess is that extending `plugin:jsdoc/recommended` (plus some
      customization) is roughly equivalent.
    - Researched [[3]] whether JSDoc `@param`-style docs or TSDoc-style
      `/** inline param docs */` work better. TSDoc work better. So disabled
      `jsdoc/require-param`.
    - Remove mostly-duplicate `src/soroban/.eslintrc.js`, which had only one
      setting different from `src/.eslintrc.js`
    
    Note that `src/contract_client` is now perhaps the only directory of
    code to pass our ESLint settings 🤔
    
      [1]: https://stackoverflow.com/a/67610259/249801
      [2]: https://eslint.org/docs/latest/rules/valid-jsdoc
      [3]: stellar#962 (comment)
    chadoh committed May 15, 2024
    Configuration menu
    Copy the full SHA
    e59a733 View commit details
    Browse the repository at this point in the history
  2. feat!: new exports contract and rpc

    - `SorobanRpc` now also exported as `rpc`
    
    - New main export `contract`
    
      This allows us to import it the usual way, instead of needing to do
      things like
    
          import { ContractClient } from "stellar-sdk/lib/contract_client"
    
      which doesn't work in the browser (because `lib`)
    
    - `ContractSpec` now available at `contract.Spec`
    
    - Also includes other supporting classes, functions, and types:
      - `contract.AssembledTransaction`
      - `contract.ClientOptions`
      - etc
    
    - These are also available at matching entrypoints, if your
    node and TypeScript configuration support the `exports` declaration:
    
        import {
          Client,
          ClientOptions,
          AssembledTransaction,
        } from 'stellar-sdk/contract'
    
    This also attempts to document exported modules. The JSDoc-style
    comments in `src/index.ts` don't actually show up when you import these
    things. We can figure this out later. Docs here
    https://jsdoc.app/howto-es2015-modules. In the meantime, these are still
    useful notes that we can use later.
    
    Co-authored-by: George <Shaptic@users.noreply.github.com>
    chadoh and Shaptic committed May 15, 2024
    Configuration menu
    Copy the full SHA
    7883dc3 View commit details
    Browse the repository at this point in the history