Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

fix: added txid to views; added key and shielded field in tx_transfert view; #180

Merged
merged 1 commit into from
Mar 30, 2024
Merged
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
30 changes: 27 additions & 3 deletions src/views.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub fn get_create_tx_become_validator_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_become_validator AS
SELECT
SELECT
hash AS txid,
data->>'address' AS address,
data->>'consensus_key' AS consensus_key,
data->>'eth_cold_key' AS eth_cold_key,
Expand All @@ -19,6 +20,7 @@ pub fn get_create_tx_become_validator_view_query(network: &str) -> String {
pub fn get_create_tx_bond_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_bond AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'amount' AS amount,
data->>'source' AS source
Expand All @@ -28,13 +30,15 @@ pub fn get_create_tx_bond_view_query(network: &str) -> String {
pub fn get_create_tx_bridge_pool_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_bridge_pool AS
SELECT
hash AS txid,
data
FROM {network}.transactions WHERE code = '\\x66412b1b01b6659dc196bef86bdb540181d90c2f984a13597f0aa2a4f9c9c907';")
}

pub fn get_create_tx_change_consensus_key_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_change_consensus_key AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'consensus_key' AS consensus_key
FROM {network}.transactions WHERE code = '\\x919be890123e9fbe7f85640811f3ca8edfebe94b7314118afbc84ff9c75ec488';")
Expand All @@ -43,6 +47,7 @@ pub fn get_create_tx_change_consensus_key_view_query(network: &str) -> String {
pub fn get_create_tx_change_validator_comission_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_change_validator_comission AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'new_rate' AS new_rate
FROM {network}.transactions WHERE code = '\\xf76e025e52c75e34937e76fae43c6ed7544e2268e0bcdafeca0b05f9b7484b36';")
Expand All @@ -51,6 +56,7 @@ pub fn get_create_tx_change_validator_comission_view_query(network: &str) -> Str
pub fn get_create_tx_change_validator_metadata_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_change_validator_metadata AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'email' AS email,
data->>'description' AS description,
Expand All @@ -64,6 +70,7 @@ pub fn get_create_tx_change_validator_metadata_view_query(network: &str) -> Stri
pub fn get_create_tx_claim_rewards_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_claim_rewards AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'source' AS source
FROM {network}.transactions WHERE code = '\\x4af7ca07f6e6f2ad87ffe2c5fca90224544c45cc263e2e4d05775d782cac1f48';")
Expand All @@ -72,20 +79,23 @@ pub fn get_create_tx_claim_rewards_view_query(network: &str) -> String {
pub fn get_create_tx_deactivate_validator_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_deactivate_validator AS
SELECT
hash AS txid,
data AS address
FROM {network}.transactions WHERE code = '\\x0faaf9b55c150cdf8b2ea6a05c5fae725735b4fee44aa5da79bcd1881cb43f78';")
}

pub fn get_create_tx_ibc_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_ibc AS
SELECT
hash AS txid,
data
FROM {network}.transactions WHERE code = '\\xf99df82e284dcb96a12b409bc43aa7dc77b346ab0b2d3f0a9a39807e749ce8ee';")
}

pub fn get_create_tx_init_account_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_init_account AS
SELECT
hash AS txid,
data->>'public_keys' AS public_keys,
data->>'vp_code_hash' AS vp_code_hash,
data->>'threshold' AS threshold
Expand All @@ -95,6 +105,7 @@ pub fn get_create_tx_init_account_view_query(network: &str) -> String {
pub fn get_create_tx_init_proposal_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_init_proposal AS
SELECT
hash AS txid,
data->>'id' AS id,
data->>'content' AS content,
data->>'author' AS author,
Expand All @@ -108,13 +119,15 @@ pub fn get_create_tx_init_proposal_view_query(network: &str) -> String {
pub fn get_create_tx_reactivate_validator_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_reactivate_validator AS
SELECT
hash AS txid,
data AS address
FROM {network}.transactions WHERE code = '\\xc94c4e6d549c921b9a483675f0e3af45eef79d4489bd35061fd285af6189b20d';")
}

pub fn get_create_tx_redelegate_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_redelegate AS
SELECT
hash AS txid,
data->>'redel_bond_start' AS redel_bond_start,
data->>'src_validator' AS src_validator,
data->>'bond_start' AS bond_start,
Expand All @@ -125,30 +138,36 @@ pub fn get_create_tx_redelegate_view_query(network: &str) -> String {
pub fn get_create_tx_resign_steward_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_resign_steward AS
SELECT
hash AS txid,
data AS address
FROM {network}.transactions WHERE code = '\\x7655ed64d1b07900672aee307f679b35af77337c077648adc11914348d1f130f';")
}

pub fn get_create_tx_reveal_pk_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_reveal_pk AS
SELECT
hash AS txid,
data AS public_key
FROM {network}.transactions WHERE code = '\\x283fd236d971dd0f7ca1a329b508a4039946f40f1c9792863fe6b0fa05d74832';")
}

pub fn get_create_tx_transfert_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_transfert AS
format!("CREATE OR REPLACE VIEW {network}.tx_transfer AS
SELECT
hash AS txid,
data->>'source' AS source,
data->>'target' AS target,
data->>'token' AS token,
data->>'amount' AS amount
data->>'amount' AS amount,
data->>'key' AS key,
data->>'shielded' AS shielded
FROM {network}.transactions WHERE code = '\\x0960374d23acbac1feb27b3888095859217936c900cef54e559d215cec3206ef';")
}

pub fn get_create_tx_unbond_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_unbond AS
SELECT
hash AS txid,
data->>'validator' AS validator,
data->>'amount' AS amount,
data->>'source' AS source
Expand All @@ -158,13 +177,15 @@ pub fn get_create_tx_unbond_view_query(network: &str) -> String {
pub fn get_create_tx_unjail_validator_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_unjail_validator AS
SELECT
hash AS txid,
data AS address
FROM {network}.transactions WHERE code = '\\x2b1451721dcdd069a19cba1f9b338bb6a45d85d0d56ba7ca952742d3ec5878b3';")
}

pub fn get_create_tx_update_account_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_update_account AS
SELECT
hash AS txid,
data->>'addr' AS addr,
data->>'vp_code_hash' AS vp_code_hash,
data->>'public_keys' AS public_keys,
Expand All @@ -175,6 +196,7 @@ pub fn get_create_tx_update_account_view_query(network: &str) -> String {
pub fn get_create_tx_update_steward_commission_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_update_steward_commission AS
SELECT
hash AS txid,
data->>'steward' AS steward,
data->>'commission' AS commission
FROM {network}.transactions WHERE code = '\\xed0ccfa4a8c8fa86f9f14c3b53b7f126ce4a86849815dad784b5aa35011a1db6';")
Expand All @@ -183,6 +205,7 @@ pub fn get_create_tx_update_steward_commission_view_query(network: &str) -> Stri
pub fn get_create_tx_vote_proposal_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_vote_proposal AS
SELECT
hash AS txid,
data->>'id' AS id,
data->>'vote' AS vote,
data->>'voter' AS voter,
Expand All @@ -193,6 +216,7 @@ pub fn get_create_tx_vote_proposal_view_query(network: &str) -> String {
pub fn get_create_tx_withdraw_view_query(network: &str) -> String {
format!("CREATE OR REPLACE VIEW {network}.tx_withdraw AS
SELECT
hash AS txid,
data->'validator' AS validator,
data->'source' AS source
FROM {network}.transactions WHERE code = '\\x69560777e2656b2872a49080c51bb5b1a498a7ffd79dae491d36b301a1b012e6';")
Expand Down
Loading