before dangerous ops

Signed-off-by: T-Hax <>
This commit is contained in:
T-Hax 2023-05-06 23:59:38 +00:00
parent 4065d89909
commit 704648ed2c
41 changed files with 31021 additions and 460 deletions

View file

@ -1,13 +0,0 @@
# RPC URLs
ETH_MAINNET_TEST_RPC=
# debug (debug events are logged to console)
DEBUG=
# use tor (torify tests)
TORIFY=
# tor port (regular = 9050, browser = 9150)
TOR_PORT=
# relayer DOMAIN (the example.xyz in https://example.xyz) for testing
TEST_RELAYER_DOMAIN=

View file

@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

View file

@ -39,12 +39,13 @@
"fs-extra": "^11.1.0",
"mocha": "^10.2.0",
"prettier": "^2.3.0",
"rimraf": "^4.4.0",
"rimraf": "^5.0.0",
"source-map-support": "^0.5.19",
"ts-essentials": "^9.3.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.2.11",
"tsconfig-paths": "^4.1.2",
"typedoc": "^0.24.6",
"typescript": "^5.0.4"
},
"scripts": {
@ -55,7 +56,7 @@
"postversion": "git push --follow-tags && npm publish",
"lint": "eslint --ext ts,js --fix src",
"build-live": "tsc -w && tsc-alias -w",
"clean": "rm -rf --interactive=never cache/*",
"clean": "rm -rf --interactive=never docs/*",
"format": "prettier src/*.ts -w"
},
"files": [

View file

@ -176,6 +176,31 @@ export namespace AsyncUtils {
export function timeout(msTimeout: number): Promise<any> {
return new Promise((resolve) => setTimeout(resolve, msTimeout))
}
export class SimpleMutex {
private _mutexes: Map<string, Promise<any>>
constructor() {
this._mutexes = new Map<string, Promise<any>>()
}
async acquire(parentCallName: string): Promise<Function> {
let release: Function = () => null
const prevMutex = this._mutexes.get(parentCallName)
this._mutexes.set(
parentCallName,
new Promise((resolve) => {
release = resolve
})
)
if (prevMutex) await prevMutex
return release
}
}
}
export namespace NumberUtils {