API Documentation

Crypto\Blocks\BlockFactory

fromHex()

1public static fromHex(hex: string)

Generate Block object from HEX.

Parameters

Type Name Required Description
string hex Yes Block content

Return Value

IBlock

fromBytes()

1public static fromBytes(buffer: Buffer)

Generate Block object from a Buffer.

Parameters

Type Name Required Description
Buffer buffer Yes Block content

Return Value

IBlock

fromJson()

1public static fromJson(json: IBlockJson)

Generate Block object from JSON.

Parameters

Type Name Required Description
IBlockJson json Yes Block content

Return Value

IBlock

fromData()

1public static fromData(data: IBlockData, options: { deserializeTransactionsUnchecked?: boolean } = {})

Generate Block object from Block data.

Parameters

Type Name Required Description
IBlockData data Yes Block content
object options Yes Options used for parsing block data

Return Value

IBlock

Crypto\Blocks\Serializer

size()

1public static size(block: IBlock)

Get size of Block.

Parameters

Type Name Required Description
IBlock block Yes Block object

Return Value

number

serializeWithTransactions()

1public static serializeWithTransactions(block: IBlockData)

Serialize Block with Transactions.

Parameters

Type Name Required Description
IBlockData block Yes Block object

Return Value

Buffer

serialize()

1public static serialize(block: IBlockData, includeSignature: boolean = true)

Serialize Block without Transactions.

Parameters

Type Name Required Description
IBlockData block Yes Block object
boolean includeSignature Yes Whether to include signature in serialization

Return Value

Buffer

Crypto\Crypto\HashAlgorithms

ripemd160()

1public static ripemd160(buffer: Buffer | string)

Hash with RIPEMD-160.

Parameters

Type Name Required Description
Buffer, string buffer Yes String or Buffer to generate hash for

Return Value

Buffer

sha1()

1public static sha1(buffer: Buffer | string)

Hash with SHA-1.

Parameters

Type Name Required Description
Buffer, string buffer Yes String or Buffer to generate hash for

Return Value

Buffer

sha256()

1public static sha256(buffer: Buffer | string | Buffer[])

Hash with SHA-256.

Parameters

Type Name Required Description
Buffer, string buffer Yes String or Buffer to generate hash for

Return Value

Buffer

hash160()

1public static hash160(buffer: Buffer | string)

Hash with Hash160.

Parameters

Type Name Required Description
Buffer, string buffer Yes String or Buffer to generate hash for

Return Value

Buffer

hash256()

1public static hash256(buffer: Buffer | string)

Hash with Hash256.

Parameters

Type Name Required Description
Buffer, string buffer Yes String or Buffer to generate hash for

Return Value

Buffer

Crypto\Crypto\Hash

signECDSA()

1public static signECDSA(hash: Buffer, keys: IKeyPair)

Sign hash with ECDSA.

Parameters

Type Name Required Description
Buffer hash Yes Hash to sign
IKeyPair keys Yes Keys to sign hash with

Return Value

string

verifyECDSA()

1public static verifyECDSA(hash: Buffer, signature: Buffer | string, publicKey: Buffer | string)

Verify ECDSA signature.

Parameters

Type Name Required Description
Buffer hash Yes Hash to verify
Buffer, string signature Yes Signature of hash
Buffer, string publicKey Yes Public key of wallet which signed the hash

Return Value

boolean

signSchnorr()

1public static signSchnorr(hash: Buffer, keys: IKeyPair)

Sign hash with Schnorr.

Parameters

Type Name Required Description
Buffer hash Yes Hash to sign
IKeyPair keys Yes Keys to sign hash with

Return Value

string

verifySchnorr()

1public static verifySchnorr(hash: Buffer, signature: Buffer | string, publicKey: Buffer | string)

Verify Schnorr signature.

Parameters

Type Name Required Description
Buffer hash Yes Hash to verify
Buffer, string signature Yes Signature of hash
Buffer, string publicKey Yes Public key of wallet which signed the hash

Return Value

boolean

Crypto\Crypto\HDWallet

fromMnemonic()

1public static fromMnemonic(mnemonic: string, passphrase?: string)

Generate BIP32 Wallet from mnemonic.

Parameters

Type Name Required Description
string mnemonic Yes INSERT_DESCRIPTION
string passphrase No INSERT_DESCRIPTION

Return Value

BIP32Interface

fromKeys()

1public static fromKeys(keys: IKeyPair, chainCode: Buffer)

Generate BIP32 Wallet from KeyPair.

Parameters

Type Name Required Description
IKeyPair keys Yes INSERT_DESCRIPTION
Buffer chainCode Yes INSERT_DESCRIPTION

Return Value

BIP32Interface

getKeys()

1public static getKeys(node: BIP32Interface)

Get keys for BIP32 Wallet.

Parameters

Type Name Required Description
BIP32Interface node Yes BIP32 Wallet to get keys for

Return Value

IKeyPair

deriveSlip44()

1public static deriveSlip44(root: BIP32Interface, hardened: boolean = true)

Determine Slip44 for BIP32 Wallet.

Parameters

Type Name Required Description
BIP32Interface root Yes BIP32 Wallet to determine Slip44 for
boolean hardened Yes INSERT_DESCRIPTION

Return Value

BIP32Interface

deriveNetwork()

1public static deriveNetwork(root: BIP32Interface)

Determine Network for BIP32 Wallet.

Parameters

Type Name Required Description
BIP32Interface root Yes BIP32 Wallet to determine network for

Return Value

BIP32Interface

Crypto\Crypto\Message

sign()

1public static sign(message: string, passphrase: string)

Sign a message using the given passphrase.

Parameters

Type Name Required Description
string message Yes Message
string passphrase Yes Passphrase

Return Value

IMessage

signWithWif()

1public static signWithWif(message: string, wif: string, network?: INetwork)

Sign a message using the given WIF string.

Parameters

Type Name Required Description
string message Yes Message
string wif Yes Network WIF
INetwork network No Network

Return Value

IMessage

verify()

1public static verify({ message, publicKey, signature }: IMessage)

Verify the message contents

Parameters

Type Name Required Description
IMessage object Yes Message

Return Value

boolean

Crypto\Crypto\Slots

getTime()

1public static getTime(time?: number)

Get the time diff between now and network start.

Parameters

Type Name Required Description
number time No Network start time

Return Value

number

getTimeInMsUntilNextSlot()

1public static getTimeInMsUntilNextSlot()

Get the time (in milliseconds) until the start of the next slot.

Return Value

number

getSlotNumber()

1public static getSlotNumber(epoch?: number)

Get the slot number.

Parameters

Type Name Required Description
number epoch No Epoch time

Return Value

number

getSlotTime()

1public static getSlotTime(slot: number)

Get the slot time.

Parameters

Type Name Required Description
number slot Yes Slot

Return Value

number

getNextSlot()

1public static getNextSlot()

Get the next slot.

Return Value

number

isForgingAllowed()

1public static isForgingAllowed(epoch?: number)

Verify is forging is allowed.

Parameters

Type Name Required Description
number epoch No Epoch time

Return Value

boolean

Crypto\Identities\Address

fromPassphrase()

1public static fromPassphrase(passphrase: string, networkVersion?: number)

Derive the address from the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase
number networkVersion No Version of the network

Return Value

string

fromPublicKey()

1public static fromPublicKey(publicKey: string, networkVersion?: number)

Derive a (multisig) address from a multi signature asset.

Parameters

Type Name Required Description
string publicKey Yes Public key
number networkVersion No Version of the network

Return Value

string

fromWIF()

1public static fromWIF(wif: string, network?: NetworkType)

Derive the address from a WIF string.

Parameters

Type Name Required Description
string wif Yes WIF
NetworkType network No Network to generate address for

Return Value

string

fromMultiSignatureAsset()

1public static fromMultiSignatureAsset(asset: IMultiSignatureAsset, networkVersion?: number)

Derive the address from the given multi signature asset.

Parameters

Type Name Required Description
IMultiSignatureAsset asset Yes Address to validate
number networkVersion No Version of the network

Return Value

string

fromPrivateKey()

1public static fromPrivateKey(privateKey, networkVersion?: number)

Derive the address from the given private key.

Parameters

Type Name Required Description
any privateKey Yes Private key to derive address for
number networkVersion No Version of the network

Return Value

string

fromBuffer()

1public static fromBuffer(buffer: Buffer)

Derive the address from a Buffer.

Parameters

Type Name Required Description
Buffer buffer Yes Buffer to derive address from

Return Value

string

toBuffer()

1public static toBuffer(address: string)

Convert address to a Buffer.

Parameters

Type Name Required Description
string address Yes Address to convert to buffer

Return Value

{ addressBuffer: Buffer; addressError?: string }

validate()

1public static validate(address: string, networkVersion?: number)

Validate the given address.

Parameters

Type Name Required Description
string address Yes Address to validate
number networkVersion No Version of the network

Return Value

boolean

Crypto\Identities\Keys

fromPassphrase()

1public static fromPassphrase(passphrase: string, compressed: boolean = true)

Derive the keys from the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase
boolean compressed Yes Compression flag

Return Value

IKeyPair

fromPrivateKey()

1public static fromPrivateKey(privateKey: Buffer | string, compressed: boolean = true)

Derive the keys from the given private key.

Parameters

Type Name Required Description
Buffer, string privateKey Yes Private Key to derive keys from
boolean compressed Yes Compression flag

Return Value

IKeyPair

fromWIF()

1public static fromWIF(wifKey: string, network?: INetwork)

Derive the keys from the given WIF.

Parameters

Type Name Required Description
string wifKey Yes Private key
INetwork network No Network

Return Value

IKeyPair

Crypto\Identities\PrivateKey

fromPassphrase()

1public static fromPassphrase(passphrase: string)

Derive the private key for the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

string

fromWIF()

1public static fromWIF(wif: string, network?: NetworkType)

Create a private key instance from a hex string.

Parameters

Type Name Required Description
string wif Yes Network WIF
NetworkType network No Network

Return Value

string

Crypto\Identities\PublicKey

fromPassphrase()

1public static fromPassphrase(passphrase: string)

Derive the public key from the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase

Return Value

string

fromWIF()

1public static fromWIF(wif: string, network?: NetworkType)

Derive the public key from the given WIF.

Parameters

Type Name Required Description
string wif Yes WIF to derive public key from
NetworkType network No Network

Return Value

string

fromMultiSignatureAsset()

1public static fromMultiSignatureAsset(asset: IMultiSignatureAsset)

Derive the public key from the given multi signature asset.

Parameters

Type Name Required Description
IMultiSignatureAsset asset Yes Asset

Return Value

string

validate()

1public static validate(publicKey: string, networkVersion?: number)

Validate the given public key.

Parameters

Type Name Required Description
string publicKey Yes Public key
number networkVersion No Network version

Return Value

boolean

Crypto\Identities\WIF

fromPassphrase()

1public static fromPassphrase(passphrase: string, network?: INetwork)

Derive the WIF from the given passphrase.

Parameters

Type Name Required Description
string passphrase Yes Passphrase to derive WIF from
INetwork network No Network wif

Return Value

string

fromKeys()

1public static fromKeys(keys: IKeyPair, network?: INetwork)

Derive the WIF from the given keys.

Parameters

Type Name Required Description
IKeyPair keys Yes Keys
INetwork network No Network

Return Value

string

Crypto\Managers\ConfigManager

setConfig()

1public setConfig(config: INetworkConfig)

Set the configuration.

Parameters

Type Name Required Description
INetworkConfig config Yes Network configuration object

Return Value

void

setFromPreset()

1public setFromPreset(network: NetworkName)

Set the configuration from given presets.

Parameters

Type Name Required Description
NetworkName network Yes Preset

Return Value

void

getPreset()

1public getPreset(network: NetworkName)

Get configuration preset.

Parameters

Type Name Required Description
NetworkName network Yes Preset

Return Value

INetworkConfig

all()

1public all()

Get all configs.

Return Value

INetworkConfig

set()

1public set<T = any>(key: string, value: T)

Set a value for the specified network config key.

Parameters

Type Name Required Description
string key Yes Key to set
T value Yes Value to set

Return Value

void

get()

1public get<T = any>(key: string)

Get key.

Parameters

Type Name Required Description
string key Yes Key to get

Return Value

T

setHeight()

1public setHeight(value: number)

Set network height.

Parameters

Type Name Required Description
number value Yes Network height

Return Value

void

getHeight()

1public getHeight()

Get network height.

Return Value

number

isNewMilestone()

1public isNewMilestone(height?: number)

Verify if current height contains a milestone.

Parameters

Type Name Required Description
number height No Height to check for milestone

Return Value

boolean

getMilestone()

1public getMilestone(height?: number)

Get milestone.

Parameters

Type Name Required Description
number height No Network height

Return Value

{ [key: string]: any }

getMilestones()

1public getMilestones()

Get all milestones.

Return Value

any

Crypto\Managers\NetworkManager

all()

1public static all()

Get settings for all networks.

Return Value

Record<NetworkName, INetworkConfig>

findByName()

1public static findByName(name: NetworkName)

Get settings for a selected network, default network is devnet.

Parameters

Type Name Required Description
NetworkName name Yes Network name

Return Value

INetworkConfig

Crypto\Transactions\Deserializer

deserialize()

1public static deserialize(serialized: string | Buffer, options: IDeserializeOptions = {})

Deserialize Transaction into object.

Parameters

Type Name Required Description
string, Buffer serialized Yes Serialized transaction
IDeserializeOptions options Yes Options for deserializing

Return Value

ITransaction

applyV1Compatibility()

1public static applyV1Compatibility(transaction: ITransactionData)

Modify transaction to be v1 compatible.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction object

Return Value

void

Crypto\Transactions\TransactionFactory

fromHex()

1public static fromHex(hex: string)

Create Transaction object from HEX.

Parameters

Type Name Required Description
string hex Yes HEX of transaction

Return Value

ITransaction

fromBytes()

1public static fromBytes(buffer: Buffer, strict: boolean = true)

Create Transaction object from Buffer.

Parameters

Type Name Required Description
Buffer buffer Yes Transaction buffer
boolean strict Yes Strict creation from buffer

Return Value

ITransaction

fromBytesUnsafe()

1public static fromBytesUnsafe(buffer: Buffer, id?: string)

Create Transaction object from Buffer (unsafe).

NOTE: Only use this internally when it is safe to assume the buffer has already been verified.

Parameters

Type Name Required Description
Buffer buffer Yes Transaction buffer
string id No ID override

Return Value

ITransaction

fromJson()

1public static fromJson(json: ITransactionJson)

Create Transaction object from JSON.

Parameters

Type Name Required Description
ITransactionJson json Yes Transaction JSON object

Return Value

ITransaction

fromData()

1public static fromData(data: ITransactionData, strict: boolean = true)

Create Transaction object from Transaction data.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction object
boolean strict Yes Strict conversion

Return Value

ITransaction

Crypto\Transactions\Serializer

getBytes()

1public static getBytes(transaction: ITransactionData, options: ISerializeOptions = {})

Convert the transaction to its byte representation.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction
ISerializeOptions options Yes Options

Return Value

Buffer

serialize()

1public static serialize(transaction: ITransaction, options: ISerializeOptions = {})

Perform AIP11 compliant serialization.

Parameters

Type Name Required Description
ITransaction transaction Yes Transaction
ISerializeOptions options Yes Options

Return Value

Buffer

Crypto\Transactions\Signer

sign()

1public static sign(transaction: ITransactionData, keys: IKeyPair, options?: ISerializeOptions)

Sign the given transaction with the provided keys.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction
IKeyPair keys Yes Keys
ISerializeOptions options No Options

Return Value

string

secondSign()

1public static secondSign(transaction: ITransactionData, keys: IKeyPair)

Second sign the given transaction with the provided keys.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction
IKeyPair keys Yes Keys

Return Value

string

multiSign()

1public static multiSign(transaction: ITransactionData, keys: IKeyPair, index: number = -1)

Multi sign the given transaction with the provided keys.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction
IKeyPair keys Yes Keys
number index Yes Index

Return Value

string

Crypto\Transactions\Utils

toBytes()

1public static toBytes(data: ITransactionData)

Convert Transaction object to Buffer.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction object

Return Value

Buffer

toHash()

1public static toHash(transaction: ITransactionData, options?: ISerializeOptions)

Convert Transaction object to Hash.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction object
ISerializeOptions options No Serialization options for generating hash

Return Value

Buffer

getId()

1public static getId(transaction: ITransactionData, options: ISerializeOptions = {})

Get Transaction ID of Transaction object.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction object
ISerializeOptions options Yes Serialization options for generating hash

Return Value

string

Crypto\Transactions\Verifier

verify()

1public static verify(data: ITransactionData)

Verify transaction.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction object

Return Value

boolean

verifySecondSignature()

1public static verifySecondSignature(transaction: ITransactionData, publicKey: string)

Verify second signature.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction object
string publicKey Yes Public key

Return Value

boolean

verifySignatures()

1public static verifySignatures(transaction: ITransactionData, multiSignature: IMultiSignatureAsset)

Verify the signatures of a Transaction object.

Parameters

Type Name Required Description
ITransactionData transaction Yes Transaction object
IMultiSignatureAsset multiSignature Yes Asset for Multi-Signature wallets/transactions

Return Value

boolean

verifyHash()

1public static verifyHash(data: ITransactionData)

Verify transaction hash.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction

Return Value

boolean

verifySchema()

1public static verifySchema(data: ITransactionData, strict: boolean = true)

Verify transaction schema.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction
boolean strict Yes Strict flag

Return Value

ISchemaValidationResult

Crypto\Transactions\Builders\BuilderFactory

transfer()

1public static transfer()

Initiate a Transfer transaction type.

Return Value

TransferBuilder

secondSignature()

1public static secondSignature()

Initiate a Second Signature transaction type.

Return Value

SecondSignatureBuilder

delegateRegistration()

1public static delegateRegistration()

Initiate a Delegate Resignation transaction type.

Return Value

DelegateRegistrationBuilder

vote()

1public static vote()

Initiate a Vote transaction type.

Return Value

VoteBuilder

multiSignature()

1public static multiSignature()

Initiate a Multi-Signature transaction type.

Return Value

MultiSignatureBuilder

ipfs()

1public static ipfs()

Initiate an IPFS transaction type.

Return Value

IPFSBuilder

multiPayment()

1public static multiPayment()

Initiate a Multi-Payment transaction type.

Return Value

MultiPaymentBuilder

delegateResignation()

1public static delegateResignation()

Initiate a Delegate Resignation transaction type.

Return Value

DelegateResignationBuilder

htlcLock()

1public static htlcLock()

Initiate a HTLC Lock transaction type.

Return Value

HtlcLockBuilder

htlcClaim()

1public static htlcClaim()

Initiate a HTLC Claim transaction type.

Return Value

HtlcClaimBuilder

htlcRefund()

1public static htlcRefund()

Initiate a HTLC Refund transaction type.

Return Value

HtlcRefundBuilder

Crypto\Transactions\Builders\Transactions\DelegateRegistrationBuilder

usernameAsset()

1public usernameAsset(username: string)

Set the username to assign.

Parameters

Type Name Required Description
string username Yes Delegate username

Return Value

DelegateRegistrationBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\DelegateResignationBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\HtlcClaimBuilder

htlcClaimAsset()

1public htlcClaimAsset(claimAsset: IHtlcClaimAsset)

Specify the HTLC Claim asset data for the Transaction.

Parameters

Type Name Required Description
IHtlcClaimAsset claimAsset Yes Asset for a HTLC Claim

Return Value

HtlcClaimBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\HtlcLockBuilder

htlcLockAsset()

1public htlcLockAsset(lockAsset: IHtlcLockAsset)

Specify the HTLC Lock asset data for the Transaction.

Parameters

Type Name Required Description
IHtlcLockAsset lockAsset Yes Asset for a HTLC Lock

Return Value

HtlcLockBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\HtlcRefundBuilder

htlcRefundAsset()

1public htlcRefundAsset(refundAsset: IHtlcRefundAsset)

Specify the HTLC Refund asset data for the Transaction.

Parameters

Type Name Required Description
IHtlcRefundAsset refundAsset Yes Asset for a HTLC Refund

Return Value

HtlcRefundBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\IPFSBuilder

ipfsAsset()

1public ipfsAsset(ipfsId: string)

Set IPFS asset.

Parameters

Type Name Required Description
string ipfsId Yes IPFS ID

Return Value

IPFSBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\MultiPaymentBuilder

addPayment()

1public addPayment(recipientId: string, amount: string)

Add a new payment to the collection.

Parameters

Type Name Required Description
string recipientId Yes Recipient identifier
string amount Yes Transaction amount

Return Value

MultiPaymentBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\MultiSignatureBuilder

participant()

1public participant(publicKey: string)

Add participant to multi signature transaction.

Parameters

Type Name Required Description
string publicKey Yes Public key

Return Value

MultiSignatureBuilder

min()

1public min(min: number)

Set the minimum required signatures.

Parameters

Type Name Required Description
number min Yes Minimum required signatures

Return Value

MultiSignatureBuilder

multiSignatureAsset()

1public multiSignatureAsset(multiSignature: IMultiSignatureAsset)

Derive the address from the given multi signature asset.

Parameters

Type Name Required Description
IMultiSignatureAsset multiSignature Yes Multi signature asset

Return Value

MultiSignatureBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\SecondSignatureBuilder

signatureAsset()

1public signatureAsset(secondPassphrase: string)

Specify the Second Signature asset data for the Transaction.

Parameters

Type Name Required Description
string secondPassphrase Yes Asset for a Second Signature

Return Value

SecondSignatureBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\TransferBuilder

expiration()

1public expiration(expiration: number)

Set Transfer expiration.

Parameters

Type Name Required Description
number expiration Yes The block-height or time when the transaction should expire

Return Value

TransferBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Builders\Transactions\VoteBuilder

votesAsset()

1public votesAsset(votes: string[])

Specify the Vote asset data for the Transaction.

Parameters

Type Name Required Description
string votes Yes Asset for a Vote

Return Value

VoteBuilder

getStruct()

1public getStruct()

Get transaction structure.

Return Value

ITransactionData

Crypto\Transactions\Types\DelegateRegistrationTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

serialize()

1public serialize(options?: ISerializeOptions)

Handle the serialization of “delegate registration” data.

Parameters

Type Name Required Description
ISerializeOptions options No Options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Handle the deserialization of “delegate registration” data.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer

Return Value

void

Crypto\Transactions\Types\DelegateResignationTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Handle the serialization of “delegate resignation” data.

Parameters

Type Name Required Description
ISerializeOptions options No Options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Handle the deserialization of “delegate resignation” data.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer

Return Value

void

Crypto\Transactions\Types\TransactionTypeFactory

initialize()

1public static initialize(transactionTypes: Map<InternalTransactionType, TransactionConstructor>)

Initialize new transaction types factory.

Parameters

Type Name Required Description
Map transactionTypes Yes INSERT_DESCRIPTION

create()

1public static create(data: ITransactionData)

Create new transaction type.

Parameters

Type Name Required Description
ITransactionData data Yes Transaction object

Return Value

ITransaction

get()

1public static get(type: number, typeGroup?: number)

Get a transaction type.

Parameters

Type Name Required Description
number type Yes Transaction type
number typeGroup No Transaction group

Return Value

TransactionConstructor

Crypto\Transactions\Types\HtlcClaimTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Serialize Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\HtlcLockTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

hasVendorField()

1public hasVendorField()

Verify if the transaction contains a vendorfield.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Serialize a Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into a Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\HtlcRefundTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Serialize a Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into a Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\InternalTransactionType

from()

1public static from(type: number, typeGroup?: number)

Create new internal transaction type from existing type.

Parameters

Type Name Required Description
number type Yes Transaction type
number typeGroup No Transaction group

Return Value

InternalTransactionType

toString()

1public toString()

Convert transaction type to a group/type string representation (E.g. 1/0)

Return Value

string

Crypto\Transactions\Types\IpfsTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Handle the serialization of “IPFS” data.

Parameters

Type Name Required Description
ISerializeOptions options No Options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Handle the deserialization of “IPFS” data.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer

Return Value

void

Crypto\Transactions\Types\MultiPaymentTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

verify()

1public verify()

Verify transaction.

Return Value

boolean

hasVendorField()

1public hasVendorField()

Verify if the transaction contains a vendorfield.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Serialize a Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into a Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\MultiSignatureRegistrationTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

staticFee()

1public static staticFee(feeContext: { height?: number; data?: ITransactionData } = {})

Get the static fee for the Multi-Signature transaction type.

Parameters

Type Name Required Description
object feeContext Yes Context for determining the static fee

Return Value

BigNumber

verify()

1public verify()

Verify transaction.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Serialize a Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into a Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\SecondSignatureRegistrationTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

serialize()

1public serialize(options?: ISerializeOptions)

Serialize a Transaction object.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Deserialize into a Transaction object.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\TransferTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

hasVendorField()

1public hasVendorField()

Verify if the transaction contains a vendorfield.

Return Value

boolean

serialize()

1public serialize(options?: ISerializeOptions)

Perform AIP11 compliant serialization.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Transactions\Types\VoteTransaction

getSchema()

1public static getSchema()

Get transaction schema.

Return Value

schemas.TransactionSchema

serialize()

1public serialize(options?: ISerializeOptions)

Perform AIP11 compliant serialization.

Parameters

Type Name Required Description
ISerializeOptions options No Serialization options

Return Value

ByteBuffer

deserialize()

1public deserialize(buf: ByteBuffer)

Perform AIP11 compliant deserialization.

Parameters

Type Name Required Description
ByteBuffer buf Yes Buffer to deserialize

Return Value

void

Crypto\Validation\Validator

getInstance()

1public getInstance()

Get an instance of the Validator object.

Return Value

Ajv.Ajv

validate()

1public validate<T = any>(schemaKeyRef: string | boolean | object, data: T)

Validate a schema object.

Parameters

Type Name Required Description
string, boolean, object schemaKeyRef Yes Schema to validate against
T data Yes Data to validate

Return Value

ISchemaValidationResult<T>

validateException()

1public validateException<T = any>(schemaKeyRef: string | boolean | object, data: T)

Validate a schema object for an exception.

Parameters

Type Name Required Description
string, boolean, object schemaKeyRef Yes Schema to validate against
T data Yes Data to validate

Return Value

ISchemaValidationResult<T>

addFormat()

1public addFormat(name: string, format: Ajv.FormatDefinition)

Add formatting definition used for validation.

Parameters

Type Name Required Description
string name Yes Name of definition
Ajv format Yes Format definition

Return Value

void

addKeyword()

1public addKeyword(keyword: string, definition: Ajv.KeywordDefinition)

Add keyword definition used for validation.

Parameters

Type Name Required Description
string keyword Yes Name of definition
Ajv definition Yes Keyword definition

Return Value

void

addSchema()

1public addSchema(schema: object | object[], key?: string)

Add schema used for validation.

Parameters

Type Name Required Description
object schema Yes Name of schema
string key No Schema

Return Value

void

removeKeyword()

1public removeKeyword(keyword: string)

Remove keyword definition from validation.

Parameters

Type Name Required Description
string keyword Yes Name of definition

Return Value

void

removeSchema()

1public removeSchema(schemaKeyRef: string | boolean | object | RegExp)

Remove schema from validation.

Parameters

Type Name Required Description
string, boolean, object, RegExp schemaKeyRef Yes Schema to remove

Return Value

void

extendTransaction()

1public extendTransaction(schema: TransactionSchema, remove?: boolean)

Extend a Transaction’s schema for validation.

Parameters

Type Name Required Description
TransactionSchema schema Yes Schema of transaction to extend
boolean remove No Whether to remove the schema
Last updated 3 years ago
Edit Page
Share: