@cashscript/utils 0.10.2 → 0.11.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/script.d.ts +2 -1
- package/dist/script.js +4 -4
- package/package.json +3 -3
package/dist/script.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { OpcodesBch2023 } from '@bitauth/libauth';
|
|
2
|
+
export declare const Op: typeof OpcodesBch2023;
|
|
2
3
|
export type Op = number;
|
|
3
4
|
export type OpOrData = Op | Uint8Array;
|
|
4
5
|
export type Script = OpOrData[];
|
package/dist/script.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpcodesBch2023, encodeDataPush, hexToBin, disassembleBytecodeBch, flattenBinArray, encodeAuthenticationInstructions, decodeAuthenticationInstructions, } from '@bitauth/libauth';
|
|
2
2
|
import { decodeInt, encodeInt } from './data.js';
|
|
3
3
|
import OptimisationsEquivFile from './cashproof-optimisations.js';
|
|
4
|
-
export const Op =
|
|
4
|
+
export const Op = OpcodesBch2023;
|
|
5
5
|
export function scriptToAsm(script) {
|
|
6
6
|
return bytecodeToAsm(scriptToBytecode(script));
|
|
7
7
|
}
|
|
@@ -49,7 +49,7 @@ export function asmToBytecode(asm) {
|
|
|
49
49
|
}
|
|
50
50
|
export function bytecodeToAsm(bytecode) {
|
|
51
51
|
// Convert the bytecode to libauth's ASM format
|
|
52
|
-
let asm =
|
|
52
|
+
let asm = disassembleBytecodeBch(bytecode);
|
|
53
53
|
// COnvert libauth's ASM format to BITBOX's
|
|
54
54
|
asm = asm.replace(/OP_PUSHBYTES_[^\s]+/g, '');
|
|
55
55
|
asm = asm.replace(/OP_PUSHDATA[^\s]+ [^\s]+/g, '');
|
|
@@ -61,7 +61,7 @@ export function bytecodeToAsm(bytecode) {
|
|
|
61
61
|
// TODO: If we decide to change the ASM / artifact format, we can remove this function and merge it with bytecodeToAsm
|
|
62
62
|
export function bytecodeToBitAuthAsm(bytecode) {
|
|
63
63
|
// Convert the bytecode to libauth's ASM format
|
|
64
|
-
let asm =
|
|
64
|
+
let asm = disassembleBytecodeBch(bytecode);
|
|
65
65
|
// COnvert libauth's ASM format to BitAuth Script ASM
|
|
66
66
|
asm = asm.replace(/OP_PUSHBYTES_[^\s]+/g, '');
|
|
67
67
|
asm = asm.replace(/OP_PUSHDATA[^\s]+ [^\s]+/g, '');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cashscript/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-next.0",
|
|
4
4
|
"description": "CashScript utilities and types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@bitauth/libauth": "^3.0.
|
|
43
|
+
"@bitauth/libauth": "^3.1.0-next.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "^29.4.1",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"jest": "^29.4.1",
|
|
49
49
|
"typescript": "^5.5.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "18df35aa3276e64fa64e92386106374d1d35b28d"
|
|
52
52
|
}
|