js-stellar-base
js-stellar-base copied to clipboard
Port to Typescript
This is a more direct way to address #183, and to add type safety to the library.
TODOs (copied from js-stellar-sdk migration)
- [x] Rename files from js to ts
- [ ] Fix errors from
npx tsc
- [ ] Make sure prettier is running on src/
- [ ] Upgrade to Webpack 4, since
ts-loader
won't run on Webpack 1 - [ ] Make codebase pass tslint
- [ ] Make sure tslint is running on src/ on commit
- [ ] Update types
- [ ] Pass CI tests
- [ ] Bump versions
- [ ] Release the
typescript
branch as an alpha - [ ] Fix or document backwards-incompatible type definitions
- [ ] Fix document generation
- [ ] Upgrade in-development projects to typescript build
- [ ] Once this has been up and used in production, merge into master
- [ ] How to handle XDR's auto-generated code? https://github.com/stellar/js-stellar-base/blob/master/src/generated/stellar-xdr_generated.js#L1
Files WIP
- [x] src/account.ts @abuiles
- [x] src/asset.ts @abuiles
- [x] src/base58.ts
- [ ] src/browser.ts
- [ ] src/generated/stellar-xdr_generated.ts
- [x] src/hashing.ts @Akuukis
- [ ] src/index.ts
- [ ] src/keypair.ts @Akuukis (revisit)
- [x] src/memo.ts @abuiles
- [x] src/network.ts @abuiles
- [ ] src/operation.ts
- [x] src/operations/account_merge.ts @abuiles
- [x] src/operations/allow_trust.ts @abuiles
- [x] src/operations/bump_sequence.ts @abuiles
- [x] src/operations/change_trust.ts @abuiles
- [x] src/operations/create_account.ts @abuiles
- [x] src/operations/create_passive_sell_offer.ts
- [ ] src/operations/index.ts
- [x] src/operations/inflation.ts
- [x] src/operations/manage_buy_offer.ts
- [x] src/operations/manage_data.ts
- [x] src/operations/manage_sell_offer.ts
- [x] src/operations/path_payment.ts
- [x] src/operations/payment.ts
- [x] src/operations/set_options.ts
- [x] src/signing.ts @abuiles
- [x] src/strkey.ts @abuiles
- [x] src/transaction.ts @Akuukis
- [ ] src/transaction_builder.ts
- [x] src/util/checksum.ts @abuiles
- [X] src/util/continued_fraction.ts @Akuukis
- [x] src/vendor/bs58.ts @Akuukis
@Akuukis @charlie-wasp I've kicked off gears for this, I'm pinging you since you both show interests on helping with this :).
I created a branch called typescript
where we can start merging updates. The first PR was very basic, it added TS to package.json and rename all the file https://github.com/stellar/js-stellar-base/pull/216
Now we need to make npx tsc
to actually work and setup the build/test pipeline. If you want to start updating files, I'll suggest you leave a comment here telling which files you are working on, so we don't overlap on each others work :). Also let's try to do small PRs so we can review and merge more easily.
Let's do this! 🚀
@abuiles Here's a batch of migrations:
- #240 Hashing, including fix for wider typings.
- #241 Continued Fraction
- #242 bs58
- #243 Keypair, including new error when neither secretKey or publicKey is provided
- #244 Transaction, doesn't compile yet due missing xdr types and many
any
- #245 Base58, including a hacky typecast from
number[]
to Buffer-alike that needs investigation - does
src/browser.ts
need anything at all? LGTM as it is.
@abuiles I believe, I'm pretty late for the party 😅 But it seems, that work is not over yet. How can I help here? Should I take some unchecked points from the top comment and work on them?
@charlie-wasp hey! Better late than never -- we still got some work to do. I'm happy if you can help on this, we have a branch with the current changes - we can continue work off that branch.