mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-26 23:25:49 +00:00
clean up
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import * as enums from './definitions.json'
|
import * as enums from './definitions.json'
|
||||||
import { SerializedType } from '../types/serialized-type'
|
import { SerializedType } from '../types/serialized-type'
|
||||||
import { Buffer } from 'buffer/'
|
import { Buffer } from 'buffer/'
|
||||||
|
import { BytesList } from '../binary'
|
||||||
|
|
||||||
const TYPE_WIDTH = 2
|
const TYPE_WIDTH = 2
|
||||||
const LEDGER_ENTRY_WIDTH = 2
|
const LEDGER_ENTRY_WIDTH = 2
|
||||||
@@ -47,7 +48,7 @@ export class Bytes {
|
|||||||
return this.name
|
return this.name
|
||||||
}
|
}
|
||||||
|
|
||||||
toBytesSink(sink): void {
|
toBytesSink(sink: BytesList): void {
|
||||||
sink.put(this.bytes)
|
sink.put(this.bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,8 +137,6 @@ class BinarySerializer {
|
|||||||
|
|
||||||
this.sink.put(field.header)
|
this.sink.put(field.header)
|
||||||
|
|
||||||
console.log(field.name, field.isVariableLengthEncoded)
|
|
||||||
|
|
||||||
if (field.isVariableLengthEncoded) {
|
if (field.isVariableLengthEncoded) {
|
||||||
this.writeLengthEncoded(associatedValue, isUnlModifyWorkaround)
|
this.writeLengthEncoded(associatedValue, isUnlModifyWorkaround)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ class STObject extends SerializedType {
|
|||||||
if (value instanceof STObject) {
|
if (value instanceof STObject) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
console.log('HIIIIIIIIIIIIIIII')
|
|
||||||
|
|
||||||
const list: BytesList = new BytesList()
|
const list: BytesList = new BytesList()
|
||||||
const bytes: BinarySerializer = new BinarySerializer(list)
|
const bytes: BinarySerializer = new BinarySerializer(list)
|
||||||
@@ -123,18 +122,15 @@ class STObject extends SerializedType {
|
|||||||
if (filter !== undefined) {
|
if (filter !== undefined) {
|
||||||
sorted = sorted.filter(filter)
|
sorted = sorted.filter(filter)
|
||||||
}
|
}
|
||||||
// console.log(sorted)
|
|
||||||
|
|
||||||
sorted.forEach((field) => {
|
sorted.forEach((field) => {
|
||||||
const associatedValue = field.associatedType.from(
|
const associatedValue = field.associatedType.from(
|
||||||
xAddressDecoded[field.name],
|
xAddressDecoded[field.name],
|
||||||
)
|
)
|
||||||
// console.log(field, associatedValue)
|
|
||||||
if ((associatedValue as unknown as Bytes).name === 'UNLModify') {
|
if ((associatedValue as unknown as Bytes).name === 'UNLModify') {
|
||||||
isUnlModify = true
|
isUnlModify = true
|
||||||
}
|
}
|
||||||
const isUnlModifyWorkaround = field.name == 'Account' && isUnlModify
|
const isUnlModifyWorkaround = field.name == 'Account' && isUnlModify
|
||||||
console.log(isUnlModify, field.name, isUnlModifyWorkaround)
|
|
||||||
bytes.writeFieldAndValue(field, associatedValue, isUnlModifyWorkaround)
|
bytes.writeFieldAndValue(field, associatedValue, isUnlModifyWorkaround)
|
||||||
if (field.type.name === ST_OBJECT) {
|
if (field.type.name === ST_OBJECT) {
|
||||||
bytes.put(OBJECT_END_MARKER_BYTE)
|
bytes.put(OBJECT_END_MARKER_BYTE)
|
||||||
|
|||||||
Reference in New Issue
Block a user