Class MessageContainer

Description

Internal helper class to pack content into container and split it into chunks (for blockchains with transaction size limit)

Example

// Packing:

const recipientAddresses: string[] = [...];

const messageContent = MessageContentV3.plain('Hi there', 'Hello world everyone :)');
const { encodedContent, key } = MessageEncodedContent.encodeContent(messageContent);
const preparedRecipients = await sender.prepareRecipients(recipientAddresses);
const container = MessageContainer.packContainer(ServiceCode.SDK, senderPublicKey, encodedContent)
const chunks = MessageChunks.packContainer();
// Broadcast chunks through blockchain

// Unpacking:
const chunks: Uint8Array[] = await readChunksFromSomewhere();
const content = MessageChunks.unpackContainer(chunks);
console.log('Your message: ', content);

Hierarchy

  • MessageContainer

Constructors

Properties

VERSION: number = 0x06

Methods

  • Method to prepare outgoing message for publishing to blockchain

    Returns

    Wrapped content splet into chunks

    Parameters

    • serviceCode: number

      Service code of an app used to send message. Used for analytics, could be left zero-filled.

    • isEncoded: boolean
    • senderPublicKeys: EncryptionPublicKey[]
    • messageBlobBytes: Uint8Array

      Raw bytes of the message blob (usually the result of MessageBlob.encode)

    Returns Uint8Array

Generated using TypeDoc