Add getTovarishType for events

This commit is contained in:
Tornado Contrib 2024-09-29 03:49:00 +00:00
parent df1fcebfe3
commit bdcf48db73
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
7 changed files with 61 additions and 8 deletions

@ -42,6 +42,7 @@ export declare class BaseEventsService<EventType extends MinimalEvents> {
constructor({ netId, provider, graphApi, subgraphName, contract, type, deployedBlock, fetchDataOptions, }: BaseEventsServiceConstructor);
getInstanceName(): string;
getType(): string;
getTovarishType(): string;
getGraphMethod(): string;
getGraphParams(): BaseGraphParams;
updateEventProgress({ percentage, type, fromBlock, toBlock, count }: Parameters<BatchEventOnProgress>[0]): void;
@ -147,6 +148,7 @@ export declare class BaseEncryptedNotesService extends BaseEventsService<Encrypt
constructor({ netId, provider, graphApi, subgraphName, Router, deployedBlock, fetchDataOptions, }: BaseEncryptedNotesServiceConstructor);
getInstanceName(): string;
getType(): string;
getTovarishType(): string;
getGraphMethod(): string;
formatEvents(events: EventLog[]): Promise<EncryptedNotesEvents[]>;
}
@ -164,6 +166,7 @@ export declare class BaseGovernanceService extends BaseEventsService<AllGovernan
constructor({ netId, provider, graphApi, subgraphName, Governance, deployedBlock, fetchDataOptions, }: BaseGovernanceServiceConstructor);
getInstanceName(): string;
getType(): string;
getTovarishType(): string;
getGraphMethod(): string;
formatEvents(events: EventLog[]): Promise<AllGovernanceEvents[]>;
getEventsFromGraph({ fromBlock }: {
@ -207,6 +210,7 @@ export declare class BaseRegistryService extends BaseEventsService<RegistersEven
constructor({ netId, provider, graphApi, subgraphName, RelayerRegistry, Aggregator, relayerEnsSubdomains, deployedBlock, fetchDataOptions, }: BaseRegistryServiceConstructor);
getInstanceName(): string;
getType(): string;
getTovarishType(): string;
getGraphMethod(): string;
formatEvents(events: EventLog[]): Promise<{
ensName: any;

15
dist/index.js vendored

@ -371,7 +371,6 @@ function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) {
return provider;
}
const populateTransaction = (signer, tx) => __async$c(void 0, null, function* () {
var _a;
const provider = signer.provider;
if (!tx.from) {
tx.from = signer.address;
@ -381,7 +380,7 @@ const populateTransaction = (signer, tx) => __async$c(void 0, null, function* ()
}
const [feeData, nonce] = yield Promise.all([
tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(),
(_a = tx.nonce) != null ? _a : provider.getTransactionCount(signer.address, "pending")
tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending")
]);
if (feeData) {
if (feeData.maxFeePerGas) {
@ -2815,6 +2814,9 @@ class BaseEventsService {
getType() {
return this.type || "";
}
getTovarishType() {
return String(this.type || "").toLowerCase();
}
getGraphMethod() {
return "";
}
@ -3154,6 +3156,9 @@ class BaseEncryptedNotesService extends BaseEventsService {
getType() {
return "EncryptedNote";
}
getTovarishType() {
return "encrypted_notes";
}
getGraphMethod() {
return "getAllEncryptedNotes";
}
@ -3197,6 +3202,9 @@ class BaseGovernanceService extends BaseEventsService {
getType() {
return "*";
}
getTovarishType() {
return "governance";
}
getGraphMethod() {
return "getAllGovernanceEvents";
}
@ -3323,6 +3331,9 @@ class BaseRegistryService extends BaseEventsService {
getType() {
return "RelayerRegistered";
}
getTovarishType() {
return "registered";
}
// Name of method used for graph
getGraphMethod() {
return "getAllRegisters";

15
dist/index.mjs vendored

@ -350,7 +350,6 @@ function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) {
return provider;
}
const populateTransaction = (signer, tx) => __async$c(void 0, null, function* () {
var _a;
const provider = signer.provider;
if (!tx.from) {
tx.from = signer.address;
@ -360,7 +359,7 @@ const populateTransaction = (signer, tx) => __async$c(void 0, null, function* ()
}
const [feeData, nonce] = yield Promise.all([
tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(),
(_a = tx.nonce) != null ? _a : provider.getTransactionCount(signer.address, "pending")
tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending")
]);
if (feeData) {
if (feeData.maxFeePerGas) {
@ -2794,6 +2793,9 @@ class BaseEventsService {
getType() {
return this.type || "";
}
getTovarishType() {
return String(this.type || "").toLowerCase();
}
getGraphMethod() {
return "";
}
@ -3133,6 +3135,9 @@ class BaseEncryptedNotesService extends BaseEventsService {
getType() {
return "EncryptedNote";
}
getTovarishType() {
return "encrypted_notes";
}
getGraphMethod() {
return "getAllEncryptedNotes";
}
@ -3176,6 +3181,9 @@ class BaseGovernanceService extends BaseEventsService {
getType() {
return "*";
}
getTovarishType() {
return "governance";
}
getGraphMethod() {
return "getAllGovernanceEvents";
}
@ -3302,6 +3310,9 @@ class BaseRegistryService extends BaseEventsService {
getType() {
return "RelayerRegistered";
}
getTovarishType() {
return "registered";
}
// Name of method used for graph
getGraphMethod() {
return "getAllRegisters";

15
dist/tornado.umd.js vendored

@ -59158,6 +59158,9 @@ class BaseEventsService {
getType() {
return this.type || "";
}
getTovarishType() {
return String(this.type || "").toLowerCase();
}
getGraphMethod() {
return "";
}
@ -59497,6 +59500,9 @@ class BaseEncryptedNotesService extends BaseEventsService {
getType() {
return "EncryptedNote";
}
getTovarishType() {
return "encrypted_notes";
}
getGraphMethod() {
return "getAllEncryptedNotes";
}
@ -59540,6 +59546,9 @@ class BaseGovernanceService extends BaseEventsService {
getType() {
return "*";
}
getTovarishType() {
return "governance";
}
getGraphMethod() {
return "getAllGovernanceEvents";
}
@ -59666,6 +59675,9 @@ class BaseRegistryService extends BaseEventsService {
getType() {
return "RelayerRegistered";
}
getTovarishType() {
return "registered";
}
// Name of method used for graph
getGraphMethod() {
return "getAllRegisters";
@ -71300,7 +71312,6 @@ function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) {
return provider;
}
const populateTransaction = (signer, tx) => __async(void 0, null, function* () {
var _a;
const provider = signer.provider;
if (!tx.from) {
tx.from = signer.address;
@ -71310,7 +71321,7 @@ const populateTransaction = (signer, tx) => __async(void 0, null, function* () {
}
const [feeData, nonce] = yield Promise.all([
tx.maxFeePerGas || tx.gasPrice ? void 0 : provider.getFeeData(),
(_a = tx.nonce) != null ? _a : provider.getTransactionCount(signer.address, "pending")
tx.nonce ? void 0 : provider.getTransactionCount(signer.address, "pending")
]);
if (feeData) {
if (feeData.maxFeePerGas) {

File diff suppressed because one or more lines are too long

@ -130,6 +130,10 @@ export class BaseEventsService<EventType extends MinimalEvents> {
return this.type || '';
}
getTovarishType(): string {
return String(this.type || '').toLowerCase();
}
getGraphMethod(): string {
return '';
}
@ -566,6 +570,10 @@ export class BaseEncryptedNotesService extends BaseEventsService<EncryptedNotesE
return 'EncryptedNote';
}
getTovarishType(): string {
return 'encrypted_notes';
}
getGraphMethod(): string {
return 'getAllEncryptedNotes';
}
@ -630,6 +638,10 @@ export class BaseGovernanceService extends BaseEventsService<AllGovernanceEvents
return '*';
}
getTovarishType(): string {
return 'governance';
}
getGraphMethod() {
return 'getAllGovernanceEvents';
}
@ -821,6 +833,10 @@ export class BaseRegistryService extends BaseEventsService<RegistersEvents> {
return 'RelayerRegistered';
}
getTovarishType(): string {
return 'registered';
}
// Name of method used for graph
getGraphMethod() {
return 'getAllRegisters';

@ -322,7 +322,7 @@ export const populateTransaction = async (
const [feeData, nonce] = await Promise.all([
tx.maxFeePerGas || tx.gasPrice ? undefined : provider.getFeeData(),
tx.nonce ?? provider.getTransactionCount(signer.address, 'pending'),
tx.nonce ? undefined : provider.getTransactionCount(signer.address, 'pending'),
]);
if (feeData) {