forked from tornadocash/tornado-cli
Improve relayer client
This commit is contained in:
parent
d19c062847
commit
f51183f2c7
46
dist/cli.js
vendored
46
dist/cli.js
vendored
@ -178695,19 +178695,19 @@ class TornadoBrowserProvider extends BrowserProvider {
|
|||||||
}
|
}
|
||||||
getSigner(address) {
|
getSigner(address) {
|
||||||
return __async$g(this, null, function* () {
|
return __async$g(this, null, function* () {
|
||||||
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
||||||
const signerAddress = (yield __superGet$2(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address;
|
const signerAddress = (yield __superGet$2(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address;
|
||||||
if (((_a = this.options) == null ? void 0 : _a.webChainId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet$2(TornadoBrowserProvider.prototype, this, "send").call(this, "eth_chainId", [])) !== Number((_c = this.options) == null ? void 0 : _c.webChainId)) {
|
if (((_a = this.options) == null ? void 0 : _a.netId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet$2(TornadoBrowserProvider.prototype, this, "send").call(this, "net_version", [])) !== ((_c = this.options) == null ? void 0 : _c.netId)) {
|
||||||
yield this.options.connectWallet();
|
yield this.options.connectWallet((_d = this.options) == null ? void 0 : _d.netId);
|
||||||
}
|
}
|
||||||
if ((_d = this.options) == null ? void 0 : _d.handleNetworkChanges) {
|
if ((_e = this.options) == null ? void 0 : _e.handleNetworkChanges) {
|
||||||
(_e = window == null ? void 0 : window.ethereum) == null ? void 0 : _e.on("chainChanged", this.options.handleNetworkChanges);
|
(_f = window == null ? void 0 : window.ethereum) == null ? void 0 : _f.on("chainChanged", this.options.handleNetworkChanges);
|
||||||
}
|
}
|
||||||
if ((_f = this.options) == null ? void 0 : _f.handleAccountChanges) {
|
if ((_g = this.options) == null ? void 0 : _g.handleAccountChanges) {
|
||||||
(_g = window == null ? void 0 : window.ethereum) == null ? void 0 : _g.on("accountsChanged", this.options.handleAccountChanges);
|
(_h = window == null ? void 0 : window.ethereum) == null ? void 0 : _h.on("accountsChanged", this.options.handleAccountChanges);
|
||||||
}
|
}
|
||||||
if ((_h = this.options) == null ? void 0 : _h.handleAccountDisconnect) {
|
if ((_i = this.options) == null ? void 0 : _i.handleAccountDisconnect) {
|
||||||
(_i = window == null ? void 0 : window.ethereum) == null ? void 0 : _i.on("disconnect", this.options.handleAccountDisconnect);
|
(_j = window == null ? void 0 : window.ethereum) == null ? void 0 : _j.on("disconnect", this.options.handleAccountDisconnect);
|
||||||
}
|
}
|
||||||
return new TornadoRpcSigner(this, signerAddress, this.options);
|
return new TornadoRpcSigner(this, signerAddress, this.options);
|
||||||
});
|
});
|
||||||
@ -181023,7 +181023,7 @@ class RelayerClient {
|
|||||||
url,
|
url,
|
||||||
relayerAddress
|
relayerAddress
|
||||||
}) {
|
}) {
|
||||||
var _a, _b;
|
var _a;
|
||||||
if (!url && hostname) {
|
if (!url && hostname) {
|
||||||
url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`;
|
url = `https://${!hostname.endsWith("/") ? hostname + "/" : hostname}`;
|
||||||
} else if (url && !url.endsWith("/")) {
|
} else if (url && !url.endsWith("/")) {
|
||||||
@ -181035,8 +181035,8 @@ class RelayerClient {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json, application/x-www-form-urlencoded"
|
"Content-Type": "application/json, application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
timeout: ((_a = this.fetchDataOptions) == null ? void 0 : _a.torPort) ? 1e4 : 3e3,
|
timeout: 6e4,
|
||||||
maxRetry: ((_b = this.fetchDataOptions) == null ? void 0 : _b.torPort) ? 2 : 0
|
maxRetry: ((_a = this.fetchDataOptions) == null ? void 0 : _a.torPort) ? 2 : 0
|
||||||
}));
|
}));
|
||||||
const statusValidator = dist_ajv.compile(getStatusSchema(this.netId, this.config, this.tovarish));
|
const statusValidator = dist_ajv.compile(getStatusSchema(this.netId, this.config, this.tovarish));
|
||||||
if (!statusValidator(rawStatus)) {
|
if (!statusValidator(rawStatus)) {
|
||||||
@ -181803,14 +181803,14 @@ function getTovarishNetworks(registryService, relayers) {
|
|||||||
return __async$c(this, null, function* () {
|
return __async$c(this, null, function* () {
|
||||||
yield Promise.all(
|
yield Promise.all(
|
||||||
relayers.filter((r) => r.tovarishHost).map((relayer) => __async$c(this, null, function* () {
|
relayers.filter((r) => r.tovarishHost).map((relayer) => __async$c(this, null, function* () {
|
||||||
var _a, _b;
|
var _a;
|
||||||
try {
|
try {
|
||||||
relayer.tovarishNetworks = yield fetchData(relayer.tovarishHost, __spreadProps$1(__spreadValues$2({}, registryService.fetchDataOptions), {
|
relayer.tovarishNetworks = yield fetchData(relayer.tovarishHost, __spreadProps$1(__spreadValues$2({}, registryService.fetchDataOptions), {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
timeout: ((_a = registryService.fetchDataOptions) == null ? void 0 : _a.torPort) ? 1e4 : 3e3,
|
timeout: 6e4,
|
||||||
maxRetry: ((_b = registryService.fetchDataOptions) == null ? void 0 : _b.torPort) ? 2 : 0
|
maxRetry: ((_a = registryService.fetchDataOptions) == null ? void 0 : _a.torPort) ? 2 : 0
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
relayer.tovarishNetworks = [];
|
relayer.tovarishNetworks = [];
|
||||||
@ -181964,10 +181964,13 @@ class BaseRegistryService extends BaseEventsService {
|
|||||||
}
|
}
|
||||||
}).filter((r) => r);
|
}).filter((r) => r);
|
||||||
yield getTovarishNetworks(this, relayers);
|
yield getTovarishNetworks(this, relayers);
|
||||||
|
const allRelayers = [...staticRelayers, ...relayers];
|
||||||
|
const tovarishRelayers = allRelayers.filter((r) => r.tovarishHost);
|
||||||
|
const classicRelayers = allRelayers.filter((r) => !r.tovarishHost);
|
||||||
return {
|
return {
|
||||||
lastBlock,
|
lastBlock,
|
||||||
timestamp,
|
timestamp,
|
||||||
relayers: [...staticRelayers, ...relayers]
|
relayers: [...tovarishRelayers, ...classicRelayers]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -182149,14 +182152,16 @@ function loadRemoteEvents(_0) {
|
|||||||
return __async$a(this, arguments, function* ({
|
return __async$a(this, arguments, function* ({
|
||||||
staticUrl,
|
staticUrl,
|
||||||
instanceName,
|
instanceName,
|
||||||
deployedBlock
|
deployedBlock,
|
||||||
|
zipDigest
|
||||||
}) {
|
}) {
|
||||||
var _a;
|
var _a;
|
||||||
try {
|
try {
|
||||||
const zipName = `${instanceName}.json`.toLowerCase();
|
const zipName = `${instanceName}.json`.toLowerCase();
|
||||||
const events = yield downloadZip({
|
const events = yield downloadZip({
|
||||||
staticUrl,
|
staticUrl,
|
||||||
zipName
|
zipName,
|
||||||
|
zipDigest
|
||||||
});
|
});
|
||||||
if (!Array.isArray(events)) {
|
if (!Array.isArray(events)) {
|
||||||
const errStr = `Invalid events from ${staticUrl}/${zipName}`;
|
const errStr = `Invalid events from ${staticUrl}/${zipName}`;
|
||||||
@ -182197,7 +182202,8 @@ class DBTornadoService extends BaseTornadoService {
|
|||||||
return yield loadRemoteEvents({
|
return yield loadRemoteEvents({
|
||||||
staticUrl: this.staticUrl,
|
staticUrl: this.staticUrl,
|
||||||
instanceName: this.getInstanceName(),
|
instanceName: this.getInstanceName(),
|
||||||
deployedBlock: this.deployedBlock
|
deployedBlock: this.deployedBlock,
|
||||||
|
zipDigest: this.zipDigest
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -187965,7 +187971,7 @@ Connected with Tovarish Relayer ${(_a = tovarishClient.selectedRelayer) == null
|
|||||||
root: tree.root,
|
root: tree.root,
|
||||||
nullifierHex,
|
nullifierHex,
|
||||||
recipient,
|
recipient,
|
||||||
relayer: !walletWithdrawal ? rewardAccount : ZeroAddress,
|
relayer: relayer2,
|
||||||
fee: fee2,
|
fee: fee2,
|
||||||
refund: refund2,
|
refund: refund2,
|
||||||
nullifier,
|
nullifier,
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
"optionalDependencies": {},
|
"optionalDependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@colors/colors": "^1.6.0",
|
"@colors/colors": "^1.6.0",
|
||||||
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#58b31101259245dad8ac6152829ca7bc7ac7f091",
|
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#0ebd4d175f4a7f8f0f339091cbec4dc4a7e8ad3a",
|
||||||
"@typechain/ethers-v6": "^0.5.1",
|
"@typechain/ethers-v6": "^0.5.1",
|
||||||
"@types/figlet": "^1.5.8",
|
"@types/figlet": "^1.5.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
||||||
|
@ -1170,7 +1170,7 @@ export function tornadoProgram() {
|
|||||||
root: tree.root,
|
root: tree.root,
|
||||||
nullifierHex,
|
nullifierHex,
|
||||||
recipient,
|
recipient,
|
||||||
relayer: !walletWithdrawal ? (rewardAccount as string) : ZeroAddress,
|
relayer,
|
||||||
fee,
|
fee,
|
||||||
refund,
|
refund,
|
||||||
nullifier,
|
nullifier,
|
||||||
|
@ -786,9 +786,9 @@
|
|||||||
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
|
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
|
||||||
ethers "^6.4.0"
|
ethers "^6.4.0"
|
||||||
|
|
||||||
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#58b31101259245dad8ac6152829ca7bc7ac7f091":
|
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#0ebd4d175f4a7f8f0f339091cbec4dc4a7e8ad3a":
|
||||||
version "1.0.19"
|
version "1.0.19"
|
||||||
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#58b31101259245dad8ac6152829ca7bc7ac7f091"
|
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#0ebd4d175f4a7f8f0f339091cbec4dc4a7e8ad3a"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@metamask/eth-sig-util" "^7.0.3"
|
"@metamask/eth-sig-util" "^7.0.3"
|
||||||
"@tornado/contracts" "^1.0.1"
|
"@tornado/contracts" "^1.0.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user