Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 additions & 0 deletions subgraph-triggers/cosmos-usdt-exchange-volume/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Graph CLI generated artifacts
build/
generated/

# Dependency directories
node_modules/
jspm_packages/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variables file
.env

# Testing
coverage
coverage.json

# Typechain
typechain
typechain-types

# Hardhat files
cache
73 changes: 73 additions & 0 deletions subgraph-triggers/cosmos-usdt-exchange-volume/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Subtreams Triggers - Importing transactions from the USDT Exchange Substreams.

## Getting Started

1. Prepare the substreams

The [injective-common](https://substreams.dev/streamingfast/injective-common/v0.1.0) substreams has a `filtered_events` module that allows getting only the events that match certain types.

We will prepare a substreams package file (.spkg) with that parameter baked-in. Here, we want the event type `wasm`:

```yaml
# substreams.yaml
specVersion: v0.1.0
package:
name: wasm_events
version: v0.1.0

network: injective-mainnet
imports:
injective: https://spkg.io/streamingfast/injective-common-v0.1.0.spkg

modules:
- name: wasm_events
use: injective:filtered_events

params:
wasm_events: "wasm"
```

Using substreams v1.7.2 or above (https://github.com/streamingfast/substreams/releases), build the package:

```bash
substreams pack
```

This creates the `wasm-events-v0.1.0.spkg` file in the local folder, which will be referenced by subgraph.yaml.


2. Install the dependencies:

```bash
npm install
```

3. Generate the code defined in the mappings

```bash
npm run codegen
```

4. Generate the Protobuf of the EventList that substreams outputs (and its dependencies):

```bash
# you probably want to delete the previous bindings
# rm -rf src/pb
buf generate --type="sf.substreams.cosmos.v1.EventList" wasm-events-v0.1.0.spkg#format=bin
```

5. Code your subgraph in `mappings.ts`, build it, deploy it on a local graph-node instance connected to injective-mainnet:

```bash
npm run build
npm run create-local
npm run deploy-local
# npm run remove-local
```

6. Publish to The Graph network:

```bash
npm run publish
```

6 changes: 6 additions & 0 deletions subgraph-triggers/cosmos-usdt-exchange-volume/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: v1
plugins:
- name: as-generator
path: ./node_modules/.bin/as-proto-gen
strategy: all
out: src/pb
Loading