sCrypt-Inc / scryptTS-examples

Examples of using scryptTS
https://scrypt.io/scryptTS
11 stars 5 forks source link

simplify code #22

Closed xhliu closed 1 year ago

xhliu commented 1 year ago

Remove types.ts and put UTXO in scrypt-ts directly. https://github.com/sCrypt-Inc/scryptTS-examples/blob/1bd3c7e461811000df169badb442b0e23c2ab529/src/types.ts#L3

Remove all bsv prefixes, looking redundant. Maybe re-export in scrypt-ts directly. https://github.com/sCrypt-Inc/scryptTS-examples/blob/1bd3c7e461811000df169badb442b0e23c2ab529/src/contracts/p2pkh.ts#L44-L48

msinkec commented 1 year ago

UTXO is already directly exported in scrypt-ts.

xhliu commented 1 year ago

bsv prefixes are still there. @msinkec

xhliu commented 1 year ago

Image

msinkec commented 1 year ago

I now import from the 'bsv' module explicitly. I think it's better to do so opposed to having everything a first class citizen to avoid confusion like this:

import { PrivKey, PrivateKey } from 'scrypt-ts'

which would be horrible.

However what I'd need is to import from the submodule directly, like this:

import { PrivateKey } from 'scrypt-ts/bsv'

I think this is not doable ATM, so here's an issue to track this: https://github.com/sCrypt-Inc/scrypt-ts/issues/191

Also the PR for scryptTS-examples: https://github.com/sCrypt-Inc/scryptTS-examples/pull/32