New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@defichain/jellyfish-transaction

Package Overview
Dependencies
Maintainers
2
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@defichain/jellyfish-transaction - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

dist/buffer/buffer_bignumber.d.ts

8

dist/buffer/buffer_composer.d.ts

@@ -21,3 +21,3 @@ import BigNumber from 'bignumber.js';

/**
* @param buffer to compose into Object
* @param {SmartBuffer} buffer to compose into Object
*/

@@ -109,3 +109,3 @@ constructor(buffer: SmartBuffer);

/**
* Unsigned BigInt, 8 bytes
* Unsigned BigNumber, 8 bytes
*

@@ -115,5 +115,5 @@ * @param getter to read from to buffer

*/
static bigUInt64(getter: () => BigInt, setter: (data: BigInt) => void): BufferComposer;
static bigNumberUInt64(getter: () => BigNumber, setter: (data: BigNumber) => void): BufferComposer;
/**
* Unsigned bigint/satoshi as BigNumber, 8 bytes
* Unsigned satoshi as BigNumber, 8 bytes
* BigNumber is multiplied/divided by 100,000,000

@@ -120,0 +120,0 @@ *

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComposableBuffer = void 0;
const bignumber_js_1 = __importDefault(require("bignumber.js"));
const smart_buffer_1 = require("smart-buffer");
const buffer_varuint_1 = require("./buffer_varuint");
const ONE_HUNDRED_MILLION = new bignumber_js_1.default('100000000');
const buffer_bignumber_1 = require("./buffer_bignumber");
/**

@@ -228,3 +224,3 @@ * A highly composable buffer, by defining a list of composer, it allows bi-directional buffer to object serialization.

/**
* Unsigned BigInt, 8 bytes
* Unsigned BigNumber, 8 bytes
*

@@ -234,9 +230,9 @@ * @param getter to read from to buffer

*/
static bigUInt64(getter, setter) {
static bigNumberUInt64(getter, setter) {
return {
fromBuffer: (buffer) => {
setter(buffer.readBigUInt64LE());
setter(buffer_bignumber_1.readBigNumberUInt64(buffer));
},
toBuffer: (buffer) => {
buffer.writeBigUInt64LE(getter().valueOf());
buffer_bignumber_1.writeBigNumberUInt64(getter(), buffer);
}

@@ -246,3 +242,3 @@ };

/**
* Unsigned bigint/satoshi as BigNumber, 8 bytes
* Unsigned satoshi as BigNumber, 8 bytes
* BigNumber is multiplied/divided by 100,000,000

@@ -254,8 +250,6 @@ *

static satoshiAsBigNumber(getter, setter) {
return ComposableBuffer.bigUInt64(() => {
const number = getter().multipliedBy(ONE_HUNDRED_MILLION).toString(10);
return BigInt(number);
return ComposableBuffer.bigNumberUInt64(() => {
return getter().multipliedBy(buffer_bignumber_1.ONE_HUNDRED_MILLION);
}, v => {
const number = new bignumber_js_1.default(v.toString()).dividedBy(ONE_HUNDRED_MILLION);
setter(number);
setter(v.dividedBy(buffer_bignumber_1.ONE_HUNDRED_MILLION));
});

@@ -262,0 +256,0 @@ }

import { SmartBuffer } from 'smart-buffer';
/**
* @param num to write as VarUInt (1-9 bytes)
* @param buffer to write to
* @param {number} num to write as VarUInt (1-9 bytes)
* @param {SmartBuffer} buffer to write to
*/

@@ -9,3 +9,3 @@ export declare function writeVarUInt(num: number, buffer: SmartBuffer): void;

* Read VarUInt as number
* @param buffer to read VarUInt from (1-9 bytes)
* @param {SmartBuffer} buffer to read VarUInt from (1-9 bytes)
* @throws RangeError 'out of Number.MAX_SAFE_INTEGER range' when it's out of MAX_SAFE_INTEGER

@@ -15,4 +15,4 @@ */

/**
* @param num to get total number bytes (1-9 bytes)
* @param {number} num to get total number bytes (1-9 bytes)
*/
export declare function byteLength(num: number): number;

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

/**
* @param num to write as VarUInt (1-9 bytes)
* @param buffer to write to
* @param {number} num to write as VarUInt (1-9 bytes)
* @param {SmartBuffer} buffer to write to
*/

@@ -36,3 +36,3 @@ function writeVarUInt(num, buffer) {

* Read VarUInt as number
* @param buffer to read VarUInt from (1-9 bytes)
* @param {SmartBuffer} buffer to read VarUInt from (1-9 bytes)
* @throws RangeError 'out of Number.MAX_SAFE_INTEGER range' when it's out of MAX_SAFE_INTEGER

@@ -60,3 +60,3 @@ */

/**
* @param num to get total number bytes (1-9 bytes)
* @param {number} num to get total number bytes (1-9 bytes)
*/

@@ -69,3 +69,3 @@ function byteLength(num) {

/**
* @param num to validate
* @param {number} num to validate
* @throws RangeError 'out of Number.MAX_SAFE_INTEGER range' when it's out of MAX_SAFE_INTEGER

@@ -72,0 +72,0 @@ */

@@ -45,6 +45,6 @@ import { EllipticPair } from '@defichain/jellyfish-crypto';

/**
* @param transaction to sign
* @param index of the vin to sign
* @param option input option
* @param sigHashType SIGHASH type
* @param {Transaction} transaction to sign
* @param {number} index of the vin to sign
* @param {SignInputOption} option input option
* @param {SIGHASH} sigHashType SIGHASH type
*/

@@ -51,0 +51,0 @@ signInput(transaction: Transaction, index: number, option: SignInputOption, sigHashType?: SIGHASH): Promise<Witness>;

@@ -38,2 +38,3 @@ "use strict";

const buffer_varuint_1 = require("./buffer/buffer_varuint");
const buffer_bignumber_1 = require("./buffer/buffer_bignumber");
var SIGHASH;

@@ -76,4 +77,4 @@ (function (SIGHASH) {

for (const vout of transaction.vout) {
const bigInt = BigInt(vout.value.multipliedBy('100000000').toString(10));
buffer.writeBigUInt64LE(bigInt);
const satoshi = vout.value.multipliedBy(buffer_bignumber_1.ONE_HUNDRED_MILLION);
buffer_bignumber_1.writeBigNumberUInt64(satoshi, buffer);
script_1.default.fromOpCodesToBuffer(vout.script.stack, buffer);

@@ -87,4 +88,4 @@ buffer_varuint_1.writeVarUInt(vout.dct_id, buffer);

*
* @param vin of the script
* @param signInputOption to sign the vin
* @param {Vin} vin of the script
* @param {SignInputOption} signInputOption to sign the vin
*/

@@ -144,6 +145,6 @@ function getScriptCode(vin, signInputOption) {

/**
* @param transaction to sign
* @param index of the vin to sign
* @param option input option
* @param sigHashType SIGHASH type
* @param {Transaction} transaction to sign
* @param {number} index of the vin to sign
* @param {SignInputOption} option input option
* @param {SIGHASH} sigHashType SIGHASH type
*/

@@ -150,0 +151,0 @@ signInput(transaction, index, option, sigHashType = SIGHASH.ALL) {

{
"private": false,
"name": "@defichain/jellyfish-transaction",
"version": "0.0.14",
"version": "0.0.15",
"description": "A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance on Bitcoin",

@@ -41,8 +41,5 @@ "keywords": [

"dependencies": {
"@defichain/jellyfish-crypto": "^0.0.14",
"@defichain/jellyfish-crypto": "^0.0.15",
"smart-buffer": "^4.1.0"
},
"devDependencies": {
"typescript": ">=4.2.0"
}
}
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