From 9c6ea53cf90c2a30499741a08e920593d7dec39c Mon Sep 17 00:00:00 2001 From: boneyard93501 <4523011+boneyard93501@users.noreply.github.com> Date: Mon, 4 Oct 2021 00:26:26 -0500 Subject: [PATCH] update main --- aqua/snapshot.aqua | 12 ++++++-- src/eip_processor.ts | 1 + src/index.ts | 72 +++++++++++++++++++++++++++++++++++++++----- 3 files changed, 75 insertions(+), 10 deletions(-) diff --git a/aqua/snapshot.aqua b/aqua/snapshot.aqua index 528e68f..bf14791 100644 --- a/aqua/snapshot.aqua +++ b/aqua/snapshot.aqua @@ -8,16 +8,22 @@ data DBResponse: snapshot_id: u64 service ProVoValidation("eip_validation"): - eip712_validation(eip_str: string, peer_id: string) -> PVResponse + eip712_validation_string(eip_str: string, peer_id: string) -> string + eip712_validation_url(eip_str: string, peer_id: string) -> string service DataProvider(""): get_records() -> []DBResponse get_record(snapshot_id: u64) -> DBResponse -func validate(relay: string, peer:string, eip712_json: string) -> PVResponse: +func validate(relay: string, peer:string, eip712_json: string) -> string: on peer via relay: - result <- ProVoValidation.eip712_validation(eip712_json, peer) + result <- ProVoValidation.eip712_validation_string(eip712_json, peer) + <- result + +func validate_from_url(relay: string, peer:string, eip712_url: string) -> string: + on peer via relay: + result <- ProVoValidation.eip712_validation_url(eip712_url, peer) <- result diff --git a/src/eip_processor.ts b/src/eip_processor.ts index 889cc69..1ecfffb 100644 --- a/src/eip_processor.ts +++ b/src/eip_processor.ts @@ -39,6 +39,7 @@ function check_signature(eip_obj: any): boolean { export function eip_validation(eip_str: string, peer_id: string): Response { const eip_obj = JSON.parse(eip_str); + console.log("eip doc parsed: ", eip_obj); // verify eip document integrity -- not working due to missing fields // const digest = TypedDataUtils.encodeDigest(eip_obj.data); diff --git a/src/index.ts b/src/index.ts index 93c5dda..30eec88 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { Fluence } from "@fluencelabs/fluence"; +import { Fluence, KeyPair } from "@fluencelabs/fluence"; import { krasnodar } from "@fluencelabs/fluence-network-environment"; import { registerProVoValidation, ProVoValidationDef, registerDataProvider, DataProviderDef } from "./_aqua/snapshot"; import { ethers } from "ethers"; @@ -8,6 +8,7 @@ import { get_db, create_table, insert_event, DBRecord, select_events, select_eve import got from 'got'; + function create_wallet(): ethers.Wallet { return ethers.Wallet.createRandom(); } @@ -18,7 +19,7 @@ function sign_response(wallet: ethers.Wallet, response: Response): Promise