Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scrypt-ts

Package Overview
Dependencies
Maintainers
2
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrypt-ts - npm Package Compare versions

Comparing version 0.1.5-beta.2 to 0.1.5-beta.3

.idea/codeStyles/codeStyleConfig.xml

2

dist/builtins/functions.d.ts

@@ -131,3 +131,3 @@ import { SigHashType } from "scryptlib";

*/
export declare function assert(cond: boolean): void;
export declare function assert(condition: boolean, msg?: string): asserts condition;
/**

@@ -134,0 +134,0 @@ * @category bitwise

@@ -195,9 +195,9 @@ "use strict";

*/
function assert(cond) {
if (!cond) {
throw new Error('Execution failed');
function assert(condition, msg) {
if (!condition) {
const message = 'Execution failed' + (msg ? `, ${msg}` : '');
throw new Error(message);
}
}
exports.assert = assert;
;
/**

@@ -204,0 +204,0 @@ * @category bitwise

@@ -5,39 +5,59 @@ import "reflect-metadata";

/**
* The input point where the smart contract is spent by the transaction
* A reference to an input of a transaction
*/
export declare type TxInputRef = {
export interface TxInputRef {
/** transaction object */
tx: bsv.Transaction;
/** an index indicating the position of inputs in this transaction */
inputIndex: number;
};
}
/**
* The transaction output point bound by the smart contract
* A reference to an output of a transaction
*/
export declare type TxOutputRef = {
export interface TxOutputRef {
/** transaction object */
tx: bsv.Transaction;
/** index of an output in this transaction */
outputIndex: number;
};
export declare type UTXO = {
}
export interface UTXO {
/** locking script */
scriptCode: ByteString;
/** amount in satoshis */
value: bigint;
/** outpoint referenced by this UTXO */
outpoint: Outpoint;
};
export declare type Outpoint = {
}
/**
* The structure used to refer to a particular transaction output
*/
export interface Outpoint {
/** txid of the transaction holding the output */
txid: ByteString;
/** index of the specific output */
outputIndex: bigint;
};
}
/**
* ScriptContext contains all the information in the transaction's preimage.
* ScriptContext contains all the information in the transaction's [preimage]{@link https://github.com/bitcoin-sv/bitcoin-sv/blob/master/doc/abc/replay-protected-sighash.md#digest-algorithm}.
* The preimage is automatically generated during the user's construction of the transaction,
* and the user does not need to calculate it explicitly
*/
export declare type ScriptContext = {
export interface ScriptContext {
/** version number of [transaction]{@link https://wiki.bitcoinsv.io/index.php/Bitcoin_Transactions#General_format_of_a_Bitcoin_transaction} */
nVersion: ByteString;
/** the specific UTXO spent by this transaction input */
utxo: UTXO;
/** double-SHA256 hash of the serialization of some/all input outpoints, see [hashPrevouts]{@link https://github.com/bitcoin-sv/bitcoin-sv/blob/master/doc/abc/replay-protected-sighash.md#hashprevouts} */
hashPrevouts: ByteString;
/** double-SHA256 hash of the serialization of some/all input sequence values, see [hashSequence]{@link https://github.com/bitcoin-sv/bitcoin-sv/blob/master/doc/abc/replay-protected-sighash.md#hashsequence} */
hashSequence: ByteString;
/** sequence number of [transaction input]{@link https://wiki.bitcoinsv.io/index.php/Bitcoin_Transactions#Format_of_a_Transaction_Input} */
nSequence: bigint;
/** double-SHA256 hash of the serialization of some/all output amount with its locking script, see [hashOutputs]{@link https://github.com/bitcoin-sv/bitcoin-sv/blob/master/doc/abc/replay-protected-sighash.md#hashoutputs} */
hashOutputs: ByteString;
/** locktime of [transaction]{@link https://wiki.bitcoinsv.io/index.php/Bitcoin_Transactions#General_format_of_a_Bitcoin_transaction} */
nLocktime: bigint;
/** [SIGHASH flag]{@link https://wiki.bitcoinsv.io/index.php/SIGHASH_flags} used by this input */
sigHashType: SigHashType;
};
}
/**

@@ -62,3 +82,3 @@ * The main contract class. To write a contract, extend this class as such:

private static _getScryptFile;
static _getCtxMethods(): string;
private static _getCtxMethods;
getCtxMethods(): string;

@@ -65,0 +85,0 @@ private getDelegateClazz;

@@ -34,3 +34,3 @@ "use strict";

const path_1 = require("path");
const idexer_1 = require("./idexer");
const indexer_1 = require("./indexer");
const scryptlib_1 = require("scryptlib");

@@ -102,7 +102,7 @@ const types_1 = require("./builtins/types");

let srcFile = Reflect.getMetadata("__filename", this);
let indexFile = idexer_1.Indexer.queryIndexFile(srcFile, process.cwd());
let indexFile = indexer_1.Indexer.queryIndexFile(srcFile, process.cwd());
if (!indexFile) {
throw new Error(`can not find \`scrypt.index.json\` file for contract \`${this.name}\`, search path from ${srcFile} to ${process.cwd()}`);
}
let indexer = new idexer_1.Indexer(indexFile);
let indexer = new indexer_1.Indexer(indexFile);
let filePath = indexer.getFullPath(scryptFile);

@@ -109,0 +109,0 @@ if (!fs.existsSync(filePath)) {

@@ -27,4 +27,5 @@ "use strict";

const path = __importStar(require("path"));
const idexer_1 = require("./idexer");
const indexer_1 = require("./indexer");
const transpiler_1 = require("./transpiler");
const dist_1 = require("scryptlib/dist");
/***

@@ -47,7 +48,7 @@ * @ignore

console.log('transformer loaded with options:', pluginOptions, '\n');
console.log('*'.repeat(20), 'path context', '*'.repeat(20));
console.log(Array(20).fill('*'), 'path context', Array(20).fill('*'));
console.log(`tsRootDir: ${tsRootDir}\ntsconfigDir: ${tsconfigDir}\njsOutDir: ${jsOutDir}\nscryptOutDir: ${scryptOutDir}`);
console.log('*'.repeat(50), '\n');
console.log(Array(50).fill('*'), '\n');
}
let indexer = new idexer_1.Indexer({ tsconfigDir, scryptOutDir });
let indexer = new indexer_1.Indexer({ tsconfigDir, scryptOutDir });
let checker = program.getTypeChecker();

@@ -102,3 +103,3 @@ /* Apply the transformation */

const newFile = tsInstance.createSourceFile(fileName, updatedText, languageVersion, true);
newFile.version = host.createHash(updatedText); // patch for making `tsc --watch` work
newFile.version = (0, dist_1.md5)(updatedText); // patch for making `tsc --watch` work
return newFile;

@@ -105,0 +106,0 @@ }

import * as ts from 'typescript';
import { Indexer } from './idexer';
import { Indexer } from './indexer';
import { Range } from './utils';
declare class EmittedLine {

@@ -24,11 +25,6 @@ prefixTabs: number;

}
export declare type Range = {
fileName: string;
start: ts.LineAndCharacter;
end: ts.LineAndCharacter;
};
export declare class TranspileError {
message: string;
srcRange: Range;
constructor(messge: string, srcRange: Range);
constructor(message: string, srcRange: Range);
}

@@ -53,3 +49,3 @@ export declare class Transpiler {

private outputScrypt;
private diagose;
private diagnose;
private outputDiagnostic;

@@ -61,3 +57,3 @@ private checkTransformedScrypt;

private isExtendsSCComponent;
private searchSmartContractCompnents;
private searchSmartContractComponents;
private getCoordinates;

@@ -64,0 +60,0 @@ private getRange;

@@ -0,3 +1,9 @@

import * as ts from 'typescript';
export interface Range {
fileName: string;
start: ts.LineAndCharacter;
end: ts.LineAndCharacter;
}
export { signTx, getPreimage } from 'scryptlib';
export declare function getBuildInType(type: string): string;
export declare function number2hex(val: number | bigint): string;
{
"name": "scrypt-ts",
"version": "0.1.5-beta.2",
"version": "0.1.5-beta.3",
"description": "A toolset for building sCrypt smart contract applications on Bitcoin SV network written in typescript.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc