Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backend/src/workers/soroban-event-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const INDEXER_STATE_ID = 'singleton';
// ─── XDR Decoding Helpers ────────────────────────────────────────────────────

/** Decode an ScVal symbol to a string. */
function decodeSymbol(val: xdr.ScVal): string {
export function decodeSymbol(val: xdr.ScVal): string {
return val.sym().toString();
}

/**
* Decode an ScVal U64 to a JavaScript bigint.
* `xdr.UInt64` extends Long; `.toString()` gives the decimal representation.
*/
function decodeU64(val: xdr.ScVal): bigint {
export function decodeU64(val: xdr.ScVal): bigint {
return BigInt(val.u64().toString());
}

Expand All @@ -27,7 +27,7 @@ function decodeU64(val: xdr.ScVal): bigint {
* I128 in XDR is split into hi (signed Int64) and lo (unsigned Uint64).
* Full value = hi * 2^64 + lo.
*/
function decodeI128(val: xdr.ScVal): string {
export function decodeI128(val: xdr.ScVal): string {
const parts = val.i128();
const hi = BigInt.asIntN(64, BigInt(parts.hi().toString()));
const lo = BigInt.asUintN(64, BigInt(parts.lo().toString()));
Expand All @@ -38,7 +38,7 @@ function decodeI128(val: xdr.ScVal): string {
* Decode an ScVal Address to a Stellar public key (G...) or contract (C...)
* string.
*/
function decodeAddress(val: xdr.ScVal): string {
export function decodeAddress(val: xdr.ScVal): string {
const addr = val.address();
if (
addr.switch().value ===
Expand All @@ -54,7 +54,7 @@ function decodeAddress(val: xdr.ScVal): string {
* Decode an ScVal Map (a `#[contracttype]` struct) into a plain object keyed
* by field name with raw ScVal values for further decoding.
*/
function decodeMap(val: xdr.ScVal): Record<string, xdr.ScVal> {
export function decodeMap(val: xdr.ScVal): Record<string, xdr.ScVal> {
const result: Record<string, xdr.ScVal> = {};
const entries = val.map();
if (!entries) return result;
Expand Down
Loading
Loading