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

scrypt-ts

Package Overview
Dependencies
Maintainers
3
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 1.3.9-test.2 to 1.3.9

35

CHANGELOG.md
# CHANGELOG
## 1.3.9
- support attaching a NOP script (like 1sat ordinal) to a contract instance.
**example:**
```ts
const demo = new Demo(1n, 2n)
// connect to a signer
await demo.connect(getDefaultSigner())
const nopScript = bsv.Script.fromASM("OP_FALSE OP_IF ... OP_ENDIF");
demo.setNOPScript(nopScript)
// contract deployment
const deployTx = await demo.deploy(1)
console.log('Demo contract deployed: ', deployTx.id)
// create instance from transaction
let currentInstance = Demo.fromTx(deployTx, 0, {}, nopScript);
```
- add build-ins function `this.timeLock()`, see https://docs.scrypt.io/tutorials/timeLock
**example:**
```ts
assert(this.timeLock(this.locktime0), 'time lock for locktime0 failed')
```
## 1.3.8

@@ -4,0 +39,0 @@

27

dist/smart-contract/builtins/functions.d.ts

@@ -946,15 +946,28 @@ import { SigHashType, Ripemd160, Sha256, Sha1 } from "scryptlib";

/**
* build P2PKH script from PubKeyHash
* @param {PubKeyHash} pubKeyHash recipient's pubKeyHash
* @returns {ByteString} a `ByteString` that represents P2PKH script
* constructs a P2PKH script from a given PubKeyHash
* @param {PubKeyHash} pubKeyHash - the recipient's public key hash
* @returns {ByteString} a `ByteString` representing the P2PKH script
*/
static buildPublicKeyHashScript(pubKeyHash: PubKeyHash): ByteString;
/**
* build P2PKH output from PubKeyHash
* @param pubKeyHash the address to receive change coin
* @param amount satoshi amount
* @returns a P2PKH output
* constructs a P2PKH output from a given PubKeyHash and satoshi amount
* @param {PubKeyHash} pubKeyHash - the recipient's public key hash
* @param {bigint} amount - the satoshi amount
* @returns {ByteString} a `ByteString` representing the P2PKH output
*/
static buildPublicKeyHashOutput(pubKeyHash: PubKeyHash, amount: bigint): ByteString;
/**
* constructs a standard payment (P2PKH) script from a given address
* @param {Addr} addr - the recipient's address
* @returns {ByteString} a `ByteString` representing the P2PKH script
*/
static buildAddressScript(addr: Addr): ByteString;
/**
* constructs a standard payment (P2PKH) output from a given address and satoshi amount
* @param {Addr} addr - the recipient's address
* @param {bigint} amount - the satoshi amount
* @returns {ByteString} a `ByteString` representing the P2PKH output
*/
static buildAddressOutput(addr: Addr, amount: bigint): ByteString;
/**
* build `OP_FALSE OP_RETURN` script from data payload

@@ -961,0 +974,0 @@ * @param {ByteString} data the data payload

@@ -1102,5 +1102,5 @@ "use strict";

/**
* build P2PKH script from PubKeyHash
* @param {PubKeyHash} pubKeyHash recipient's pubKeyHash
* @returns {ByteString} a `ByteString` that represents P2PKH script
* constructs a P2PKH script from a given PubKeyHash
* @param {PubKeyHash} pubKeyHash - the recipient's public key hash
* @returns {ByteString} a `ByteString` representing the P2PKH script
*/

@@ -1112,6 +1112,6 @@ static buildPublicKeyHashScript(pubKeyHash) {

/**
* build P2PKH output from PubKeyHash
* @param pubKeyHash the address to receive change coin
* @param amount satoshi amount
* @returns a P2PKH output
* constructs a P2PKH output from a given PubKeyHash and satoshi amount
* @param {PubKeyHash} pubKeyHash - the recipient's public key hash
* @param {bigint} amount - the satoshi amount
* @returns {ByteString} a `ByteString` representing the P2PKH output
*/

@@ -1122,2 +1122,19 @@ static buildPublicKeyHashOutput(pubKeyHash, amount) {

/**
* constructs a standard payment (P2PKH) script from a given address
* @param {Addr} addr - the recipient's address
* @returns {ByteString} a `ByteString` representing the P2PKH script
*/
static buildAddressScript(addr) {
return Utils.buildPublicKeyHashScript(addr);
}
/**
* constructs a standard payment (P2PKH) output from a given address and satoshi amount
* @param {Addr} addr - the recipient's address
* @param {bigint} amount - the satoshi amount
* @returns {ByteString} a `ByteString` representing the P2PKH output
*/
static buildAddressOutput(addr, amount) {
return Utils.buildPublicKeyHashOutput(addr, amount);
}
/**
* build `OP_FALSE OP_RETURN` script from data payload

@@ -1124,0 +1141,0 @@ * @param {ByteString} data the data payload

@@ -151,2 +151,8 @@ import "reflect-metadata";

private _initDelegateInstance;
/**
* Only inherited classes can call this function.
* Direct subclasses of `SmartContract` do not need to call this function.
* @param args constructor parameters of inherited classes
* @onchain
*/
setConstructor(...args: any[]): void;

@@ -291,2 +297,17 @@ /**

/**
* Implements a time-based lock on a transaction until a specified `locktime` has been reached.
* The lock can be based on either block height or a UNIX timestamp.
*
* If the `locktime` is below 500,000,000, it's interpreted as a block height. Otherwise,
* it's interpreted as a UNIX timestamp. This function checks and ensures that the transaction's
* nSequence is less than `UINT_MAX`, and that the provided `locktime` has been reached or passed.
*
* @param {bigint} locktime - The block height or timestamp until which the transaction should be locked.
* @returns If `true` is returned, nlockTime and sequence in `this.ctx` are valid, otherwise they are invalid.
* @onchain
* @category Time Lock
* @see https://docs.scrypt.io/tutorials/timeLock
*/
timeLock(locktime: bigint): boolean;
/**
* Get the amount of the change output for `to.tx`.

@@ -494,3 +515,3 @@ * @onchain

*/
static fromLockingScript(script: string, offchainValues?: Record<string, any>): SmartContract;
static fromLockingScript(script: string, offchainValues?: Record<string, any>, nopScript?: bsv.Script): SmartContract;
/**

@@ -504,3 +525,3 @@ * recover a `SmartContract` instance from the transaction

*/
static fromTx<T extends SmartContract>(this: new (...args: any[]) => T, tx: bsv.Transaction, atOutputIndex: number, offchainValues?: Record<string, any>): T;
static fromTx<T extends SmartContract>(this: new (...args: any[]) => T, tx: bsv.Transaction, atOutputIndex: number, offchainValues?: Record<string, any>, nopScript?: bsv.Script): T;
/** @ignore */

@@ -526,6 +547,5 @@ private static dummySignMultiCallTx;

private static autoPayfee;
setNOPScript(nopScript: bsv.Script | null): void;
private static getNOPScript;
getNOPScript(): bsv.Script | null;
prependNOPScript(nopScript: bsv.Script | null): void;
getPrependNOPScript(): bsv.Script | null;
}
export {};
{
"name": "scrypt-ts",
"version": "1.3.9-test.2",
"version": "1.3.9",
"description": "A toolset for building sCrypt smart contract applications on Bitcoin SV network written in typescript.",

@@ -60,3 +60,3 @@ "main": "dist/index.js",

"reflect-metadata": "^0.1.13",
"scryptlib": "^2.1.26",
"scryptlib": "^2.1.29",
"socket.io-client": "^4.6.1",

@@ -63,0 +63,0 @@ "superagent": "^8.0.9"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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