envio
Version:
A latency and sync speed optimized, developer friendly blockchain data indexer.
63 lines (54 loc) • 2.22 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 Caml_js_exceptions = require("rescript/lib/js/caml_js_exceptions.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_";
function makeCacheTable(effectName) {
return Table.mkTable(cacheTablePrefix + effectName, [], [
Table.mkField("id", "TEXT", S$RescriptSchema.string, undefined, undefined, undefined, true, undefined, undefined),
Table.mkField("output", "JSONB", S$RescriptSchema.json(false), undefined, undefined, true, undefined, undefined, undefined)
]);
}
function prettifyExn(exn) {
var e = Caml_js_exceptions.internalToOCamlException(exn);
if (e.RE_EXN_ID === Js_exn.$$Error) {
return e._1;
} else {
return e;
}
}
exports.fuelSupplyParamsSchema = fuelSupplyParamsSchema;
exports.fuelTransferParamsSchema = fuelTransferParamsSchema;
exports.makeEnumConfig = makeEnumConfig;
exports.cacheTablePrefix = cacheTablePrefix;
exports.makeCacheTable = makeCacheTable;
exports.prettifyExn = prettifyExn;
/* fuelSupplyParamsSchema Not a pure module */