Overview

You can add parameters to your query using double curly braces, e.g. {{my_parameter}}

https://www.loom.com/share/84ebe9c427d044afbaa8670ad70a3206

For example, if you wanted to get the max block an address was used in (either “from” or “to”), you could write:

select max(block_number) as max_block
from ethereum.transactions as t 
where 
(
    t.from_address = lower('{{address}}')
    or
    t.to_address = lower('{{address}}')
)

And “address” field will appear above the query. Put an address in, e.g. 0xa8792f4472c0e076f2546c1d934e0637748dbef7 and run the query

Untitled

Using Parameters in the API

This field will automatically be available in the API for this query. Click the three dots menu and click “Settings”

Untitled

import requests

url = "<https://api.luabase.com/run>"

payload = {
  "uuid": "eed8cb00345d403db9b7da6eaf188532",
  "parameters": {
  "address": {
    "value": "0xa8792f4472c0e076f2546c1d934e0637748dbef7",
    "type": "value"
  }
}
}
headers = {"content-type": "application/json"}
response = requests.request("POST", url, json=payload, headers=headers)
data = response.json()

Memory