Post
Topic
Board Development & Technical Discussion
Re: Pure TypeScript library to operate with sats (zero-dependencies)
by
alerdenisov
on 30/08/2023, 14:53:07 UTC
I did quick test with few inscription and it seems to works properly. So here are few of my thought,
1. Is it right to assume your library only have function to look for sat properties of Ordinals inscription based on one of known value (e.g. decimal)?
2. It annoys me fromDecimal require me to enter string rather than decimal.

Code:
> Sat.fromDecimal(313225.1127208201)
<repl>.ts:29:17 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.

29 Sat.fromDecimal(313225.1127208201)
> Sat.fromDecimal("313225.1127208201")
Sat { n: 1308063627208201 }

3. Function fromString with parameter sat initially confuse me. Different name such as fromSat or fromSatNumber probably would be better.

Thank you for feedback. Sounds reasonable! About string as type of argument – let me check max precision of JS number and max possible decimal notation. If fix – i will add additional type.
Function fromString allow to pass any notation. I assume to deprecate original and introduce from or even parse, what do you think?

I don't want to ask any external API (such as explorer or bitcoin rpc) and let to use library inside quite limited environment with V8 interp. So any operations with inscription isn't available by design.

I will add rarity and exotic check function for Sat class and function to pass whole range for scan. I think that's all I can imagine without being tied to external data.