I’ve removed the fields on the indexer side that use balance:
before debuggin:
let event = new DepositEvent({
id: receipt.receiptId,
user: getIdentity(log.user),
amount: BigInt(log.amount.toString()),
baseAmount: BigInt(log.balance.liquid.base.toString()),
quoteAmount: BigInt(log.balance.liquid.quote.toString()),
asset: log.asset.bits,
txId: receipt.txId,
timestamp: tai64ToDate(receipt.time).toISOString(),
})
after:
let event = new DepositEvent({
id: receipt.receiptId,
user: getIdentity(log.user),
amount: BigInt(log.amount.toString()),
asset: log.asset.bits,
txId: receipt.txId,
timestamp: tai64ToDate(receipt.time).toISOString(),
})
problem is the same…
I started debugging BigNumberCoder in node models
decode(data, offset) {
console.log("Raw data:", data);
console.log("Offset:", offset);
console.log("Expected encoded length:", this.encodedLength);
if (offset + this.encodedLength > data.length) {
console.error(`Error: Offset (${offset}) plus expected length (${this.encodedLength}) exceeds data length (${data.length}).`);
throw new import_errors4.FuelError(import_errors4.ErrorCode.DECODE_ERROR, `Data out of bounds for ${this.type} decoding.`);
}
let bytes = data.slice(offset, offset + this.encodedLength);
console.log("Bytes after slicing:", bytes);
if (bytes.length !== this.encodedLength) {
console.error(`Error: Byte length (${bytes.length}) does not match expected encoded length (${this.encodedLength}).`);
throw new import_errors4.FuelError(import_errors4.ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
}
return [(0, import_math3.bn)(bytes), offset + this.encodedLength];
}
and i got this result
Raw data: Uint8Array(96) [
0, 0, 0, 0, 0, 0, 39, 16, 56, 228, 202, 152,
91, 34, 98, 95, 255, 147, 32, 94, 153, 123, 252, 92,
200, 69, 58, 149, 61, 166, 56, 173, 41, 124, 166, 10,
159, 38, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0,
30, 244, 202, 35, 247, 125, 221, 57, 64, 14, 50, 25,
159, 30, 126, 74, 133, 223, 242, 6, 122, 133, 14, 224,
148, 78, 214, 236, 226, 92, 48, 254, 0, 0, 0, 0,
0, 0, 39, 16, 0, 0, 0, 0, 0, 0, 0, 0
]
Offset: 0
Expected encoded length: 8
Bytes after slicing: Uint8Array(8) [
0, 0, 0, 0,
0, 0, 39, 16
]
Raw data: Uint8Array(96) [
0, 0, 0, 0, 0, 0, 39, 16, 56, 228, 202, 152,
91, 34, 98, 95, 255, 147, 32, 94, 153, 123, 252, 92,
200, 69, 58, 149, 61, 166, 56, 173, 41, 124, 166, 10,
159, 38, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0,
30, 244, 202, 35, 247, 125, 221, 57, 64, 14, 50, 25,
159, 30, 126, 74, 133, 223, 242, 6, 122, 133, 14, 224,
148, 78, 214, 236, 226, 92, 48, 254, 0, 0, 0, 0,
0, 0, 39, 16, 0, 0, 0, 0, 0, 0, 0, 0
]
Offset: 40
Expected encoded length: 8
Bytes after slicing: Uint8Array(8) [
0, 0, 0, 0,
0, 0, 0, 0
]
Raw data: Uint8Array(96) [
0, 0, 0, 0, 0, 0, 39, 16, 56, 228, 202, 152,
91, 34, 98, 95, 255, 147, 32, 94, 153, 123, 252, 92,
200, 69, 58, 149, 61, 166, 56, 173, 41, 124, 166, 10,
159, 38, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0,
30, 244, 202, 35, 247, 125, 221, 57, 64, 14, 50, 25,
159, 30, 126, 74, 133, 223, 242, 6, 122, 133, 14, 224,
148, 78, 214, 236, 226, 92, 48, 254, 0, 0, 0, 0,
0, 0, 39, 16, 0, 0, 0, 0, 0, 0, 0, 0
]
Offset: 80
Expected encoded length: 8
Bytes after slicing: Uint8Array(8) [
0, 0, 0, 0,
0, 0, 39, 16
]
Raw data: Uint8Array(96) [
0, 0, 0, 0, 0, 0, 39, 16, 56, 228, 202, 152,
91, 34, 98, 95, 255, 147, 32, 94, 153, 123, 252, 92,
200, 69, 58, 149, 61, 166, 56, 173, 41, 124, 166, 10,
159, 38, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0,
30, 244, 202, 35, 247, 125, 221, 57, 64, 14, 50, 25,
159, 30, 126, 74, 133, 223, 242, 6, 122, 133, 14, 224,
148, 78, 214, 236, 226, 92, 48, 254, 0, 0, 0, 0,
0, 0, 39, 16, 0, 0, 0, 0, 0, 0, 0, 0
]
Offset: 88
Expected encoded length: 8
Bytes after slicing: Uint8Array(8) [
0, 0, 0, 0,
0, 0, 0, 0
]
Raw data: Uint8Array(96) [
0, 0, 0, 0, 0, 0, 39, 16, 56, 228, 202, 152,
91, 34, 98, 95, 255, 147, 32, 94, 153, 123, 252, 92,
200, 69, 58, 149, 61, 166, 56, 173, 41, 124, 166, 10,
159, 38, 0, 188, 0, 0, 0, 0, 0, 0, 0, 0,
30, 244, 202, 35, 247, 125, 221, 57, 64, 14, 50, 25,
159, 30, 126, 74, 133, 223, 242, 6, 122, 133, 14, 224,
148, 78, 214, 236, 226, 92, 48, 254, 0, 0, 0, 0,
0, 0, 39, 16, 0, 0, 0, 0, 0, 0, 0, 0
]
Offset: 96
Expected encoded length: 8
Error: Offset (96) plus expected length (8) exceeds data length (96).
Can this get us closer to a solution? Please give feedback if I’m not clear or descriptive.