add comment as optional transfer param

This commit is contained in:
Alexandr 2025-02-24 01:15:09 +03:00
parent 8654b3f72b
commit 40f1663a56
2 changed files with 9 additions and 6 deletions

View file

@ -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
);
},
{

View file

@ -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}`);