Skip to content

Commit

Permalink
fix: add custom bigint pow to prevent transpilers incorrect conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsan-javaid authored and reedrosenbluth committed Nov 30, 2021
1 parent 0d0b5fb commit f0334cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/transactions/src/clarity/types/intCV.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { IntegerType, intToBigInt } from '@stacks/common';
import { ClarityType } from '../constants';

const MAX_U128 = BigInt(2) ** BigInt(128) - BigInt(1);
const MAX_U128 = BigInt('0xffffffffffffffffffffffffffffffff'); // (2 ** 128 - 1)
const MIN_U128 = BigInt(0);
const MAX_I128 = BigInt(2) ** BigInt(127) - BigInt(1);
const MIN_I128 = BigInt(-2) ** BigInt(127);
const MAX_I128 = BigInt('0x7fffffffffffffffffffffffffffffff'); // (2 ** 127 - 1)
// no signed (negative) hex support in bigint constructor
const MIN_I128 = BigInt('-170141183460469231731687303715884105728'); // (-2 ** 127)

interface IntCV {
readonly type: ClarityType.Int;
Expand Down

1 comment on commit f0334cf

@vercel
Copy link

@vercel vercel bot commented on f0334cf Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.