-
-
Notifications
You must be signed in to change notification settings - Fork 0
Chat
martiliones edited this page Jun 12, 2023
·
1 revision
Get messages between two accounts
-
Type
interface AdamantApi { getChatMessages( address1: string, address2: string, options?: TransactionQuery<ChatroomsOptions> ): Promise<GetChatMessagesResponseDto>; } interface ChatroomsOptions { blockId?: number; fromHeight?: number; inId?: string; limit?: number; maxAmount?: number; minAmount?: number; offset?: number; orderBy?: string; recipientId?: string; senderId?: string; toHeight?: number; type?: number; withoutDirectTransfers?: boolean; } interface GetChatMessagesResponseDto { messages: (ChatMessageTransaction | TokenTransferTransaction)[]; nodeTimestamp: number; participants: ChatParticipant[]; success: boolean; } type TokenTransferTransaction = { asset: TokenTransferAsset; type: number; } & BaseTransaction; type ChatMessageTransaction = { asset: ChatMessageAsset; type: number; } & BaseTransaction; interface ChatParticipant { address: string; publicKey: string; } interface BaseTransaction { amount: number; asset: object; blockId: string; block_timestamp: number; confirmations: number; fee: number; height: number; id: string; recipientId: string; recipientPublicKey: string; senderId: string; senderPublicKey: string; signature: string; signatures: string[]; timestamp: number; type: number; } type TokenTransferAsset = object; interface ChatMessageAsset { chat: { message?: string; own_message?: string; type?: number }; }
-
References
Get list of Chats
-
Type
interface AdamantApi { getChats( address: string, options?: TransactionQuery<ChatroomsOptions> ): Promise<GetChatRoomsResponseDto>; } interface ChatroomsOptions { blockId?: number; fromHeight?: number; inId?: string; limit?: number; maxAmount?: number; minAmount?: number; offset?: number; orderBy?: string; recipientId?: string; senderId?: string; toHeight?: number; type?: number; withoutDirectTransfers?: boolean; } interface GetChatRoomsResponseDto { chats: { lastTransaction?: ChatMessageTransaction | TokenTransferTransaction; participants?: ChatParticipant[]; }[]; nodeTimestamp: number; success: boolean; } type TokenTransferTransaction = { asset: TokenTransferAsset; type: number; } & BaseTransaction; type ChatMessageTransaction = { asset: ChatMessageAsset; type: number; } & BaseTransaction; interface ChatParticipant { address: string; publicKey: string; } interface BaseTransaction { amount: number; asset: object; blockId: string; block_timestamp: number; confirmations: number; fee: number; height: number; id: string; recipientId: string; recipientPublicKey: string; senderId: string; senderPublicKey: string; signature: string; signatures: string[]; timestamp: number; type: number; } type TokenTransferAsset = object; interface ChatMessageAsset { chat: { message?: string; own_message?: string; type?: number }; }
-
References
Encrypts a message, creates Message transaction, signs it, and broadcasts to ADAMANT network. Supports Basic, Rich and Signal Message Types.
-
Type
interface AdamantApi { sendMessage( addressOrPublicKey: string, message: string, messageType?: MessageType, amount?: number, isADM?: boolean ): Promise<TransferTokenResponseDto>; } interface TransferTokenResponseDto { nodeTimestamp: number; success: boolean; transactionId: string; }
-
References
Send tokens to an account
-
Type
interface AdamantApi { sendTokens( addressOrPublicKey: string, amount: number, isAmountInADM?: boolean ): Promise<TransferTokenResponseDto>; } interface TransferTokenResponseDto { nodeTimestamp: number; success: boolean; transactionId: string; }