Skip to content

Instantly share code, notes, and snippets.

@dskvr
Last active September 30, 2019 16:42
Show Gist options
  • Save dskvr/f0f292afeb507b1221f083e1563cfb09 to your computer and use it in GitHub Desktop.
Save dskvr/f0f292afeb507b1221f083e1563cfb09 to your computer and use it in GitHub Desktop.
(experimental) EOSIO Transaction Schema
// To parse this JSON data, first install
//
// Boost http://www.boost.org
// json.hpp https://github.com/nlohmann/json
//
// Then include this file, and then do
//
// Coordinate data = nlohmann::json::parse(jsonString);
#pragma once
#include <boost/variant.hpp>
#include "json.hpp"
#include <boost/optional.hpp>
#include <stdexcept>
#include <regex>
#ifndef NLOHMANN_OPT_HELPER
#define NLOHMANN_OPT_HELPER
namespace nlohmann {
template <typename T>
struct adl_serializer<std::shared_ptr<T>> {
static void to_json(json & j, const std::shared_ptr<T> & opt) {
if (!opt) j = nullptr; else j = *opt;
}
static std::shared_ptr<T> from_json(const json & j) {
if (j.is_null()) return std::unique_ptr<T>(); else return std::unique_ptr<T>(new T(j.get<T>()));
}
};
}
#endif
namespace quicktype {
using nlohmann::json;
class ClassMemberConstraints {
private:
boost::optional<int> min_value;
boost::optional<int> max_value;
boost::optional<size_t> min_length;
boost::optional<size_t> max_length;
boost::optional<std::string> pattern;
public:
ClassMemberConstraints(
boost::optional<int> min_value,
boost::optional<int> max_value,
boost::optional<size_t> min_length,
boost::optional<size_t> max_length,
boost::optional<std::string> pattern
) : min_value(min_value), max_value(max_value), min_length(min_length), max_length(max_length), pattern(pattern) {}
ClassMemberConstraints() = default;
virtual ~ClassMemberConstraints() = default;
void set_min_value(int min_value) { this->min_value = min_value; }
auto get_min_value() const { return min_value; }
void set_max_value(int max_value) { this->max_value = max_value; }
auto get_max_value() const { return max_value; }
void set_min_length(size_t min_length) { this->min_length = min_length; }
auto get_min_length() const { return min_length; }
void set_max_length(size_t max_length) { this->max_length = max_length; }
auto get_max_length() const { return max_length; }
void set_pattern(const std::string & pattern) { this->pattern = pattern; }
auto get_pattern() const { return pattern; }
};
class ClassMemberConstraintException : public std::runtime_error {
public:
ClassMemberConstraintException(const std::string & msg) : std::runtime_error(msg) {}
};
class ValueTooLowException : public ClassMemberConstraintException {
public:
ValueTooLowException(const std::string & msg) : ClassMemberConstraintException(msg) {}
};
class ValueTooHighException : public ClassMemberConstraintException {
public:
ValueTooHighException(const std::string & msg) : ClassMemberConstraintException(msg) {}
};
class ValueTooShortException : public ClassMemberConstraintException {
public:
ValueTooShortException(const std::string & msg) : ClassMemberConstraintException(msg) {}
};
class ValueTooLongException : public ClassMemberConstraintException {
public:
ValueTooLongException(const std::string & msg) : ClassMemberConstraintException(msg) {}
};
class InvalidPatternException : public ClassMemberConstraintException {
public:
InvalidPatternException(const std::string & msg) : ClassMemberConstraintException(msg) {}
};
void CheckConstraint(const std::string & name, const ClassMemberConstraints & c, int64_t value) {
if (c.get_min_value() != boost::none && value < *c.get_min_value()) {
throw ValueTooLowException ("Value too low for " + name + " (" + std::to_string(value) + "<" + std::to_string(*c.get_min_value()) + ")");
}
if (c.get_max_value() != boost::none && value > *c.get_max_value()) {
throw ValueTooHighException ("Value too high for " + name + " (" + std::to_string(value) + ">" + std::to_string(*c.get_max_value()) + ")");
}
}
void CheckConstraint(const std::string & name, const ClassMemberConstraints & c, const std::string & value) {
if (c.get_min_length() != boost::none && value.length() < *c.get_min_length()) {
throw ValueTooShortException ("Value too short for " + name + " (" + std::to_string(value.length()) + "<" + std::to_string(*c.get_min_length()) + ")");
}
if (c.get_max_length() != boost::none && value.length() > *c.get_max_length()) {
throw ValueTooLongException ("Value too long for " + name + " (" + std::to_string(value.length()) + ">" + std::to_string(*c.get_max_length()) + ")");
}
if (c.get_pattern() != boost::none) {
std::smatch result;
std::regex_search(value, result, std::regex( *c.get_pattern() ));
if (result.empty()) {
throw InvalidPatternException ("Value doesn't match pattern for " + name + " (" + value +" != " + *c.get_pattern() + ")");
}
}
}
inline json get_untyped(const json & j, const char * property) {
if (j.find(property) != j.end()) {
return j.at(property).get<json>();
}
return json();
}
inline json get_untyped(const json & j, std::string property) {
return get_untyped(j, property.data());
}
template <typename T>
inline std::shared_ptr<T> get_optional(const json & j, const char * property) {
if (j.find(property) != j.end()) {
return j.at(property).get<std::shared_ptr<T>>();
}
return std::shared_ptr<T>();
}
template <typename T>
inline std::shared_ptr<T> get_optional(const json & j, std::string property) {
return get_optional<T>(j, property.data());
}
class ActionAuthorization {
public:
ActionAuthorization() :
actor_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)")),
permission_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)"))
{}
virtual ~ActionAuthorization() = default;
private:
std::string actor;
ClassMemberConstraints actor_constraint;
std::string permission;
ClassMemberConstraints permission_constraint;
public:
const std::string & get_actor() const { return actor; }
std::string & get_mutable_actor() { return actor; }
void set_actor(const std::string & value) { CheckConstraint("actor", actor_constraint, value); this->actor = value; }
const std::string & get_permission() const { return permission; }
std::string & get_mutable_permission() { return permission; }
void set_permission(const std::string & value) { CheckConstraint("permission", permission_constraint, value); this->permission = value; }
};
class ActionElement {
public:
ActionElement() :
account_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)")),
name_constraint(boost::none, boost::none, boost::none, boost::none, std::string("^([a-z1-9]{1}[a-z1-9_]{0,30}[a-z1-9]{1})$"))
{}
virtual ~ActionElement() = default;
private:
std::string account;
ClassMemberConstraints account_constraint;
std::vector<ActionAuthorization> authorization;
std::map<std::string, nlohmann::json> data;
std::string hex_data;
std::string name;
ClassMemberConstraints name_constraint;
public:
const std::string & get_account() const { return account; }
std::string & get_mutable_account() { return account; }
void set_account(const std::string & value) { CheckConstraint("account", account_constraint, value); this->account = value; }
const std::vector<ActionAuthorization> & get_authorization() const { return authorization; }
std::vector<ActionAuthorization> & get_mutable_authorization() { return authorization; }
void set_authorization(const std::vector<ActionAuthorization> & value) { this->authorization = value; }
const std::map<std::string, nlohmann::json> & get_data() const { return data; }
std::map<std::string, nlohmann::json> & get_mutable_data() { return data; }
void set_data(const std::map<std::string, nlohmann::json> & value) { this->data = value; }
const std::string & get_hex_data() const { return hex_data; }
std::string & get_mutable_hex_data() { return hex_data; }
void set_hex_data(const std::string & value) { this->hex_data = value; }
/**
* C++ variable signature
*/
const std::string & get_name() const { return name; }
std::string & get_mutable_name() { return name; }
void set_name(const std::string & value) { CheckConstraint("name", name_constraint, value); this->name = value; }
};
class ContextFreeActionAuthorization {
public:
ContextFreeActionAuthorization() :
actor_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)")),
permission_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)"))
{}
virtual ~ContextFreeActionAuthorization() = default;
private:
std::string actor;
ClassMemberConstraints actor_constraint;
std::string permission;
ClassMemberConstraints permission_constraint;
public:
const std::string & get_actor() const { return actor; }
std::string & get_mutable_actor() { return actor; }
void set_actor(const std::string & value) { CheckConstraint("actor", actor_constraint, value); this->actor = value; }
const std::string & get_permission() const { return permission; }
std::string & get_mutable_permission() { return permission; }
void set_permission(const std::string & value) { CheckConstraint("permission", permission_constraint, value); this->permission = value; }
};
class ContextFreeActionElement {
public:
ContextFreeActionElement() :
account_constraint(boost::none, boost::none, boost::none, boost::none, std::string("(^(eosio[\.][a-z1-5]{1,6})$)|(^[a-z]{1}[a-z1-5]{11}$)|(^([a-z1-5]{1,12})$)|(^([a-z1-5]{1}[a-z1-5\.]{0,10}[a-z1-5]{1})$)")),
name_constraint(boost::none, boost::none, boost::none, boost::none, std::string("^([a-z1-9]{1}[a-z1-9_]{0,30}[a-z1-9]{1})$"))
{}
virtual ~ContextFreeActionElement() = default;
private:
std::string account;
ClassMemberConstraints account_constraint;
std::vector<ContextFreeActionAuthorization> authorization;
std::map<std::string, nlohmann::json> data;
std::string hex_data;
std::string name;
ClassMemberConstraints name_constraint;
public:
const std::string & get_account() const { return account; }
std::string & get_mutable_account() { return account; }
void set_account(const std::string & value) { CheckConstraint("account", account_constraint, value); this->account = value; }
const std::vector<ContextFreeActionAuthorization> & get_authorization() const { return authorization; }
std::vector<ContextFreeActionAuthorization> & get_mutable_authorization() { return authorization; }
void set_authorization(const std::vector<ContextFreeActionAuthorization> & value) { this->authorization = value; }
const std::map<std::string, nlohmann::json> & get_data() const { return data; }
std::map<std::string, nlohmann::json> & get_mutable_data() { return data; }
void set_data(const std::map<std::string, nlohmann::json> & value) { this->data = value; }
const std::string & get_hex_data() const { return hex_data; }
std::string & get_mutable_hex_data() { return hex_data; }
void set_hex_data(const std::string & value) { this->hex_data = value; }
/**
* C++ variable signature
*/
const std::string & get_name() const { return name; }
std::string & get_mutable_name() { return name; }
void set_name(const std::string & value) { CheckConstraint("name", name_constraint, value); this->name = value; }
};
using WholeNumber = boost::variant<int64_t, std::string>;
using Extension = boost::variant<int64_t, std::string>;
class Coordinate {
public:
Coordinate() :
expiration_constraint(boost::none, boost::none, boost::none, boost::none, std::string("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$"))
{}
virtual ~Coordinate() = default;
private:
std::vector<ActionElement> actions;
std::vector<ContextFreeActionElement> context_free_actions;
int64_t delay_sec;
std::string expiration;
ClassMemberConstraints expiration_constraint;
WholeNumber max_cpu_usage_ms;
WholeNumber max_net_usage_words;
int64_t ref_block_num;
int64_t ref_block_prefix;
std::vector<std::vector<Extension>> transaction_extensions;
public:
const std::vector<ActionElement> & get_actions() const { return actions; }
std::vector<ActionElement> & get_mutable_actions() { return actions; }
void set_actions(const std::vector<ActionElement> & value) { this->actions = value; }
const std::vector<ContextFreeActionElement> & get_context_free_actions() const { return context_free_actions; }
std::vector<ContextFreeActionElement> & get_mutable_context_free_actions() { return context_free_actions; }
void set_context_free_actions(const std::vector<ContextFreeActionElement> & value) { this->context_free_actions = value; }
const int64_t & get_delay_sec() const { return delay_sec; }
int64_t & get_mutable_delay_sec() { return delay_sec; }
void set_delay_sec(const int64_t & value) { this->delay_sec = value; }
/**
* Time that transaction must be confirmed by.
*/
const std::string & get_expiration() const { return expiration; }
std::string & get_mutable_expiration() { return expiration; }
void set_expiration(const std::string & value) { CheckConstraint("expiration", expiration_constraint, value); this->expiration = value; }
/**
* A whole number
*/
const WholeNumber & get_max_cpu_usage_ms() const { return max_cpu_usage_ms; }
WholeNumber & get_mutable_max_cpu_usage_ms() { return max_cpu_usage_ms; }
void set_max_cpu_usage_ms(const WholeNumber & value) { this->max_cpu_usage_ms = value; }
/**
* A whole number
*/
const WholeNumber & get_max_net_usage_words() const { return max_net_usage_words; }
WholeNumber & get_mutable_max_net_usage_words() { return max_net_usage_words; }
void set_max_net_usage_words(const WholeNumber & value) { this->max_net_usage_words = value; }
const int64_t & get_ref_block_num() const { return ref_block_num; }
int64_t & get_mutable_ref_block_num() { return ref_block_num; }
void set_ref_block_num(const int64_t & value) { this->ref_block_num = value; }
const int64_t & get_ref_block_prefix() const { return ref_block_prefix; }
int64_t & get_mutable_ref_block_prefix() { return ref_block_prefix; }
void set_ref_block_prefix(const int64_t & value) { this->ref_block_prefix = value; }
const std::vector<std::vector<Extension>> & get_transaction_extensions() const { return transaction_extensions; }
std::vector<std::vector<Extension>> & get_mutable_transaction_extensions() { return transaction_extensions; }
void set_transaction_extensions(const std::vector<std::vector<Extension>> & value) { this->transaction_extensions = value; }
};
}
namespace nlohmann {
void from_json(const json & j, quicktype::ActionAuthorization & x);
void to_json(json & j, const quicktype::ActionAuthorization & x);
void from_json(const json & j, quicktype::ActionElement & x);
void to_json(json & j, const quicktype::ActionElement & x);
void from_json(const json & j, quicktype::ContextFreeActionAuthorization & x);
void to_json(json & j, const quicktype::ContextFreeActionAuthorization & x);
void from_json(const json & j, quicktype::ContextFreeActionElement & x);
void to_json(json & j, const quicktype::ContextFreeActionElement & x);
void from_json(const json & j, quicktype::Coordinate & x);
void to_json(json & j, const quicktype::Coordinate & x);
void from_json(const json & j, boost::variant<int64_t, std::string> & x);
void to_json(json & j, const boost::variant<int64_t, std::string> & x);
inline void from_json(const json & j, quicktype::ActionAuthorization& x) {
x.set_actor(j.at("actor").get<std::string>());
x.set_permission(j.at("permission").get<std::string>());
}
inline void to_json(json & j, const quicktype::ActionAuthorization & x) {
j = json::object();
j["actor"] = x.get_actor();
j["permission"] = x.get_permission();
}
inline void from_json(const json & j, quicktype::ActionElement& x) {
x.set_account(j.at("account").get<std::string>());
x.set_authorization(j.at("authorization").get<std::vector<quicktype::ActionAuthorization>>());
x.set_data(j.at("data").get<std::map<std::string, json>>());
x.set_hex_data(j.at("hex_data").get<std::string>());
x.set_name(j.at("name").get<std::string>());
}
inline void to_json(json & j, const quicktype::ActionElement & x) {
j = json::object();
j["account"] = x.get_account();
j["authorization"] = x.get_authorization();
j["data"] = x.get_data();
j["hex_data"] = x.get_hex_data();
j["name"] = x.get_name();
}
inline void from_json(const json & j, quicktype::ContextFreeActionAuthorization& x) {
x.set_actor(j.at("actor").get<std::string>());
x.set_permission(j.at("permission").get<std::string>());
}
inline void to_json(json & j, const quicktype::ContextFreeActionAuthorization & x) {
j = json::object();
j["actor"] = x.get_actor();
j["permission"] = x.get_permission();
}
inline void from_json(const json & j, quicktype::ContextFreeActionElement& x) {
x.set_account(j.at("account").get<std::string>());
x.set_authorization(j.at("authorization").get<std::vector<quicktype::ContextFreeActionAuthorization>>());
x.set_data(j.at("data").get<std::map<std::string, json>>());
x.set_hex_data(j.at("hex_data").get<std::string>());
x.set_name(j.at("name").get<std::string>());
}
inline void to_json(json & j, const quicktype::ContextFreeActionElement & x) {
j = json::object();
j["account"] = x.get_account();
j["authorization"] = x.get_authorization();
j["data"] = x.get_data();
j["hex_data"] = x.get_hex_data();
j["name"] = x.get_name();
}
inline void from_json(const json & j, quicktype::Coordinate& x) {
x.set_actions(j.at("actions").get<std::vector<quicktype::ActionElement>>());
x.set_context_free_actions(j.at("context_free_actions").get<std::vector<quicktype::ContextFreeActionElement>>());
x.set_delay_sec(j.at("delay_sec").get<int64_t>());
x.set_expiration(j.at("expiration").get<std::string>());
x.set_max_cpu_usage_ms(j.at("max_cpu_usage_ms").get<quicktype::WholeNumber>());
x.set_max_net_usage_words(j.at("max_net_usage_words").get<quicktype::WholeNumber>());
x.set_ref_block_num(j.at("ref_block_num").get<int64_t>());
x.set_ref_block_prefix(j.at("ref_block_prefix").get<int64_t>());
x.set_transaction_extensions(j.at("transaction_extensions").get<std::vector<std::vector<quicktype::Extension>>>());
}
inline void to_json(json & j, const quicktype::Coordinate & x) {
j = json::object();
j["actions"] = x.get_actions();
j["context_free_actions"] = x.get_context_free_actions();
j["delay_sec"] = x.get_delay_sec();
j["expiration"] = x.get_expiration();
j["max_cpu_usage_ms"] = x.get_max_cpu_usage_ms();
j["max_net_usage_words"] = x.get_max_net_usage_words();
j["ref_block_num"] = x.get_ref_block_num();
j["ref_block_prefix"] = x.get_ref_block_prefix();
j["transaction_extensions"] = x.get_transaction_extensions();
}
inline void from_json(const json & j, boost::variant<int64_t, std::string> & x) {
if (j.is_number_integer())
x = j.get<int64_t>();
else if (j.is_string())
x = j.get<std::string>();
else throw "Could not deserialize";
}
inline void to_json(json & j, const boost::variant<int64_t, std::string> & x) {
switch (x.which()) {
case 0:
j = boost::get<int64_t>(x);
break;
case 1:
j = boost::get<std::string>(x);
break;
default: throw "Input JSON does not conform to schema";
}
}
}
{
"type": "object",
"additionalProperties": false,
"minProperties": 9,
"required": [
"expiration",
"ref_block_num",
"ref_block_prefix",
"max_net_usage_words",
"max_cpu_usage_ms",
"delay_sec",
"context_free_actions",
"actions",
"transaction_extensions"
],
"properties": {
"expiration": {
"description": "Time that transaction must be confirmed by.",
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$",
"id": "https://eosio.github.io/schemas/DateTime.json",
"title": "DateTime"
},
"ref_block_num": { "type": "integer" },
"ref_block_prefix": { "type": "integer" },
"max_net_usage_words": {
"description": "A whole number",
"anyOf": [ { "type": "string", "pattern": "^\\d+$" }, { "type": "integer" } ],
"id": "https://eosio.github.io/schemas/WholeNumber.json",
"title": "WholeNumber"
},
"max_cpu_usage_ms": {
"description": "A whole number",
"anyOf": [ { "type": "string", "pattern": "^\\d+$" }, { "type": "integer" } ],
"id": "https://eosio.github.io/schemas/WholeNumber.json",
"title": "WholeNumber"
},
"delay_sec": { "type": "integer" },
"context_free_actions": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"minProperties": 5,
"required": [ "account", "name", "authorization", "data", "hex_data" ],
"properties": {
"account": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
},
"name": {
"type": "string",
"description": "C++ variable signature",
"pattern": "^([a-z1-9]{1}[a-z1-9_]{0,30}[a-z1-9]{1})$",
"id": "https://eosio.github.io/schemas/CppSignature.json",
"title": "CppSignature"
},
"authorization": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"minProperties": 2,
"required": [ "actor", "permission" ],
"properties": {
"actor": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
},
"permission": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
}
},
"id": "https://eosio.github.io/schemas/Authority.json",
"title": "Authority"
}
},
"data": { "type": "object", "additionalProperties": true },
"hex_data": { "type": "string" }
},
"id": "https://eosio.github.io/schemas/Action.json",
"title": "Action"
}
},
"actions": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"minProperties": 5,
"required": [ "account", "name", "authorization", "data", "hex_data" ],
"properties": {
"account": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
},
"name": {
"type": "string",
"description": "C++ variable signature",
"pattern": "^([a-z1-9]{1}[a-z1-9_]{0,30}[a-z1-9]{1})$",
"id": "https://eosio.github.io/schemas/CppSignature.json",
"title": "CppSignature"
},
"authorization": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"minProperties": 2,
"required": [ "actor", "permission" ],
"properties": {
"actor": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
},
"permission": {
"anyOf": [
{
"type": "string",
"description": "String representation of privileged EOSIO name type",
"pattern": "^(eosio[\\.][a-z1-5]{1,6})$",
"id": "https://eosio.github.io/schemas/NamePrivileged.json",
"title": "NamePrivileged"
},
{
"type": "string",
"description": "String representation of basic EOSIO name type, must be 12 characters and contain only a-z and 0-5",
"pattern": "^[a-z]{1}[a-z1-5]{11}$",
"id": "https://eosio.github.io/schemas/NameBasic.json",
"title": "NameBasic"
},
{
"type": "string",
"description": "String representation of EOSIO bid name type, 1-12 characters and only a-z and 0-5 are allowed",
"pattern": "^([a-z1-5]{1,12})$",
"id": "https://eosio.github.io/schemas/NameBid.json",
"title": "NameBid"
},
{
"type": "string",
"description": "String representation of EOSIO name type",
"pattern": "^([a-z1-5]{1}[a-z1-5\\.]{0,10}[a-z1-5]{1})$",
"id": "https://eosio.github.io/schemas/NameCatchAll.json",
"title": "NameCatchAll"
}
],
"id": "https://eosio.github.io/schemas/Name.json",
"title": "Name"
}
},
"id": "https://eosio.github.io/schemas/Authority.json",
"title": "Authority"
}
},
"data": { "type": "object", "additionalProperties": true },
"hex_data": { "type": "string" }
},
"id": "https://eosio.github.io/schemas/Action.json",
"title": "Action"
}
},
"transaction_extensions": {
"type": "array",
"items": {
"type": "array",
"items": { "anyOf": [ { "type": "integer" }, { "type": "string" } ] },
"id": "https://eosio.github.io/schemas/Extension.json",
"title": "Extension"
}
}
},
"id": "https://eosio.github.io/schemas/Transaction.json",
"title": "Transaction"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment