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.39.0 to 0.40.0

dist/script/dftx/dftx_icxorderbook.d.ts

18

dist/buffer/buffer_composer.d.ts

@@ -82,2 +82,12 @@ import BigNumber from 'bignumber.js';

/**
* HEX String with length specified, encoded into Buffer as the same order of the Hex String.
* In short this read a hex and push it into the Buffer. It will not re-order the endian.
*
* When hex is `undefined` it will write `0x00` signifying zero byte length.
*
* @param getter to read HEX String. Writes its length then write the HEX string. Defaults to empty string.
* @param setter to read ordered Buffer and set as the same ordered HEX String
*/
static varUIntOptionalHex(getter: () => string | undefined, setter: (data: string | undefined) => void): BufferComposer;
/**
* Same behavior with `hex` when the field is defined

@@ -139,2 +149,10 @@ * `toBuffer` resulted empty SmartBuffer

/**
* VarUInt sized hex string, encoded into Buffer as the same order of the hex String.
* In short this read a VarUInt sized hex and push it into the Buffer. It will not re-order the endian.
*
* @param getter to read hex String and write as the same ordered Buffer
* @param setter to read ordered Buffer and set as the same ordered hex String
*/
static varUIntHex(getter: () => string, setter: (data: string) => void): BufferComposer;
/**
* Unsigned Int8, 1 byte

@@ -141,0 +159,0 @@ *

@@ -167,2 +167,36 @@ "use strict";

/**
* HEX String with length specified, encoded into Buffer as the same order of the Hex String.
* In short this read a hex and push it into the Buffer. It will not re-order the endian.
*
* When hex is `undefined` it will write `0x00` signifying zero byte length.
*
* @param getter to read HEX String. Writes its length then write the HEX string. Defaults to empty string.
* @param setter to read ordered Buffer and set as the same ordered HEX String
*/
static varUIntOptionalHex(getter, setter) {
return {
fromBuffer: (buffer) => {
const length = buffer_varuint_1.readVarUInt(buffer);
if (length > 0) {
const buff = Buffer.from(buffer.readBuffer(length));
setter(buff.toString('hex'));
}
},
toBuffer: (buffer) => {
const hex = getter();
if (hex !== undefined) {
if (hex === '') {
throw new Error('ComposableBuffer.varUIntOptionalHex.toBuffer attempting to write empty buffer');
}
const buff = Buffer.from(hex, 'hex');
buffer_varuint_1.writeVarUInt(buff.length, buffer);
buffer.writeBuffer(buff);
}
else {
buffer_varuint_1.writeVarUInt(0x00, buffer);
}
}
};
}
/**
* Same behavior with `hex` when the field is defined

@@ -312,2 +346,23 @@ * `toBuffer` resulted empty SmartBuffer

/**
* VarUInt sized hex string, encoded into Buffer as the same order of the hex String.
* In short this read a VarUInt sized hex and push it into the Buffer. It will not re-order the endian.
*
* @param getter to read hex String and write as the same ordered Buffer
* @param setter to read ordered Buffer and set as the same ordered hex String
*/
static varUIntHex(getter, setter) {
return {
fromBuffer: (buffer) => {
const length = buffer_varuint_1.readVarUInt(buffer);
const buff = Buffer.from(buffer.readBuffer(length));
setter(buff.toString('hex'));
},
toBuffer: (buffer) => {
const buff = Buffer.from(getter(), 'hex');
buffer_varuint_1.writeVarUInt(buff.length, buffer);
buffer.writeBuffer(buff);
}
};
}
/**
* Unsigned Int8, 1 byte

@@ -314,0 +369,0 @@ *

import BigNumber from 'bignumber.js';
import { BufferComposer, ComposableBuffer } from '../../buffer/buffer_composer';
import { Script } from '../../tx';
export interface LiqPoolSplit {

@@ -38,2 +39,48 @@ tokenId: number;

}
export declare type ProposalType = 0x01 | 0x03;
export declare type ProposalCycles = 0x01 | 0x02 | 0x03;
export interface CreateProposal {
type: ProposalType;
address: Script;
amount: BigNumber;
cycles: ProposalCycles;
title: string;
}
export interface CreateCfp extends CreateProposal {
type: 0x01;
}
export interface CreateVoc extends CreateProposal {
type: 0x03;
cycles: 0x02;
}
/**
* Composable CCreateProposal, C stands for Composable.
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer.
*/
export declare class CCreateProposal extends ComposableBuffer<CreateProposal> {
composers(ccp: CreateCfp | CreateVoc): BufferComposer[];
}
export declare class CCreateCfp extends CCreateProposal {
static OP_CODE: number;
static OP_NAME: string;
}
export declare class CCreateVoc extends CCreateProposal {
static OP_CODE: number;
static OP_NAME: string;
}
export declare type VoteDecision = 0x01 | 0x02 | 0x03;
export interface Vote {
proposalId: string;
masternodeId: string;
voteDecision: VoteDecision;
}
/**
* Composable CVote, C stands for Composable.
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer.
*/
export declare class CVote extends ComposableBuffer<Vote> {
static OP_CODE: number;
static OP_NAME: string;
composers(vote: Vote): BufferComposer[];
}
//# sourceMappingURL=dftx_governance.d.ts.map

45

dist/script/dftx/dftx_governance.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSetGovernance = exports.CGovernanceVar = exports.CLiqPoolSplit = void 0;
exports.CVote = exports.CCreateVoc = exports.CCreateCfp = exports.CCreateProposal = exports.CSetGovernance = exports.CGovernanceVar = exports.CLiqPoolSplit = void 0;
const buffer_bignumber_1 = require("../../buffer/buffer_bignumber");
const buffer_composer_1 = require("../../buffer/buffer_composer");
const tx_composer_1 = require("../../tx_composer");
class CLiqPoolSplit extends buffer_composer_1.ComposableBuffer {

@@ -78,2 +79,44 @@ composers(lps) {

CSetGovernance.OP_NAME = 'OP_DEFI_TX_SET_GOVERNANCE';
/**
* Composable CCreateProposal, C stands for Composable.
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer.
*/
class CCreateProposal extends buffer_composer_1.ComposableBuffer {
composers(ccp) {
return [
buffer_composer_1.ComposableBuffer.uInt8(() => ccp.type, v => ccp.type = v),
buffer_composer_1.ComposableBuffer.single(() => ccp.address, v => ccp.address = v, v => new tx_composer_1.CScript(v)),
buffer_composer_1.ComposableBuffer.satoshiAsBigNumber(() => ccp.amount, v => ccp.amount = v),
buffer_composer_1.ComposableBuffer.uInt8(() => ccp.cycles, v => ccp.cycles = v),
buffer_composer_1.ComposableBuffer.varUIntUtf8BE(() => ccp.title, v => ccp.title = v)
];
}
}
exports.CCreateProposal = CCreateProposal;
class CCreateCfp extends CCreateProposal {
}
exports.CCreateCfp = CCreateCfp;
CCreateCfp.OP_CODE = 0x46; // 'F'
CCreateCfp.OP_NAME = 'OP_DEFI_TX_CREATE_CFP';
class CCreateVoc extends CCreateProposal {
}
exports.CCreateVoc = CCreateVoc;
CCreateVoc.OP_CODE = 0x45; // 'E'
CCreateVoc.OP_NAME = 'OP_DEFI_TX_CREATE_VOC';
/**
* Composable CVote, C stands for Composable.
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer.
*/
class CVote extends buffer_composer_1.ComposableBuffer {
composers(vote) {
return [
buffer_composer_1.ComposableBuffer.hexBEBufferLE(32, () => vote.proposalId, v => vote.proposalId = v),
buffer_composer_1.ComposableBuffer.hexBEBufferLE(32, () => vote.masternodeId, v => vote.masternodeId = v),
buffer_composer_1.ComposableBuffer.uInt8(() => vote.voteDecision, v => vote.voteDecision = v)
];
}
}
exports.CVote = CVote;
CVote.OP_CODE = 0x56; // 'V'
CVote.OP_NAME = 'OP_DEFI_TX_CREATE_CFP';
//# sourceMappingURL=dftx_governance.js.map

2

dist/script/dftx/dftx_misc.js

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

const buffer_composer_1 = require("../../buffer/buffer_composer");
// Disabling no-return-assign makes the code cleaner with the setter and getter */
/* eslint-disable no-return-assign */
/**

@@ -9,0 +7,0 @@ * Composable UtxosToAccount, C stands for Composable.

@@ -12,3 +12,5 @@ "use strict";

const dftx_unmapped_1 = require("./dftx_unmapped");
const dftx_icxorderbook_1 = require("./dftx_icxorderbook");
const dftx_governance_1 = require("./dftx_governance");
const dftx_loans_1 = require("./dftx_loans");
/**

@@ -105,2 +107,22 @@ * Composable DfTx, C stands for Composable.

return compose(dftx_governance_1.CSetGovernance.OP_NAME, d => new dftx_governance_1.CSetGovernance(d));
case dftx_icxorderbook_1.CICXCreateOrder.OP_CODE:
return compose(dftx_icxorderbook_1.CICXCreateOrder.OP_NAME, d => new dftx_icxorderbook_1.CICXCreateOrder(d));
case dftx_icxorderbook_1.CICXMakeOffer.OP_CODE:
return compose(dftx_icxorderbook_1.CICXMakeOffer.OP_NAME, d => new dftx_icxorderbook_1.CICXMakeOffer(d));
case dftx_governance_1.CCreateCfp.OP_CODE:
return compose(dftx_governance_1.CCreateCfp.OP_NAME, d => new dftx_governance_1.CCreateCfp(d));
case dftx_governance_1.CCreateVoc.OP_CODE:
return compose(dftx_governance_1.CCreateVoc.OP_NAME, d => new dftx_governance_1.CCreateVoc(d));
case dftx_governance_1.CVote.OP_CODE:
return compose(dftx_governance_1.CVote.OP_NAME, d => new dftx_governance_1.CVote(d));
case dftx_icxorderbook_1.CICXSubmitDFCHTLC.OP_CODE:
return compose(dftx_icxorderbook_1.CICXSubmitDFCHTLC.OP_NAME, d => new dftx_icxorderbook_1.CICXSubmitDFCHTLC(d));
case dftx_loans_1.CCreateLoanScheme.OP_CODE:
return compose(dftx_loans_1.CCreateLoanScheme.OP_NAME, d => new dftx_loans_1.CCreateLoanScheme(d));
case dftx_loans_1.CSetDefaultLoanScheme.OP_CODE:
return compose(dftx_loans_1.CSetDefaultLoanScheme.OP_NAME, d => new dftx_loans_1.CSetDefaultLoanScheme(d));
case dftx_icxorderbook_1.CICXSubmitEXTHTLC.OP_CODE:
return compose(dftx_icxorderbook_1.CICXSubmitEXTHTLC.OP_NAME, d => new dftx_icxorderbook_1.CICXSubmitEXTHTLC(d));
case dftx_icxorderbook_1.CICXClaimDFCHTLC.OP_CODE:
return compose(dftx_icxorderbook_1.CICXClaimDFCHTLC.OP_NAME, d => new dftx_icxorderbook_1.CICXClaimDFCHTLC(d));
default:

@@ -107,0 +129,0 @@ return compose(dftx_unmapped_1.CDeFiOpUnmapped.OP_NAME, d => new dftx_unmapped_1.CDeFiOpUnmapped(d));

@@ -13,3 +13,5 @@ /// <reference types="node" />

export * from './dftx_token';
export * from './dftx_loans';
export * from './dftx_unmapped';
export * from './dftx_icxorderbook';
export * from './dftx';

@@ -16,0 +18,0 @@ /**

@@ -29,3 +29,5 @@ "use strict";

__exportStar(require("./dftx_token"), exports);
__exportStar(require("./dftx_loans"), exports);
__exportStar(require("./dftx_unmapped"), exports);
__exportStar(require("./dftx_icxorderbook"), exports);
__exportStar(require("./dftx"), exports);

@@ -32,0 +34,0 @@ const DEFI_SIGNATURE = '44665478'; // DfTx

@@ -20,4 +20,6 @@ /// <reference types="node" />

import { AppointOracle, RemoveOracle, SetOracleData, UpdateOracle } from './dftx/dftx_oracles';
import { CreateLoanScheme, SetDefaultLoanScheme } from './dftx/dftx_loans';
import { SetGovernance, CreateCfp, CreateVoc, Vote } from './dftx/dftx_governance';
import { ICXCreateOrder, ICXMakeOffer, ICXSubmitDFCHTLC, ICXSubmitEXTHTLC, ICXClaimDFCHTLC } from './dftx/dftx_icxorderbook';
import { CreateMasternode, ResignMasternode } from './dftx/dftx_masternode';
import { SetGovernance } from './dftx/dftx_governance';
/**

@@ -102,2 +104,12 @@ * @param num to map as OPCode, 1 byte long

OP_DEFI_TX_SET_GOVERNANCE: (setGovernance: SetGovernance) => OP_DEFI_TX;
OP_DEFI_TX_ICX_CREATE_ORDER: (createOrder: ICXCreateOrder) => OP_DEFI_TX;
OP_DEFI_TX_ICX_MAKE_OFFER: (makeOffer: ICXMakeOffer) => OP_DEFI_TX;
OP_DEFI_TX_CREATE_CFP: (createCfp: CreateCfp) => OP_DEFI_TX;
OP_DEFI_TX_CREATE_VOC: (createVoc: CreateVoc) => OP_DEFI_TX;
OP_DEFI_TX_VOTE: (vote: Vote) => OP_DEFI_TX;
OP_DEFI_TX_ICX_SUBMIT_DFC_HTLC: (icxSubmitDFCHTLC: ICXSubmitDFCHTLC) => OP_DEFI_TX;
OP_DEFI_TX_CREATE_LOAN_SCHEME: (createLoanScheme: CreateLoanScheme) => OP_DEFI_TX;
OP_DEFI_TX_SET_DEFAULT_LOAN_SCHEME: (setDefaultLoanScheme: SetDefaultLoanScheme) => OP_DEFI_TX;
OP_DEFI_TX_ICX_SUBMIT_EXT_HTLC: (icxSubmitEXTHTLC: ICXSubmitEXTHTLC) => OP_DEFI_TX;
OP_DEFI_TX_ICX_CLAIM_DFC_HTLC: (icxClaimDFCHTLC: ICXClaimDFCHTLC) => OP_DEFI_TX;
OP_0: constants.OP_0;

@@ -104,0 +116,0 @@ OP_FALSE: constants.OP_FALSE;

@@ -43,5 +43,7 @@ "use strict";

const dftx_oracles_1 = require("./dftx/dftx_oracles");
const dftx_loans_1 = require("./dftx/dftx_loans");
const dftx_misc_1 = require("./dftx/dftx_misc");
const dftx_governance_1 = require("./dftx/dftx_governance");
const dftx_icxorderbook_1 = require("./dftx/dftx_icxorderbook");
const dftx_masternode_1 = require("./dftx/dftx_masternode");
const dftx_governance_1 = require("./dftx/dftx_governance");
/**

@@ -299,2 +301,82 @@ * @param num to map as OPCode, 1 byte long

},
OP_DEFI_TX_ICX_CREATE_ORDER: (createOrder) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_icxorderbook_1.CICXCreateOrder.OP_CODE,
name: dftx_icxorderbook_1.CICXCreateOrder.OP_NAME,
data: createOrder
});
},
OP_DEFI_TX_ICX_MAKE_OFFER: (makeOffer) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_icxorderbook_1.CICXMakeOffer.OP_CODE,
name: dftx_icxorderbook_1.CICXMakeOffer.OP_NAME,
data: makeOffer
});
},
OP_DEFI_TX_CREATE_CFP: (createCfp) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_governance_1.CCreateCfp.OP_CODE,
name: dftx_governance_1.CCreateCfp.OP_NAME,
data: createCfp
});
},
OP_DEFI_TX_CREATE_VOC: (createVoc) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_governance_1.CCreateVoc.OP_CODE,
name: dftx_governance_1.CCreateVoc.OP_NAME,
data: createVoc
});
},
OP_DEFI_TX_VOTE: (vote) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_governance_1.CVote.OP_CODE,
name: dftx_governance_1.CVote.OP_NAME,
data: vote
});
},
OP_DEFI_TX_ICX_SUBMIT_DFC_HTLC: (icxSubmitDFCHTLC) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_icxorderbook_1.CICXSubmitDFCHTLC.OP_CODE,
name: dftx_icxorderbook_1.CICXSubmitDFCHTLC.OP_NAME,
data: icxSubmitDFCHTLC
});
},
OP_DEFI_TX_CREATE_LOAN_SCHEME: (createLoanScheme) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_loans_1.CCreateLoanScheme.OP_CODE,
name: dftx_loans_1.CCreateLoanScheme.OP_NAME,
data: createLoanScheme
});
},
OP_DEFI_TX_SET_DEFAULT_LOAN_SCHEME: (setDefaultLoanScheme) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_loans_1.CSetDefaultLoanScheme.OP_CODE,
name: dftx_loans_1.CSetDefaultLoanScheme.OP_NAME,
data: setDefaultLoanScheme
});
},
OP_DEFI_TX_ICX_SUBMIT_EXT_HTLC: (icxSubmitEXTHTLC) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_icxorderbook_1.CICXSubmitEXTHTLC.OP_CODE,
name: dftx_icxorderbook_1.CICXSubmitEXTHTLC.OP_NAME,
data: icxSubmitEXTHTLC
});
},
OP_DEFI_TX_ICX_CLAIM_DFC_HTLC: (icxClaimDFCHTLC) => {
return new dftx_1.OP_DEFI_TX({
signature: dftx_2.CDfTx.SIGNATURE,
type: dftx_icxorderbook_1.CICXClaimDFCHTLC.OP_CODE,
name: dftx_icxorderbook_1.CICXClaimDFCHTLC.OP_NAME,
data: icxClaimDFCHTLC
});
},
OP_0: new constants.OP_0(),

@@ -301,0 +383,0 @@ OP_FALSE: new constants.OP_FALSE(),

@@ -9,4 +9,2 @@ "use strict";

const jellyfish_crypto_1 = require("@defichain/jellyfish-crypto");
// Disabling no-return-assign makes the code cleaner with the setter and getter */
/* eslint-disable no-return-assign */
/**

@@ -13,0 +11,0 @@ * USE CTransaction AT YOUR OWN RISK.

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

class CWitnessProgram extends buffer_composer_1.ComposableBuffer {
/* eslint-disable no-return-assign */
composers(wp) {

@@ -14,0 +13,0 @@ return [

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

@@ -41,5 +41,5 @@ "DeFiChain",

"dependencies": {
"@defichain/jellyfish-crypto": "^0.39.0",
"@defichain/jellyfish-crypto": "^0.40.0",
"smart-buffer": "^4.1.0"
}
}

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 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 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 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 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 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 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 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 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 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 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