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

15
dist/index.js vendored

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

15
dist/index.mjs vendored

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

15
dist/tornado.umd.js vendored

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

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