@cashscript/utils 0.10.0-next.3 → 0.10.0-next.5
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/artifact.d.ts +6 -4
- package/dist/script.d.ts +1 -1
- package/dist/script.js +3 -3
- package/package.json +2 -2
package/dist/artifact.d.ts
CHANGED
|
@@ -18,11 +18,13 @@ export interface DebugInformation {
|
|
|
18
18
|
export interface LogEntry {
|
|
19
19
|
ip: number;
|
|
20
20
|
line: number;
|
|
21
|
-
data: Array<
|
|
22
|
-
stackIndex: number;
|
|
23
|
-
type: string;
|
|
24
|
-
} | string>;
|
|
21
|
+
data: Array<LogData>;
|
|
25
22
|
}
|
|
23
|
+
export interface StackItem {
|
|
24
|
+
type: string;
|
|
25
|
+
stackIndex: number;
|
|
26
|
+
}
|
|
27
|
+
export declare type LogData = StackItem | string;
|
|
26
28
|
export interface RequireMessage {
|
|
27
29
|
ip: number;
|
|
28
30
|
line: number;
|
package/dist/script.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export declare function encodeNullDataScript(chunks: OpOrData[]): Uint8Array;
|
|
|
26
26
|
* @returns completed redeem script
|
|
27
27
|
*/
|
|
28
28
|
export declare function replaceBytecodeNop(script: Script): Script;
|
|
29
|
-
export declare function generateRedeemScript(baseScript: Script,
|
|
29
|
+
export declare function generateRedeemScript(baseScript: Script, encodedConstructorArgs: Script): Script;
|
|
30
30
|
export declare function optimiseBytecode(script: Script, runs?: number): Script;
|
package/dist/script.js
CHANGED
|
@@ -65,7 +65,7 @@ export function bytecodeToAsm(bytecode) {
|
|
|
65
65
|
export function bytecodeToBitAuthAsm(bytecode) {
|
|
66
66
|
// Convert the bytecode to libauth's ASM format
|
|
67
67
|
let asm = disassembleBytecodeBCH(bytecode);
|
|
68
|
-
// COnvert libauth's ASM format to
|
|
68
|
+
// COnvert libauth's ASM format to BitAuth Script ASM
|
|
69
69
|
asm = asm.replace(/OP_PUSHBYTES_[^\s]+/g, '');
|
|
70
70
|
asm = asm.replace(/OP_PUSHDATA[^\s]+ [^\s]+/g, '');
|
|
71
71
|
asm = asm.replace(/(^|\s)(0x\w*)/g, ' \<$2\>');
|
|
@@ -142,8 +142,8 @@ export function replaceBytecodeNop(script) {
|
|
|
142
142
|
// Minimally encode
|
|
143
143
|
return asmToScript(scriptToAsm(script));
|
|
144
144
|
}
|
|
145
|
-
export function generateRedeemScript(baseScript,
|
|
146
|
-
return replaceBytecodeNop([...
|
|
145
|
+
export function generateRedeemScript(baseScript, encodedConstructorArgs) {
|
|
146
|
+
return replaceBytecodeNop([...encodedConstructorArgs.slice().reverse(), ...baseScript]);
|
|
147
147
|
}
|
|
148
148
|
export function optimiseBytecode(script, runs = 1000) {
|
|
149
149
|
const optimisations = OptimisationsEquivFile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cashscript/utils",
|
|
3
|
-
"version": "0.10.0-next.
|
|
3
|
+
"version": "0.10.0-next.5",
|
|
4
4
|
"description": "CashScript utilities and types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"jest": "^29.4.1",
|
|
50
50
|
"typescript": "^4.1.5"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3d6611410e8c7ed9d760071a8c639e91c2cbb477"
|
|
53
53
|
}
|