envio
Version:
A latency and sync speed optimized, developer friendly blockchain data indexer.
63 lines (53 loc) • 2.34 kB
JavaScript
// Generated by ReScript, PLEASE EDIT WITH CARE
;
var Table = require("./db/Table.res.js");
var $$BigInt = require("./bindings/BigInt.res.js");
var Js_exn = require("rescript/lib/js/js_exn.js");
var Address = require("./Address.res.js");
var Belt_Array = require("rescript/lib/js/belt_Array.js");
var Caml_option = require("rescript/lib/js/caml_option.js");
var S$RescriptSchema = require("rescript-schema/src/S.res.js");
var fuelSupplyParamsSchema = S$RescriptSchema.schema(function (s) {
return {
subId: s.m(S$RescriptSchema.string),
amount: s.m($$BigInt.schema)
};
});
var fuelTransferParamsSchema = S$RescriptSchema.schema(function (s) {
return {
to: s.m(Address.schema),
assetId: s.m(S$RescriptSchema.string),
amount: s.m($$BigInt.schema)
};
});
function makeEnumConfig(name, variants) {
var v = Belt_Array.get(variants, 0);
return {
name: name,
variants: variants,
schema: S$RescriptSchema.$$enum(variants),
default: v !== undefined ? Caml_option.valFromOption(v) : Js_exn.raiseError("No variants defined for enum " + name)
};
}
var cacheTablePrefix = "envio_effect_";
var cacheOutputSchema = S$RescriptSchema.json(false);
var effectCacheItemRowsSchema = S$RescriptSchema.array(S$RescriptSchema.schema(function (s) {
return {
id: s.m(S$RescriptSchema.string),
output: s.m(cacheOutputSchema)
};
}));
function makeCacheTable(effectName) {
return Table.mkTable(cacheTablePrefix + effectName, undefined, [
Table.mkField("id", "TEXT", S$RescriptSchema.string, undefined, undefined, undefined, true, undefined, undefined),
Table.mkField("output", "JSONB", cacheOutputSchema, undefined, undefined, true, undefined, undefined, undefined)
]);
}
exports.fuelSupplyParamsSchema = fuelSupplyParamsSchema;
exports.fuelTransferParamsSchema = fuelTransferParamsSchema;
exports.makeEnumConfig = makeEnumConfig;
exports.cacheTablePrefix = cacheTablePrefix;
exports.cacheOutputSchema = cacheOutputSchema;
exports.effectCacheItemRowsSchema = effectCacheItemRowsSchema;
exports.makeCacheTable = makeCacheTable;
/* fuelSupplyParamsSchema Not a pure module */