An 5768/nft sales legacy index (#804)

* wip inner index

* add index to legacy views
This commit is contained in:
tarikceric 2025-02-17 11:11:53 -08:00 committed by GitHub
parent 82fc03d9a3
commit c90fbbd3fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 68 additions and 3 deletions

View File

@ -52,8 +52,7 @@ base_transfers AS (
FROM
{{ ref('silver__transfers') }}
WHERE
mint = 'So11111111111111111111111111111111111111112'
mint in ('So11111111111111111111111111111111111111112','So11111111111111111111111111111111111111111')
{% if is_incremental() %}
AND _inserted_timestamp >= (
SELECT
@ -203,6 +202,8 @@ SELECT
A.block_id,
A.tx_id,
A.succeeded,
a.index,
null as inner_index,
A.program_id,
A.mint,
A.purchaser,
@ -228,6 +229,8 @@ SELECT
A.block_id,
A.tx_id,
A.succeeded,
a.index,
null as inner_index,
A.program_id,
A.mint,
A.purchaser,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
mint,
purchaser,

View File

@ -16,6 +16,7 @@ WITH sales_inner_instructions AS (
succeeded,
program_id,
e.index,
null as inner_index,
COALESCE(
i.value :parsed :info :lamports :: NUMBER,
0
@ -83,6 +84,8 @@ pre_final AS (
s.block_id,
s.tx_id,
s.succeeded,
s.index,
s.inner_index,
s.program_id,
COALESCE(
p.mint,
@ -107,6 +110,8 @@ pre_final AS (
s.block_id,
s.tx_id,
s.succeeded,
s.index,
s.inner_index,
s.program_id,
COALESCE(
p.mint,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -206,6 +206,8 @@ SELECT
block_id,
b.tx_id,
succeeded,
b.instructions_index as index,
null as inner_index,
'hadeK9DLv9eA7ya5KCTqSvSvRZeJC3JgD5a9Y3CNbvu' AS program_id,
mint,
purchaser,
@ -229,6 +231,8 @@ SELECT
block_id,
A.tx_id,
succeeded,
a.instructions_index as index,
null as inner_index,
'hadeK9DLv9eA7ya5KCTqSvSvRZeJC3JgD5a9Y3CNbvu' AS program_id,
mint,
purchaser,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
mint,
purchaser,

View File

@ -15,6 +15,7 @@ WITH base_table AS (
block_id,
tx_id,
succeeded,
index,
program_id,
instruction :accounts [0] :: STRING AS purchaser,
instruction :accounts [2] :: STRING AS seller,
@ -63,6 +64,8 @@ SELECT
b.block_id,
b.tx_id,
b.succeeded,
b.index,
null as inner_index,
b.program_id,
b.purchaser,
b.seller,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -172,6 +172,8 @@ SELECT
s.block_timestamp,
s.block_id,
s.tx_id,
s.index,
null as inner_index,
s.succeeded,
s.program_id,
COALESCE(
@ -203,6 +205,7 @@ GROUP BY
s.block_id,
s.tx_id,
s.succeeded,
s.index,
s.program_id,
COALESCE(
p.mint,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -178,6 +178,8 @@ SELECT
b.block_id,
b.tx_id,
b.succeeded,
b.event_index as index,
null as inner_index,
b.program_id,
COALESCE(
b.nft_account_mint,
@ -211,6 +213,7 @@ GROUP BY
b.block_id,
b.tx_id,
b.succeeded,
b.event_index,
b.program_id,
COALESCE(
b.nft_account_mint,

View File

@ -10,6 +10,8 @@ WITH base AS (
COALESCE(d.block_id, v.block_id) AS block_id,
COALESCE(d.tx_id, v.tx_id) AS tx_id,
COALESCE(d.succeeded, v.succeeded) AS succeeded,
COALESCE(d.index, v.index) AS index,
COALESCE(d.inner_index, v.inner_index) AS inner_index,
COALESCE(d.program_id, v.program_id) AS program_id,
COALESCE(d.mint, v.mint) AS mint,
COALESCE(d.purchaser, v.purchaser) AS purchaser,

View File

@ -74,6 +74,8 @@ pre_final AS (
s.block_id,
s.tx_id,
s.succeeded,
s.index,
null as inner_index,
s.program_id,
p.mint,
s.purchaser,
@ -96,6 +98,7 @@ pre_final AS (
s.tx_id,
s.succeeded,
s.program_id,
s.index,
p.mint,
s.purchaser,
s.seller,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -12,6 +12,8 @@ WITH base_table AS (
block_timestamp,
block_id,
tx_id,
index,
null as inner_index,
succeeded,
program_id,
instruction :accounts[0] :: STRING AS acct_1,
@ -65,6 +67,8 @@ SELECT
b.block_id,
b.tx_id,
b.succeeded,
b.index,
b.inner_index,
b.program_id,
b.mint,
b.acct_1 AS purchaser,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
mint,
purchaser,

View File

@ -69,6 +69,8 @@ SELECT
s.block_id,
s.tx_id,
s.succeeded,
s.index,
null as inner_index,
s.program_id,
p.mint AS mint,
s.purchaser,
@ -91,6 +93,7 @@ GROUP BY
s.tx_id,
s.succeeded,
s.program_id,
s.index,
p.mint,
s.purchaser,
s.seller,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -119,6 +119,8 @@ pre_final AS (
A.program_id,
A.tx_id,
b.succeeded,
A.index,
A.inner_index,
A.buyer AS purchaser,
A.seller,
A.mint,
@ -142,6 +144,8 @@ pre_final AS (
A.program_id,
A.tx_id,
b.succeeded,
A.index,
A.inner_index,
A.buyer AS purchaser,
A.seller,
A.mint,
@ -173,12 +177,16 @@ pre_final AS (
6,
7,
8,
9
9,
10,
11
)
SELECT
block_timestamp,
block_id,
tx_id,
index,
inner_index,
succeeded,
program_id,
purchaser,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,

View File

@ -13,6 +13,8 @@ WITH base_table AS (
e.block_timestamp,
e.block_id,
e.tx_id,
e.index,
null as inner_index,
t.succeeded,
e.program_id,
CASE
@ -124,6 +126,8 @@ SELECT
b.block_id,
b.tx_id,
b.succeeded,
b.index,
b.inner_index,
b.program_id,
b.mint,
b.purchaser,

View File

@ -7,6 +7,8 @@ SELECT
block_id,
tx_id,
succeeded,
index,
inner_index,
program_id,
purchaser,
seller,