STREAM-382/marketplace-tests (#33)

This commit is contained in:
Julius Remigio 2023-08-08 11:51:42 -07:00 committed by GitHub
parent 1a00e9fe86
commit f15f5fc175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 1461 additions and 395 deletions

71
.github/workflows/dbt_test.yml vendored Normal file
View File

@ -0,0 +1,71 @@
name: dbt_tests
run-name: ${{ inputs.dbt_command }}
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: DBT Run Environment
required: true
options:
- dev
- prod
default: dev
warehouse:
type: choice
description: Snowflake warehouse
required: true
options:
- DBT
- DBT_CLOUD
- DBT_EMERGENCY
default: DBT
dbt_command:
type: string
description: 'DBT Run Command'
required: true
env:
DBT_PROFILES_DIR: ./
ACCOUNT: "${{ vars.ACCOUNT }}"
ROLE: "${{ vars.ROLE }}"
USER: "${{ vars.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ vars.REGION }}"
DATABASE: "${{ vars.DATABASE }}"
WAREHOUSE: "${{ inputs.warehouse }}"
SCHEMA: "${{ vars.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
run_tests:
runs-on: ubuntu-latest
environment:
name: workflow_${{ inputs.environment }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
dbt deps
- name: Run DBT Jobs
run: |
dbt --debug test ${{ inputs.dbt_command }}
- name: Store logs
uses: actions/upload-artifact@v3
with:
name: dbt-logs
path: logs

View File

@ -0,0 +1,45 @@
{% set schema = "strangelove" %}
{% set config = fromyaml(config_strangelove_udfs(schema_name = schema, utils_schema_name = "quicknode_utils")) %}
{% set raw_test_queries %}
strangelove.get:
- |
'https://api.strange.love/cosmoshub/mainnet/rpc/block_by_hash'
- |
{
'blockHash': '0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED'
}
strangelove.post:
- |
'https://endpoint'
- |
{
'foo': 'bar'
}
{% endset %}
{% set test_queries = fromyaml(raw_test_queries) %}
{{ test_queries }}
{{ schema }}
_____
columns:
{%- for item in config %}
- name: {{ item["name"] | replace(schema~".", "") }}
tests:
- test_marketplace_udf:
name: test_{{ item["name"].replace(".", "__") ~ "_status_200" }}
args: >
{{ test_queries[item["name"]] | join(", ") | indent(16) }}
validations:
- result:status_code = 200
{%- endfor %}
=====================
{{ config | pprint}}
{# {% for item in config %}
{% if item["return_type"][0] != "VARIANT"%}
{{ item["return_type"][0] }}
{% endif %}
{% endfor %} #}

View File

@ -1,7 +1,21 @@
version: "0.2"
language: en
words:
- aave
- bitquery
- blockpour
- chainbase
- credmark
- dapplooker
- doseq
- fromyaml
- GETVARIABLE
- helius
- keccak
- livequery
- quicknode
- reingest
- solana
- strangelove
- subquery
- udfs

View File

@ -58,7 +58,8 @@ vars:
UPDATE_SNOWFLAKE_TAGS: true
STREAMLINE_INVOKE_STREAMS: False
STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False
REST_API_ID_PROD: hn8uqhku77
REST_API_ID_DEV: hn8uqhku77
REST_API_ID_PROD: ARPK1G9P37
REST_API_ID_DEV: QG6A9ZS6R7
API_INTEGRATION: AWS_LIVE_QUERY{{ '_DEV' if target.name != 'prod' else '' }}
AWS_REGION: us-east-1
STUDIO_TEST_USER_ID: 98d15c30-9fa5-43cd-9c69-3d4c0bb269f5

View File

@ -83,10 +83,13 @@ def get_simplified_signature(abi):
{% macro python_object_to_url_query_string() %}
import urllib.parse
from urllib.parse import urlencode
def object_to_url_query_string(variant_object):
return f'{urllib.parse.urlencode(variant_object)}'
def object_to_url_query_string(query, doseq=False):
{# return type(query) #}
if isinstance(query, dict):
return urlencode(query, doseq)
return urlencode([tuple(i) for i in query], doseq)
{% endmacro %}

View File

@ -140,18 +140,66 @@
sql: |
{{ sql_udf_json_rpc_call(False) }}
- name: {{ schema }}.udf_object_to_url_query_string
- name: {{ schema }}.udf_urlencode
signature:
- [object, OBJECT]
- [query, OBJECT]
- [doseq, BOOLEAN]
return_type: TEXT
options: |
NULL
LANGUAGE PYTHON
IMMUTABLE
RUNTIME_VERSION = '3.8'
COMMENT=$$Pthon (function)[https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode] to convert an object to a URL query string.$$
HANDLER = 'object_to_url_query_string'
sql: |
{{ python_object_to_url_query_string() | indent(4) }}
- name: {{ schema }}.udf_urlencode
signature:
- [query, ARRAY]
- [doseq, BOOLEAN]
return_type: TEXT
options: |
NULL
LANGUAGE PYTHON
IMMUTABLE
RUNTIME_VERSION = '3.8'
COMMENT=$$Pthon (function)[https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode] to convert an array to a URL query string.$$
HANDLER = 'object_to_url_query_string'
sql: |
{{ python_object_to_url_query_string() | indent(4) }}
- name: {{ schema }}.udf_urlencode
signature:
- [query, ARRAY]
return_type: TEXT
options: |
NULL
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
IMMUTABLE
sql: |
SELECT {{ schema }}.udf_urlencode(query, FALSE)
- name: {{ schema }}.udf_urlencode
signature:
- [query, OBJECT]
return_type: TEXT
options: |
NULL
LANGUAGE SQL
RETURNS NULL ON NULL INPUT
IMMUTABLE
sql: |
SELECT {{ schema }}.udf_urlencode(query, FALSE)
- name: {{ schema }}.udf_object_to_url_query_string
signature:
- [object, OBJECT]
return_type: TEXT
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
IMMUTABLE
sql: SELECT utils.udf_urlencode(object, FALSE)
- name: {{ schema }}.udf_evm_transform_log
signature:
- [decoded, VARIANT]

View File

@ -156,7 +156,11 @@
{% set sql %}
{{- crud_udfs(config, this.schema, var("DROP_UDFS_AND_SPS")) -}}
{%- endset -%}
{%- do log("Deploy core udfs: " ~ this.database ~ "." ~ this.schema, true) -%}
{%- if var("DROP_UDFS_AND_SPS") -%}
{%- do log("Drop core udfs: " ~ this.database ~ "." ~ this.schema, true) -%}
{%- else -%}
{%- do log("Deploy core udfs: " ~ this.database ~ "." ~ this.schema, true) -%}
{%- endif -%}
{%- do run_query(sql ~ apply_grants_by_schema(this.schema)) -%}
{% else -%}
SELECT '{{ model.schema }}' as schema_
@ -177,7 +181,11 @@
{{- crud_udfs_by_chain(config, blockchain, network, var("DROP_UDFS_AND_SPS")) -}}
{%- endfor -%}
{%- endset -%}
{%- do log("Deploy partner udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- if var("DROP_UDFS_AND_SPS") -%}
{%- do log("Drop partner udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- else -%}
{%- do log("Deploy partner udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- endif -%}
{%- do run_query(sql ~ apply_grants_by_schema(schema)) -%}
{% else -%}
SELECT '{{ model.schema }}' as schema_
@ -197,7 +205,11 @@
{{- crud_udfs_by_marketplace(config, schema, utility_schema, var("DROP_UDFS_AND_SPS")) -}}
{%- endfor -%}
{%- endset -%}
{%- do log("Deploy marketplace udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- if var("DROP_UDFS_AND_SPS") -%}
{%- do log("Drop marketplace udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- else -%}
{%- do log("Deploy marketplace udfs: " ~ this.database ~ "." ~ schema, true) -%}
{%- endif -%}
{%- do run_query(sql ~ apply_grants_by_schema(schema)) -%}
{% else -%}
SELECT '{{ model.schema }}' as schema_

View File

@ -1,4 +1,4 @@
{% macro config_alchemy_utils_udfs(schema = "alchemy_utils", utils_schema_name="alchemy_utils") -%}
{% macro config_alchemy_utils_udfs(schema_name = "alchemy_utils", utils_schema_name="alchemy_utils") -%}
{#
This macro is used to generate the alchemy base endpoints
#}

View File

@ -1,15 +0,0 @@
{% macro config_footprint_address_udfs(schema_name = "footprint_address", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the footprint address endpoints
#}
- name: {{ schema_name -}}.get_tx_stats_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the transactions statistics by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-transactions-statistics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/transactions/statistics") | trim}}
{% endmacro %}

View File

@ -1,51 +0,0 @@
{% macro config_footprint_balances_udfs(schema_name = "footprint_balances", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the footprint balance endpoints
#}
- name: {{ schema_name -}}.get_native_balance_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the native balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-native-balance).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/native/balance") | trim}}
- name: {{ schema_name -}}.get_all_nfts_owned_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns all NFTs owned by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_nft-wallet-balance).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/wallet/balance") | trim}}
- name: {{ schema_name -}}.get_all_erc20_balance_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns all ERC20 balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-erc20-balance).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/erc20/balance") | trim}}
- name: {{ schema_name -}}.get_nft_owned_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the specified NFT owned by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_nft-balance).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/balance") | trim}}
- name: {{ schema_name -}}.get_erc20_balance_by_address
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the specified ERC20 balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_token-balance).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/token/balance") | trim}}
{% endmacro %}

View File

@ -1,24 +0,0 @@
{% macro config_footprint_chains_udfs(schema_name = "footprint_chains", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the Footprint token endpoints
#}
- name: {{ schema_name -}}.get_chain_transactions
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the transactions of the chain. [Footprint docs here](https://docs.footprint.network/reference/get_chain-transactions).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/chain/transactions") | trim}}
- name: {{ schema_name -}}.get_chains
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of all chains. [Footprint docs here](https://docs.footprint.network/reference/get_chain-info).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/chain/info") | trim}}
{% endmacro %}

View File

@ -1,25 +0,0 @@
{% macro config_footprint_charts_udfs(schema_name = "footprint_charts", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the Footprint Chart endpoints
#}
- name: {{ schema_name -}}.get_chart_results
signature:
- [CHART_ID, VARCHAR, The chart ID]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns your Footprint chart data by a chart ID. [Footprint docs here](https://docs.footprint.network/reference/post_dataapi-card-chart-id-query).$$
sql: |
SELECT
live.udf_api(
'POST',
concat(
'https://footprint.network/api/v1/dataApi/card/', CHART_ID, '/query'
),
{'api-key': '{API_KEY}'},
{},
'_FSC_SYS/FOOTPRINT'
) as response
{% endmacro %}

View File

@ -1,69 +0,0 @@
{% macro config_footprint_gamefi_udfs(schema_name = "footprint_gamefi", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the Footprint Gamefi endpoints
#}
- name: {{ schema_name -}}.get_protocols
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info") | trim}}
- name: {{ schema_name -}}.get_protocols_by_contract
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of the protocol by contract address. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info-by-contract).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info/by-contract") | trim}}
- name: {{ schema_name -}}.get_protocols_by_name
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of the protocol by name. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info-by-name).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info/by-name") | trim}}
- name: {{ schema_name -}}.get_protocol_active_users
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the active users of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-active-user).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/active-user") | trim}}
- name: {{ schema_name -}}.get_protocol_active_user_stats
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the active user statistics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-active-user-statistics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/active-user/statistics") | trim}}
- name: {{ schema_name -}}.get_protocol_new_user_stats
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the new user statistics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-new-user-statistics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/new-user/statistics") | trim}}
- name: {{ schema_name -}}.get_protocol_stats
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the statistics metrics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-statistics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/statistics") | trim}}
{% endmacro %}

View File

@ -1,123 +0,0 @@
{% macro config_footprint_nfts_udfs(schema_name = "footprint_nfts", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the Footprint nft endpoints
#}
- name: {{ schema_name -}}.get_nft_txs_by_collection
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the sales record of the NFT collection in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transactions).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transactions") | trim}}
- name: {{ schema_name -}}.get_nft_transfers_by_collection
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the transfers record of the NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transfers).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transfers") | trim}}
- name: {{ schema_name -}}.get_nft_listings
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the sales listing of the NFT in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-order-listings).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/order/listings") | trim}}
- name: {{ schema_name -}}.check_nft_wash_trade
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns whether the transaction hash is wash trading. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transactions-is-washtrade).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transactions/is-washtrade") | trim}}
- name: {{ schema_name -}}.get_nft_collection_stats
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the statistics metrics data of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-metrics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/metrics") | trim}}
- name: {{ schema_name -}}.get_nft_collection_floor_price_history
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the floor price history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-floor-price-history).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/floor-price/history") | trim}}
- name: {{ schema_name -}}.get_nft_collection_market_cap_history
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the market cap history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-market-cap-history).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/market-cap/history") | trim}}
- name: {{ schema_name -}}.get_nft_collection_volume_history
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the volume history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-volume-history).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/volume/history") | trim}}
- name: {{ schema_name -}}.get_nft_marketplace_stats
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the statistics metrics data of single NFT collection in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-marketplace-statistics).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/marketplace/statistics") | trim}}
- name: {{ schema_name -}}.get_nft_collections
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of the NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-info).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/info") | trim}}
- name: {{ schema_name -}}.get_nft_tokens_by_collection
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the basic information of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-info).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/info") | trim}}
- name: {{ schema_name -}}.get_nft_attributes
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the attributes of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-attributes).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/attributes") | trim}}
- name: {{ schema_name -}}.get_nft_owners_by_collection
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the owners of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-owners).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/owners") | trim}}
{% endmacro %}

View File

@ -1,15 +0,0 @@
{% macro config_footprint_tokens_udfs(schema_name = "footprint_tokens", utils_schema_name = "footprint_utils") -%}
{#
This macro is used to generate the Footprint token endpoints
#}
- name: {{ schema_name -}}.get_token_transfers
signature:
- [QUERY_PARAMS, OBJECT, The query parameters]
return_type:
- "VARIANT"
options: |
COMMENT = $$Returns the transfers record of the token. [Footprint docs here](https://docs.footprint.network/reference/get_token-transfers).$$
sql: {{footprint_get_api_call(utils_schema_name, "/v2/token/transfers") | trim}}
{% endmacro %}

View File

@ -1,9 +1,29 @@
{% macro config_footprint_utils_udfs(schema = "footprint_utils", utils_schema_name="footprint_utils") -%}
{% macro config_footprint_utils_udfs(schema_name = "footprint_utils", utils_schema_name="footprint_utils") -%}
{#
This macro is used to generate the Footprint base endpoints
#}
- name: {{ schema -}}.get
- name: {{ schema_name -}}.get
signature:
- [PATH, STRING, The path starting with '/']
- [QUERY_ARGS, ARRAY, The query arguments]
return_type:
- "VARIANT"
options: |
COMMENT = $$Used to issue a 'GET' request to the Footprint API.$$
sql: |
SELECT
live.udf_api(
'GET',
concat(
'https://api.footprint.network/api', PATH, '?',
utils.udf_urlencode(QUERY_ARGS, TRUE)
),
{'api-key': '{API_KEY}'},
{},
'_FSC_SYS/FOOTPRINT'
) as response
- name: {{ schema_name -}}.get
signature:
- [PATH, STRING, The path starting with '/']
- [QUERY_ARGS, OBJECT, The query arguments]
@ -17,14 +37,14 @@
'GET',
concat(
'https://api.footprint.network/api', PATH, '?',
utils.udf_object_to_url_query_string(QUERY_ARGS)
utils.udf_urlencode(QUERY_ARGS, TRUE)
),
{'api-key': '{API_KEY}'},
{},
'_FSC_SYS/FOOTPRINT'
) as response
- name: {{ schema -}}.post
- name: {{ schema_name -}}.post
signature:
- [PATH, STRING, The path starting with '/']
- [BODY, OBJECT, The request body]
@ -43,7 +63,7 @@
) as response
- name: {{ schema -}}.rpc
- name: {{ schema_name -}}.rpc
signature:
- [METHOD, STRING, The RPC method to call]
- [PARAMS, ARRAY, The RPC Params arguments]

View File

@ -1,4 +1,4 @@
{% macro config_helius_util_udfs(schema = "helius_utils", utils_schema_name="helius_utils") -%}
{% macro config_helius_utils_udfs(schema = "helius_utils", utils_schema_name="helius_utils") -%}
{#
This macro is used to generate the Helius base endpoints
#}

View File

@ -1,4 +1,4 @@
{% macro config_quicknode_ethereum_nft_udfs(schema_name = "quicknode_ethereum_nfts", utils_schema_name = "quicknode_utils") -%}
{% macro config_quicknode_ethereum_nfts_udfs(schema_name = "quicknode_ethereum_nfts", utils_schema_name = "quicknode_utils") -%}
{#
This macro is used to generate the QuickNode Ethereum NFT endpoints
#}

View File

@ -1,4 +1,4 @@
{% macro config_quicknode_ethereum_token_udfs(schema_name = "quicknode_ethereum_tokens", utils_schema_name = "quicknode_utils") -%}
{% macro config_quicknode_ethereum_tokens_udfs(schema_name = "quicknode_ethereum_tokens", utils_schema_name = "quicknode_utils") -%}
{#
This macro is used to generate the QuickNode Ethereum Token endpoints
#}

View File

@ -1,4 +1,4 @@
{% macro config_quicknode_polygon_nft_udfs(schema_name = "quicknode_polygon_nfts", utils_schema_name = "quicknode_utils") -%}
{% macro config_quicknode_polygon_nfts_udfs(schema_name = "quicknode_polygon_nfts", utils_schema_name = "quicknode_utils") -%}
{#
This macro is used to generate the QuickNode Polygon NFT endpoints
#}

View File

@ -1,4 +1,4 @@
{% macro config_quicknode_polygon_token_udfs(schema_name = "quicknode_polygon_tokens", utils_schema_name = "quicknode_utils") -%}
{% macro config_quicknode_polygon_tokens_udfs(schema_name = "quicknode_polygon_tokens", utils_schema_name = "quicknode_utils") -%}
{#
This macro is used to generate the QuickNode Polygon Token endpoints
#}

View File

@ -1,4 +1,4 @@
{% macro config_quicknode_solana_nft_udfs(schema_name = "quicknode_solana_nfts", utils_schema_name = "quicknode_utils") -%}
{% macro config_quicknode_solana_nfts_udfs(schema_name = "quicknode_solana_nfts", utils_schema_name = "quicknode_utils") -%}
{#
This macro is used to generate the QuickNode Solana NFT endpoints
#}

View File

@ -1,9 +1,9 @@
{% macro config_quicknode_util_udfs(schema = "quicknode_utils", utils_schema_name="quicknode_utils") -%}
{% macro config_quicknode_utils_udfs(schema_name = "quicknode_utils", utils_schema_name="quicknode_utils") -%}
{#
This macro is used to generate the QuickNode base endpoints/RPC calls
#}
- name: {{ schema -}}.ethereum_mainnet_rpc
- name: {{ schema_name -}}.ethereum_mainnet_rpc
signature:
- [METHOD, STRING, The RPC method to call]
- [PARAMS, OBJECT, The RPC Params arguments]
@ -20,7 +20,7 @@
'_FSC_SYS/QUICKNODE'
) as response
- name: {{ schema -}}.polygon_mainnet_rpc
- name: {{ schema_name -}}.polygon_mainnet_rpc
signature:
- [METHOD, STRING, The RPC method to call]
- [PARAMS, OBJECT, The RPC Params arguments]
@ -37,7 +37,7 @@
'_FSC_SYS/QUICKNODE'
) as response
- name: {{ schema -}}.solana_mainnet_rpc
- name: {{ schema_name -}}.solana_mainnet_rpc
signature:
- [METHOD, STRING, The RPC method to call]
- [PARAMS, OBJECT, The RPC Params arguments]

35
macros/tests/udfs.sql Normal file
View File

@ -0,0 +1,35 @@
{% macro base_test_udf(model, udf, args, assertions) %}
{#
Generates a test for a UDF.
#}
{% if execute %}
{%- set context -%}
SET LIVEQUERY_CONTEXT = '{"userId":"{{ var("STUDIO_TEST_USER_ID") }}"}';
{%- endset -%}
{%- do run_query(context) -%}
{%- endif -%}
{%- set call -%}
{{ target.database }}.{{ udf }}({{ args }})
{%- endset -%}
,
test AS
(
SELECT
'{{ udf }}' AS test_name
,[{{ args }}] as parameters
,{{ call }} AS result
)
{% for assertion in assertions %}
SELECT
test_name,
parameters,
result,
$${{ assertion }}$$ AS assertion,
$${{ context ~ "\n" }}SELECT {{ call ~ "\n" }};$$ AS sql
FROM test
WHERE NOT {{ assertion }}
{%- if not loop.last -%}
UNION ALL
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}

View File

@ -5,4 +5,5 @@ models:
tests:
- test_udf:
args: "'hello'"
expected: "'hello'"
assertions:
- result = 'hello'

View File

@ -1,3 +1,4 @@
version: 2
models:
- name: utils
columns:
@ -5,10 +6,194 @@ models:
tests:
- test_udf:
args: "'foo', [], 1"
expected: >
{
'jsonrpc': '2.0',
'method': 'foo',
'params': [],
'id': '1'
}
assertions:
- >
result = {
'jsonrpc': '2.0',
'method': 'foo',
'params': [],
'id': '1'
}
- name: udf_urlencode
tests:
- test_udf:
name: test_utils__udf_urlencode_dict_true_1
args: >
{'a':'b'}, TRUE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_true_2
args: >
{'a':'a', 'b':'b'}, TRUE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_true_space
args: >
{'space': 'abc 123'}, TRUE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_true_special
args: >
{'special!': ' !@#$,+"'}, TRUE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_true_array
args: >
{'array': [0, 1, 2]}, TRUE
assertions:
- result = 'array=0&array=1&array=2'
- test_udf:
name: test_utils__udf_urlencode_dict_false_1
args: >
{'a':'b'}, FALSE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_false_2
args: >
{'a':'b', 'b':'b'}, FALSE
assertions:
- result = 'a=b&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_false_space
args: >
{'space': 'abc 123'}, FALSE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_false_special
args: >
{'special!': ' !@#$,+"'}, FALSE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_false_array
args: >
{'array': [0, 1, 2]}, FALSE
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
- test_udf:
name: test_utils__udf_urlencode_dict_1
args: >
{'a':'b'}
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_2
args: >
{'a':'b', 'b':'b'}
assertions:
- result = 'a=b&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_space
args: >
{'space': 'abc 123'}
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_special
args: >
{'special!': ' !@#$,+"'}
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_array
args: >
{'array': [0, 1, 2]}
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
# write tests but use arrays of arrays instead of dictionaries
- test_udf:
name: test_utils__udf_urlencode_array_true_1
args: >
[['a', 'b']], TRUE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_true_2
args: >
[['a', 'a'], ['b', 'b']], TRUE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_true_space
args: >
[['space', 'abc 123']], TRUE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_true_special
args: >
[['special!', ' !@#$,+"']], TRUE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_true_array
args: >
[['array', [0, 1, 2]]], TRUE
assertions:
- result = 'array=0&array=1&array=2'
- test_udf:
name: test_utils__udf_urlencode_array_false_1
args: >
[['a', 'b']], FALSE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_false_2
args: >
[['a', 'a'], ['b', 'b']], FALSE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_false_space
args: >
[['space', 'abc 123']], FALSE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_false_special
args: >
[['special!', ' !@#$,+"']], FALSE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_false_array
args: >
[['array', [0, 1, 2]]], FALSE
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
- test_udf:
name: test_utils__udf_urlencode_array_1
args: >
[['a', 'b']]
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_2
args: >
[['a', 'a'], ['b', 'b']]
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_space
args: >
[['space', 'abc 123']]
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_special
args: >
[['special!', ' !@#$,+"']]
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_array
args: >
[['array', [0, 1, 2]]]
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'

View File

@ -0,0 +1,194 @@
version: 2
models:
- name: alchemy_nfts__alchemy_utils
columns:
- name: get_nfts
tests:
- test_udf:
name: test_alchemy_nfts__get_nfts_status_200
args: >
'eth-mainnet', {'owner': '0x4a9318F375937B56045E5a548e7E66AEA61Dd610'}
assertions:
- result:status_code = 200
- name: get_owners_for_token
tests:
- test_udf:
name: test_alchemy_nfts__get_owners_for_token_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 44}
assertions:
- result:status_code = 200
- name: get_owners_for_collection
tests:
- test_udf:
name: test_alchemy_nfts__get_owners_for_collection_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'withTokenBalances': True}
assertions:
- result:status_code = 200
- name: is_holder_of_collection
tests:
- test_udf:
name: test_alchemy_nfts__is_holder_of_collection_status_200
args: >
'eth-mainnet', {'wallet': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330'}
assertions:
- result:status_code = 200
- name: get_contracts_for_owner
tests:
- test_udf:
name: test_alchemy_nfts__get_contracts_for_owner_status_200
args: >
'eth-mainnet', {'owner': 'vitalik.eth', 'pageSize': 100, 'page': 1}
assertions:
- result:status_code = 200
- name: get_nft_metadata
tests:
- test_udf:
name: test_alchemy_nfts__get_nft_metadata_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 44}
assertions:
- result:status_code = 200
- name: get_nft_metadata_batch
tests:
- test_udf:
name: test_alchemy_nfts__get_nft_metadata_batch_status_200
args: >
'eth-mainnet', {'tokens': [{'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 44}, {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 43}]}
assertions:
- result:status_code = 200
- name: get_contract_metadata
tests:
- test_udf:
name: test_alchemy_nfts__get_contract_metadata_status_200
args: >
'ethereum-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330'}
assertions:
- result:status_code = 200
- name: get_contract_metadata_batch
tests:
- test_udf:
name: test_alchemy_nfts__get_contract_metadata_batch_status_200
args: >
'eth-mainnet', {'contractAddresses': ['0xe785E82358879F061BC3dcAC6f0444462D4b5330', '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d']}
assertions:
- result:status_code = 200
- name: invalidate_contract
tests:
- test_udf:
name: test_alchemy_nfts__invalidate_contract_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330'}
assertions:
- result:status_code = 200
- name: reingest_contract
tests:
- test_udf:
name: test_alchemy_nfts__reingest_contract_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330'}
assertions:
- result:status_code = 200
- name: search_contract_metadata
tests:
- test_udf:
name: test_alchemy_nfts__search_contract_metadata_status_200
args: >
'eth-mainnet', {'query': 'bored'}
assertions:
- result:status_code = 200
- name: get_nfts_for_collection
tests:
- test_udf:
name: test_alchemy_nfts__get_nfts_for_collection_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'withMetadata': True}
assertions:
- result:status_code = 200
- name: get_spam_contracts
tests:
- test_udf:
name: test_alchemy_nfts__get_spam_contracts_status_200
args: >
'eth-mainnet', {}
assertions:
- result:status_code = 200
- name: is_spam_contract
tests:
- test_udf:
name: test_alchemy_nfts__is_spam_contract_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330'}
assertions:
- result:status_code = 200
- name: is_airdrop
tests:
- test_udf:
name: test_alchemy_nfts__is_airdrop_status_200
args: >
'eth-mainnet', {'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 44}
assertions:
- result:status_code = 200
- name: report_spam
tests:
- test_udf:
config:
# we don't want to run this test in CI
enabled: false
name: test_alchemy_nfts__report_spam_status_200
args: null
assertions:
- result:status_code = 200
- name: get_floor_price
tests:
- test_udf:
name: test_alchemy_nfts__get_floor_price_status_200
args: >
'eth-mainnet', {'contractAddress': '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'}
assertions:
- result:status_code = 200
- name: get_nft_sales
tests:
- test_udf:
name: test_alchemy_nfts__get_nft_sales_status_200
args: >
'eth-mainnet', {'fromBlock': 0, 'toBlock': 'latest', 'order': 'asc', 'contractAddress': '0xe785E82358879F061BC3dcAC6f0444462D4b5330', 'tokenId': 44}
assertions:
- result:status_code = 200
- name: compute_rarity
tests:
- test_udf:
name: test_alchemy_nfts__compute_rarity_status_200
args: >
'eth-mainnet', {'tokenId': 3603, 'contractAddress': '0xb6a37b5d14d502c3ab0ae6f3a0e058bc9517786e'}
assertions:
- result:status_code = 200
- name: summarize_nft_attributes
tests:
- test_udf:
name: test_alchemy_nfts__summarize_nft_attributes_status_200
args: >
'eth-mainnet', {'contractAddress': '0xb6a37b5d14d502c3ab0ae6f3a0e058bc9517786e'}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,32 @@
version: 2
models:
- name: alchemy_tokens__alchemy_utils
columns:
- name: get_token_allowance
tests:
- test_udf:
name: test_alchemy_tokens__get_token_allowance_status_200
args: >
'eth-mainnet', [{'contract': '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', 'owner': '0xf1a726210550c306a9964b251cbcd3fa5ecb275d', 'spender': '0xdef1c0ded9bec7f1a1670819833240f027b25eff'}]
assertions:
- result:status_code = 200
- name: get_token_balances
tests:
- test_udf:
name: test_alchemy_tokens__get_token_balances_status_200
args: >
'eth-mainnet', ['0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5', 'erc20']
assertions:
- result:status_code = 200
- name: get_token_metadata
tests:
- test_udf:
name: test_alchemy_tokens__get_token_metadata_status_200
args: >
'eth-mainnet', ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48']
assertions:
- result:status_code = 200

View File

@ -0,0 +1,13 @@
version: 2
models:
- name: alchemy_transfers__alchemy_utils
columns:
- name: get_asset_transfers
tests:
- test_udf:
name: test_alchemy_transfers__get_asset_transfers_status_200
args: >
'eth-mainnet', [{'fromBlock': '0x0', 'toBlock': 'latest', 'toAddress': '0x5c43B1eD97e52d009611D89b74fA829FE4ac56b1', 'category': ['external'], 'withMetadata': True, 'excludeZeroValue': True}]
assertions:
- result:status_code = 200

View File

@ -0,0 +1,38 @@
version: 2
models:
- name: bitquery__
columns:
- name: graphql
tests:
- test_udf:
name: test_bitquery__graphql_status_200
args: >
{
'query': '{
ethereum( network: bsc ) {
dexTrades(
options: {limit: 1}
baseCurrency: {is: "0x6679eB24F59dFe111864AEc72B443d1Da666B360"}
quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
) {
buyAmount
buyAmountInUsd: buyAmount(in: USD)
buyCurrency {
symbol
address
}
sellAmount
sellCurrency {
symbol
address
}
tradeAmount(in: USD)
}
}
}',
'variables': '{}'
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,29 @@
version: 2
models:
- name: blockpour_utils__
columns:
- name: get
tests:
- test_udf:
name: test_blockpour_utils__get_status_200
args: >
'/v1/tokens/1/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', {
'blockNumber': 17767007
}
assertions:
- result:status_code = 200
- name: post
tests:
- test_udf:
name: test_blockpour_utils__post_status_200
args: >
'/v1/model/run', {
'slug': 'price.quote',
'version': '1.0',
'chainId': 1,
'blockNumber': 17767016,
'input': {}
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,18 @@
version: 2
models:
- name: chainbase_utils__
columns:
- name: get
tests:
- test_udf:
name: test_chainbase_utils__get_status_200
args: >
'/v1/nft/metadata'
, {
'chain_id': 1,
'contract_address': '0xed5af388653567af2f388e6224dc7c4b3241c544',
'token_id': 1
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,30 @@
version: 2
models:
- name: credmark_utils__
columns:
- name: get
tests:
- test_udf:
name: test_credmark_utils__get_status_200
args: >
'/v1/tokens/1/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
, {
'blockNumber': 17767007
}
assertions:
- result:status_code = 200
- name: post
tests:
- test_udf:
name: test_credmark_utils__post_status_200
args: >
'/v1/model/run'
, {
'slug': 'aave-v2.account-info',
'chainId': 1,
'blockNumber': 17725466,
'input': {'address': '0xf89a3799b90593317E0a1Eb74164fbc1755A297A'}
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,13 @@
version: 2
models:
- name: dapplooker__
columns:
- name: get_chart
tests:
- test_udf:
name: test_dapplooker__get_chart_status_202
args: >
'a68cc6dd-1bc1-40ca-aaf8-b5155785f0b4'
assertions:
- result:status_code between 200 and 299

View File

@ -0,0 +1,18 @@
version: 2
models:
- name: footprint_utils__footprint_utils
columns:
- name: get
tests:
- test_udf:
name: test_footprint_utils__get_status_200_v2_protocol_info
args: >
'/v2/protocol/info'
, {
'chain': 'Ethereum',
'protocol_slug': 'the-sandbox',
'limit': 10,
'offset': 0
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,15 @@
version: 2
models:
- name: fred__
columns:
- name: get_series
tests:
- test_udf:
name: test_fred__get_series_status_200
args: >
{
'series_id': 'CORESTICKM679SFRBATL',
'file_type': 'json'
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,43 @@
version: 2
models:
- name: helius_apis__helius_utils
columns:
- name: token_metadata
tests:
- test_udf:
name: test_helius_apis__token_metadata_status_200
args: >
'mainnet'
, {
'mintAccounts': [
'BAAzgRGWY2v5AJBNZNFd2abiRXAUo56UxywKEjoCZW2',
'8s6kQUZfdm7GSaThAcsmSs56wMinXrbk6SdNVngutrz5'
],
'includeOffChain': true
}
assertions:
- result:status_code = 200
- name: balances
tests:
- test_udf:
name: test_helius_apis__balances_status_200
args: >
'mainnet'
, '231B38ZpsbtrWbsBEjSXfjVj9JT2XyuNXy4f98V5NXxg'
assertions:
- result:status_code = 200
- name: parse_transactions
tests:
- test_udf:
name: test_helius_apis__parse_transactions_status_200
args: >
'mainnet'
, [
'5u5S6yWN5wJkEDr3hKeqF3Y8nWcyWaZDboEnpfUuAw1zcvbvevs58rEfCpN6VkfxaS4N8RCMkBcyhxBFs3eoL4U4',
'2bWLiRSA8GCh7UNEpiZdgsh2BMxZwKawk8ND4Z3iWrqDZE6JQk69n9WoCU9rKDrgWHw6qV25g8UBMJYddRJRHR9v'
]
assertions:
- result:status_code = 200

View File

@ -0,0 +1,114 @@
version: 2
models:
- name: helius_das__helius_utils
columns:
- name: get_asset
tests:
- test_udf:
name: test_helius_das__get_asset_status_200
args: >
'mainnet'
, {
'id': 'F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk'
}
assertions:
- result:status_code = 200
- name: get_signatures_for_asset
tests:
- test_udf:
name: test_helius_das__get_signatures_for_asset_status_200
args: >
'mainnet'
, {
'id': 'FNt6A9Mfnqbwc1tY7uwAguKQ1JcpBrxmhczDgbdJy5AC',
'page': 1, -- Starts at 1
'limit': 1000 -- Limit 1000 per request.
}
assertions:
- result:status_code = 200
- name: search_assets
tests:
- test_udf:
name: test_helius_das__search_assets_status_200
args: >
'mainnet'
, {
'ownerAddress': '2k5AXX4guW9XwRQ1AKCpAuUqgWDpQpwFfpVFh3hnm2Ha',
'compressed': true,
'page': 1, -- Starts at 1
'limit': 1000
}
assertions:
- result:status_code = 200
- name: get_asset_proof
tests:
- test_udf:
name: test_helius_das__get_asset_proof_status_200
args: >
'mainnet'
, {
'id': 'Bu1DEKeawy7txbnCEJE4BU3BKLXaNAKCYcHR4XhndGss'
}
assertions:
- result:status_code = 200
- name: get_assets_by_owner
tests:
- test_udf:
name: test_helius_das__get_assets_by_owner_status_200
args: >
'mainnet'
, {
'ownerAddress': '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY',
'page': 1, -- Starts at 1
'limit': 1000
}
assertions:
- result:status_code = 200
- name: get_assets_by_authority
tests:
- test_udf:
name: test_helius_das__get_assets_by_authority_status_200
args: >
'mainnet'
, {
'authorityAddress': '2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW',
'page': 1, -- Starts at 1
'limit': 1000
}
assertions:
- result:status_code = 200
- name: get_assets_by_creator
tests:
- test_udf:
name: test_helius_das__get_assets_by_creator_status_200
args: >
'mainnet'
, {
'creatorAddress': 'D3XrkNZz6wx6cofot7Zohsf2KSsu2ArngNk8VqU9cTY3',
'onlyVerified': true,
'page': 1, -- Starts at 1
'limit': 1000
}
assertions:
- result:status_code = 200
- name: get_assets_by_group
tests:
- test_udf:
name: test_helius_das__get_assets_by_group_status_200
args: >
'mainnet'
, {
'groupKey': 'collection',
'groupValue': 'J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w',
'page': 1,
'limit': 1000
}
assertions:
- result:status_code = 200

View File

@ -1,5 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_helius_util_udfs,
config_helius_utils_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -0,0 +1,44 @@
version: 2
models:
- name: playgrounds__
columns:
- name: query_subgraph
tests:
- test_udf:
name: test_playgrounds__query_subgraph_status_200_liquidity_pools
args: >
'ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH6123cr7'
, {
'query': '{
liquidityPools(first: 200, orderBy: totalValueLockedUSD, orderDirection: desc) {
id
totalLiquidity
name
inputTokens {
id
symbol
}
}
}',
'variables': {}
}
assertions:
- result:status_code = 200
- test_udf:
name: test_playgrounds__query_subgraph_status_200_total_pool_count
args: >
'ELUcwgpm14LKPLrBRuVvPvNKHQ9HvwmtKgKSH6123cr7'
, {
'query': '{
protocols {
name
totalPoolCount
}
}',
'variables': {}
}
assertions:
- result:status_code = 200

View File

@ -1,6 +1,6 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_ethereum_nft_udfs,
config_quicknode_ethereum_nfts_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}
-- depends_on: {{ ref('quicknode_utils__qicknode_utils') }}
-- depends_on: {{ ref('quicknode_utils__quicknode_utils') }}

View File

@ -0,0 +1,84 @@
version: 2
models:
- name: quicknode_ethereum_nfts__quicknode_utils
columns:
- name: fetch_nft_collection_details
tests:
- test_udf:
name: test_quicknode_ethereum_nfts__fetch_nft_collection_details_status_200
args: >
{
'contracts': [
'0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7'
]
}
assertions:
- result:status_code = 200
- name: fetch_nfts
tests:
- test_udf:
name: test_quicknode_ethereum_nfts__fetch_nfts_status_200
args: >
{
'wallet': '0x91b51c173a4bdaa1a60e234fc3f705a16d228740',
'omitFields': [
'provenance',
'traits'
],
'page': 1,
'perPage': 10,
'contracts': [
'0x2106c00ac7da0a3430ae667879139e832307aeaa',
'0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D'
]
}
assertions:
- result:status_code = 200
- name: fetch_nfts_by_collection
tests:
- test_udf:
name: test_quicknode_ethereum_nfts__fetch_nfts_by_collection_status_200
args: >
{
'collection': '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'omitFields': [
'imageUrl',
'traits'
],
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: get_transfers_by_nft
tests:
- test_udf:
name: test_quicknode_ethereum_nfts__get_transfers_by_nft_status_200
args: >
{
'collection': '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'collectionTokenId': '1',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: verify_nfts_owner
tests:
- test_udf:
name: test_quicknode_ethereum_nfts__verify_nfts_owner_status_200
args: >
{
'wallet': '0x91b51c173a4bdaa1a60e234fc3f705a16d228740',
'contracts': [
'0x2106c00ac7da0a3430ae667879139e832307aeaa:3643',
'0xd07dc4262bcdbf85190c01c996b4c06a461d2430:133803'
]
}
assertions:
- result:status_code = 200

View File

@ -1,6 +1,6 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_ethereum_token_udfs,
config_quicknode_ethereum_tokens_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}
-- depends_on: {{ ref('quicknode_utils__qicknode_utils') }}
-- depends_on: {{ ref('quicknode_utils__quicknode_utils') }}

View File

@ -0,0 +1,63 @@
version: 2
models:
- name: quicknode_ethereum_tokens__quicknode_utils
columns:
- name: get_token_metadata_by_contract_address
tests:
- test_udf:
name: test_quicknode_ethereum_tokens__get_token_metadata_by_contract_address_status_200
args: >
{
'contract': '0x4d224452801ACEd8B2F0aebE155379bb5D594381'
}
assertions:
- result:status_code = 200
- name: get_token_metadata_by_symbol
tests:
- test_udf:
name: test_quicknode_ethereum_tokens__get_token_metadata_by_symbol_status_200
args: >
{
'symbol': 'USDC'
}
assertions:
- result:status_code = 200
- name: get_transactions_by_address
tests:
- test_udf:
name: test_quicknode_ethereum_tokens__get_transactions_by_address_status_200
args: >
{
'address': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: get_wallet_token_balance
tests:
- test_udf:
name: test_quicknode_ethereum_tokens__get_wallet_token_balance_status_200
args: >
{
'wallet': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
}
assertions:
- result:status_code = 200
- name: get_wallet_token_transactions
tests:
- test_udf:
name: test_quicknode_ethereum_tokens__get_wallet_token_transactions_status_200
args: >
{
'address': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
'contract': '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200

View File

@ -1,6 +1,6 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_polygon_nft_udfs,
config_quicknode_polygon_nfts_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}
-- depends_on: {{ ref('quicknode_utils__qicknode_utils') }}
-- depends_on: {{ ref('quicknode_utils__quicknode_utils') }}

View File

@ -0,0 +1,85 @@
version: 2
models:
- name: quicknode_polygon_nfts__quicknode_utils
columns:
- name: fetch_nft_collection_details
tests:
- test_udf:
name: test_quicknode_polygon_nfts__fetch_nft_collection_details_status_200
args: >
{
'contracts': [
'0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7'
]
}
assertions:
- result:status_code = 200
- name: fetch_nfts
tests:
- test_udf:
name: test_quicknode_polygon_nfts__fetch_nfts_status_200
args: >
{
'wallet': '0x91b51c173a4bdaa1a60e234fc3f705a16d228740',
'omitFields': [
'provenance',
'traits'
],
'page': 1,
'perPage': 10,
'contracts': [
'0x2106c00ac7da0a3430ae667879139e832307aeaa',
'0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D'
]
}
assertions:
- result:status_code = 200
- name: fetch_nfts_by_collection
tests:
- test_udf:
name: test_quicknode_polygon_nfts__fetch_nfts_by_collection_status_200
args: >
{
'collection': '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'omitFields': [
'imageUrl',
'traits'
],
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: get_transfers_by_nft
tests:
- test_udf:
name: test_quicknode_polygon_nfts__get_transfers_by_nft_status_200
args: >
{
'collection': '0x60E4d786628Fea6478F785A6d7e704777c86a7c6',
'collectionTokenId': '1',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: verify_nfts_owner
tests:
- test_udf:
name: test_quicknode_polygon_nfts__verify_nfts_owner_status_200
args: >
{
'wallet': '0x91b51c173a4bdaa1a60e234fc3f705a16d228740',
'contracts': [
'0x2106c00ac7da0a3430ae667879139e832307aeaa:3643',
'0xd07dc4262bcdbf85190c01c996b4c06a461d2430:133803'
]
}
assertions:
- result:status_code = 200

View File

@ -1,6 +1,6 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_polygon_token_udfs,
config_quicknode_polygon_tokens_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}
-- depends_on: {{ ref('quicknode_utils__qicknode_utils') }}
-- depends_on: {{ ref('quicknode_utils__quicknode_utils') }}

View File

@ -0,0 +1,63 @@
version: 2
models:
- name: quicknode_polygon_tokens__quicknode_utils
columns:
- name: get_token_metadata_by_contract_address
tests:
- test_udf:
name: test_quicknode_polygon_tokens__get_token_metadata_by_contract_address_status_200
args: >
{
'contract': '0x4d224452801ACEd8B2F0aebE155379bb5D594381'
}
assertions:
- result:status_code = 200
- name: get_token_metadata_by_symbol
tests:
- test_udf:
name: test_quicknode_polygon_tokens__get_token_metadata_by_symbol_status_200
args: >
{
'symbol': 'USDC'
}
assertions:
- result:status_code = 200
- name: get_transactions_by_address
tests:
- test_udf:
name: test_quicknode_polygon_tokens__get_transactions_by_address_status_200
args: >
{
'address': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: get_wallet_token_balance
tests:
- test_udf:
name: test_quicknode_polygon_tokens__get_wallet_token_balance_status_200
args: >
{
'wallet': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
}
assertions:
- result:status_code = 200
- name: get_wallet_token_transactions
tests:
- test_udf:
name: test_quicknode_polygon_tokens__get_wallet_token_transactions_status_200
args: >
{
'address': '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
'contract': '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE',
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200

View File

@ -1,6 +1,6 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_solana_nft_udfs,
config_quicknode_solana_nfts_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}
-- depends_on: {{ ref('quicknode_utils__qicknode_utils') }}
-- depends_on: {{ ref('quicknode_utils__quicknode_utils') }}

View File

@ -0,0 +1,34 @@
version: 2
models:
- name: quicknode_solana_nfts__quicknode_utils
columns:
- name: fetch_nfts
tests:
- test_udf:
name: test_quicknode_solana_nfts__fetch_nfts_status_200
args: >
{
'wallet': 'DcTmx4VLcf5euAB17nynax7g55xuB3XKBDyz1pudMcjW',
'omitFields': [
'provenance',
'traits'
],
'page': 1,
'perPage': 10
}
assertions:
- result:status_code = 200
- name: fetch_nfts_by_creator
tests:
- test_udf:
name: test_quicknode_solana_nfts__fetch_nfts_by_creator_status_200
args: >
{
'creator': 'DznU28LgherhU2JwC2db3KmAeWPqoF9Yx2aVtNUudW6R',
'page': 1,
'perPage': 3
}
assertions:
- result:status_code = 200

View File

@ -1,5 +1,5 @@
-- depends_on: {{ ref('live') }}
{%- set configs = [
config_quicknode_util_udfs,
config_quicknode_utils_udfs,
] -%}
{{- ephemeral_deploy_marketplace(configs) -}}

View File

@ -0,0 +1,15 @@
version: 2
models:
- name: strangelove__
columns:
- name: get
tests:
- test_udf:
name: test_strangelove__get_status_200
args: >
'https://api.strange.love/cosmoshub/mainnet/rpc/block_by_hash'
, {
'blockHash': '0xD70952032620CC4E2737EB8AC379806359D8E0B17B0488F627997A0B043ABDED'
}
assertions:
- result:status_code = 200

View File

@ -0,0 +1,13 @@
version: 2
models:
- name: subquery__
columns:
- name: graphql
tests:
- test_udf:
name: test_subquery__graphql_status_200
args: >
'kepler-network'
, {'query':'query { _mmrs (first: 5) { nodes { key } } }'}
assertions:
- result:status_code = 200

View File

@ -1,17 +1,12 @@
{% test test_udf(model, column_name, args, expected) %}
{%- set schema = model | replace("__dbt__cte__", "") -%}
{%- set udf = schema ~ "." ~ column_name -%}
,
tests AS
(
SELECT
'{{ udf }}' AS test_name
,[{{ args }}] as parameters
,{{ udf }}({{args}}) AS actual
,{{ expected }} AS expected
,NOT {{ udf }}({{args}}) = {{ expected }} AS failed
)
SELECT *
FROM tests
WHERE FAILED = TRUE
{% test test_udf(model, column_name, args, assertions) %}
{#
This is a generic test for UDFs.
The udfs are deployed using ephemeral models, so we need to
use the ephemeral model name to get the udf name.
#}
{%- set schema = model | replace("__dbt__cte__", "") -%}
{%- set schema = schema.split("__") | first -%}
{%- set udf = schema ~ "." ~ column_name -%}
{{ base_test_udf(model, udf, args, assertions) }}
{% endtest %}