Minor updates #1

Closed
tornadocontrib wants to merge 67 commits from tornadocontrib/tornado-core:main into main
10 changed files with 51 additions and 15 deletions
Showing only changes of commit 61266bdb6e - Show all commits

11
dist/index.js vendored
View File

@ -2390,6 +2390,7 @@ const statusSchema = {
netId: { type: "integer" },
tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 },
latestBlock: { type: "number" },
latestBalance: { type: "string", BN: true },
version: { type: "string" },
health: {
type: "object",
@ -2479,7 +2480,7 @@ function getStatusSchema(netId, config, tovarish) {
schema.required.push("ethPrices");
}
if (tovarish) {
schema.required.push("gasPrices", "latestBlock", "syncStatus", "onSyncEvents");
schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents");
}
return schema;
}
@ -2699,8 +2700,8 @@ class RelayerClient {
pickWeightedRandomRelayer(relayers) {
return pickWeightedRandomRelayer(relayers);
}
tornadoWithdraw(_0) {
return __async$a(this, arguments, function* ({ contract, proof, args }) {
tornadoWithdraw(_0, _1) {
return __async$a(this, arguments, function* ({ contract, proof, args }, callback) {
const { url } = this.selectedRelayer;
const withdrawResponse = yield fetchData(`${url}v1/tornadoWithdraw`, __spreadProps$2(__spreadValues$2({}, this.fetchDataOptions), {
method: "POST",
@ -2755,6 +2756,9 @@ class RelayerClient {
`);
}
relayerStatus = status;
if (typeof callback === "function") {
callback(jobResponse);
}
}
yield sleep(3e3);
}
@ -6800,6 +6804,7 @@ class TovarishClient extends RelayerClient {
tornadoServiceFee: status.tornadoServiceFee,
// Additional fields for tovarish relayer
latestBlock: Number(status.latestBlock),
latestBalance: status.latestBalance,
version: status.version,
events: status.events,
syncStatus: status.syncStatus

11
dist/index.mjs vendored
View File

@ -2369,6 +2369,7 @@ const statusSchema = {
netId: { type: "integer" },
tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 },
latestBlock: { type: "number" },
latestBalance: { type: "string", BN: true },
version: { type: "string" },
health: {
type: "object",
@ -2458,7 +2459,7 @@ function getStatusSchema(netId, config, tovarish) {
schema.required.push("ethPrices");
}
if (tovarish) {
schema.required.push("gasPrices", "latestBlock", "syncStatus", "onSyncEvents");
schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents");
}
return schema;
}
@ -2678,8 +2679,8 @@ class RelayerClient {
pickWeightedRandomRelayer(relayers) {
return pickWeightedRandomRelayer(relayers);
}
tornadoWithdraw(_0) {
return __async$a(this, arguments, function* ({ contract, proof, args }) {
tornadoWithdraw(_0, _1) {
return __async$a(this, arguments, function* ({ contract, proof, args }, callback) {
const { url } = this.selectedRelayer;
const withdrawResponse = yield fetchData(`${url}v1/tornadoWithdraw`, __spreadProps$2(__spreadValues$2({}, this.fetchDataOptions), {
method: "POST",
@ -2734,6 +2735,9 @@ class RelayerClient {
`);
}
relayerStatus = status;
if (typeof callback === "function") {
callback(jobResponse);
}
}
yield sleep(3e3);
}
@ -6779,6 +6783,7 @@ class TovarishClient extends RelayerClient {
tornadoServiceFee: status.tornadoServiceFee,
// Additional fields for tovarish relayer
latestBlock: Number(status.latestBlock),
latestBalance: status.latestBalance,
version: status.version,
events: status.events,
syncStatus: status.syncStatus

View File

@ -143,5 +143,5 @@ export declare class RelayerClient {
invalidRelayers: RelayerError[];
}>;
pickWeightedRandomRelayer(relayers: RelayerInfo[]): RelayerInfo;
tornadoWithdraw({ contract, proof, args }: TornadoWithdrawParams): Promise<void>;
tornadoWithdraw({ contract, proof, args }: TornadoWithdrawParams, callback?: (jobResp: RelayerTornadoJobs) => void): Promise<void>;
}

View File

@ -56,9 +56,13 @@ export type statusSchema = {
maximum: number;
minimum: number;
};
latestBlock?: {
latestBlock: {
type: string;
};
latestBalance: {
type: string;
BN: boolean;
};
version: {
type: string;
};

11
dist/tornado.umd.js vendored
View File

@ -71729,8 +71729,8 @@ class RelayerClient {
pickWeightedRandomRelayer(relayers) {
return pickWeightedRandomRelayer(relayers);
}
tornadoWithdraw(_0) {
return __async(this, arguments, function* ({ contract, proof, args }) {
tornadoWithdraw(_0, _1) {
return __async(this, arguments, function* ({ contract, proof, args }, callback) {
const { url } = this.selectedRelayer;
const withdrawResponse = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}v1/tornadoWithdraw`, __spreadProps(__spreadValues({}, this.fetchDataOptions), {
method: "POST",
@ -71785,6 +71785,9 @@ class RelayerClient {
`);
}
relayerStatus = status;
if (typeof callback === "function") {
callback(jobResponse);
}
}
yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(3e3);
}
@ -71832,6 +71835,7 @@ const statusSchema = {
netId: { type: "integer" },
tornadoServiceFee: { type: "number", maximum: 20, minimum: 0 },
latestBlock: { type: "number" },
latestBalance: { type: "string", BN: true },
version: { type: "string" },
health: {
type: "object",
@ -71921,7 +71925,7 @@ function getStatusSchema(netId, config, tovarish) {
schema.required.push("ethPrices");
}
if (tovarish) {
schema.required.push("gasPrices", "latestBlock", "syncStatus", "onSyncEvents");
schema.required.push("gasPrices", "latestBlock", "latestBalance", "syncStatus", "onSyncEvents");
}
return schema;
}
@ -72174,6 +72178,7 @@ class TovarishClient extends _relayerClient__WEBPACK_IMPORTED_MODULE_0__/* .Rela
tornadoServiceFee: status.tornadoServiceFee,
// Additional fields for tovarish relayer
latestBlock: Number(status.latestBlock),
latestBalance: status.latestBalance,
version: status.version,
events: status.events,
syncStatus: status.syncStatus

File diff suppressed because one or more lines are too long

View File

@ -31,12 +31,14 @@ export interface TovarishSyncStatus {
gasPrice: boolean;
}
export interface TovarishStatus extends RelayerStatus {
latestBalance: string;
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;
onSyncEvents: boolean;
}
export interface TovarishInfo extends RelayerInfo {
latestBlock: number;
latestBalance: string;
version: string;
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;

View File

@ -316,7 +316,10 @@ export class RelayerClient {
return pickWeightedRandomRelayer(relayers);
}
async tornadoWithdraw({ contract, proof, args }: TornadoWithdrawParams) {
async tornadoWithdraw(
{ contract, proof, args }: TornadoWithdrawParams,
callback?: (jobResp: RelayerTornadoJobs) => void,
) {
const { url } = this.selectedRelayer as RelayerInfo;
const withdrawResponse = (await fetchData(`${url}v1/tornadoWithdraw`, {
@ -381,6 +384,10 @@ export class RelayerClient {
}
relayerStatus = status;
if (typeof callback === 'function') {
callback(jobResponse as unknown as RelayerTornadoJobs);
}
}
await sleep(3000);

View File

@ -56,9 +56,13 @@ export type statusSchema = {
maximum: number;
minimum: number;
};
latestBlock?: {
latestBlock: {
type: string;
};
latestBalance: {
type: string;
BN: boolean;
};
version: {
type: string;
};
@ -106,6 +110,7 @@ const statusSchema: statusSchema = {
netId: { type: 'integer' },
tornadoServiceFee: { type: 'number', maximum: 20, minimum: 0 },
latestBlock: { type: 'number' },
latestBalance: { type: 'string', BN: true },
version: { type: 'string' },
health: {
type: 'object',
@ -204,7 +209,7 @@ export function getStatusSchema(netId: NetIdType, config: Config, tovarish: bool
}
if (tovarish) {
schema.required.push('gasPrices', 'latestBlock', 'syncStatus', 'onSyncEvents');
schema.required.push('gasPrices', 'latestBlock', 'latestBalance', 'syncStatus', 'onSyncEvents');
}
return schema;

View File

@ -50,6 +50,7 @@ export interface TovarishSyncStatus {
// Expected response from /status endpoint
export interface TovarishStatus extends RelayerStatus {
latestBalance: string;
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;
onSyncEvents: boolean;
@ -58,6 +59,7 @@ export interface TovarishStatus extends RelayerStatus {
// Formatted TovarishStatus for Frontend usage
export interface TovarishInfo extends RelayerInfo {
latestBlock: number;
latestBalance: string;
version: string;
events: TovarishEventsStatus;
syncStatus: TovarishSyncStatus;
@ -130,6 +132,7 @@ export class TovarishClient extends RelayerClient {
tornadoServiceFee: status.tornadoServiceFee,
// Additional fields for tovarish relayer
latestBlock: Number(status.latestBlock),
latestBalance: status.latestBalance,
version: status.version,
events: status.events,
syncStatus: status.syncStatus,