Allow custom URL format relayers

should be convenient  to test locally
This commit is contained in:
Tornado Contrib 2024-09-27 04:56:19 +00:00
parent c155649719
commit 82aeabd739
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
6 changed files with 30 additions and 6 deletions

7
dist/index.js vendored

@ -2611,10 +2611,15 @@ class RelayerClient {
askRelayerStatus(_0) { askRelayerStatus(_0) {
return __async$9(this, arguments, function* ({ return __async$9(this, arguments, function* ({
hostname, hostname,
url,
relayerAddress relayerAddress
}) { }) {
var _a, _b; var _a, _b;
const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; if (!url) {
url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`;
} else if (!url.endsWith("/")) {
url += "/";
}
const rawStatus = yield fetchData(`${url}status`, __spreadProps$1(__spreadValues$1({}, this.fetchDataOptions), { const rawStatus = yield fetchData(`${url}status`, __spreadProps$1(__spreadValues$1({}, this.fetchDataOptions), {
headers: { headers: {
"Content-Type": "application/json, application/x-www-form-urlencoded" "Content-Type": "application/json, application/x-www-form-urlencoded"

7
dist/index.mjs vendored

@ -2590,10 +2590,15 @@ class RelayerClient {
askRelayerStatus(_0) { askRelayerStatus(_0) {
return __async$9(this, arguments, function* ({ return __async$9(this, arguments, function* ({
hostname, hostname,
url,
relayerAddress relayerAddress
}) { }) {
var _a, _b; var _a, _b;
const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; if (!url) {
url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`;
} else if (!url.endsWith("/")) {
url += "/";
}
const rawStatus = yield fetchData(`${url}status`, __spreadProps$1(__spreadValues$1({}, this.fetchDataOptions), { const rawStatus = yield fetchData(`${url}status`, __spreadProps$1(__spreadValues$1({}, this.fetchDataOptions), {
headers: { headers: {
"Content-Type": "application/json, application/x-www-form-urlencoded" "Content-Type": "application/json, application/x-www-form-urlencoded"

@ -131,8 +131,9 @@ export declare class RelayerClient {
selectedRelayer?: RelayerInfo; selectedRelayer?: RelayerInfo;
fetchDataOptions?: fetchDataOptions; fetchDataOptions?: fetchDataOptions;
constructor({ netId, config, fetchDataOptions }: RelayerClientConstructor); constructor({ netId, config, fetchDataOptions }: RelayerClientConstructor);
askRelayerStatus({ hostname, relayerAddress, }: { askRelayerStatus({ hostname, url, relayerAddress, }: {
hostname: string; hostname: string;
url?: string;
relayerAddress?: string; relayerAddress?: string;
}): Promise<RelayerStatus>; }): Promise<RelayerStatus>;
filterRelayer(relayer: CachedRelayerInfo): Promise<RelayerInfo | RelayerError | undefined>; filterRelayer(relayer: CachedRelayerInfo): Promise<RelayerInfo | RelayerError | undefined>;

7
dist/tornado.umd.js vendored

@ -71566,10 +71566,15 @@ class RelayerClient {
askRelayerStatus(_0) { askRelayerStatus(_0) {
return __async(this, arguments, function* ({ return __async(this, arguments, function* ({
hostname, hostname,
url,
relayerAddress relayerAddress
}) { }) {
var _a, _b; var _a, _b;
const url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`; if (!url) {
url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`;
} else if (!url.endsWith("/")) {
url += "/";
}
const rawStatus = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}status`, __spreadProps(__spreadValues({}, this.fetchDataOptions), { const rawStatus = yield (0,_providers__WEBPACK_IMPORTED_MODULE_2__/* .fetchData */ .Fd)(`${url}status`, __spreadProps(__spreadValues({}, this.fetchDataOptions), {
headers: { headers: {
"Content-Type": "application/json, application/x-www-form-urlencoded" "Content-Type": "application/json, application/x-www-form-urlencoded"

File diff suppressed because one or more lines are too long

@ -199,12 +199,20 @@ export class RelayerClient {
async askRelayerStatus({ async askRelayerStatus({
hostname, hostname,
url,
relayerAddress, relayerAddress,
}: { }: {
hostname: string; hostname: string;
// optional url if entered manually
url?: string;
// relayerAddress from registry contract to prevent cheating
relayerAddress?: string; relayerAddress?: string;
}): Promise<RelayerStatus> { }): Promise<RelayerStatus> {
const url = `https://${!hostname.endsWith('/') ? hostname + '/' : hostname}`; if (!url) {
url = `https://${!hostname.endsWith('/') ? hostname + '/' : hostname}`;
} else if (!url.endsWith('/')) {
url += '/';
}
const rawStatus = (await fetchData(`${url}status`, { const rawStatus = (await fetchData(`${url}status`, {
...this.fetchDataOptions, ...this.fetchDataOptions,