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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{
config(
schema = 'near_v1_signer',
alias = 'users',
materialized = 'view',
post_hook = '{{ expose_spells(\'["near"]\',
"project",
"v1_signer",
\'["bh2smith"]\') }}'
)
}}

-- PoC Query: https://dune.com/queries/4642523
SELECT
receipt_predecessor_account_id as sign_for,
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 >= {{BlockHeight}}
AND log.block_height >= {{BlockHeight}}
bh2smith marked this conversation as resolved.
Show resolved Hide resolved
AND action_kind = 'FUNCTION_CALL'
AND action_function_call_call_method_name = 'sign'
-- $ echo "eyJyZXF1ZXN0Ijp" | base64 --decode is guaranteed slice of input call data.
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: v1_signer_users
bh2smith marked this conversation as resolved.
Show resolved Hide resolved
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: sign_for
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
7 changes: 7 additions & 0 deletions sources/near/v1_signer.yml
bh2smith marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

sources:
- name: near_v1_signer
description: Tables Related to Chain Signatures Contract - https://docs.near.org/concepts/abstraction/chain-signatures
tables:
- name: users
Loading