Statement
See the Concepts - Attestation page for more information on what is an attestation.
type Statement = {
sourceKey: string; // base58 of a PublicKey
route: Route;
condition: StatementCondition;
};
Each statement is linked to a ZAP Source by its public key sourceKey
and is associated with a Route.
type Route = {
path: string;
args?: {
[key: string]: any;
};
};
// Example
let route: Route = {
path: "/api/v1/price",
args: {
symbol: "ETH",
currency: "USD",
},
};
The condition
is of type StatementCondition
, and represents a rule of .
type StatementCondition = {
type: ConditionType;
targetValue: number;
};
enum ConditionType {
LT = 1,
GT = 2,
EQ = 3,
NEQ = 4,
}
// Example
let condition = {
type: ConditionType.GT,
targetValue: 3000,
};
With the above example, the statement is equivalent to the following:
let statement = {
sourceKey: "base58PublicKey", // base58 of the public key of the Price Oracle ZAP Source
route: {
path: "/api/v1/price",
args: {
symbol: "ETH",
currency: "USD",
},
},
condition: {
type: ConditionType.GT,
targetValue: 3000,
},
};
Note: With this implementation, only statement with can be represented. We plan to use recursion and 'Combining statements' to be able to represent any statement after the initial release.
ProvableStatement
Under the hood, the client will convert this statement object to a ProvableStatement
o1js's struct object, and the condition will be verified inside a proof (the 'Attestation proof').
This can be easily done with the following code:
let provableStatement = ProvableStatement.from(statement);