public static fromHex(hex: string)
Generate Block object from HEX.
Type | Name | Required | Description |
---|---|---|---|
string | hex | Yes | Block content |
IBlock
public static fromBytes(buffer: Buffer)
Generate Block object from a Buffer.
Type | Name | Required | Description |
---|---|---|---|
Buffer | buffer | Yes | Block content |
IBlock
public static fromJson(json: IBlockJson)
Generate Block object from JSON.
Type | Name | Required | Description |
---|---|---|---|
IBlockJson | json | Yes | Block content |
IBlock
public static fromData(data: IBlockData, options: { deserializeTransactionsUnchecked?: boolean } = {})
Generate Block object from Block data.
Type | Name | Required | Description |
---|---|---|---|
IBlockData | data | Yes | Block content |
object | options | Yes | Options used for parsing block data |
IBlock
public static size(block: IBlock)
Get size of Block.
Type | Name | Required | Description |
---|---|---|---|
IBlock | block | Yes | Block object |
number
public static serializeWithTransactions(block: IBlockData)
Serialize Block with Transactions.
Type | Name | Required | Description |
---|---|---|---|
IBlockData | block | Yes | Block object |
Buffer
public static serialize(block: IBlockData, includeSignature: boolean = true)
Serialize Block without Transactions.
Type | Name | Required | Description |
---|---|---|---|
IBlockData | block | Yes | Block object |
boolean | includeSignature | Yes | Whether to include signature in serialization |
Buffer
public static ripemd160(buffer: Buffer | string)
Hash with RIPEMD-160.
Type | Name | Required | Description |
---|---|---|---|
Buffer, string | buffer | Yes | String or Buffer to generate hash for |
Buffer
public static sha1(buffer: Buffer | string)
Hash with SHA-1.
Type | Name | Required | Description |
---|---|---|---|
Buffer, string | buffer | Yes | String or Buffer to generate hash for |
Buffer
public static sha256(buffer: Buffer | string | Buffer[])
Hash with SHA-256.
Type | Name | Required | Description |
---|---|---|---|
Buffer, string | buffer | Yes | String or Buffer to generate hash for |
Buffer
public static hash160(buffer: Buffer | string)
Hash with Hash160.
Type | Name | Required | Description |
---|---|---|---|
Buffer, string | buffer | Yes | String or Buffer to generate hash for |
Buffer
public static hash256(buffer: Buffer | string)
Hash with Hash256.
Type | Name | Required | Description |
---|---|---|---|
Buffer, string | buffer | Yes | String or Buffer to generate hash for |
Buffer
public static signECDSA(hash: Buffer, keys: IKeyPair)
Sign hash with ECDSA.
Type | Name | Required | Description |
---|---|---|---|
Buffer | hash | Yes | Hash to sign |
IKeyPair | keys | Yes | Keys to sign hash with |
string
public static verifyECDSA(hash: Buffer, signature: Buffer | string, publicKey: Buffer | string)
Verify ECDSA signature.
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 |
boolean
public static signSchnorr(hash: Buffer, keys: IKeyPair)
Sign hash with Schnorr.
Type | Name | Required | Description |
---|---|---|---|
Buffer | hash | Yes | Hash to sign |
IKeyPair | keys | Yes | Keys to sign hash with |
string
public static verifySchnorr(hash: Buffer, signature: Buffer | string, publicKey: Buffer | string)
Verify Schnorr signature.
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 |
boolean
public static fromMnemonic(mnemonic: string, passphrase?: string)
Generate BIP32 Wallet from mnemonic.
Type | Name | Required | Description |
---|---|---|---|
string | mnemonic | Yes | INSERT_DESCRIPTION |
string | passphrase | No | INSERT_DESCRIPTION |
BIP32Interface
public static fromKeys(keys: IKeyPair, chainCode: Buffer)
Generate BIP32 Wallet from KeyPair.
Type | Name | Required | Description |
---|---|---|---|
IKeyPair | keys | Yes | INSERT_DESCRIPTION |
Buffer | chainCode | Yes | INSERT_DESCRIPTION |
BIP32Interface
public static getKeys(node: BIP32Interface)
Get keys for BIP32 Wallet.
Type | Name | Required | Description |
---|---|---|---|
BIP32Interface | node | Yes | BIP32 Wallet to get keys for |
IKeyPair
public static deriveSlip44(root: BIP32Interface, hardened: boolean = true)
Determine Slip44 for BIP32 Wallet.
Type | Name | Required | Description |
---|---|---|---|
BIP32Interface | root | Yes | BIP32 Wallet to determine Slip44 for |
boolean | hardened | Yes | INSERT_DESCRIPTION |
BIP32Interface
public static deriveNetwork(root: BIP32Interface)
Determine Network for BIP32 Wallet.
Type | Name | Required | Description |
---|---|---|---|
BIP32Interface | root | Yes | BIP32 Wallet to determine network for |
BIP32Interface
public static sign(message: string, passphrase: string)
Sign a message using the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | message | Yes | Message |
string | passphrase | Yes | Passphrase |
IMessage
public static signWithWif(message: string, wif: string, network?: INetwork)
Sign a message using the given WIF string.
Type | Name | Required | Description |
---|---|---|---|
string | message | Yes | Message |
string | wif | Yes | Network WIF |
INetwork | network | No | Network |
IMessage
public static verify({ message, publicKey, signature }: IMessage)
Verify the message contents
Type | Name | Required | Description |
---|---|---|---|
IMessage | object | Yes | Message |
boolean
public static getTime(time?: number)
Get the time diff between now and network start.
Type | Name | Required | Description |
---|---|---|---|
number | time | No | Network start time |
number
public static getTimeInMsUntilNextSlot()
Get the time (in milliseconds) until the start of the next slot.
number
public static getSlotNumber(epoch?: number)
Get the slot number.
Type | Name | Required | Description |
---|---|---|---|
number | epoch | No | Epoch time |
number
public static getSlotTime(slot: number)
Get the slot time.
Type | Name | Required | Description |
---|---|---|---|
number | slot | Yes | Slot |
number
public static getNextSlot()
Get the next slot.
number
public static isForgingAllowed(epoch?: number)
Verify is forging is allowed.
Type | Name | Required | Description |
---|---|---|---|
number | epoch | No | Epoch time |
boolean
public static fromPassphrase(passphrase: string, networkVersion?: number)
Derive the address from the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | passphrase | Yes | Passphrase |
number | networkVersion | No | Version of the network |
string
public static fromPublicKey(publicKey: string, networkVersion?: number)
Derive a (multisig) address from a multi signature asset.
Type | Name | Required | Description |
---|---|---|---|
string | publicKey | Yes | Public key |
number | networkVersion | No | Version of the network |
string
public static fromWIF(wif: string, network?: NetworkType)
Derive the address from a WIF string.
Type | Name | Required | Description |
---|---|---|---|
string | wif | Yes | WIF |
NetworkType | network | No | Network to generate address for |
string
public static fromMultiSignatureAsset(asset: IMultiSignatureAsset, networkVersion?: number)
Derive the address from the given multi signature asset.
Type | Name | Required | Description |
---|---|---|---|
IMultiSignatureAsset | asset | Yes | Address to validate |
number | networkVersion | No | Version of the network |
string
public static fromPrivateKey(privateKey, networkVersion?: number)
Derive the address from the given private key.
Type | Name | Required | Description |
---|---|---|---|
any | privateKey | Yes | Private key to derive address for |
number | networkVersion | No | Version of the network |
string
public static fromBuffer(buffer: Buffer)
Derive the address from a Buffer.
Type | Name | Required | Description |
---|---|---|---|
Buffer | buffer | Yes | Buffer to derive address from |
string
public static toBuffer(address: string)
Convert address to a Buffer.
Type | Name | Required | Description |
---|---|---|---|
string | address | Yes | Address to convert to buffer |
{ addressBuffer: Buffer; addressError?: string }
public static validate(address: string, networkVersion?: number)
Validate the given address.
Type | Name | Required | Description |
---|---|---|---|
string | address | Yes | Address to validate |
number | networkVersion | No | Version of the network |
boolean
public static fromPassphrase(passphrase: string, compressed: boolean = true)
Derive the keys from the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | passphrase | Yes | Passphrase |
boolean | compressed | Yes | Compression flag |
IKeyPair
public static fromPrivateKey(privateKey: Buffer | string, compressed: boolean = true)
Derive the keys from the given private key.
Type | Name | Required | Description | |
---|---|---|---|---|
Buffer, string | privateKey | Yes | Private Key to derive keys from | |
boolean | compressed | Yes | Compression flag |
IKeyPair
public static fromWIF(wifKey: string, network?: INetwork)
Derive the keys from the given WIF.
Type | Name | Required | Description |
---|---|---|---|
string | wifKey | Yes | Private key |
INetwork | network | No | Network |
IKeyPair
public static fromPassphrase(passphrase: string)
Derive the private key for the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | passphrase | Yes | Passphrase |
string
public static fromWIF(wif: string, network?: NetworkType)
Create a private key instance from a hex string.
Type | Name | Required | Description |
---|---|---|---|
string | wif | Yes | Network WIF |
NetworkType | network | No | Network |
string
public static fromPassphrase(passphrase: string)
Derive the public key from the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | passphrase | Yes | Passphrase |
string
public static fromWIF(wif: string, network?: NetworkType)
Derive the public key from the given WIF.
Type | Name | Required | Description |
---|---|---|---|
string | wif | Yes | WIF to derive public key from |
NetworkType | network | No | Network |
string
public static fromMultiSignatureAsset(asset: IMultiSignatureAsset)
Derive the public key from the given multi signature asset.
Type | Name | Required | Description |
---|---|---|---|
IMultiSignatureAsset | asset | Yes | Asset |
string
public static validate(publicKey: string, networkVersion?: number)
Validate the given public key.
Type | Name | Required | Description |
---|---|---|---|
string | publicKey | Yes | Public key |
number | networkVersion | No | Network version |
boolean
public static fromPassphrase(passphrase: string, network?: INetwork)
Derive the WIF from the given passphrase.
Type | Name | Required | Description |
---|---|---|---|
string | passphrase | Yes | Passphrase to derive WIF from |
INetwork | network | No | Network wif |
string
public static fromKeys(keys: IKeyPair, network?: INetwork)
Derive the WIF from the given keys.
Type | Name | Required | Description |
---|---|---|---|
IKeyPair | keys | Yes | Keys |
INetwork | network | No | Network |
string
public setConfig(config: INetworkConfig)
Set the configuration.
Type | Name | Required | Description |
---|---|---|---|
INetworkConfig | config | Yes | Network configuration object |
void
public setFromPreset(network: NetworkName)
Set the configuration from given presets.
Type | Name | Required | Description |
---|---|---|---|
NetworkName | network | Yes | Preset |
void
public getPreset(network: NetworkName)
Get configuration preset.
Type | Name | Required | Description |
---|---|---|---|
NetworkName | network | Yes | Preset |
INetworkConfig
public all()
Get all configs.
INetworkConfig
public set<T = any>(key: string, value: T)
Set a value for the specified network config key.
Type | Name | Required | Description |
---|---|---|---|
string | key | Yes | Key to set |
T | value | Yes | Value to set |
void
public get<T = any>(key: string)
Get key.
Type | Name | Required | Description |
---|---|---|---|
string | key | Yes | Key to get |
T
public setHeight(value: number)
Set network height.
Type | Name | Required | Description |
---|---|---|---|
number | value | Yes | Network height |
void
public getHeight()
Get network height.
number
public isNewMilestone(height?: number)
Verify if current height contains a milestone.
Type | Name | Required | Description |
---|---|---|---|
number | height | No | Height to check for milestone |
boolean
public getMilestone(height?: number)
Get milestone.
Type | Name | Required | Description |
---|---|---|---|
number | height | No | Network height |
{ [key: string]: any }
public getMilestones()
Get all milestones.
any
public static all()
Get settings for all networks.
Record<NetworkName, INetworkConfig>
public static findByName(name: NetworkName)
Get settings for a selected network, default network is devnet.
Type | Name | Required | Description |
---|---|---|---|
NetworkName | name | Yes | Network name |
INetworkConfig
public static deserialize(serialized: string | Buffer, options: IDeserializeOptions = {})
Deserialize Transaction into object.
Type | Name | Required | Description |
---|---|---|---|
string, Buffer | serialized | Yes | Serialized transaction |
IDeserializeOptions | options | Yes | Options for deserializing |
ITransaction
public static applyV1Compatibility(transaction: ITransactionData)
Modify transaction to be v1 compatible.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction object |
void
public static fromHex(hex: string)
Create Transaction object from HEX.
Type | Name | Required | Description |
---|---|---|---|
string | hex | Yes | HEX of transaction |
ITransaction
public static fromBytes(buffer: Buffer, strict: boolean = true)
Create Transaction object from Buffer.
Type | Name | Required | Description |
---|---|---|---|
Buffer | buffer | Yes | Transaction buffer |
boolean | strict | Yes | Strict creation from buffer |
ITransaction
public 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.
Type | Name | Required | Description |
---|---|---|---|
Buffer | buffer | Yes | Transaction buffer |
string | id | No | ID override |
ITransaction
public static fromJson(json: ITransactionJson)
Create Transaction object from JSON.
Type | Name | Required | Description |
---|---|---|---|
ITransactionJson | json | Yes | Transaction JSON object |
ITransaction
public static fromData(data: ITransactionData, strict: boolean = true)
Create Transaction object from Transaction data.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction object |
boolean | strict | Yes | Strict conversion |
ITransaction
public static getBytes(transaction: ITransactionData, options: ISerializeOptions = {})
Convert the transaction to its byte representation.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction |
ISerializeOptions | options | Yes | Options |
Buffer
public static serialize(transaction: ITransaction, options: ISerializeOptions = {})
Perform AIP11 compliant serialization.
Type | Name | Required | Description |
---|---|---|---|
ITransaction | transaction | Yes | Transaction |
ISerializeOptions | options | Yes | Options |
Buffer
public static sign(transaction: ITransactionData, keys: IKeyPair, options?: ISerializeOptions)
Sign the given transaction with the provided keys.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction |
IKeyPair | keys | Yes | Keys |
ISerializeOptions | options | No | Options |
string
public static secondSign(transaction: ITransactionData, keys: IKeyPair)
Second sign the given transaction with the provided keys.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction |
IKeyPair | keys | Yes | Keys |
string
public static multiSign(transaction: ITransactionData, keys: IKeyPair, index: number = -1)
Multi sign the given transaction with the provided keys.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction |
IKeyPair | keys | Yes | Keys |
number | index | Yes | Index |
string
public static toBytes(data: ITransactionData)
Convert Transaction object to Buffer.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction object |
Buffer
public static toHash(transaction: ITransactionData, options?: ISerializeOptions)
Convert Transaction object to Hash.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction object |
ISerializeOptions | options | No | Serialization options for generating hash |
Buffer
public static getId(transaction: ITransactionData, options: ISerializeOptions = {})
Get Transaction ID of Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction object |
ISerializeOptions | options | Yes | Serialization options for generating hash |
string
public static verify(data: ITransactionData)
Verify transaction.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction object |
boolean
public static verifySecondSignature(transaction: ITransactionData, publicKey: string)
Verify second signature.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction object |
string | publicKey | Yes | Public key |
boolean
public static verifySignatures(transaction: ITransactionData, multiSignature: IMultiSignatureAsset)
Verify the signatures of a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | transaction | Yes | Transaction object |
IMultiSignatureAsset | multiSignature | Yes | Asset for Multi-Signature wallets/transactions |
boolean
public static verifyHash(data: ITransactionData)
Verify transaction hash.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction |
boolean
public static verifySchema(data: ITransactionData, strict: boolean = true)
Verify transaction schema.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction |
boolean | strict | Yes | Strict flag |
ISchemaValidationResult
public static transfer()
Initiate a Transfer transaction type.
TransferBuilder
public static secondSignature()
Initiate a Second Signature transaction type.
SecondSignatureBuilder
public static delegateRegistration()
Initiate a Delegate Resignation transaction type.
DelegateRegistrationBuilder
public static vote()
Initiate a Vote transaction type.
VoteBuilder
public static multiSignature()
Initiate a Multi-Signature transaction type.
MultiSignatureBuilder
public static ipfs()
Initiate an IPFS transaction type.
IPFSBuilder
public static multiPayment()
Initiate a Multi-Payment transaction type.
MultiPaymentBuilder
public static delegateResignation()
Initiate a Delegate Resignation transaction type.
DelegateResignationBuilder
public static htlcLock()
Initiate a HTLC Lock transaction type.
HtlcLockBuilder
public static htlcClaim()
Initiate a HTLC Claim transaction type.
HtlcClaimBuilder
public static htlcRefund()
Initiate a HTLC Refund transaction type.
HtlcRefundBuilder
public usernameAsset(username: string)
Set the username to assign.
Type | Name | Required | Description |
---|---|---|---|
string | username | Yes | Delegate username |
DelegateRegistrationBuilder
public getStruct()
Get transaction structure.
ITransactionData
public getStruct()
Get transaction structure.
ITransactionData
public htlcClaimAsset(claimAsset: IHtlcClaimAsset)
Specify the HTLC Claim asset data for the Transaction.
Type | Name | Required | Description |
---|---|---|---|
IHtlcClaimAsset | claimAsset | Yes | Asset for a HTLC Claim |
HtlcClaimBuilder
public getStruct()
Get transaction structure.
ITransactionData
public htlcLockAsset(lockAsset: IHtlcLockAsset)
Specify the HTLC Lock asset data for the Transaction.
Type | Name | Required | Description |
---|---|---|---|
IHtlcLockAsset | lockAsset | Yes | Asset for a HTLC Lock |
HtlcLockBuilder
public getStruct()
Get transaction structure.
ITransactionData
public htlcRefundAsset(refundAsset: IHtlcRefundAsset)
Specify the HTLC Refund asset data for the Transaction.
Type | Name | Required | Description |
---|---|---|---|
IHtlcRefundAsset | refundAsset | Yes | Asset for a HTLC Refund |
HtlcRefundBuilder
public getStruct()
Get transaction structure.
ITransactionData
public ipfsAsset(ipfsId: string)
Set IPFS asset.
Type | Name | Required | Description |
---|---|---|---|
string | ipfsId | Yes | IPFS ID |
IPFSBuilder
public getStruct()
Get transaction structure.
ITransactionData
public addPayment(recipientId: string, amount: string)
Add a new payment to the collection.
Type | Name | Required | Description |
---|---|---|---|
string | recipientId | Yes | Recipient identifier |
string | amount | Yes | Transaction amount |
MultiPaymentBuilder
public getStruct()
Get transaction structure.
ITransactionData
public participant(publicKey: string)
Add participant to multi signature transaction.
Type | Name | Required | Description |
---|---|---|---|
string | publicKey | Yes | Public key |
MultiSignatureBuilder
public min(min: number)
Set the minimum required signatures.
Type | Name | Required | Description |
---|---|---|---|
number | min | Yes | Minimum required signatures |
MultiSignatureBuilder
public multiSignatureAsset(multiSignature: IMultiSignatureAsset)
Derive the address from the given multi signature asset.
Type | Name | Required | Description |
---|---|---|---|
IMultiSignatureAsset | multiSignature | Yes | Multi signature asset |
MultiSignatureBuilder
public getStruct()
Get transaction structure.
ITransactionData
public signatureAsset(secondPassphrase: string)
Specify the Second Signature asset data for the Transaction.
Type | Name | Required | Description |
---|---|---|---|
string | secondPassphrase | Yes | Asset for a Second Signature |
SecondSignatureBuilder
public getStruct()
Get transaction structure.
ITransactionData
public expiration(expiration: number)
Set Transfer expiration.
Type | Name | Required | Description |
---|---|---|---|
number | expiration | Yes | When the transaction should expire |
TransferBuilder
public getStruct()
Get transaction structure.
ITransactionData
public votesAsset(votes: string[])
Specify the Vote asset data for the Transaction.
Type | Name | Required | Description |
---|---|---|---|
string | votes | Yes | Asset for a Vote |
VoteBuilder
public getStruct()
Get transaction structure.
ITransactionData
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public serialize(options?: ISerializeOptions)
Handle the serialization of "delegate registration" data.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Handle the deserialization of "delegate registration" data.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public serialize(options?: ISerializeOptions)
Handle the serialization of "delegate resignation" data.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Handle the deserialization of "delegate resignation" data.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer |
void
public static initialize(transactionTypes: Map<InternalTransactionType, TransactionConstructor>)
Initialize new transaction types factory.
Type | Name | Required | Description |
---|---|---|---|
Map | transactionTypes | Yes | INSERT_DESCRIPTION |
public static create(data: ITransactionData)
Create new transaction type.
Type | Name | Required | Description |
---|---|---|---|
ITransactionData | data | Yes | Transaction object |
ITransaction
public static get(type: number, typeGroup?: number)
Get a transaction type.
Type | Name | Required | Description |
---|---|---|---|
number | type | Yes | Transaction type |
number | typeGroup | No | Transaction group |
TransactionConstructor
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public serialize(options?: ISerializeOptions)
Serialize Transction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public hasVendorField()
Verify if the transaction contains a vendorfield.
boolean
public serialize(options?: ISerializeOptions)
Serialize a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public serialize(options?: ISerializeOptions)
Serialize a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static from(type: number, typeGroup?: number)
Create new internal transaction type from existing type.
Type | Name | Required | Description |
---|---|---|---|
number | type | Yes | Transaction type |
number | typeGroup | No | Transaction group |
InternalTransactionType
public toString()
Convert transaction type to a group/type
string representation (E.g. 1/0)
string
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public serialize(options?: ISerializeOptions)
Handle the serialization of "IPFS" data.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Handle the deserialization of "IPFS" data.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public verify()
Verify transaction.
boolean
public hasVendorField()
Verify if the transaction contains a vendorfield.
boolean
public serialize(options?: ISerializeOptions)
Serialize a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public static staticFee(feeContext: { height?: number; data?: ITransactionData } = {})
Get the static fee for the Multi-Signature transaction type.
Type | Name | Required | Description |
---|---|---|---|
object | feeContext | Yes | Context for determining the static fee |
BigNumber
public verify()
Verify transaction.
boolean
public serialize(options?: ISerializeOptions)
Serialize a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public serialize(options?: ISerializeOptions)
Serialize a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Deserialize into a Transaction object.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public hasVendorField()
Verify if the transaction contains a vendorfield.
boolean
public serialize(options?: ISerializeOptions)
Perform AIP11 compliant serialization.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Perform AIP11 compliant deserialization.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public static getSchema()
Get transaction schema.
schemas.TransactionSchema
public serialize(options?: ISerializeOptions)
Perform AIP11 compliant serialization.
Type | Name | Required | Description |
---|---|---|---|
ISerializeOptions | options | No | Serialization options |
ByteBuffer
public deserialize(buf: ByteBuffer)
Perform AIP11 compliant deserialization.
Type | Name | Required | Description |
---|---|---|---|
ByteBuffer | buf | Yes | Buffer to deserialize |
void
public getInstance()
Get an instance of the Validator object.
Ajv.Ajv
public validate<T = any>(schemaKeyRef: string | boolean | object, data: T)
Validate a schema object.
Type | Name | Required | Description |
---|---|---|---|
string, boolean, object | schemaKeyRef | Yes | Schema to validate against |
T | data | Yes | Data to validate |
ISchemaValidationResult<T>
public validateException<T = any>(schemaKeyRef: string | boolean | object, data: T)
Validate a schema object for an exception.
Type | Name | Required | Description |
---|---|---|---|
string, boolean, object | schemaKeyRef | Yes | Schema to validate against |
T | data | Yes | Data to validate |
ISchemaValidationResult<T>
public addFormat(name: string, format: Ajv.FormatDefinition)
Add formatting definition used for validation.
Type | Name | Required | Description |
---|---|---|---|
string | name | Yes | Name of definition |
Ajv | format | Yes | Format definition |
void
public addKeyword(keyword: string, definition: Ajv.KeywordDefinition)
Add keyword definition used for validation.
Type | Name | Required | Description |
---|---|---|---|
string | keyword | Yes | Name of definition |
Ajv | definition | Yes | Keyword definition |
void
public addSchema(schema: object | object[], key?: string)
Add schema used for validation.
Type | Name | Required | Description |
---|---|---|---|
object | schema | Yes | Name of schema |
string | key | No | Schema |
void
public removeKeyword(keyword: string)
Remove keyword definition from validation.
Type | Name | Required | Description |
---|---|---|---|
string | keyword | Yes | Name of definition |
void
public removeSchema(schemaKeyRef: string | boolean | object | RegExp)
Remove schema from validation.
Type | Name | Required | Description |
---|---|---|---|
string, boolean, object, RegExp | schemaKeyRef | Yes | Schema to remove |
void
public extendTransaction(schema: TransactionSchema, remove?: boolean)
Extend a Transaction's schema for validation.
Type | Name | Required | Description |
---|---|---|---|
TransactionSchema | schema | Yes | Schema of transaction to extend |
boolean | remove | No | Whether to remove the schema |