mirror of
https://github.com/fluencelabs/eip712-validation-node
synced 2025-06-26 21:21:57 +00:00
bump peer versions
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.4.1-239
|
||||
* Aqua version: 0.6.0-272
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -16,69 +16,6 @@ import {
|
||||
|
||||
// Services
|
||||
|
||||
export interface EIPValidatorDef {
|
||||
eip712_validation_string: (eip_str: string, peer_id: string, callParams: CallParams<'eip_str' | 'peer_id'>) => { stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; } | Promise<{ stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; }>;
|
||||
eip712_validation_url: (eip_str: string, peer_id: string, callParams: CallParams<'eip_str' | 'peer_id'>) => { stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; } | Promise<{ stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; }>;
|
||||
}
|
||||
export function registerEIPValidator(service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(serviceId: string, service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(peer: FluencePeer, service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(peer: FluencePeer, serviceId: string, service: EIPValidatorDef): void;
|
||||
|
||||
|
||||
export function registerEIPValidator(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "EIPValidator",
|
||||
"functions" : [
|
||||
{
|
||||
"functionName" : "eip712_validation_string",
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "eip_str",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "peer_id",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionName" : "eip712_validation_url",
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "eip_str",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "peer_id",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface DataProviderDef {
|
||||
delete_records: (password: string, callParams: CallParams<'password'>) => { stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; } | Promise<{ stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; }>;
|
||||
get_record: (signature: string, callParams: CallParams<'signature'>) => { stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; } | Promise<{ stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; }>;
|
||||
@ -188,15 +125,91 @@ export function registerConsensusService(...args: any) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface EIPValidatorDef {
|
||||
eip712_validation_string: (eip_str: string, peer_id: string, callParams: CallParams<'eip_str' | 'peer_id'>) => { stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; } | Promise<{ stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; }>;
|
||||
eip712_validation_url: (eip_str: string, peer_id: string, callParams: CallParams<'eip_str' | 'peer_id'>) => { stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; } | Promise<{ stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; }>;
|
||||
}
|
||||
export function registerEIPValidator(service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(serviceId: string, service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(peer: FluencePeer, service: EIPValidatorDef): void;
|
||||
export function registerEIPValidator(peer: FluencePeer, serviceId: string, service: EIPValidatorDef): void;
|
||||
|
||||
|
||||
export function registerEIPValidator(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "EIPValidator",
|
||||
"functions" : [
|
||||
{
|
||||
"functionName" : "eip712_validation_string",
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "eip_str",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "peer_id",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionName" : "eip712_validation_url",
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "eip_str",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "peer_id",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
],
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
export type Get_recordResult = { stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; }
|
||||
export function get_record(signature: string, node: string, relay: string, config?: {ttl?: number}): Promise<Get_recordResult>;
|
||||
export function get_record(peer: FluencePeer, signature: string, node: string, relay: string, config?: {ttl?: number}): Promise<Get_recordResult>;
|
||||
export function get_record(
|
||||
signature: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Get_recordResult>;
|
||||
|
||||
export function get_record(
|
||||
peer: FluencePeer,
|
||||
signature: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Get_recordResult>;
|
||||
|
||||
export function get_record(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -204,36 +217,33 @@ export function get_record(...args: any) {
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "signature") [] signature)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "signature") [] signature)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call node ("DataProvider" "get_record") [signature] res)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call node ("DataProvider" "get_record") [signature] res)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
@ -286,12 +296,25 @@ export function get_record(...args: any) {
|
||||
|
||||
|
||||
export type Delete_recordsResult = { stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; }
|
||||
export function delete_records(password: string, node: string, relay: string, config?: {ttl?: number}): Promise<Delete_recordsResult>;
|
||||
export function delete_records(peer: FluencePeer, password: string, node: string, relay: string, config?: {ttl?: number}): Promise<Delete_recordsResult>;
|
||||
export function delete_records(
|
||||
password: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Delete_recordsResult>;
|
||||
|
||||
export function delete_records(
|
||||
peer: FluencePeer,
|
||||
password: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Delete_recordsResult>;
|
||||
|
||||
export function delete_records(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -299,36 +322,33 @@ export function delete_records(...args: any) {
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "password") [] password)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "password") [] password)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call node ("DataProvider" "delete_records") [password] result)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call node ("DataProvider" "delete_records") [password] result)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [result])
|
||||
@ -381,12 +401,25 @@ export function delete_records(...args: any) {
|
||||
|
||||
|
||||
export type ValidateResult = { stderr: string; stdout: { signature: string; validation: { eip_validation: boolean; peer_id: string; timestamp: number; ts_validation: boolean; }; }; }
|
||||
export function validate(eip712_url: string, node: string, relay: string, config?: {ttl?: number}): Promise<ValidateResult>;
|
||||
export function validate(peer: FluencePeer, eip712_url: string, node: string, relay: string, config?: {ttl?: number}): Promise<ValidateResult>;
|
||||
export function validate(
|
||||
eip712_url: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<ValidateResult>;
|
||||
|
||||
export function validate(
|
||||
peer: FluencePeer,
|
||||
eip712_url: string,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<ValidateResult>;
|
||||
|
||||
export function validate(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -394,36 +427,33 @@ export function validate(...args: any) {
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "eip712_url") [] eip712_url)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "eip712_url") [] eip712_url)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call node ("EIPValidator" "eip712_validation_url") [eip712_url node] res)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call node ("EIPValidator" "eip712_validation_url") [eip712_url node] res)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
@ -476,46 +506,54 @@ export function validate(...args: any) {
|
||||
|
||||
|
||||
|
||||
export function get_record_count(node: string, relay: string, config?: {ttl?: number}): Promise<number>;
|
||||
export function get_record_count(peer: FluencePeer, node: string, relay: string, config?: {ttl?: number}): Promise<number>;
|
||||
export function get_record_count(
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function get_record_count(
|
||||
peer: FluencePeer,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function get_record_count(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call node ("DataProvider" "get_record_count") [] res)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call node ("DataProvider" "get_record_count") [] res)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
@ -562,46 +600,54 @@ export function get_record_count(...args: any) {
|
||||
|
||||
|
||||
export type Get_recordsResult = { stderr: string; stdout: { eip712_doc: string; eip_validation: boolean; event_address: string; peer_id: string; signature: string; signed_response: string; timestamp: number; ts_validation: boolean; }[]; }
|
||||
export function get_records(node: string, relay: string, config?: {ttl?: number}): Promise<Get_recordsResult>;
|
||||
export function get_records(peer: FluencePeer, node: string, relay: string, config?: {ttl?: number}): Promise<Get_recordsResult>;
|
||||
export function get_records(
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Get_recordsResult>;
|
||||
|
||||
export function get_records(
|
||||
peer: FluencePeer,
|
||||
node: string,
|
||||
relay: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Get_recordsResult>;
|
||||
|
||||
export function get_records(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call node ("DataProvider" "get_records") [] res)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "node") [] node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call node ("DataProvider" "get_records") [] res)
|
||||
(call relay ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
@ -648,12 +694,29 @@ export function get_records(...args: any) {
|
||||
|
||||
|
||||
export type Eip_consensusResult = { stderr: string; stdout: { consensus: boolean; invalid: number; n: number; threshold: number; valid: number; }[]; }
|
||||
export function eip_consensus(signature: string, locations: { node_id: string; relay_id: string; }[], service_node: string, consensus_service: string, threshold: number, config?: {ttl?: number}): Promise<Eip_consensusResult>;
|
||||
export function eip_consensus(peer: FluencePeer, signature: string, locations: { node_id: string; relay_id: string; }[], service_node: string, consensus_service: string, threshold: number, config?: {ttl?: number}): Promise<Eip_consensusResult>;
|
||||
export function eip_consensus(
|
||||
signature: string,
|
||||
locations: { node_id: string; relay_id: string; }[],
|
||||
service_node: string,
|
||||
consensus_service: string,
|
||||
threshold: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Eip_consensusResult>;
|
||||
|
||||
export function eip_consensus(
|
||||
peer: FluencePeer,
|
||||
signature: string,
|
||||
locations: { node_id: string; relay_id: string; }[],
|
||||
service_node: string,
|
||||
consensus_service: string,
|
||||
threshold: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Eip_consensusResult>;
|
||||
|
||||
export function eip_consensus(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -661,94 +724,84 @@ export function eip_consensus(...args: any) {
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "signature") [] signature)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "locations") [] locations)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "service_node") [] service_node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "consensus_service") [] consensus_service)
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "signature") [] signature)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "threshold") [] threshold)
|
||||
(call %init_peer_id% ("getDataSrv" "locations") [] locations)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "service_node") [] service_node)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "consensus_service") [] consensus_service)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "threshold") [] threshold)
|
||||
)
|
||||
(new $result
|
||||
(seq
|
||||
(seq
|
||||
(fold locations loc
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
(call loc.$.node_id! ("DataProvider" "get_record") [signature] res)
|
||||
(xor
|
||||
(seq
|
||||
(call loc.$.node_id! ("DataProvider" "get_record") [signature] res)
|
||||
(match res.$.stdout.[0].ts_validation! true
|
||||
(xor
|
||||
(match res.$.stdout.[0].ts_validation! true
|
||||
(xor
|
||||
(ap true $result)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(ap false $result)
|
||||
(ap true $result)
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
(ap false $result)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(call loc.$.relay_id! ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(next loc)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call service_node (consensus_service "consensus") [$result threshold] consensus)
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
(xor
|
||||
(seq
|
||||
(call service_node (consensus_service "consensus") [$result threshold] consensus)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [consensus])
|
||||
|
Reference in New Issue
Block a user