Skip to content

Commit

Permalink
preliminary support for new types
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardAH committed Mar 15, 2023
1 parent 1664d84 commit 4ba4510
Showing 1 changed file with 157 additions and 13 deletions.
170 changes: 157 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,140 @@
state = 5; // type and field read
}

if (state == 240)
{
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "currency", out);
if (hexaccum != "0".repeat(40))
{
state = 241;
hexaccum = "";
to_accumulate = 42;
continue;
}
state = 0;
}
continue;
}

if (state == 241)
{
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "issuer", out);
hexaccum = "";
state = 0;
}
continue;
}

if (state == 250)
{
// account
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "locking chain door", out);
hexaccum = "";
state = 251;
to_accumulate = 40;
}
continue;
}

if (state == 251)
{
// currency
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "locking chain currency", out);
if (hexaccum != "0".repeat(40))
{
// we need to read a currency-issuer first
state = 252;
hexaccum = "";
to_accumulate = 42;
continue;
}
else
{
// skip to issuing chain door
state = 253;
hexaccum = "";
to_accumulate = 42;
continue;
}
state = 0;
}
continue;
}

if (state == 252)
{
// account
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "locking chain issuer", out);
hexaccum = "";
to_accumulate = 42;
state = 253;
}
continue;
}

if (state == 253)
{
// account
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "issuing chain door", out);
hexaccum = "";
state = 254;
to_accumulate = 40;
}
continue;
}

if (state == 254)
{
// currnecy
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "issuing chain currency", out);
if (hexaccum != "0".repeat(40))
{
// we need to read a currency-issuer first
hexaccum = "";
state = 255;
to_accumulate = 42;
continue;
}
state = 0;
}
continue;
}

if (state == 255)
{
// account
hexaccum += inp[i]
if (--to_accumulate == 0)
{
print_payload("", "", hexaccum, "issuing chain issuer", out);
hexaccum = "";
state = 0;
}
continue;
}


if (state == 5) {

// now we process VL if any and print the field contents
Expand All @@ -799,6 +933,16 @@
to_accumulate = -1 /* special value because we need the next byte to know how big 16 or 96 */
amount_type = -1
}
else if (st_type == 24) {
to_accumulate = 40;
state = 240
continue
}
else if (st_type == 25) {
to_accumulate = 42;
state = 250
continue
}
else if (st_type == 7) {
state = 70
continue
Expand Down Expand Up @@ -857,24 +1001,24 @@
state = 0
continue
}
hex_accum = ""
hexaccum = ""
state = 191
vec_counter = 0
}

if (state == 191)
{
if (to_accumulate % 64 == 0 && hex_accum != "")
if (to_accumulate % 64 == 0 && hexaccum != "")
{
print_payload("", "", hex_accum, "hash " + (vec_counter++), out);
hex_accum = ""
print_payload("", "", hexaccum, "hash " + (vec_counter++), out);
hexaccum = ""
}
to_accumulate--;
hex_accum += inp[i]
hexaccum += inp[i]
if (to_accumulate <= 0)
{
print_payload("", "", hex_accum, "hash " + (vec_counter++), out);
hex_accum = ""
print_payload("", "", hexaccum, "hash " + (vec_counter++), out);
hexaccum = ""
vec_counter = 0
state = 0
continue
Expand All @@ -887,7 +1031,7 @@
{ // pathset accountid or currency or issuer
console.log("182: " + to_accumulate)
to_accumulate--;
hex_accum += inp[i];
hexaccum += inp[i];
if (to_accumulate <= 0)
state = (flags == 0 ? 184 : 183 ); // fallthru
else
Expand All @@ -898,25 +1042,25 @@
{ // display parsed field
if (flags & 0x01)
{
print_payload("", "", hex_accum, "account", out);
print_payload("", "", hexaccum, "account", out);
flags -= 0x01;
}
else if (flags & 0x10)
{
print_payload("", "", hex_accum, "currency", out);
print_payload("", "", hexaccum, "currency", out);
flags -= 0x10;
}
else if (flags & 0x20)
{
print_payload("", "", hex_accum, "issuer", out);
print_payload("", "", hexaccum, "issuer", out);
flags -= 0x20;
}

if (flags > 0)
{
state = 182;
to_accumulate = 40;
hex_accum = "";
hexaccum = "";
continue;
}

Expand Down Expand Up @@ -993,7 +1137,7 @@

indent_level += 2;

hex_accum = "";
hexaccum = "";
to_accumulate = 40;
state = 182;
continue;
Expand Down

0 comments on commit 4ba4510

Please sign in to comment.