envio
Version:
A latency and sync speed optimized, developer friendly blockchain data indexer.
176 lines (158 loc) • 3.58 kB
JavaScript
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Table from "./db/Table.res.mjs";
import * as Utils from "./Utils.res.mjs";
import * as Address from "./Address.res.mjs";
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
let allEvmBlockFields = [
"number",
"timestamp",
"hash",
"parentHash",
"nonce",
"sha3Uncles",
"logsBloom",
"transactionsRoot",
"stateRoot",
"receiptsRoot",
"miner",
"difficulty",
"totalDifficulty",
"extraData",
"size",
"gasLimit",
"gasUsed",
"uncles",
"baseFeePerGas",
"blobGasUsed",
"excessBlobGas",
"parentBeaconBlockRoot",
"withdrawalsRoot",
"l1BlockNumber",
"sendCount",
"sendRoot",
"mixHash"
];
let evmBlockFieldSchema = S$RescriptSchema.$$enum(allEvmBlockFields);
let allEvmTransactionFields = [
"transactionIndex",
"hash",
"from",
"to",
"gas",
"gasPrice",
"maxPriorityFeePerGas",
"maxFeePerGas",
"cumulativeGasUsed",
"effectiveGasPrice",
"gasUsed",
"input",
"nonce",
"value",
"v",
"r",
"s",
"contractAddress",
"logsBloom",
"root",
"status",
"yParity",
"accessList",
"maxFeePerBlobGas",
"blobVersionedHashes",
"type",
"l1Fee",
"l1GasPrice",
"l1GasUsed",
"l1FeeScalar",
"gasUsedForL1",
"authorizationList"
];
let evmTransactionFieldSchema = S$RescriptSchema.$$enum(allEvmTransactionFields);
let evmNullableBlockFields = new Set([
"nonce",
"difficulty",
"totalDifficulty",
"uncles",
"baseFeePerGas",
"blobGasUsed",
"excessBlobGas",
"parentBeaconBlockRoot",
"withdrawalsRoot",
"l1BlockNumber",
"sendCount",
"sendRoot",
"mixHash"
]);
let evmNullableTransactionFields = new Set([
"gasPrice",
"v",
"r",
"s",
"yParity",
"maxPriorityFeePerGas",
"maxFeePerGas",
"maxFeePerBlobGas",
"blobVersionedHashes",
"contractAddress",
"root",
"status",
"l1Fee",
"l1GasPrice",
"l1GasUsed",
"l1FeeScalar",
"gasUsedForL1",
"from",
"to",
"type"
]);
function dependsOnAddresses(isWildcard, filterByAddresses) {
if (isWildcard) {
return filterByAddresses;
} else {
return true;
}
}
function getItemChainId(item) {
if (item.kind === 0) {
return item.chain;
} else {
return item.onBlockConfig.chainId;
}
}
let fuelSupplyParamsSchema = S$RescriptSchema.schema(s => ({
subId: s.m(S$RescriptSchema.string),
amount: s.m(Utils.$$BigInt.schema)
}));
let fuelTransferParamsSchema = S$RescriptSchema.schema(s => ({
to: s.m(Address.schema),
assetId: s.m(S$RescriptSchema.string),
amount: s.m(Utils.$$BigInt.schema)
}));
let cacheTablePrefix = "envio_effect_";
let cacheOutputSchema = S$RescriptSchema.json(false);
function makeCacheTable(effectName) {
return Table.mkTable(cacheTablePrefix + effectName, undefined, [
Table.mkField("id", "String", S$RescriptSchema.string, undefined, undefined, undefined, true, undefined, undefined, undefined, undefined, undefined),
Table.mkField("output", "Json", cacheOutputSchema, undefined, undefined, true, undefined, undefined, undefined, undefined, undefined, undefined)
], undefined);
}
let loadedFromDbCheckpointId = 0n;
let initialCheckpointId = 0n;
export {
allEvmBlockFields,
evmBlockFieldSchema,
allEvmTransactionFields,
evmTransactionFieldSchema,
evmNullableBlockFields,
evmNullableTransactionFields,
dependsOnAddresses,
getItemChainId,
fuelSupplyParamsSchema,
fuelTransferParamsSchema,
cacheTablePrefix,
cacheOutputSchema,
makeCacheTable,
loadedFromDbCheckpointId,
initialCheckpointId,
}
/* evmBlockFieldSchema Not a pure module */