mirror of
https://github.com/fluencelabs/eip712-validation-node
synced 2025-05-04 12:42:13 +00:00
init aqua inerfaces and funcs
This commit is contained in:
parent
f75563f242
commit
509e5f4ead
36
aqua/snapshot.aqua
Normal file
36
aqua/snapshot.aqua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
data PVResponse:
|
||||||
|
peer_id: string
|
||||||
|
timestamp: u64
|
||||||
|
eip_validation: bool
|
||||||
|
ts_validation: bool
|
||||||
|
|
||||||
|
data DBResponse:
|
||||||
|
snapshot_id: u64
|
||||||
|
|
||||||
|
service ProVoValidation("eip_validation"):
|
||||||
|
eip_validation(eip_str: string, peer_id: string)
|
||||||
|
|
||||||
|
service DataProvider(""):
|
||||||
|
get_records()
|
||||||
|
get_record(snapshot_id: u64)
|
||||||
|
|
||||||
|
|
||||||
|
func validate(relay: string, peer:string, eip712_json: string) -> PVResponse {
|
||||||
|
on peer via relay:
|
||||||
|
result <- ProVoValidation.eip_validation(eip712_json, peer)
|
||||||
|
<- result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func get_record(relay:string, peer:string, snapshot_id: u64) -> DBResponse:
|
||||||
|
on peer via relay:
|
||||||
|
result <- DataProvider.get_record(snapshot_id)
|
||||||
|
<- result
|
||||||
|
|
||||||
|
|
||||||
|
func get_records(relay:string, peer:string) -> []DBResponse:
|
||||||
|
on peer via relay:
|
||||||
|
result <- DataProvider.get_records()
|
||||||
|
<- result
|
||||||
|
|
||||||
|
|
BIN
data/snapshot.db
BIN
data/snapshot.db
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
import { TypedDataUtils } from 'ethers-eip712'; // https://github.com/0xsequence/ethers-eip712
|
import { TypedDataUtils } from 'ethers-eip712'; // https://github.com/0xsequence/ethers-eip712
|
||||||
import { eip_validation, Response } from "./eip_processor";
|
import { eip_validation, Response } from "./eip_processor";
|
||||||
import { get_db, create_table, insert_event } from './local_db';
|
import { get_db, create_table, insert_event, DBRecord } from './local_db';
|
||||||
|
|
||||||
var sqlite3 = require('sqlite3').verbose();
|
var sqlite3 = require('sqlite3').verbose();
|
||||||
|
|
||||||
|
@ -6,6 +6,17 @@ const sqlite3 = sqlite.verbose();
|
|||||||
import { Response } from './eip_processor';
|
import { Response } from './eip_processor';
|
||||||
|
|
||||||
|
|
||||||
|
export interface DBRecord {
|
||||||
|
snapshot_id: number;
|
||||||
|
event_address: string;
|
||||||
|
event_signature: string;
|
||||||
|
eip712_doc: string;
|
||||||
|
peer_id: string;
|
||||||
|
timestamp: number;
|
||||||
|
eip_validation: boolean;
|
||||||
|
ts_validation: boolean;
|
||||||
|
signed_response: string;
|
||||||
|
}
|
||||||
|
|
||||||
// db handler
|
// db handler
|
||||||
export function get_db(db_path: any): sqlite.Database {
|
export function get_db(db_path: any): sqlite.Database {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user