Skip to content

Commit

Permalink
use BigInt function over literals to allow third party using bable / …
Browse files Browse the repository at this point in the history
…uglifyjs etc.

Ref: bcoin-org/bcrypto#33
  • Loading branch information
freedomhero committed Mar 16, 2021
1 parent c6910da commit a7efe48
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "scryptlib",
"version": "0.3.2-beta1",
"version": "0.3.2-beta2",
"description": "Javascript SDK for integration of Bitcoin SV Smart Contracts written in sCrypt language.",
"engines": {
"node": ">=12.0.0"
},
"main": "dist/index.js",
"types": "dist",
"browser":{
"browser": {
"child_process": false,
"fs": false
},
},
"scripts": {
"compile": "tsc -b",
"watch": "tsc -b -w",
Expand Down
8 changes: 4 additions & 4 deletions src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ class OpState {

toBigInt() : bigint {
if (this.op.opcodenum === Opcode.OP_1) {
return 1n;
return BigInt(1);
} else if (this.op.opcodenum === Opcode.OP_0) {
return 0n;
return BigInt(0);
} else if (this.op.opcodenum === Opcode.OP_1NEGATE) {
return -1n;
return BigInt(-1);
} else if (this.op.opcodenum >= Opcode.OP_2 && this.op.opcodenum <= Opcode.OP_16) {
return BigInt(this.op.opcodenum - Opcode.OP_2 + 2);
} else {
Expand All @@ -115,7 +115,7 @@ class OpState {
}

toBoolean() : boolean {
return this.toBigInt() !== 0n;
return this.toBigInt() !== BigInt(0);
}

toHex() : string {
Expand Down

0 comments on commit a7efe48

Please sign in to comment.