0.7.34
This commit is contained in:
@@ -27,13 +27,17 @@ pub async fn query_liquidity_events_upsert(
|
||||
let query_result = sqlx::query(
|
||||
r#"
|
||||
INSERT INTO k_sol_liquidity_events (
|
||||
transaction_id,
|
||||
decoded_event_id,
|
||||
dex_id,
|
||||
pool_id,
|
||||
pair_id,
|
||||
signature,
|
||||
instruction_index,
|
||||
slot,
|
||||
program_id,
|
||||
event_kind,
|
||||
event_kind_text,
|
||||
actor_wallet,
|
||||
base_token_id,
|
||||
quote_token_id,
|
||||
@@ -41,15 +45,22 @@ INSERT INTO k_sol_liquidity_events (
|
||||
base_amount,
|
||||
quote_amount,
|
||||
lp_amount,
|
||||
executed_at
|
||||
amounts_are_complete,
|
||||
payload_json,
|
||||
executed_at,
|
||||
created_at
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON CONFLICT(signature, instruction_index) DO UPDATE SET
|
||||
transaction_id = excluded.transaction_id,
|
||||
decoded_event_id = excluded.decoded_event_id,
|
||||
dex_id = excluded.dex_id,
|
||||
pool_id = excluded.pool_id,
|
||||
pair_id = excluded.pair_id,
|
||||
slot = excluded.slot,
|
||||
program_id = excluded.program_id,
|
||||
event_kind = excluded.event_kind,
|
||||
event_kind_text = excluded.event_kind_text,
|
||||
actor_wallet = excluded.actor_wallet,
|
||||
base_token_id = excluded.base_token_id,
|
||||
quote_token_id = excluded.quote_token_id,
|
||||
@@ -57,16 +68,22 @@ ON CONFLICT(signature, instruction_index) DO UPDATE SET
|
||||
base_amount = excluded.base_amount,
|
||||
quote_amount = excluded.quote_amount,
|
||||
lp_amount = excluded.lp_amount,
|
||||
amounts_are_complete = excluded.amounts_are_complete,
|
||||
payload_json = excluded.payload_json,
|
||||
executed_at = excluded.executed_at
|
||||
"#,
|
||||
)
|
||||
.bind(dto.transaction_id)
|
||||
.bind(dto.decoded_event_id)
|
||||
.bind(dto.dex_id)
|
||||
.bind(dto.pool_id)
|
||||
.bind(dto.pair_id)
|
||||
.bind(dto.signature.clone())
|
||||
.bind(dto.instruction_index)
|
||||
.bind(slot_i64)
|
||||
.bind(dto.program_id.clone())
|
||||
.bind(dto.event_kind.to_i16())
|
||||
.bind(dto.event_kind_text.clone())
|
||||
.bind(dto.actor_wallet.clone())
|
||||
.bind(dto.base_token_id)
|
||||
.bind(dto.quote_token_id)
|
||||
@@ -74,7 +91,10 @@ ON CONFLICT(signature, instruction_index) DO UPDATE SET
|
||||
.bind(dto.base_amount.clone())
|
||||
.bind(dto.quote_amount.clone())
|
||||
.bind(dto.lp_amount.clone())
|
||||
.bind(if dto.amounts_are_complete { 1_i64 } else { 0_i64 })
|
||||
.bind(dto.payload_json.clone())
|
||||
.bind(dto.executed_at.to_rfc3339())
|
||||
.bind(dto.created_at.to_rfc3339())
|
||||
.execute(pool)
|
||||
.await;
|
||||
if let Err(error) = query_result {
|
||||
@@ -122,13 +142,17 @@ pub async fn query_liquidity_events_list_recent(
|
||||
r#"
|
||||
SELECT
|
||||
id,
|
||||
transaction_id,
|
||||
decoded_event_id,
|
||||
dex_id,
|
||||
pool_id,
|
||||
pair_id,
|
||||
signature,
|
||||
instruction_index,
|
||||
slot,
|
||||
program_id,
|
||||
event_kind,
|
||||
event_kind_text,
|
||||
actor_wallet,
|
||||
base_token_id,
|
||||
quote_token_id,
|
||||
@@ -136,7 +160,10 @@ SELECT
|
||||
base_amount,
|
||||
quote_amount,
|
||||
lp_amount,
|
||||
executed_at
|
||||
amounts_are_complete,
|
||||
payload_json,
|
||||
executed_at,
|
||||
created_at
|
||||
FROM k_sol_liquidity_events
|
||||
ORDER BY id DESC
|
||||
LIMIT ?
|
||||
|
||||
Reference in New Issue
Block a user