Fix: Don't remove fields in JSON mode if empty.

This commit is contained in:
muzam1l
2023-03-23 16:26:29 +05:30
parent 025eff6cf2
commit 8a5b83d57f
3 changed files with 12 additions and 14 deletions

View File

@@ -141,7 +141,7 @@ export const prepareTransaction = (data: any) => {
if (_value.$value) {
options[field] = (+(_value as any).$value * 1000000 + '')
} else {
options[field] = undefined
options[field] = ""
}
}
// amount.token
@@ -156,7 +156,7 @@ export const prepareTransaction = (data: any) => {
}
// account
if (_value.$type === 'account') {
options[field] = _value.$value?.toString();
options[field] = _value.$value?.toString() || ""
}
// json
if (_value.$type === 'json') {
@@ -172,13 +172,6 @@ export const prepareTransaction = (data: any) => {
}
})
// delete unnecessary fields
Object.keys(options).forEach(field => {
if (!options[field]) {
delete options[field]
}
})
return options
}
@@ -269,7 +262,7 @@ export const prepareState = (value: string, transactionType?: string) => {
} else if (isAccount) {
rest[field] = {
$type: "account",
$value: value?.toString()
$value: value?.toString() || ""
}
}
else if (typeof value === 'object') {