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