Skip to content

Commit

Permalink
Add non-root ledgers support
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed May 31, 2024
1 parent c347346 commit 3d65672
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions Tzkt.Sync/Protocols/Helpers/BigMaps.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Numerics;
using System.Text.Json;
using Netezos.Contracts;
using Netezos.Encoding;
Expand All @@ -13,35 +10,35 @@ static class BigMaps
{
public static BigMapTag GetTags(Contract contract, TreeView bigmap)
{
var schema = bigmap.Schema as BigMapSchema;
var tags = BigMapTag.None;

if (IsPersistent(bigmap))
{
tags |= BigMapTag.Persistent;
var schema = bigmap.Schema as BigMapSchema;
if (schema.Field == "metadata")
{
if (schema.Key is StringSchema &&
schema.Value is BytesSchema)
tags |= BigMapTag.Metadata;
}
else if (contract.Kind == ContractKind.Asset)
else if (contract.Kind == ContractKind.Asset && schema.Field == "token_metadata")
{
if (schema.Field == "token_metadata")
{
if (schema.Key is NatSchema &&
schema.Value is PairSchema pair &&
pair.Left is NatSchema &&
pair.Right is MapSchema map &&
map.Key is StringSchema &&
map.Value is BytesSchema)
tags |= BigMapTag.TokenMetadata;
}
else if (schema.Field == "ledger")
{
tags |= GetLedgerType(schema);
}
if (schema.Key is NatSchema &&
schema.Value is PairSchema pair &&
pair.Left is NatSchema &&
pair.Right is MapSchema map &&
map.Key is StringSchema &&
map.Value is BytesSchema)
tags |= BigMapTag.TokenMetadata;
}
}

if (contract.Kind == ContractKind.Asset && schema.Field == "ledger")
{
tags |= GetLedgerType(schema);
}

return tags;
}

Expand Down

0 comments on commit 3d65672

Please sign in to comment.