Skip to content

adamant-api / helpers/transactions / createChatTransaction

Function: createChatTransaction() ​

ts
function createChatTransaction(data): {
  amount: number;
  asset: {
     chat: {
        message: string;
        own_message: string;
        type: MessageType;
     };
  };
  recipientId: `U${string}`;
  senderId: `U${string}`;
  senderPublicKey: string;
  signature: string;
  timestamp: number;
  timestampMs?: number;
  type: CHAT_MESSAGE;
};

Defined in: src/helpers/transactions/index.ts:149

Creates and signs an encrypted ADM chat transaction envelope.

Parameters ​

ParameterType
dataChatTransactionData

Returns ​

ts
{
  amount: number;
  asset: {
     chat: {
        message: string;
        own_message: string;
        type: MessageType;
     };
  };
  recipientId: `U${string}`;
  senderId: `U${string}`;
  senderPublicKey: string;
  signature: string;
  timestamp: number;
  timestampMs?: number;
  type: CHAT_MESSAGE;
}

amount ​

ts
amount: number;

asset ​

ts
asset: {
  chat: {
     message: string;
     own_message: string;
     type: MessageType;
  };
};

asset.chat ​

ts
chat: {
  message: string;
  own_message: string;
  type: MessageType;
};

asset.chat.message ​

ts
message: string = data.message;

asset.chat.own_message ​

ts
own_message: string = data.own_message;

asset.chat.type ​

ts
type: MessageType = data.message_type;

recipientId ​

ts
recipientId: `U${string}` = details.recipientId;

senderId ​

ts
senderId: `U${string}`;

senderPublicKey ​

ts
senderPublicKey: string;

signature ​

ts
signature: string;

timestamp ​

ts
timestamp: number;

timestampMs? ​

ts
optional timestampMs?: number;

type ​

ts
type: CHAT_MESSAGE;

Released under the GPL-3.0 License.