tornado-core 1.0.18

* improved events
This commit is contained in:
Tornado Contrib 2024-10-02 12:50:25 +00:00
parent 4a884e4f41
commit 2092214da2
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
10 changed files with 46 additions and 46 deletions

@ -1,7 +1,7 @@
import { RelayerParams } from '../relayerClient';
export interface BaseEvents<T> {
events: T[];
lastBlock: number | null;
lastBlock: number;
}
export interface CachedEvents<T> extends BaseEvents<T> {
fromCache: boolean;

16
dist/index.js vendored

@ -433,7 +433,7 @@ class TornadoWallet extends ethers.Wallet {
populateTransaction(tx) {
return __async$d(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet$2(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject);
});
}
@ -449,7 +449,7 @@ class TornadoVoidSigner extends ethers.VoidSigner {
populateTransaction(tx) {
return __async$d(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet$2(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject);
});
}
@ -3072,7 +3072,7 @@ class BaseEventsService {
return __async$9(this, null, function* () {
return {
events: [],
lastBlock: null
lastBlock: 0
};
});
}
@ -3083,18 +3083,18 @@ class BaseEventsService {
return __async$9(this, null, function* () {
return {
events: [],
lastBlock: null,
lastBlock: 0,
fromCache: true
};
});
}
getSavedEvents() {
return __async$9(this, null, function* () {
let cachedEvents = yield this.getEventsFromDB();
if (!cachedEvents || !cachedEvents.events.length) {
cachedEvents = yield this.getEventsFromCache();
let dbEvents = yield this.getEventsFromDB();
if (!dbEvents.lastBlock) {
dbEvents = yield this.getEventsFromCache();
}
return cachedEvents;
return dbEvents;
});
}
/**

16
dist/index.mjs vendored

@ -412,7 +412,7 @@ class TornadoWallet extends Wallet {
populateTransaction(tx) {
return __async$d(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet$2(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject);
});
}
@ -428,7 +428,7 @@ class TornadoVoidSigner extends VoidSigner {
populateTransaction(tx) {
return __async$d(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet$2(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject);
});
}
@ -3051,7 +3051,7 @@ class BaseEventsService {
return __async$9(this, null, function* () {
return {
events: [],
lastBlock: null
lastBlock: 0
};
});
}
@ -3062,18 +3062,18 @@ class BaseEventsService {
return __async$9(this, null, function* () {
return {
events: [],
lastBlock: null,
lastBlock: 0,
fromCache: true
};
});
}
getSavedEvents() {
return __async$9(this, null, function* () {
let cachedEvents = yield this.getEventsFromDB();
if (!cachedEvents || !cachedEvents.events.length) {
cachedEvents = yield this.getEventsFromCache();
let dbEvents = yield this.getEventsFromDB();
if (!dbEvents.lastBlock) {
dbEvents = yield this.getEventsFromCache();
}
return cachedEvents;
return dbEvents;
});
}
/**

10
dist/providers.d.ts vendored

@ -45,26 +45,26 @@ export type TornadoWalletOptions = {
bumpNonce?: boolean;
};
export declare class TornadoWallet extends Wallet {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;
bumpNonce: boolean;
constructor(key: string | SigningKey, provider?: null | Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions);
constructor(key: string | SigningKey, provider?: Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions);
static fromMnemonic(mneomnic: string, provider: Provider, index?: number, options?: TornadoWalletOptions): TornadoWallet;
populateTransaction(tx: TransactionRequest): Promise<import("ethers").TransactionLike<string>>;
}
export declare class TornadoVoidSigner extends VoidSigner {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;
bumpNonce: boolean;
constructor(address: string, provider?: null | Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions);
constructor(address: string, provider?: Provider, { gasPriceBump, gasLimitBump, gasFailover, bumpNonce }?: TornadoWalletOptions);
populateTransaction(tx: TransactionRequest): Promise<import("ethers").TransactionLike<string>>;
}
export declare class TornadoRpcSigner extends JsonRpcSigner {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;

16
dist/tornado.umd.js vendored

@ -59198,7 +59198,7 @@ class BaseEventsService {
return __async(this, null, function* () {
return {
events: [],
lastBlock: null
lastBlock: 0
};
});
}
@ -59209,18 +59209,18 @@ class BaseEventsService {
return __async(this, null, function* () {
return {
events: [],
lastBlock: null,
lastBlock: 0,
fromCache: true
};
});
}
getSavedEvents() {
return __async(this, null, function* () {
let cachedEvents = yield this.getEventsFromDB();
if (!cachedEvents || !cachedEvents.events.length) {
cachedEvents = yield this.getEventsFromCache();
let dbEvents = yield this.getEventsFromDB();
if (!dbEvents.lastBlock) {
dbEvents = yield this.getEventsFromCache();
}
return cachedEvents;
return dbEvents;
});
}
/**
@ -71446,7 +71446,7 @@ class TornadoWallet extends Wallet {
populateTransaction(tx) {
return __async(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject);
});
}
@ -71462,7 +71462,7 @@ class TornadoVoidSigner extends VoidSigner {
populateTransaction(tx) {
return __async(this, null, function* () {
const txObject = yield populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return __superGet(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject);
});
}

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{
"name": "@tornado/core",
"version": "1.0.17",
"version": "1.0.18",
"description": "An SDK for building applications on top of Privacy Pools",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

@ -175,7 +175,7 @@ export class BaseEventsService<EventType extends MinimalEvents> {
async getEventsFromDB(): Promise<BaseEvents<EventType>> {
return {
events: [],
lastBlock: null,
lastBlock: 0,
};
}
@ -185,19 +185,19 @@ export class BaseEventsService<EventType extends MinimalEvents> {
async getEventsFromCache(): Promise<CachedEvents<EventType>> {
return {
events: [],
lastBlock: null,
lastBlock: 0,
fromCache: true,
};
}
async getSavedEvents(): Promise<BaseEvents<EventType> | CachedEvents<EventType>> {
let cachedEvents = await this.getEventsFromDB();
let dbEvents = await this.getEventsFromDB();
if (!cachedEvents || !cachedEvents.events.length) {
cachedEvents = await this.getEventsFromCache();
if (!dbEvents.lastBlock) {
dbEvents = await this.getEventsFromCache();
}
return cachedEvents;
return dbEvents;
}
/**

@ -2,7 +2,7 @@ import { RelayerParams } from '../relayerClient';
export interface BaseEvents<T> {
events: T[];
lastBlock: number | null;
lastBlock: number;
}
export interface CachedEvents<T> extends BaseEvents<T> {

@ -379,14 +379,14 @@ export type TornadoWalletOptions = {
};
export class TornadoWallet extends Wallet {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;
bumpNonce: boolean;
constructor(
key: string | SigningKey,
provider?: null | Provider,
provider?: Provider,
{ gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {},
) {
super(key, provider);
@ -407,21 +407,21 @@ export class TornadoWallet extends Wallet {
async populateTransaction(tx: TransactionRequest) {
const txObject = await populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return super.populateTransaction(txObject);
}
}
export class TornadoVoidSigner extends VoidSigner {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;
bumpNonce: boolean;
constructor(
address: string,
provider?: null | Provider,
provider?: Provider,
{ gasPriceBump, gasLimitBump, gasFailover, bumpNonce }: TornadoWalletOptions = {},
) {
super(address, provider);
@ -436,14 +436,14 @@ export class TornadoVoidSigner extends VoidSigner {
async populateTransaction(tx: TransactionRequest) {
const txObject = await populateTransaction(this, tx);
this.nonce = txObject.nonce;
this.nonce = Number(txObject.nonce);
return super.populateTransaction(txObject);
}
}
export class TornadoRpcSigner extends JsonRpcSigner {
nonce?: number | null;
nonce?: number;
gasPriceBump: number;
gasLimitBump: number;
gasFailover: boolean;