Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Near: v1.signer users #7597

Merged
merged 14 commits into from
Feb 17, 2025
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{
config(
schema = 'near_v1_signer',
alias = 'users',
materialized = 'table',
post_hook = '{{ expose_spells(\'["near"]\',
"project",
"v1_signer",
\'["bh2smith"]\') }}'
)
}}

-- PoC Query: https://dune.com/queries/4642523
SELECT
receipt_predecessor_account_id as account_id,
json_extract_scalar(action_function_call_args_parsed, '$.request.path') AS derivation_path,
CAST(json_extract_scalar(action_function_call_args_parsed, '$.request.key_version') AS INTEGER) AS key_version
FROM {{ source('near', 'actions') }} action
JOIN {{ source('near', 'logs') }} log
ON action.block_height = log.block_height
AND action.receipt_id = log.receipt_id
WHERE
receipt_receiver_account_id = 'v1.signer'
-- Deployment block of v1.signer: https://nearblocks.io/txns/79BBi3H3XgzktscGqKDZHAiNGRseuAJuYCmHkxKFLNif
AND action.block_height >= 124788114
AND log.block_height >= 124788114
AND action_kind = 'FUNCTION_CALL'
AND action_function_call_call_method_name = 'sign'
-- $ echo "eyJyZXF1ZXN0Ijp" | base64 --decode ==> {"request":{
AND SUBSTRING(
action_function_call_call_args_base64,
1,
LENGTH('eyJyZXF1ZXN0Ijp')
) = 'eyJyZXF1ZXN0Ijp'
AND index_in_execution_outcome_logs = 1
GROUP BY 1,2,3
28 changes: 28 additions & 0 deletions dbt_subprojects/daily_spellbook/models/near/v1_signer/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2

models:
- name: near_v1_signer_users
meta:
blockchain: near
sector: authentication
project: v1_signer
contributors: bh2smith
config:
tags:
["near", "v1_signer", "mpc", "chain_sigs"]
description: >
This table contains user signing activity on the NEAR blockchain for the `v1.signer` (MPC) contract.
It extracts sign requests and associated metadata from function call arguments and logs.
columns:
- name: account_id
description: "Account ID that requested the signature"
tests:
- not_null
- name: derivation_path
description: "Derivation path for the key used in the signing request"
tests:
- not_null
- name: key_version
description: "Version number of the signing key"
tests:
- not_null
Loading
Oops, something went wrong.