@cashscript/utils
Advanced tools
Comparing version 0.10.0-next.6 to 0.10.0
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { PathLike } from 'fs'; | ||
@@ -28,3 +27,3 @@ export interface AbiInput { | ||
} | ||
export declare type LogData = StackItem | string; | ||
export type LogData = StackItem | string; | ||
export interface RequireStatement { | ||
@@ -31,0 +30,0 @@ ip: number; |
import { Script } from './script.js'; | ||
export declare type LineToOpcodesMap = Record<string, Script>; | ||
export declare type LineToAsmMap = Record<string, string>; | ||
export type LineToOpcodesMap = Record<string, Script>; | ||
export type LineToAsmMap = Record<string, string>; | ||
export declare function buildLineToOpcodesMap(bytecode: Script, sourceMap: string): LineToOpcodesMap; | ||
export declare function buildLineToAsmMap(bytecode: Script, sourceMap: string): LineToAsmMap; | ||
export declare function formatBitAuthScript(bytecode: Script, sourceMap: string, sourceCode: string): string; |
export declare const Op: typeof import("@bitauth/libauth").OpcodesBCH2023; | ||
export declare type Op = number; | ||
export declare type OpOrData = Op | Uint8Array; | ||
export declare type Script = OpOrData[]; | ||
export type Op = number; | ||
export type OpOrData = Op | Uint8Array; | ||
export type Script = OpOrData[]; | ||
export declare function scriptToAsm(script: Script): string; | ||
@@ -6,0 +6,0 @@ export declare function scriptToBitAuthAsm(script: Script): string; |
@@ -8,7 +8,5 @@ import { OpcodesBCH, encodeDataPush, hexToBin, disassembleBytecodeBCH, flattenBinArray, encodeAuthenticationInstructions, decodeAuthenticationInstructions, } from '@bitauth/libauth'; | ||
} | ||
// TODO: See note at bytecodeToAsm | ||
export function scriptToBitAuthAsm(script) { | ||
return bytecodeToBitAuthAsm(scriptToBytecode(script)); | ||
} | ||
// TODO: Figure out why OP_0 is decoded to an empty Uint8Array (while e.g. OP_3 is just OP_3) | ||
export function asmToScript(asm) { | ||
@@ -64,4 +62,3 @@ return bytecodeToScript(asmToBytecode(asm)); | ||
} | ||
// TODO: If we decide to change the ASM / artifact format, we can remove this function and merge it | ||
// with bytecodeToAsm | ||
// TODO: If we decide to change the ASM / artifact format, we can remove this function and merge it with bytecodeToAsm | ||
export function bytecodeToBitAuthAsm(bytecode) { | ||
@@ -68,0 +65,0 @@ // Convert the bytecode to libauth's ASM format |
@@ -74,3 +74,3 @@ import { PositionHint } from './types.js'; | ||
let prevEndColumn = 0; | ||
let prevHint; | ||
let prevHint = PositionHint.START; | ||
return sourceMap.split(';').map((entry) => { | ||
@@ -93,3 +93,3 @@ const [startLineStr, startColumnStr, endLineStr, endColumnStr, positionHintStr] = entry.split(':'); | ||
}, | ||
...(hint ? { positionHint: hint } : {}), | ||
positionHint: hint, | ||
}; | ||
@@ -96,0 +96,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export declare type Type = PrimitiveType | ArrayType | TupleType | BytesType; | ||
export type Type = PrimitiveType | ArrayType | TupleType | BytesType; | ||
export declare class ArrayType { | ||
@@ -45,7 +45,7 @@ elementType: Type; | ||
} | ||
export declare type SingleLocationData = { | ||
export type SingleLocationData = { | ||
location: LocationI; | ||
positionHint?: PositionHint; | ||
positionHint: PositionHint; | ||
}; | ||
export declare type FullLocationData = Array<SingleLocationData>; | ||
export type FullLocationData = Array<SingleLocationData>; | ||
export declare enum PositionHint { | ||
@@ -52,0 +52,0 @@ START = 0, |
@@ -176,2 +176,7 @@ export class ArrayType { | ||
// Denotes whether an opcode belongs to the "start" or "end" of the statement it's in (defaults to "start") | ||
// Examples: | ||
// require(true); --> the OP_VERIFY comes after the condition (OP_TRUE), so it should get a PositionHint.END | ||
// !true --> the OP_NOT comes after the condition (OP_TRUE), so it should get a PositionHint.END | ||
// if (true) { ... } --> the OP_IF comes before the body, so it should get a PositionHint.START, | ||
// the OP_ENDIF comes after the body, so it should get a PositionHint.END | ||
export var PositionHint; | ||
@@ -178,0 +183,0 @@ (function (PositionHint) { |
{ | ||
"name": "@cashscript/utils", | ||
"version": "0.10.0-next.6", | ||
"version": "0.10.0", | ||
"description": "CashScript utilities and types", | ||
@@ -13,7 +13,7 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/Bitcoin-com/cashscript/issues" | ||
"url": "https://github.com/CashScript/cashscript/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Bitcoin-com/cashscript.git" | ||
"url": "git+https://github.com/CashScript/cashscript.git" | ||
}, | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@bitauth/libauth": "^2.0.0", | ||
"@bitauth/libauth": "^3.0.0", | ||
"hash.js": "^1.1.7" | ||
@@ -52,5 +52,5 @@ }, | ||
"jest": "^29.4.1", | ||
"typescript": "^4.1.5" | ||
"typescript": "^5.5.4" | ||
}, | ||
"gitHead": "b26f1f20b89df6d857a5860eebd3bcc7668faa4e" | ||
"gitHead": "cd3031b60dc4ca2d2351608dfd838a50bcc7bbb9" | ||
} |
# @cashscript/utils | ||
[![Build Status](https://travis-ci.org/Bitcoin-com/cashscript.svg)](https://travis-ci.org/Bitcoin-com/cashscript) | ||
[![Coverage Status](https://img.shields.io/codecov/c/github/Bitcoin-com/cashscript.svg)](https://codecov.io/gh/Bitcoin-com/cashscript) | ||
[![Build Status](https://travis-ci.org/CashScript/cashscript.svg)](https://travis-ci.org/CashScript/cashscript) | ||
[![Coverage Status](https://img.shields.io/codecov/c/github/CashScript/cashscript.svg)](https://codecov.io/gh/CashScript/cashscript) | ||
[![NPM Version](https://img.shields.io/npm/v/@cashscript/utils.svg)](https://www.npmjs.com/package/@cashscript/utils) | ||
@@ -9,2 +9,2 @@ [![NPM Monthly Downloads](https://img.shields.io/npm/dm/@cashscript/utils.svg)](hhttps://www.npmjs.com/package/@cashscript/utils) | ||
`@cashscript/utils` is a package containing a number of utilities and types used by both the CashScript compiler and the JavaScript SDK. This package can be used by other applications as well, but it should be considered an unstable API and will not necessarily follow semantic versioning rules. So if you want to use `@cashscript/utils` as a standalone package, it is recommended to specify a specific version (instead of a range) in your `package.json`. | ||
`@cashscript/utils` is a package containing a number of utilities and types used by both the CashScript compiler and the TypeScript SDK. This package can be used by other applications as well, but it should be considered an unstable API and will not necessarily follow semantic versioning rules. So if you want to use `@cashscript/utils` as a standalone package, it is recommended to specify a specific version (instead of a range) in your `package.json`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44243
857
+ Added@bitauth/libauth@3.0.0(transitive)
- Removed@bitauth/libauth@2.1.0(transitive)
Updated@bitauth/libauth@^3.0.0