Add watcher in eth_call
mode for Censures contract (#6)
* Create watcher in eth_call mode for Censures contract * Update readme about unhandled queries --------- Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
This commit is contained in:
parent
8e14305364
commit
1e11139c9a
2
packages/censures-watcher/.eslintignore
Normal file
2
packages/censures-watcher/.eslintignore
Normal file
@ -0,0 +1,2 @@
|
||||
# Don't lint build output.
|
||||
dist
|
28
packages/censures-watcher/.eslintrc.json
Normal file
28
packages/censures-watcher/.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"semistandard",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": [
|
||||
"warn",
|
||||
{
|
||||
"allowArgumentsExplicitlyTypedAsAny": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
212
packages/censures-watcher/README.md
Normal file
212
packages/censures-watcher/README.md
Normal file
@ -0,0 +1,212 @@
|
||||
# censures-watcher
|
||||
|
||||
## Currently unsupported queries
|
||||
|
||||
The watcher was generated in `eth_call` mode and does not support the following queries in its current state:
|
||||
|
||||
* `getCensuring(uint16 _whose) returns (uint32[] cens)`
|
||||
|
||||
* `getCensuredBy(uint16 _who) returns (uint16[] cens)`
|
||||
|
||||
## Setup
|
||||
|
||||
* Run the following command to install required packages:
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
* Create a postgres12 database for the watcher:
|
||||
|
||||
```bash
|
||||
sudo su - postgres
|
||||
createdb censures-watcher
|
||||
```
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
|
||||
|
||||
```
|
||||
createdb censures-watcher-job-queue
|
||||
```
|
||||
|
||||
```
|
||||
postgres@tesla:~$ psql -U postgres -h localhost censures-watcher-job-queue
|
||||
Password for user postgres:
|
||||
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
|
||||
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
|
||||
Type "help" for help.
|
||||
|
||||
censures-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
||||
CREATE EXTENSION
|
||||
censures-watcher-job-queue=# exit
|
||||
```
|
||||
|
||||
* In the [config file](./environments/local.toml):
|
||||
|
||||
* Update the database connection settings.
|
||||
|
||||
* Update the `upstream` config and provide the `ipld-eth-server` GQL API endpoint.
|
||||
|
||||
* Update the `server` config with state checkpoint settings.
|
||||
|
||||
## Customize
|
||||
|
||||
* Indexing on an event:
|
||||
|
||||
* Edit the custom hook function `handleEvent` (triggered on an event) in [hooks.ts](./src/hooks.ts) to perform corresponding indexing using the `Indexer` object.
|
||||
|
||||
* While using the indexer storage methods for indexing, pass `diff` as true if default state is desired to be generated using the state variables being indexed.
|
||||
|
||||
* Generating state:
|
||||
|
||||
* Edit the custom hook function `createInitialState` (triggered if the watcher passes the start block, checkpoint: `true`) in [hooks.ts](./src/hooks.ts) to save an initial `State` using the `Indexer` object.
|
||||
|
||||
* Edit the custom hook function `createStateDiff` (triggered on a block) in [hooks.ts](./src/hooks.ts) to save the state in a `diff` `State` using the `Indexer` object. The default state (if exists) is updated.
|
||||
|
||||
* Edit the custom hook function `createStateCheckpoint` (triggered just before default and CLI checkpoint) in [hooks.ts](./src/hooks.ts) to save the state in a `checkpoint` `State` using the `Indexer` object.
|
||||
|
||||
### GQL Caching
|
||||
|
||||
To enable GQL requests caching:
|
||||
|
||||
* Update the `server.gqlCache` config with required settings.
|
||||
|
||||
* In the GQL [schema file](./src/schema.gql), use the `cacheControl` directive to apply cache hints at schema level.
|
||||
|
||||
* Eg. Set `inheritMaxAge` to true for non-scalar fields of a type.
|
||||
|
||||
* In the GQL [resolvers file](./src/resolvers.ts), uncomment the `setGQLCacheHints()` calls in resolvers for required queries.
|
||||
|
||||
## Run
|
||||
|
||||
* If the watcher is a `lazy` watcher:
|
||||
|
||||
* Run the server:
|
||||
|
||||
```bash
|
||||
yarn server
|
||||
```
|
||||
|
||||
GQL console: http://localhost:3009/graphql
|
||||
|
||||
* If the watcher is an `active` watcher:
|
||||
|
||||
* Run the job-runner:
|
||||
|
||||
```bash
|
||||
yarn job-runner
|
||||
```
|
||||
|
||||
* Run the server:
|
||||
|
||||
```bash
|
||||
yarn server
|
||||
```
|
||||
|
||||
GQL console: http://localhost:3009/graphql
|
||||
|
||||
* To watch a contract:
|
||||
|
||||
```bash
|
||||
yarn watch:contract --address <contract-address> --kind <contract-kind> --checkpoint <true | false> --starting-block [block-number]
|
||||
```
|
||||
|
||||
* `address`: Address or identifier of the contract to be watched.
|
||||
* `kind`: Kind of the contract.
|
||||
* `checkpoint`: Turn checkpointing on (`true` | `false`).
|
||||
* `starting-block`: Starting block for the contract (default: `1`).
|
||||
|
||||
Examples:
|
||||
|
||||
Watch a contract with its address and checkpointing on:
|
||||
|
||||
```bash
|
||||
yarn watch:contract --address 0x1F78641644feB8b64642e833cE4AFE93DD6e7833 --kind ERC20 --checkpoint true
|
||||
```
|
||||
|
||||
Watch a contract with its identifier and checkpointing on:
|
||||
|
||||
```bash
|
||||
yarn watch:contract --address MyProtocol --kind protocol --checkpoint true
|
||||
```
|
||||
|
||||
* To fill a block range:
|
||||
|
||||
```bash
|
||||
yarn fill --start-block <from-block> --end-block <to-block>
|
||||
```
|
||||
|
||||
* `start-block`: Block number to start filling from.
|
||||
* `end-block`: Block number till which to fill.
|
||||
|
||||
* To create a checkpoint for a contract:
|
||||
|
||||
```bash
|
||||
yarn checkpoint create --address <contract-address> --block-hash [block-hash]
|
||||
```
|
||||
|
||||
* `address`: Address or identifier of the contract for which to create a checkpoint.
|
||||
* `block-hash`: Hash of a block (in the pruned region) at which to create the checkpoint (default: latest canonical block hash).
|
||||
|
||||
* To reset the watcher to a previous block number:
|
||||
|
||||
* Reset watcher:
|
||||
|
||||
```bash
|
||||
yarn reset watcher --block-number <previous-block-number>
|
||||
```
|
||||
|
||||
* Reset job-queue:
|
||||
|
||||
```bash
|
||||
yarn reset job-queue
|
||||
```
|
||||
|
||||
* Reset state:
|
||||
|
||||
```bash
|
||||
yarn reset state --block-number <previous-block-number>
|
||||
```
|
||||
|
||||
* `block-number`: Block number to which to reset the watcher.
|
||||
|
||||
* To export and import the watcher state:
|
||||
|
||||
* In source watcher, export watcher state:
|
||||
|
||||
```bash
|
||||
yarn export-state --export-file [export-file-path] --block-number [snapshot-block-height]
|
||||
```
|
||||
|
||||
* `export-file`: Path of file to which to export the watcher data.
|
||||
* `block-number`: Block height at which to take snapshot for export.
|
||||
|
||||
* In target watcher, run job-runner:
|
||||
|
||||
```bash
|
||||
yarn job-runner
|
||||
```
|
||||
|
||||
* Import watcher state:
|
||||
|
||||
```bash
|
||||
yarn import-state --import-file <import-file-path>
|
||||
```
|
||||
|
||||
* `import-file`: Path of file from which to import the watcher data.
|
||||
|
||||
* Run server:
|
||||
|
||||
```bash
|
||||
yarn server
|
||||
```
|
||||
|
||||
* To inspect a CID:
|
||||
|
||||
```bash
|
||||
yarn inspect-cid --cid <cid>
|
||||
```
|
||||
|
||||
* `cid`: CID to be inspected.
|
66
packages/censures-watcher/environments/local.toml
Normal file
66
packages/censures-watcher/environments/local.toml
Normal file
@ -0,0 +1,66 @@
|
||||
[server]
|
||||
host = "127.0.0.1"
|
||||
port = 3009
|
||||
kind = "lazy"
|
||||
|
||||
# Checkpointing state.
|
||||
checkpointing = true
|
||||
|
||||
# Checkpoint interval in number of blocks.
|
||||
checkpointInterval = 2000
|
||||
|
||||
# Enable state creation
|
||||
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
|
||||
enableState = true
|
||||
|
||||
# Boolean to filter logs by contract.
|
||||
filterLogs = false
|
||||
|
||||
# Max block range for which to return events in eventsInRange GQL query.
|
||||
# Use -1 for skipping check on block range.
|
||||
maxEventsBlockRange = 1000
|
||||
|
||||
# GQL cache settings
|
||||
[server.gqlCache]
|
||||
enabled = true
|
||||
|
||||
# Max in-memory cache size (in bytes) (default 8 MB)
|
||||
# maxCacheSize
|
||||
|
||||
# GQL cache-control max-age settings (in seconds)
|
||||
maxAge = 15
|
||||
|
||||
[metrics]
|
||||
host = "127.0.0.1"
|
||||
port = 9000
|
||||
[metrics.gql]
|
||||
port = 9001
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "localhost"
|
||||
port = 5432
|
||||
database = "censures-watcher"
|
||||
username = "postgres"
|
||||
password = "postgres"
|
||||
synchronize = true
|
||||
logging = false
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
|
||||
rpcProviderEndpoint = "http://127.0.0.1:8081"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://postgres:postgres@localhost/censures-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 100
|
||||
eventsInBatch = 50
|
||||
blockDelayInMilliSecs = 2000
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
73
packages/censures-watcher/package.json
Normal file
73
packages/censures-watcher/package.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "@cerc-io/censures-watcher",
|
||||
"version": "0.1.0",
|
||||
"description": "censures-watcher",
|
||||
"private": true,
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"build": "yarn clean && tsc && yarn copy-assets",
|
||||
"clean": "rm -rf ./dist",
|
||||
"copy-assets": "copyfiles -u 1 src/**/*.gql dist/",
|
||||
"server": "DEBUG=vulcanize:* YARN_CHILD_PROCESS=true node --enable-source-maps dist/server.js",
|
||||
"server:dev": "DEBUG=vulcanize:* YARN_CHILD_PROCESS=true ts-node src/server.ts",
|
||||
"job-runner": "DEBUG=vulcanize:* YARN_CHILD_PROCESS=true node --enable-source-maps dist/job-runner.js",
|
||||
"job-runner:dev": "DEBUG=vulcanize:* YARN_CHILD_PROCESS=true ts-node src/job-runner.ts",
|
||||
"watch:contract": "DEBUG=vulcanize:* ts-node src/cli/watch-contract.ts",
|
||||
"fill": "DEBUG=vulcanize:* ts-node src/fill.ts",
|
||||
"reset": "DEBUG=vulcanize:* ts-node src/cli/reset.ts",
|
||||
"checkpoint": "DEBUG=vulcanize:* node --enable-source-maps dist/cli/checkpoint.js",
|
||||
"checkpoint:dev": "DEBUG=vulcanize:* ts-node src/cli/checkpoint.ts",
|
||||
"export-state": "DEBUG=vulcanize:* node --enable-source-maps dist/cli/export-state.js",
|
||||
"export-state:dev": "DEBUG=vulcanize:* ts-node src/cli/export-state.ts",
|
||||
"import-state": "DEBUG=vulcanize:* node --enable-source-maps dist/cli/import-state.js",
|
||||
"import-state:dev": "DEBUG=vulcanize:* ts-node src/cli/import-state.ts",
|
||||
"inspect-cid": "DEBUG=vulcanize:* ts-node src/cli/inspect-cid.ts",
|
||||
"index-block": "DEBUG=vulcanize:* ts-node src/cli/index-block.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cerc-io/watcher-ts.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/cerc-io/watcher-ts/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.3.19",
|
||||
"@ethersproject/providers": "^5.4.4",
|
||||
"@cerc-io/cli": "^0.2.34",
|
||||
"@cerc-io/ipld-eth-client": "^0.2.34",
|
||||
"@cerc-io/solidity-mapper": "^0.2.34",
|
||||
"@cerc-io/util": "^0.2.34",
|
||||
"apollo-type-bigint": "^0.1.3",
|
||||
"debug": "^4.3.1",
|
||||
"ethers": "^5.4.4",
|
||||
"graphql": "^15.5.0",
|
||||
"json-bigint": "^1.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"typeorm": "^0.2.32",
|
||||
"yargs": "^17.0.1",
|
||||
"decimal.js": "^10.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ethersproject/abi": "^5.3.0",
|
||||
"@types/yargs": "^17.0.0",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/json-bigint": "^1.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
||||
"@typescript-eslint/parser": "^5.47.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-semistandard": "^15.0.1",
|
||||
"eslint-config-standard": "^16.0.3",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-standard": "^5.0.0",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^5.0.2",
|
||||
"copyfiles": "^2.4.1"
|
||||
}
|
||||
}
|
267
packages/censures-watcher/src/artifacts/Censures.json
Normal file
267
packages/censures-watcher/src/artifacts/Censures.json
Normal file
@ -0,0 +1,267 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_who",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "getCensuredBy",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "cens",
|
||||
"type": "uint16[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "censuring",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_whose",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "getCensuringCount",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "count",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint32"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "censuredByIndexes",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_as",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"name": "_who",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"name": "censure",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_whose",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "getCensuring",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "cens",
|
||||
"type": "uint32[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "azimuth",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_as",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"name": "_who",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"name": "forgive",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"name": "censuringIndexes",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint32"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "censuredBy",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_who",
|
||||
"type": "uint16"
|
||||
}
|
||||
],
|
||||
"name": "getCensuredByCount",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "count",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_azimuth",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "by",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "who",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"name": "Censured",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "by",
|
||||
"type": "uint16"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "who",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"name": "Forgiven",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
34
packages/censures-watcher/src/cli/checkpoint-cmds/create.ts
Normal file
34
packages/censures-watcher/src/cli/checkpoint-cmds/create.ts
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright 2022 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { CreateCheckpointCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../../database';
|
||||
import { Indexer } from '../../indexer';
|
||||
|
||||
export const command = 'create';
|
||||
|
||||
export const desc = 'Create checkpoint';
|
||||
|
||||
export const builder = {
|
||||
address: {
|
||||
type: 'string',
|
||||
require: true,
|
||||
demandOption: true,
|
||||
describe: 'Contract address to create the checkpoint for.'
|
||||
},
|
||||
blockHash: {
|
||||
type: 'string',
|
||||
describe: 'Blockhash at which to create the checkpoint.'
|
||||
}
|
||||
};
|
||||
|
||||
export const handler = async (argv: any): Promise<void> => {
|
||||
const createCheckpointCmd = new CreateCheckpointCmd();
|
||||
await createCheckpointCmd.init(argv, Database);
|
||||
|
||||
await createCheckpointCmd.initIndexer(Indexer);
|
||||
|
||||
await createCheckpointCmd.exec();
|
||||
};
|
39
packages/censures-watcher/src/cli/checkpoint.ts
Normal file
39
packages/censures-watcher/src/cli/checkpoint.ts
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import yargs from 'yargs';
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { DEFAULT_CONFIG_PATH } from '@cerc-io/util';
|
||||
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
const log = debug('vulcanize:checkpoint');
|
||||
|
||||
const main = async () => {
|
||||
return yargs(hideBin(process.argv))
|
||||
.parserConfiguration({
|
||||
'parse-numbers': false
|
||||
}).options({
|
||||
configFile: {
|
||||
alias: 'f',
|
||||
type: 'string',
|
||||
require: true,
|
||||
demandOption: true,
|
||||
describe: 'configuration file path (toml)',
|
||||
default: DEFAULT_CONFIG_PATH
|
||||
}
|
||||
})
|
||||
.commandDir('checkpoint-cmds', { extensions: ['ts', 'js'], exclude: /([a-zA-Z0-9\s_\\.\-:])+(.d.ts)$/ })
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.argv;
|
||||
};
|
||||
|
||||
main().then(() => {
|
||||
process.exit();
|
||||
}).catch(err => {
|
||||
log(err);
|
||||
});
|
28
packages/censures-watcher/src/cli/export-state.ts
Normal file
28
packages/censures-watcher/src/cli/export-state.ts
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { ExportStateCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { Indexer } from '../indexer';
|
||||
|
||||
const log = debug('vulcanize:export-state');
|
||||
|
||||
const main = async (): Promise<void> => {
|
||||
const exportStateCmd = new ExportStateCmd();
|
||||
await exportStateCmd.init(Database);
|
||||
|
||||
await exportStateCmd.initIndexer(Indexer);
|
||||
|
||||
await exportStateCmd.exec();
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit(0);
|
||||
});
|
29
packages/censures-watcher/src/cli/import-state.ts
Normal file
29
packages/censures-watcher/src/cli/import-state.ts
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { ImportStateCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { Indexer } from '../indexer';
|
||||
import { State } from '../entity/State';
|
||||
|
||||
const log = debug('vulcanize:import-state');
|
||||
|
||||
export const main = async (): Promise<any> => {
|
||||
const importStateCmd = new ImportStateCmd();
|
||||
await importStateCmd.init(Database);
|
||||
|
||||
await importStateCmd.initIndexer(Indexer);
|
||||
|
||||
await importStateCmd.exec(State);
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit(0);
|
||||
});
|
28
packages/censures-watcher/src/cli/index-block.ts
Normal file
28
packages/censures-watcher/src/cli/index-block.ts
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright 2022 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { IndexBlockCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { Indexer } from '../indexer';
|
||||
|
||||
const log = debug('vulcanize:index-block');
|
||||
|
||||
const main = async (): Promise<void> => {
|
||||
const indexBlockCmd = new IndexBlockCmd();
|
||||
await indexBlockCmd.init(Database);
|
||||
|
||||
await indexBlockCmd.initIndexer(Indexer);
|
||||
|
||||
await indexBlockCmd.exec();
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit(0);
|
||||
});
|
28
packages/censures-watcher/src/cli/inspect-cid.ts
Normal file
28
packages/censures-watcher/src/cli/inspect-cid.ts
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { InspectCIDCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { Indexer } from '../indexer';
|
||||
|
||||
const log = debug('vulcanize:inspect-cid');
|
||||
|
||||
const main = async (): Promise<void> => {
|
||||
const inspectCIDCmd = new InspectCIDCmd();
|
||||
await inspectCIDCmd.init(Database);
|
||||
|
||||
await inspectCIDCmd.initIndexer(Indexer);
|
||||
|
||||
await inspectCIDCmd.exec();
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit(0);
|
||||
});
|
22
packages/censures-watcher/src/cli/reset-cmds/job-queue.ts
Normal file
22
packages/censures-watcher/src/cli/reset-cmds/job-queue.ts
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import debug from 'debug';
|
||||
|
||||
import { getConfig, resetJobs, Config } from '@cerc-io/util';
|
||||
|
||||
const log = debug('vulcanize:reset-job-queue');
|
||||
|
||||
export const command = 'job-queue';
|
||||
|
||||
export const desc = 'Reset job queue';
|
||||
|
||||
export const builder = {};
|
||||
|
||||
export const handler = async (argv: any): Promise<void> => {
|
||||
const config: Config = await getConfig(argv.configFile);
|
||||
await resetJobs(config);
|
||||
|
||||
log('Job queue reset successfully');
|
||||
};
|
24
packages/censures-watcher/src/cli/reset-cmds/state.ts
Normal file
24
packages/censures-watcher/src/cli/reset-cmds/state.ts
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright 2022 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { ResetStateCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../../database';
|
||||
|
||||
export const command = 'state';
|
||||
|
||||
export const desc = 'Reset State to a given block number';
|
||||
|
||||
export const builder = {
|
||||
blockNumber: {
|
||||
type: 'number'
|
||||
}
|
||||
};
|
||||
|
||||
export const handler = async (argv: any): Promise<void> => {
|
||||
const resetStateCmd = new ResetStateCmd();
|
||||
await resetStateCmd.init(argv, Database);
|
||||
|
||||
await resetStateCmd.exec();
|
||||
};
|
27
packages/censures-watcher/src/cli/reset-cmds/watcher.ts
Normal file
27
packages/censures-watcher/src/cli/reset-cmds/watcher.ts
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { ResetWatcherCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../../database';
|
||||
import { Indexer } from '../../indexer';
|
||||
|
||||
export const command = 'watcher';
|
||||
|
||||
export const desc = 'Reset watcher to a block number';
|
||||
|
||||
export const builder = {
|
||||
blockNumber: {
|
||||
type: 'number'
|
||||
}
|
||||
};
|
||||
|
||||
export const handler = async (argv: any): Promise<void> => {
|
||||
const resetWatcherCmd = new ResetWatcherCmd();
|
||||
await resetWatcherCmd.init(argv, Database);
|
||||
|
||||
await resetWatcherCmd.initIndexer(Indexer);
|
||||
|
||||
await resetWatcherCmd.exec();
|
||||
};
|
24
packages/censures-watcher/src/cli/reset.ts
Normal file
24
packages/censures-watcher/src/cli/reset.ts
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { getResetYargs } from '@cerc-io/util';
|
||||
|
||||
const log = debug('vulcanize:reset');
|
||||
|
||||
const main = async () => {
|
||||
return getResetYargs()
|
||||
.commandDir('reset-cmds', { extensions: ['ts', 'js'], exclude: /([a-zA-Z0-9\s_\\.\-:])+(.d.ts)$/ })
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.argv;
|
||||
};
|
||||
|
||||
main().then(() => {
|
||||
process.exit();
|
||||
}).catch(err => {
|
||||
log(err);
|
||||
});
|
28
packages/censures-watcher/src/cli/watch-contract.ts
Normal file
28
packages/censures-watcher/src/cli/watch-contract.ts
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { WatchContractCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { Indexer } from '../indexer';
|
||||
|
||||
const log = debug('vulcanize:watch-contract');
|
||||
|
||||
const main = async (): Promise<void> => {
|
||||
const watchContractCmd = new WatchContractCmd();
|
||||
await watchContractCmd.init(Database);
|
||||
|
||||
await watchContractCmd.initIndexer(Indexer);
|
||||
|
||||
await watchContractCmd.exec();
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit(0);
|
||||
});
|
388
packages/censures-watcher/src/client.ts
Normal file
388
packages/censures-watcher/src/client.ts
Normal file
@ -0,0 +1,388 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { gql } from '@apollo/client/core';
|
||||
import { GraphQLClient, GraphQLConfig } from '@cerc-io/ipld-eth-client';
|
||||
|
||||
import { queries, mutations, subscriptions } from './gql';
|
||||
|
||||
export class Client {
|
||||
_config: GraphQLConfig;
|
||||
_client: GraphQLClient;
|
||||
|
||||
constructor (config: GraphQLConfig) {
|
||||
this._config = config;
|
||||
|
||||
this._client = new GraphQLClient(config);
|
||||
}
|
||||
|
||||
async getIsActive (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { isActive } = await this._client.query(
|
||||
gql(queries.isActive),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return isActive;
|
||||
}
|
||||
|
||||
async getGetKeyRevisionNumber (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getKeyRevisionNumber } = await this._client.query(
|
||||
gql(queries.getKeyRevisionNumber),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getKeyRevisionNumber;
|
||||
}
|
||||
|
||||
async getHasBeenLinked (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { hasBeenLinked } = await this._client.query(
|
||||
gql(queries.hasBeenLinked),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return hasBeenLinked;
|
||||
}
|
||||
|
||||
async getIsLive (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { isLive } = await this._client.query(
|
||||
gql(queries.isLive),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return isLive;
|
||||
}
|
||||
|
||||
async getGetContinuityNumber (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getContinuityNumber } = await this._client.query(
|
||||
gql(queries.getContinuityNumber),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getContinuityNumber;
|
||||
}
|
||||
|
||||
async getGetSpawnCount (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getSpawnCount } = await this._client.query(
|
||||
gql(queries.getSpawnCount),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getSpawnCount;
|
||||
}
|
||||
|
||||
async getHasSponsor (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { hasSponsor } = await this._client.query(
|
||||
gql(queries.hasSponsor),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return hasSponsor;
|
||||
}
|
||||
|
||||
async getGetSponsor (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getSponsor } = await this._client.query(
|
||||
gql(queries.getSponsor),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getSponsor;
|
||||
}
|
||||
|
||||
async getIsSponsor (blockHash: string, contractAddress: string, _point: number, _sponsor: number): Promise<any> {
|
||||
const { isSponsor } = await this._client.query(
|
||||
gql(queries.isSponsor),
|
||||
{ blockHash, contractAddress, _point, _sponsor }
|
||||
);
|
||||
|
||||
return isSponsor;
|
||||
}
|
||||
|
||||
async getGetSponsoringCount (blockHash: string, contractAddress: string, _sponsor: number): Promise<any> {
|
||||
const { getSponsoringCount } = await this._client.query(
|
||||
gql(queries.getSponsoringCount),
|
||||
{ blockHash, contractAddress, _sponsor }
|
||||
);
|
||||
|
||||
return getSponsoringCount;
|
||||
}
|
||||
|
||||
async getIsEscaping (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { isEscaping } = await this._client.query(
|
||||
gql(queries.isEscaping),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return isEscaping;
|
||||
}
|
||||
|
||||
async getGetEscapeRequest (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getEscapeRequest } = await this._client.query(
|
||||
gql(queries.getEscapeRequest),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getEscapeRequest;
|
||||
}
|
||||
|
||||
async getIsRequestingEscapeTo (blockHash: string, contractAddress: string, _point: number, _sponsor: number): Promise<any> {
|
||||
const { isRequestingEscapeTo } = await this._client.query(
|
||||
gql(queries.isRequestingEscapeTo),
|
||||
{ blockHash, contractAddress, _point, _sponsor }
|
||||
);
|
||||
|
||||
return isRequestingEscapeTo;
|
||||
}
|
||||
|
||||
async getGetEscapeRequestsCount (blockHash: string, contractAddress: string, _sponsor: number): Promise<any> {
|
||||
const { getEscapeRequestsCount } = await this._client.query(
|
||||
gql(queries.getEscapeRequestsCount),
|
||||
{ blockHash, contractAddress, _sponsor }
|
||||
);
|
||||
|
||||
return getEscapeRequestsCount;
|
||||
}
|
||||
|
||||
async getGetOwner (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getOwner } = await this._client.query(
|
||||
gql(queries.getOwner),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getOwner;
|
||||
}
|
||||
|
||||
async getIsOwner (blockHash: string, contractAddress: string, _point: number, _address: string): Promise<any> {
|
||||
const { isOwner } = await this._client.query(
|
||||
gql(queries.isOwner),
|
||||
{ blockHash, contractAddress, _point, _address }
|
||||
);
|
||||
|
||||
return isOwner;
|
||||
}
|
||||
|
||||
async getGetOwnedPointCount (blockHash: string, contractAddress: string, _whose: string): Promise<any> {
|
||||
const { getOwnedPointCount } = await this._client.query(
|
||||
gql(queries.getOwnedPointCount),
|
||||
{ blockHash, contractAddress, _whose }
|
||||
);
|
||||
|
||||
return getOwnedPointCount;
|
||||
}
|
||||
|
||||
async getGetOwnedPointAtIndex (blockHash: string, contractAddress: string, _whose: string, _index: bigint): Promise<any> {
|
||||
const { getOwnedPointAtIndex } = await this._client.query(
|
||||
gql(queries.getOwnedPointAtIndex),
|
||||
{ blockHash, contractAddress, _whose, _index }
|
||||
);
|
||||
|
||||
return getOwnedPointAtIndex;
|
||||
}
|
||||
|
||||
async getGetManagementProxy (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getManagementProxy } = await this._client.query(
|
||||
gql(queries.getManagementProxy),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getManagementProxy;
|
||||
}
|
||||
|
||||
async getIsManagementProxy (blockHash: string, contractAddress: string, _point: number, _proxy: string): Promise<any> {
|
||||
const { isManagementProxy } = await this._client.query(
|
||||
gql(queries.isManagementProxy),
|
||||
{ blockHash, contractAddress, _point, _proxy }
|
||||
);
|
||||
|
||||
return isManagementProxy;
|
||||
}
|
||||
|
||||
async getCanManage (blockHash: string, contractAddress: string, _point: number, _who: string): Promise<any> {
|
||||
const { canManage } = await this._client.query(
|
||||
gql(queries.canManage),
|
||||
{ blockHash, contractAddress, _point, _who }
|
||||
);
|
||||
|
||||
return canManage;
|
||||
}
|
||||
|
||||
async getGetManagerForCount (blockHash: string, contractAddress: string, _proxy: string): Promise<any> {
|
||||
const { getManagerForCount } = await this._client.query(
|
||||
gql(queries.getManagerForCount),
|
||||
{ blockHash, contractAddress, _proxy }
|
||||
);
|
||||
|
||||
return getManagerForCount;
|
||||
}
|
||||
|
||||
async getGetSpawnProxy (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getSpawnProxy } = await this._client.query(
|
||||
gql(queries.getSpawnProxy),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getSpawnProxy;
|
||||
}
|
||||
|
||||
async getIsSpawnProxy (blockHash: string, contractAddress: string, _point: number, _proxy: string): Promise<any> {
|
||||
const { isSpawnProxy } = await this._client.query(
|
||||
gql(queries.isSpawnProxy),
|
||||
{ blockHash, contractAddress, _point, _proxy }
|
||||
);
|
||||
|
||||
return isSpawnProxy;
|
||||
}
|
||||
|
||||
async getCanSpawnAs (blockHash: string, contractAddress: string, _point: number, _who: string): Promise<any> {
|
||||
const { canSpawnAs } = await this._client.query(
|
||||
gql(queries.canSpawnAs),
|
||||
{ blockHash, contractAddress, _point, _who }
|
||||
);
|
||||
|
||||
return canSpawnAs;
|
||||
}
|
||||
|
||||
async getGetSpawningForCount (blockHash: string, contractAddress: string, _proxy: string): Promise<any> {
|
||||
const { getSpawningForCount } = await this._client.query(
|
||||
gql(queries.getSpawningForCount),
|
||||
{ blockHash, contractAddress, _proxy }
|
||||
);
|
||||
|
||||
return getSpawningForCount;
|
||||
}
|
||||
|
||||
async getGetVotingProxy (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getVotingProxy } = await this._client.query(
|
||||
gql(queries.getVotingProxy),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getVotingProxy;
|
||||
}
|
||||
|
||||
async getIsVotingProxy (blockHash: string, contractAddress: string, _point: number, _proxy: string): Promise<any> {
|
||||
const { isVotingProxy } = await this._client.query(
|
||||
gql(queries.isVotingProxy),
|
||||
{ blockHash, contractAddress, _point, _proxy }
|
||||
);
|
||||
|
||||
return isVotingProxy;
|
||||
}
|
||||
|
||||
async getCanVoteAs (blockHash: string, contractAddress: string, _point: number, _who: string): Promise<any> {
|
||||
const { canVoteAs } = await this._client.query(
|
||||
gql(queries.canVoteAs),
|
||||
{ blockHash, contractAddress, _point, _who }
|
||||
);
|
||||
|
||||
return canVoteAs;
|
||||
}
|
||||
|
||||
async getGetVotingForCount (blockHash: string, contractAddress: string, _proxy: string): Promise<any> {
|
||||
const { getVotingForCount } = await this._client.query(
|
||||
gql(queries.getVotingForCount),
|
||||
{ blockHash, contractAddress, _proxy }
|
||||
);
|
||||
|
||||
return getVotingForCount;
|
||||
}
|
||||
|
||||
async getGetTransferProxy (blockHash: string, contractAddress: string, _point: number): Promise<any> {
|
||||
const { getTransferProxy } = await this._client.query(
|
||||
gql(queries.getTransferProxy),
|
||||
{ blockHash, contractAddress, _point }
|
||||
);
|
||||
|
||||
return getTransferProxy;
|
||||
}
|
||||
|
||||
async getIsTransferProxy (blockHash: string, contractAddress: string, _point: number, _proxy: string): Promise<any> {
|
||||
const { isTransferProxy } = await this._client.query(
|
||||
gql(queries.isTransferProxy),
|
||||
{ blockHash, contractAddress, _point, _proxy }
|
||||
);
|
||||
|
||||
return isTransferProxy;
|
||||
}
|
||||
|
||||
async getCanTransfer (blockHash: string, contractAddress: string, _point: number, _who: string): Promise<any> {
|
||||
const { canTransfer } = await this._client.query(
|
||||
gql(queries.canTransfer),
|
||||
{ blockHash, contractAddress, _point, _who }
|
||||
);
|
||||
|
||||
return canTransfer;
|
||||
}
|
||||
|
||||
async getGetTransferringForCount (blockHash: string, contractAddress: string, _proxy: string): Promise<any> {
|
||||
const { getTransferringForCount } = await this._client.query(
|
||||
gql(queries.getTransferringForCount),
|
||||
{ blockHash, contractAddress, _proxy }
|
||||
);
|
||||
|
||||
return getTransferringForCount;
|
||||
}
|
||||
|
||||
async getIsOperator (blockHash: string, contractAddress: string, _owner: string, _operator: string): Promise<any> {
|
||||
const { isOperator } = await this._client.query(
|
||||
gql(queries.isOperator),
|
||||
{ blockHash, contractAddress, _owner, _operator }
|
||||
);
|
||||
|
||||
return isOperator;
|
||||
}
|
||||
|
||||
async getGetCensuringCount (blockHash: string, contractAddress: string, _whose: number): Promise<any> {
|
||||
const { getCensuringCount } = await this._client.query(
|
||||
gql(queries.getCensuringCount),
|
||||
{ blockHash, contractAddress, _whose }
|
||||
);
|
||||
|
||||
return getCensuringCount;
|
||||
}
|
||||
|
||||
async getGetCensuredByCount (blockHash: string, contractAddress: string, _who: number): Promise<any> {
|
||||
const { getCensuredByCount } = await this._client.query(
|
||||
gql(queries.getCensuredByCount),
|
||||
{ blockHash, contractAddress, _who }
|
||||
);
|
||||
|
||||
return getCensuredByCount;
|
||||
}
|
||||
|
||||
async getEvents (blockHash: string, contractAddress: string, name: string): Promise<any> {
|
||||
const { events } = await this._client.query(
|
||||
gql(queries.events),
|
||||
{ blockHash, contractAddress, name }
|
||||
);
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
async getEventsInRange (fromBlockNumber: number, toBlockNumber: number): Promise<any> {
|
||||
const { eventsInRange } = await this._client.query(
|
||||
gql(queries.eventsInRange),
|
||||
{ fromBlockNumber, toBlockNumber }
|
||||
);
|
||||
|
||||
return eventsInRange;
|
||||
}
|
||||
|
||||
async watchContract (contractAddress: string, startingBlock?: number): Promise<any> {
|
||||
const { watchContract } = await this._client.mutate(
|
||||
gql(mutations.watchContract),
|
||||
{ contractAddress, startingBlock }
|
||||
);
|
||||
|
||||
return watchContract;
|
||||
}
|
||||
|
||||
async watchEvents (onNext: (value: any) => void): Promise<ZenObservable.Subscription> {
|
||||
return this._client.subscribe(
|
||||
gql(subscriptions.onEvent),
|
||||
({ data }) => {
|
||||
onNext(data.onEvent);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
905
packages/censures-watcher/src/database.ts
Normal file
905
packages/censures-watcher/src/database.ts
Normal file
@ -0,0 +1,905 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import assert from 'assert';
|
||||
import { Connection, ConnectionOptions, DeepPartial, FindConditions, QueryRunner, FindManyOptions, EntityTarget } from 'typeorm';
|
||||
import path from 'path';
|
||||
|
||||
import {
|
||||
Database as BaseDatabase,
|
||||
DatabaseInterface,
|
||||
QueryOptions,
|
||||
StateKind,
|
||||
Where
|
||||
} from '@cerc-io/util';
|
||||
|
||||
import { Contract } from './entity/Contract';
|
||||
import { Event } from './entity/Event';
|
||||
import { SyncStatus } from './entity/SyncStatus';
|
||||
import { StateSyncStatus } from './entity/StateSyncStatus';
|
||||
import { BlockProgress } from './entity/BlockProgress';
|
||||
import { State } from './entity/State';
|
||||
import { IsActive } from './entity/IsActive';
|
||||
import { GetKeyRevisionNumber } from './entity/GetKeyRevisionNumber';
|
||||
import { HasBeenLinked } from './entity/HasBeenLinked';
|
||||
import { IsLive } from './entity/IsLive';
|
||||
import { GetContinuityNumber } from './entity/GetContinuityNumber';
|
||||
import { GetSpawnCount } from './entity/GetSpawnCount';
|
||||
import { HasSponsor } from './entity/HasSponsor';
|
||||
import { GetSponsor } from './entity/GetSponsor';
|
||||
import { IsSponsor } from './entity/IsSponsor';
|
||||
import { GetSponsoringCount } from './entity/GetSponsoringCount';
|
||||
import { IsEscaping } from './entity/IsEscaping';
|
||||
import { GetEscapeRequest } from './entity/GetEscapeRequest';
|
||||
import { IsRequestingEscapeTo } from './entity/IsRequestingEscapeTo';
|
||||
import { GetEscapeRequestsCount } from './entity/GetEscapeRequestsCount';
|
||||
import { GetOwner } from './entity/GetOwner';
|
||||
import { IsOwner } from './entity/IsOwner';
|
||||
import { GetOwnedPointCount } from './entity/GetOwnedPointCount';
|
||||
import { GetOwnedPointAtIndex } from './entity/GetOwnedPointAtIndex';
|
||||
import { GetManagementProxy } from './entity/GetManagementProxy';
|
||||
import { IsManagementProxy } from './entity/IsManagementProxy';
|
||||
import { CanManage } from './entity/CanManage';
|
||||
import { GetManagerForCount } from './entity/GetManagerForCount';
|
||||
import { GetSpawnProxy } from './entity/GetSpawnProxy';
|
||||
import { IsSpawnProxy } from './entity/IsSpawnProxy';
|
||||
import { CanSpawnAs } from './entity/CanSpawnAs';
|
||||
import { GetSpawningForCount } from './entity/GetSpawningForCount';
|
||||
import { GetVotingProxy } from './entity/GetVotingProxy';
|
||||
import { IsVotingProxy } from './entity/IsVotingProxy';
|
||||
import { CanVoteAs } from './entity/CanVoteAs';
|
||||
import { GetVotingForCount } from './entity/GetVotingForCount';
|
||||
import { GetTransferProxy } from './entity/GetTransferProxy';
|
||||
import { IsTransferProxy } from './entity/IsTransferProxy';
|
||||
import { CanTransfer } from './entity/CanTransfer';
|
||||
import { GetTransferringForCount } from './entity/GetTransferringForCount';
|
||||
import { IsOperator } from './entity/IsOperator';
|
||||
import { GetCensuringCount } from './entity/GetCensuringCount';
|
||||
import { GetCensuredByCount } from './entity/GetCensuredByCount';
|
||||
|
||||
export const ENTITIES = [IsActive, GetKeyRevisionNumber, HasBeenLinked, IsLive, GetContinuityNumber, GetSpawnCount, HasSponsor, GetSponsor, IsSponsor, GetSponsoringCount, IsEscaping, GetEscapeRequest, IsRequestingEscapeTo, GetEscapeRequestsCount, GetOwner, IsOwner, GetOwnedPointCount, GetOwnedPointAtIndex, GetManagementProxy, IsManagementProxy, CanManage, GetManagerForCount, GetSpawnProxy, IsSpawnProxy, CanSpawnAs, GetSpawningForCount, GetVotingProxy, IsVotingProxy, CanVoteAs, GetVotingForCount, GetTransferProxy, IsTransferProxy, CanTransfer, GetTransferringForCount, IsOperator, GetCensuringCount, GetCensuredByCount];
|
||||
|
||||
export class Database implements DatabaseInterface {
|
||||
_config: ConnectionOptions;
|
||||
_conn!: Connection;
|
||||
_baseDatabase: BaseDatabase;
|
||||
_propColMaps: { [key: string]: Map<string, string>; };
|
||||
|
||||
constructor (config: ConnectionOptions) {
|
||||
assert(config);
|
||||
|
||||
this._config = {
|
||||
...config,
|
||||
entities: [path.join(__dirname, 'entity/*')]
|
||||
};
|
||||
|
||||
this._baseDatabase = new BaseDatabase(this._config);
|
||||
this._propColMaps = {};
|
||||
}
|
||||
|
||||
get baseDatabase (): BaseDatabase {
|
||||
return this._baseDatabase;
|
||||
}
|
||||
|
||||
async init (): Promise<void> {
|
||||
this._conn = await this._baseDatabase.init();
|
||||
this._setPropColMaps();
|
||||
}
|
||||
|
||||
async close (): Promise<void> {
|
||||
return this._baseDatabase.close();
|
||||
}
|
||||
|
||||
async getIsActive ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<IsActive | undefined> {
|
||||
return this._conn.getRepository(IsActive)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getGetKeyRevisionNumber ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetKeyRevisionNumber | undefined> {
|
||||
return this._conn.getRepository(GetKeyRevisionNumber)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getHasBeenLinked ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<HasBeenLinked | undefined> {
|
||||
return this._conn.getRepository(HasBeenLinked)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsLive ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<IsLive | undefined> {
|
||||
return this._conn.getRepository(IsLive)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getGetContinuityNumber ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetContinuityNumber | undefined> {
|
||||
return this._conn.getRepository(GetContinuityNumber)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getGetSpawnCount ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetSpawnCount | undefined> {
|
||||
return this._conn.getRepository(GetSpawnCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getHasSponsor ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<HasSponsor | undefined> {
|
||||
return this._conn.getRepository(HasSponsor)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getGetSponsor ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetSponsor | undefined> {
|
||||
return this._conn.getRepository(GetSponsor)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsSponsor ({ blockHash, contractAddress, _point, _sponsor }: { blockHash: string, contractAddress: string, _point: number, _sponsor: number }): Promise<IsSponsor | undefined> {
|
||||
return this._conn.getRepository(IsSponsor)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_sponsor
|
||||
});
|
||||
}
|
||||
|
||||
async getGetSponsoringCount ({ blockHash, contractAddress, _sponsor }: { blockHash: string, contractAddress: string, _sponsor: number }): Promise<GetSponsoringCount | undefined> {
|
||||
return this._conn.getRepository(GetSponsoringCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_sponsor
|
||||
});
|
||||
}
|
||||
|
||||
async getIsEscaping ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<IsEscaping | undefined> {
|
||||
return this._conn.getRepository(IsEscaping)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getGetEscapeRequest ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetEscapeRequest | undefined> {
|
||||
return this._conn.getRepository(GetEscapeRequest)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsRequestingEscapeTo ({ blockHash, contractAddress, _point, _sponsor }: { blockHash: string, contractAddress: string, _point: number, _sponsor: number }): Promise<IsRequestingEscapeTo | undefined> {
|
||||
return this._conn.getRepository(IsRequestingEscapeTo)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_sponsor
|
||||
});
|
||||
}
|
||||
|
||||
async getGetEscapeRequestsCount ({ blockHash, contractAddress, _sponsor }: { blockHash: string, contractAddress: string, _sponsor: number }): Promise<GetEscapeRequestsCount | undefined> {
|
||||
return this._conn.getRepository(GetEscapeRequestsCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_sponsor
|
||||
});
|
||||
}
|
||||
|
||||
async getGetOwner ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetOwner | undefined> {
|
||||
return this._conn.getRepository(GetOwner)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsOwner ({ blockHash, contractAddress, _point, _address }: { blockHash: string, contractAddress: string, _point: number, _address: string }): Promise<IsOwner | undefined> {
|
||||
return this._conn.getRepository(IsOwner)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_address
|
||||
});
|
||||
}
|
||||
|
||||
async getGetOwnedPointCount ({ blockHash, contractAddress, _whose }: { blockHash: string, contractAddress: string, _whose: string }): Promise<GetOwnedPointCount | undefined> {
|
||||
return this._conn.getRepository(GetOwnedPointCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_whose
|
||||
});
|
||||
}
|
||||
|
||||
async getGetOwnedPointAtIndex ({ blockHash, contractAddress, _whose, _index }: { blockHash: string, contractAddress: string, _whose: string, _index: bigint }): Promise<GetOwnedPointAtIndex | undefined> {
|
||||
return this._conn.getRepository(GetOwnedPointAtIndex)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_whose,
|
||||
_index
|
||||
});
|
||||
}
|
||||
|
||||
async getGetManagementProxy ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetManagementProxy | undefined> {
|
||||
return this._conn.getRepository(GetManagementProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsManagementProxy ({ blockHash, contractAddress, _point, _proxy }: { blockHash: string, contractAddress: string, _point: number, _proxy: string }): Promise<IsManagementProxy | undefined> {
|
||||
return this._conn.getRepository(IsManagementProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getCanManage ({ blockHash, contractAddress, _point, _who }: { blockHash: string, contractAddress: string, _point: number, _who: string }): Promise<CanManage | undefined> {
|
||||
return this._conn.getRepository(CanManage)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_who
|
||||
});
|
||||
}
|
||||
|
||||
async getGetManagerForCount ({ blockHash, contractAddress, _proxy }: { blockHash: string, contractAddress: string, _proxy: string }): Promise<GetManagerForCount | undefined> {
|
||||
return this._conn.getRepository(GetManagerForCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getGetSpawnProxy ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetSpawnProxy | undefined> {
|
||||
return this._conn.getRepository(GetSpawnProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsSpawnProxy ({ blockHash, contractAddress, _point, _proxy }: { blockHash: string, contractAddress: string, _point: number, _proxy: string }): Promise<IsSpawnProxy | undefined> {
|
||||
return this._conn.getRepository(IsSpawnProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getCanSpawnAs ({ blockHash, contractAddress, _point, _who }: { blockHash: string, contractAddress: string, _point: number, _who: string }): Promise<CanSpawnAs | undefined> {
|
||||
return this._conn.getRepository(CanSpawnAs)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_who
|
||||
});
|
||||
}
|
||||
|
||||
async getGetSpawningForCount ({ blockHash, contractAddress, _proxy }: { blockHash: string, contractAddress: string, _proxy: string }): Promise<GetSpawningForCount | undefined> {
|
||||
return this._conn.getRepository(GetSpawningForCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getGetVotingProxy ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetVotingProxy | undefined> {
|
||||
return this._conn.getRepository(GetVotingProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsVotingProxy ({ blockHash, contractAddress, _point, _proxy }: { blockHash: string, contractAddress: string, _point: number, _proxy: string }): Promise<IsVotingProxy | undefined> {
|
||||
return this._conn.getRepository(IsVotingProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getCanVoteAs ({ blockHash, contractAddress, _point, _who }: { blockHash: string, contractAddress: string, _point: number, _who: string }): Promise<CanVoteAs | undefined> {
|
||||
return this._conn.getRepository(CanVoteAs)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_who
|
||||
});
|
||||
}
|
||||
|
||||
async getGetVotingForCount ({ blockHash, contractAddress, _proxy }: { blockHash: string, contractAddress: string, _proxy: string }): Promise<GetVotingForCount | undefined> {
|
||||
return this._conn.getRepository(GetVotingForCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getGetTransferProxy ({ blockHash, contractAddress, _point }: { blockHash: string, contractAddress: string, _point: number }): Promise<GetTransferProxy | undefined> {
|
||||
return this._conn.getRepository(GetTransferProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point
|
||||
});
|
||||
}
|
||||
|
||||
async getIsTransferProxy ({ blockHash, contractAddress, _point, _proxy }: { blockHash: string, contractAddress: string, _point: number, _proxy: string }): Promise<IsTransferProxy | undefined> {
|
||||
return this._conn.getRepository(IsTransferProxy)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getCanTransfer ({ blockHash, contractAddress, _point, _who }: { blockHash: string, contractAddress: string, _point: number, _who: string }): Promise<CanTransfer | undefined> {
|
||||
return this._conn.getRepository(CanTransfer)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_point,
|
||||
_who
|
||||
});
|
||||
}
|
||||
|
||||
async getGetTransferringForCount ({ blockHash, contractAddress, _proxy }: { blockHash: string, contractAddress: string, _proxy: string }): Promise<GetTransferringForCount | undefined> {
|
||||
return this._conn.getRepository(GetTransferringForCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_proxy
|
||||
});
|
||||
}
|
||||
|
||||
async getIsOperator ({ blockHash, contractAddress, _owner, _operator }: { blockHash: string, contractAddress: string, _owner: string, _operator: string }): Promise<IsOperator | undefined> {
|
||||
return this._conn.getRepository(IsOperator)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_owner,
|
||||
_operator
|
||||
});
|
||||
}
|
||||
|
||||
async getGetCensuringCount ({ blockHash, contractAddress, _whose }: { blockHash: string, contractAddress: string, _whose: number }): Promise<GetCensuringCount | undefined> {
|
||||
return this._conn.getRepository(GetCensuringCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_whose
|
||||
});
|
||||
}
|
||||
|
||||
async getGetCensuredByCount ({ blockHash, contractAddress, _who }: { blockHash: string, contractAddress: string, _who: number }): Promise<GetCensuredByCount | undefined> {
|
||||
return this._conn.getRepository(GetCensuredByCount)
|
||||
.findOne({
|
||||
blockHash,
|
||||
contractAddress,
|
||||
_who
|
||||
});
|
||||
}
|
||||
|
||||
async saveIsActive ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<IsActive>): Promise<IsActive> {
|
||||
const repo = this._conn.getRepository(IsActive);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetKeyRevisionNumber ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetKeyRevisionNumber>): Promise<GetKeyRevisionNumber> {
|
||||
const repo = this._conn.getRepository(GetKeyRevisionNumber);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveHasBeenLinked ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<HasBeenLinked>): Promise<HasBeenLinked> {
|
||||
const repo = this._conn.getRepository(HasBeenLinked);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsLive ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<IsLive>): Promise<IsLive> {
|
||||
const repo = this._conn.getRepository(IsLive);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetContinuityNumber ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetContinuityNumber>): Promise<GetContinuityNumber> {
|
||||
const repo = this._conn.getRepository(GetContinuityNumber);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetSpawnCount ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetSpawnCount>): Promise<GetSpawnCount> {
|
||||
const repo = this._conn.getRepository(GetSpawnCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveHasSponsor ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<HasSponsor>): Promise<HasSponsor> {
|
||||
const repo = this._conn.getRepository(HasSponsor);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetSponsor ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetSponsor>): Promise<GetSponsor> {
|
||||
const repo = this._conn.getRepository(GetSponsor);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsSponsor ({ blockHash, blockNumber, contractAddress, _point, _sponsor, value, proof }: DeepPartial<IsSponsor>): Promise<IsSponsor> {
|
||||
const repo = this._conn.getRepository(IsSponsor);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _sponsor, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetSponsoringCount ({ blockHash, blockNumber, contractAddress, _sponsor, value, proof }: DeepPartial<GetSponsoringCount>): Promise<GetSponsoringCount> {
|
||||
const repo = this._conn.getRepository(GetSponsoringCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _sponsor, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsEscaping ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<IsEscaping>): Promise<IsEscaping> {
|
||||
const repo = this._conn.getRepository(IsEscaping);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetEscapeRequest ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetEscapeRequest>): Promise<GetEscapeRequest> {
|
||||
const repo = this._conn.getRepository(GetEscapeRequest);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsRequestingEscapeTo ({ blockHash, blockNumber, contractAddress, _point, _sponsor, value, proof }: DeepPartial<IsRequestingEscapeTo>): Promise<IsRequestingEscapeTo> {
|
||||
const repo = this._conn.getRepository(IsRequestingEscapeTo);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _sponsor, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetEscapeRequestsCount ({ blockHash, blockNumber, contractAddress, _sponsor, value, proof }: DeepPartial<GetEscapeRequestsCount>): Promise<GetEscapeRequestsCount> {
|
||||
const repo = this._conn.getRepository(GetEscapeRequestsCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _sponsor, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetOwner ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetOwner>): Promise<GetOwner> {
|
||||
const repo = this._conn.getRepository(GetOwner);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsOwner ({ blockHash, blockNumber, contractAddress, _point, _address, value, proof }: DeepPartial<IsOwner>): Promise<IsOwner> {
|
||||
const repo = this._conn.getRepository(IsOwner);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _address, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetOwnedPointCount ({ blockHash, blockNumber, contractAddress, _whose, value, proof }: DeepPartial<GetOwnedPointCount>): Promise<GetOwnedPointCount> {
|
||||
const repo = this._conn.getRepository(GetOwnedPointCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _whose, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetOwnedPointAtIndex ({ blockHash, blockNumber, contractAddress, _whose, _index, value, proof }: DeepPartial<GetOwnedPointAtIndex>): Promise<GetOwnedPointAtIndex> {
|
||||
const repo = this._conn.getRepository(GetOwnedPointAtIndex);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _whose, _index, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetManagementProxy ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetManagementProxy>): Promise<GetManagementProxy> {
|
||||
const repo = this._conn.getRepository(GetManagementProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsManagementProxy ({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof }: DeepPartial<IsManagementProxy>): Promise<IsManagementProxy> {
|
||||
const repo = this._conn.getRepository(IsManagementProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveCanManage ({ blockHash, blockNumber, contractAddress, _point, _who, value, proof }: DeepPartial<CanManage>): Promise<CanManage> {
|
||||
const repo = this._conn.getRepository(CanManage);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _who, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetManagerForCount ({ blockHash, blockNumber, contractAddress, _proxy, value, proof }: DeepPartial<GetManagerForCount>): Promise<GetManagerForCount> {
|
||||
const repo = this._conn.getRepository(GetManagerForCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetSpawnProxy ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetSpawnProxy>): Promise<GetSpawnProxy> {
|
||||
const repo = this._conn.getRepository(GetSpawnProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsSpawnProxy ({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof }: DeepPartial<IsSpawnProxy>): Promise<IsSpawnProxy> {
|
||||
const repo = this._conn.getRepository(IsSpawnProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveCanSpawnAs ({ blockHash, blockNumber, contractAddress, _point, _who, value, proof }: DeepPartial<CanSpawnAs>): Promise<CanSpawnAs> {
|
||||
const repo = this._conn.getRepository(CanSpawnAs);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _who, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetSpawningForCount ({ blockHash, blockNumber, contractAddress, _proxy, value, proof }: DeepPartial<GetSpawningForCount>): Promise<GetSpawningForCount> {
|
||||
const repo = this._conn.getRepository(GetSpawningForCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetVotingProxy ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetVotingProxy>): Promise<GetVotingProxy> {
|
||||
const repo = this._conn.getRepository(GetVotingProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsVotingProxy ({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof }: DeepPartial<IsVotingProxy>): Promise<IsVotingProxy> {
|
||||
const repo = this._conn.getRepository(IsVotingProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveCanVoteAs ({ blockHash, blockNumber, contractAddress, _point, _who, value, proof }: DeepPartial<CanVoteAs>): Promise<CanVoteAs> {
|
||||
const repo = this._conn.getRepository(CanVoteAs);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _who, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetVotingForCount ({ blockHash, blockNumber, contractAddress, _proxy, value, proof }: DeepPartial<GetVotingForCount>): Promise<GetVotingForCount> {
|
||||
const repo = this._conn.getRepository(GetVotingForCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetTransferProxy ({ blockHash, blockNumber, contractAddress, _point, value, proof }: DeepPartial<GetTransferProxy>): Promise<GetTransferProxy> {
|
||||
const repo = this._conn.getRepository(GetTransferProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsTransferProxy ({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof }: DeepPartial<IsTransferProxy>): Promise<IsTransferProxy> {
|
||||
const repo = this._conn.getRepository(IsTransferProxy);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveCanTransfer ({ blockHash, blockNumber, contractAddress, _point, _who, value, proof }: DeepPartial<CanTransfer>): Promise<CanTransfer> {
|
||||
const repo = this._conn.getRepository(CanTransfer);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _point, _who, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetTransferringForCount ({ blockHash, blockNumber, contractAddress, _proxy, value, proof }: DeepPartial<GetTransferringForCount>): Promise<GetTransferringForCount> {
|
||||
const repo = this._conn.getRepository(GetTransferringForCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _proxy, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveIsOperator ({ blockHash, blockNumber, contractAddress, _owner, _operator, value, proof }: DeepPartial<IsOperator>): Promise<IsOperator> {
|
||||
const repo = this._conn.getRepository(IsOperator);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _owner, _operator, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetCensuringCount ({ blockHash, blockNumber, contractAddress, _whose, value, proof }: DeepPartial<GetCensuringCount>): Promise<GetCensuringCount> {
|
||||
const repo = this._conn.getRepository(GetCensuringCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _whose, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
async saveGetCensuredByCount ({ blockHash, blockNumber, contractAddress, _who, value, proof }: DeepPartial<GetCensuredByCount>): Promise<GetCensuredByCount> {
|
||||
const repo = this._conn.getRepository(GetCensuredByCount);
|
||||
const entity = repo.create({ blockHash, blockNumber, contractAddress, _who, value, proof });
|
||||
return repo.save(entity);
|
||||
}
|
||||
|
||||
getNewState (): State {
|
||||
return new State();
|
||||
}
|
||||
|
||||
async getStates (where: FindConditions<State>): Promise<State[]> {
|
||||
const repo = this._conn.getRepository(State);
|
||||
|
||||
return this._baseDatabase.getStates(repo, where);
|
||||
}
|
||||
|
||||
async getLatestState (contractAddress: string, kind: StateKind | null, blockNumber?: number): Promise<State | undefined> {
|
||||
const repo = this._conn.getRepository(State);
|
||||
|
||||
return this._baseDatabase.getLatestState(repo, contractAddress, kind, blockNumber);
|
||||
}
|
||||
|
||||
async getPrevState (blockHash: string, contractAddress: string, kind?: string): Promise<State | undefined> {
|
||||
const repo = this._conn.getRepository(State);
|
||||
|
||||
return this._baseDatabase.getPrevState(repo, blockHash, contractAddress, kind);
|
||||
}
|
||||
|
||||
// Fetch all diff States after the specified block number.
|
||||
async getDiffStatesInRange (contractAddress: string, startblock: number, endBlock: number): Promise<State[]> {
|
||||
const repo = this._conn.getRepository(State);
|
||||
|
||||
return this._baseDatabase.getDiffStatesInRange(repo, contractAddress, startblock, endBlock);
|
||||
}
|
||||
|
||||
async saveOrUpdateState (dbTx: QueryRunner, state: State): Promise<State> {
|
||||
const repo = dbTx.manager.getRepository(State);
|
||||
|
||||
return this._baseDatabase.saveOrUpdateState(repo, state);
|
||||
}
|
||||
|
||||
async removeStates (dbTx: QueryRunner, blockNumber: number, kind: string): Promise<void> {
|
||||
const repo = dbTx.manager.getRepository(State);
|
||||
|
||||
await this._baseDatabase.removeStates(repo, blockNumber, kind);
|
||||
}
|
||||
|
||||
async removeStatesAfterBlock (dbTx: QueryRunner, blockNumber: number): Promise<void> {
|
||||
const repo = dbTx.manager.getRepository(State);
|
||||
|
||||
await this._baseDatabase.removeStatesAfterBlock(repo, blockNumber);
|
||||
}
|
||||
|
||||
async getStateSyncStatus (): Promise<StateSyncStatus | undefined> {
|
||||
const repo = this._conn.getRepository(StateSyncStatus);
|
||||
|
||||
return this._baseDatabase.getStateSyncStatus(repo);
|
||||
}
|
||||
|
||||
async updateStateSyncStatusIndexedBlock (queryRunner: QueryRunner, blockNumber: number, force?: boolean): Promise<StateSyncStatus> {
|
||||
const repo = queryRunner.manager.getRepository(StateSyncStatus);
|
||||
|
||||
return this._baseDatabase.updateStateSyncStatusIndexedBlock(repo, blockNumber, force);
|
||||
}
|
||||
|
||||
async updateStateSyncStatusCheckpointBlock (queryRunner: QueryRunner, blockNumber: number, force?: boolean): Promise<StateSyncStatus> {
|
||||
const repo = queryRunner.manager.getRepository(StateSyncStatus);
|
||||
|
||||
return this._baseDatabase.updateStateSyncStatusCheckpointBlock(repo, blockNumber, force);
|
||||
}
|
||||
|
||||
async getContracts (): Promise<Contract[]> {
|
||||
const repo = this._conn.getRepository(Contract);
|
||||
|
||||
return this._baseDatabase.getContracts(repo);
|
||||
}
|
||||
|
||||
async createTransactionRunner (): Promise<QueryRunner> {
|
||||
return this._baseDatabase.createTransactionRunner();
|
||||
}
|
||||
|
||||
async getProcessedBlockCountForRange (fromBlockNumber: number, toBlockNumber: number): Promise<{ expected: number, actual: number }> {
|
||||
const repo = this._conn.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.getProcessedBlockCountForRange(repo, fromBlockNumber, toBlockNumber);
|
||||
}
|
||||
|
||||
async getEventsInRange (fromBlockNumber: number, toBlockNumber: number): Promise<Array<Event>> {
|
||||
const repo = this._conn.getRepository(Event);
|
||||
|
||||
return this._baseDatabase.getEventsInRange(repo, fromBlockNumber, toBlockNumber);
|
||||
}
|
||||
|
||||
async saveEventEntity (queryRunner: QueryRunner, entity: Event): Promise<Event> {
|
||||
const repo = queryRunner.manager.getRepository(Event);
|
||||
return this._baseDatabase.saveEventEntity(repo, entity);
|
||||
}
|
||||
|
||||
async getBlockEvents (blockHash: string, where: Where, queryOptions: QueryOptions): Promise<Event[]> {
|
||||
const repo = this._conn.getRepository(Event);
|
||||
|
||||
return this._baseDatabase.getBlockEvents(repo, blockHash, where, queryOptions);
|
||||
}
|
||||
|
||||
async saveBlockWithEvents (queryRunner: QueryRunner, block: DeepPartial<BlockProgress>, events: DeepPartial<Event>[]): Promise<BlockProgress> {
|
||||
const blockRepo = queryRunner.manager.getRepository(BlockProgress);
|
||||
const eventRepo = queryRunner.manager.getRepository(Event);
|
||||
|
||||
return this._baseDatabase.saveBlockWithEvents(blockRepo, eventRepo, block, events);
|
||||
}
|
||||
|
||||
async saveEvents (queryRunner: QueryRunner, events: Event[]): Promise<void> {
|
||||
const eventRepo = queryRunner.manager.getRepository(Event);
|
||||
|
||||
return this._baseDatabase.saveEvents(eventRepo, events);
|
||||
}
|
||||
|
||||
async saveBlockProgress (queryRunner: QueryRunner, block: DeepPartial<BlockProgress>): Promise<BlockProgress> {
|
||||
const repo = queryRunner.manager.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.saveBlockProgress(repo, block);
|
||||
}
|
||||
|
||||
async saveContract (queryRunner: QueryRunner, address: string, kind: string, checkpoint: boolean, startingBlock: number): Promise<Contract> {
|
||||
const repo = queryRunner.manager.getRepository(Contract);
|
||||
|
||||
return this._baseDatabase.saveContract(repo, address, kind, checkpoint, startingBlock);
|
||||
}
|
||||
|
||||
async updateSyncStatusIndexedBlock (queryRunner: QueryRunner, blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
||||
const repo = queryRunner.manager.getRepository(SyncStatus);
|
||||
|
||||
return this._baseDatabase.updateSyncStatusIndexedBlock(repo, blockHash, blockNumber, force);
|
||||
}
|
||||
|
||||
async updateSyncStatusCanonicalBlock (queryRunner: QueryRunner, blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
||||
const repo = queryRunner.manager.getRepository(SyncStatus);
|
||||
|
||||
return this._baseDatabase.updateSyncStatusCanonicalBlock(repo, blockHash, blockNumber, force);
|
||||
}
|
||||
|
||||
async updateSyncStatusChainHead (queryRunner: QueryRunner, blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
||||
const repo = queryRunner.manager.getRepository(SyncStatus);
|
||||
|
||||
return this._baseDatabase.updateSyncStatusChainHead(repo, blockHash, blockNumber, force);
|
||||
}
|
||||
|
||||
async getSyncStatus (queryRunner: QueryRunner): Promise<SyncStatus | undefined> {
|
||||
const repo = queryRunner.manager.getRepository(SyncStatus);
|
||||
|
||||
return this._baseDatabase.getSyncStatus(repo);
|
||||
}
|
||||
|
||||
async getEvent (id: string): Promise<Event | undefined> {
|
||||
const repo = this._conn.getRepository(Event);
|
||||
|
||||
return this._baseDatabase.getEvent(repo, id);
|
||||
}
|
||||
|
||||
async getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgress[]> {
|
||||
const repo = this._conn.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.getBlocksAtHeight(repo, height, isPruned);
|
||||
}
|
||||
|
||||
async markBlocksAsPruned (queryRunner: QueryRunner, blocks: BlockProgress[]): Promise<void> {
|
||||
const repo = queryRunner.manager.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.markBlocksAsPruned(repo, blocks);
|
||||
}
|
||||
|
||||
async getBlockProgress (blockHash: string): Promise<BlockProgress | undefined> {
|
||||
const repo = this._conn.getRepository(BlockProgress);
|
||||
return this._baseDatabase.getBlockProgress(repo, blockHash);
|
||||
}
|
||||
|
||||
async getBlockProgressEntities (where: FindConditions<BlockProgress>, options: FindManyOptions<BlockProgress>): Promise<BlockProgress[]> {
|
||||
const repo = this._conn.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.getBlockProgressEntities(repo, where, options);
|
||||
}
|
||||
|
||||
async getEntitiesForBlock (blockHash: string, tableName: string): Promise<any[]> {
|
||||
return this._baseDatabase.getEntitiesForBlock(blockHash, tableName);
|
||||
}
|
||||
|
||||
async updateBlockProgress (queryRunner: QueryRunner, block: BlockProgress, lastProcessedEventIndex: number): Promise<BlockProgress> {
|
||||
const repo = queryRunner.manager.getRepository(BlockProgress);
|
||||
|
||||
return this._baseDatabase.updateBlockProgress(repo, block, lastProcessedEventIndex);
|
||||
}
|
||||
|
||||
async removeEntities<Entity> (queryRunner: QueryRunner, entity: new () => Entity, findConditions?: FindManyOptions<Entity> | FindConditions<Entity>): Promise<void> {
|
||||
return this._baseDatabase.removeEntities(queryRunner, entity, findConditions);
|
||||
}
|
||||
|
||||
async deleteEntitiesByConditions<Entity> (queryRunner: QueryRunner, entity: EntityTarget<Entity>, findConditions: FindConditions<Entity>): Promise<void> {
|
||||
await this._baseDatabase.deleteEntitiesByConditions(queryRunner, entity, findConditions);
|
||||
}
|
||||
|
||||
async getAncestorAtDepth (blockHash: string, depth: number): Promise<string> {
|
||||
return this._baseDatabase.getAncestorAtDepth(blockHash, depth);
|
||||
}
|
||||
|
||||
_getPropertyColumnMapForEntity (entityName: string): Map<string, string> {
|
||||
return this._conn.getMetadata(entityName).ownColumns.reduce((acc, curr) => {
|
||||
return acc.set(curr.propertyName, curr.databaseName);
|
||||
}, new Map<string, string>());
|
||||
}
|
||||
|
||||
_setPropColMaps (): void {
|
||||
this._propColMaps.IsActive = this._getPropertyColumnMapForEntity('IsActive');
|
||||
this._propColMaps.GetKeyRevisionNumber = this._getPropertyColumnMapForEntity('GetKeyRevisionNumber');
|
||||
this._propColMaps.HasBeenLinked = this._getPropertyColumnMapForEntity('HasBeenLinked');
|
||||
this._propColMaps.IsLive = this._getPropertyColumnMapForEntity('IsLive');
|
||||
this._propColMaps.GetContinuityNumber = this._getPropertyColumnMapForEntity('GetContinuityNumber');
|
||||
this._propColMaps.GetSpawnCount = this._getPropertyColumnMapForEntity('GetSpawnCount');
|
||||
this._propColMaps.HasSponsor = this._getPropertyColumnMapForEntity('HasSponsor');
|
||||
this._propColMaps.GetSponsor = this._getPropertyColumnMapForEntity('GetSponsor');
|
||||
this._propColMaps.IsSponsor = this._getPropertyColumnMapForEntity('IsSponsor');
|
||||
this._propColMaps.GetSponsoringCount = this._getPropertyColumnMapForEntity('GetSponsoringCount');
|
||||
this._propColMaps.IsEscaping = this._getPropertyColumnMapForEntity('IsEscaping');
|
||||
this._propColMaps.GetEscapeRequest = this._getPropertyColumnMapForEntity('GetEscapeRequest');
|
||||
this._propColMaps.IsRequestingEscapeTo = this._getPropertyColumnMapForEntity('IsRequestingEscapeTo');
|
||||
this._propColMaps.GetEscapeRequestsCount = this._getPropertyColumnMapForEntity('GetEscapeRequestsCount');
|
||||
this._propColMaps.GetOwner = this._getPropertyColumnMapForEntity('GetOwner');
|
||||
this._propColMaps.IsOwner = this._getPropertyColumnMapForEntity('IsOwner');
|
||||
this._propColMaps.GetOwnedPointCount = this._getPropertyColumnMapForEntity('GetOwnedPointCount');
|
||||
this._propColMaps.GetOwnedPointAtIndex = this._getPropertyColumnMapForEntity('GetOwnedPointAtIndex');
|
||||
this._propColMaps.GetManagementProxy = this._getPropertyColumnMapForEntity('GetManagementProxy');
|
||||
this._propColMaps.IsManagementProxy = this._getPropertyColumnMapForEntity('IsManagementProxy');
|
||||
this._propColMaps.CanManage = this._getPropertyColumnMapForEntity('CanManage');
|
||||
this._propColMaps.GetManagerForCount = this._getPropertyColumnMapForEntity('GetManagerForCount');
|
||||
this._propColMaps.GetSpawnProxy = this._getPropertyColumnMapForEntity('GetSpawnProxy');
|
||||
this._propColMaps.IsSpawnProxy = this._getPropertyColumnMapForEntity('IsSpawnProxy');
|
||||
this._propColMaps.CanSpawnAs = this._getPropertyColumnMapForEntity('CanSpawnAs');
|
||||
this._propColMaps.GetSpawningForCount = this._getPropertyColumnMapForEntity('GetSpawningForCount');
|
||||
this._propColMaps.GetVotingProxy = this._getPropertyColumnMapForEntity('GetVotingProxy');
|
||||
this._propColMaps.IsVotingProxy = this._getPropertyColumnMapForEntity('IsVotingProxy');
|
||||
this._propColMaps.CanVoteAs = this._getPropertyColumnMapForEntity('CanVoteAs');
|
||||
this._propColMaps.GetVotingForCount = this._getPropertyColumnMapForEntity('GetVotingForCount');
|
||||
this._propColMaps.GetTransferProxy = this._getPropertyColumnMapForEntity('GetTransferProxy');
|
||||
this._propColMaps.IsTransferProxy = this._getPropertyColumnMapForEntity('IsTransferProxy');
|
||||
this._propColMaps.CanTransfer = this._getPropertyColumnMapForEntity('CanTransfer');
|
||||
this._propColMaps.GetTransferringForCount = this._getPropertyColumnMapForEntity('GetTransferringForCount');
|
||||
this._propColMaps.IsOperator = this._getPropertyColumnMapForEntity('IsOperator');
|
||||
this._propColMaps.GetCensuringCount = this._getPropertyColumnMapForEntity('GetCensuringCount');
|
||||
this._propColMaps.GetCensuredByCount = this._getPropertyColumnMapForEntity('GetCensuredByCount');
|
||||
}
|
||||
}
|
48
packages/censures-watcher/src/entity/BlockProgress.ts
Normal file
48
packages/censures-watcher/src/entity/BlockProgress.ts
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index, CreateDateColumn } from 'typeorm';
|
||||
import { BlockProgressInterface } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash'], { unique: true })
|
||||
@Index(['blockNumber'])
|
||||
@Index(['parentHash'])
|
||||
export class BlockProgress implements BlockProgressInterface {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar')
|
||||
cid!: string;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
parentHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('integer')
|
||||
blockTimestamp!: number;
|
||||
|
||||
@Column('integer')
|
||||
numEvents!: number;
|
||||
|
||||
@Column('integer')
|
||||
numProcessedEvents!: number;
|
||||
|
||||
@Column('integer')
|
||||
lastProcessedEventIndex!: number;
|
||||
|
||||
@Column('boolean')
|
||||
isComplete!: boolean;
|
||||
|
||||
@Column('boolean', { default: false })
|
||||
isPruned!: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
}
|
33
packages/censures-watcher/src/entity/CanManage.ts
Normal file
33
packages/censures-watcher/src/entity/CanManage.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_who'], { unique: true })
|
||||
export class CanManage {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_who!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/CanSpawnAs.ts
Normal file
33
packages/censures-watcher/src/entity/CanSpawnAs.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_who'], { unique: true })
|
||||
export class CanSpawnAs {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_who!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/CanTransfer.ts
Normal file
33
packages/censures-watcher/src/entity/CanTransfer.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_who'], { unique: true })
|
||||
export class CanTransfer {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_who!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/CanVoteAs.ts
Normal file
33
packages/censures-watcher/src/entity/CanVoteAs.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_who'], { unique: true })
|
||||
export class CanVoteAs {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_who!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
24
packages/censures-watcher/src/entity/Contract.ts
Normal file
24
packages/censures-watcher/src/entity/Contract.ts
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['address'], { unique: true })
|
||||
export class Contract {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
address!: string;
|
||||
|
||||
@Column('varchar')
|
||||
kind!: string;
|
||||
|
||||
@Column('boolean')
|
||||
checkpoint!: boolean;
|
||||
|
||||
@Column('integer')
|
||||
startingBlock!: number;
|
||||
}
|
38
packages/censures-watcher/src/entity/Event.ts
Normal file
38
packages/censures-watcher/src/entity/Event.ts
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index, ManyToOne } from 'typeorm';
|
||||
import { BlockProgress } from './BlockProgress';
|
||||
|
||||
@Entity()
|
||||
@Index(['block', 'contract'])
|
||||
@Index(['block', 'contract', 'eventName'])
|
||||
export class Event {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@ManyToOne(() => BlockProgress, { onDelete: 'CASCADE' })
|
||||
block!: BlockProgress;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
txHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
index!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contract!: string;
|
||||
|
||||
@Column('varchar', { length: 256 })
|
||||
eventName!: string;
|
||||
|
||||
@Column('text')
|
||||
eventInfo!: string;
|
||||
|
||||
@Column('text')
|
||||
extraInfo!: string;
|
||||
|
||||
@Column('text')
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetCensuredByCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetCensuredByCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_who'], { unique: true })
|
||||
export class GetCensuredByCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_who!: number;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetCensuringCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetCensuringCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_whose'], { unique: true })
|
||||
export class GetCensuringCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_whose!: number;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetContinuityNumber.ts
Normal file
30
packages/censures-watcher/src/entity/GetContinuityNumber.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetContinuityNumber {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetEscapeRequest.ts
Normal file
30
packages/censures-watcher/src/entity/GetEscapeRequest.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetEscapeRequest {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_sponsor'], { unique: true })
|
||||
export class GetEscapeRequestsCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_sponsor!: number;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetKeyRevisionNumber.ts
Normal file
30
packages/censures-watcher/src/entity/GetKeyRevisionNumber.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetKeyRevisionNumber {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetManagementProxy.ts
Normal file
30
packages/censures-watcher/src/entity/GetManagementProxy.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetManagementProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar')
|
||||
value!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetManagerForCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetManagerForCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_proxy'], { unique: true })
|
||||
export class GetManagerForCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
34
packages/censures-watcher/src/entity/GetOwnedPointAtIndex.ts
Normal file
34
packages/censures-watcher/src/entity/GetOwnedPointAtIndex.ts
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_whose', '_index'], { unique: true })
|
||||
export class GetOwnedPointAtIndex {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_whose!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
_index!: bigint;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetOwnedPointCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetOwnedPointCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_whose'], { unique: true })
|
||||
export class GetOwnedPointCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_whose!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetOwner.ts
Normal file
30
packages/censures-watcher/src/entity/GetOwner.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetOwner {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar')
|
||||
value!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetSpawnCount.ts
Normal file
30
packages/censures-watcher/src/entity/GetSpawnCount.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetSpawnCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetSpawnProxy.ts
Normal file
30
packages/censures-watcher/src/entity/GetSpawnProxy.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetSpawnProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar')
|
||||
value!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetSpawningForCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetSpawningForCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_proxy'], { unique: true })
|
||||
export class GetSpawningForCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetSponsor.ts
Normal file
30
packages/censures-watcher/src/entity/GetSponsor.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetSponsor {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
value!: number;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetSponsoringCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetSponsoringCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_sponsor'], { unique: true })
|
||||
export class GetSponsoringCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_sponsor!: number;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetTransferProxy.ts
Normal file
30
packages/censures-watcher/src/entity/GetTransferProxy.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetTransferProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar')
|
||||
value!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_proxy'], { unique: true })
|
||||
export class GetTransferringForCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/GetVotingForCount.ts
Normal file
31
packages/censures-watcher/src/entity/GetVotingForCount.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
import { bigintTransformer } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_proxy'], { unique: true })
|
||||
export class GetVotingForCount {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('numeric', { transformer: bigintTransformer })
|
||||
value!: bigint;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/GetVotingProxy.ts
Normal file
30
packages/censures-watcher/src/entity/GetVotingProxy.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class GetVotingProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar')
|
||||
value!: string;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/HasBeenLinked.ts
Normal file
30
packages/censures-watcher/src/entity/HasBeenLinked.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class HasBeenLinked {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/HasSponsor.ts
Normal file
30
packages/censures-watcher/src/entity/HasSponsor.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class HasSponsor {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/IsActive.ts
Normal file
30
packages/censures-watcher/src/entity/IsActive.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class IsActive {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/IsEscaping.ts
Normal file
30
packages/censures-watcher/src/entity/IsEscaping.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class IsEscaping {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
30
packages/censures-watcher/src/entity/IsLive.ts
Normal file
30
packages/censures-watcher/src/entity/IsLive.ts
Normal file
@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point'], { unique: true })
|
||||
export class IsLive {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsManagementProxy.ts
Normal file
33
packages/censures-watcher/src/entity/IsManagementProxy.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_proxy'], { unique: true })
|
||||
export class IsManagementProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsOperator.ts
Normal file
33
packages/censures-watcher/src/entity/IsOperator.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_owner', '_operator'], { unique: true })
|
||||
export class IsOperator {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_owner!: string;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_operator!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsOwner.ts
Normal file
33
packages/censures-watcher/src/entity/IsOwner.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_address'], { unique: true })
|
||||
export class IsOwner {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_address!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsRequestingEscapeTo.ts
Normal file
33
packages/censures-watcher/src/entity/IsRequestingEscapeTo.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_sponsor'], { unique: true })
|
||||
export class IsRequestingEscapeTo {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
_sponsor!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsSpawnProxy.ts
Normal file
33
packages/censures-watcher/src/entity/IsSpawnProxy.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_proxy'], { unique: true })
|
||||
export class IsSpawnProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsSponsor.ts
Normal file
33
packages/censures-watcher/src/entity/IsSponsor.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_sponsor'], { unique: true })
|
||||
export class IsSponsor {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('integer')
|
||||
_sponsor!: number;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsTransferProxy.ts
Normal file
33
packages/censures-watcher/src/entity/IsTransferProxy.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_proxy'], { unique: true })
|
||||
export class IsTransferProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
33
packages/censures-watcher/src/entity/IsVotingProxy.ts
Normal file
33
packages/censures-watcher/src/entity/IsVotingProxy.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockHash', 'contractAddress', '_point', '_proxy'], { unique: true })
|
||||
export class IsVotingProxy {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
blockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
blockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('integer')
|
||||
_point!: number;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
_proxy!: string;
|
||||
|
||||
@Column('boolean')
|
||||
value!: boolean;
|
||||
|
||||
@Column('text', { nullable: true })
|
||||
proof!: string;
|
||||
}
|
31
packages/censures-watcher/src/entity/State.ts
Normal file
31
packages/censures-watcher/src/entity/State.ts
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Index, ManyToOne } from 'typeorm';
|
||||
import { StateKind } from '@cerc-io/util';
|
||||
import { BlockProgress } from './BlockProgress';
|
||||
|
||||
@Entity()
|
||||
@Index(['cid'], { unique: true })
|
||||
@Index(['block', 'contractAddress'])
|
||||
@Index(['block', 'contractAddress', 'kind'], { unique: true })
|
||||
export class State {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@ManyToOne(() => BlockProgress, { onDelete: 'CASCADE' })
|
||||
block!: BlockProgress;
|
||||
|
||||
@Column('varchar', { length: 42 })
|
||||
contractAddress!: string;
|
||||
|
||||
@Column('varchar')
|
||||
cid!: string;
|
||||
|
||||
@Column({ type: 'enum', enum: StateKind })
|
||||
kind!: StateKind;
|
||||
|
||||
@Column('bytea')
|
||||
data!: Buffer;
|
||||
}
|
17
packages/censures-watcher/src/entity/StateSyncStatus.ts
Normal file
17
packages/censures-watcher/src/entity/StateSyncStatus.ts
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class StateSyncStatus {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('integer')
|
||||
latestIndexedBlockNumber!: number;
|
||||
|
||||
@Column('integer', { nullable: true })
|
||||
latestCheckpointBlockNumber!: number;
|
||||
}
|
36
packages/censures-watcher/src/entity/SyncStatus.ts
Normal file
36
packages/censures-watcher/src/entity/SyncStatus.ts
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { SyncStatusInterface } from '@cerc-io/util';
|
||||
|
||||
@Entity()
|
||||
export class SyncStatus implements SyncStatusInterface {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
chainHeadBlockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
chainHeadBlockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
latestIndexedBlockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
latestIndexedBlockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
latestCanonicalBlockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
latestCanonicalBlockNumber!: number;
|
||||
|
||||
@Column('varchar', { length: 66 })
|
||||
initialIndexedBlockHash!: string;
|
||||
|
||||
@Column('integer')
|
||||
initialIndexedBlockNumber!: number;
|
||||
}
|
33
packages/censures-watcher/src/fill.ts
Normal file
33
packages/censures-watcher/src/fill.ts
Normal file
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import 'reflect-metadata';
|
||||
import debug from 'debug';
|
||||
|
||||
import { FillCmd } from '@cerc-io/cli';
|
||||
|
||||
import { Database } from './database';
|
||||
import { Indexer } from './indexer';
|
||||
|
||||
const log = debug('vulcanize:fill');
|
||||
|
||||
export const main = async (): Promise<any> => {
|
||||
const fillCmd = new FillCmd();
|
||||
await fillCmd.init(Database);
|
||||
|
||||
await fillCmd.initIndexer(Indexer);
|
||||
|
||||
await fillCmd.exec();
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
log(err);
|
||||
}).finally(() => {
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
log(`Exiting process ${process.pid} with code 0`);
|
||||
process.exit(0);
|
||||
});
|
3
packages/censures-watcher/src/gql/index.ts
Normal file
3
packages/censures-watcher/src/gql/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * as mutations from './mutations';
|
||||
export * as queries from './queries';
|
||||
export * as subscriptions from './subscriptions';
|
4
packages/censures-watcher/src/gql/mutations/index.ts
Normal file
4
packages/censures-watcher/src/gql/mutations/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const watchContract = fs.readFileSync(path.join(__dirname, 'watchContract.gql'), 'utf8');
|
@ -0,0 +1,3 @@
|
||||
mutation watchContract($address: String!, $kind: String!, $checkpoint: Boolean!, $startingBlock: Int){
|
||||
watchContract(address: $address, kind: $kind, checkpoint: $checkpoint, startingBlock: $startingBlock)
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/canManage.gql
Normal file
8
packages/censures-watcher/src/gql/queries/canManage.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query canManage($blockHash: String!, $contractAddress: String!, $_point: Int!, $_who: String!){
|
||||
canManage(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point, _who: $_who){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/canSpawnAs.gql
Normal file
8
packages/censures-watcher/src/gql/queries/canSpawnAs.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query canSpawnAs($blockHash: String!, $contractAddress: String!, $_point: Int!, $_who: String!){
|
||||
canSpawnAs(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point, _who: $_who){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query canTransfer($blockHash: String!, $contractAddress: String!, $_point: Int!, $_who: String!){
|
||||
canTransfer(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point, _who: $_who){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/canVoteAs.gql
Normal file
8
packages/censures-watcher/src/gql/queries/canVoteAs.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query canVoteAs($blockHash: String!, $contractAddress: String!, $_point: Int!, $_who: String!){
|
||||
canVoteAs(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point, _who: $_who){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
32
packages/censures-watcher/src/gql/queries/events.gql
Normal file
32
packages/censures-watcher/src/gql/queries/events.gql
Normal file
@ -0,0 +1,32 @@
|
||||
query events($blockHash: String!, $contractAddress: String!, $name: String){
|
||||
events(blockHash: $blockHash, contractAddress: $contractAddress, name: $name){
|
||||
block{
|
||||
cid
|
||||
hash
|
||||
number
|
||||
timestamp
|
||||
parentHash
|
||||
}
|
||||
tx{
|
||||
hash
|
||||
index
|
||||
from
|
||||
to
|
||||
}
|
||||
contract
|
||||
eventIndex
|
||||
event{
|
||||
... on CensuredEvent {
|
||||
by
|
||||
who
|
||||
}
|
||||
... on ForgivenEvent {
|
||||
by
|
||||
who
|
||||
}
|
||||
}
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
32
packages/censures-watcher/src/gql/queries/eventsInRange.gql
Normal file
32
packages/censures-watcher/src/gql/queries/eventsInRange.gql
Normal file
@ -0,0 +1,32 @@
|
||||
query eventsInRange($fromBlockNumber: Int!, $toBlockNumber: Int!){
|
||||
eventsInRange(fromBlockNumber: $fromBlockNumber, toBlockNumber: $toBlockNumber){
|
||||
block{
|
||||
cid
|
||||
hash
|
||||
number
|
||||
timestamp
|
||||
parentHash
|
||||
}
|
||||
tx{
|
||||
hash
|
||||
index
|
||||
from
|
||||
to
|
||||
}
|
||||
contract
|
||||
eventIndex
|
||||
event{
|
||||
... on CensuredEvent {
|
||||
by
|
||||
who
|
||||
}
|
||||
... on ForgivenEvent {
|
||||
by
|
||||
who
|
||||
}
|
||||
}
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getCensuredByCount($blockHash: String!, $contractAddress: String!, $_who: Int!){
|
||||
getCensuredByCount(blockHash: $blockHash, contractAddress: $contractAddress, _who: $_who){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getCensuringCount($blockHash: String!, $contractAddress: String!, $_whose: Int!){
|
||||
getCensuringCount(blockHash: $blockHash, contractAddress: $contractAddress, _whose: $_whose){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getContinuityNumber($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getContinuityNumber(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getEscapeRequest($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getEscapeRequest(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getEscapeRequestsCount($blockHash: String!, $contractAddress: String!, $_sponsor: Int!){
|
||||
getEscapeRequestsCount(blockHash: $blockHash, contractAddress: $contractAddress, _sponsor: $_sponsor){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getKeyRevisionNumber($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getKeyRevisionNumber(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getManagementProxy($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getManagementProxy(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getManagerForCount($blockHash: String!, $contractAddress: String!, $_proxy: String!){
|
||||
getManagerForCount(blockHash: $blockHash, contractAddress: $contractAddress, _proxy: $_proxy){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getOwnedPointAtIndex($blockHash: String!, $contractAddress: String!, $_whose: String!, $_index: BigInt!){
|
||||
getOwnedPointAtIndex(blockHash: $blockHash, contractAddress: $contractAddress, _whose: $_whose, _index: $_index){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getOwnedPointCount($blockHash: String!, $contractAddress: String!, $_whose: String!){
|
||||
getOwnedPointCount(blockHash: $blockHash, contractAddress: $contractAddress, _whose: $_whose){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/getOwner.gql
Normal file
8
packages/censures-watcher/src/gql/queries/getOwner.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query getOwner($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getOwner(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getSpawnCount($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getSpawnCount(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getSpawnProxy($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getSpawnProxy(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getSpawningForCount($blockHash: String!, $contractAddress: String!, $_proxy: String!){
|
||||
getSpawningForCount(blockHash: $blockHash, contractAddress: $contractAddress, _proxy: $_proxy){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/getSponsor.gql
Normal file
8
packages/censures-watcher/src/gql/queries/getSponsor.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query getSponsor($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getSponsor(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getSponsoringCount($blockHash: String!, $contractAddress: String!, $_sponsor: Int!){
|
||||
getSponsoringCount(blockHash: $blockHash, contractAddress: $contractAddress, _sponsor: $_sponsor){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
15
packages/censures-watcher/src/gql/queries/getState.gql
Normal file
15
packages/censures-watcher/src/gql/queries/getState.gql
Normal file
@ -0,0 +1,15 @@
|
||||
query getState($blockHash: String!, $contractAddress: String!, $kind: String){
|
||||
getState(blockHash: $blockHash, contractAddress: $contractAddress, kind: $kind){
|
||||
block{
|
||||
cid
|
||||
hash
|
||||
number
|
||||
timestamp
|
||||
parentHash
|
||||
}
|
||||
contractAddress
|
||||
cid
|
||||
kind
|
||||
data
|
||||
}
|
||||
}
|
15
packages/censures-watcher/src/gql/queries/getStateByCID.gql
Normal file
15
packages/censures-watcher/src/gql/queries/getStateByCID.gql
Normal file
@ -0,0 +1,15 @@
|
||||
query getStateByCID($cid: String!){
|
||||
getStateByCID(cid: $cid){
|
||||
block{
|
||||
cid
|
||||
hash
|
||||
number
|
||||
timestamp
|
||||
parentHash
|
||||
}
|
||||
contractAddress
|
||||
cid
|
||||
kind
|
||||
data
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getSyncStatus{
|
||||
getSyncStatus{
|
||||
latestIndexedBlockHash
|
||||
latestIndexedBlockNumber
|
||||
latestCanonicalBlockHash
|
||||
latestCanonicalBlockNumber
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getTransferProxy($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getTransferProxy(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getTransferringForCount($blockHash: String!, $contractAddress: String!, $_proxy: String!){
|
||||
getTransferringForCount(blockHash: $blockHash, contractAddress: $contractAddress, _proxy: $_proxy){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getVotingForCount($blockHash: String!, $contractAddress: String!, $_proxy: String!){
|
||||
getVotingForCount(blockHash: $blockHash, contractAddress: $contractAddress, _proxy: $_proxy){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query getVotingProxy($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
getVotingProxy(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
query hasBeenLinked($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
hasBeenLinked(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/hasSponsor.gql
Normal file
8
packages/censures-watcher/src/gql/queries/hasSponsor.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query hasSponsor($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
hasSponsor(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
45
packages/censures-watcher/src/gql/queries/index.ts
Normal file
45
packages/censures-watcher/src/gql/queries/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const events = fs.readFileSync(path.join(__dirname, 'events.gql'), 'utf8');
|
||||
export const eventsInRange = fs.readFileSync(path.join(__dirname, 'eventsInRange.gql'), 'utf8');
|
||||
export const isActive = fs.readFileSync(path.join(__dirname, 'isActive.gql'), 'utf8');
|
||||
export const getKeyRevisionNumber = fs.readFileSync(path.join(__dirname, 'getKeyRevisionNumber.gql'), 'utf8');
|
||||
export const hasBeenLinked = fs.readFileSync(path.join(__dirname, 'hasBeenLinked.gql'), 'utf8');
|
||||
export const isLive = fs.readFileSync(path.join(__dirname, 'isLive.gql'), 'utf8');
|
||||
export const getContinuityNumber = fs.readFileSync(path.join(__dirname, 'getContinuityNumber.gql'), 'utf8');
|
||||
export const getSpawnCount = fs.readFileSync(path.join(__dirname, 'getSpawnCount.gql'), 'utf8');
|
||||
export const hasSponsor = fs.readFileSync(path.join(__dirname, 'hasSponsor.gql'), 'utf8');
|
||||
export const getSponsor = fs.readFileSync(path.join(__dirname, 'getSponsor.gql'), 'utf8');
|
||||
export const isSponsor = fs.readFileSync(path.join(__dirname, 'isSponsor.gql'), 'utf8');
|
||||
export const getSponsoringCount = fs.readFileSync(path.join(__dirname, 'getSponsoringCount.gql'), 'utf8');
|
||||
export const isEscaping = fs.readFileSync(path.join(__dirname, 'isEscaping.gql'), 'utf8');
|
||||
export const getEscapeRequest = fs.readFileSync(path.join(__dirname, 'getEscapeRequest.gql'), 'utf8');
|
||||
export const isRequestingEscapeTo = fs.readFileSync(path.join(__dirname, 'isRequestingEscapeTo.gql'), 'utf8');
|
||||
export const getEscapeRequestsCount = fs.readFileSync(path.join(__dirname, 'getEscapeRequestsCount.gql'), 'utf8');
|
||||
export const getOwner = fs.readFileSync(path.join(__dirname, 'getOwner.gql'), 'utf8');
|
||||
export const isOwner = fs.readFileSync(path.join(__dirname, 'isOwner.gql'), 'utf8');
|
||||
export const getOwnedPointCount = fs.readFileSync(path.join(__dirname, 'getOwnedPointCount.gql'), 'utf8');
|
||||
export const getOwnedPointAtIndex = fs.readFileSync(path.join(__dirname, 'getOwnedPointAtIndex.gql'), 'utf8');
|
||||
export const getManagementProxy = fs.readFileSync(path.join(__dirname, 'getManagementProxy.gql'), 'utf8');
|
||||
export const isManagementProxy = fs.readFileSync(path.join(__dirname, 'isManagementProxy.gql'), 'utf8');
|
||||
export const canManage = fs.readFileSync(path.join(__dirname, 'canManage.gql'), 'utf8');
|
||||
export const getManagerForCount = fs.readFileSync(path.join(__dirname, 'getManagerForCount.gql'), 'utf8');
|
||||
export const getSpawnProxy = fs.readFileSync(path.join(__dirname, 'getSpawnProxy.gql'), 'utf8');
|
||||
export const isSpawnProxy = fs.readFileSync(path.join(__dirname, 'isSpawnProxy.gql'), 'utf8');
|
||||
export const canSpawnAs = fs.readFileSync(path.join(__dirname, 'canSpawnAs.gql'), 'utf8');
|
||||
export const getSpawningForCount = fs.readFileSync(path.join(__dirname, 'getSpawningForCount.gql'), 'utf8');
|
||||
export const getVotingProxy = fs.readFileSync(path.join(__dirname, 'getVotingProxy.gql'), 'utf8');
|
||||
export const isVotingProxy = fs.readFileSync(path.join(__dirname, 'isVotingProxy.gql'), 'utf8');
|
||||
export const canVoteAs = fs.readFileSync(path.join(__dirname, 'canVoteAs.gql'), 'utf8');
|
||||
export const getVotingForCount = fs.readFileSync(path.join(__dirname, 'getVotingForCount.gql'), 'utf8');
|
||||
export const getTransferProxy = fs.readFileSync(path.join(__dirname, 'getTransferProxy.gql'), 'utf8');
|
||||
export const isTransferProxy = fs.readFileSync(path.join(__dirname, 'isTransferProxy.gql'), 'utf8');
|
||||
export const canTransfer = fs.readFileSync(path.join(__dirname, 'canTransfer.gql'), 'utf8');
|
||||
export const getTransferringForCount = fs.readFileSync(path.join(__dirname, 'getTransferringForCount.gql'), 'utf8');
|
||||
export const isOperator = fs.readFileSync(path.join(__dirname, 'isOperator.gql'), 'utf8');
|
||||
export const getCensuringCount = fs.readFileSync(path.join(__dirname, 'getCensuringCount.gql'), 'utf8');
|
||||
export const getCensuredByCount = fs.readFileSync(path.join(__dirname, 'getCensuredByCount.gql'), 'utf8');
|
||||
export const getSyncStatus = fs.readFileSync(path.join(__dirname, 'getSyncStatus.gql'), 'utf8');
|
||||
export const getStateByCID = fs.readFileSync(path.join(__dirname, 'getStateByCID.gql'), 'utf8');
|
||||
export const getState = fs.readFileSync(path.join(__dirname, 'getState.gql'), 'utf8');
|
8
packages/censures-watcher/src/gql/queries/isActive.gql
Normal file
8
packages/censures-watcher/src/gql/queries/isActive.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query isActive($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
isActive(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
8
packages/censures-watcher/src/gql/queries/isEscaping.gql
Normal file
8
packages/censures-watcher/src/gql/queries/isEscaping.gql
Normal file
@ -0,0 +1,8 @@
|
||||
query isEscaping($blockHash: String!, $contractAddress: String!, $_point: Int!){
|
||||
isEscaping(blockHash: $blockHash, contractAddress: $contractAddress, _point: $_point){
|
||||
value
|
||||
proof{
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user