Skip to content

Commit

Permalink
fix: fix buy-token indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
EjembiEmmanuel committed Aug 30, 2024
1 parent f645a46 commit 3c17464
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions apps/indexer/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AUTH_TOKEN=dna_xxx
POSTGRES_CONNECTION_STRING=postgresql://admin:postgres@localhost:5432/indexer
4 changes: 2 additions & 2 deletions apps/indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ FROM quay.io/apibara/sink-postgres:0.7.0-x86_64
WORKDIR /app
COPY ./src/* /app

ARG DATABASE_CONN_STRING
ARG POSTGRES_CONNECTION_STRING

ENV DATABASE_CONN_STRING=${DATABASE_CONN_STRING}
ENV POSTGRES_CONNECTION_STRING=${POSTGRES_CONNECTION_STRING}

ENTRYPOINT ["/nix/store/rh1g8pb7wfnyr527jfmkkc5lm3sa1f0l-apibara-sink-postgres-0.7.0/bin/apibara-sink-postgres"]
9 changes: 4 additions & 5 deletions apps/indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
## Install Postgres and Init the tables

```
docker run --name afk-indexer -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v /afk-indexer:/docker-entrypoint-initdb.d postgres:16
docker run --name afk-indexer -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=admin -e POSTGRES_DB=indexer -d -p 5432:5432 -v ./:/docker-entrypoint-initdb.d postgres:latest
```

# Test

unrugmeme_deploy
buy-token deploy

```
apibara run ./src/pump-buy-coin.js -A dna_XXX
apibara run ./src/buy-token.ts --allow-env .env -A dna_xxx
```

Expand All @@ -27,4 +26,4 @@ apibara run ./src/pump-buy-coin.js -A dna_XXX
```

### Run it
docker run -it --env-file ./.env afk-indexer run /app/buy-token --tls-accept-invalid-certificates=true --allow-env-from-env DATABASE_CONN_STRING
docker run -it --env-file ./.env afk-indexer run /app/buy-token.ts --tls-accept-invalid-certificates=true --allow-env-from-env POSTGRES_CONNECTION_STRING
2 changes: 1 addition & 1 deletion apps/indexer/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ CREATE TABLE token_transactions (
current_supply TEXT,
liquidity_raised TEXT,
price TEXT,
protocol_fee TEXT,
amount TEXT,
time_stamp timestamp,
_cursor bigint,
transaction_type TEXT NOT NULL CHECK (transaction_type IN ('buy', 'sell'))

Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/src/buy-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const config = {
filter,
sinkType: "postgres",
sinkOptions: {
connectionString: Deno.env.get("DATABASE_CONN_STRING"),
connectionString: Deno.env.get("POSTGRES_CONNECTION_STRING"),
tableName: "token_transactions"
}
};
Expand Down

0 comments on commit 3c17464

Please sign in to comment.