hirosystems / stacks.js

JavaScript libraries for identity, auth, storage and transactions on the Stacks blockchain.
https://stacks.js.org
MIT License
944 stars 307 forks source link

`bigint` arguments #1678

Closed obycode closed 2 months ago

obycode commented 2 months ago

Problem

For all of the functions that take in values that represent Clarity ints and uints, they should probably accept bigint | number, since these types can be larger than a number (128-bit vs 64-bit).

Solution

Update the parameter types to be bigint | number.

Additional context

janniks commented 2 months ago

🙏🏻 We typically have an IntegerType for this where was it missing?

obycode commented 2 months ago

Oh, nice. I see that now. I was getting an error from signPoxSignature. It looks like just the period and reward cycle were the problem. Maybe that's intentional though?

janniks commented 2 months ago

Yeah, those we left as number intentionally, but maybe there's a case they should be bigint.

janniks commented 2 months ago

I'll close for now, please reopen if you feel bigint would be better. Realistically it should never be reached/needed, so I hope number is more understandable to be a lower "number" in users' minds -- but who knows :)