├── .cargo └── config.toml ├── .github └── workflows │ └── publish_to_npm.yml ├── .gitignore ├── .npmignore ├── .yarn └── releases │ └── yarn-4.2.1.cjs ├── .yarnrc.yml ├── Cargo.toml ├── LICENSE ├── README.md ├── __test__ └── index.spec.mjs ├── build.rs ├── examples ├── asset-id │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ │ └── app.ts │ └── tsconfig.json ├── predicate-root │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ │ └── app.ts │ └── tsconfig.json └── simple-logs │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ └── app.ts │ └── tsconfig.json ├── index.d.ts ├── index.js ├── npm ├── darwin-arm64 │ ├── README.md │ └── package.json ├── darwin-x64 │ ├── README.md │ └── package.json ├── linux-arm64-gnu │ ├── README.md │ └── package.json ├── linux-x64-gnu │ ├── README.md │ └── package.json ├── linux-x64-musl │ ├── README.md │ └── package.json └── win32-x64-msvc │ ├── README.md │ └── package.json ├── package.json ├── rustfmt.toml ├── src ├── config.rs ├── lib.rs ├── query.rs ├── response.rs └── types.rs └── yarn.lock /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.aarch64-unknown-linux-musl] 2 | linker = "aarch64-linux-musl-gcc" 3 | rustflags = ["-C", "target-feature=-crt-static"] 4 | [target.x86_64-pc-windows-msvc] 5 | rustflags = ["-C", "target-feature=+crt-static"] -------------------------------------------------------------------------------- /.github/workflows/publish_to_npm.yml: -------------------------------------------------------------------------------- 1 | name: Publish to NPM 2 | 3 | concurrency: 4 | group: ${{ github.workflow }}-${{ github.ref }} 5 | cancel-in-progress: true 6 | 7 | env: 8 | DEBUG: napi:* 9 | APP_NAME: 'hyperfuel-client' 10 | MACOSX_DEPLOYMENT_TARGET: '10.13' 11 | permissions: 12 | contents: write 13 | id-token: write 14 | 15 | on: 16 | workflow_dispatch: null 17 | 18 | jobs: 19 | build: 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | settings: 24 | - host: macos-13 25 | target: x86_64-apple-darwin 26 | build: | 27 | brew install capnp 28 | yarn set version 3 29 | rustup target install x86_64-apple-darwin 30 | yarn build --target x86_64-apple-darwin 31 | strip -x *.node 32 | - host: windows-latest 33 | build: | 34 | yarn set version 3 35 | choco install capnproto 36 | yarn build 37 | target: x86_64-pc-windows-msvc 38 | - host: ubuntu-latest 39 | target: x86_64-unknown-linux-gnu 40 | docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian 41 | build: |- 42 | yarn set version 3 43 | apt-get install -y capnproto libcapnp-dev 44 | set -e && 45 | yarn build --target x86_64-unknown-linux-gnu && 46 | strip *.node 47 | - host: ubuntu-latest 48 | target: x86_64-unknown-linux-musl 49 | docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig 50 | build: |- 51 | yarn set version 3 52 | apt-get install -y capnproto libcapnp-dev 53 | set -e && 54 | rustup target install x86_64-unknown-linux-musl 55 | yarn build --target x86_64-unknown-linux-musl && 56 | strip *.node 57 | - host: macos-latest 58 | target: aarch64-apple-darwin 59 | build: | 60 | yarn set version 3 61 | brew install capnp 62 | yarn set version 3 63 | yarn build --target aarch64-apple-darwin 64 | strip -x *.node 65 | - host: ubuntu-latest 66 | target: aarch64-unknown-linux-gnu 67 | docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 68 | build: |- 69 | yarn set version 3 70 | apt-get install -y capnproto libcapnp-dev 71 | set -e && 72 | yarn build --target aarch64-unknown-linux-gnu && 73 | aarch64-unknown-linux-gnu-strip *.node 74 | - host: windows-latest 75 | target: aarch64-pc-windows-msvc 76 | build: | 77 | yarn set version 3 78 | choco install capnproto 79 | yarn build 80 | name: stable - ${{ matrix.settings.target }} - node@18 81 | runs-on: ${{ matrix.settings.host }} 82 | steps: 83 | - uses: actions/checkout@v3 84 | - name: Setup node 85 | uses: actions/setup-node@v3 86 | if: ${{ !matrix.settings.docker }} 87 | with: 88 | node-version: 18 89 | check-latest: true 90 | cache: yarn 91 | - name: Install 92 | uses: dtolnay/rust-toolchain@stable 93 | if: ${{ !matrix.settings.docker }} 94 | with: 95 | toolchain: stable 96 | targets: ${{ matrix.settings.target }} 97 | - name: Cache cargo 98 | uses: actions/cache@v3 99 | with: 100 | path: | 101 | ~/.cargo/registry/index/ 102 | ~/.cargo/registry/cache/ 103 | ~/.cargo/git/db/ 104 | .cargo-cache 105 | target/ 106 | key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} 107 | - uses: goto-bus-stop/setup-zig@v2 108 | if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} 109 | with: 110 | version: 0.10.1 111 | - name: Setup toolchain 112 | run: ${{ matrix.settings.setup }} 113 | if: ${{ matrix.settings.setup }} 114 | shell: bash 115 | - name: Setup node x86 116 | if: matrix.settings.target == 'i686-pc-windows-msvc' 117 | run: yarn config set supportedArchitectures.cpu "ia32" 118 | shell: bash 119 | - name: Install dependencies 120 | run: yarn install 121 | - name: Setup node x86 122 | uses: actions/setup-node@v3 123 | if: matrix.settings.target == 'i686-pc-windows-msvc' 124 | with: 125 | node-version: 18 126 | check-latest: true 127 | cache: yarn 128 | architecture: x86 129 | - name: Build in docker 130 | uses: addnab/docker-run-action@v3 131 | if: ${{ matrix.settings.docker }} 132 | with: 133 | image: ${{ matrix.settings.docker }} 134 | options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build' 135 | run: ${{ matrix.settings.build }} 136 | - name: Build 137 | run: ${{ matrix.settings.build }} 138 | if: ${{ !matrix.settings.docker }} 139 | shell: bash 140 | - name: Upload artifact 141 | uses: actions/upload-artifact@v3 142 | with: 143 | name: bindings-${{ matrix.settings.target }} 144 | path: ${{ env.APP_NAME }}.*.node 145 | if-no-files-found: error 146 | test-macOS-windows-binding: 147 | name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} 148 | needs: 149 | - build 150 | strategy: 151 | fail-fast: false 152 | matrix: 153 | settings: 154 | - host: macos-13 155 | target: x86_64-apple-darwin 156 | - host: windows-latest 157 | target: x86_64-pc-windows-msvc 158 | node: 159 | - '18' 160 | runs-on: ${{ matrix.settings.host }} 161 | steps: 162 | - uses: actions/checkout@v3 163 | - name: Setup node 164 | uses: actions/setup-node@v3 165 | with: 166 | node-version: ${{ matrix.node }} 167 | check-latest: true 168 | cache: yarn 169 | - name: Install dependencies 170 | run: yarn install 171 | - name: Download artifacts 172 | uses: actions/download-artifact@v3 173 | with: 174 | name: bindings-${{ matrix.settings.target }} 175 | path: . 176 | - name: List packages 177 | run: ls -R . 178 | shell: bash 179 | - name: Test bindings 180 | run: yarn test 181 | test-linux-x64-gnu-binding: 182 | name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} 183 | needs: 184 | - build 185 | strategy: 186 | fail-fast: false 187 | matrix: 188 | node: 189 | - '18' 190 | runs-on: ubuntu-latest 191 | steps: 192 | - uses: actions/checkout@v3 193 | - name: Setup node 194 | uses: actions/setup-node@v3 195 | with: 196 | node-version: ${{ matrix.node }} 197 | check-latest: true 198 | cache: yarn 199 | - name: Install dependencies 200 | run: yarn install 201 | - name: Download artifacts 202 | uses: actions/download-artifact@v3 203 | with: 204 | name: bindings-x86_64-unknown-linux-gnu 205 | path: . 206 | - name: List packages 207 | run: ls -R . 208 | shell: bash 209 | - name: Test bindings 210 | run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test 211 | test-linux-x64-musl-binding: 212 | name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} 213 | needs: 214 | - build 215 | strategy: 216 | fail-fast: false 217 | matrix: 218 | node: 219 | - '18' 220 | runs-on: ubuntu-latest 221 | steps: 222 | - uses: actions/checkout@v3 223 | - name: Setup node 224 | uses: actions/setup-node@v3 225 | with: 226 | node-version: ${{ matrix.node }} 227 | check-latest: true 228 | cache: yarn 229 | - name: Install dependencies 230 | run: | 231 | yarn config set supportedArchitectures.libc "musl" 232 | yarn install 233 | - name: Download artifacts 234 | uses: actions/download-artifact@v3 235 | with: 236 | name: bindings-x86_64-unknown-linux-musl 237 | path: . 238 | - name: List packages 239 | run: ls -R . 240 | shell: bash 241 | - name: Test bindings 242 | run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test 243 | test-linux-aarch64-gnu-binding: 244 | name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} 245 | needs: 246 | - build 247 | strategy: 248 | fail-fast: false 249 | matrix: 250 | node: 251 | - '18' 252 | runs-on: ubuntu-latest 253 | steps: 254 | - uses: actions/checkout@v3 255 | - name: Download artifacts 256 | uses: actions/download-artifact@v3 257 | with: 258 | name: bindings-aarch64-unknown-linux-gnu 259 | path: . 260 | - name: List packages 261 | run: ls -R . 262 | shell: bash 263 | - name: Install dependencies 264 | run: | 265 | yarn config set supportedArchitectures.cpu "arm64" 266 | yarn config set supportedArchitectures.libc "glibc" 267 | yarn install 268 | - name: Set up QEMU 269 | uses: docker/setup-qemu-action@v2 270 | with: 271 | platforms: arm64 272 | - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 273 | - name: Setup and run tests 274 | uses: addnab/docker-run-action@v3 275 | with: 276 | image: node:${{ matrix.node }}-slim 277 | options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' 278 | run: | 279 | set -e 280 | yarn test 281 | ls -la 282 | publish: 283 | name: Publish 284 | runs-on: ubuntu-latest 285 | needs: 286 | - test-macOS-windows-binding 287 | - test-linux-x64-gnu-binding 288 | - test-linux-x64-musl-binding 289 | - test-linux-aarch64-gnu-binding 290 | steps: 291 | - uses: actions/checkout@v3 292 | - name: Setup node 293 | uses: actions/setup-node@v3 294 | with: 295 | node-version: 18 296 | check-latest: true 297 | cache: yarn 298 | - name: Install dependencies 299 | run: yarn install 300 | - name: Download all artifacts 301 | uses: actions/download-artifact@v3 302 | with: 303 | path: artifacts 304 | - name: Move artifacts 305 | run: yarn artifacts 306 | - name: List packages 307 | run: ls -R ./npm 308 | shell: bash 309 | - name: Publish 310 | run: | 311 | sleep 30 312 | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc 313 | npm publish --access public 314 | env: 315 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 316 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | data/ 2 | 3 | # Created by https://www.toptal.com/developers/gitignore/api/node 4 | # Edit at https://www.toptal.com/developers/gitignore?templates=node 5 | 6 | ### Node ### 7 | # Logs 8 | logs 9 | *.log 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | lerna-debug.log* 14 | 15 | # Diagnostic reports (https://nodejs.org/api/report.html) 16 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 17 | 18 | # Runtime data 19 | pids 20 | *.pid 21 | *.seed 22 | *.pid.lock 23 | 24 | # Directory for instrumented libs generated by jscoverage/JSCover 25 | lib-cov 26 | 27 | # Coverage directory used by tools like istanbul 28 | coverage 29 | *.lcov 30 | 31 | # nyc test coverage 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 35 | .grunt 36 | 37 | # Bower dependency directory (https://bower.io/) 38 | bower_components 39 | 40 | # node-waf configuration 41 | .lock-wscript 42 | 43 | # Compiled binary addons (https://nodejs.org/api/addons.html) 44 | build/Release 45 | 46 | # Dependency directories 47 | node_modules/ 48 | jspm_packages/ 49 | 50 | # TypeScript v1 declaration files 51 | typings/ 52 | 53 | # TypeScript cache 54 | *.tsbuildinfo 55 | 56 | # Optional npm cache directory 57 | .npm 58 | 59 | # Optional eslint cache 60 | .eslintcache 61 | 62 | # Microbundle cache 63 | .rpt2_cache/ 64 | .rts2_cache_cjs/ 65 | .rts2_cache_es/ 66 | .rts2_cache_umd/ 67 | 68 | # Optional REPL history 69 | .node_repl_history 70 | 71 | # Output of 'npm pack' 72 | *.tgz 73 | 74 | # Yarn Integrity file 75 | .yarn-integrity 76 | 77 | # dotenv environment variables file 78 | .env 79 | .env.test 80 | 81 | # parcel-bundler cache (https://parceljs.org/) 82 | .cache 83 | 84 | # Next.js build output 85 | .next 86 | 87 | # Nuxt.js build / generate output 88 | .nuxt 89 | dist 90 | 91 | # Gatsby files 92 | .cache/ 93 | # Comment in the public line in if your project uses Gatsby and not Next.js 94 | # https://nextjs.org/blog/next-9-1#public-directory-support 95 | # public 96 | 97 | # vuepress build output 98 | .vuepress/dist 99 | 100 | # Serverless directories 101 | .serverless/ 102 | 103 | # FuseBox cache 104 | .fusebox/ 105 | 106 | # DynamoDB Local files 107 | .dynamodb/ 108 | 109 | # TernJS port file 110 | .tern-port 111 | 112 | # Stores VSCode versions used for testing VSCode extensions 113 | .vscode-test 114 | 115 | # End of https://www.toptal.com/developers/gitignore/api/node 116 | 117 | # Created by https://www.toptal.com/developers/gitignore/api/macos 118 | # Edit at https://www.toptal.com/developers/gitignore?templates=macos 119 | 120 | ### macOS ### 121 | # General 122 | .DS_Store 123 | .AppleDouble 124 | .LSOverride 125 | 126 | # Icon must end with two 127 | Icon 128 | 129 | 130 | # Thumbnails 131 | ._* 132 | 133 | # Files that might appear in the root of a volume 134 | .DocumentRevisions-V100 135 | .fseventsd 136 | .Spotlight-V100 137 | .TemporaryItems 138 | .Trashes 139 | .VolumeIcon.icns 140 | .com.apple.timemachine.donotpresent 141 | 142 | # Directories potentially created on remote AFP share 143 | .AppleDB 144 | .AppleDesktop 145 | Network Trash Folder 146 | Temporary Items 147 | .apdisk 148 | 149 | ### macOS Patch ### 150 | # iCloud generated files 151 | *.icloud 152 | 153 | # End of https://www.toptal.com/developers/gitignore/api/macos 154 | 155 | # Created by https://www.toptal.com/developers/gitignore/api/windows 156 | # Edit at https://www.toptal.com/developers/gitignore?templates=windows 157 | 158 | ### Windows ### 159 | # Windows thumbnail cache files 160 | Thumbs.db 161 | Thumbs.db:encryptable 162 | ehthumbs.db 163 | ehthumbs_vista.db 164 | 165 | # Dump file 166 | *.stackdump 167 | 168 | # Folder config file 169 | [Dd]esktop.ini 170 | 171 | # Recycle Bin used on file shares 172 | $RECYCLE.BIN/ 173 | 174 | # Windows Installer files 175 | *.cab 176 | *.msi 177 | *.msix 178 | *.msm 179 | *.msp 180 | 181 | # Windows shortcuts 182 | *.lnk 183 | 184 | # End of https://www.toptal.com/developers/gitignore/api/windows 185 | 186 | #Added by cargo 187 | 188 | /target 189 | Cargo.lock 190 | 191 | .pnp.* 192 | .yarn/* 193 | !.yarn/patches 194 | !.yarn/plugins 195 | !.yarn/releases 196 | !.yarn/sdks 197 | !.yarn/versions 198 | 199 | *.node 200 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | target 2 | data/ 3 | Cargo.lock 4 | .cargo 5 | .github 6 | npm 7 | .eslintrc 8 | .prettierignore 9 | rustfmt.toml 10 | yarn.lock 11 | *.node 12 | .yarn 13 | __test__ 14 | renovate.json 15 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | yarnPath: .yarn/releases/yarn-4.2.1.cjs 4 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | edition = "2021" 3 | name = "envio_hyperfuel-client" 4 | version = "1.2.2" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix 11 | napi = { version = "2", default-features = false, features = [ 12 | "napi9", 13 | "async", 14 | "serde-json", 15 | ] } 16 | napi-derive = "2" 17 | serde_json = "1" 18 | serde = { version = "1", features = ["derive"] } 19 | tokio = { version = "1", features = ["rt-multi-thread"] } 20 | anyhow = "1.0.83" 21 | env_logger = "0.11" 22 | faster-hex = "0.9.0" 23 | 24 | hyperfuel-client = "2.1.1" 25 | hyperfuel-net-types = "3.0.0" 26 | hyperfuel-format = "3.0.0" 27 | 28 | [build-dependencies] 29 | napi-build = "2.0.1" 30 | 31 | [profile.release] 32 | lto = true 33 | strip = "symbols" 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @envio-dev/hyperfuel-client-node 2 | 3 | Node package for [Envio's](https://envio.dev/) hyperfuel client written in Rust. 4 | 5 | More information about Envio's Hyperfuel support of Fuel at [https://docs.envio.dev/docs/HyperSync/hyperfuel](https://docs.envio.dev/docs/HyperSync/hyperfuel) 6 | 7 | ### see examples in `examples/` 8 | 9 | -------------------------------------------------------------------------------- /__test__/index.spec.mjs: -------------------------------------------------------------------------------- 1 | import test from 'ava' 2 | 3 | // import { sum } from '../index.js' 4 | 5 | test('sum from native', (t) => { 6 | t.is(1 + 2, 3) 7 | }) 8 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | extern crate napi_build; 2 | 3 | fn main() { 4 | napi_build::setup(); 5 | } 6 | -------------------------------------------------------------------------------- /examples/asset-id/README.md: -------------------------------------------------------------------------------- 1 | # asset-id 2 | We query from blocks 0 (inclusive) to 1300000 (exclusive) for all `Inputs` where the address `0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea` 3 | matches on the `asset_id` field. 4 | 5 | Can run `npx tsc && node dist/app.js` to run it. -------------------------------------------------------------------------------- /examples/asset-id/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-logs", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "simple-logs", 9 | "version": "0.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "hyperfuel-client": "../.." 13 | }, 14 | "devDependencies": { 15 | "@types/node": "^20.10.3", 16 | "typescript": "^5.3.2" 17 | } 18 | }, 19 | "../..": { 20 | "name": "hyperfuel-client", 21 | "version": "0.0.5", 22 | "license": "MIT", 23 | "devDependencies": { 24 | "@napi-rs/cli": "^2.18.3", 25 | "ava": "^6.0.1" 26 | }, 27 | "engines": { 28 | "node": ">= 10" 29 | } 30 | }, 31 | "../../node_modules/@mapbox/node-pre-gyp": { 32 | "version": "1.0.11", 33 | "dev": true, 34 | "license": "BSD-3-Clause", 35 | "dependencies": { 36 | "detect-libc": "^2.0.0", 37 | "https-proxy-agent": "^5.0.0", 38 | "make-dir": "^3.1.0", 39 | "node-fetch": "^2.6.7", 40 | "nopt": "^5.0.0", 41 | "npmlog": "^5.0.1", 42 | "rimraf": "^3.0.2", 43 | "semver": "^7.3.5", 44 | "tar": "^6.1.11" 45 | }, 46 | "bin": { 47 | "node-pre-gyp": "bin/node-pre-gyp" 48 | } 49 | }, 50 | "../../node_modules/@napi-rs/cli": { 51 | "version": "2.18.3", 52 | "dev": true, 53 | "license": "MIT", 54 | "bin": { 55 | "napi": "scripts/index.js" 56 | }, 57 | "engines": { 58 | "node": ">= 10" 59 | }, 60 | "funding": { 61 | "type": "github", 62 | "url": "https://github.com/sponsors/Brooooooklyn" 63 | } 64 | }, 65 | "../../node_modules/@nodelib/fs.scandir": { 66 | "version": "2.1.5", 67 | "dev": true, 68 | "license": "MIT", 69 | "dependencies": { 70 | "@nodelib/fs.stat": "2.0.5", 71 | "run-parallel": "^1.1.9" 72 | }, 73 | "engines": { 74 | "node": ">= 8" 75 | } 76 | }, 77 | "../../node_modules/@nodelib/fs.stat": { 78 | "version": "2.0.5", 79 | "dev": true, 80 | "license": "MIT", 81 | "engines": { 82 | "node": ">= 8" 83 | } 84 | }, 85 | "../../node_modules/@nodelib/fs.walk": { 86 | "version": "1.2.8", 87 | "dev": true, 88 | "license": "MIT", 89 | "dependencies": { 90 | "@nodelib/fs.scandir": "2.1.5", 91 | "fastq": "^1.6.0" 92 | }, 93 | "engines": { 94 | "node": ">= 8" 95 | } 96 | }, 97 | "../../node_modules/@rollup/pluginutils": { 98 | "version": "4.2.1", 99 | "dev": true, 100 | "license": "MIT", 101 | "dependencies": { 102 | "estree-walker": "^2.0.1", 103 | "picomatch": "^2.2.2" 104 | }, 105 | "engines": { 106 | "node": ">= 8.0.0" 107 | } 108 | }, 109 | "../../node_modules/@sindresorhus/merge-streams": { 110 | "version": "2.3.0", 111 | "dev": true, 112 | "license": "MIT", 113 | "engines": { 114 | "node": ">=18" 115 | }, 116 | "funding": { 117 | "url": "https://github.com/sponsors/sindresorhus" 118 | } 119 | }, 120 | "../../node_modules/@vercel/nft": { 121 | "version": "0.26.5", 122 | "dev": true, 123 | "license": "MIT", 124 | "dependencies": { 125 | "@mapbox/node-pre-gyp": "^1.0.5", 126 | "@rollup/pluginutils": "^4.0.0", 127 | "acorn": "^8.6.0", 128 | "acorn-import-attributes": "^1.9.2", 129 | "async-sema": "^3.1.1", 130 | "bindings": "^1.4.0", 131 | "estree-walker": "2.0.2", 132 | "glob": "^7.1.3", 133 | "graceful-fs": "^4.2.9", 134 | "micromatch": "^4.0.2", 135 | "node-gyp-build": "^4.2.2", 136 | "resolve-from": "^5.0.0" 137 | }, 138 | "bin": { 139 | "nft": "out/cli.js" 140 | }, 141 | "engines": { 142 | "node": ">=16" 143 | } 144 | }, 145 | "../../node_modules/abbrev": { 146 | "version": "1.1.1", 147 | "dev": true, 148 | "license": "ISC" 149 | }, 150 | "../../node_modules/acorn": { 151 | "version": "8.11.3", 152 | "dev": true, 153 | "license": "MIT", 154 | "bin": { 155 | "acorn": "bin/acorn" 156 | }, 157 | "engines": { 158 | "node": ">=0.4.0" 159 | } 160 | }, 161 | "../../node_modules/acorn-import-attributes": { 162 | "version": "1.9.5", 163 | "dev": true, 164 | "license": "MIT", 165 | "peerDependencies": { 166 | "acorn": "^8" 167 | } 168 | }, 169 | "../../node_modules/acorn-walk": { 170 | "version": "8.3.2", 171 | "dev": true, 172 | "license": "MIT", 173 | "engines": { 174 | "node": ">=0.4.0" 175 | } 176 | }, 177 | "../../node_modules/agent-base": { 178 | "version": "6.0.2", 179 | "dev": true, 180 | "license": "MIT", 181 | "dependencies": { 182 | "debug": "4" 183 | }, 184 | "engines": { 185 | "node": ">= 6.0.0" 186 | } 187 | }, 188 | "../../node_modules/ansi-regex": { 189 | "version": "5.0.1", 190 | "dev": true, 191 | "license": "MIT", 192 | "engines": { 193 | "node": ">=8" 194 | } 195 | }, 196 | "../../node_modules/ansi-styles": { 197 | "version": "6.2.1", 198 | "dev": true, 199 | "license": "MIT", 200 | "engines": { 201 | "node": ">=12" 202 | }, 203 | "funding": { 204 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 205 | } 206 | }, 207 | "../../node_modules/aproba": { 208 | "version": "2.0.0", 209 | "dev": true, 210 | "license": "ISC" 211 | }, 212 | "../../node_modules/are-we-there-yet": { 213 | "version": "2.0.0", 214 | "dev": true, 215 | "license": "ISC", 216 | "dependencies": { 217 | "delegates": "^1.0.0", 218 | "readable-stream": "^3.6.0" 219 | }, 220 | "engines": { 221 | "node": ">=10" 222 | } 223 | }, 224 | "../../node_modules/argparse": { 225 | "version": "1.0.10", 226 | "dev": true, 227 | "license": "MIT", 228 | "dependencies": { 229 | "sprintf-js": "~1.0.2" 230 | } 231 | }, 232 | "../../node_modules/array-find-index": { 233 | "version": "1.0.2", 234 | "dev": true, 235 | "license": "MIT", 236 | "engines": { 237 | "node": ">=0.10.0" 238 | } 239 | }, 240 | "../../node_modules/arrgv": { 241 | "version": "1.0.2", 242 | "dev": true, 243 | "license": "MIT", 244 | "engines": { 245 | "node": ">=8.0.0" 246 | } 247 | }, 248 | "../../node_modules/arrify": { 249 | "version": "3.0.0", 250 | "dev": true, 251 | "license": "MIT", 252 | "engines": { 253 | "node": ">=12" 254 | }, 255 | "funding": { 256 | "url": "https://github.com/sponsors/sindresorhus" 257 | } 258 | }, 259 | "../../node_modules/async-sema": { 260 | "version": "3.1.1", 261 | "dev": true, 262 | "license": "MIT" 263 | }, 264 | "../../node_modules/ava": { 265 | "version": "6.1.3", 266 | "dev": true, 267 | "license": "MIT", 268 | "dependencies": { 269 | "@vercel/nft": "^0.26.2", 270 | "acorn": "^8.11.3", 271 | "acorn-walk": "^8.3.2", 272 | "ansi-styles": "^6.2.1", 273 | "arrgv": "^1.0.2", 274 | "arrify": "^3.0.0", 275 | "callsites": "^4.1.0", 276 | "cbor": "^9.0.1", 277 | "chalk": "^5.3.0", 278 | "chunkd": "^2.0.1", 279 | "ci-info": "^4.0.0", 280 | "ci-parallel-vars": "^1.0.1", 281 | "cli-truncate": "^4.0.0", 282 | "code-excerpt": "^4.0.0", 283 | "common-path-prefix": "^3.0.0", 284 | "concordance": "^5.0.4", 285 | "currently-unhandled": "^0.4.1", 286 | "debug": "^4.3.4", 287 | "emittery": "^1.0.1", 288 | "figures": "^6.0.1", 289 | "globby": "^14.0.0", 290 | "ignore-by-default": "^2.1.0", 291 | "indent-string": "^5.0.0", 292 | "is-plain-object": "^5.0.0", 293 | "is-promise": "^4.0.0", 294 | "matcher": "^5.0.0", 295 | "memoize": "^10.0.0", 296 | "ms": "^2.1.3", 297 | "p-map": "^7.0.1", 298 | "package-config": "^5.0.0", 299 | "picomatch": "^3.0.1", 300 | "plur": "^5.1.0", 301 | "pretty-ms": "^9.0.0", 302 | "resolve-cwd": "^3.0.0", 303 | "stack-utils": "^2.0.6", 304 | "strip-ansi": "^7.1.0", 305 | "supertap": "^3.0.1", 306 | "temp-dir": "^3.0.0", 307 | "write-file-atomic": "^5.0.1", 308 | "yargs": "^17.7.2" 309 | }, 310 | "bin": { 311 | "ava": "entrypoints/cli.mjs" 312 | }, 313 | "engines": { 314 | "node": "^18.18 || ^20.8 || ^21 || ^22" 315 | }, 316 | "peerDependencies": { 317 | "@ava/typescript": "*" 318 | }, 319 | "peerDependenciesMeta": { 320 | "@ava/typescript": { 321 | "optional": true 322 | } 323 | } 324 | }, 325 | "../../node_modules/ava/node_modules/ansi-regex": { 326 | "version": "6.0.1", 327 | "dev": true, 328 | "license": "MIT", 329 | "engines": { 330 | "node": ">=12" 331 | }, 332 | "funding": { 333 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 334 | } 335 | }, 336 | "../../node_modules/ava/node_modules/ms": { 337 | "version": "2.1.3", 338 | "dev": true, 339 | "license": "MIT" 340 | }, 341 | "../../node_modules/ava/node_modules/picomatch": { 342 | "version": "3.0.1", 343 | "dev": true, 344 | "license": "MIT", 345 | "engines": { 346 | "node": ">=10" 347 | }, 348 | "funding": { 349 | "url": "https://github.com/sponsors/jonschlinkert" 350 | } 351 | }, 352 | "../../node_modules/ava/node_modules/strip-ansi": { 353 | "version": "7.1.0", 354 | "dev": true, 355 | "license": "MIT", 356 | "dependencies": { 357 | "ansi-regex": "^6.0.1" 358 | }, 359 | "engines": { 360 | "node": ">=12" 361 | }, 362 | "funding": { 363 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 364 | } 365 | }, 366 | "../../node_modules/balanced-match": { 367 | "version": "1.0.2", 368 | "dev": true, 369 | "license": "MIT" 370 | }, 371 | "../../node_modules/bindings": { 372 | "version": "1.5.0", 373 | "dev": true, 374 | "license": "MIT", 375 | "dependencies": { 376 | "file-uri-to-path": "1.0.0" 377 | } 378 | }, 379 | "../../node_modules/blueimp-md5": { 380 | "version": "2.19.0", 381 | "dev": true, 382 | "license": "MIT" 383 | }, 384 | "../../node_modules/brace-expansion": { 385 | "version": "1.1.11", 386 | "dev": true, 387 | "license": "MIT", 388 | "dependencies": { 389 | "balanced-match": "^1.0.0", 390 | "concat-map": "0.0.1" 391 | } 392 | }, 393 | "../../node_modules/braces": { 394 | "version": "3.0.2", 395 | "dev": true, 396 | "license": "MIT", 397 | "dependencies": { 398 | "fill-range": "^7.0.1" 399 | }, 400 | "engines": { 401 | "node": ">=8" 402 | } 403 | }, 404 | "../../node_modules/callsites": { 405 | "version": "4.1.0", 406 | "dev": true, 407 | "license": "MIT", 408 | "engines": { 409 | "node": ">=12.20" 410 | }, 411 | "funding": { 412 | "url": "https://github.com/sponsors/sindresorhus" 413 | } 414 | }, 415 | "../../node_modules/cbor": { 416 | "version": "9.0.2", 417 | "dev": true, 418 | "license": "MIT", 419 | "dependencies": { 420 | "nofilter": "^3.1.0" 421 | }, 422 | "engines": { 423 | "node": ">=16" 424 | } 425 | }, 426 | "../../node_modules/chalk": { 427 | "version": "5.3.0", 428 | "dev": true, 429 | "license": "MIT", 430 | "engines": { 431 | "node": "^12.17.0 || ^14.13 || >=16.0.0" 432 | }, 433 | "funding": { 434 | "url": "https://github.com/chalk/chalk?sponsor=1" 435 | } 436 | }, 437 | "../../node_modules/chownr": { 438 | "version": "2.0.0", 439 | "dev": true, 440 | "license": "ISC", 441 | "engines": { 442 | "node": ">=10" 443 | } 444 | }, 445 | "../../node_modules/chunkd": { 446 | "version": "2.0.1", 447 | "dev": true, 448 | "license": "MIT" 449 | }, 450 | "../../node_modules/ci-info": { 451 | "version": "4.0.0", 452 | "dev": true, 453 | "funding": [ 454 | { 455 | "type": "github", 456 | "url": "https://github.com/sponsors/sibiraj-s" 457 | } 458 | ], 459 | "license": "MIT", 460 | "engines": { 461 | "node": ">=8" 462 | } 463 | }, 464 | "../../node_modules/ci-parallel-vars": { 465 | "version": "1.0.1", 466 | "dev": true, 467 | "license": "MIT" 468 | }, 469 | "../../node_modules/cli-truncate": { 470 | "version": "4.0.0", 471 | "dev": true, 472 | "license": "MIT", 473 | "dependencies": { 474 | "slice-ansi": "^5.0.0", 475 | "string-width": "^7.0.0" 476 | }, 477 | "engines": { 478 | "node": ">=18" 479 | }, 480 | "funding": { 481 | "url": "https://github.com/sponsors/sindresorhus" 482 | } 483 | }, 484 | "../../node_modules/cli-truncate/node_modules/ansi-regex": { 485 | "version": "6.0.1", 486 | "dev": true, 487 | "license": "MIT", 488 | "engines": { 489 | "node": ">=12" 490 | }, 491 | "funding": { 492 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 493 | } 494 | }, 495 | "../../node_modules/cli-truncate/node_modules/emoji-regex": { 496 | "version": "10.3.0", 497 | "dev": true, 498 | "license": "MIT" 499 | }, 500 | "../../node_modules/cli-truncate/node_modules/string-width": { 501 | "version": "7.1.0", 502 | "dev": true, 503 | "license": "MIT", 504 | "dependencies": { 505 | "emoji-regex": "^10.3.0", 506 | "get-east-asian-width": "^1.0.0", 507 | "strip-ansi": "^7.1.0" 508 | }, 509 | "engines": { 510 | "node": ">=18" 511 | }, 512 | "funding": { 513 | "url": "https://github.com/sponsors/sindresorhus" 514 | } 515 | }, 516 | "../../node_modules/cli-truncate/node_modules/strip-ansi": { 517 | "version": "7.1.0", 518 | "dev": true, 519 | "license": "MIT", 520 | "dependencies": { 521 | "ansi-regex": "^6.0.1" 522 | }, 523 | "engines": { 524 | "node": ">=12" 525 | }, 526 | "funding": { 527 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 528 | } 529 | }, 530 | "../../node_modules/cliui": { 531 | "version": "8.0.1", 532 | "dev": true, 533 | "license": "ISC", 534 | "dependencies": { 535 | "string-width": "^4.2.0", 536 | "strip-ansi": "^6.0.1", 537 | "wrap-ansi": "^7.0.0" 538 | }, 539 | "engines": { 540 | "node": ">=12" 541 | } 542 | }, 543 | "../../node_modules/code-excerpt": { 544 | "version": "4.0.0", 545 | "dev": true, 546 | "license": "MIT", 547 | "dependencies": { 548 | "convert-to-spaces": "^2.0.1" 549 | }, 550 | "engines": { 551 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 552 | } 553 | }, 554 | "../../node_modules/color-convert": { 555 | "version": "2.0.1", 556 | "dev": true, 557 | "license": "MIT", 558 | "dependencies": { 559 | "color-name": "~1.1.4" 560 | }, 561 | "engines": { 562 | "node": ">=7.0.0" 563 | } 564 | }, 565 | "../../node_modules/color-name": { 566 | "version": "1.1.4", 567 | "dev": true, 568 | "license": "MIT" 569 | }, 570 | "../../node_modules/color-support": { 571 | "version": "1.1.3", 572 | "dev": true, 573 | "license": "ISC", 574 | "bin": { 575 | "color-support": "bin.js" 576 | } 577 | }, 578 | "../../node_modules/common-path-prefix": { 579 | "version": "3.0.0", 580 | "dev": true, 581 | "license": "ISC" 582 | }, 583 | "../../node_modules/concat-map": { 584 | "version": "0.0.1", 585 | "dev": true, 586 | "license": "MIT" 587 | }, 588 | "../../node_modules/concordance": { 589 | "version": "5.0.4", 590 | "dev": true, 591 | "license": "ISC", 592 | "dependencies": { 593 | "date-time": "^3.1.0", 594 | "esutils": "^2.0.3", 595 | "fast-diff": "^1.2.0", 596 | "js-string-escape": "^1.0.1", 597 | "lodash": "^4.17.15", 598 | "md5-hex": "^3.0.1", 599 | "semver": "^7.3.2", 600 | "well-known-symbols": "^2.0.0" 601 | }, 602 | "engines": { 603 | "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" 604 | } 605 | }, 606 | "../../node_modules/console-control-strings": { 607 | "version": "1.1.0", 608 | "dev": true, 609 | "license": "ISC" 610 | }, 611 | "../../node_modules/convert-to-spaces": { 612 | "version": "2.0.1", 613 | "dev": true, 614 | "license": "MIT", 615 | "engines": { 616 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 617 | } 618 | }, 619 | "../../node_modules/currently-unhandled": { 620 | "version": "0.4.1", 621 | "dev": true, 622 | "license": "MIT", 623 | "dependencies": { 624 | "array-find-index": "^1.0.1" 625 | }, 626 | "engines": { 627 | "node": ">=0.10.0" 628 | } 629 | }, 630 | "../../node_modules/date-time": { 631 | "version": "3.1.0", 632 | "dev": true, 633 | "license": "MIT", 634 | "dependencies": { 635 | "time-zone": "^1.0.0" 636 | }, 637 | "engines": { 638 | "node": ">=6" 639 | } 640 | }, 641 | "../../node_modules/debug": { 642 | "version": "4.3.4", 643 | "dev": true, 644 | "license": "MIT", 645 | "dependencies": { 646 | "ms": "2.1.2" 647 | }, 648 | "engines": { 649 | "node": ">=6.0" 650 | }, 651 | "peerDependenciesMeta": { 652 | "supports-color": { 653 | "optional": true 654 | } 655 | } 656 | }, 657 | "../../node_modules/delegates": { 658 | "version": "1.0.0", 659 | "dev": true, 660 | "license": "MIT" 661 | }, 662 | "../../node_modules/detect-libc": { 663 | "version": "2.0.3", 664 | "dev": true, 665 | "license": "Apache-2.0", 666 | "engines": { 667 | "node": ">=8" 668 | } 669 | }, 670 | "../../node_modules/emittery": { 671 | "version": "1.0.3", 672 | "dev": true, 673 | "license": "MIT", 674 | "engines": { 675 | "node": ">=14.16" 676 | }, 677 | "funding": { 678 | "url": "https://github.com/sindresorhus/emittery?sponsor=1" 679 | } 680 | }, 681 | "../../node_modules/emoji-regex": { 682 | "version": "8.0.0", 683 | "dev": true, 684 | "license": "MIT" 685 | }, 686 | "../../node_modules/escalade": { 687 | "version": "3.1.2", 688 | "dev": true, 689 | "license": "MIT", 690 | "engines": { 691 | "node": ">=6" 692 | } 693 | }, 694 | "../../node_modules/escape-string-regexp": { 695 | "version": "5.0.0", 696 | "dev": true, 697 | "license": "MIT", 698 | "engines": { 699 | "node": ">=12" 700 | }, 701 | "funding": { 702 | "url": "https://github.com/sponsors/sindresorhus" 703 | } 704 | }, 705 | "../../node_modules/esprima": { 706 | "version": "4.0.1", 707 | "dev": true, 708 | "license": "BSD-2-Clause", 709 | "bin": { 710 | "esparse": "bin/esparse.js", 711 | "esvalidate": "bin/esvalidate.js" 712 | }, 713 | "engines": { 714 | "node": ">=4" 715 | } 716 | }, 717 | "../../node_modules/estree-walker": { 718 | "version": "2.0.2", 719 | "dev": true, 720 | "license": "MIT" 721 | }, 722 | "../../node_modules/esutils": { 723 | "version": "2.0.3", 724 | "dev": true, 725 | "license": "BSD-2-Clause", 726 | "engines": { 727 | "node": ">=0.10.0" 728 | } 729 | }, 730 | "../../node_modules/fast-diff": { 731 | "version": "1.3.0", 732 | "dev": true, 733 | "license": "Apache-2.0" 734 | }, 735 | "../../node_modules/fast-glob": { 736 | "version": "3.3.2", 737 | "dev": true, 738 | "license": "MIT", 739 | "dependencies": { 740 | "@nodelib/fs.stat": "^2.0.2", 741 | "@nodelib/fs.walk": "^1.2.3", 742 | "glob-parent": "^5.1.2", 743 | "merge2": "^1.3.0", 744 | "micromatch": "^4.0.4" 745 | }, 746 | "engines": { 747 | "node": ">=8.6.0" 748 | } 749 | }, 750 | "../../node_modules/fastq": { 751 | "version": "1.17.1", 752 | "dev": true, 753 | "license": "ISC", 754 | "dependencies": { 755 | "reusify": "^1.0.4" 756 | } 757 | }, 758 | "../../node_modules/figures": { 759 | "version": "6.1.0", 760 | "dev": true, 761 | "license": "MIT", 762 | "dependencies": { 763 | "is-unicode-supported": "^2.0.0" 764 | }, 765 | "engines": { 766 | "node": ">=18" 767 | }, 768 | "funding": { 769 | "url": "https://github.com/sponsors/sindresorhus" 770 | } 771 | }, 772 | "../../node_modules/file-uri-to-path": { 773 | "version": "1.0.0", 774 | "dev": true, 775 | "license": "MIT" 776 | }, 777 | "../../node_modules/fill-range": { 778 | "version": "7.0.1", 779 | "dev": true, 780 | "license": "MIT", 781 | "dependencies": { 782 | "to-regex-range": "^5.0.1" 783 | }, 784 | "engines": { 785 | "node": ">=8" 786 | } 787 | }, 788 | "../../node_modules/find-up-simple": { 789 | "version": "1.0.0", 790 | "dev": true, 791 | "license": "MIT", 792 | "engines": { 793 | "node": ">=18" 794 | }, 795 | "funding": { 796 | "url": "https://github.com/sponsors/sindresorhus" 797 | } 798 | }, 799 | "../../node_modules/fs-minipass": { 800 | "version": "2.1.0", 801 | "dev": true, 802 | "license": "ISC", 803 | "dependencies": { 804 | "minipass": "^3.0.0" 805 | }, 806 | "engines": { 807 | "node": ">= 8" 808 | } 809 | }, 810 | "../../node_modules/fs.realpath": { 811 | "version": "1.0.0", 812 | "dev": true, 813 | "license": "ISC" 814 | }, 815 | "../../node_modules/gauge": { 816 | "version": "3.0.2", 817 | "dev": true, 818 | "license": "ISC", 819 | "dependencies": { 820 | "aproba": "^1.0.3 || ^2.0.0", 821 | "color-support": "^1.1.2", 822 | "console-control-strings": "^1.0.0", 823 | "has-unicode": "^2.0.1", 824 | "object-assign": "^4.1.1", 825 | "signal-exit": "^3.0.0", 826 | "string-width": "^4.2.3", 827 | "strip-ansi": "^6.0.1", 828 | "wide-align": "^1.1.2" 829 | }, 830 | "engines": { 831 | "node": ">=10" 832 | } 833 | }, 834 | "../../node_modules/get-caller-file": { 835 | "version": "2.0.5", 836 | "dev": true, 837 | "license": "ISC", 838 | "engines": { 839 | "node": "6.* || 8.* || >= 10.*" 840 | } 841 | }, 842 | "../../node_modules/get-east-asian-width": { 843 | "version": "1.2.0", 844 | "dev": true, 845 | "license": "MIT", 846 | "engines": { 847 | "node": ">=18" 848 | }, 849 | "funding": { 850 | "url": "https://github.com/sponsors/sindresorhus" 851 | } 852 | }, 853 | "../../node_modules/glob": { 854 | "version": "7.2.3", 855 | "dev": true, 856 | "license": "ISC", 857 | "dependencies": { 858 | "fs.realpath": "^1.0.0", 859 | "inflight": "^1.0.4", 860 | "inherits": "2", 861 | "minimatch": "^3.1.1", 862 | "once": "^1.3.0", 863 | "path-is-absolute": "^1.0.0" 864 | }, 865 | "engines": { 866 | "node": "*" 867 | }, 868 | "funding": { 869 | "url": "https://github.com/sponsors/isaacs" 870 | } 871 | }, 872 | "../../node_modules/glob-parent": { 873 | "version": "5.1.2", 874 | "dev": true, 875 | "license": "ISC", 876 | "dependencies": { 877 | "is-glob": "^4.0.1" 878 | }, 879 | "engines": { 880 | "node": ">= 6" 881 | } 882 | }, 883 | "../../node_modules/globby": { 884 | "version": "14.0.1", 885 | "dev": true, 886 | "license": "MIT", 887 | "dependencies": { 888 | "@sindresorhus/merge-streams": "^2.1.0", 889 | "fast-glob": "^3.3.2", 890 | "ignore": "^5.2.4", 891 | "path-type": "^5.0.0", 892 | "slash": "^5.1.0", 893 | "unicorn-magic": "^0.1.0" 894 | }, 895 | "engines": { 896 | "node": ">=18" 897 | }, 898 | "funding": { 899 | "url": "https://github.com/sponsors/sindresorhus" 900 | } 901 | }, 902 | "../../node_modules/graceful-fs": { 903 | "version": "4.2.11", 904 | "dev": true, 905 | "license": "ISC" 906 | }, 907 | "../../node_modules/has-unicode": { 908 | "version": "2.0.1", 909 | "dev": true, 910 | "license": "ISC" 911 | }, 912 | "../../node_modules/https-proxy-agent": { 913 | "version": "5.0.1", 914 | "dev": true, 915 | "license": "MIT", 916 | "dependencies": { 917 | "agent-base": "6", 918 | "debug": "4" 919 | }, 920 | "engines": { 921 | "node": ">= 6" 922 | } 923 | }, 924 | "../../node_modules/ignore": { 925 | "version": "5.3.1", 926 | "dev": true, 927 | "license": "MIT", 928 | "engines": { 929 | "node": ">= 4" 930 | } 931 | }, 932 | "../../node_modules/ignore-by-default": { 933 | "version": "2.1.0", 934 | "dev": true, 935 | "license": "ISC", 936 | "engines": { 937 | "node": ">=10 <11 || >=12 <13 || >=14" 938 | } 939 | }, 940 | "../../node_modules/imurmurhash": { 941 | "version": "0.1.4", 942 | "dev": true, 943 | "license": "MIT", 944 | "engines": { 945 | "node": ">=0.8.19" 946 | } 947 | }, 948 | "../../node_modules/indent-string": { 949 | "version": "5.0.0", 950 | "dev": true, 951 | "license": "MIT", 952 | "engines": { 953 | "node": ">=12" 954 | }, 955 | "funding": { 956 | "url": "https://github.com/sponsors/sindresorhus" 957 | } 958 | }, 959 | "../../node_modules/inflight": { 960 | "version": "1.0.6", 961 | "dev": true, 962 | "license": "ISC", 963 | "dependencies": { 964 | "once": "^1.3.0", 965 | "wrappy": "1" 966 | } 967 | }, 968 | "../../node_modules/inherits": { 969 | "version": "2.0.4", 970 | "dev": true, 971 | "license": "ISC" 972 | }, 973 | "../../node_modules/irregular-plurals": { 974 | "version": "3.5.0", 975 | "dev": true, 976 | "license": "MIT", 977 | "engines": { 978 | "node": ">=8" 979 | } 980 | }, 981 | "../../node_modules/is-extglob": { 982 | "version": "2.1.1", 983 | "dev": true, 984 | "license": "MIT", 985 | "engines": { 986 | "node": ">=0.10.0" 987 | } 988 | }, 989 | "../../node_modules/is-fullwidth-code-point": { 990 | "version": "3.0.0", 991 | "dev": true, 992 | "license": "MIT", 993 | "engines": { 994 | "node": ">=8" 995 | } 996 | }, 997 | "../../node_modules/is-glob": { 998 | "version": "4.0.3", 999 | "dev": true, 1000 | "license": "MIT", 1001 | "dependencies": { 1002 | "is-extglob": "^2.1.1" 1003 | }, 1004 | "engines": { 1005 | "node": ">=0.10.0" 1006 | } 1007 | }, 1008 | "../../node_modules/is-number": { 1009 | "version": "7.0.0", 1010 | "dev": true, 1011 | "license": "MIT", 1012 | "engines": { 1013 | "node": ">=0.12.0" 1014 | } 1015 | }, 1016 | "../../node_modules/is-plain-object": { 1017 | "version": "5.0.0", 1018 | "dev": true, 1019 | "license": "MIT", 1020 | "engines": { 1021 | "node": ">=0.10.0" 1022 | } 1023 | }, 1024 | "../../node_modules/is-promise": { 1025 | "version": "4.0.0", 1026 | "dev": true, 1027 | "license": "MIT" 1028 | }, 1029 | "../../node_modules/is-unicode-supported": { 1030 | "version": "2.0.0", 1031 | "dev": true, 1032 | "license": "MIT", 1033 | "engines": { 1034 | "node": ">=18" 1035 | }, 1036 | "funding": { 1037 | "url": "https://github.com/sponsors/sindresorhus" 1038 | } 1039 | }, 1040 | "../../node_modules/js-string-escape": { 1041 | "version": "1.0.1", 1042 | "dev": true, 1043 | "license": "MIT", 1044 | "engines": { 1045 | "node": ">= 0.8" 1046 | } 1047 | }, 1048 | "../../node_modules/js-yaml": { 1049 | "version": "3.14.1", 1050 | "dev": true, 1051 | "license": "MIT", 1052 | "dependencies": { 1053 | "argparse": "^1.0.7", 1054 | "esprima": "^4.0.0" 1055 | }, 1056 | "bin": { 1057 | "js-yaml": "bin/js-yaml.js" 1058 | } 1059 | }, 1060 | "../../node_modules/load-json-file": { 1061 | "version": "7.0.1", 1062 | "dev": true, 1063 | "license": "MIT", 1064 | "engines": { 1065 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 1066 | }, 1067 | "funding": { 1068 | "url": "https://github.com/sponsors/sindresorhus" 1069 | } 1070 | }, 1071 | "../../node_modules/lodash": { 1072 | "version": "4.17.21", 1073 | "dev": true, 1074 | "license": "MIT" 1075 | }, 1076 | "../../node_modules/make-dir": { 1077 | "version": "3.1.0", 1078 | "dev": true, 1079 | "license": "MIT", 1080 | "dependencies": { 1081 | "semver": "^6.0.0" 1082 | }, 1083 | "engines": { 1084 | "node": ">=8" 1085 | }, 1086 | "funding": { 1087 | "url": "https://github.com/sponsors/sindresorhus" 1088 | } 1089 | }, 1090 | "../../node_modules/make-dir/node_modules/semver": { 1091 | "version": "6.3.1", 1092 | "dev": true, 1093 | "license": "ISC", 1094 | "bin": { 1095 | "semver": "bin/semver.js" 1096 | } 1097 | }, 1098 | "../../node_modules/matcher": { 1099 | "version": "5.0.0", 1100 | "dev": true, 1101 | "license": "MIT", 1102 | "dependencies": { 1103 | "escape-string-regexp": "^5.0.0" 1104 | }, 1105 | "engines": { 1106 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 1107 | }, 1108 | "funding": { 1109 | "url": "https://github.com/sponsors/sindresorhus" 1110 | } 1111 | }, 1112 | "../../node_modules/md5-hex": { 1113 | "version": "3.0.1", 1114 | "dev": true, 1115 | "license": "MIT", 1116 | "dependencies": { 1117 | "blueimp-md5": "^2.10.0" 1118 | }, 1119 | "engines": { 1120 | "node": ">=8" 1121 | } 1122 | }, 1123 | "../../node_modules/memoize": { 1124 | "version": "10.0.0", 1125 | "dev": true, 1126 | "license": "MIT", 1127 | "dependencies": { 1128 | "mimic-function": "^5.0.0" 1129 | }, 1130 | "engines": { 1131 | "node": ">=18" 1132 | }, 1133 | "funding": { 1134 | "url": "https://github.com/sindresorhus/memoize?sponsor=1" 1135 | } 1136 | }, 1137 | "../../node_modules/merge2": { 1138 | "version": "1.4.1", 1139 | "dev": true, 1140 | "license": "MIT", 1141 | "engines": { 1142 | "node": ">= 8" 1143 | } 1144 | }, 1145 | "../../node_modules/micromatch": { 1146 | "version": "4.0.5", 1147 | "dev": true, 1148 | "license": "MIT", 1149 | "dependencies": { 1150 | "braces": "^3.0.2", 1151 | "picomatch": "^2.3.1" 1152 | }, 1153 | "engines": { 1154 | "node": ">=8.6" 1155 | } 1156 | }, 1157 | "../../node_modules/mimic-function": { 1158 | "version": "5.0.1", 1159 | "dev": true, 1160 | "license": "MIT", 1161 | "engines": { 1162 | "node": ">=18" 1163 | }, 1164 | "funding": { 1165 | "url": "https://github.com/sponsors/sindresorhus" 1166 | } 1167 | }, 1168 | "../../node_modules/minimatch": { 1169 | "version": "3.1.2", 1170 | "dev": true, 1171 | "license": "ISC", 1172 | "dependencies": { 1173 | "brace-expansion": "^1.1.7" 1174 | }, 1175 | "engines": { 1176 | "node": "*" 1177 | } 1178 | }, 1179 | "../../node_modules/minipass": { 1180 | "version": "3.3.6", 1181 | "dev": true, 1182 | "license": "ISC", 1183 | "dependencies": { 1184 | "yallist": "^4.0.0" 1185 | }, 1186 | "engines": { 1187 | "node": ">=8" 1188 | } 1189 | }, 1190 | "../../node_modules/minizlib": { 1191 | "version": "2.1.2", 1192 | "dev": true, 1193 | "license": "MIT", 1194 | "dependencies": { 1195 | "minipass": "^3.0.0", 1196 | "yallist": "^4.0.0" 1197 | }, 1198 | "engines": { 1199 | "node": ">= 8" 1200 | } 1201 | }, 1202 | "../../node_modules/mkdirp": { 1203 | "version": "1.0.4", 1204 | "dev": true, 1205 | "license": "MIT", 1206 | "bin": { 1207 | "mkdirp": "bin/cmd.js" 1208 | }, 1209 | "engines": { 1210 | "node": ">=10" 1211 | } 1212 | }, 1213 | "../../node_modules/ms": { 1214 | "version": "2.1.2", 1215 | "dev": true, 1216 | "license": "MIT" 1217 | }, 1218 | "../../node_modules/node-fetch": { 1219 | "version": "2.7.0", 1220 | "dev": true, 1221 | "license": "MIT", 1222 | "dependencies": { 1223 | "whatwg-url": "^5.0.0" 1224 | }, 1225 | "engines": { 1226 | "node": "4.x || >=6.0.0" 1227 | }, 1228 | "peerDependencies": { 1229 | "encoding": "^0.1.0" 1230 | }, 1231 | "peerDependenciesMeta": { 1232 | "encoding": { 1233 | "optional": true 1234 | } 1235 | } 1236 | }, 1237 | "../../node_modules/node-gyp-build": { 1238 | "version": "4.8.1", 1239 | "dev": true, 1240 | "license": "MIT", 1241 | "bin": { 1242 | "node-gyp-build": "bin.js", 1243 | "node-gyp-build-optional": "optional.js", 1244 | "node-gyp-build-test": "build-test.js" 1245 | } 1246 | }, 1247 | "../../node_modules/nofilter": { 1248 | "version": "3.1.0", 1249 | "dev": true, 1250 | "license": "MIT", 1251 | "engines": { 1252 | "node": ">=12.19" 1253 | } 1254 | }, 1255 | "../../node_modules/nopt": { 1256 | "version": "5.0.0", 1257 | "dev": true, 1258 | "license": "ISC", 1259 | "dependencies": { 1260 | "abbrev": "1" 1261 | }, 1262 | "bin": { 1263 | "nopt": "bin/nopt.js" 1264 | }, 1265 | "engines": { 1266 | "node": ">=6" 1267 | } 1268 | }, 1269 | "../../node_modules/npmlog": { 1270 | "version": "5.0.1", 1271 | "dev": true, 1272 | "license": "ISC", 1273 | "dependencies": { 1274 | "are-we-there-yet": "^2.0.0", 1275 | "console-control-strings": "^1.1.0", 1276 | "gauge": "^3.0.0", 1277 | "set-blocking": "^2.0.0" 1278 | } 1279 | }, 1280 | "../../node_modules/object-assign": { 1281 | "version": "4.1.1", 1282 | "dev": true, 1283 | "license": "MIT", 1284 | "engines": { 1285 | "node": ">=0.10.0" 1286 | } 1287 | }, 1288 | "../../node_modules/once": { 1289 | "version": "1.4.0", 1290 | "dev": true, 1291 | "license": "ISC", 1292 | "dependencies": { 1293 | "wrappy": "1" 1294 | } 1295 | }, 1296 | "../../node_modules/p-map": { 1297 | "version": "7.0.2", 1298 | "dev": true, 1299 | "license": "MIT", 1300 | "engines": { 1301 | "node": ">=18" 1302 | }, 1303 | "funding": { 1304 | "url": "https://github.com/sponsors/sindresorhus" 1305 | } 1306 | }, 1307 | "../../node_modules/package-config": { 1308 | "version": "5.0.0", 1309 | "dev": true, 1310 | "license": "MIT", 1311 | "dependencies": { 1312 | "find-up-simple": "^1.0.0", 1313 | "load-json-file": "^7.0.1" 1314 | }, 1315 | "engines": { 1316 | "node": ">=18" 1317 | }, 1318 | "funding": { 1319 | "url": "https://github.com/sponsors/sindresorhus" 1320 | } 1321 | }, 1322 | "../../node_modules/parse-ms": { 1323 | "version": "4.0.0", 1324 | "dev": true, 1325 | "license": "MIT", 1326 | "engines": { 1327 | "node": ">=18" 1328 | }, 1329 | "funding": { 1330 | "url": "https://github.com/sponsors/sindresorhus" 1331 | } 1332 | }, 1333 | "../../node_modules/path-is-absolute": { 1334 | "version": "1.0.1", 1335 | "dev": true, 1336 | "license": "MIT", 1337 | "engines": { 1338 | "node": ">=0.10.0" 1339 | } 1340 | }, 1341 | "../../node_modules/path-type": { 1342 | "version": "5.0.0", 1343 | "dev": true, 1344 | "license": "MIT", 1345 | "engines": { 1346 | "node": ">=12" 1347 | }, 1348 | "funding": { 1349 | "url": "https://github.com/sponsors/sindresorhus" 1350 | } 1351 | }, 1352 | "../../node_modules/picomatch": { 1353 | "version": "2.3.1", 1354 | "dev": true, 1355 | "license": "MIT", 1356 | "engines": { 1357 | "node": ">=8.6" 1358 | }, 1359 | "funding": { 1360 | "url": "https://github.com/sponsors/jonschlinkert" 1361 | } 1362 | }, 1363 | "../../node_modules/plur": { 1364 | "version": "5.1.0", 1365 | "dev": true, 1366 | "license": "MIT", 1367 | "dependencies": { 1368 | "irregular-plurals": "^3.3.0" 1369 | }, 1370 | "engines": { 1371 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 1372 | }, 1373 | "funding": { 1374 | "url": "https://github.com/sponsors/sindresorhus" 1375 | } 1376 | }, 1377 | "../../node_modules/pretty-ms": { 1378 | "version": "9.0.0", 1379 | "dev": true, 1380 | "license": "MIT", 1381 | "dependencies": { 1382 | "parse-ms": "^4.0.0" 1383 | }, 1384 | "engines": { 1385 | "node": ">=18" 1386 | }, 1387 | "funding": { 1388 | "url": "https://github.com/sponsors/sindresorhus" 1389 | } 1390 | }, 1391 | "../../node_modules/queue-microtask": { 1392 | "version": "1.2.3", 1393 | "dev": true, 1394 | "funding": [ 1395 | { 1396 | "type": "github", 1397 | "url": "https://github.com/sponsors/feross" 1398 | }, 1399 | { 1400 | "type": "patreon", 1401 | "url": "https://www.patreon.com/feross" 1402 | }, 1403 | { 1404 | "type": "consulting", 1405 | "url": "https://feross.org/support" 1406 | } 1407 | ], 1408 | "license": "MIT" 1409 | }, 1410 | "../../node_modules/readable-stream": { 1411 | "version": "3.6.2", 1412 | "dev": true, 1413 | "license": "MIT", 1414 | "dependencies": { 1415 | "inherits": "^2.0.3", 1416 | "string_decoder": "^1.1.1", 1417 | "util-deprecate": "^1.0.1" 1418 | }, 1419 | "engines": { 1420 | "node": ">= 6" 1421 | } 1422 | }, 1423 | "../../node_modules/require-directory": { 1424 | "version": "2.1.1", 1425 | "dev": true, 1426 | "license": "MIT", 1427 | "engines": { 1428 | "node": ">=0.10.0" 1429 | } 1430 | }, 1431 | "../../node_modules/resolve-cwd": { 1432 | "version": "3.0.0", 1433 | "dev": true, 1434 | "license": "MIT", 1435 | "dependencies": { 1436 | "resolve-from": "^5.0.0" 1437 | }, 1438 | "engines": { 1439 | "node": ">=8" 1440 | } 1441 | }, 1442 | "../../node_modules/resolve-from": { 1443 | "version": "5.0.0", 1444 | "dev": true, 1445 | "license": "MIT", 1446 | "engines": { 1447 | "node": ">=8" 1448 | } 1449 | }, 1450 | "../../node_modules/reusify": { 1451 | "version": "1.0.4", 1452 | "dev": true, 1453 | "license": "MIT", 1454 | "engines": { 1455 | "iojs": ">=1.0.0", 1456 | "node": ">=0.10.0" 1457 | } 1458 | }, 1459 | "../../node_modules/rimraf": { 1460 | "version": "3.0.2", 1461 | "dev": true, 1462 | "license": "ISC", 1463 | "dependencies": { 1464 | "glob": "^7.1.3" 1465 | }, 1466 | "bin": { 1467 | "rimraf": "bin.js" 1468 | }, 1469 | "funding": { 1470 | "url": "https://github.com/sponsors/isaacs" 1471 | } 1472 | }, 1473 | "../../node_modules/run-parallel": { 1474 | "version": "1.2.0", 1475 | "dev": true, 1476 | "funding": [ 1477 | { 1478 | "type": "github", 1479 | "url": "https://github.com/sponsors/feross" 1480 | }, 1481 | { 1482 | "type": "patreon", 1483 | "url": "https://www.patreon.com/feross" 1484 | }, 1485 | { 1486 | "type": "consulting", 1487 | "url": "https://feross.org/support" 1488 | } 1489 | ], 1490 | "license": "MIT", 1491 | "dependencies": { 1492 | "queue-microtask": "^1.2.2" 1493 | } 1494 | }, 1495 | "../../node_modules/safe-buffer": { 1496 | "version": "5.2.1", 1497 | "dev": true, 1498 | "funding": [ 1499 | { 1500 | "type": "github", 1501 | "url": "https://github.com/sponsors/feross" 1502 | }, 1503 | { 1504 | "type": "patreon", 1505 | "url": "https://www.patreon.com/feross" 1506 | }, 1507 | { 1508 | "type": "consulting", 1509 | "url": "https://feross.org/support" 1510 | } 1511 | ], 1512 | "license": "MIT" 1513 | }, 1514 | "../../node_modules/semver": { 1515 | "version": "7.6.1", 1516 | "dev": true, 1517 | "license": "ISC", 1518 | "bin": { 1519 | "semver": "bin/semver.js" 1520 | }, 1521 | "engines": { 1522 | "node": ">=10" 1523 | } 1524 | }, 1525 | "../../node_modules/serialize-error": { 1526 | "version": "7.0.1", 1527 | "dev": true, 1528 | "license": "MIT", 1529 | "dependencies": { 1530 | "type-fest": "^0.13.1" 1531 | }, 1532 | "engines": { 1533 | "node": ">=10" 1534 | }, 1535 | "funding": { 1536 | "url": "https://github.com/sponsors/sindresorhus" 1537 | } 1538 | }, 1539 | "../../node_modules/set-blocking": { 1540 | "version": "2.0.0", 1541 | "dev": true, 1542 | "license": "ISC" 1543 | }, 1544 | "../../node_modules/signal-exit": { 1545 | "version": "3.0.7", 1546 | "dev": true, 1547 | "license": "ISC" 1548 | }, 1549 | "../../node_modules/slash": { 1550 | "version": "5.1.0", 1551 | "dev": true, 1552 | "license": "MIT", 1553 | "engines": { 1554 | "node": ">=14.16" 1555 | }, 1556 | "funding": { 1557 | "url": "https://github.com/sponsors/sindresorhus" 1558 | } 1559 | }, 1560 | "../../node_modules/slice-ansi": { 1561 | "version": "5.0.0", 1562 | "dev": true, 1563 | "license": "MIT", 1564 | "dependencies": { 1565 | "ansi-styles": "^6.0.0", 1566 | "is-fullwidth-code-point": "^4.0.0" 1567 | }, 1568 | "engines": { 1569 | "node": ">=12" 1570 | }, 1571 | "funding": { 1572 | "url": "https://github.com/chalk/slice-ansi?sponsor=1" 1573 | } 1574 | }, 1575 | "../../node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { 1576 | "version": "4.0.0", 1577 | "dev": true, 1578 | "license": "MIT", 1579 | "engines": { 1580 | "node": ">=12" 1581 | }, 1582 | "funding": { 1583 | "url": "https://github.com/sponsors/sindresorhus" 1584 | } 1585 | }, 1586 | "../../node_modules/sprintf-js": { 1587 | "version": "1.0.3", 1588 | "dev": true, 1589 | "license": "BSD-3-Clause" 1590 | }, 1591 | "../../node_modules/stack-utils": { 1592 | "version": "2.0.6", 1593 | "dev": true, 1594 | "license": "MIT", 1595 | "dependencies": { 1596 | "escape-string-regexp": "^2.0.0" 1597 | }, 1598 | "engines": { 1599 | "node": ">=10" 1600 | } 1601 | }, 1602 | "../../node_modules/stack-utils/node_modules/escape-string-regexp": { 1603 | "version": "2.0.0", 1604 | "dev": true, 1605 | "license": "MIT", 1606 | "engines": { 1607 | "node": ">=8" 1608 | } 1609 | }, 1610 | "../../node_modules/string_decoder": { 1611 | "version": "1.3.0", 1612 | "dev": true, 1613 | "license": "MIT", 1614 | "dependencies": { 1615 | "safe-buffer": "~5.2.0" 1616 | } 1617 | }, 1618 | "../../node_modules/string-width": { 1619 | "version": "4.2.3", 1620 | "dev": true, 1621 | "license": "MIT", 1622 | "dependencies": { 1623 | "emoji-regex": "^8.0.0", 1624 | "is-fullwidth-code-point": "^3.0.0", 1625 | "strip-ansi": "^6.0.1" 1626 | }, 1627 | "engines": { 1628 | "node": ">=8" 1629 | } 1630 | }, 1631 | "../../node_modules/strip-ansi": { 1632 | "version": "6.0.1", 1633 | "dev": true, 1634 | "license": "MIT", 1635 | "dependencies": { 1636 | "ansi-regex": "^5.0.1" 1637 | }, 1638 | "engines": { 1639 | "node": ">=8" 1640 | } 1641 | }, 1642 | "../../node_modules/supertap": { 1643 | "version": "3.0.1", 1644 | "dev": true, 1645 | "license": "MIT", 1646 | "dependencies": { 1647 | "indent-string": "^5.0.0", 1648 | "js-yaml": "^3.14.1", 1649 | "serialize-error": "^7.0.1", 1650 | "strip-ansi": "^7.0.1" 1651 | }, 1652 | "engines": { 1653 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 1654 | } 1655 | }, 1656 | "../../node_modules/supertap/node_modules/ansi-regex": { 1657 | "version": "6.0.1", 1658 | "dev": true, 1659 | "license": "MIT", 1660 | "engines": { 1661 | "node": ">=12" 1662 | }, 1663 | "funding": { 1664 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 1665 | } 1666 | }, 1667 | "../../node_modules/supertap/node_modules/strip-ansi": { 1668 | "version": "7.1.0", 1669 | "dev": true, 1670 | "license": "MIT", 1671 | "dependencies": { 1672 | "ansi-regex": "^6.0.1" 1673 | }, 1674 | "engines": { 1675 | "node": ">=12" 1676 | }, 1677 | "funding": { 1678 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 1679 | } 1680 | }, 1681 | "../../node_modules/tar": { 1682 | "version": "6.2.1", 1683 | "dev": true, 1684 | "license": "ISC", 1685 | "dependencies": { 1686 | "chownr": "^2.0.0", 1687 | "fs-minipass": "^2.0.0", 1688 | "minipass": "^5.0.0", 1689 | "minizlib": "^2.1.1", 1690 | "mkdirp": "^1.0.3", 1691 | "yallist": "^4.0.0" 1692 | }, 1693 | "engines": { 1694 | "node": ">=10" 1695 | } 1696 | }, 1697 | "../../node_modules/tar/node_modules/minipass": { 1698 | "version": "5.0.0", 1699 | "dev": true, 1700 | "license": "ISC", 1701 | "engines": { 1702 | "node": ">=8" 1703 | } 1704 | }, 1705 | "../../node_modules/temp-dir": { 1706 | "version": "3.0.0", 1707 | "dev": true, 1708 | "license": "MIT", 1709 | "engines": { 1710 | "node": ">=14.16" 1711 | } 1712 | }, 1713 | "../../node_modules/time-zone": { 1714 | "version": "1.0.0", 1715 | "dev": true, 1716 | "license": "MIT", 1717 | "engines": { 1718 | "node": ">=4" 1719 | } 1720 | }, 1721 | "../../node_modules/to-regex-range": { 1722 | "version": "5.0.1", 1723 | "dev": true, 1724 | "license": "MIT", 1725 | "dependencies": { 1726 | "is-number": "^7.0.0" 1727 | }, 1728 | "engines": { 1729 | "node": ">=8.0" 1730 | } 1731 | }, 1732 | "../../node_modules/tr46": { 1733 | "version": "0.0.3", 1734 | "dev": true, 1735 | "license": "MIT" 1736 | }, 1737 | "../../node_modules/type-fest": { 1738 | "version": "0.13.1", 1739 | "dev": true, 1740 | "license": "(MIT OR CC0-1.0)", 1741 | "engines": { 1742 | "node": ">=10" 1743 | }, 1744 | "funding": { 1745 | "url": "https://github.com/sponsors/sindresorhus" 1746 | } 1747 | }, 1748 | "../../node_modules/unicorn-magic": { 1749 | "version": "0.1.0", 1750 | "dev": true, 1751 | "license": "MIT", 1752 | "engines": { 1753 | "node": ">=18" 1754 | }, 1755 | "funding": { 1756 | "url": "https://github.com/sponsors/sindresorhus" 1757 | } 1758 | }, 1759 | "../../node_modules/util-deprecate": { 1760 | "version": "1.0.2", 1761 | "dev": true, 1762 | "license": "MIT" 1763 | }, 1764 | "../../node_modules/webidl-conversions": { 1765 | "version": "3.0.1", 1766 | "dev": true, 1767 | "license": "BSD-2-Clause" 1768 | }, 1769 | "../../node_modules/well-known-symbols": { 1770 | "version": "2.0.0", 1771 | "dev": true, 1772 | "license": "ISC", 1773 | "engines": { 1774 | "node": ">=6" 1775 | } 1776 | }, 1777 | "../../node_modules/whatwg-url": { 1778 | "version": "5.0.0", 1779 | "dev": true, 1780 | "license": "MIT", 1781 | "dependencies": { 1782 | "tr46": "~0.0.3", 1783 | "webidl-conversions": "^3.0.0" 1784 | } 1785 | }, 1786 | "../../node_modules/wide-align": { 1787 | "version": "1.1.5", 1788 | "dev": true, 1789 | "license": "ISC", 1790 | "dependencies": { 1791 | "string-width": "^1.0.2 || 2 || 3 || 4" 1792 | } 1793 | }, 1794 | "../../node_modules/wrap-ansi": { 1795 | "version": "7.0.0", 1796 | "dev": true, 1797 | "license": "MIT", 1798 | "dependencies": { 1799 | "ansi-styles": "^4.0.0", 1800 | "string-width": "^4.1.0", 1801 | "strip-ansi": "^6.0.0" 1802 | }, 1803 | "engines": { 1804 | "node": ">=10" 1805 | }, 1806 | "funding": { 1807 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 1808 | } 1809 | }, 1810 | "../../node_modules/wrap-ansi/node_modules/ansi-styles": { 1811 | "version": "4.3.0", 1812 | "dev": true, 1813 | "license": "MIT", 1814 | "dependencies": { 1815 | "color-convert": "^2.0.1" 1816 | }, 1817 | "engines": { 1818 | "node": ">=8" 1819 | }, 1820 | "funding": { 1821 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 1822 | } 1823 | }, 1824 | "../../node_modules/wrappy": { 1825 | "version": "1.0.2", 1826 | "dev": true, 1827 | "license": "ISC" 1828 | }, 1829 | "../../node_modules/write-file-atomic": { 1830 | "version": "5.0.1", 1831 | "dev": true, 1832 | "license": "ISC", 1833 | "dependencies": { 1834 | "imurmurhash": "^0.1.4", 1835 | "signal-exit": "^4.0.1" 1836 | }, 1837 | "engines": { 1838 | "node": "^14.17.0 || ^16.13.0 || >=18.0.0" 1839 | } 1840 | }, 1841 | "../../node_modules/write-file-atomic/node_modules/signal-exit": { 1842 | "version": "4.1.0", 1843 | "dev": true, 1844 | "license": "ISC", 1845 | "engines": { 1846 | "node": ">=14" 1847 | }, 1848 | "funding": { 1849 | "url": "https://github.com/sponsors/isaacs" 1850 | } 1851 | }, 1852 | "../../node_modules/y18n": { 1853 | "version": "5.0.8", 1854 | "dev": true, 1855 | "license": "ISC", 1856 | "engines": { 1857 | "node": ">=10" 1858 | } 1859 | }, 1860 | "../../node_modules/yallist": { 1861 | "version": "4.0.0", 1862 | "dev": true, 1863 | "license": "ISC" 1864 | }, 1865 | "../../node_modules/yargs": { 1866 | "version": "17.7.2", 1867 | "dev": true, 1868 | "license": "MIT", 1869 | "dependencies": { 1870 | "cliui": "^8.0.1", 1871 | "escalade": "^3.1.1", 1872 | "get-caller-file": "^2.0.5", 1873 | "require-directory": "^2.1.1", 1874 | "string-width": "^4.2.3", 1875 | "y18n": "^5.0.5", 1876 | "yargs-parser": "^21.1.1" 1877 | }, 1878 | "engines": { 1879 | "node": ">=12" 1880 | } 1881 | }, 1882 | "../../node_modules/yargs-parser": { 1883 | "version": "21.1.1", 1884 | "dev": true, 1885 | "license": "ISC", 1886 | "engines": { 1887 | "node": ">=12" 1888 | } 1889 | }, 1890 | "node_modules/.pnpm/@types+node@20.10.4": { 1891 | "extraneous": true 1892 | }, 1893 | "node_modules/.pnpm/typescript@5.3.3": { 1894 | "dev": true 1895 | }, 1896 | "node_modules/.pnpm/typescript@5.3.3/node_modules/typescript": { 1897 | "version": "5.3.3", 1898 | "dev": true, 1899 | "license": "Apache-2.0", 1900 | "bin": { 1901 | "tsc": "bin/tsc", 1902 | "tsserver": "bin/tsserver" 1903 | }, 1904 | "engines": { 1905 | "node": ">=14.17" 1906 | } 1907 | }, 1908 | "node_modules/.pnpm/undici-types@5.26.5/node_modules/undici-types": { 1909 | "version": "5.26.5", 1910 | "extraneous": true, 1911 | "license": "MIT" 1912 | }, 1913 | "node_modules/@types/node": { 1914 | "version": "20.12.11", 1915 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz", 1916 | "integrity": "sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==", 1917 | "dev": true, 1918 | "dependencies": { 1919 | "undici-types": "~5.26.4" 1920 | } 1921 | }, 1922 | "node_modules/hyperfuel-client": { 1923 | "resolved": "../..", 1924 | "link": true 1925 | }, 1926 | "node_modules/typescript": { 1927 | "resolved": "node_modules/.pnpm/typescript@5.3.3/node_modules/typescript", 1928 | "link": true 1929 | }, 1930 | "node_modules/undici-types": { 1931 | "version": "5.26.5", 1932 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 1933 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 1934 | "dev": true 1935 | } 1936 | } 1937 | } 1938 | -------------------------------------------------------------------------------- /examples/asset-id/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-logs", 3 | "version": "0.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/node": "^20.10.3", 14 | "typescript": "^5.3.2" 15 | }, 16 | "dependencies": { 17 | "@envio-dev/hyperfuel-client": "../.." 18 | } 19 | } -------------------------------------------------------------------------------- /examples/asset-id/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | '@envio-dev/hyperfuel-client': 9 | specifier: ../.. 10 | version: link:../.. 11 | 12 | devDependencies: 13 | '@types/node': 14 | specifier: ^20.10.3 15 | version: 20.10.4 16 | typescript: 17 | specifier: ^5.3.2 18 | version: 5.3.3 19 | 20 | packages: 21 | 22 | /@types/node@20.10.4: 23 | resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} 24 | dependencies: 25 | undici-types: 5.26.5 26 | dev: true 27 | 28 | /typescript@5.3.3: 29 | resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} 30 | engines: {node: '>=14.17'} 31 | hasBin: true 32 | dev: true 33 | 34 | /undici-types@5.26.5: 35 | resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} 36 | dev: true 37 | -------------------------------------------------------------------------------- /examples/asset-id/src/app.ts: -------------------------------------------------------------------------------- 1 | import { HyperfuelClient, Query } from "@envio-dev/hyperfuel-client"; 2 | 3 | async function main() { 4 | const client = HyperfuelClient.new({ 5 | url: "https://fuel-testnet.hypersync.xyz" 6 | }); 7 | 8 | const query: Query = { 9 | // start query from block 0 10 | "fromBlock": 0, 11 | // if to_block is not set, query runs to the end of the chain 12 | "toBlock": 1300000, 13 | // which inputs to load data from 14 | "inputs": [ 15 | { 16 | "assetId": ["0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea"] 17 | } 18 | ], 19 | // what data we want returned from the inputs we loaded 20 | "fieldSelection": { 21 | "input": [ 22 | "tx_id", 23 | "block_height", 24 | "input_type", 25 | "utxo_id", 26 | "owner", 27 | "amount", 28 | "asset_id" 29 | ] 30 | } 31 | } 32 | 33 | const res = await client.getSelectedData(query); 34 | 35 | console.log(`inputs: ${JSON.stringify(res.data.inputs)}`); 36 | 37 | } 38 | 39 | main(); 40 | -------------------------------------------------------------------------------- /examples/asset-id/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es2020", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "outDir": "dist" 9 | }, 10 | "lib": ["es2015"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/predicate-root/README.md: -------------------------------------------------------------------------------- 1 | # predicate-root 2 | This example returns `input` field data from an input where the `owner` field matches the predicate root 0x94a8e322ff02baeb1d625e83dadf5ec88870ac801da370d4b15bbd5f0af01169 `owner` is ["The owning address or predicate root."](https://docs.fuel.network/docs/graphql/reference/objects/#inputcoin) of an InputCoin Input type 3 | 4 | Can run `npx tsc && node dist/app.js` to run it. -------------------------------------------------------------------------------- /examples/predicate-root/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "predicate-root", 3 | "version": "0.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/node": "^20.10.3", 14 | "typescript": "^5.3.2" 15 | }, 16 | "dependencies": { 17 | "@envio-dev/hyperfuel-client": "../.." 18 | } 19 | } -------------------------------------------------------------------------------- /examples/predicate-root/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | '@envio-dev/hyperfuel-client': 9 | specifier: ../.. 10 | version: link:../.. 11 | 12 | devDependencies: 13 | '@types/node': 14 | specifier: ^20.10.3 15 | version: 20.10.4 16 | typescript: 17 | specifier: ^5.3.2 18 | version: 5.3.3 19 | 20 | packages: 21 | 22 | /@types/node@20.10.4: 23 | resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} 24 | dependencies: 25 | undici-types: 5.26.5 26 | dev: true 27 | 28 | /typescript@5.3.3: 29 | resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} 30 | engines: {node: '>=14.17'} 31 | hasBin: true 32 | dev: true 33 | 34 | /undici-types@5.26.5: 35 | resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} 36 | dev: true 37 | -------------------------------------------------------------------------------- /examples/predicate-root/src/app.ts: -------------------------------------------------------------------------------- 1 | import { HyperfuelClient, Query } from "@envio-dev/hyperfuel-client"; 2 | 3 | async function main() { 4 | const client = HyperfuelClient.new({ 5 | url: "https://fuel-testnet.hypersync.xyz" 6 | }); 7 | 8 | const query: Query = { 9 | // start query from block 0 10 | "fromBlock": 0, 11 | // if to_block is not set, query runs to the end of the chain 12 | "toBlock": 1427625, 13 | // which inputs to load data from 14 | "inputs": [ 15 | { 16 | "owner": ["0x94a8e322ff02baeb1d625e83dadf5ec88870ac801da370d4b15bbd5f0af01169"] 17 | } 18 | ], 19 | // what data we want returned from the inputs we loaded 20 | "fieldSelection": { 21 | "input": [ 22 | "tx_id", 23 | "block_height", 24 | "input_type", 25 | "utxo_id", 26 | "owner", 27 | "amount", 28 | "asset_id", 29 | "predicate_gas_used", 30 | "predicate", 31 | "predicate_data" 32 | ] 33 | } 34 | } 35 | 36 | const res = await client.getSelectedData(query); 37 | 38 | console.log(`inputs: ${JSON.stringify(res.data.inputs)}`); 39 | 40 | } 41 | 42 | main(); 43 | -------------------------------------------------------------------------------- /examples/predicate-root/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es2020", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "outDir": "dist" 9 | }, 10 | "lib": ["es2015"] 11 | } 12 | -------------------------------------------------------------------------------- /examples/simple-logs/README.md: -------------------------------------------------------------------------------- 1 | # simple-logs 2 | This example will simply fetch the logs from a vector of contracts over a specified block range. 3 | returns all log data necessary for fuel's decoder. 4 | 5 | Can run `npx tsc && node dist/app.js` to run it. -------------------------------------------------------------------------------- /examples/simple-logs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asset-id", 3 | "version": "0.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@types/node": "^20.10.3", 14 | "typescript": "^5.3.2" 15 | }, 16 | "dependencies": { 17 | "@envio-dev/hyperfuel-client": "../.." 18 | } 19 | } -------------------------------------------------------------------------------- /examples/simple-logs/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | '@envio-dev/hyperfuel-client': 9 | specifier: ../.. 10 | version: link:../.. 11 | 12 | devDependencies: 13 | '@types/node': 14 | specifier: ^20.10.3 15 | version: 20.10.4 16 | typescript: 17 | specifier: ^5.3.2 18 | version: 5.3.3 19 | 20 | packages: 21 | 22 | /@types/node@20.10.4: 23 | resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} 24 | dependencies: 25 | undici-types: 5.26.5 26 | dev: true 27 | 28 | /typescript@5.3.3: 29 | resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} 30 | engines: {node: '>=14.17'} 31 | hasBin: true 32 | dev: true 33 | 34 | /undici-types@5.26.5: 35 | resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} 36 | dev: true 37 | -------------------------------------------------------------------------------- /examples/simple-logs/src/app.ts: -------------------------------------------------------------------------------- 1 | import { HyperfuelClient } from "@envio-dev/hyperfuel-client"; 2 | 3 | async function main() { 4 | const client = HyperfuelClient.new({ 5 | url: "https://fuel-testnet.hypersync.xyz" 6 | }); 7 | 8 | // contract(s) we want logs from 9 | const contracts = ["0x4a2ce054e3e94155f7092f7365b212f7f45105b74819c623744ebcc5d065c6ac"] 10 | 11 | // get logs from blocks 0(inclusive) to 1627509(exclusive) 12 | const logs = await client.presetQueryGetLogs(contracts, 0, 1627509); 13 | 14 | console.log(`number of logs: ${logs.data.length}`); 15 | console.log(`logs: ${JSON.stringify(logs.data)}`); 16 | 17 | } 18 | 19 | main(); 20 | 21 | -------------------------------------------------------------------------------- /examples/simple-logs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es2020", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "outDir": "dist" 9 | }, 10 | "lib": ["es2015"] 11 | } 12 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | 4 | /* auto-generated by NAPI-RS */ 5 | 6 | export interface Config { 7 | /** Url of the source hypersync instance */ 8 | url: string 9 | /** Optional bearer_token to put into http requests made to source hypersync instance */ 10 | bearerToken?: string 11 | /** Timout treshold for a single http request in milliseconds, default is 30 seconds (30_000ms) */ 12 | httpReqTimeoutMillis?: number 13 | } 14 | export interface ReceiptSelection { 15 | rootContractId?: Array 16 | toAddress?: Array 17 | assetId?: Array 18 | receiptType?: Array 19 | sender?: Array 20 | recipient?: Array 21 | contractId?: Array 22 | ra?: Array 23 | rb?: Array 24 | rc?: Array 25 | rd?: Array 26 | txStatus?: Array 27 | txType?: Array 28 | } 29 | export interface InputSelection { 30 | owner?: Array 31 | assetId?: Array 32 | contract?: Array 33 | sender?: Array 34 | recipient?: Array 35 | inputType?: Array 36 | txStatus?: Array 37 | txType?: Array 38 | } 39 | export interface OutputSelection { 40 | to?: Array 41 | assetId?: Array 42 | contract?: Array 43 | outputType?: Array 44 | txStatus?: Array 45 | txType?: Array 46 | } 47 | export interface FieldSelection { 48 | block?: Array 49 | transaction?: Array 50 | receipt?: Array 51 | input?: Array 52 | output?: Array 53 | } 54 | export interface Query { 55 | /** The block to start the query from */ 56 | fromBlock: number 57 | /** 58 | * The block to end the query at. If not specified, the query will go until the 59 | * end of data. Exclusive, the returned range will be [from_block..to_block). 60 | * 61 | * The query will return before it reaches this target block if it hits the time limit 62 | * configured on the server. The user should continue their query by putting the 63 | * next_block field in the response into from_block field of their next query. This implements 64 | * pagination. 65 | */ 66 | toBlock?: number 67 | /** 68 | * List of receipt selections, the query will return receipts that match any of these selections and 69 | * it will return receipts that are related to the returned objects. 70 | */ 71 | receipts?: Array 72 | /** 73 | * List of input selections, the query will return inputs that match any of these selections and 74 | * it will return inputs that are related to the returned objects. 75 | */ 76 | inputs?: Array 77 | /** 78 | * List of output selections, the query will return outputs that match any of these selections and 79 | * it will return outputs that are related to the returned objects. 80 | */ 81 | outputs?: Array 82 | /** 83 | * Whether to include all blocks regardless of if they are related to a returned transaction or log. Normally 84 | * the server will return only the blocks that are related to the transaction or logs in the response. But if this 85 | * is set to true, the server will return data for all blocks in the requested range [from_block, to_block). 86 | */ 87 | includeAllBlocks?: boolean 88 | /** 89 | * Field selection. The user can select which fields they are interested in, requesting less fields will improve 90 | * query execution time and reduce the payload size so the user should always use a minimal number of fields. 91 | */ 92 | fieldSelection: FieldSelection 93 | /** 94 | * Maximum number of blocks that should be returned, the server might return more blocks than this number but 95 | * it won't overshoot by too much. 96 | */ 97 | maxNumBlocks?: number 98 | /** 99 | * Maximum number of transactions that should be returned, the server might return more transactions than this number but 100 | * it won't overshoot by too much. 101 | */ 102 | maxNumTransactions?: number 103 | } 104 | export interface QueryResponseTyped { 105 | /** Current height of the source hypersync instance */ 106 | archiveHeight?: number 107 | /** 108 | * Next block to query for, the responses are paginated so 109 | * the caller should continue the query from this block if they 110 | * didn't get responses up to the to_block they specified in the Query. 111 | */ 112 | nextBlock: number 113 | /** Total time it took the hypersync instance to execute the query. */ 114 | totalExecutionTime: number 115 | /** Response data */ 116 | data: QueryResponseDataTyped 117 | } 118 | export interface QueryResponseDataTyped { 119 | blocks: Array 120 | transactions: Array 121 | receipts: Array 122 | inputs: Array 123 | outputs: Array 124 | } 125 | export interface LogResponse { 126 | /** Current height of the source hypersync instance */ 127 | archiveHeight?: number 128 | /** 129 | * Next block to query for, the responses are paginated so 130 | * the caller should continue the query from this block if they 131 | * didn't get responses up to the to_block they specified in the Query. 132 | */ 133 | nextBlock: number 134 | /** Total time it took the hypersync instance to execute the query. */ 135 | totalExecutionTime: number 136 | /** Response data */ 137 | data: Array 138 | } 139 | /** 140 | * Contains all the fields needed for decoding plus some additional fields 141 | * for context. 142 | */ 143 | export interface LogContext { 144 | blockHeight: number 145 | txId: string 146 | receiptIndex: number 147 | receiptType: number 148 | contractId?: string 149 | rootContractId?: string 150 | ra?: number 151 | rb?: number 152 | rc?: number 153 | rd?: number 154 | pc?: number 155 | is?: number 156 | ptr?: number 157 | len?: number 158 | digest?: string 159 | data?: string 160 | } 161 | /** The block header contains metadata about a certain block. */ 162 | export interface Block { 163 | /** String of the header */ 164 | id: string 165 | /** The block height for the data availability layer up to which (inclusive) input messages are processed. */ 166 | daHeight: number 167 | consensusParametersVersion: number 168 | stateTransitionBytecodeVersion: number 169 | /** The number of transactions in the block. */ 170 | transactionsCount: string 171 | /** The number of receipt messages in the block. */ 172 | messageReceiptCount: string 173 | /** The merkle root of the transactions in the block. */ 174 | transactionsRoot: string 175 | messageOutboxRoot: string 176 | eventInboxRoot: string 177 | /** The block height. */ 178 | height: number 179 | /** The merkle root of all previous consensus header Stringes (not including this block). */ 180 | prevRoot: string 181 | /** The timestamp for the block. */ 182 | time: number 183 | /** The String of the serialized application header for this block. */ 184 | applicationHash: string 185 | } 186 | /** An object containing information about a transaction. */ 187 | export interface Transaction { 188 | /** block the transaction is in. */ 189 | blockHeight: number 190 | /** A unique transaction id. */ 191 | id: string 192 | /** An array of asset ids used for the transaction inputs. */ 193 | inputAssetIds?: Array 194 | /** An array of contracts used for the transaction inputs. */ 195 | inputContracts?: Array 196 | /** 197 | * A contract used for the transaction input. 198 | * A unique 32 byte identifier for the UTXO for a contract used for the transaction input. 199 | */ 200 | inputContractUtxoId?: string 201 | /** The root of amount of coins owned by contract before transaction execution for a contract used for the transaction input. */ 202 | inputContractBalanceRoot?: string 203 | /** The state root of contract before transaction execution for a contract used for the transaction input. */ 204 | inputContractStateRoot?: string 205 | /** A pointer to the TX whose output is being spent for a contract used for the transaction input. */ 206 | inputContractTxPointerBlockHeight?: number 207 | /** A pointer to the TX whose output is being spent for a contract used for the transaction input. */ 208 | inputContractTxPointerTxIndex?: number 209 | /** The contract id for a contract used for the transaction input. */ 210 | inputContract?: string 211 | policiesTip?: number 212 | policiesWitnessLimit?: number 213 | policiesMaturity?: number 214 | policiesMaxFee?: number 215 | scriptGasLimit?: number 216 | /** The minimum block height that the transaction can be included at. */ 217 | maturity?: number 218 | /** The amount minted in the transaction. */ 219 | mintAmount?: number 220 | /** The asset ID for coins minted in the transaction. */ 221 | mintAssetId?: string 222 | mintGasPrice?: number 223 | /** The location of the transaction in the block. */ 224 | txPointerBlockHeight?: number 225 | txPointerTxIndex?: number 226 | /** Script, creating a new contract, or minting new coins */ 227 | txType: number 228 | /** The index of the input from a transaction that changed the state of a contract. */ 229 | outputContractInputIndex?: number 230 | /** The root of amount of coins owned by contract after transaction execution from a transaction that changed the state of a contract. */ 231 | outputContractBalanceRoot?: string 232 | /** The state root of contract after transaction execution from a transaction that changed the state of a contract. */ 233 | outputContractStateRoot?: string 234 | /** An array of witnesses. */ 235 | witnesses?: string 236 | /** The root of the receipts. */ 237 | receiptsRoot?: string 238 | /** The status type of the transaction. */ 239 | status: number 240 | /** for SubmittedStatus, SuccessStatus, and FailureStatus, the time a transaction was submitted, successful, or failed */ 241 | time: number 242 | /** 243 | * for SuccessStatus, the state of the program execution 244 | * for SqueezedOutStatus & FailureStatus, the reason the transaction was squeezed out or failed 245 | */ 246 | reason?: string 247 | /** The script to execute. */ 248 | script?: string 249 | /** The script input parameters. */ 250 | scriptData?: string 251 | /** The witness index of contract bytecode. */ 252 | bytecodeWitnessIndex?: number 253 | bytecodeRoot?: string 254 | subsectionIndex?: number 255 | subsectionsNumber?: number 256 | proofSet?: string 257 | consensusParametersUpgradePurposeWitnessIndex?: number 258 | consensusParametersUpgradePurposeChecksum?: string 259 | stateTransitionUpgradePurposeRoot?: string 260 | /** The salt value for the transaction. */ 261 | salt?: string 262 | } 263 | /** An object representing all possible types of receipts. */ 264 | export interface Receipt { 265 | /** Index of the receipt in the block */ 266 | receiptIndex: number 267 | /** Contract that produced the receipt */ 268 | rootContractId?: string 269 | /** transaction that this receipt originated from */ 270 | txId: string 271 | /** The status type of the transaction this receipt originated from */ 272 | txStatus: number 273 | /** The type of the transaction this receipt originated from */ 274 | txType: number 275 | /** block that the receipt originated in */ 276 | blockHeight: number 277 | /** The value of the program counter register $pc, which is the memory address of the current instruction. */ 278 | pc?: string 279 | /** The value of register $is, which is the pointer to the start of the currently-executing code. */ 280 | is?: string 281 | /** The recipient contract */ 282 | to?: string 283 | /** The recipient address */ 284 | toAddress?: string 285 | /** The amount of coins transferred. */ 286 | amount?: bigint 287 | /** The asset id of the coins transferred. */ 288 | assetId?: string 289 | /** The gas used for the transaction. */ 290 | gas?: number 291 | /** The first parameter for a CALL receipt type, holds the function selector. */ 292 | param1?: bigint 293 | /** The second parameter for a CALL receipt type, typically used for the user-specified input to the ABI function being selected. */ 294 | param2?: bigint 295 | /** The value of registers at the end of execution, used for debugging. */ 296 | val?: bigint 297 | /** The value of the pointer register, used for debugging. */ 298 | ptr?: bigint 299 | /** A 32-byte String of MEM[$rC, $rD]. The syntax MEM[x, y] means the memory range starting at byte x, of length y bytes. */ 300 | digest?: string 301 | /** The decimal string representation of an 8-bit unsigned integer for the panic reason. Only returned if the receipt type is PANIC. */ 302 | reason?: number 303 | /** The value of register $rA. */ 304 | ra?: bigint 305 | /** The value of register $rB. */ 306 | rb?: bigint 307 | /** The value of register $rC. */ 308 | rc?: bigint 309 | /** The value of register $rD. */ 310 | rd?: bigint 311 | /** The length of the receipt. */ 312 | len?: bigint 313 | /** The type of receipt. */ 314 | receiptType: number 315 | /** 0 if script exited successfully, any otherwise. */ 316 | result?: number 317 | /** The amount of gas consumed by the script. */ 318 | gasUsed?: number 319 | /** The receipt data. */ 320 | data?: string 321 | /** The address of the message sender. */ 322 | sender?: string 323 | /** The address of the message recipient. */ 324 | recipient?: string 325 | /** The nonce value for a message. */ 326 | nonce?: string 327 | /** Current context if in an internal context. null otherwise */ 328 | contractId?: string 329 | /** The sub id. */ 330 | subId?: string 331 | } 332 | /** An object representing all possible types of inputs. InputCoin, InputContract, InputMessage */ 333 | export interface Input { 334 | /** transaction that this input originated from */ 335 | txId: string 336 | /** The status type of the transaction this input originated from */ 337 | txStatus: number 338 | /** The type of the transaction this input originated from */ 339 | txType: number 340 | /** block that the input originated in */ 341 | blockHeight: number 342 | /** InputCoin, InputContract, or InputMessage */ 343 | inputType: number 344 | /** A unique 32 byte identifier for the UTXO. */ 345 | utxoId?: string 346 | /** The owning address or predicate root. */ 347 | owner?: string 348 | /** 349 | * for InputCoin type: The amount of coins. 350 | * for InputMessage type: The amount sent in the message. 351 | */ 352 | amount?: bigint 353 | /** The asset ID of the coins. */ 354 | assetId?: string 355 | /** A pointer to the transaction whose output is being spent. */ 356 | txPointerBlockHeight?: number 357 | txPointerTxIndex?: number 358 | /** The index of the witness that authorizes spending the coin. */ 359 | witnessIndex?: number 360 | /** The amount of gas used in the predicate transaction. */ 361 | predicateGasUsed?: number 362 | /** The predicate bytecode. */ 363 | predicate?: string 364 | /** The predicate input parameters. */ 365 | predicateData?: string 366 | /** The root of amount of coins owned by contract before transaction execution. */ 367 | balanceRoot?: string 368 | /** The state root of contract before transaction execution. */ 369 | stateRoot?: string 370 | /** The input contract. */ 371 | contract?: string 372 | /** The sender address of the message. */ 373 | sender?: string 374 | /** The recipient address of the message. */ 375 | recipient?: string 376 | /** A nonce value for the message input, which is determined by the sending system and is published at the time the message is sent. */ 377 | nonce?: string 378 | /** The message data. */ 379 | data?: string 380 | } 381 | /** An object representing all possible types of Outputs. CoinOutput, ContractOutput, ChangeOutput, VariableOutput, ContractCreated */ 382 | export interface Output { 383 | /** transaction that this out originated from */ 384 | txId: string 385 | /** The status type of the transaction this output originated from */ 386 | txStatus: number 387 | /** The type of the transaction this output originated from */ 388 | txType: number 389 | /** block that the output originated in */ 390 | blockHeight: number 391 | /** CoinOutput, ContractOutput, ChangeOutput, VariableOutput, or ContractCreated */ 392 | outputType: number 393 | /** The address the coins were sent to. */ 394 | to?: string 395 | /** The amount of coins in the output. */ 396 | amount?: bigint 397 | /** The asset id for the coins sent. */ 398 | assetId?: string 399 | /** The index of the input. */ 400 | inputIndex?: number 401 | /** The root of amount of coins owned by contract after transaction execution. */ 402 | balanceRoot?: string 403 | /** 404 | * for ContractedCreated type: The initial state root of contract. 405 | * for ContractOutput type: The state root of contract after transaction execution. 406 | */ 407 | stateRoot?: string 408 | /** for ContractCreated type: The contract that was created. */ 409 | contract?: string 410 | } 411 | export class HyperfuelClient { 412 | /** Create a new client with given config */ 413 | static new(cfg: Config): HyperfuelClient 414 | /** Get the height of the source hyperfuel instance */ 415 | getHeight(): Promise 416 | /** 417 | * Get the height of the source hyperfuel instance 418 | * Internally calls get_height. 419 | * On an error from the source hyperfuel instance, sleeps for 420 | * 1 second (increasing by 1 each failure up to max of 5 seconds) 421 | * and retries query until success. 422 | */ 423 | getHeightWithRetry(): Promise 424 | /** 425 | * Create a parquet file by executing a query. 426 | * 427 | * Path should point to a folder that will contain the parquet files in the end. 428 | */ 429 | createParquetFolder(query: Query, path: string): Promise 430 | /** 431 | * Send a query request to the source hyperfuel instance. 432 | * 433 | * Returns a query response which contains typed data. 434 | * 435 | * NOTE: this query returns loads all transactions that your match your receipt, input, or output selections 436 | * and applies the field selection to all these loaded transactions. So your query will return the data you 437 | * want plus additional data from the loaded transactions. This functionality is in case you want to associate 438 | * receipts, inputs, or outputs with eachother. 439 | */ 440 | getData(query: Query): Promise 441 | /** 442 | * Send a query request to the source hyperfuel instance. 443 | * 444 | * Returns a query response that which contains structured data that doesn't include any inputs, outputs, 445 | * and receipts that don't exactly match the query's input, outout, or receipt selection. 446 | */ 447 | getSelectedData(query: Query): Promise 448 | /** 449 | * Send a query request to the source hyperfuel instance. 450 | * 451 | * Returns all log and logdata receipts of logs emitted by any of the specified contracts 452 | * within the block range. 453 | * If no 'to_block' is specified, query will run to the head of the chain. 454 | * Returned data contains all the data needed to decode Fuel Log or LogData 455 | * receipts as well as some extra data for context. This query doesn't return any logs that 456 | * were a part of a failed transaction. 457 | * 458 | * NOTE: this function is experimental and might be removed in future versions. 459 | */ 460 | presetQueryGetLogs(emittingContracts: Array, fromBlock: number, toBlock?: number | undefined | null): Promise 461 | } 462 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | /* prettier-ignore */ 4 | 5 | /* auto-generated by NAPI-RS */ 6 | 7 | const { existsSync, readFileSync } = require('fs') 8 | const { join } = require('path') 9 | 10 | const { platform, arch } = process 11 | 12 | let nativeBinding = null 13 | let localFileExisted = false 14 | let loadError = null 15 | 16 | function isMusl() { 17 | // For Node 10 18 | if (!process.report || typeof process.report.getReport !== 'function') { 19 | try { 20 | const lddPath = require('child_process').execSync('which ldd').toString().trim() 21 | return readFileSync(lddPath, 'utf8').includes('musl') 22 | } catch (e) { 23 | return true 24 | } 25 | } else { 26 | const { glibcVersionRuntime } = process.report.getReport().header 27 | return !glibcVersionRuntime 28 | } 29 | } 30 | 31 | switch (platform) { 32 | case 'android': 33 | switch (arch) { 34 | case 'arm64': 35 | localFileExisted = existsSync(join(__dirname, 'hyperfuel-client.android-arm64.node')) 36 | try { 37 | if (localFileExisted) { 38 | nativeBinding = require('./hyperfuel-client.android-arm64.node') 39 | } else { 40 | nativeBinding = require('@envio-dev/hyperfuel-client-android-arm64') 41 | } 42 | } catch (e) { 43 | loadError = e 44 | } 45 | break 46 | case 'arm': 47 | localFileExisted = existsSync(join(__dirname, 'hyperfuel-client.android-arm-eabi.node')) 48 | try { 49 | if (localFileExisted) { 50 | nativeBinding = require('./hyperfuel-client.android-arm-eabi.node') 51 | } else { 52 | nativeBinding = require('@envio-dev/hyperfuel-client-android-arm-eabi') 53 | } 54 | } catch (e) { 55 | loadError = e 56 | } 57 | break 58 | default: 59 | throw new Error(`Unsupported architecture on Android ${arch}`) 60 | } 61 | break 62 | case 'win32': 63 | switch (arch) { 64 | case 'x64': 65 | localFileExisted = existsSync( 66 | join(__dirname, 'hyperfuel-client.win32-x64-msvc.node') 67 | ) 68 | try { 69 | if (localFileExisted) { 70 | nativeBinding = require('./hyperfuel-client.win32-x64-msvc.node') 71 | } else { 72 | nativeBinding = require('@envio-dev/hyperfuel-client-win32-x64-msvc') 73 | } 74 | } catch (e) { 75 | loadError = e 76 | } 77 | break 78 | case 'ia32': 79 | localFileExisted = existsSync( 80 | join(__dirname, 'hyperfuel-client.win32-ia32-msvc.node') 81 | ) 82 | try { 83 | if (localFileExisted) { 84 | nativeBinding = require('./hyperfuel-client.win32-ia32-msvc.node') 85 | } else { 86 | nativeBinding = require('@envio-dev/hyperfuel-client-win32-ia32-msvc') 87 | } 88 | } catch (e) { 89 | loadError = e 90 | } 91 | break 92 | case 'arm64': 93 | localFileExisted = existsSync( 94 | join(__dirname, 'hyperfuel-client.win32-arm64-msvc.node') 95 | ) 96 | try { 97 | if (localFileExisted) { 98 | nativeBinding = require('./hyperfuel-client.win32-arm64-msvc.node') 99 | } else { 100 | nativeBinding = require('@envio-dev/hyperfuel-client-win32-arm64-msvc') 101 | } 102 | } catch (e) { 103 | loadError = e 104 | } 105 | break 106 | default: 107 | throw new Error(`Unsupported architecture on Windows: ${arch}`) 108 | } 109 | break 110 | case 'darwin': 111 | localFileExisted = existsSync(join(__dirname, 'hyperfuel-client.darwin-universal.node')) 112 | try { 113 | if (localFileExisted) { 114 | nativeBinding = require('./hyperfuel-client.darwin-universal.node') 115 | } else { 116 | nativeBinding = require('@envio-dev/hyperfuel-client-darwin-universal') 117 | } 118 | break 119 | } catch {} 120 | switch (arch) { 121 | case 'x64': 122 | localFileExisted = existsSync(join(__dirname, 'hyperfuel-client.darwin-x64.node')) 123 | try { 124 | if (localFileExisted) { 125 | nativeBinding = require('./hyperfuel-client.darwin-x64.node') 126 | } else { 127 | nativeBinding = require('@envio-dev/hyperfuel-client-darwin-x64') 128 | } 129 | } catch (e) { 130 | loadError = e 131 | } 132 | break 133 | case 'arm64': 134 | localFileExisted = existsSync( 135 | join(__dirname, 'hyperfuel-client.darwin-arm64.node') 136 | ) 137 | try { 138 | if (localFileExisted) { 139 | nativeBinding = require('./hyperfuel-client.darwin-arm64.node') 140 | } else { 141 | nativeBinding = require('@envio-dev/hyperfuel-client-darwin-arm64') 142 | } 143 | } catch (e) { 144 | loadError = e 145 | } 146 | break 147 | default: 148 | throw new Error(`Unsupported architecture on macOS: ${arch}`) 149 | } 150 | break 151 | case 'freebsd': 152 | if (arch !== 'x64') { 153 | throw new Error(`Unsupported architecture on FreeBSD: ${arch}`) 154 | } 155 | localFileExisted = existsSync(join(__dirname, 'hyperfuel-client.freebsd-x64.node')) 156 | try { 157 | if (localFileExisted) { 158 | nativeBinding = require('./hyperfuel-client.freebsd-x64.node') 159 | } else { 160 | nativeBinding = require('@envio-dev/hyperfuel-client-freebsd-x64') 161 | } 162 | } catch (e) { 163 | loadError = e 164 | } 165 | break 166 | case 'linux': 167 | switch (arch) { 168 | case 'x64': 169 | if (isMusl()) { 170 | localFileExisted = existsSync( 171 | join(__dirname, 'hyperfuel-client.linux-x64-musl.node') 172 | ) 173 | try { 174 | if (localFileExisted) { 175 | nativeBinding = require('./hyperfuel-client.linux-x64-musl.node') 176 | } else { 177 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-x64-musl') 178 | } 179 | } catch (e) { 180 | loadError = e 181 | } 182 | } else { 183 | localFileExisted = existsSync( 184 | join(__dirname, 'hyperfuel-client.linux-x64-gnu.node') 185 | ) 186 | try { 187 | if (localFileExisted) { 188 | nativeBinding = require('./hyperfuel-client.linux-x64-gnu.node') 189 | } else { 190 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-x64-gnu') 191 | } 192 | } catch (e) { 193 | loadError = e 194 | } 195 | } 196 | break 197 | case 'arm64': 198 | if (isMusl()) { 199 | localFileExisted = existsSync( 200 | join(__dirname, 'hyperfuel-client.linux-arm64-musl.node') 201 | ) 202 | try { 203 | if (localFileExisted) { 204 | nativeBinding = require('./hyperfuel-client.linux-arm64-musl.node') 205 | } else { 206 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-arm64-musl') 207 | } 208 | } catch (e) { 209 | loadError = e 210 | } 211 | } else { 212 | localFileExisted = existsSync( 213 | join(__dirname, 'hyperfuel-client.linux-arm64-gnu.node') 214 | ) 215 | try { 216 | if (localFileExisted) { 217 | nativeBinding = require('./hyperfuel-client.linux-arm64-gnu.node') 218 | } else { 219 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-arm64-gnu') 220 | } 221 | } catch (e) { 222 | loadError = e 223 | } 224 | } 225 | break 226 | case 'arm': 227 | if (isMusl()) { 228 | localFileExisted = existsSync( 229 | join(__dirname, 'hyperfuel-client.linux-arm-musleabihf.node') 230 | ) 231 | try { 232 | if (localFileExisted) { 233 | nativeBinding = require('./hyperfuel-client.linux-arm-musleabihf.node') 234 | } else { 235 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-arm-musleabihf') 236 | } 237 | } catch (e) { 238 | loadError = e 239 | } 240 | } else { 241 | localFileExisted = existsSync( 242 | join(__dirname, 'hyperfuel-client.linux-arm-gnueabihf.node') 243 | ) 244 | try { 245 | if (localFileExisted) { 246 | nativeBinding = require('./hyperfuel-client.linux-arm-gnueabihf.node') 247 | } else { 248 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-arm-gnueabihf') 249 | } 250 | } catch (e) { 251 | loadError = e 252 | } 253 | } 254 | break 255 | case 'riscv64': 256 | if (isMusl()) { 257 | localFileExisted = existsSync( 258 | join(__dirname, 'hyperfuel-client.linux-riscv64-musl.node') 259 | ) 260 | try { 261 | if (localFileExisted) { 262 | nativeBinding = require('./hyperfuel-client.linux-riscv64-musl.node') 263 | } else { 264 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-riscv64-musl') 265 | } 266 | } catch (e) { 267 | loadError = e 268 | } 269 | } else { 270 | localFileExisted = existsSync( 271 | join(__dirname, 'hyperfuel-client.linux-riscv64-gnu.node') 272 | ) 273 | try { 274 | if (localFileExisted) { 275 | nativeBinding = require('./hyperfuel-client.linux-riscv64-gnu.node') 276 | } else { 277 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-riscv64-gnu') 278 | } 279 | } catch (e) { 280 | loadError = e 281 | } 282 | } 283 | break 284 | case 's390x': 285 | localFileExisted = existsSync( 286 | join(__dirname, 'hyperfuel-client.linux-s390x-gnu.node') 287 | ) 288 | try { 289 | if (localFileExisted) { 290 | nativeBinding = require('./hyperfuel-client.linux-s390x-gnu.node') 291 | } else { 292 | nativeBinding = require('@envio-dev/hyperfuel-client-linux-s390x-gnu') 293 | } 294 | } catch (e) { 295 | loadError = e 296 | } 297 | break 298 | default: 299 | throw new Error(`Unsupported architecture on Linux: ${arch}`) 300 | } 301 | break 302 | default: 303 | throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`) 304 | } 305 | 306 | if (!nativeBinding) { 307 | if (loadError) { 308 | throw loadError 309 | } 310 | throw new Error(`Failed to load native binding`) 311 | } 312 | 313 | const { HyperfuelClient } = nativeBinding 314 | 315 | module.exports.HyperfuelClient = HyperfuelClient 316 | -------------------------------------------------------------------------------- /npm/darwin-arm64/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-darwin-arm64` 2 | 3 | This is the **aarch64-apple-darwin** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/darwin-arm64/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-darwin-arm64", 3 | "version": "0.0.9", 4 | "os": [ 5 | "darwin" 6 | ], 7 | "cpu": [ 8 | "arm64" 9 | ], 10 | "main": "hyperfuel-client.darwin-arm64.node", 11 | "files": [ 12 | "hyperfuel-client.darwin-arm64.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | } 18 | } -------------------------------------------------------------------------------- /npm/darwin-x64/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-darwin-x64` 2 | 3 | This is the **x86_64-apple-darwin** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/darwin-x64/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-darwin-x64", 3 | "version": "0.0.9", 4 | "os": [ 5 | "darwin" 6 | ], 7 | "cpu": [ 8 | "x64" 9 | ], 10 | "main": "hyperfuel-client.darwin-x64.node", 11 | "files": [ 12 | "hyperfuel-client.darwin-x64.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | } 18 | } -------------------------------------------------------------------------------- /npm/linux-arm64-gnu/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-linux-arm64-gnu` 2 | 3 | This is the **aarch64-unknown-linux-gnu** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/linux-arm64-gnu/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-linux-arm64-gnu", 3 | "version": "0.0.9", 4 | "os": [ 5 | "linux" 6 | ], 7 | "cpu": [ 8 | "arm64" 9 | ], 10 | "main": "hyperfuel-client.linux-arm64-gnu.node", 11 | "files": [ 12 | "hyperfuel-client.linux-arm64-gnu.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | }, 18 | "libc": [ 19 | "glibc" 20 | ] 21 | } -------------------------------------------------------------------------------- /npm/linux-x64-gnu/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-linux-x64-gnu` 2 | 3 | This is the **x86_64-unknown-linux-gnu** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/linux-x64-gnu/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-linux-x64-gnu", 3 | "version": "0.0.9", 4 | "os": [ 5 | "linux" 6 | ], 7 | "cpu": [ 8 | "x64" 9 | ], 10 | "main": "hyperfuel-client.linux-x64-gnu.node", 11 | "files": [ 12 | "hyperfuel-client.linux-x64-gnu.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | }, 18 | "libc": [ 19 | "glibc" 20 | ] 21 | } -------------------------------------------------------------------------------- /npm/linux-x64-musl/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-linux-x64-musl` 2 | 3 | This is the **x86_64-unknown-linux-musl** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/linux-x64-musl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-linux-x64-musl", 3 | "version": "0.0.9", 4 | "os": [ 5 | "linux" 6 | ], 7 | "cpu": [ 8 | "x64" 9 | ], 10 | "main": "hyperfuel-client.linux-x64-musl.node", 11 | "files": [ 12 | "hyperfuel-client.linux-x64-musl.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | }, 18 | "libc": [ 19 | "musl" 20 | ] 21 | } -------------------------------------------------------------------------------- /npm/win32-x64-msvc/README.md: -------------------------------------------------------------------------------- 1 | # `hyperfuel-client-win32-x64-msvc` 2 | 3 | This is the **x86_64-pc-windows-msvc** binary for `hyperfuel-client` 4 | -------------------------------------------------------------------------------- /npm/win32-x64-msvc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client-win32-x64-msvc", 3 | "version": "0.0.9", 4 | "os": [ 5 | "win32" 6 | ], 7 | "cpu": [ 8 | "x64" 9 | ], 10 | "main": "hyperfuel-client.win32-x64-msvc.node", 11 | "files": [ 12 | "hyperfuel-client.win32-x64-msvc.node" 13 | ], 14 | "license": "MIT", 15 | "engines": { 16 | "node": ">= 10" 17 | } 18 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@envio-dev/hyperfuel-client", 3 | "version": "1.2.2", 4 | "main": "index.js", 5 | "types": "index.d.ts", 6 | "napi": { 7 | "name": "hyperfuel-client", 8 | "triples": { 9 | "additional": [ 10 | "aarch64-apple-darwin", 11 | "aarch64-unknown-linux-gnu", 12 | "x86_64-unknown-linux-musl" 13 | ] 14 | } 15 | }, 16 | "license": "MIT", 17 | "devDependencies": { 18 | "@napi-rs/cli": "^2.18.3", 19 | "ava": "^6.0.1" 20 | }, 21 | "ava": { 22 | "timeout": "3m" 23 | }, 24 | "engines": { 25 | "node": ">= 10" 26 | }, 27 | "scripts": { 28 | "artifacts": "napi artifacts", 29 | "build": "napi build --platform --release", 30 | "build:debug": "napi build --platform", 31 | "prepublishOnly": "napi prepublish -t npm", 32 | "test": "ava", 33 | "universal": "napi universal", 34 | "version": "napi version" 35 | }, 36 | "packageManager": "yarn@4.2.1" 37 | } -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | tab_spaces = 4 2 | edition = "2021" 3 | -------------------------------------------------------------------------------- /src/config.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use serde::Serialize; 3 | 4 | #[napi(object)] 5 | #[derive(Default, Clone, Serialize)] 6 | pub struct Config { 7 | /// Url of the source hypersync instance 8 | pub url: String, 9 | /// Optional bearer_token to put into http requests made to source hypersync instance 10 | #[serde(skip_serializing_if = "Option::is_none")] 11 | pub bearer_token: Option, 12 | /// Timout treshold for a single http request in milliseconds, default is 30 seconds (30_000ms) 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub http_req_timeout_millis: Option, 15 | } 16 | 17 | impl Config { 18 | pub fn try_convert(&self) -> Result { 19 | let json = serde_json::to_vec(self).context("serialize to json")?; 20 | serde_json::from_slice(&json).context("parse json") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{anyhow, Context, Result}; 2 | 3 | mod config; 4 | mod query; 5 | mod response; 6 | mod types; 7 | 8 | use config::Config; 9 | use query::Query; 10 | use response::{LogResponse, QueryResponseTyped}; 11 | 12 | #[macro_use] 13 | extern crate napi_derive; 14 | 15 | #[napi] 16 | pub struct HyperfuelClient { 17 | inner: hyperfuel_client::Client, 18 | } 19 | 20 | #[napi] 21 | impl HyperfuelClient { 22 | /// Create a new client with given config 23 | #[napi] 24 | pub fn new(cfg: Config) -> napi::Result { 25 | env_logger::try_init().ok(); 26 | 27 | Self::new_impl(cfg).map_err(|e| napi::Error::from_reason(format!("{:?}", e))) 28 | } 29 | 30 | fn new_impl(cfg: Config) -> Result { 31 | let cfg = cfg.try_convert().context("parse config")?; 32 | 33 | let inner = hyperfuel_client::Client::new(cfg).context("build client")?; 34 | 35 | Ok(HyperfuelClient { inner }) 36 | } 37 | 38 | /// Get the height of the source hyperfuel instance 39 | #[napi] 40 | pub async fn get_height(&self) -> napi::Result { 41 | let height = self 42 | .inner 43 | .get_height() 44 | .await 45 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e)))?; 46 | 47 | Ok(height.try_into().unwrap()) 48 | } 49 | 50 | /// Get the height of the source hyperfuel instance 51 | /// Internally calls get_height. 52 | /// On an error from the source hyperfuel instance, sleeps for 53 | /// 1 second (increasing by 1 each failure up to max of 5 seconds) 54 | /// and retries query until success. 55 | #[napi] 56 | pub async fn get_height_with_retry(&self) -> napi::Result { 57 | let height = self 58 | .inner 59 | .get_height_with_retry() 60 | .await 61 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e)))?; 62 | 63 | Ok(height.try_into().unwrap()) 64 | } 65 | 66 | /// Create a parquet file by executing a query. 67 | /// 68 | /// Path should point to a folder that will contain the parquet files in the end. 69 | #[napi] 70 | pub async fn create_parquet_folder(&self, query: Query, path: String) -> napi::Result<()> { 71 | self.create_parquet_folder_impl(query, path) 72 | .await 73 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e))) 74 | } 75 | 76 | async fn create_parquet_folder_impl(&self, query: Query, path: String) -> Result<()> { 77 | let query = query.try_convert().context("parse query")?; 78 | 79 | self.inner 80 | .create_parquet_folder(query, path) 81 | .await 82 | .context("create parquet folder")?; 83 | 84 | Ok(()) 85 | } 86 | 87 | /// Send a query request to the source hyperfuel instance. 88 | /// 89 | /// Returns a query response which contains typed data. 90 | /// 91 | /// NOTE: this query returns loads all transactions that your match your receipt, input, or output selections 92 | /// and applies the field selection to all these loaded transactions. So your query will return the data you 93 | /// want plus additional data from the loaded transactions. This functionality is in case you want to associate 94 | /// receipts, inputs, or outputs with eachother. 95 | #[napi] 96 | pub async fn get_data(&self, query: Query) -> napi::Result { 97 | self.get_data_impl(query) 98 | .await 99 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e))) 100 | } 101 | 102 | async fn get_data_impl(&self, query: Query) -> Result { 103 | let query = query.try_convert().context("parse query")?; 104 | let resp = self.inner.get_data(&query).await.context("get data")?; 105 | Ok(resp.into()) 106 | } 107 | 108 | /// Send a query request to the source hyperfuel instance. 109 | /// 110 | /// Returns a query response that which contains structured data that doesn't include any inputs, outputs, 111 | /// and receipts that don't exactly match the query's input, outout, or receipt selection. 112 | #[napi] 113 | pub async fn get_selected_data(&self, query: Query) -> napi::Result { 114 | self.get_selected_data_impl(query) 115 | .await 116 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e))) 117 | } 118 | 119 | async fn get_selected_data_impl(&self, query: Query) -> Result { 120 | let query = query.try_convert().context("parse query")?; 121 | let resp = self 122 | .inner 123 | .get_selected_data(&query) 124 | .await 125 | .context("get data")?; 126 | Ok(resp.into()) 127 | } 128 | 129 | /// Send a query request to the source hyperfuel instance. 130 | /// 131 | /// Returns all log and logdata receipts of logs emitted by any of the specified contracts 132 | /// within the block range. 133 | /// If no 'to_block' is specified, query will run to the head of the chain. 134 | /// Returned data contains all the data needed to decode Fuel Log or LogData 135 | /// receipts as well as some extra data for context. This query doesn't return any logs that 136 | /// were a part of a failed transaction. 137 | /// 138 | /// NOTE: this function is experimental and might be removed in future versions. 139 | #[napi] 140 | pub async fn preset_query_get_logs( 141 | &self, 142 | emitting_contracts: Vec, 143 | from_block: i64, 144 | to_block: Option, 145 | ) -> napi::Result { 146 | self.preset_query_get_logs_impl(emitting_contracts, from_block, to_block) 147 | .await 148 | .map_err(|e| napi::Error::from_reason(format!("{:?}", e))) 149 | } 150 | 151 | async fn preset_query_get_logs_impl( 152 | &self, 153 | emitting_contracts: Vec, 154 | from_block: i64, 155 | to_block: Option, 156 | ) -> Result { 157 | // cut the "0x" off the address 158 | let mut emitting_contracts_args = vec![]; 159 | for contract_address in emitting_contracts { 160 | let address: &str = if &contract_address[..2] == "0x" { 161 | &contract_address[2..] 162 | } else { 163 | &contract_address 164 | }; 165 | let address = hex_str_address_to_byte_array(address) 166 | .context(format!("convert address {}", address))?; 167 | emitting_contracts_args.push(address) 168 | } 169 | 170 | let from_block = from_block as u64; 171 | let to_block = to_block.map(|i| i as u64); 172 | 173 | let resp = self 174 | .inner 175 | .preset_query_get_logs(emitting_contracts_args, from_block, to_block) 176 | .await 177 | .context("get logs")?; 178 | Ok(resp.into()) 179 | } 180 | } 181 | 182 | // helper function to decode hex string as address 183 | fn hex_str_address_to_byte_array(hex_str: &str) -> Result<[u8; 32]> { 184 | if hex_str.len() != 64 { 185 | return Err(anyhow!("address must be 64 hex characters".to_owned())); 186 | } 187 | 188 | let mut dst = [0u8; 32]; 189 | match faster_hex::hex_decode(hex_str.as_bytes(), &mut dst) { 190 | Ok(()) => Ok(dst), 191 | Err(e) => Err(anyhow!("Failed to decode hex string: {}", e)), 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/query.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{Context, Result}; 2 | use napi::bindgen_prelude::BigInt; 3 | 4 | use serde::{Deserialize, Deserializer, Serialize, Serializer}; 5 | 6 | // Custom serializer function for BigInt 7 | fn serialize_bigint(bigint: &Option>, serializer: S) -> Result 8 | where 9 | S: Serializer, 10 | { 11 | match bigint { 12 | Some(vec) => { 13 | let vec_u64: Vec = vec 14 | .iter() 15 | .map(|bigint: &BigInt| bigint.get_u64().1) 16 | .collect(); 17 | serializer.serialize_some(&vec_u64) 18 | } 19 | None => serializer.serialize_none(), 20 | } 21 | } 22 | fn deserialize_bigint<'de, D>(deserializer: D) -> Result>, D::Error> 23 | where 24 | D: Deserializer<'de>, 25 | { 26 | let option_vec_of_u64: Option> = Option::deserialize(deserializer)?; 27 | match option_vec_of_u64 { 28 | Some(vec_of_u64) => { 29 | let vec_of_bigint: Vec = vec_of_u64 30 | .into_iter() 31 | .map(|u64_val: u64| { 32 | u64_val.into() 33 | // u64_val.to_napi_value() 34 | }) 35 | .collect(); 36 | Ok(Some(vec_of_bigint)) 37 | } 38 | None => Ok(None), 39 | } 40 | } 41 | 42 | // TODO: is Deserialize required? 43 | #[napi(object)] 44 | #[derive(Default, Serialize, Deserialize, Clone, Debug)] 45 | pub struct ReceiptSelection { 46 | #[serde(skip_serializing_if = "Option::is_none")] 47 | pub root_contract_id: Option>, 48 | #[serde(skip_serializing_if = "Option::is_none")] 49 | pub to_address: Option>, 50 | #[serde(skip_serializing_if = "Option::is_none")] 51 | pub asset_id: Option>, 52 | #[serde(skip_serializing_if = "Option::is_none")] 53 | pub receipt_type: Option>, 54 | #[serde(skip_serializing_if = "Option::is_none")] 55 | pub sender: Option>, 56 | #[serde(skip_serializing_if = "Option::is_none")] 57 | pub recipient: Option>, 58 | #[serde(skip_serializing_if = "Option::is_none")] 59 | pub contract_id: Option>, 60 | #[serde(skip_serializing_if = "Option::is_none")] 61 | #[serde(deserialize_with = "deserialize_bigint")] 62 | #[serde(serialize_with = "serialize_bigint")] 63 | pub ra: Option>, 64 | #[serde(skip_serializing_if = "Option::is_none")] 65 | #[serde(deserialize_with = "deserialize_bigint")] 66 | #[serde(serialize_with = "serialize_bigint")] 67 | pub rb: Option>, 68 | #[serde(skip_serializing_if = "Option::is_none")] 69 | #[serde(deserialize_with = "deserialize_bigint")] 70 | #[serde(serialize_with = "serialize_bigint")] 71 | pub rc: Option>, 72 | #[serde(skip_serializing_if = "Option::is_none")] 73 | #[serde(deserialize_with = "deserialize_bigint")] 74 | #[serde(serialize_with = "serialize_bigint")] 75 | pub rd: Option>, 76 | #[serde(skip_serializing_if = "Option::is_none")] 77 | pub tx_status: Option>, 78 | #[serde(skip_serializing_if = "Option::is_none")] 79 | pub tx_type: Option>, 80 | } 81 | 82 | #[napi(object)] 83 | #[derive(Default, Serialize, Deserialize, Clone, Debug)] 84 | pub struct InputSelection { 85 | #[serde(skip_serializing_if = "Option::is_none")] 86 | pub owner: Option>, 87 | #[serde(skip_serializing_if = "Option::is_none")] 88 | pub asset_id: Option>, 89 | #[serde(skip_serializing_if = "Option::is_none")] 90 | pub contract: Option>, 91 | #[serde(skip_serializing_if = "Option::is_none")] 92 | pub sender: Option>, 93 | #[serde(skip_serializing_if = "Option::is_none")] 94 | pub recipient: Option>, 95 | #[serde(skip_serializing_if = "Option::is_none")] 96 | pub input_type: Option>, 97 | #[serde(skip_serializing_if = "Option::is_none")] 98 | pub tx_status: Option>, 99 | #[serde(skip_serializing_if = "Option::is_none")] 100 | pub tx_type: Option>, 101 | } 102 | 103 | #[napi(object)] 104 | #[derive(Default, Serialize, Deserialize, Clone, Debug)] 105 | pub struct OutputSelection { 106 | #[serde(skip_serializing_if = "Option::is_none")] 107 | pub to: Option>, 108 | #[serde(skip_serializing_if = "Option::is_none")] 109 | pub asset_id: Option>, 110 | #[serde(skip_serializing_if = "Option::is_none")] 111 | pub contract: Option>, 112 | #[serde(skip_serializing_if = "Option::is_none")] 113 | pub output_type: Option>, 114 | #[serde(skip_serializing_if = "Option::is_none")] 115 | pub tx_status: Option>, 116 | #[serde(skip_serializing_if = "Option::is_none")] 117 | pub tx_type: Option>, 118 | } 119 | 120 | #[napi(object)] 121 | #[derive(Default, Debug, Clone, Serialize, Deserialize)] 122 | pub struct FieldSelection { 123 | #[serde(skip_serializing_if = "Option::is_none")] 124 | pub block: Option>, 125 | #[serde(skip_serializing_if = "Option::is_none")] 126 | pub transaction: Option>, 127 | #[serde(skip_serializing_if = "Option::is_none")] 128 | pub receipt: Option>, 129 | #[serde(skip_serializing_if = "Option::is_none")] 130 | pub input: Option>, 131 | #[serde(skip_serializing_if = "Option::is_none")] 132 | pub output: Option>, 133 | } 134 | 135 | #[napi(object)] 136 | #[derive(Default, Serialize, Deserialize, Clone, Debug)] 137 | pub struct Query { 138 | /// The block to start the query from 139 | pub from_block: i64, 140 | /// The block to end the query at. If not specified, the query will go until the 141 | /// end of data. Exclusive, the returned range will be [from_block..to_block). 142 | /// 143 | /// The query will return before it reaches this target block if it hits the time limit 144 | /// configured on the server. The user should continue their query by putting the 145 | /// next_block field in the response into from_block field of their next query. This implements 146 | /// pagination. 147 | #[serde(skip_serializing_if = "Option::is_none")] 148 | pub to_block: Option, 149 | /// List of receipt selections, the query will return receipts that match any of these selections and 150 | /// it will return receipts that are related to the returned objects. 151 | #[serde(skip_serializing_if = "Option::is_none")] 152 | pub receipts: Option>, 153 | /// List of input selections, the query will return inputs that match any of these selections and 154 | /// it will return inputs that are related to the returned objects. 155 | #[serde(skip_serializing_if = "Option::is_none")] 156 | pub inputs: Option>, 157 | /// List of output selections, the query will return outputs that match any of these selections and 158 | /// it will return outputs that are related to the returned objects. 159 | #[serde(skip_serializing_if = "Option::is_none")] 160 | pub outputs: Option>, 161 | /// Whether to include all blocks regardless of if they are related to a returned transaction or log. Normally 162 | /// the server will return only the blocks that are related to the transaction or logs in the response. But if this 163 | /// is set to true, the server will return data for all blocks in the requested range [from_block, to_block). 164 | #[serde(skip_serializing_if = "Option::is_none")] 165 | pub include_all_blocks: Option, 166 | /// Field selection. The user can select which fields they are interested in, requesting less fields will improve 167 | /// query execution time and reduce the payload size so the user should always use a minimal number of fields. 168 | pub field_selection: FieldSelection, 169 | /// Maximum number of blocks that should be returned, the server might return more blocks than this number but 170 | /// it won't overshoot by too much. 171 | #[serde(skip_serializing_if = "Option::is_none")] 172 | pub max_num_blocks: Option, 173 | /// Maximum number of transactions that should be returned, the server might return more transactions than this number but 174 | /// it won't overshoot by too much. 175 | #[serde(skip_serializing_if = "Option::is_none")] 176 | pub max_num_transactions: Option, 177 | } 178 | 179 | impl Query { 180 | pub fn try_convert(&self) -> Result { 181 | let json = serde_json::to_vec(self).context("serialize to json")?; 182 | serde_json::from_slice(&json).context("parse json") 183 | } 184 | } 185 | 186 | impl TryFrom for Query { 187 | type Error = anyhow::Error; 188 | 189 | fn try_from(hyperfuel_query: hyperfuel_net_types::Query) -> Result { 190 | let json = serde_json::to_vec(&hyperfuel_query).context("serialize query to json")?; 191 | serde_json::from_slice(&json).context("parse json") 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/response.rs: -------------------------------------------------------------------------------- 1 | use hyperfuel_format::Hex; 2 | 3 | use crate::types::{as_i64, Block, Input, Output, Receipt, Transaction}; 4 | 5 | #[napi(object)] 6 | #[derive(Debug, Clone)] 7 | pub struct QueryResponseTyped { 8 | /// Current height of the source hypersync instance 9 | pub archive_height: Option, 10 | /// Next block to query for, the responses are paginated so 11 | /// the caller should continue the query from this block if they 12 | /// didn't get responses up to the to_block they specified in the Query. 13 | pub next_block: i64, 14 | /// Total time it took the hypersync instance to execute the query. 15 | pub total_execution_time: i64, 16 | /// Response data 17 | pub data: QueryResponseDataTyped, 18 | } 19 | 20 | #[napi(object)] 21 | #[derive(Debug, Clone)] 22 | pub struct QueryResponseDataTyped { 23 | pub blocks: Vec, 24 | pub transactions: Vec, 25 | pub receipts: Vec, 26 | pub inputs: Vec, 27 | pub outputs: Vec, 28 | } 29 | 30 | impl From for QueryResponseTyped { 31 | fn from(r: hyperfuel_client::QueryResponseTyped) -> Self { 32 | let archive_height = r.archive_height.map(|u| u as i64); 33 | let next_block = r.next_block as i64; 34 | let total_execution_time = r.total_execution_time as i64; 35 | let data = QueryResponseDataTyped { 36 | blocks: r.data.blocks.into_iter().map(|b| b.into()).collect(), 37 | transactions: r.data.transactions.into_iter().map(|b| b.into()).collect(), 38 | receipts: r.data.receipts.into_iter().map(|b| b.into()).collect(), 39 | inputs: r.data.inputs.into_iter().map(|b| b.into()).collect(), 40 | outputs: r.data.outputs.into_iter().map(|b| b.into()).collect(), 41 | }; 42 | 43 | Self { 44 | archive_height, 45 | next_block, 46 | total_execution_time, 47 | data, 48 | } 49 | } 50 | } 51 | 52 | #[napi(object)] 53 | #[derive(Debug, Clone)] 54 | pub struct LogResponse { 55 | /// Current height of the source hypersync instance 56 | pub archive_height: Option, 57 | /// Next block to query for, the responses are paginated so 58 | /// the caller should continue the query from this block if they 59 | /// didn't get responses up to the to_block they specified in the Query. 60 | pub next_block: i64, 61 | /// Total time it took the hypersync instance to execute the query. 62 | pub total_execution_time: i64, 63 | /// Response data 64 | pub data: Vec, 65 | } 66 | 67 | /// Contains all the fields needed for decoding plus some additional fields 68 | /// for context. 69 | 70 | #[napi(object)] 71 | #[derive(Debug, Clone)] 72 | pub struct LogContext { 73 | pub block_height: i64, 74 | pub tx_id: String, 75 | pub receipt_index: i64, 76 | pub receipt_type: u8, 77 | pub contract_id: Option, 78 | pub root_contract_id: Option, 79 | pub ra: Option, 80 | pub rb: Option, 81 | pub rc: Option, 82 | pub rd: Option, 83 | pub pc: Option, 84 | pub is: Option, 85 | pub ptr: Option, 86 | pub len: Option, 87 | pub digest: Option, 88 | pub data: Option, 89 | } 90 | 91 | impl From for LogResponse { 92 | fn from(r: hyperfuel_client::LogResponse) -> Self { 93 | let archive_height = r.archive_height.map(|h| h as i64); 94 | let next_block = r.next_block as i64; 95 | let total_execution_time = r.total_execution_time as i64; 96 | let data = r 97 | .data 98 | .into_iter() 99 | .map(|c| LogContext { 100 | block_height: as_i64(c.block_height), 101 | tx_id: c.tx_id.encode_hex(), 102 | receipt_index: as_i64(c.receipt_index), 103 | receipt_type: c.receipt_type.to_u8(), 104 | contract_id: c.contract_id.map(|i| i.encode_hex()), 105 | root_contract_id: c.root_contract_id.map(|i| i.encode_hex()), 106 | ra: c.ra.map(as_i64), 107 | rb: c.rb.map(as_i64), 108 | rc: c.rc.map(as_i64), 109 | rd: c.rd.map(as_i64), 110 | pc: c.pc.map(as_i64), 111 | is: c.is.map(as_i64), 112 | ptr: c.ptr.map(as_i64), 113 | len: c.len.map(as_i64), 114 | digest: c.digest.map(|i| i.encode_hex()), 115 | data: c.data.map(|i| i.encode_hex()), 116 | }) 117 | .collect(); 118 | Self { 119 | archive_height, 120 | next_block, 121 | total_execution_time, 122 | data, 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/types.rs: -------------------------------------------------------------------------------- 1 | use hyperfuel_format::{Hex, UInt}; 2 | use napi::bindgen_prelude::BigInt; 3 | 4 | /// The block header contains metadata about a certain block. 5 | 6 | #[napi(object)] 7 | #[derive(Debug, Default, Clone, PartialEq, Eq)] 8 | pub struct Block { 9 | /// String of the header 10 | pub id: String, 11 | /// The block height for the data availability layer up to which (inclusive) input messages are processed. 12 | pub da_height: i64, 13 | pub consensus_parameters_version: i64, 14 | pub state_transition_bytecode_version: i64, 15 | /// The number of transactions in the block. 16 | pub transactions_count: String, 17 | /// The number of receipt messages in the block. 18 | pub message_receipt_count: String, 19 | /// The merkle root of the transactions in the block. 20 | pub transactions_root: String, 21 | pub message_outbox_root: String, 22 | pub event_inbox_root: String, 23 | /// The block height. 24 | pub height: i64, 25 | /// The merkle root of all previous consensus header Stringes (not including this block). 26 | pub prev_root: String, 27 | /// The timestamp for the block. 28 | pub time: i64, 29 | /// The String of the serialized application header for this block. 30 | pub application_hash: String, 31 | } 32 | 33 | /// An object containing information about a transaction. 34 | #[napi(object)] 35 | #[derive(Debug, Default, Clone, PartialEq, Eq)] 36 | pub struct Transaction { 37 | /// block the transaction is in. 38 | pub block_height: i64, 39 | /// A unique transaction id. 40 | pub id: String, 41 | /// An array of asset ids used for the transaction inputs. 42 | pub input_asset_ids: Option>, 43 | // Contract object -> bincode into schema 44 | /// An array of contracts used for the transaction inputs. 45 | pub input_contracts: Option>, 46 | /// A contract used for the transaction input. 47 | /// A unique 32 byte identifier for the UTXO for a contract used for the transaction input. 48 | pub input_contract_utxo_id: Option, 49 | /// The root of amount of coins owned by contract before transaction execution for a contract used for the transaction input. 50 | pub input_contract_balance_root: Option, 51 | /// The state root of contract before transaction execution for a contract used for the transaction input. 52 | pub input_contract_state_root: Option, 53 | /// A pointer to the TX whose output is being spent for a contract used for the transaction input. 54 | pub input_contract_tx_pointer_block_height: Option, 55 | /// A pointer to the TX whose output is being spent for a contract used for the transaction input. 56 | pub input_contract_tx_pointer_tx_index: Option, 57 | /// The contract id for a contract used for the transaction input. 58 | pub input_contract: Option, 59 | pub policies_tip: Option, 60 | pub policies_witness_limit: Option, 61 | pub policies_maturity: Option, 62 | pub policies_max_fee: Option, 63 | pub script_gas_limit: Option, 64 | /// The minimum block height that the transaction can be included at. 65 | pub maturity: Option, 66 | /// The amount minted in the transaction. 67 | pub mint_amount: Option, 68 | /// The asset ID for coins minted in the transaction. 69 | pub mint_asset_id: Option, 70 | pub mint_gas_price: Option, 71 | /// The location of the transaction in the block. 72 | pub tx_pointer_block_height: Option, 73 | pub tx_pointer_tx_index: Option, 74 | /// Script, creating a new contract, or minting new coins 75 | pub tx_type: u8, 76 | /// The index of the input from a transaction that changed the state of a contract. 77 | pub output_contract_input_index: Option, 78 | /// The root of amount of coins owned by contract after transaction execution from a transaction that changed the state of a contract. 79 | pub output_contract_balance_root: Option, 80 | /// The state root of contract after transaction execution from a transaction that changed the state of a contract. 81 | pub output_contract_state_root: Option, 82 | /// An array of witnesses. 83 | pub witnesses: Option, 84 | /// The root of the receipts. 85 | pub receipts_root: Option, 86 | /// The status type of the transaction. 87 | pub status: u8, 88 | /// for SubmittedStatus, SuccessStatus, and FailureStatus, the time a transaction was submitted, successful, or failed 89 | pub time: i64, 90 | /// for SuccessStatus, the state of the program execution 91 | // pub program_state: Option 92 | /// for SqueezedOutStatus & FailureStatus, the reason the transaction was squeezed out or failed 93 | pub reason: Option, 94 | /// The script to execute. 95 | pub script: Option, 96 | /// The script input parameters. 97 | pub script_data: Option, 98 | /// The witness index of contract bytecode. 99 | pub bytecode_witness_index: Option, 100 | pub bytecode_root: Option, 101 | pub subsection_index: Option, 102 | pub subsections_number: Option, 103 | pub proof_set: Option, 104 | pub consensus_parameters_upgrade_purpose_witness_index: Option, 105 | pub consensus_parameters_upgrade_purpose_checksum: Option, 106 | pub state_transition_upgrade_purpose_root: Option, 107 | /// The salt value for the transaction. 108 | pub salt: Option, 109 | } 110 | 111 | /// An object representing all possible types of receipts. 112 | #[napi(object)] 113 | #[derive(Debug, Default, Clone)] 114 | pub struct Receipt { 115 | /// Index of the receipt in the block 116 | pub receipt_index: i64, 117 | /// Contract that produced the receipt 118 | pub root_contract_id: Option, 119 | /// transaction that this receipt originated from 120 | pub tx_id: String, 121 | /// The status type of the transaction this receipt originated from 122 | pub tx_status: u8, 123 | /// The type of the transaction this receipt originated from 124 | pub tx_type: u8, 125 | /// block that the receipt originated in 126 | pub block_height: i64, 127 | /// The value of the program counter register $pc, which is the memory address of the current instruction. 128 | pub pc: Option, 129 | /// The value of register $is, which is the pointer to the start of the currently-executing code. 130 | pub is: Option, 131 | /// The recipient contract 132 | pub to: Option, 133 | /// The recipient address 134 | pub to_address: Option, 135 | /// The amount of coins transferred. 136 | pub amount: Option, 137 | /// The asset id of the coins transferred. 138 | pub asset_id: Option, 139 | /// The gas used for the transaction. 140 | pub gas: Option, 141 | /// The first parameter for a CALL receipt type, holds the function selector. 142 | pub param1: Option, 143 | /// The second parameter for a CALL receipt type, typically used for the user-specified input to the ABI function being selected. 144 | pub param2: Option, 145 | /// The value of registers at the end of execution, used for debugging. 146 | pub val: Option, 147 | /// The value of the pointer register, used for debugging. 148 | pub ptr: Option, 149 | /// A 32-byte String of MEM[$rC, $rD]. The syntax MEM[x, y] means the memory range starting at byte x, of length y bytes. 150 | pub digest: Option, 151 | /// The decimal string representation of an 8-bit unsigned integer for the panic reason. Only returned if the receipt type is PANIC. 152 | pub reason: Option, 153 | /// The value of register $rA. 154 | pub ra: Option, 155 | /// The value of register $rB. 156 | pub rb: Option, 157 | /// The value of register $rC. 158 | pub rc: Option, 159 | /// The value of register $rD. 160 | pub rd: Option, 161 | /// The length of the receipt. 162 | pub len: Option, 163 | /// The type of receipt. 164 | pub receipt_type: u8, 165 | /// 0 if script exited successfully, any otherwise. 166 | pub result: Option, 167 | /// The amount of gas consumed by the script. 168 | pub gas_used: Option, 169 | /// The receipt data. 170 | pub data: Option, 171 | /// The address of the message sender. 172 | pub sender: Option, 173 | /// The address of the message recipient. 174 | pub recipient: Option, 175 | /// The nonce value for a message. 176 | pub nonce: Option, 177 | /// Current context if in an internal context. null otherwise 178 | pub contract_id: Option, 179 | /// The sub id. 180 | pub sub_id: Option, 181 | } 182 | 183 | /// An object representing all possible types of inputs. InputCoin, InputContract, InputMessage 184 | #[napi(object)] 185 | #[derive(Debug, Default, Clone)] 186 | pub struct Input { 187 | /// transaction that this input originated from 188 | pub tx_id: String, 189 | /// The status type of the transaction this input originated from 190 | pub tx_status: u8, 191 | /// The type of the transaction this input originated from 192 | pub tx_type: u8, 193 | /// block that the input originated in 194 | pub block_height: i64, 195 | /// InputCoin, InputContract, or InputMessage 196 | pub input_type: u8, 197 | /// A unique 32 byte identifier for the UTXO. 198 | pub utxo_id: Option, 199 | /// The owning address or predicate root. 200 | pub owner: Option, 201 | /// for InputCoin type: The amount of coins. 202 | /// for InputMessage type: The amount sent in the message. 203 | pub amount: Option, 204 | /// The asset ID of the coins. 205 | pub asset_id: Option, 206 | /// A pointer to the transaction whose output is being spent. 207 | pub tx_pointer_block_height: Option, 208 | pub tx_pointer_tx_index: Option, 209 | /// The index of the witness that authorizes spending the coin. 210 | pub witness_index: Option, 211 | /// The amount of gas used in the predicate transaction. 212 | pub predicate_gas_used: Option, 213 | /// The predicate bytecode. 214 | pub predicate: Option, 215 | /// The predicate input parameters. 216 | pub predicate_data: Option, 217 | /// The root of amount of coins owned by contract before transaction execution. 218 | pub balance_root: Option, 219 | /// The state root of contract before transaction execution. 220 | pub state_root: Option, 221 | /// The input contract. 222 | pub contract: Option, 223 | /// The sender address of the message. 224 | pub sender: Option, 225 | /// The recipient address of the message. 226 | pub recipient: Option, 227 | /// A nonce value for the message input, which is determined by the sending system and is published at the time the message is sent. 228 | pub nonce: Option, 229 | /// The message data. 230 | pub data: Option, 231 | } 232 | 233 | /// An object representing all possible types of Outputs. CoinOutput, ContractOutput, ChangeOutput, VariableOutput, ContractCreated 234 | #[napi(object)] 235 | #[derive(Debug, Default, Clone)] 236 | pub struct Output { 237 | /// transaction that this out originated from 238 | pub tx_id: String, 239 | /// The status type of the transaction this output originated from 240 | pub tx_status: u8, 241 | /// The type of the transaction this output originated from 242 | pub tx_type: u8, 243 | /// block that the output originated in 244 | pub block_height: i64, 245 | /// CoinOutput, ContractOutput, ChangeOutput, VariableOutput, or ContractCreated 246 | pub output_type: u8, 247 | /// The address the coins were sent to. 248 | pub to: Option, 249 | /// The amount of coins in the output. 250 | pub amount: Option, 251 | /// The asset id for the coins sent. 252 | pub asset_id: Option, 253 | /// The index of the input. 254 | pub input_index: Option, 255 | /// The root of amount of coins owned by contract after transaction execution. 256 | pub balance_root: Option, 257 | /// for ContractedCreated type: The initial state root of contract. 258 | /// for ContractOutput type: The state root of contract after transaction execution. 259 | pub state_root: Option, 260 | /// for ContractCreated type: The contract that was created. 261 | pub contract: Option, 262 | } 263 | 264 | impl From for Block { 265 | fn from(b: hyperfuel_format::BlockHeader) -> Self { 266 | Self { 267 | id: b.id.encode_hex(), 268 | da_height: as_i64(b.da_height), 269 | transactions_count: b.transactions_count.encode_hex(), 270 | message_receipt_count: b.message_receipt_count.encode_hex(), 271 | transactions_root: b.transactions_root.encode_hex(), 272 | height: as_i64(b.height), 273 | prev_root: b.prev_root.encode_hex(), 274 | time: as_i64(b.time), 275 | application_hash: b.application_hash.encode_hex(), 276 | consensus_parameters_version: as_i64(b.consensus_parameters_version), 277 | state_transition_bytecode_version: as_i64(b.state_transition_bytecode_version), 278 | message_outbox_root: b.message_outbox_root.encode_hex(), 279 | event_inbox_root: b.event_inbox_root.encode_hex(), 280 | } 281 | } 282 | } 283 | 284 | impl From for Transaction { 285 | fn from(t: hyperfuel_format::Transaction) -> Self { 286 | Self { 287 | block_height: as_i64(t.block_height), 288 | id: t.id.encode_hex(), 289 | input_asset_ids: t 290 | .input_asset_ids 291 | .map(|d| d.into_iter().map(|i| i.encode_hex()).collect()), 292 | input_contracts: t 293 | .input_contracts 294 | .map(|d| d.into_iter().map(|i| i.encode_hex()).collect()), 295 | input_contract_utxo_id: t.input_contract_utxo_id.map(|d| d.encode_hex()), 296 | input_contract_balance_root: t.input_contract_balance_root.map(|d| d.encode_hex()), 297 | input_contract_state_root: t.input_contract_state_root.map(|d| d.encode_hex()), 298 | input_contract_tx_pointer_block_height: t 299 | .input_contract_tx_pointer_block_height 300 | .map(as_i64), 301 | input_contract_tx_pointer_tx_index: t.input_contract_tx_pointer_tx_index.map(as_i64), 302 | input_contract: t.input_contract.map(|d| d.encode_hex()), 303 | maturity: t.maturity.map(as_i64), 304 | mint_amount: t.mint_amount.map(as_i64), 305 | mint_asset_id: t.mint_asset_id.map(|d| d.encode_hex()), 306 | tx_pointer_block_height: t.tx_pointer_block_height.map(as_i64), 307 | tx_pointer_tx_index: t.tx_pointer_tx_index.map(as_i64), 308 | tx_type: t.tx_type.to_u8(), 309 | output_contract_input_index: t.output_contract_input_index.map(as_i64), 310 | output_contract_balance_root: t.output_contract_balance_root.map(|d| d.encode_hex()), 311 | output_contract_state_root: t.output_contract_state_root.map(|d| d.encode_hex()), 312 | witnesses: t.witnesses.map(|d| d.encode_hex()), 313 | receipts_root: t.receipts_root.map(|d| d.encode_hex()), 314 | status: t.status.as_u8(), 315 | time: as_i64(t.time), 316 | reason: t.reason, 317 | script: t.script.map(|d| d.encode_hex()), 318 | script_data: t.script_data.map(|d| d.encode_hex()), 319 | bytecode_witness_index: t.bytecode_witness_index.map(as_i64), 320 | salt: t.salt.map(|d| d.encode_hex()), 321 | policies_tip: t.policies_tip.map(as_i64), 322 | policies_witness_limit: t.policies_witness_limit.map(as_i64), 323 | policies_maturity: t.policies_maturity.map(as_i64), 324 | policies_max_fee: t.policies_max_fee.map(as_i64), 325 | script_gas_limit: t.script_gas_limit.map(as_i64), 326 | mint_gas_price: t.mint_amount.map(as_i64), 327 | bytecode_root: t.bytecode_root.map(|r| r.encode_hex()), 328 | subsection_index: t.subsection_index.map(as_i64), 329 | subsections_number: t.subsections_number.map(as_i64), 330 | proof_set: t.proof_set.map(|p| p.encode_hex()), 331 | consensus_parameters_upgrade_purpose_witness_index: t 332 | .consensus_parameters_upgrade_purpose_witness_index 333 | .map(as_i64), 334 | consensus_parameters_upgrade_purpose_checksum: t 335 | .consensus_parameters_upgrade_purpose_checksum 336 | .map(|a| a.encode_hex()), 337 | state_transition_upgrade_purpose_root: t 338 | .state_transition_upgrade_purpose_root 339 | .map(|a| a.encode_hex()), 340 | } 341 | } 342 | } 343 | 344 | impl From for Receipt { 345 | fn from(r: hyperfuel_format::Receipt) -> Self { 346 | Self { 347 | receipt_index: as_i64(r.receipt_index), 348 | root_contract_id: r.root_contract_id.map(|d| d.encode_hex()), 349 | tx_id: r.tx_id.encode_hex(), 350 | tx_status: r.tx_status.as_u8(), 351 | tx_type: r.tx_type.to_u8(), 352 | block_height: as_i64(r.block_height), 353 | pc: r.pc.map(|x| x.to_string()), 354 | is: r.is.map(|x| x.to_string()), 355 | to: r.to.map(|d| d.encode_hex()), 356 | to_address: r.to_address.map(|d| d.encode_hex()), 357 | amount: r.amount.map(|x| { 358 | let as_u64: u64 = *x; 359 | let big: BigInt = as_u64.into(); 360 | big 361 | }), 362 | asset_id: r.asset_id.map(|d| d.encode_hex()), 363 | gas: r.gas.map(as_i64), 364 | param1: r.param1.map(|x| { 365 | let as_u64: u64 = *x; 366 | let big: BigInt = as_u64.into(); 367 | big 368 | }), 369 | param2: r.param2.map(|x| { 370 | let as_u64: u64 = *x; 371 | let big: BigInt = as_u64.into(); 372 | big 373 | }), 374 | val: r.val.map(|x| { 375 | let as_u64: u64 = *x; 376 | let big: BigInt = as_u64.into(); 377 | big 378 | }), 379 | ptr: r.ptr.map(|x| { 380 | let as_u64: u64 = *x; 381 | let big: BigInt = as_u64.into(); 382 | big 383 | }), 384 | digest: r.digest.map(|d| d.encode_hex()), 385 | reason: r.reason.map(as_i64), 386 | ra: r.ra.map(|x| { 387 | let as_u64: u64 = *x; 388 | let big: BigInt = as_u64.into(); 389 | big 390 | }), 391 | rb: r.rb.map(|x| { 392 | let as_u64: u64 = *x; 393 | let big: BigInt = as_u64.into(); 394 | big 395 | }), 396 | rc: r.rc.map(|x| { 397 | let as_u64: u64 = *x; 398 | let big: BigInt = as_u64.into(); 399 | big 400 | }), 401 | rd: r.rd.map(|x| { 402 | let as_u64: u64 = *x; 403 | let big: BigInt = as_u64.into(); 404 | big 405 | }), 406 | len: r.len.map(|x| { 407 | let as_u64: u64 = *x; 408 | let big: BigInt = as_u64.into(); 409 | big 410 | }), 411 | receipt_type: r.receipt_type.to_u8(), 412 | result: r.result.map(as_i64), 413 | gas_used: r.gas_used.map(as_i64), 414 | data: r.data.map(|d| d.encode_hex()), 415 | sender: r.sender.map(|d| d.encode_hex()), 416 | recipient: r.recipient.map(|d| d.encode_hex()), 417 | nonce: r.nonce.map(|d| d.encode_hex()), 418 | contract_id: r.contract_id.map(|d| d.encode_hex()), 419 | sub_id: r.sub_id.map(|d| d.encode_hex()), 420 | } 421 | } 422 | } 423 | 424 | impl From for Input { 425 | fn from(i: hyperfuel_format::Input) -> Self { 426 | Self { 427 | tx_id: i.tx_id.encode_hex(), 428 | tx_status: i.tx_status.as_u8(), 429 | tx_type: i.tx_type.to_u8(), 430 | block_height: as_i64(i.block_height), 431 | input_type: i.input_type.as_u8(), 432 | utxo_id: i.utxo_id.map(|d| d.encode_hex()), 433 | owner: i.owner.map(|d| d.encode_hex()), 434 | amount: i.amount.map(|x| { 435 | let as_u64: u64 = *x; 436 | let big: BigInt = as_u64.into(); 437 | big 438 | }), 439 | asset_id: i.asset_id.map(|d| d.encode_hex()), 440 | tx_pointer_block_height: i.tx_pointer_block_height.map(as_i64), 441 | tx_pointer_tx_index: i.tx_pointer_tx_index.map(as_i64), 442 | witness_index: i.witness_index.map(as_i64), 443 | predicate_gas_used: i.predicate_gas_used.map(as_i64), 444 | predicate: i.predicate.map(|d| d.encode_hex()), 445 | predicate_data: i.predicate_data.map(|d| d.encode_hex()), 446 | balance_root: i.balance_root.map(|d| d.encode_hex()), 447 | state_root: i.state_root.map(|d| d.encode_hex()), 448 | contract: i.contract.map(|d| d.encode_hex()), 449 | sender: i.sender.map(|d| d.encode_hex()), 450 | recipient: i.recipient.map(|d| d.encode_hex()), 451 | nonce: i.nonce.map(|d| d.encode_hex()), 452 | data: i.data.map(|d| d.encode_hex()), 453 | } 454 | } 455 | } 456 | 457 | impl From for Output { 458 | fn from(o: hyperfuel_format::Output) -> Self { 459 | Self { 460 | tx_id: o.tx_id.encode_hex(), 461 | tx_status: o.tx_status.as_u8(), 462 | tx_type: o.tx_type.to_u8(), 463 | block_height: as_i64(o.block_height), 464 | output_type: o.output_type.as_u8(), 465 | to: o.to.map(|d| d.encode_hex()), 466 | amount: o.amount.map(|x| { 467 | let as_u64: u64 = *x; 468 | let big: BigInt = as_u64.into(); 469 | big 470 | }), 471 | asset_id: o.asset_id.map(|d| d.encode_hex()), 472 | input_index: o.input_index.map(as_i64), 473 | balance_root: o.balance_root.map(|d| d.encode_hex()), 474 | state_root: o.state_root.map(|d| d.encode_hex()), 475 | contract: o.contract.map(|d| d.encode_hex()), 476 | } 477 | } 478 | } 479 | 480 | pub fn as_i64(uint: UInt) -> i64 { 481 | let cast: u64 = uint.into(); 482 | cast as i64 483 | } 484 | --------------------------------------------------------------------------------