diff --git a/.github/workflows/CI_checks.yml b/.github/workflows/CI_checks.yml new file mode 100644 index 0000000..7371be4 --- /dev/null +++ b/.github/workflows/CI_checks.yml @@ -0,0 +1,38 @@ +name: Checks on CI + +# Will limit one workflow per branch and one per pull_request at the same time +# and cancel if a new one appears. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +on: + pull_request: + push: + +jobs: + build: + name: Build check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + - run: npm ci + - run: npm run tsc + + code_styling_checks: + name: Code Styling check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + - run: npm ci + - run: npm run format:check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c960973 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,17 @@ +name: Publish Package to npmjs +on: + release: + types: [published] +jobs: + npm-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + - run: npm ci + - run: npm run prepublishOnly + - uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 2f09cc9..89b6513 100644 --- a/README.md +++ b/README.md @@ -18,27 +18,27 @@ npm install viem hemi-viem ```js // example.js -import { createPublicClient, http } from "viem" +import { createPublicClient, http } from "viem"; import { hemiPublicBitcoinKitActions, hemiPublicOpNodeActions, hemiSepolia, -} from "hemi-viem" +} from "hemi-viem"; -const parameters = { chain: hemiSepolia, transport: http() } +const parameters = { chain: hemiSepolia, transport: http() }; const client = createPublicClient(parameters) .extend(hemiPublicOpNodeActions()) - .extend(hemiPublicBitcoinKitActions()) + .extend(hemiPublicBitcoinKitActions()); -const blockNumber = await client.getBlockNumber() -const block = await client.getBlock({ blockNumber: blockNumber - 100n }) +const blockNumber = await client.getBlockNumber(); +const block = await client.getBlock({ blockNumber: blockNumber - 100n }); -const btcFinality = await client.getBtcFinalityByBlockHash(block) -console.log(btcFinality) +const btcFinality = await client.getBtcFinalityByBlockHash(block); +console.log(btcFinality); -const btcHeader = await client.getLastHeader() -console.log(btcHeader) +const btcHeader = await client.getLastHeader(); +console.log(btcHeader); ``` Output: diff --git a/package-lock.json b/package-lock.json index b31ccbb..d3b7d0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,17 @@ { "name": "hemi-viem", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hemi-viem", - "version": "1.1.0", + "version": "1.2.0", "license": "MIT", "devDependencies": { + "husky": "4.3.8", + "lint-staged": "15.2.7", + "prettier": "3.3.2", "typescript": "5.5.3" }, "peerDependencies": { @@ -21,6 +24,69 @@ "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==", "peer": true }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@noble/curves": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", @@ -81,6 +147,12 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "dev": true + }, "node_modules/abitype": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", @@ -102,6 +174,503 @@ } } }, + "node_modules/ansi-escapes": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.1.tgz", + "integrity": "sha512-4nJ3yixlEthEJ9Rk4vPcdBRkZvQZlYyu8j4/Mqz5sgIkddmEnH2Yj2ZrnP9S3tQOvSNRUIgVNF/1yPpRAGNRig==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cosmiconfig/node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-versions": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", + "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", + "dev": true, + "dependencies": { + "semver-regex": "^3.1.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/husky": { + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", + "integrity": "sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^7.0.0", + "find-versions": "^4.0.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^5.0.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "bin": { + "husky-run": "bin/run.js", + "husky-upgrade": "lib/upgrader/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/husky" + } + }, + "node_modules/husky/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/husky/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/husky/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/husky/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/husky/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/husky/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/isows": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.4.tgz", @@ -117,6 +686,600 @@ "ws": "*" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/lilconfig": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/lint-staged": { + "version": "15.2.7", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.7.tgz", + "integrity": "sha512-+FdVbbCZ+yoh7E/RosSdqKJyUM2OEjTciH0TFNkawKgvFp1zbGlEC39RADg+xKBG1R4mhoH2j85myBQZ5wR+lw==", + "dev": true, + "dependencies": { + "chalk": "~5.3.0", + "commander": "~12.1.0", + "debug": "~4.3.4", + "execa": "~8.0.1", + "lilconfig": "~3.1.1", + "listr2": "~8.2.1", + "micromatch": "~4.0.7", + "pidtree": "~0.6.0", + "string-argv": "~0.3.2", + "yaml": "~2.4.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/listr2": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.3.tgz", + "integrity": "sha512-Lllokma2mtoniUOS94CcOErHWAug5iu7HOmDrvWgpw8jyQH2fomgB+7lZS4HWZxytUuQwkGOwe49FvwVaA85Xw==", + "dev": true, + "dependencies": { + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.0.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.0.0.tgz", + "integrity": "sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw==", + "dev": true, + "dependencies": { + "ansi-escapes": "^6.2.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^7.0.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/micromatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", + "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "dev": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true, + "bin": { + "opencollective-postinstall": "index.js" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pkg-dir": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", + "dev": true, + "dependencies": { + "find-up": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "dependencies": { + "semver-compare": "^1.0.0" + } + }, + "node_modules/prettier": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "dev": true + }, + "node_modules/semver-regex": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.4.tgz", + "integrity": "sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/typescript": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", @@ -160,6 +1323,47 @@ } } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-pm-runs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz", + "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/ws": { "version": "8.13.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", @@ -180,6 +1384,30 @@ "optional": true } } + }, + "node_modules/yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 3d500a7..775ba27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hemi-viem", - "version": "1.1.0", + "version": "1.2.0", "description": "Viem extension for the Hemi Network", "bugs": { "url": "https://github.com/hemilabs/hemi-viem/issues" @@ -10,10 +10,12 @@ "name": "Gabriel Montes", "email": "gabriel@bloq.com" }, - "contributors": [{ - "name": "Gonzalo D'Elia", - "email": "gonzalo@bloq.com" - }], + "contributors": [ + { + "name": "Gonzalo D'Elia", + "email": "gonzalo@bloq.com" + } + ], "files": [ "_esm/**/*", "_types/**/*", @@ -25,10 +27,14 @@ "build:esm": "tsc --noEmit false --outDir ./_esm --sourceMap", "build:types": "tsc --module esnext --declarationDir ./_types --emitDeclarationOnly --declaration --declarationMap", "clean": "rm -rf ./_esm ./_types", + "format:check": "prettier --check .", "prepublishOnly": "npm run build", "tsc": "tsc --noEmit" }, "devDependencies": { + "husky": "4.3.8", + "lint-staged": "15.2.7", + "prettier": "3.3.2", "typescript": "5.5.3" }, "peerDependencies": { @@ -41,9 +47,17 @@ "types": "./_types/index.d.ts" } }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,json,md,ts,}": "prettier --write" + }, "module": "./_esm/index.js", "prettier": { - "semi": false + "quoteProps": "consistent" }, "types": "./_types/index.d.ts", "typings": "./_types/index.d.ts" diff --git a/src/actions/bitcoin-kit.ts b/src/actions/bitcoin-kit.ts index 25d8992..0078254 100644 --- a/src/actions/bitcoin-kit.ts +++ b/src/actions/bitcoin-kit.ts @@ -1,84 +1,94 @@ -import { type Chain, type Client, type Hash, type Transport } from "viem" -import { readContract } from 'viem/actions' +import { + isHash, + type Chain, + type Client, + type Hash, + type Transport, +} from "viem"; +import { readContract } from "viem/actions"; import { bitcoinKitTxsAbi, bitcoinKitTxAddresses, -} from "../contracts/bitcoin-kit-txs.js" +} from "../contracts/bitcoin-kit-txs.js"; export function getBitcoinAddressBalance< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { btcAddress: string }) { - const { btcAddress } = parameters + const { btcAddress } = parameters; return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getBitcoinAddressBalance", args: [btcAddress], - }) + }); } export function getHeaderN< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { height: number }) { - const { height } = parameters + const { height } = parameters; return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getHeaderN", args: [height], - }) + }); } export function getLastHeader< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client) { return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getLastHeader", args: [], - }) + }); } export function getTransactionByTxId< TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, ->(client: Client, parameters: { txId: Hash }) { - const { txId } = parameters +>(client: Client, parameters: { txId: string }) { + const { txId } = parameters; + const hash: Hash = isHash(txId) ? txId : `0x${txId}`; return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getTransactionByTxId", - args: [txId], - }) + args: [hash], + }); } export function getTxConfirmations< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { txId: Hash }) { - const { txId } = parameters + const { txId } = parameters; return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getTxConfirmations", args: [txId], - }) + }); } export function getUtxosForBitcoinAddress< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->(client: Client, parameters: { btcAddress: string; pageNumber: bigint; pageSize: bigint}) { - const { btcAddress, pageNumber, pageSize } = parameters + TChain extends Chain | undefined = Chain | undefined, +>( + client: Client, + parameters: { btcAddress: string; pageNumber: bigint; pageSize: bigint }, +) { + const { btcAddress, pageNumber, pageSize } = parameters; return readContract(client, { address: bitcoinKitTxAddresses[client.chain!.id], abi: bitcoinKitTxsAbi, functionName: "getUTXOsForBitcoinAddress", args: [btcAddress, pageNumber, pageSize], - }) + }); } diff --git a/src/actions/bitcoin-tunnel-manager.ts b/src/actions/bitcoin-tunnel-manager.ts index 88e3c5f..41cf172 100644 --- a/src/actions/bitcoin-tunnel-manager.ts +++ b/src/actions/bitcoin-tunnel-manager.ts @@ -1,30 +1,33 @@ -import { type Address, type Client, type Chain, type Transport } from 'viem' -import { readContract } from 'viem/actions' +import { type Address, type Client, type Chain, type Transport } from "viem"; +import { readContract } from "viem/actions"; -import { bitcoinTunnelManagerAbi, bitcoinTunnelManagerAddresses } from '../contracts/bitcoin-tunnel-manager.js' +import { + bitcoinTunnelManagerAbi, + bitcoinTunnelManagerAddresses, +} from "../contracts/bitcoin-tunnel-manager.js"; export function getVaultOwnerByBTCAddress< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { btcAddress: string }) { - const { btcAddress } = parameters + const { btcAddress } = parameters; return readContract(client, { abi: bitcoinTunnelManagerAbi, address: bitcoinTunnelManagerAddresses[client.chain!.id], args: [btcAddress], - functionName: 'getVaultOwnerByBTCAddress', - }) + functionName: "getVaultOwnerByBTCAddress", + }); } export function getVaultAddressByOwner< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { ownerAddress: Address }) { - const { ownerAddress } = parameters + const { ownerAddress } = parameters; return readContract(client, { address: bitcoinTunnelManagerAddresses[client.chain!.id], abi: bitcoinTunnelManagerAbi, args: [ownerAddress], - functionName: 'getVaultAddressByOwner', - }) + functionName: "getVaultAddressByOwner", + }); } diff --git a/src/actions/bitcoin-vault.ts b/src/actions/bitcoin-vault.ts index 04781f1..6092e72 100644 --- a/src/actions/bitcoin-vault.ts +++ b/src/actions/bitcoin-vault.ts @@ -1,31 +1,41 @@ -import { type Address, type Chain, type Client, type Hash, type Transport, isHash } from "viem" -import { readContract } from 'viem/actions' +import { + type Address, + type Chain, + type Client, + type Hash, + type Transport, + isHash, +} from "viem"; +import { readContract } from "viem/actions"; -import { bitcoinVaultAbi } from '../contracts/bitcoin-vault.js' +import { bitcoinVaultAbi } from "../contracts/bitcoin-vault.js"; export function acknowledgedDeposits< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->(client: Client, parameters: { txId: string, vaultAddress: Address }) { - const { txId, vaultAddress } = parameters - const hash: Hash = isHash(txId) ? txId : `0x${txId}` + TChain extends Chain | undefined = Chain | undefined, +>( + client: Client, + parameters: { txId: string; vaultAddress: Address }, +) { + const { txId, vaultAddress } = parameters; + const hash: Hash = isHash(txId) ? txId : `0x${txId}`; return readContract(client, { address: vaultAddress, abi: bitcoinVaultAbi, - functionName: 'acknowledgedDeposits', - args: [hash] - }) + functionName: "acknowledgedDeposits", + args: [hash], + }); } export function getBitcoinCustodyAddress< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { vaultAddress: Address }) { - const { vaultAddress } = parameters + const { vaultAddress } = parameters; return readContract(client, { address: vaultAddress, abi: bitcoinVaultAbi, - functionName: 'getBitcoinCustodyAddress', - args: [] - }) + functionName: "getBitcoinCustodyAddress", + args: [], + }); } diff --git a/src/actions/get-btc-finality-by-block-hash.ts b/src/actions/get-btc-finality-by-block-hash.ts index 4fc7e6c..39e9654 100644 --- a/src/actions/get-btc-finality-by-block-hash.ts +++ b/src/actions/get-btc-finality-by-block-hash.ts @@ -1,28 +1,30 @@ -import { type Chain, type Hash, type Client, type Transport, http } from "viem" +import { type Chain, type Hash, type Client, type Transport, http } from "viem"; export async function getBtcFinalityByBlockHash< TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined + TChain extends Chain | undefined = Chain | undefined, >(client: Client, parameters: { hash: Hash }) { - const { hash } = parameters + const { hash } = parameters; try { - const opNodeHttp = http(client.chain!.rpcUrls.opNode.http[0]) - const transport = opNodeHttp({}) + const opNodeHttp = http(client.chain!.rpcUrls.opNode.http[0]); + const transport = opNodeHttp({}); const response = await transport.request({ method: "optimism_btcFinalityByBlockHash", params: [hash], - }) - return Array.isArray(response) && response.length > 0 ? response[0] : response + }); + return Array.isArray(response) && response.length > 0 + ? response[0] + : response; } catch (err) { // https://www.jsonrpc.org/specification#error_object if (err.code !== -32000) { - throw err + throw err; } return { l2_keystone: null, btc_pub_height: -1, btc_pub_header_hash: "", btc_finality: -9, - } + }; } } diff --git a/src/chains/hemi-sepolia.ts b/src/chains/hemi-sepolia.ts index 481749f..785e9bb 100644 --- a/src/chains/hemi-sepolia.ts +++ b/src/chains/hemi-sepolia.ts @@ -1,7 +1,7 @@ -import { defineChain } from "viem" -import { chainConfig } from "viem/op-stack" +import { defineChain } from "viem"; +import { chainConfig } from "viem/op-stack"; -const sourceId = 11_155_111 // Sepolia +const sourceId = 11_155_111; // Sepolia export const hemiSepolia = defineChain({ ...chainConfig, @@ -30,13 +30,13 @@ export const hemiSepolia = defineChain({ contracts: { addressManager: { [sourceId]: { - address: '0x23f0022354241FDb721Dc43E7897d7Af662A2995' - } + address: "0x23f0022354241FDb721Dc43E7897d7Af662A2995", + }, }, l1CrossDomainMessenger: { [sourceId]: { - address: '0x9bCCCf1d222539c4C47E4C6f5749e4d5fA33215c' - } + address: "0x9bCCCf1d222539c4C47E4C6f5749e4d5fA33215c", + }, }, l1StandardBridge: { [sourceId]: { @@ -60,4 +60,4 @@ export const hemiSepolia = defineChain({ }, testnet: true, sourceId, -}) \ No newline at end of file +}); diff --git a/src/chains/hemi.ts b/src/chains/hemi.ts index e5a4af4..6f3efa5 100644 --- a/src/chains/hemi.ts +++ b/src/chains/hemi.ts @@ -1,7 +1,7 @@ -import { defineChain } from "viem" -import { chainConfig } from "viem/op-stack" +import { defineChain } from "viem"; +import { chainConfig } from "viem/op-stack"; -const sourceId = 1 // Ethereum mainnet +const sourceId = 1; // Ethereum mainnet export const hemi = defineChain({ ...chainConfig, @@ -28,4 +28,4 @@ export const hemi = defineChain({ }, }, sourceId, -}) \ No newline at end of file +}); diff --git a/src/contracts/bitcoin-kit-txs.ts b/src/contracts/bitcoin-kit-txs.ts index b99fe6e..b964d54 100644 --- a/src/contracts/bitcoin-kit-txs.ts +++ b/src/contracts/bitcoin-kit-txs.ts @@ -1,9 +1,9 @@ -import { type Address, type Chain } from 'viem' -import { hemiSepolia } from "../chains/hemi-sepolia.js" +import { type Address, type Chain } from "viem"; +import { hemiSepolia } from "../chains/hemi-sepolia.js"; -export const bitcoinKitTxAddresses: Record = { +export const bitcoinKitTxAddresses: Record = { [hemiSepolia.id]: "0x181dBA19ce25bbD6d884347d2471FE5E5C0fcA4c", -} +}; export const bitcoinKitTxsAbi = [ { @@ -383,4 +383,4 @@ export const bitcoinKitTxsAbi = [ stateMutability: "view", type: "function", }, -] as const +] as const; diff --git a/src/contracts/bitcoin-tunnel-manager.ts b/src/contracts/bitcoin-tunnel-manager.ts index 3cfd85d..6ae642a 100644 --- a/src/contracts/bitcoin-tunnel-manager.ts +++ b/src/contracts/bitcoin-tunnel-manager.ts @@ -1,477 +1,477 @@ -import { type Address, type Chain } from 'viem' -import { hemiSepolia } from "../chains/hemi-sepolia.js" +import { type Address, type Chain } from "viem"; +import { hemiSepolia } from "../chains/hemi-sepolia.js"; -export const bitcoinTunnelManagerAddresses: Record = { +export const bitcoinTunnelManagerAddresses: Record = { [hemiSepolia.id]: "0xBB3c3E0D5D2Ff65492deAeA721b331851befc267", -} +}; export const bitcoinTunnelManagerAbi = [ { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "_bitcoinKitAddress", - "type": "address" + internalType: "address", + name: "_bitcoinKitAddress", + type: "address", }, { - "internalType": "address", - "name": "_permittedCollateralToken", - "type": "address" + internalType: "address", + name: "_permittedCollateralToken", + type: "address", }, { - "internalType": "address", - "name": "_collateralTokenBTCPriceOracle", - "type": "address" + internalType: "address", + name: "_collateralTokenBTCPriceOracle", + type: "address", }, { - "internalType": "uint32", - "name": "_initialOpeningCollateralRatio", - "type": "uint32" + internalType: "uint32", + name: "_initialOpeningCollateralRatio", + type: "uint32", }, { - "internalType": "uint32", - "name": "_liquidationCollateralRatio", - "type": "uint32" + internalType: "uint32", + name: "_liquidationCollateralRatio", + type: "uint32", }, { - "internalType": "uint256", - "name": "_minimumCollateralDepositAmount", - "type": "uint256" - } + internalType: "uint256", + name: "_minimumCollateralDepositAmount", + type: "uint256", + }, ], - "stateMutability": "nonpayable", - "type": "constructor" + stateMutability: "nonpayable", + type: "constructor", }, { - "inputs": [], - "name": "GenericWithdrawalFailed", - "type": "error" + inputs: [], + name: "GenericWithdrawalFailed", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "operator", - "type": "address" - } + internalType: "address", + name: "operator", + type: "address", + }, ], - "name": "OperatorAlreadyCreatedVault", - "type": "error" + name: "OperatorAlreadyCreatedVault", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], - "name": "VaultInsufficientBalanceForWithdrawal", - "type": "error" + name: "VaultInsufficientBalanceForWithdrawal", + type: "error", }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "bytes32", - "name": "btcTxid", - "type": "bytes32" + indexed: true, + internalType: "bytes32", + name: "btcTxid", + type: "bytes32", }, { - "indexed": true, - "internalType": "address", - "name": "depositer", - "type": "address" + indexed: true, + internalType: "address", + name: "depositer", + type: "address", }, { - "indexed": true, - "internalType": "address", - "name": "vaultAddress", - "type": "address" + indexed: true, + internalType: "address", + name: "vaultAddress", + type: "address", }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], - "name": "DepositConfirmed", - "type": "event" + name: "DepositConfirmed", + type: "event", }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" + indexed: true, + internalType: "address", + name: "operator", + type: "address", }, { - "indexed": true, - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } + indexed: true, + internalType: "address", + name: "vaultAddress", + type: "address", + }, ], - "name": "VaultActivated", - "type": "event" + name: "VaultActivated", + type: "event", }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" + indexed: true, + internalType: "address", + name: "operator", + type: "address", }, { - "indexed": true, - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } + indexed: true, + internalType: "address", + name: "vaultAddress", + type: "address", + }, ], - "name": "VaultCreated", - "type": "event" + name: "VaultCreated", + type: "event", }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "address", - "name": "vaultAddress", - "type": "address" + indexed: true, + internalType: "address", + name: "vaultAddress", + type: "address", }, { - "indexed": true, - "internalType": "uint32", - "name": "withdrawalCounter", - "type": "uint32" + indexed: true, + internalType: "uint32", + name: "withdrawalCounter", + type: "uint32", }, { - "indexed": false, - "internalType": "uint256", - "name": "amountAfterFees", - "type": "uint256" - } + indexed: false, + internalType: "uint256", + name: "amountAfterFees", + type: "uint256", + }, ], - "name": "WithdrawalFinalized", - "type": "event" + name: "WithdrawalFinalized", + type: "event", }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "address", - "name": "withdrawer", - "type": "address" + indexed: true, + internalType: "address", + name: "withdrawer", + type: "address", }, { - "indexed": true, - "internalType": "address", - "name": "vaultAddress", - "type": "address" + indexed: true, + internalType: "address", + name: "vaultAddress", + type: "address", }, { - "indexed": true, - "internalType": "uint32", - "name": "withdrawalCounter", - "type": "uint32" + indexed: true, + internalType: "uint32", + name: "withdrawalCounter", + type: "uint32", }, { - "indexed": false, - "internalType": "string", - "name": "btcAddress", - "type": "string" + indexed: false, + internalType: "string", + name: "btcAddress", + type: "string", }, { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], - "name": "WithdrawalInitiated", - "type": "event" + name: "WithdrawalInitiated", + type: "event", }, { - "inputs": [ + inputs: [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + internalType: "uint256", + name: "", + type: "uint256", + }, ], - "name": "allOwners", - "outputs": [ + name: "allOwners", + outputs: [ { - "internalType": "address", - "name": "", - "type": "address" - } + internalType: "address", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "allOwnersSize", - "outputs": [ + inputs: [], + name: "allOwnersSize", + outputs: [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + internalType: "uint256", + name: "", + type: "uint256", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "bitcoinKitContract", - "outputs": [ + inputs: [], + name: "bitcoinKitContract", + outputs: [ { - "internalType": "contract IBitcoinKit", - "name": "", - "type": "address" - } + internalType: "contract IBitcoinKit", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "btcTokenContract", - "outputs": [ + inputs: [], + name: "btcTokenContract", + outputs: [ { - "internalType": "contract BTCToken", - "name": "", - "type": "address" - } + internalType: "contract BTCToken", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "collateralBTCPriceOracle", - "outputs": [ + inputs: [], + name: "collateralBTCPriceOracle", + outputs: [ { - "internalType": "contract IAssetPriceOracle", - "name": "", - "type": "address" - } + internalType: "contract IAssetPriceOracle", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "_txid", - "type": "bytes32" + internalType: "bytes32", + name: "_txid", + type: "bytes32", }, { - "internalType": "address", - "name": "vaultOwner", - "type": "address" - } + internalType: "address", + name: "vaultOwner", + type: "address", + }, ], - "name": "confirmDeposit", - "outputs": [ + name: "confirmDeposit", + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "string", - "name": "btcAddress", - "type": "string" - } + internalType: "string", + name: "btcAddress", + type: "string", + }, ], - "name": "createVault", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + name: "createVault", + outputs: [], + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "vaultOperator", - "type": "address" + internalType: "address", + name: "vaultOperator", + type: "address", }, { - "internalType": "uint32", - "name": "withdrawalIndex", - "type": "uint32" + internalType: "uint32", + name: "withdrawalIndex", + type: "uint32", }, { - "internalType": "bytes32", - "name": "_txid", - "type": "bytes32" - } + internalType: "bytes32", + name: "_txid", + type: "bytes32", + }, ], - "name": "finalizeWithdrawal", - "outputs": [ + name: "finalizeWithdrawal", + outputs: [ { - "internalType": "bool", - "name": "success", - "type": "bool" - } + internalType: "bool", + name: "success", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "owner", - "type": "address" - } + internalType: "address", + name: "owner", + type: "address", + }, ], - "name": "getBtcAddressOfVaultByOwner", - "outputs": [ + name: "getBtcAddressOfVaultByOwner", + outputs: [ { - "internalType": "string", - "name": "btcAddress", - "type": "string" - } + internalType: "string", + name: "btcAddress", + type: "string", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "owner", - "type": "address" - } + internalType: "address", + name: "owner", + type: "address", + }, ], - "name": "getVaultAddressByOwner", - "outputs": [ + name: "getVaultAddressByOwner", + outputs: [ { - "internalType": "address", - "name": "vaultAddress", - "type": "address" - } + internalType: "address", + name: "vaultAddress", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "string", - "name": "btcAddress", - "type": "string" - } + internalType: "string", + name: "btcAddress", + type: "string", + }, ], - "name": "getVaultOwnerByBTCAddress", - "outputs": [ + name: "getVaultOwnerByBTCAddress", + outputs: [ { - "internalType": "address", - "name": "owner", - "type": "address" - } + internalType: "address", + name: "owner", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "string", - "name": "btcAddress", - "type": "string" + internalType: "string", + name: "btcAddress", + type: "string", }, { - "internalType": "uint256", - "name": "amount", - "type": "uint256" + internalType: "uint256", + name: "amount", + type: "uint256", }, { - "internalType": "address", - "name": "vaultOperator", - "type": "address" - } + internalType: "address", + name: "vaultOperator", + type: "address", + }, ], - "name": "initiateWithdrawal", - "outputs": [ + name: "initiateWithdrawal", + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } + internalType: "bytes32", + name: "", + type: "bytes32", + }, ], - "name": "ownerByBTCAddressHash", - "outputs": [ + name: "ownerByBTCAddressHash", + outputs: [ { - "internalType": "address", - "name": "", - "type": "address" - } + internalType: "address", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "permittedCollateralToken", - "outputs": [ + inputs: [], + name: "permittedCollateralToken", + outputs: [ { - "internalType": "contract ERC20", - "name": "", - "type": "address" - } + internalType: "contract ERC20", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "", - "type": "address" - } + internalType: "address", + name: "", + type: "address", + }, ], - "name": "vaultsByOwner", - "outputs": [ + name: "vaultsByOwner", + outputs: [ { - "internalType": "contract BitcoinVault", - "name": "", - "type": "address" - } + internalType: "contract BitcoinVault", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" - } -] as const + stateMutability: "view", + type: "function", + }, +] as const; diff --git a/src/contracts/bitcoin-vault.ts b/src/contracts/bitcoin-vault.ts index d06d8c3..9167102 100644 --- a/src/contracts/bitcoin-vault.ts +++ b/src/contracts/bitcoin-vault.ts @@ -1,358 +1,358 @@ export const bitcoinVaultAbi = [ { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "_owner", - "type": "address" + internalType: "address", + name: "_owner", + type: "address", }, { - "internalType": "address", - "name": "_operator", - "type": "address" + internalType: "address", + name: "_operator", + type: "address", }, { - "internalType": "contract IBitcoinKit", - "name": "_bitcoinKitContract", - "type": "address" + internalType: "contract IBitcoinKit", + name: "_bitcoinKitContract", + type: "address", }, { - "internalType": "string", - "name": "_bitcoinAddress", - "type": "string" + internalType: "string", + name: "_bitcoinAddress", + type: "string", }, { - "internalType": "contract ERC20", - "name": "_collateralAssetContract", - "type": "address" - } + internalType: "contract ERC20", + name: "_collateralAssetContract", + type: "address", + }, ], - "stateMutability": "nonpayable", - "type": "constructor" + stateMutability: "nonpayable", + type: "constructor", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "txid", - "type": "bytes32" - } + internalType: "bytes32", + name: "txid", + type: "bytes32", + }, ], - "name": "DepositInvalidOpReturnNotPopulated", - "type": "error" + name: "DepositInvalidOpReturnNotPopulated", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "invalidOperator", - "type": "address" - } + internalType: "address", + name: "invalidOperator", + type: "address", + }, ], - "name": "InvalidAuthorizedOperator", - "type": "error" + name: "InvalidAuthorizedOperator", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "invalidOwner", - "type": "address" - } + internalType: "address", + name: "invalidOwner", + type: "address", + }, ], - "name": "InvalidAuthorizedOwner", - "type": "error" + name: "InvalidAuthorizedOwner", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "string", - "name": "invalidBitcoinAddress", - "type": "string" - } + internalType: "string", + name: "invalidBitcoinAddress", + type: "string", + }, ], - "name": "InvalidBitcoinAddress", - "type": "error" + name: "InvalidBitcoinAddress", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "unauthorizedOperator", - "type": "address" - } + internalType: "address", + name: "unauthorizedOperator", + type: "address", + }, ], - "name": "UnauthorizedOperator", - "type": "error" + name: "UnauthorizedOperator", + type: "error", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } + internalType: "bytes32", + name: "", + type: "bytes32", + }, ], - "name": "acknowledgedDeposits", - "outputs": [ + name: "acknowledgedDeposits", + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "bitcoinCustodyAddress", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } + inputs: [], + name: "bitcoinCustodyAddress", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "bitcoinKitContract", - "outputs": [ - { - "internalType": "contract IBitcoinKit", - "name": "", - "type": "address" - } + inputs: [], + name: "bitcoinKitContract", + outputs: [ + { + internalType: "contract IBitcoinKit", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes", - "name": "_input", - "type": "bytes" - } + internalType: "bytes", + name: "_input", + type: "bytes", + }, ], - "name": "bytesToAddress", - "outputs": [ + name: "bytesToAddress", + outputs: [ { - "internalType": "address", - "name": "addr", - "type": "address" - } + internalType: "address", + name: "addr", + type: "address", + }, ], - "stateMutability": "pure", - "type": "function" + stateMutability: "pure", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "_txid", - "type": "bytes32" - } + internalType: "bytes32", + name: "_txid", + type: "bytes32", + }, ], - "name": "confirmDeposit", - "outputs": [ + name: "confirmDeposit", + outputs: [ { - "internalType": "bool", - "name": "success", - "type": "bool" + internalType: "bool", + name: "success", + type: "bool", }, { - "internalType": "uint256", - "name": "satsDeposited", - "type": "uint256" + internalType: "uint256", + name: "satsDeposited", + type: "uint256", }, { - "internalType": "address", - "name": "tunnelDestination", - "type": "address" - } + internalType: "address", + name: "tunnelDestination", + type: "address", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } + internalType: "uint256", + name: "amount", + type: "uint256", + }, ], - "name": "depositCollateral", - "outputs": [ + name: "depositCollateral", + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "uint8", - "name": "c", - "type": "uint8" - } + internalType: "uint8", + name: "c", + type: "uint8", + }, ], - "name": "fromHexChar", - "outputs": [ + name: "fromHexChar", + outputs: [ { - "internalType": "uint8", - "name": "", - "type": "uint8" - } + internalType: "uint8", + name: "", + type: "uint8", + }, ], - "stateMutability": "pure", - "type": "function" + stateMutability: "pure", + type: "function", }, { - "inputs": [], - "name": "getBitcoinCustodyAddress", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } + inputs: [], + name: "getBitcoinCustodyAddress", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "getEffectiveCollateralBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } + inputs: [], + name: "getEffectiveCollateralBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "getOperator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + inputs: [], + name: "getOperator", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes", - "name": "source", - "type": "bytes" + internalType: "bytes", + name: "source", + type: "bytes", }, { - "internalType": "uint256", - "name": "startIndex", - "type": "uint256" + internalType: "uint256", + name: "startIndex", + type: "uint256", }, { - "internalType": "uint256", - "name": "endIndex", - "type": "uint256" - } + internalType: "uint256", + name: "endIndex", + type: "uint256", + }, ], - "name": "hexAsciiBytesToBytes", - "outputs": [ + name: "hexAsciiBytesToBytes", + outputs: [ { - "internalType": "bytes", - "name": "result", - "type": "bytes" - } + internalType: "bytes", + name: "result", + type: "bytes", + }, ], - "stateMutability": "pure", - "type": "function" + stateMutability: "pure", + type: "function", }, { - "inputs": [ + inputs: [ { - "internalType": "bytes32", - "name": "_txid", - "type": "bytes32" - } + internalType: "bytes32", + name: "_txid", + type: "bytes32", + }, ], - "name": "isDepositAlreadyConfirmed", - "outputs": [ + name: "isDepositAlreadyConfirmed", + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "operator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + inputs: [], + name: "operator", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: "view", + type: "function", }, { - "inputs": [], - "name": "recoverIncorrectDeposits", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } + inputs: [], + name: "recoverIncorrectDeposits", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" + stateMutability: "nonpayable", + type: "function", }, { - "inputs": [], - "name": "withdrawCollateral", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } + inputs: [], + name: "withdrawCollateral", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, ], - "stateMutability": "nonpayable", - "type": "function" - } -] as const + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/src/decorators/actions-to-decorator.ts b/src/decorators/actions-to-decorator.ts index 1ec3b4a..49b20d6 100644 --- a/src/decorators/actions-to-decorator.ts +++ b/src/decorators/actions-to-decorator.ts @@ -1,38 +1,30 @@ -import { - type Chain, - type Client, - type Transport, -} from "viem" +import { type Chain, type Client, type Transport } from "viem"; type Actions< TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, > = { - [key: string]: (client: Client, parameters: any) => any -} + [key: string]: (client: Client, parameters: any) => any; +}; type DecoratedActions< T extends Actions, TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined -> = { [K in keyof T]: (properties: Parameters[1]) => ReturnType } + TChain extends Chain | undefined = Chain | undefined, +> = { [K in keyof T]: (properties: Parameters[1]) => ReturnType }; export const actionsToDecorator = function < TActions extends Actions, TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->( - actions: TActions -) { - return function ( - client: Client - ) { + TChain extends Chain | undefined = Chain | undefined, +>(actions: TActions) { + return function (client: Client) { return Object.fromEntries( Object.keys(actions).map((action) => [ action, (properties: Parameters[1]) => actions[action](client, properties), - ]) - ) as DecoratedActions - } -} + ]), + ) as DecoratedActions; + }; +}; diff --git a/src/decorators/public-bitcoin-kit-actions.ts b/src/decorators/public-bitcoin-kit-actions.ts index a9eb5ca..85b4f31 100644 --- a/src/decorators/public-bitcoin-kit-actions.ts +++ b/src/decorators/public-bitcoin-kit-actions.ts @@ -1,9 +1,12 @@ -import {type Chain, type Transport } from 'viem' +import { type Chain, type Transport } from "viem"; -import { actionsToDecorator } from "./actions-to-decorator.js" -import * as bitcoinKitActions from "../actions/bitcoin-kit.js" +import { actionsToDecorator } from "./actions-to-decorator.js"; +import * as bitcoinKitActions from "../actions/bitcoin-kit.js"; export const hemiPublicBitcoinKitActions = < TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->() => actionsToDecorator(bitcoinKitActions) + TChain extends Chain | undefined = Chain | undefined, +>() => + actionsToDecorator( + bitcoinKitActions, + ); diff --git a/src/decorators/public-bitcoin-tunnel-manager-actions.ts b/src/decorators/public-bitcoin-tunnel-manager-actions.ts index f589b4f..159e1eb 100644 --- a/src/decorators/public-bitcoin-tunnel-manager-actions.ts +++ b/src/decorators/public-bitcoin-tunnel-manager-actions.ts @@ -1,9 +1,12 @@ -import {type Chain, type Transport } from 'viem' +import { type Chain, type Transport } from "viem"; -import { actionsToDecorator } from "./actions-to-decorator.js" -import * as bitcoinTunnelManagerActions from "../actions/bitcoin-tunnel-manager.js" +import { actionsToDecorator } from "./actions-to-decorator.js"; +import * as bitcoinTunnelManagerActions from "../actions/bitcoin-tunnel-manager.js"; export const hemiPublicBitcoinTunnelManagerActions = < TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->() => actionsToDecorator(bitcoinTunnelManagerActions) + TChain extends Chain | undefined = Chain | undefined, +>() => + actionsToDecorator( + bitcoinTunnelManagerActions, + ); diff --git a/src/decorators/public-bitcoin-vault-actions.ts b/src/decorators/public-bitcoin-vault-actions.ts index d0dec38..a7f7119 100644 --- a/src/decorators/public-bitcoin-vault-actions.ts +++ b/src/decorators/public-bitcoin-vault-actions.ts @@ -1,9 +1,12 @@ -import {type Chain, type Transport } from 'viem' +import { type Chain, type Transport } from "viem"; -import { actionsToDecorator } from "./actions-to-decorator.js" -import * as bitcoinVaultActions from "../actions/bitcoin-vault.js" +import { actionsToDecorator } from "./actions-to-decorator.js"; +import * as bitcoinVaultActions from "../actions/bitcoin-vault.js"; export const hemiPublicBitcoinVaultActions = < TTransport extends Transport = Transport, - TChain extends Chain | undefined = Chain | undefined ->() => actionsToDecorator(bitcoinVaultActions) + TChain extends Chain | undefined = Chain | undefined, +>() => + actionsToDecorator( + bitcoinVaultActions, + ); diff --git a/src/decorators/public-op-node-actions.ts b/src/decorators/public-op-node-actions.ts index 608d42c..50771ab 100644 --- a/src/decorators/public-op-node-actions.ts +++ b/src/decorators/public-op-node-actions.ts @@ -1,12 +1,10 @@ -import { type Chain, type Transport } from "viem" +import { type Chain, type Transport } from "viem"; -import { actionsToDecorator } from "./actions-to-decorator.js" -import * as opNodeActions from "../actions/get-btc-finality-by-block-hash.js" +import { actionsToDecorator } from "./actions-to-decorator.js"; +import * as opNodeActions from "../actions/get-btc-finality-by-block-hash.js"; export const hemiPublicOpNodeActions = < TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, >() => - actionsToDecorator( - opNodeActions - ) + actionsToDecorator(opNodeActions); diff --git a/src/index.ts b/src/index.ts index 11f9830..bbaf3b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,12 @@ -export { hemi } from "./chains/hemi.js" -export { hemiSepolia } from "./chains/hemi-sepolia.js" +export { hemi } from "./chains/hemi.js"; +export { hemiSepolia } from "./chains/hemi-sepolia.js"; -export * from "./actions/bitcoin-kit.js" -export * from "./actions/bitcoin-tunnel-manager.js" -export * from "./actions/bitcoin-vault.js" -export * from "./actions/get-btc-finality-by-block-hash.js" +export * from "./actions/bitcoin-kit.js"; +export * from "./actions/bitcoin-tunnel-manager.js"; +export * from "./actions/bitcoin-vault.js"; +export * from "./actions/get-btc-finality-by-block-hash.js"; -export { hemiPublicBitcoinKitActions } from "./decorators/public-bitcoin-kit-actions.js" -export { hemiPublicBitcoinTunnelManagerActions } from "./decorators/public-bitcoin-tunnel-manager-actions.js" -export { hemiPublicBitcoinVaultActions } from "./decorators/public-bitcoin-vault-actions.js" -export { hemiPublicOpNodeActions } from "./decorators/public-op-node-actions.js" +export { hemiPublicBitcoinKitActions } from "./decorators/public-bitcoin-kit-actions.js"; +export { hemiPublicBitcoinTunnelManagerActions } from "./decorators/public-bitcoin-tunnel-manager-actions.js"; +export { hemiPublicBitcoinVaultActions } from "./decorators/public-bitcoin-vault-actions.js"; +export { hemiPublicOpNodeActions } from "./decorators/public-op-node-actions.js";