forked from tornado-packages/tornado-core
Add latestBalance params
This commit is contained in:
parent
a00dab8d06
commit
61266bdb6e
11
dist/index.js
vendored
11
dist/index.js
vendored
@ -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
11
dist/index.mjs
vendored
@ -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
|
||||
|
2
dist/relayerClient.d.ts
vendored
2
dist/relayerClient.d.ts
vendored
@ -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>;
|
||||
}
|
||||
|
6
dist/schemas/status.d.ts
vendored
6
dist/schemas/status.d.ts
vendored
@ -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
11
dist/tornado.umd.js
vendored
@ -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
|
||||
|
2
dist/tornado.umd.min.js
vendored
2
dist/tornado.umd.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/tovarishClient.d.ts
vendored
2
dist/tovarishClient.d.ts
vendored
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user