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; idb: IndexedDB;
instanceName: string; instanceName: string;
}): Promise<BaseEvents<T>>; }): 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; staticUrl: string;
instanceName: string; instanceName: string;
deployedBlock: number; deployedBlock: number;
zipDigest?: string;
}): Promise<CachedEvents<T>>; }): Promise<CachedEvents<T>>;
export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstructor { export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstructor {
staticUrl: string; staticUrl: string;
@ -23,6 +24,7 @@ export interface DBTornadoServiceConstructor extends BaseTornadoServiceConstruct
export declare class DBTornadoService extends BaseTornadoService { export declare class DBTornadoService extends BaseTornadoService {
staticUrl: string; staticUrl: string;
idb: IndexedDB; idb: IndexedDB;
zipDigest?: string;
constructor(params: DBTornadoServiceConstructor); constructor(params: DBTornadoServiceConstructor);
getEventsFromDB(): Promise<BaseEvents<DepositsEvents | WithdrawalsEvents>>; getEventsFromDB(): Promise<BaseEvents<DepositsEvents | WithdrawalsEvents>>;
getEventsFromCache(): Promise<CachedEvents<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* ({ return __async$a(this, arguments, function* ({
staticUrl, staticUrl,
instanceName, instanceName,
deployedBlock deployedBlock,
zipDigest
}) { }) {
var _a; var _a;
try { try {
const zipName = `${instanceName}.json`.toLowerCase(); const zipName = `${instanceName}.json`.toLowerCase();
const events = yield downloadZip({ const events = yield downloadZip({
staticUrl, staticUrl,
zipName zipName,
zipDigest
}); });
if (!Array.isArray(events)) { if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`; const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -3979,7 +3981,8 @@ class DBTornadoService extends BaseTornadoService {
return yield loadRemoteEvents({ return yield loadRemoteEvents({
staticUrl: this.staticUrl, staticUrl: this.staticUrl,
instanceName: this.getInstanceName(), 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* ({ return __async$a(this, arguments, function* ({
staticUrl, staticUrl,
instanceName, instanceName,
deployedBlock deployedBlock,
zipDigest
}) { }) {
var _a; var _a;
try { try {
const zipName = `${instanceName}.json`.toLowerCase(); const zipName = `${instanceName}.json`.toLowerCase();
const events = yield downloadZip({ const events = yield downloadZip({
staticUrl, staticUrl,
zipName zipName,
zipDigest
}); });
if (!Array.isArray(events)) { if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`; const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -3958,7 +3960,8 @@ class DBTornadoService extends BaseTornadoService {
return yield loadRemoteEvents({ return yield loadRemoteEvents({
staticUrl: this.staticUrl, staticUrl: this.staticUrl,
instanceName: this.getInstanceName(), 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* ({ return __async(this, arguments, function* ({
staticUrl, staticUrl,
instanceName, instanceName,
deployedBlock deployedBlock,
zipDigest
}) { }) {
var _a; var _a;
try { try {
const zipName = `${instanceName}.json`.toLowerCase(); const zipName = `${instanceName}.json`.toLowerCase();
const events = yield (0,_zip__WEBPACK_IMPORTED_MODULE_0__/* .downloadZip */ ._6)({ const events = yield (0,_zip__WEBPACK_IMPORTED_MODULE_0__/* .downloadZip */ ._6)({
staticUrl, staticUrl,
zipName zipName,
zipDigest
}); });
if (!Array.isArray(events)) { if (!Array.isArray(events)) {
const errStr = `Invalid events from ${staticUrl}/${zipName}`; const errStr = `Invalid events from ${staticUrl}/${zipName}`;
@ -60050,7 +60052,8 @@ class DBTornadoService extends _base__WEBPACK_IMPORTED_MODULE_1__/* .BaseTornado
return yield loadRemoteEvents({ return yield loadRemoteEvents({
staticUrl: this.staticUrl, staticUrl: this.staticUrl,
instanceName: this.getInstanceName(), 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, staticUrl,
instanceName, instanceName,
deployedBlock, deployedBlock,
zipDigest,
}: { }: {
staticUrl: string; staticUrl: string;
instanceName: string; instanceName: string;
deployedBlock: number; deployedBlock: number;
zipDigest?: string;
}): Promise<CachedEvents<T>> { }): Promise<CachedEvents<T>> {
try { try {
const zipName = `${instanceName}.json`.toLowerCase(); const zipName = `${instanceName}.json`.toLowerCase();
@ -84,6 +86,7 @@ export async function loadRemoteEvents<T extends MinimalEvents>({
const events = await downloadZip<T[]>({ const events = await downloadZip<T[]>({
staticUrl, staticUrl,
zipName, zipName,
zipDigest,
}); });
if (!Array.isArray(events)) { if (!Array.isArray(events)) {
@ -117,6 +120,8 @@ export class DBTornadoService extends BaseTornadoService {
staticUrl: string; staticUrl: string;
idb: IndexedDB; idb: IndexedDB;
zipDigest?: string;
constructor(params: DBTornadoServiceConstructor) { constructor(params: DBTornadoServiceConstructor) {
super(params); super(params);
@ -136,6 +141,7 @@ export class DBTornadoService extends BaseTornadoService {
staticUrl: this.staticUrl, staticUrl: this.staticUrl,
instanceName: this.getInstanceName(), instanceName: this.getInstanceName(),
deployedBlock: this.deployedBlock, deployedBlock: this.deployedBlock,
zipDigest: this.zipDigest,
}); });
} }