mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
clean up
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user