diff --git a/src/background/background.ts b/src/background/background.ts index 7446e01..d33d745 100644 --- a/src/background/background.ts +++ b/src/background/background.ts @@ -427,7 +427,7 @@ async function processRequest(request: RequestType, sender: Sender, sendResponse request.destination, request.amount, request.decimalPoint, - request.comment + request.comment ?? undefined ) .then((data) => { sendResponse({ data }); @@ -526,7 +526,7 @@ async function processRequest(request: RequestType, sender: Sender, sendResponse destination, amount, asset?.decimal_point || 12, - comment + comment ?? undefined ); }, { diff --git a/src/background/wallet.ts b/src/background/wallet.ts index 0760925..04f4c67 100644 --- a/src/background/wallet.ts +++ b/src/background/wallet.ts @@ -318,7 +318,7 @@ export const transfer = async ( destination: any, amount: any, decimalPoint: any, - comment: string + comment?: string ) => { const destinations = [ { @@ -331,12 +331,15 @@ export const transfer = async ( }, ]; - const response = await fetchData("transfer", { + const options : {[key: string]: typeof destinations | number | string } = { destinations, fee: 10000000000, mixin: 10, - comment - }); + }; + + if (comment) options.comment = comment; + + const response = await fetchData("transfer", options); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`);