@defichain/jellyfish-transaction
Advanced tools
Comparing version 3.30.4 to 3.31.0
@@ -69,2 +69,41 @@ import { BufferComposer, ComposableBuffer } from '@defichain/jellyfish-buffer'; | ||
/** | ||
* TransferDomainItem DeFi Transaction | ||
*/ | ||
export interface TransferDomainItem { | ||
address: Script; | ||
amount: TokenBalanceVarInt; | ||
domain: number; | ||
data?: number[]; | ||
} | ||
/** | ||
* Composable TransferDomainItem, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
export declare class CTransferDomainItem extends ComposableBuffer<TransferDomainItem> { | ||
composers(tdi: TransferDomainItem): BufferComposer[]; | ||
} | ||
export interface TransferDomainPair { | ||
src: TransferDomainItem; | ||
dst: TransferDomainItem; | ||
} | ||
/** | ||
* Composable TransferDomainPair, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
export declare class CTransferDomainPair extends ComposableBuffer<TransferDomainPair> { | ||
composers(tdi: TransferDomainPair): BufferComposer[]; | ||
} | ||
export interface TransferDomain { | ||
items: TransferDomainPair[]; | ||
} | ||
/** | ||
* Composable TransferDomain, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
export declare class CTransferDomain extends ComposableBuffer<TransferDomain> { | ||
static OP_CODE: number; | ||
static OP_NAME: string; | ||
composers(td: TransferDomain): BufferComposer[]; | ||
} | ||
/** | ||
* FutureSwap DeFi Transaction | ||
@@ -71,0 +110,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CSetFutureSwap = exports.CAnyAccountToAccount = exports.CAccountToAccount = exports.CAccountToUtxos = exports.CUtxosToAccount = void 0; | ||
exports.CSetFutureSwap = exports.CTransferDomain = exports.CTransferDomainPair = exports.CTransferDomainItem = exports.CAnyAccountToAccount = exports.CAccountToAccount = exports.CAccountToUtxos = exports.CUtxosToAccount = void 0; | ||
const jellyfish_buffer_1 = require("@defichain/jellyfish-buffer"); | ||
@@ -68,2 +68,62 @@ const tx_composer_1 = require("../../tx_composer"); | ||
/** | ||
* Composable TransferDomainItem, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
class CTransferDomainItem extends jellyfish_buffer_1.ComposableBuffer { | ||
composers(tdi) { | ||
return [ | ||
jellyfish_buffer_1.ComposableBuffer.single(() => tdi.address, v => tdi.address = v, v => new tx_composer_1.CScript(v)), | ||
jellyfish_buffer_1.ComposableBuffer.single(() => tdi.amount, v => tdi.amount = v, v => new dftx_balance_1.CTokenBalanceVarInt(v)), | ||
jellyfish_buffer_1.ComposableBuffer.uInt8(() => tdi.domain, v => tdi.domain = v), | ||
{ | ||
fromBuffer: (buffer) => { | ||
const array = []; | ||
if (buffer.remaining() > 0) { | ||
array.push(buffer.readUInt8()); | ||
} | ||
tdi.data = array; | ||
}, | ||
toBuffer: (buffer) => { | ||
if (tdi.data !== undefined) { | ||
for (let i = 0; i < tdi.data.length; i += 1) { | ||
buffer.writeUInt8(tdi.data[i]); | ||
} | ||
} | ||
else { | ||
buffer.writeUInt8(0x00); | ||
} | ||
} | ||
} | ||
]; | ||
} | ||
} | ||
exports.CTransferDomainItem = CTransferDomainItem; | ||
/** | ||
* Composable TransferDomainPair, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
class CTransferDomainPair extends jellyfish_buffer_1.ComposableBuffer { | ||
composers(tdi) { | ||
return [ | ||
jellyfish_buffer_1.ComposableBuffer.single(() => tdi.src, v => tdi.src = v, v => new CTransferDomainItem(v)), | ||
jellyfish_buffer_1.ComposableBuffer.single(() => tdi.dst, v => tdi.dst = v, v => new CTransferDomainItem(v)) | ||
]; | ||
} | ||
} | ||
exports.CTransferDomainPair = CTransferDomainPair; | ||
/** | ||
* Composable TransferDomain, C stands for Composable. | ||
* Immutable by design, bi-directional fromBuffer, toBuffer deep composer. | ||
*/ | ||
class CTransferDomain extends jellyfish_buffer_1.ComposableBuffer { | ||
composers(td) { | ||
return [ | ||
jellyfish_buffer_1.ComposableBuffer.compactSizeArray(() => td.items, v => td.items = v, v => new CTransferDomainPair(v)) | ||
]; | ||
} | ||
} | ||
exports.CTransferDomain = CTransferDomain; | ||
CTransferDomain.OP_CODE = 0x38; // '8' | ||
CTransferDomain.OP_NAME = 'OP_DEFI_TX_TRANSFER_DOMAIN'; | ||
/** | ||
* Composable FutureSwap, C stands for Composable. | ||
@@ -70,0 +130,0 @@ * Immutable by design, bi-directional fromBuffer, toBuffer deep composer. |
@@ -93,2 +93,4 @@ "use strict"; | ||
return compose(dftx_account_1.CAccountToAccount.OP_NAME, d => new dftx_account_1.CAccountToAccount(d)); | ||
case dftx_account_1.CTransferDomain.OP_CODE: | ||
return compose(dftx_account_1.CTransferDomain.OP_NAME, d => new dftx_account_1.CTransferDomain(d)); | ||
case dftx_account_1.CAnyAccountToAccount.OP_CODE: | ||
@@ -95,0 +97,0 @@ return compose(dftx_account_1.CAnyAccountToAccount.OP_NAME, d => new dftx_account_1.CAnyAccountToAccount(d)); |
@@ -18,3 +18,3 @@ /// <reference types="node" /> | ||
import { TokenBurn, TokenCreate, TokenMint, TokenUpdate, TokenUpdateAny } from './dftx/dftx_token'; | ||
import { AccountToAccount, AccountToUtxos, AnyAccountToAccount, UtxosToAccount, SetFutureSwap } from './dftx/dftx_account'; | ||
import { AccountToAccount, AccountToUtxos, AnyAccountToAccount, UtxosToAccount, SetFutureSwap, TransferDomain } from './dftx/dftx_account'; | ||
import { AppointOracle, RemoveOracle, SetOracleData, UpdateOracle } from './dftx/dftx_oracles'; | ||
@@ -98,2 +98,3 @@ import { SetLoanScheme, DestroyLoanScheme, SetDefaultLoanScheme, SetCollateralToken, SetLoanToken, UpdateLoanToken, TakeLoan, PaybackLoan, PaybackLoanV2 } from './dftx/dftx_loans'; | ||
OP_DEFI_TX_ACCOUNT_TO_ACCOUNT: (accountToAccount: AccountToAccount) => OP_DEFI_TX; | ||
OP_DEFI_TX_TRANSFER_DOMAIN: (transferDomain: TransferDomain) => OP_DEFI_TX; | ||
OP_DEFI_TX_ANY_ACCOUNT_TO_ACCOUNT: (anyAccountToAccount: AnyAccountToAccount) => OP_DEFI_TX; | ||
@@ -100,0 +101,0 @@ OP_DEFI_TX_FUTURE_SWAP: (futureSwap: SetFutureSwap) => OP_DEFI_TX; |
@@ -245,2 +245,10 @@ "use strict"; | ||
}, | ||
OP_DEFI_TX_TRANSFER_DOMAIN: (transferDomain) => { | ||
return new dftx_1.OP_DEFI_TX({ | ||
signature: dftx_2.CDfTx.SIGNATURE, | ||
type: dftx_account_1.CTransferDomain.OP_CODE, | ||
name: dftx_account_1.CTransferDomain.OP_NAME, | ||
data: transferDomain | ||
}); | ||
}, | ||
OP_DEFI_TX_ANY_ACCOUNT_TO_ACCOUNT: (anyAccountToAccount) => { | ||
@@ -247,0 +255,0 @@ return new dftx_1.OP_DEFI_TX({ |
{ | ||
"private": false, | ||
"name": "@defichain/jellyfish-transaction", | ||
"version": "3.30.4", | ||
"version": "3.31.0", | ||
"description": "SDK & Ecosystem for building modern lite DeFi Applications at scale.", | ||
@@ -17,7 +17,7 @@ "repository": "BirthdayResearch/jellyfishsdk", | ||
"dependencies": { | ||
"@defichain/jellyfish-buffer": "3.30.4", | ||
"@defichain/jellyfish-crypto": "3.30.4" | ||
"@defichain/jellyfish-buffer": "3.31.0", | ||
"@defichain/jellyfish-crypto": "3.31.0" | ||
}, | ||
"peerDependencies": { | ||
"defichain": "^3.30.4" | ||
"defichain": "^3.31.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
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
373154
6553
+ Added@defichain/jellyfish-buffer@3.31.0(transitive)
+ Added@defichain/jellyfish-crypto@3.31.0(transitive)
- Removed@defichain/jellyfish-buffer@3.30.4(transitive)
- Removed@defichain/jellyfish-crypto@3.30.4(transitive)