Skip to content

Commit

Permalink
feat: updated ship materialize view query to support new onchain stru…
Browse files Browse the repository at this point in the history
…cture (#52)
  • Loading branch information
Mercurial authored Apr 24, 2024
1 parent be4de66 commit ab01df0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions indexer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
dbContext.Database.Migrate();

var trackedAddressed = JsonSerializer.Deserialize<string[]>(builder.Configuration.GetValue<string>("UtxoAddresses") ?? "[]");

var shipyardPolicyId = builder.Configuration.GetValue<string>("ShipyardPolicyId");
// SQL to create the materialized view

var dropViewSql = "DROP MATERIALIZED VIEW IF EXISTS mapobjects;";
Expand All @@ -44,12 +44,12 @@ CREATE MATERIALIZED VIEW mapobjects AS
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 0 ->> 'int' AS INTEGER) AS fuel,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 1 ->> 'int' AS INTEGER) AS positionx,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 2 ->> 'int' AS INTEGER) AS positiony,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 3 ->> 'bytes' AS VARCHAR(56)) AS shipyardpolicy,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 4 ->> 'bytes' AS TEXT) AS shiptokenname,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 5 ->> 'bytes' AS TEXT) AS pilottokenname,
'{shipyardPolicyId}' AS shipyardpolicy,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 3 ->> 'bytes' AS TEXT) AS shiptokenname,
CAST(utxo_plutus_data(""Era"", ""Cbor"") -> 'fields' -> 4 ->> 'bytes' AS TEXT) AS pilottokenname,
0 as totalrewards
from ""UtxoCborByAddresses""
where ""Address"" = '{trackedAddressed?[0]}'
where ""Address"" = '{trackedAddressed?[0]}' and utxo_has_policy_id_output(""Era"", ""Cbor"", decode('{shipyardPolicyId}', 'hex'))
union all
select
""TxHash"" || '#' || ""OutputIndex"" as id,
Expand Down
Empty file removed indexer/Worker.cs
Empty file.

0 comments on commit ab01df0

Please sign in to comment.