Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (issuanceTimestamp && issuanceTimestamp.length > ISSUANCE_TIMESTAMP_LENGTH) {
throw new RangeError(errors.ILLEGAL_ISSUANCE_TIMESTAMP_LENGTH)
}
if (tag && tag.length > TAG_LENGTH) {
throw new RangeError(errors.ILLEGAL_TAG_LENGTH)
}
const signatureOrMessageCopy = signatureOrMessage
? signatureOrMessage.slice()
: new Int8Array(SIGNATURE_OR_MESSAGE_LENGTH)
const numberOfFragments = signatureOrMessageCopy.length / SIGNATURE_OR_MESSAGE_LENGTH
const bundleCopy = new Int8Array(bundle.length + numberOfFragments * TRANSACTION_LENGTH)
const currentIndexBuffer = bundle.length > 0 ? increment(lastIndex(bundle)) : new Int8Array(LAST_INDEX_LENGTH)
const lastIndexBuffer = currentIndexBuffer.slice()
let fragmentIndex = 0
bundleCopy.set(bundle.slice())
// Create and append transactions to the bundle.
for (let offset = bundle.length; offset < bundleCopy.length; offset += TRANSACTION_LENGTH) {
const signatureOrMessageCopyFragment = signatureOrMessageCopy.subarray(
fragmentIndex * SIGNATURE_OR_MESSAGE_LENGTH,
(fragmentIndex + 1) * SIGNATURE_OR_MESSAGE_LENGTH
)
bundleCopy.set(signatureOrMessageCopyFragment, offset + SIGNATURE_OR_MESSAGE_OFFSET)
if (address) {
bundleCopy.set(address, offset + ADDRESS_OFFSET)