Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintignore

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
module.exports = {
extends: ['@theguild'],
ignorePatterns: [
'node_modules',
'dist',
'build',
'generated',
'packages/cli/tests/cli/init',
'packages/cli/tests/cli/validation',
'packages/ts/test/',
'examples',
'cf-pages/*',
'vitest.config.ts',
],
rules: {
// not necessary here, we dont build with bob
'import/extensions': 'off',
Expand All @@ -16,6 +28,7 @@ module.exports = {
'@typescript-eslint/ban-types': 'off',
// AssemblyScript `===` is a reference equality check, not a value equality check. We are trying to do a value check. Learn more: https://github.com/AssemblyScript/assemblyscript/issues/621#issuecomment-497973428
eqeqeq: 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
overrides: [
{
Expand All @@ -29,6 +42,7 @@ module.exports = {
'sonarjs/no-inverted-boolean-check': 'warn',
// TODO: warning for now, clean up
'@typescript-eslint/no-loss-of-precision': 'warn',
'no-loss-of-precision': 'warn',
// AssemblyScript types are different from TS and in cases we want to use what TS may think we should not,
},
},
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ tmp

*.wasm

.idea
.idea
1 change: 0 additions & 1 deletion .prettierrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@theguild/prettier-config"
60 changes: 28 additions & 32 deletions examples/aggregations/check-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,50 @@ sgd=$1
# Note that these substitutions are done for all possible combinations of
# INTV/DUR and TBL
expand() {
query=${1//SGD/$sgd}
if [[ "$query" =~ "INTV" ]]
then
for pair in hour:3600 day:86400
do
intv=${pair%:*}
duration=${pair#*:}
q=${query//INTV/$intv}
q=${q//DUR/$duration}
if [[ "$q" =~ "TBL" ]]
then
for tbl in stats group_1 group_2 group_3 groups
do
echo "${q//TBL/$tbl};"
done
else
echo "$q;"
fi
query=${1//SGD/$sgd}
if [[ "$query" =~ "INTV" ]]; then
for pair in hour:3600 day:86400; do
intv=${pair%:*}
duration=${pair#*:}
q=${query//INTV/$intv}
q=${q//DUR/$duration}
if [[ "$q" =~ "TBL" ]]; then
for tbl in stats group_1 group_2 group_3 groups; do
echo "${q//TBL/$tbl};"
done
else
echo "$query;"
fi
else
echo "$q;"
fi
done
else
echo "$query;"
fi
}

# Max and last must be the same
read -d '' -r max_last <<'EOF'
read -d '' -r max_last << 'EOF'
select count(*) = 0 as TBL_INTV_max_eq_last
from SGD.TBL_INTV
where max != last
EOF

# Min and first must be the same
read -d '' -r min_first <<'EOF'
read -d '' -r min_first << 'EOF'
select count(*) = 0 as TBL_INTV_min_eq_first
from SGD.TBL_INTV
where min != first
EOF

# The sum over block numbers must be correct
read -d '' -r sum_check <<'EOF'
read -d '' -r sum_check << 'EOF'
select count(*) = 0 as stats_INTV_sum_correct
from SGD.stats_INTV
where sum != (last - first + 1)::numeric*(last + first)::numeric/2
and first > 1
EOF

# The timestamps of all buckets are rounded to the beginning of the period
read -d '' -r bucket_timestamp <<'EOF'
read -d '' -r bucket_timestamp << 'EOF'
select count(*) = 0 as TBL_INTV_bucket_timestamp
from SGD.TBL_INTV
where to_timestamp(timestamp)
Expand All @@ -76,7 +72,7 @@ EOF

# The timestamp of the min and max block for all buckets must be between
# the bucket's timestamp plus the bucket's duration
read -d '' -r block_timestamp <<'EOF'
read -d '' -r block_timestamp << 'EOF'
select count(*) = 0 as TBL_INTV_timestamp
from SGD.TBL_INTV s,
SGD.block_time b
Expand All @@ -87,7 +83,7 @@ EOF
# For group_3_hour, since we split the aggregations into 1000 buckets,
# there can only be one or two blocks in each bucket; if there are two,
# they must differ by 1000 blocks
read -d '' -r group3_count_min_max <<'EOF'
read -d '' -r group3_count_min_max << 'EOF'
select count(*) = 0 as count_min_max
from SGD.group_3_hour
where (count = 1 and min != max)
Expand All @@ -96,15 +92,15 @@ select count(*) = 0 as count_min_max
EOF

# Same as previous for 'groups' instead of 'group_3'
read -d '' -r groups_count_min_max <<'EOF'
read -d '' -r groups_count_min_max << 'EOF'
select count(*) = 0 as count_min_max
from SGD.groups_hour
where (count = 1 and min != max)
or (count = 2 and min + 1000 != max)
or count > 2
EOF

read -d '' -r groups_total_min_max <<'EOF'
read -d '' -r groups_total_min_max << 'EOF'
select count(*) = 0 as total_min_max
from SGD.groups_hour
where total_min != group_3
Expand All @@ -118,14 +114,14 @@ EOF
# is g + (g+1000) + (g+2000) + .. + (g + (tc-1)*1000)
# We don't know what the total count should be since each group can contain
# 1 or 2 blocks, but we can at least relate total_count and total_sum
read -d '' -r groups_total_count_sum <<'EOF'
read -d '' -r groups_total_count_sum << 'EOF'
select count(*) = 0 as total_count_sum
from SGD.groups_hour
where total_sum != total_count * (group_3 + 1000 * (total_count::numeric - 1) / 2)
EOF

# Recalculate total count and sum with a window query
read -d '' -r groups_window_totals <<'EOF'
read -d '' -r groups_window_totals << 'EOF'
select count(*) = 0 as window_totals from
(select group_3, total_count, total_sum,
sum(count) over (partition by group_3 order by timestamp) as new_total_count,
Expand All @@ -144,4 +140,4 @@ expand "$block_timestamp"
expand "$group3_count_min_max"
expand "$groups_total_min_max"
expand "$groups_total_count_sum"
expand "$groups_window_totals"
expand "$groups_window_totals"
6 changes: 3 additions & 3 deletions examples/aggregations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"test": "graph test"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-ts": "^0.32.0"
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "^0.35.1"
},
"devDependencies": {
"matchstick-as": "0.5.0"
"matchstick-as": "0.6.0"
}
}
2 changes: 1 addition & 1 deletion examples/arweave-blocks-transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"remove-local": "graph remove arweave-example --node http://localhost:8020"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "0.35.1"
}
}
2 changes: 1 addition & 1 deletion examples/cosmos-block-filtering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"babel-register": "^6.26.0"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "0.35.1",
"mustache": "^4.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cosmos-osmosis-token-swaps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"babel-register": "^6.26.0"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "0.35.1"
}
}
4 changes: 2 additions & 2 deletions examples/cosmos-validator-delegations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"remove-local": "graph remove cosmos-validator-delegations --node http://127.0.0.1:8020"
},
"dependencies": {
"as-proto": "^0.2.3",
"as-proto": "^1.3.0",
"babel-polyfill": "^6.26.0",
"babel-register": "^6.26.0"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "0.35.1",
"mustache": "^4.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cosmos-validator-rewards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"babel-register": "^6.26.0"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.71.2",
"@graphprotocol/graph-cli": "0.90.1",
"@graphprotocol/graph-ts": "0.35.1",
"mustache": "^4.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ethereum-basic-event-handlers/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ typechain-types
# Hardhat files
cache
artifacts/build-info
artifacts/contracts/**/*.dbg.json
artifacts/contracts/**/*.dbg.json
4 changes: 2 additions & 2 deletions examples/ethereum-basic-event-handlers/build/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dataSources:
name: Gravity
network: test
source:
address: '0x5FbDB2315678afecb367f032d93F642f64180aa3'
address: "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf"
abi: Gravity
mapping:
kind: ethereum/events
Expand All @@ -18,7 +18,7 @@ dataSources:
- Gravatar
abis:
- name: Gravity
file: Gravity/artifacts/contracts/Gravity.sol/GravatarRegistry.json
file: Gravity/GravatarRegistry.json
eventHandlers:
- event: NewGravatar(uint256,address,string,string)
handler: handleNewGravatar
Expand Down
Loading
Loading