Store uniswap universal router decoded data to Mongo DB as mutations and distribute decoded data as subscriptions and GraphQL query
- Uniswap Universal Publisher: The GraphQL receive data from the Uniswap Universal Publisher through mutations
- Mongo DB: Mutations register data to the Mongo DB
$ sudo apt install nodejs
$ cd ./[application execute path]
$ git clone https://github.com/HiroyukiNaito/uniswap-universal-graphql.git
$ cd uniswap-universal-graphql
$ yarn install
$ vi .env
# Your Mongo DB server (DNS name or IP address)
MONGODB_SERVER=localhost
# Database which store Uniswap universal router data
MONGODB_DB=uniswapData
# Your Mongo DB user name
MONGODB_USER=user
# Your Mongo DB user password
MONGODB_PASSWORD=password
# Maximum object number by query
QUERY_LIMIT=100
# Access token for Mmutation
APP_SECRET=AccessToken
# Data will expire (delete) following seconds
EXPIRE_TIME=86400
# If you want to use GraphiQL, assign 'ON'
GRAPHIQL=ON
$ export $(cat .env | xargs)
$ yarn nodemon app
Model Name | Indeces | Description |
---|---|---|
txnPools | _id, hash(unique), createdAt (ttl: 2592000) | Transaction Pool Data. This data will vanish after a month |
txns | _id, hash(unique), createdAt, blockHeader.timestamp | L1 Transaction Data |
l2txns | _id, hash(unique), createdAt, blockHeader.timestamp | L2 Transaction Data |
- Schemas are here
Can subscribe L1 latest txpool data, L1 transaction data and L2 transaction data
- Subscribe all properties in the most recent txpool data
subscription {
txnPool {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
}
}
- Subscribe almost all properties in the most recent L1 Transaction data
subscription {
txn {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}
- Subscribe almost all properties in the most recent L1 Transaction data in bulk
subscription {
txnBulk {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}
- Subscribe almost all properties in the most recent L2 Transaction data
- Note: L2 Uniswap transaction are significantly fewer than L1
subscription {
l2txn {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}
- Subscribe almost all properties in the most recent L2 Transaction data in bulk
- Note: L2 Uniswap transaction are significantly fewer than L1
subscription {
l2txnBulk {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}
- Can list all obtained L1 txpool data, L1 transaction data and L2 transaction data stored in Mongo DB
- Other useful queries are considered now. Any suggestions are welcomed.
- List all txpool data
query {
txnPoolList(limit: 100) {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
}
}
- List all L1 transaction data
query {
txnList(limit: 100) {
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}
- List all L2 transaction data
query {
l2txnList(limit: 100){
provider
blockNumber
blockHash
hash
type
to
from
nonce
gasLimit
gasPrice
maxPriorityFeePerGas
maxFeePerGas
data
value
chainId
createdAt
decodedData {
contents
deadline
}
accessList
signature {
_type
networkV
r
s
v
}
blockHeader {
_type
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
hash
miner
nonce
number
parentHash
timestamp
}
}
}