-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init art peace indexer * add web analytics
- Loading branch information
Showing
13 changed files
with
774 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// src/analytics.ts | ||
export const initGoogleAnalytics = (trackingId: string) => { | ||
if (typeof window !== 'undefined') { | ||
const script1 = document.createElement('script'); | ||
script1.async = true; | ||
script1.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`; | ||
document.head.appendChild(script1); | ||
|
||
// Add the gtag initialization script | ||
const script2 = document.createElement('script'); | ||
script2.innerHTML = ` | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
gtag('config', '${trackingId}'); | ||
`; | ||
document.head.appendChild(script2); | ||
|
||
// const script = document.createElement('script'); | ||
// script.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`; | ||
// script.async = true; | ||
// document.head.appendChild(script); | ||
|
||
// window?.dataLayer = window.dataLayer || []; | ||
// function gtag() { | ||
// window.dataLayer.push(arguments); | ||
// } | ||
// gtag('js', new Date()); | ||
// gtag('config', trackingId); | ||
} | ||
}; | ||
|
||
export const logPageView = () => { | ||
if (typeof window !== 'undefined') { | ||
window.gtag('event', 'page_view', { | ||
page_path: window.location.pathname, | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM quay.io/apibara/sink-webhook:0.6.0 as sink-webhook | ||
|
||
WORKDIR /indexer | ||
COPY ./indexer/script.js . | ||
|
||
CMD ["run", "script.js", "--allow-env", "/configs/configs.env", "--allow-env-from-env", "CONSUMER_TARGET_URL,APIBARA_STREAM_URL,PERSIST_TO_REDIS,INDEXER_ID", "--allow-net", "--sink-id", "art-peace-sink-id"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM quay.io/apibara/sink-webhook:0.6.0 as sink-webhook | ||
|
||
WORKDIR /indexer | ||
COPY ./indexer/prod-script.js . | ||
|
||
# TODO: Allow net only on the required domains | ||
CMD ["run", "prod-script.js", "--allow-env-from-env", "CONSUMER_TARGET_URL,APIBARA_STREAM_URL,PERSIST_TO_REDIS,INDEXER_ID,ART_PEACE_CONTRACT_ADDRESS,NFT_CONTRACT_ADDRESS,USERNAME_STORE_ADDRESS", "--allow-net", "--sink-id", "art-peace-sink-id"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# art/peace Indexer | ||
|
||
This directory contains the Apibara indexer setup for `art/peace`, which indexes and relays `art/peace` state change information to be stored in the Redis and Postgres DBs. | ||
|
||
## Running | ||
|
||
``` | ||
# Setup Indexer/DNA w/ docker compose or other options | ||
# Create an indexer.env file with the following : | ||
# ART_PEACE_CONTRACT_ADDRESS=... # Example: 0x78223f7ab13216727ed426380079c169578cafad83a3178c7b33ba7ca307713 | ||
# APIBARA_STREAM_URL=... # Example: http://localhost:7171 | ||
# CONSUMER_TARGET_URL=... # Example: http://localhost:8081/consume-indexer-msg | ||
apibara run scripts.js --allow-env indexer.env | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: "3" | ||
|
||
services: | ||
devnet: | ||
image: shardlabs/starknet-devnet-rs:0.0.3 | ||
command: | ||
- --dump-on=transaction | ||
- --dump-path=/data/dump | ||
- --seed=42 | ||
volumes: | ||
- devnet:/data | ||
ports: | ||
- 5050:5050 | ||
|
||
dna: | ||
image: quay.io/apibara/starknet:1.5.0 | ||
command: | ||
- start | ||
- --rpc=http://devnet:5050/rpc | ||
- --name=devnet | ||
- --head-refresh-interval-ms=1000 | ||
- --wait-for-rpc | ||
- --address=0.0.0.0:7171 | ||
environment: | ||
- XDG_DATA_HOME=/data | ||
volumes: | ||
- dna:/data | ||
ports: | ||
- 7171:7171 | ||
depends_on: | ||
devnet: | ||
condition: service_started | ||
|
||
volumes: | ||
devnet: | ||
dna: |
Oops, something went wrong.