This commit is contained in:
Mayukha Vadari
2021-11-30 14:19:52 -05:00
parent ce229b9977
commit fe75f127f6
3 changed files with 2 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import * as enums from './definitions.json'
import { SerializedType } from '../types/serialized-type'
import { Buffer } from 'buffer/'
import { BytesList } from '../binary'
const TYPE_WIDTH = 2
const LEDGER_ENTRY_WIDTH = 2
@@ -47,7 +48,7 @@ export class Bytes {
return this.name
}
toBytesSink(sink): void {
toBytesSink(sink: BytesList): void {
sink.put(this.bytes)
}

View File

@@ -137,8 +137,6 @@ class BinarySerializer {
this.sink.put(field.header)
console.log(field.name, field.isVariableLengthEncoded)
if (field.isVariableLengthEncoded) {
this.writeLengthEncoded(associatedValue, isUnlModifyWorkaround)
} else {

View File

@@ -92,7 +92,6 @@ class STObject extends SerializedType {
if (value instanceof STObject) {
return value
}
console.log('HIIIIIIIIIIIIIIII')
const list: BytesList = new BytesList()
const bytes: BinarySerializer = new BinarySerializer(list)
@@ -123,18 +122,15 @@ class STObject extends SerializedType {
if (filter !== undefined) {
sorted = sorted.filter(filter)
}
// console.log(sorted)
sorted.forEach((field) => {
const associatedValue = field.associatedType.from(
xAddressDecoded[field.name],
)
// console.log(field, associatedValue)
if ((associatedValue as unknown as Bytes).name === 'UNLModify') {
isUnlModify = true
}
const isUnlModifyWorkaround = field.name == 'Account' && isUnlModify
console.log(isUnlModify, field.name, isUnlModifyWorkaround)
bytes.writeFieldAndValue(field, associatedValue, isUnlModifyWorkaround)
if (field.type.name === ST_OBJECT) {
bytes.put(OBJECT_END_MARKER_BYTE)