Add digest params

This commit is contained in:
Tornado Contrib 2024-10-05 21:05:09 +00:00
parent 58b3110125
commit 51f737b728
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
6 changed files with 28 additions and 11 deletions

4
dist/events/db.d.ts vendored

@ -11,10 +11,11 @@ export declare function loadDBEvents<T extends MinimalEvents>({ idb, instanceNam
idb: IndexedDB;
instanceName: string;
}): Promise<BaseEvents<T>>;
export declare function loadRemoteEvents<T extends MinimalEvents>({ staticUrl, instanceName, deployedBlock, }: {
export declare function loadRemoteEvents<T extends MinimalEvents>({ staticUrl, instanceName, deployedBlock, zipDigest, }: {
staticUrl: string;
instanceName: string;
deployedBlock: number;
zipDigest?: string;
}): Promise<CachedEvents<T>>;
export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstructor {
staticUrl: string;
@ -23,6 +24,7 @@ export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstruct
export declare class DBTornadoService extends BaseTornadoService {
staticUrl: string;
idb: IndexedDB;
zipDigest?: string;
constructor(params: DBTornadoServiceConstructor);
getEventsFromDB(): Promise<BaseEvents<DepositsEvents | WithdrawalsEvents>>;
getEventsFromCache(): Promise<CachedEvents<DepositsEvents | WithdrawalsEvents>>;

9
dist/index.js vendored

@ -3931,14 +3931,16 @@ function loadRemoteEvents(_0) {
return __async$a(this, arguments, function* ({
staticUrl,
instanceName,
deployedBlock
deployedBlock,
zipDigest
}) {
var _a;
try {
const zipName = `${instanceName}.json`.toLowerCase();
const events = yield downloadZip({
staticUrl,
zipName
zipName,
zipDigest
});
if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -3979,7 +3981,8 @@ class DBTornadoService extends BaseTornadoService {
return yield loadRemoteEvents({
staticUrl: this.staticUrl,
instanceName: this.getInstanceName(),
deployedBlock: this.deployedBlock
deployedBlock: this.deployedBlock,
zipDigest: this.zipDigest
});
});
}

9
dist/index.mjs vendored

@ -3910,14 +3910,16 @@ function loadRemoteEvents(_0) {
return __async$a(this, arguments, function* ({
staticUrl,
instanceName,
deployedBlock
deployedBlock,
zipDigest
}) {
var _a;
try {
const zipName = `${instanceName}.json`.toLowerCase();
const events = yield downloadZip({
staticUrl,
zipName
zipName,
zipDigest
});
if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -3958,7 +3960,8 @@ class DBTornadoService extends BaseTornadoService {
return yield loadRemoteEvents({
staticUrl: this.staticUrl,
instanceName: this.getInstanceName(),
deployedBlock: this.deployedBlock
deployedBlock: this.deployedBlock,
zipDigest: this.zipDigest
});
});
}

9
dist/tornado.umd.js vendored

@ -60002,14 +60002,16 @@ function loadRemoteEvents(_0) {
return __async(this, arguments, function* ({
staticUrl,
instanceName,
deployedBlock
deployedBlock,
zipDigest
}) {
var _a;
try {
const zipName = `${instanceName}.json`.toLowerCase();
const events = yield (0,_zip__WEBPACK_IMPORTED_MODULE_0__/* .downloadZip */ ._6)({
staticUrl,
zipName
zipName,
zipDigest
});
if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -60050,7 +60052,8 @@ class DBTornadoService extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTornado
return yield loadRemoteEvents({
staticUrl: this.staticUrl,
instanceName: this.getInstanceName(),
deployedBlock: this.deployedBlock
deployedBlock: this.deployedBlock,
zipDigest: this.zipDigest
});
});
}

File diff suppressed because one or more lines are too long

@ -73,10 +73,12 @@ export async function loadRemoteEvents<T extends MinimalEvents>({
staticUrl,
instanceName,
deployedBlock,
zipDigest,
}: {
staticUrl: string;
instanceName: string;
deployedBlock: number;
zipDigest?: string;
}): Promise<CachedEvents<T>> {
try {
const zipName = `${instanceName}.json`.toLowerCase();
@ -84,6 +86,7 @@ export async function loadRemoteEvents<T extends MinimalEvents>({
const events = await downloadZip<T[]>({
staticUrl,
zipName,
zipDigest,
});
if (!Array.isArray(events)) {
@ -117,6 +120,8 @@ export class DBTornadoService extends BaseTornadoService {
staticUrl: string;
idb: IndexedDB;
zipDigest?: string;
constructor(params: DBTornadoServiceConstructor) {
super(params);
@ -136,6 +141,7 @@ export class DBTornadoService extends BaseTornadoService {
staticUrl: this.staticUrl,
instanceName: this.getInstanceName(),
deployedBlock: this.deployedBlock,
zipDigest: this.zipDigest,
});
}