1+ import { MessageType } from 'adamant-api' ;
2+
13import api from '../../utils/api.js' ;
24import config from '../../utils/config.js' ;
35import { requiredParam } from '../../utils/validate.js' ;
@@ -28,14 +30,14 @@ export async function sendMessage(
2830 amountString = '' ,
2931 passphrase ,
3032) {
31- const messageType = 'basic' ;
33+ const messageType = MessageType . Chat ;
3234 const isAmountInADM = amountString . includes ( 'ADM' ) ;
3335 const amount = parseFloat ( amountString , 10 ) ;
3436
3537 const messageStr =
3638 typeof message === 'object' ? JSON . stringify ( message ) : message ;
3739
38- const res = await sendMessage (
40+ const res = await api . sendMessage (
3941 passphrase || config . passphrase ,
4042 address ,
4143 messageStr ,
@@ -52,7 +54,7 @@ export async function sendRich(
5254 json = requiredParam ( 'json' ) ,
5355 passphrase ,
5456) {
55- const messageType = 'rich' ;
57+ const messageType = MessageType . Rich ;
5658 const message =
5759 typeof json === 'object' ? JSON . stringify ( json ) : prepareJSON ( json ) ;
5860
@@ -71,7 +73,7 @@ export async function sendSignal(
7173 json = requiredParam ( 'json' ) ,
7274 passphrase ,
7375) {
74- const messageType = 'signal' ;
76+ const messageType = MessageType . Signal ;
7577 const message =
7678 typeof json === 'object' ? JSON . stringify ( json ) : prepareJSON ( json ) ;
7779
0 commit comments