├── .github ├── ISSUE_TEMPLATE │ ├── 01_BUG_REPORT.md │ ├── 02_FEATURE_REQUEST.md │ ├── 03_CODEBASE_IMPROVEMENT.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── test.yml ├── .gitignore ├── .prettierrc ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── examples ├── disassemble │ ├── .gitignore │ ├── favicon.svg │ ├── index.html │ ├── package.json │ ├── public │ │ └── data │ │ │ ├── my-counter.zip │ │ │ └── starcoin-framework.zip │ ├── src │ │ ├── main.ts │ │ ├── style.css │ │ └── vite-env.d.ts │ ├── tsconfig.json │ └── yarn.lock └── my-counter │ ├── .gitignore │ ├── favicon.svg │ ├── index.html │ ├── package.json │ ├── public │ └── data │ │ ├── my-counter.zip │ │ └── starcoin-framework.zip │ ├── src │ ├── main.ts │ ├── style.css │ └── vite-env.d.ts │ ├── tsconfig.json │ └── yarn.lock ├── karma.conf.js ├── package.json ├── pkg ├── disassemble.ts ├── git.ts ├── index.ts ├── move.ts ├── move_bg.js ├── move_bg.wasm └── package.ts ├── rollup.config.js ├── src ├── cli.rs ├── lib.rs ├── main.rs ├── targets │ ├── mod.rs │ ├── starcoin │ │ ├── mod.rs │ │ └── types │ │ │ ├── function.rs │ │ │ ├── mod.rs │ │ │ ├── module.rs │ │ │ ├── package.rs │ │ │ └── script.rs │ └── target.rs └── utils │ ├── bcs_ext │ └── mod.rs │ ├── mod.rs │ └── serde_helper │ ├── mod.rs │ └── vec_bytes.rs ├── test ├── data │ ├── disassemble.zip │ ├── my-counter.zip │ ├── starcoin-framework.zip │ └── unit-test.zip ├── git.test.ts ├── move.test.ts ├── package.test.ts └── wasmfs.test.ts ├── tsconfig.json ├── tslint.json └── yarn.lock /.github/ISSUE_TEMPLATE/01_BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help Starcoin IDE to improve 4 | title: "bug: " 5 | labels: "bug" 6 | assignees: "" 7 | --- 8 | 9 | # Bug Report 10 | 11 | **Starcoin IDE version:** 12 | 13 | 14 | 15 | **Current behavior:** 16 | 17 | 18 | 19 | **Expected behavior:** 20 | 21 | 22 | 23 | **Steps to reproduce:** 24 | 25 | 26 | 27 | **Related code:** 28 | 29 | 30 | 31 | ``` 32 | insert short code snippets here 33 | ``` 34 | 35 | **Other information:** 36 | 37 | 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project 4 | title: "feat: " 5 | labels: "enhancement" 6 | assignees: "" 7 | --- 8 | 9 | # Feature Request 10 | 11 | **Describe the Feature Request** 12 | 13 | 14 | 15 | **Describe Preferred Solution** 16 | 17 | 18 | 19 | **Describe Alternatives** 20 | 21 | 22 | 23 | **Related Code** 24 | 25 | 26 | 27 | **Additional Context** 28 | 29 | 30 | 31 | **If the feature request is approved, would you be willing to submit a PR?** 32 | Yes / No _(Help can be provided if you need assistance submitting a PR)_ 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Codebase improvement 3 | about: Provide your feedback for the existing codebase. Suggest a better solution for algorithms, development tools, etc. 4 | title: "dev: " 5 | labels: "enhancement" 6 | assignees: "" 7 | --- 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | blank_issues_enabled: false 3 | contact_links: 4 | - name: Starcoin Community Support 5 | url: https://github.com/starcoinorg/starcoin/discussions 6 | about: Please ask and answer questions here. 7 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Pull request type 4 | 5 | 6 | 7 | Please check the type of change your PR introduces: 8 | 9 | - [ ] Bugfix 10 | - [ ] Feature 11 | - [ ] Code style update (formatting, renaming) 12 | - [ ] Refactoring (no functional changes, no api changes) 13 | - [ ] Build related changes 14 | - [ ] Documentation content changes 15 | - [ ] Other (please describe): 16 | 17 | ## What is the current behavior? 18 | 19 | 20 | 21 | Issue Number: N/A 22 | 23 | ## What is the new behavior? 24 | 25 | 26 | 27 | - 28 | - 29 | - 30 | 31 | ## Other information 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: [ 'main', 'release-**' ] 4 | pull_request: 5 | branches: [ 'main', 'release-**' ] 6 | name: Test 7 | jobs: 8 | test: 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | os: [ubuntu-20.04, macos-10.15, windows-2022] 13 | runs-on: ${{ matrix.os }} 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: setup rust toolchain 17 | uses: actions-rs/toolchain@v1 18 | with: 19 | toolchain: nightly 20 | target: wasm32-wasi 21 | components: rustfmt,rust-src,clippy 22 | default: true 23 | profile: minimal 24 | - name: Install Node.js 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: '14.x' 28 | - name: Install dependencies 29 | run: yarn install 30 | - name: run fmt check 31 | uses: actions-rs/cargo@v1 32 | with: 33 | command: fmt 34 | args: -- --check 35 | - name: Run tslint check 36 | run: yarn lint:ts:tslint 37 | - name: Run headless test 38 | uses: GabrielBB/xvfb-action@v1 39 | with: 40 | run: yarn test 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | 3 | # Project ignore 4 | .cache 5 | report.* 6 | **/test_result.wat 7 | **/test_result.wasm 8 | **/lib 9 | 10 | # Node 11 | node_modules 12 | coverage 13 | .nyc_output 14 | .DS_Store 15 | *.log 16 | .vscode 17 | .idea 18 | lib 19 | compiled 20 | .awcache 21 | .rpt2_cache 22 | docs 23 | /examples/wasm-shell/dist 24 | /dist 25 | oclif.manifest.json 26 | 27 | /node_modules 28 | 29 | .parcel-cache/ 30 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "Inflector" 7 | version = "0.11.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" 10 | 11 | [[package]] 12 | name = "aead" 13 | version = "0.3.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" 16 | dependencies = [ 17 | "generic-array", 18 | ] 19 | 20 | [[package]] 21 | name = "aes" 22 | version = "0.6.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" 25 | dependencies = [ 26 | "aes-soft", 27 | "aesni", 28 | "cipher", 29 | ] 30 | 31 | [[package]] 32 | name = "aes-gcm" 33 | version = "0.8.0" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" 36 | dependencies = [ 37 | "aead", 38 | "aes", 39 | "cipher", 40 | "ctr", 41 | "ghash", 42 | "subtle", 43 | ] 44 | 45 | [[package]] 46 | name = "aes-soft" 47 | version = "0.6.4" 48 | source = "registry+https://github.com/rust-lang/crates.io-index" 49 | checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" 50 | dependencies = [ 51 | "cipher", 52 | "opaque-debug", 53 | ] 54 | 55 | [[package]] 56 | name = "aesni" 57 | version = "0.10.0" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" 60 | dependencies = [ 61 | "cipher", 62 | "opaque-debug", 63 | ] 64 | 65 | [[package]] 66 | name = "aho-corasick" 67 | version = "0.7.18" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 70 | dependencies = [ 71 | "memchr", 72 | ] 73 | 74 | [[package]] 75 | name = "ansi_term" 76 | version = "0.12.1" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 79 | dependencies = [ 80 | "winapi", 81 | ] 82 | 83 | [[package]] 84 | name = "anyhow" 85 | version = "1.0.57" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" 88 | 89 | [[package]] 90 | name = "arrayref" 91 | version = "0.3.6" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" 94 | 95 | [[package]] 96 | name = "atty" 97 | version = "0.2.14" 98 | source = "registry+https://github.com/rust-lang/crates.io-index" 99 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 100 | dependencies = [ 101 | "hermit-abi", 102 | "libc", 103 | "winapi", 104 | ] 105 | 106 | [[package]] 107 | name = "autocfg" 108 | version = "1.1.0" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 111 | 112 | [[package]] 113 | name = "base64" 114 | version = "0.13.0" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 117 | 118 | [[package]] 119 | name = "bcs" 120 | version = "0.1.3" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "510fd83e3eaf7263b06182f3550b4c0af2af42cb36ab8024969ff5ea7fcb2833" 123 | dependencies = [ 124 | "serde", 125 | "thiserror", 126 | ] 127 | 128 | [[package]] 129 | name = "bech32" 130 | version = "0.8.1" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "cf9ff0bbfd639f15c74af777d81383cf53efb7c93613f6cab67c6c11e05bbf8b" 133 | 134 | [[package]] 135 | name = "bindgen" 136 | version = "0.59.2" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" 139 | dependencies = [ 140 | "bitflags", 141 | "cexpr", 142 | "clang-sys", 143 | "clap 2.34.0", 144 | "env_logger", 145 | "lazy_static", 146 | "lazycell", 147 | "log", 148 | "peeking_take_while", 149 | "proc-macro2 1.0.38", 150 | "quote 1.0.18", 151 | "regex", 152 | "rustc-hash", 153 | "shlex", 154 | "which", 155 | ] 156 | 157 | [[package]] 158 | name = "bitflags" 159 | version = "1.3.2" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 162 | 163 | [[package]] 164 | name = "block-buffer" 165 | version = "0.9.0" 166 | source = "registry+https://github.com/rust-lang/crates.io-index" 167 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 168 | dependencies = [ 169 | "generic-array", 170 | ] 171 | 172 | [[package]] 173 | name = "bs58" 174 | version = "0.4.0" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" 177 | 178 | [[package]] 179 | name = "byteorder" 180 | version = "1.4.3" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 183 | 184 | [[package]] 185 | name = "bytes" 186 | version = "1.2.1" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" 189 | 190 | [[package]] 191 | name = "cc" 192 | version = "1.0.74" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" 195 | 196 | [[package]] 197 | name = "cexpr" 198 | version = "0.6.0" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" 201 | dependencies = [ 202 | "nom", 203 | ] 204 | 205 | [[package]] 206 | name = "cfg-if" 207 | version = "1.0.0" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 210 | 211 | [[package]] 212 | name = "cipher" 213 | version = "0.2.5" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" 216 | dependencies = [ 217 | "generic-array", 218 | ] 219 | 220 | [[package]] 221 | name = "clang-sys" 222 | version = "1.4.0" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" 225 | dependencies = [ 226 | "glob", 227 | "libc", 228 | "libloading", 229 | ] 230 | 231 | [[package]] 232 | name = "clap" 233 | version = "2.34.0" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 236 | dependencies = [ 237 | "ansi_term", 238 | "atty", 239 | "bitflags", 240 | "strsim 0.8.0", 241 | "textwrap 0.11.0", 242 | "unicode-width", 243 | "vec_map", 244 | ] 245 | 246 | [[package]] 247 | name = "clap" 248 | version = "3.2.22" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" 251 | dependencies = [ 252 | "atty", 253 | "bitflags", 254 | "clap_derive", 255 | "clap_lex", 256 | "indexmap", 257 | "once_cell", 258 | "strsim 0.10.0", 259 | "termcolor", 260 | "textwrap 0.15.1", 261 | ] 262 | 263 | [[package]] 264 | name = "clap_derive" 265 | version = "3.2.18" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" 268 | dependencies = [ 269 | "heck 0.4.0", 270 | "proc-macro-error", 271 | "proc-macro2 1.0.38", 272 | "quote 1.0.18", 273 | "syn 1.0.94", 274 | ] 275 | 276 | [[package]] 277 | name = "clap_lex" 278 | version = "0.2.4" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" 281 | dependencies = [ 282 | "os_str_bytes", 283 | ] 284 | 285 | [[package]] 286 | name = "codespan" 287 | version = "0.11.1" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "3362992a0d9f1dd7c3d0e89e0ab2bb540b7a95fea8cd798090e758fda2899b5e" 290 | dependencies = [ 291 | "codespan-reporting", 292 | "serde", 293 | ] 294 | 295 | [[package]] 296 | name = "codespan-reporting" 297 | version = "0.11.1" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 300 | dependencies = [ 301 | "serde", 302 | "termcolor", 303 | "unicode-width", 304 | ] 305 | 306 | [[package]] 307 | name = "colored" 308 | version = "2.0.0" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" 311 | dependencies = [ 312 | "atty", 313 | "lazy_static", 314 | "winapi", 315 | ] 316 | 317 | [[package]] 318 | name = "cpufeatures" 319 | version = "0.2.2" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" 322 | dependencies = [ 323 | "libc", 324 | ] 325 | 326 | [[package]] 327 | name = "cpuid-bool" 328 | version = "0.2.0" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" 331 | 332 | [[package]] 333 | name = "crunchy" 334 | version = "0.2.2" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 337 | 338 | [[package]] 339 | name = "crypto-mac" 340 | version = "0.10.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" 343 | dependencies = [ 344 | "generic-array", 345 | "subtle", 346 | ] 347 | 348 | [[package]] 349 | name = "ctr" 350 | version = "0.6.0" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" 353 | dependencies = [ 354 | "cipher", 355 | ] 356 | 357 | [[package]] 358 | name = "curve25519-dalek-fiat" 359 | version = "0.1.0" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | checksum = "44339b9ecede7f72a0d3b012bf9bb5a616dc8bfde23ce544e42da075c87198f0" 362 | dependencies = [ 363 | "byteorder", 364 | "digest", 365 | "fiat-crypto", 366 | "rand_core", 367 | "subtle", 368 | "zeroize", 369 | ] 370 | 371 | [[package]] 372 | name = "data-encoding" 373 | version = "2.3.2" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" 376 | 377 | [[package]] 378 | name = "datatest-stable" 379 | version = "0.1.1" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "a0ff02642cff6f40d39f61c8d51cb394fd313e1aa2057833b91ad788c4e9331f" 382 | dependencies = [ 383 | "regex", 384 | "structopt", 385 | "termcolor", 386 | "walkdir", 387 | ] 388 | 389 | [[package]] 390 | name = "diem-crypto" 391 | version = "0.0.3" 392 | source = "git+https://github.com/pym-labs/starcoin-crypto?rev=ada7f71f3585670106e356f82a8d817e8115b41b#ada7f71f3585670106e356f82a8d817e8115b41b" 393 | dependencies = [ 394 | "aes-gcm", 395 | "anyhow", 396 | "bcs", 397 | "bindgen", 398 | "bytes", 399 | "cc", 400 | "curve25519-dalek-fiat", 401 | "diem-crypto-derive", 402 | "digest", 403 | "ed25519-dalek-fiat", 404 | "hex", 405 | "hkdf", 406 | "libc", 407 | "mirai-annotations", 408 | "once_cell", 409 | "proptest", 410 | "proptest-derive", 411 | "rand", 412 | "rand_core", 413 | "schemars", 414 | "serde", 415 | "serde-name 0.1.2", 416 | "serde_bytes", 417 | "sha2", 418 | "static_assertions", 419 | "thiserror", 420 | "tiny-keccak", 421 | "x25519-dalek-fiat", 422 | ] 423 | 424 | [[package]] 425 | name = "diem-crypto-derive" 426 | version = "0.0.3" 427 | source = "git+https://github.com/pym-labs/starcoin-crypto?rev=ada7f71f3585670106e356f82a8d817e8115b41b#ada7f71f3585670106e356f82a8d817e8115b41b" 428 | dependencies = [ 429 | "proc-macro2 1.0.38", 430 | "quote 1.0.18", 431 | "syn 1.0.94", 432 | ] 433 | 434 | [[package]] 435 | name = "difference" 436 | version = "2.0.0" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 439 | 440 | [[package]] 441 | name = "digest" 442 | version = "0.9.0" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 445 | dependencies = [ 446 | "generic-array", 447 | ] 448 | 449 | [[package]] 450 | name = "dyn-clone" 451 | version = "1.0.5" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" 454 | 455 | [[package]] 456 | name = "ed25519" 457 | version = "1.5.2" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" 460 | dependencies = [ 461 | "serde", 462 | "signature", 463 | ] 464 | 465 | [[package]] 466 | name = "ed25519-dalek-fiat" 467 | version = "0.1.0" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "97c6ac152eba578c1c53d2cefe8ad02e239e3d6f971b0f1ef3cb54cd66037fa0" 470 | dependencies = [ 471 | "curve25519-dalek-fiat", 472 | "ed25519", 473 | "rand", 474 | "serde", 475 | "serde_bytes", 476 | "sha2", 477 | "zeroize", 478 | ] 479 | 480 | [[package]] 481 | name = "either" 482 | version = "1.8.0" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" 485 | 486 | [[package]] 487 | name = "env_logger" 488 | version = "0.9.1" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" 491 | dependencies = [ 492 | "atty", 493 | "humantime", 494 | "log", 495 | "regex", 496 | "termcolor", 497 | ] 498 | 499 | [[package]] 500 | name = "fastrand" 501 | version = "1.7.0" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" 504 | dependencies = [ 505 | "instant", 506 | ] 507 | 508 | [[package]] 509 | name = "fiat-crypto" 510 | version = "0.1.17" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" 513 | 514 | [[package]] 515 | name = "fixedbitset" 516 | version = "0.2.0" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" 519 | 520 | [[package]] 521 | name = "form_urlencoded" 522 | version = "1.0.1" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 525 | dependencies = [ 526 | "matches", 527 | "percent-encoding", 528 | ] 529 | 530 | [[package]] 531 | name = "generic-array" 532 | version = "0.14.5" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" 535 | dependencies = [ 536 | "typenum", 537 | "version_check", 538 | ] 539 | 540 | [[package]] 541 | name = "getopts" 542 | version = "0.2.21" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" 545 | dependencies = [ 546 | "unicode-width", 547 | ] 548 | 549 | [[package]] 550 | name = "getrandom" 551 | version = "0.2.6" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" 554 | dependencies = [ 555 | "cfg-if", 556 | "libc", 557 | "wasi", 558 | ] 559 | 560 | [[package]] 561 | name = "ghash" 562 | version = "0.3.1" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" 565 | dependencies = [ 566 | "opaque-debug", 567 | "polyval", 568 | ] 569 | 570 | [[package]] 571 | name = "glob" 572 | version = "0.3.0" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" 575 | 576 | [[package]] 577 | name = "hashbrown" 578 | version = "0.11.2" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 581 | 582 | [[package]] 583 | name = "heck" 584 | version = "0.3.3" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 587 | dependencies = [ 588 | "unicode-segmentation", 589 | ] 590 | 591 | [[package]] 592 | name = "heck" 593 | version = "0.4.0" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" 596 | 597 | [[package]] 598 | name = "hermit-abi" 599 | version = "0.1.19" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 602 | dependencies = [ 603 | "libc", 604 | ] 605 | 606 | [[package]] 607 | name = "hex" 608 | version = "0.4.3" 609 | source = "registry+https://github.com/rust-lang/crates.io-index" 610 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 611 | 612 | [[package]] 613 | name = "hkdf" 614 | version = "0.10.0" 615 | source = "registry+https://github.com/rust-lang/crates.io-index" 616 | checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" 617 | dependencies = [ 618 | "digest", 619 | "hmac", 620 | ] 621 | 622 | [[package]] 623 | name = "hmac" 624 | version = "0.10.1" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" 627 | dependencies = [ 628 | "crypto-mac", 629 | "digest", 630 | ] 631 | 632 | [[package]] 633 | name = "humantime" 634 | version = "2.1.0" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 637 | 638 | [[package]] 639 | name = "idna" 640 | version = "0.2.3" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 643 | dependencies = [ 644 | "matches", 645 | "unicode-bidi", 646 | "unicode-normalization", 647 | ] 648 | 649 | [[package]] 650 | name = "indexmap" 651 | version = "1.8.1" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" 654 | dependencies = [ 655 | "autocfg", 656 | "hashbrown", 657 | ] 658 | 659 | [[package]] 660 | name = "instant" 661 | version = "0.1.12" 662 | source = "registry+https://github.com/rust-lang/crates.io-index" 663 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 664 | dependencies = [ 665 | "cfg-if", 666 | ] 667 | 668 | [[package]] 669 | name = "itoa" 670 | version = "1.0.1" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 673 | 674 | [[package]] 675 | name = "lazy_static" 676 | version = "1.4.0" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 679 | 680 | [[package]] 681 | name = "lazycell" 682 | version = "1.3.0" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" 685 | 686 | [[package]] 687 | name = "libc" 688 | version = "0.2.125" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" 691 | 692 | [[package]] 693 | name = "libloading" 694 | version = "0.7.3" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" 697 | dependencies = [ 698 | "cfg-if", 699 | "winapi", 700 | ] 701 | 702 | [[package]] 703 | name = "log" 704 | version = "0.4.17" 705 | source = "registry+https://github.com/rust-lang/crates.io-index" 706 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 707 | dependencies = [ 708 | "cfg-if", 709 | ] 710 | 711 | [[package]] 712 | name = "matches" 713 | version = "0.1.9" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 716 | 717 | [[package]] 718 | name = "memchr" 719 | version = "2.5.0" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 722 | 723 | [[package]] 724 | name = "minimal-lexical" 725 | version = "0.2.1" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 728 | 729 | [[package]] 730 | name = "mirai-annotations" 731 | version = "1.12.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" 734 | 735 | [[package]] 736 | name = "move-binary-format" 737 | version = "0.0.3" 738 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 739 | dependencies = [ 740 | "anyhow", 741 | "mirai-annotations", 742 | "move-core-types", 743 | "once_cell", 744 | "ref-cast", 745 | "serde", 746 | "variant_count", 747 | ] 748 | 749 | [[package]] 750 | name = "move-borrow-graph" 751 | version = "0.0.1" 752 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 753 | dependencies = [ 754 | "mirai-annotations", 755 | ] 756 | 757 | [[package]] 758 | name = "move-bytecode-source-map" 759 | version = "0.1.0" 760 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 761 | dependencies = [ 762 | "anyhow", 763 | "bcs", 764 | "move-binary-format", 765 | "move-command-line-common", 766 | "move-core-types", 767 | "move-ir-types", 768 | "move-symbol-pool", 769 | "serde", 770 | ] 771 | 772 | [[package]] 773 | name = "move-bytecode-verifier" 774 | version = "0.1.0" 775 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 776 | dependencies = [ 777 | "anyhow", 778 | "mirai-annotations", 779 | "move-binary-format", 780 | "move-borrow-graph", 781 | "move-core-types", 782 | "petgraph", 783 | ] 784 | 785 | [[package]] 786 | name = "move-command-line-common" 787 | version = "0.1.0" 788 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 789 | dependencies = [ 790 | "anyhow", 791 | "difference", 792 | "hex", 793 | "serde", 794 | "sha2", 795 | "walkdir", 796 | ] 797 | 798 | [[package]] 799 | name = "move-compiler" 800 | version = "0.0.1" 801 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 802 | dependencies = [ 803 | "anyhow", 804 | "bcs", 805 | "clap 3.2.22", 806 | "codespan-reporting", 807 | "difference", 808 | "hex", 809 | "move-binary-format", 810 | "move-borrow-graph", 811 | "move-bytecode-source-map", 812 | "move-bytecode-verifier", 813 | "move-command-line-common", 814 | "move-core-types", 815 | "move-ir-to-bytecode", 816 | "move-ir-types", 817 | "move-symbol-pool", 818 | "num-bigint", 819 | "once_cell", 820 | "petgraph", 821 | "regex", 822 | "tempfile", 823 | "walkdir", 824 | ] 825 | 826 | [[package]] 827 | name = "move-core-types" 828 | version = "0.0.3" 829 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 830 | dependencies = [ 831 | "anyhow", 832 | "bcs", 833 | "bech32", 834 | "hex", 835 | "mirai-annotations", 836 | "once_cell", 837 | "rand", 838 | "ref-cast", 839 | "schemars", 840 | "serde", 841 | "serde_bytes", 842 | ] 843 | 844 | [[package]] 845 | name = "move-coverage" 846 | version = "0.1.0" 847 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 848 | dependencies = [ 849 | "anyhow", 850 | "bcs", 851 | "clap 3.2.22", 852 | "codespan", 853 | "colored", 854 | "move-binary-format", 855 | "move-bytecode-source-map", 856 | "move-command-line-common", 857 | "move-core-types", 858 | "move-ir-types", 859 | "once_cell", 860 | "petgraph", 861 | "serde", 862 | ] 863 | 864 | [[package]] 865 | name = "move-disassembler" 866 | version = "0.1.0" 867 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 868 | dependencies = [ 869 | "anyhow", 870 | "clap 3.2.22", 871 | "colored", 872 | "move-binary-format", 873 | "move-bytecode-source-map", 874 | "move-bytecode-verifier", 875 | "move-command-line-common", 876 | "move-compiler", 877 | "move-core-types", 878 | "move-coverage", 879 | "move-ir-types", 880 | ] 881 | 882 | [[package]] 883 | name = "move-ir-to-bytecode" 884 | version = "0.1.0" 885 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 886 | dependencies = [ 887 | "anyhow", 888 | "codespan-reporting", 889 | "log", 890 | "move-binary-format", 891 | "move-bytecode-source-map", 892 | "move-command-line-common", 893 | "move-core-types", 894 | "move-ir-to-bytecode-syntax", 895 | "move-ir-types", 896 | "move-symbol-pool", 897 | "ouroboros", 898 | "thiserror", 899 | ] 900 | 901 | [[package]] 902 | name = "move-ir-to-bytecode-syntax" 903 | version = "0.1.0" 904 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 905 | dependencies = [ 906 | "anyhow", 907 | "hex", 908 | "move-command-line-common", 909 | "move-core-types", 910 | "move-ir-types", 911 | "move-symbol-pool", 912 | ] 913 | 914 | [[package]] 915 | name = "move-ir-types" 916 | version = "0.1.0" 917 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 918 | dependencies = [ 919 | "anyhow", 920 | "hex", 921 | "move-command-line-common", 922 | "move-core-types", 923 | "move-symbol-pool", 924 | "once_cell", 925 | "serde", 926 | ] 927 | 928 | [[package]] 929 | name = "move-symbol-pool" 930 | version = "0.1.0" 931 | source = "git+https://github.com/starcoinorg/move?rev=4735fa59b63e1b30622411d8af65129e4c80b3bc#4735fa59b63e1b30622411d8af65129e4c80b3bc" 932 | dependencies = [ 933 | "once_cell", 934 | "serde", 935 | ] 936 | 937 | [[package]] 938 | name = "move-web" 939 | version = "0.1.0" 940 | dependencies = [ 941 | "anyhow", 942 | "base64", 943 | "bcs", 944 | "clap 3.2.22", 945 | "datatest-stable", 946 | "getopts", 947 | "hex", 948 | "move-binary-format", 949 | "move-bytecode-source-map", 950 | "move-command-line-common", 951 | "move-compiler", 952 | "move-core-types", 953 | "move-disassembler", 954 | "move-ir-types", 955 | "once_cell", 956 | "regex", 957 | "schemars", 958 | "serde", 959 | "serde_bytes", 960 | "serde_json", 961 | "starcoin-crypto", 962 | "tempfile", 963 | "walkdir", 964 | ] 965 | 966 | [[package]] 967 | name = "multiaddr" 968 | version = "0.13.0" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "48ee4ea82141951ac6379f964f71b20876d43712bea8faf6dd1a375e08a46499" 971 | dependencies = [ 972 | "arrayref", 973 | "bs58", 974 | "byteorder", 975 | "data-encoding", 976 | "multihash", 977 | "percent-encoding", 978 | "serde", 979 | "static_assertions", 980 | "unsigned-varint", 981 | "url", 982 | ] 983 | 984 | [[package]] 985 | name = "multihash" 986 | version = "0.14.0" 987 | source = "registry+https://github.com/rust-lang/crates.io-index" 988 | checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" 989 | dependencies = [ 990 | "generic-array", 991 | "multihash-derive", 992 | "unsigned-varint", 993 | ] 994 | 995 | [[package]] 996 | name = "multihash-derive" 997 | version = "0.7.2" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" 1000 | dependencies = [ 1001 | "proc-macro-crate", 1002 | "proc-macro-error", 1003 | "proc-macro2 1.0.38", 1004 | "quote 1.0.18", 1005 | "syn 1.0.94", 1006 | "synstructure", 1007 | ] 1008 | 1009 | [[package]] 1010 | name = "nom" 1011 | version = "7.1.1" 1012 | source = "registry+https://github.com/rust-lang/crates.io-index" 1013 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 1014 | dependencies = [ 1015 | "memchr", 1016 | "minimal-lexical", 1017 | ] 1018 | 1019 | [[package]] 1020 | name = "num-bigint" 1021 | version = "0.4.3" 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" 1023 | checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" 1024 | dependencies = [ 1025 | "autocfg", 1026 | "num-integer", 1027 | "num-traits", 1028 | ] 1029 | 1030 | [[package]] 1031 | name = "num-integer" 1032 | version = "0.1.45" 1033 | source = "registry+https://github.com/rust-lang/crates.io-index" 1034 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 1035 | dependencies = [ 1036 | "autocfg", 1037 | "num-traits", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "num-traits" 1042 | version = "0.2.15" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 1045 | dependencies = [ 1046 | "autocfg", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "once_cell" 1051 | version = "1.15.0" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" 1054 | 1055 | [[package]] 1056 | name = "opaque-debug" 1057 | version = "0.3.0" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 1060 | 1061 | [[package]] 1062 | name = "os_str_bytes" 1063 | version = "6.0.1" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435" 1066 | 1067 | [[package]] 1068 | name = "ouroboros" 1069 | version = "0.9.5" 1070 | source = "registry+https://github.com/rust-lang/crates.io-index" 1071 | checksum = "fbeff60e3e37407a80ead3e9458145b456e978c4068cddbfea6afb48572962ca" 1072 | dependencies = [ 1073 | "ouroboros_macro", 1074 | "stable_deref_trait", 1075 | ] 1076 | 1077 | [[package]] 1078 | name = "ouroboros_macro" 1079 | version = "0.9.5" 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" 1081 | checksum = "03f2cb802b5bdfdf52f1ffa0b54ce105e4d346e91990dd571f86c91321ad49e2" 1082 | dependencies = [ 1083 | "Inflector", 1084 | "proc-macro-error", 1085 | "proc-macro2 1.0.38", 1086 | "quote 1.0.18", 1087 | "syn 1.0.94", 1088 | ] 1089 | 1090 | [[package]] 1091 | name = "peeking_take_while" 1092 | version = "0.1.2" 1093 | source = "registry+https://github.com/rust-lang/crates.io-index" 1094 | checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" 1095 | 1096 | [[package]] 1097 | name = "percent-encoding" 1098 | version = "2.1.0" 1099 | source = "registry+https://github.com/rust-lang/crates.io-index" 1100 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 1101 | 1102 | [[package]] 1103 | name = "petgraph" 1104 | version = "0.5.1" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" 1107 | dependencies = [ 1108 | "fixedbitset", 1109 | "indexmap", 1110 | ] 1111 | 1112 | [[package]] 1113 | name = "polyval" 1114 | version = "0.4.5" 1115 | source = "registry+https://github.com/rust-lang/crates.io-index" 1116 | checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" 1117 | dependencies = [ 1118 | "cpuid-bool", 1119 | "opaque-debug", 1120 | "universal-hash", 1121 | ] 1122 | 1123 | [[package]] 1124 | name = "ppv-lite86" 1125 | version = "0.2.16" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 1128 | 1129 | [[package]] 1130 | name = "proc-macro-crate" 1131 | version = "1.1.3" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" 1134 | dependencies = [ 1135 | "thiserror", 1136 | "toml", 1137 | ] 1138 | 1139 | [[package]] 1140 | name = "proc-macro-error" 1141 | version = "1.0.4" 1142 | source = "registry+https://github.com/rust-lang/crates.io-index" 1143 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 1144 | dependencies = [ 1145 | "proc-macro-error-attr", 1146 | "proc-macro2 1.0.38", 1147 | "quote 1.0.18", 1148 | "syn 1.0.94", 1149 | "version_check", 1150 | ] 1151 | 1152 | [[package]] 1153 | name = "proc-macro-error-attr" 1154 | version = "1.0.4" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 1157 | dependencies = [ 1158 | "proc-macro2 1.0.38", 1159 | "quote 1.0.18", 1160 | "version_check", 1161 | ] 1162 | 1163 | [[package]] 1164 | name = "proc-macro2" 1165 | version = "0.4.30" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" 1168 | dependencies = [ 1169 | "unicode-xid 0.1.0", 1170 | ] 1171 | 1172 | [[package]] 1173 | name = "proc-macro2" 1174 | version = "1.0.38" 1175 | source = "registry+https://github.com/rust-lang/crates.io-index" 1176 | checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" 1177 | dependencies = [ 1178 | "unicode-xid 0.2.3", 1179 | ] 1180 | 1181 | [[package]] 1182 | name = "proptest" 1183 | version = "1.0.0" 1184 | source = "registry+https://github.com/rust-lang/crates.io-index" 1185 | checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5" 1186 | dependencies = [ 1187 | "bitflags", 1188 | "byteorder", 1189 | "lazy_static", 1190 | "num-traits", 1191 | "quick-error", 1192 | "rand", 1193 | "rand_chacha", 1194 | "rand_xorshift", 1195 | "regex-syntax", 1196 | ] 1197 | 1198 | [[package]] 1199 | name = "proptest-derive" 1200 | version = "0.3.0" 1201 | source = "registry+https://github.com/rust-lang/crates.io-index" 1202 | checksum = "90b46295382dc76166cb7cf2bb4a97952464e4b7ed5a43e6cd34e1fec3349ddc" 1203 | dependencies = [ 1204 | "proc-macro2 0.4.30", 1205 | "quote 0.6.13", 1206 | "syn 0.15.44", 1207 | ] 1208 | 1209 | [[package]] 1210 | name = "quick-error" 1211 | version = "2.0.1" 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" 1213 | checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" 1214 | 1215 | [[package]] 1216 | name = "quote" 1217 | version = "0.6.13" 1218 | source = "registry+https://github.com/rust-lang/crates.io-index" 1219 | checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 1220 | dependencies = [ 1221 | "proc-macro2 0.4.30", 1222 | ] 1223 | 1224 | [[package]] 1225 | name = "quote" 1226 | version = "1.0.18" 1227 | source = "registry+https://github.com/rust-lang/crates.io-index" 1228 | checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" 1229 | dependencies = [ 1230 | "proc-macro2 1.0.38", 1231 | ] 1232 | 1233 | [[package]] 1234 | name = "rand" 1235 | version = "0.8.5" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1238 | dependencies = [ 1239 | "libc", 1240 | "rand_chacha", 1241 | "rand_core", 1242 | ] 1243 | 1244 | [[package]] 1245 | name = "rand_chacha" 1246 | version = "0.3.1" 1247 | source = "registry+https://github.com/rust-lang/crates.io-index" 1248 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1249 | dependencies = [ 1250 | "ppv-lite86", 1251 | "rand_core", 1252 | ] 1253 | 1254 | [[package]] 1255 | name = "rand_core" 1256 | version = "0.6.3" 1257 | source = "registry+https://github.com/rust-lang/crates.io-index" 1258 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 1259 | dependencies = [ 1260 | "getrandom", 1261 | ] 1262 | 1263 | [[package]] 1264 | name = "rand_xorshift" 1265 | version = "0.3.0" 1266 | source = "registry+https://github.com/rust-lang/crates.io-index" 1267 | checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" 1268 | dependencies = [ 1269 | "rand_core", 1270 | ] 1271 | 1272 | [[package]] 1273 | name = "redox_syscall" 1274 | version = "0.2.13" 1275 | source = "registry+https://github.com/rust-lang/crates.io-index" 1276 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" 1277 | dependencies = [ 1278 | "bitflags", 1279 | ] 1280 | 1281 | [[package]] 1282 | name = "ref-cast" 1283 | version = "1.0.7" 1284 | source = "registry+https://github.com/rust-lang/crates.io-index" 1285 | checksum = "685d58625b6c2b83e4cc88a27c4bf65adb7b6b16dbdc413e515c9405b47432ab" 1286 | dependencies = [ 1287 | "ref-cast-impl", 1288 | ] 1289 | 1290 | [[package]] 1291 | name = "ref-cast-impl" 1292 | version = "1.0.7" 1293 | source = "registry+https://github.com/rust-lang/crates.io-index" 1294 | checksum = "a043824e29c94169374ac5183ac0ed43f5724dc4556b19568007486bd840fa1f" 1295 | dependencies = [ 1296 | "proc-macro2 1.0.38", 1297 | "quote 1.0.18", 1298 | "syn 1.0.94", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "regex" 1303 | version = "1.5.5" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" 1306 | dependencies = [ 1307 | "aho-corasick", 1308 | "memchr", 1309 | "regex-syntax", 1310 | ] 1311 | 1312 | [[package]] 1313 | name = "regex-syntax" 1314 | version = "0.6.25" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 1317 | 1318 | [[package]] 1319 | name = "remove_dir_all" 1320 | version = "0.5.3" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1323 | dependencies = [ 1324 | "winapi", 1325 | ] 1326 | 1327 | [[package]] 1328 | name = "rustc-hash" 1329 | version = "1.1.0" 1330 | source = "registry+https://github.com/rust-lang/crates.io-index" 1331 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1332 | 1333 | [[package]] 1334 | name = "ryu" 1335 | version = "1.0.9" 1336 | source = "registry+https://github.com/rust-lang/crates.io-index" 1337 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 1338 | 1339 | [[package]] 1340 | name = "same-file" 1341 | version = "1.0.6" 1342 | source = "registry+https://github.com/rust-lang/crates.io-index" 1343 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1344 | dependencies = [ 1345 | "winapi-util", 1346 | ] 1347 | 1348 | [[package]] 1349 | name = "schemars" 1350 | version = "0.8.8" 1351 | source = "git+https://github.com/starcoinorg/schemars?rev=6972da92f4360e1779168bb3fe0274c521d324e2#6972da92f4360e1779168bb3fe0274c521d324e2" 1352 | dependencies = [ 1353 | "dyn-clone", 1354 | "multiaddr", 1355 | "schemars_derive", 1356 | "serde", 1357 | "serde_json", 1358 | ] 1359 | 1360 | [[package]] 1361 | name = "schemars_derive" 1362 | version = "0.8.8" 1363 | source = "git+https://github.com/starcoinorg/schemars?rev=6972da92f4360e1779168bb3fe0274c521d324e2#6972da92f4360e1779168bb3fe0274c521d324e2" 1364 | dependencies = [ 1365 | "proc-macro2 1.0.38", 1366 | "quote 1.0.18", 1367 | "serde_derive_internals", 1368 | "syn 1.0.94", 1369 | ] 1370 | 1371 | [[package]] 1372 | name = "serde" 1373 | version = "1.0.137" 1374 | source = "registry+https://github.com/rust-lang/crates.io-index" 1375 | checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" 1376 | dependencies = [ 1377 | "serde_derive", 1378 | ] 1379 | 1380 | [[package]] 1381 | name = "serde-name" 1382 | version = "0.1.2" 1383 | source = "registry+https://github.com/rust-lang/crates.io-index" 1384 | checksum = "12c47087018ec281d1cdab673d36aea22d816b54d498264029c05d5fa1910da6" 1385 | dependencies = [ 1386 | "serde", 1387 | "thiserror", 1388 | ] 1389 | 1390 | [[package]] 1391 | name = "serde-name" 1392 | version = "0.2.1" 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" 1394 | checksum = "3b5b14ebbcc4e4f2b3642fa99c388649da58d1dc3308c7d109f39f565d1710f0" 1395 | dependencies = [ 1396 | "serde", 1397 | "thiserror", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "serde_bytes" 1402 | version = "0.11.6" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" 1405 | dependencies = [ 1406 | "serde", 1407 | ] 1408 | 1409 | [[package]] 1410 | name = "serde_derive" 1411 | version = "1.0.137" 1412 | source = "registry+https://github.com/rust-lang/crates.io-index" 1413 | checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" 1414 | dependencies = [ 1415 | "proc-macro2 1.0.38", 1416 | "quote 1.0.18", 1417 | "syn 1.0.94", 1418 | ] 1419 | 1420 | [[package]] 1421 | name = "serde_derive_internals" 1422 | version = "0.25.0" 1423 | source = "registry+https://github.com/rust-lang/crates.io-index" 1424 | checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" 1425 | dependencies = [ 1426 | "proc-macro2 1.0.38", 1427 | "quote 1.0.18", 1428 | "syn 1.0.94", 1429 | ] 1430 | 1431 | [[package]] 1432 | name = "serde_json" 1433 | version = "1.0.81" 1434 | source = "registry+https://github.com/rust-lang/crates.io-index" 1435 | checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" 1436 | dependencies = [ 1437 | "itoa", 1438 | "ryu", 1439 | "serde", 1440 | ] 1441 | 1442 | [[package]] 1443 | name = "sha2" 1444 | version = "0.9.9" 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" 1446 | checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" 1447 | dependencies = [ 1448 | "block-buffer", 1449 | "cfg-if", 1450 | "cpufeatures", 1451 | "digest", 1452 | "opaque-debug", 1453 | ] 1454 | 1455 | [[package]] 1456 | name = "shlex" 1457 | version = "1.1.0" 1458 | source = "registry+https://github.com/rust-lang/crates.io-index" 1459 | checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" 1460 | 1461 | [[package]] 1462 | name = "signature" 1463 | version = "1.6.4" 1464 | source = "registry+https://github.com/rust-lang/crates.io-index" 1465 | checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" 1466 | 1467 | [[package]] 1468 | name = "stable_deref_trait" 1469 | version = "1.2.0" 1470 | source = "registry+https://github.com/rust-lang/crates.io-index" 1471 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1472 | 1473 | [[package]] 1474 | name = "starcoin-crypto" 1475 | version = "1.10.0-rc.2" 1476 | source = "git+https://github.com/pym-labs/starcoin-crypto?rev=ada7f71f3585670106e356f82a8d817e8115b41b#ada7f71f3585670106e356f82a8d817e8115b41b" 1477 | dependencies = [ 1478 | "anyhow", 1479 | "bcs", 1480 | "diem-crypto", 1481 | "diem-crypto-derive", 1482 | "hex", 1483 | "once_cell", 1484 | "rand", 1485 | "rand_core", 1486 | "serde", 1487 | "serde-name 0.2.1", 1488 | "serde_bytes", 1489 | "starcoin-crypto-macro", 1490 | ] 1491 | 1492 | [[package]] 1493 | name = "starcoin-crypto-macro" 1494 | version = "1.10.0-rc.2" 1495 | source = "git+https://github.com/pym-labs/starcoin-crypto?rev=ada7f71f3585670106e356f82a8d817e8115b41b#ada7f71f3585670106e356f82a8d817e8115b41b" 1496 | dependencies = [ 1497 | "proc-macro2 1.0.38", 1498 | "quote 1.0.18", 1499 | "syn 1.0.94", 1500 | ] 1501 | 1502 | [[package]] 1503 | name = "static_assertions" 1504 | version = "1.1.0" 1505 | source = "registry+https://github.com/rust-lang/crates.io-index" 1506 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1507 | 1508 | [[package]] 1509 | name = "strsim" 1510 | version = "0.8.0" 1511 | source = "registry+https://github.com/rust-lang/crates.io-index" 1512 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 1513 | 1514 | [[package]] 1515 | name = "strsim" 1516 | version = "0.10.0" 1517 | source = "registry+https://github.com/rust-lang/crates.io-index" 1518 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1519 | 1520 | [[package]] 1521 | name = "structopt" 1522 | version = "0.3.26" 1523 | source = "registry+https://github.com/rust-lang/crates.io-index" 1524 | checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" 1525 | dependencies = [ 1526 | "clap 2.34.0", 1527 | "lazy_static", 1528 | "structopt-derive", 1529 | ] 1530 | 1531 | [[package]] 1532 | name = "structopt-derive" 1533 | version = "0.4.18" 1534 | source = "registry+https://github.com/rust-lang/crates.io-index" 1535 | checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" 1536 | dependencies = [ 1537 | "heck 0.3.3", 1538 | "proc-macro-error", 1539 | "proc-macro2 1.0.38", 1540 | "quote 1.0.18", 1541 | "syn 1.0.94", 1542 | ] 1543 | 1544 | [[package]] 1545 | name = "subtle" 1546 | version = "2.4.1" 1547 | source = "registry+https://github.com/rust-lang/crates.io-index" 1548 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 1549 | 1550 | [[package]] 1551 | name = "syn" 1552 | version = "0.15.44" 1553 | source = "registry+https://github.com/rust-lang/crates.io-index" 1554 | checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 1555 | dependencies = [ 1556 | "proc-macro2 0.4.30", 1557 | "quote 0.6.13", 1558 | "unicode-xid 0.1.0", 1559 | ] 1560 | 1561 | [[package]] 1562 | name = "syn" 1563 | version = "1.0.94" 1564 | source = "registry+https://github.com/rust-lang/crates.io-index" 1565 | checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" 1566 | dependencies = [ 1567 | "proc-macro2 1.0.38", 1568 | "quote 1.0.18", 1569 | "unicode-xid 0.2.3", 1570 | ] 1571 | 1572 | [[package]] 1573 | name = "synstructure" 1574 | version = "0.12.6" 1575 | source = "registry+https://github.com/rust-lang/crates.io-index" 1576 | checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" 1577 | dependencies = [ 1578 | "proc-macro2 1.0.38", 1579 | "quote 1.0.18", 1580 | "syn 1.0.94", 1581 | "unicode-xid 0.2.3", 1582 | ] 1583 | 1584 | [[package]] 1585 | name = "tempfile" 1586 | version = "3.3.0" 1587 | source = "registry+https://github.com/rust-lang/crates.io-index" 1588 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 1589 | dependencies = [ 1590 | "cfg-if", 1591 | "fastrand", 1592 | "libc", 1593 | "redox_syscall", 1594 | "remove_dir_all", 1595 | "winapi", 1596 | ] 1597 | 1598 | [[package]] 1599 | name = "termcolor" 1600 | version = "1.1.3" 1601 | source = "registry+https://github.com/rust-lang/crates.io-index" 1602 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 1603 | dependencies = [ 1604 | "winapi-util", 1605 | ] 1606 | 1607 | [[package]] 1608 | name = "textwrap" 1609 | version = "0.11.0" 1610 | source = "registry+https://github.com/rust-lang/crates.io-index" 1611 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 1612 | dependencies = [ 1613 | "unicode-width", 1614 | ] 1615 | 1616 | [[package]] 1617 | name = "textwrap" 1618 | version = "0.15.1" 1619 | source = "registry+https://github.com/rust-lang/crates.io-index" 1620 | checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" 1621 | 1622 | [[package]] 1623 | name = "thiserror" 1624 | version = "1.0.31" 1625 | source = "registry+https://github.com/rust-lang/crates.io-index" 1626 | checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" 1627 | dependencies = [ 1628 | "thiserror-impl", 1629 | ] 1630 | 1631 | [[package]] 1632 | name = "thiserror-impl" 1633 | version = "1.0.31" 1634 | source = "registry+https://github.com/rust-lang/crates.io-index" 1635 | checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" 1636 | dependencies = [ 1637 | "proc-macro2 1.0.38", 1638 | "quote 1.0.18", 1639 | "syn 1.0.94", 1640 | ] 1641 | 1642 | [[package]] 1643 | name = "tiny-keccak" 1644 | version = "2.0.2" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" 1647 | dependencies = [ 1648 | "crunchy", 1649 | ] 1650 | 1651 | [[package]] 1652 | name = "tinyvec" 1653 | version = "1.6.0" 1654 | source = "registry+https://github.com/rust-lang/crates.io-index" 1655 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1656 | dependencies = [ 1657 | "tinyvec_macros", 1658 | ] 1659 | 1660 | [[package]] 1661 | name = "tinyvec_macros" 1662 | version = "0.1.0" 1663 | source = "registry+https://github.com/rust-lang/crates.io-index" 1664 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1665 | 1666 | [[package]] 1667 | name = "toml" 1668 | version = "0.5.9" 1669 | source = "registry+https://github.com/rust-lang/crates.io-index" 1670 | checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" 1671 | dependencies = [ 1672 | "serde", 1673 | ] 1674 | 1675 | [[package]] 1676 | name = "typenum" 1677 | version = "1.15.0" 1678 | source = "registry+https://github.com/rust-lang/crates.io-index" 1679 | checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" 1680 | 1681 | [[package]] 1682 | name = "unicode-bidi" 1683 | version = "0.3.8" 1684 | source = "registry+https://github.com/rust-lang/crates.io-index" 1685 | checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" 1686 | 1687 | [[package]] 1688 | name = "unicode-normalization" 1689 | version = "0.1.19" 1690 | source = "registry+https://github.com/rust-lang/crates.io-index" 1691 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 1692 | dependencies = [ 1693 | "tinyvec", 1694 | ] 1695 | 1696 | [[package]] 1697 | name = "unicode-segmentation" 1698 | version = "1.9.0" 1699 | source = "registry+https://github.com/rust-lang/crates.io-index" 1700 | checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" 1701 | 1702 | [[package]] 1703 | name = "unicode-width" 1704 | version = "0.1.9" 1705 | source = "registry+https://github.com/rust-lang/crates.io-index" 1706 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 1707 | 1708 | [[package]] 1709 | name = "unicode-xid" 1710 | version = "0.1.0" 1711 | source = "registry+https://github.com/rust-lang/crates.io-index" 1712 | checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1713 | 1714 | [[package]] 1715 | name = "unicode-xid" 1716 | version = "0.2.3" 1717 | source = "registry+https://github.com/rust-lang/crates.io-index" 1718 | checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" 1719 | 1720 | [[package]] 1721 | name = "universal-hash" 1722 | version = "0.4.1" 1723 | source = "registry+https://github.com/rust-lang/crates.io-index" 1724 | checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" 1725 | dependencies = [ 1726 | "generic-array", 1727 | "subtle", 1728 | ] 1729 | 1730 | [[package]] 1731 | name = "unsigned-varint" 1732 | version = "0.7.1" 1733 | source = "registry+https://github.com/rust-lang/crates.io-index" 1734 | checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" 1735 | 1736 | [[package]] 1737 | name = "url" 1738 | version = "2.2.2" 1739 | source = "registry+https://github.com/rust-lang/crates.io-index" 1740 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1741 | dependencies = [ 1742 | "form_urlencoded", 1743 | "idna", 1744 | "matches", 1745 | "percent-encoding", 1746 | ] 1747 | 1748 | [[package]] 1749 | name = "variant_count" 1750 | version = "1.1.0" 1751 | source = "registry+https://github.com/rust-lang/crates.io-index" 1752 | checksum = "aae2faf80ac463422992abf4de234731279c058aaf33171ca70277c98406b124" 1753 | dependencies = [ 1754 | "quote 1.0.18", 1755 | "syn 1.0.94", 1756 | ] 1757 | 1758 | [[package]] 1759 | name = "vec_map" 1760 | version = "0.8.2" 1761 | source = "registry+https://github.com/rust-lang/crates.io-index" 1762 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 1763 | 1764 | [[package]] 1765 | name = "version_check" 1766 | version = "0.9.4" 1767 | source = "registry+https://github.com/rust-lang/crates.io-index" 1768 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1769 | 1770 | [[package]] 1771 | name = "walkdir" 1772 | version = "2.3.2" 1773 | source = "registry+https://github.com/rust-lang/crates.io-index" 1774 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 1775 | dependencies = [ 1776 | "same-file", 1777 | "winapi", 1778 | "winapi-util", 1779 | ] 1780 | 1781 | [[package]] 1782 | name = "wasi" 1783 | version = "0.10.2+wasi-snapshot-preview1" 1784 | source = "registry+https://github.com/rust-lang/crates.io-index" 1785 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1786 | 1787 | [[package]] 1788 | name = "which" 1789 | version = "4.3.0" 1790 | source = "registry+https://github.com/rust-lang/crates.io-index" 1791 | checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" 1792 | dependencies = [ 1793 | "either", 1794 | "libc", 1795 | "once_cell", 1796 | ] 1797 | 1798 | [[package]] 1799 | name = "winapi" 1800 | version = "0.3.9" 1801 | source = "registry+https://github.com/rust-lang/crates.io-index" 1802 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1803 | dependencies = [ 1804 | "winapi-i686-pc-windows-gnu", 1805 | "winapi-x86_64-pc-windows-gnu", 1806 | ] 1807 | 1808 | [[package]] 1809 | name = "winapi-i686-pc-windows-gnu" 1810 | version = "0.4.0" 1811 | source = "registry+https://github.com/rust-lang/crates.io-index" 1812 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1813 | 1814 | [[package]] 1815 | name = "winapi-util" 1816 | version = "0.1.5" 1817 | source = "registry+https://github.com/rust-lang/crates.io-index" 1818 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1819 | dependencies = [ 1820 | "winapi", 1821 | ] 1822 | 1823 | [[package]] 1824 | name = "winapi-x86_64-pc-windows-gnu" 1825 | version = "0.4.0" 1826 | source = "registry+https://github.com/rust-lang/crates.io-index" 1827 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1828 | 1829 | [[package]] 1830 | name = "x25519-dalek-fiat" 1831 | version = "0.1.0" 1832 | source = "registry+https://github.com/rust-lang/crates.io-index" 1833 | checksum = "2f3519d56987103ef084eba6ddfc3be45b7eaee08f2d60bc8495cdca30362a32" 1834 | dependencies = [ 1835 | "curve25519-dalek-fiat", 1836 | "rand_core", 1837 | "zeroize", 1838 | ] 1839 | 1840 | [[package]] 1841 | name = "zeroize" 1842 | version = "1.5.7" 1843 | source = "registry+https://github.com/rust-lang/crates.io-index" 1844 | checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" 1845 | dependencies = [ 1846 | "zeroize_derive", 1847 | ] 1848 | 1849 | [[package]] 1850 | name = "zeroize_derive" 1851 | version = "1.3.2" 1852 | source = "registry+https://github.com/rust-lang/crates.io-index" 1853 | checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" 1854 | dependencies = [ 1855 | "proc-macro2 1.0.38", 1856 | "quote 1.0.18", 1857 | "syn 1.0.94", 1858 | "synstructure", 1859 | ] 1860 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "move-web" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | anyhow = "1.0.41" 10 | once_cell = "1.10.0" 11 | tempfile = "3.1.0" 12 | regex = { version = "1.5.4", default-features = false, features = ["std", "perf"] } 13 | datatest-stable = "0.1.1" 14 | base64 = "0.13.0" 15 | walkdir = "2" 16 | getopts = "0.2" 17 | serde = { version = "1.0.130", default-features = false } 18 | serde_json = { version = "1.0", features = ["arbitrary_precision"] } 19 | serde_bytes = "0.11.5" 20 | hex = "0.4.3" 21 | bcs = "0.1.3" 22 | clap = "3.2.22" 23 | 24 | schemars = {git = "https://github.com/starcoinorg/schemars", rev = "6972da92f4360e1779168bb3fe0274c521d324e2"} 25 | move-core-types = { git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc" } 26 | move-compiler = { package="move-compiler", git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc" } 27 | move-command-line-common = {git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc"} 28 | move-binary-format = { git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc" } 29 | move-disassembler = {git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc"} 30 | move-bytecode-source-map = {git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc"} 31 | move-ir-types = {git = "https://github.com/starcoinorg/move", rev = "4735fa59b63e1b30622411d8af65129e4c80b3bc"} 32 | starcoin-crypto = {git = "https://github.com/pym-labs/starcoin-crypto", rev = "ada7f71f3585670106e356f82a8d817e8115b41b"} 33 | 34 | [[bin]] 35 | name = "move-web" 36 | path = "src/main.rs" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # move-js 2 | 3 | Javascript version of the move language compiler and disassemble 4 | 5 | ## Features 6 | - Compiling move package into blob 7 | - Disassemble contract 8 | 9 | ## Example 10 | 11 | * Compiling move package into blob example 12 | ```ts 13 | import { WasmFs } from '@wasmer/wasmfs' 14 | import { Git, MovePackage } from '@starcoin/move-js' 15 | 16 | const startWasiTask = async () => { 17 | const wasmfs = new WasmFs() 18 | const git = new Git(wasmfs) 19 | 20 | await git.download("/data/starcoin-framework.zip", "/workspace/starcoin-framework") 21 | await git.download("/data/my-counter.zip", "/workspace/my-counter") 22 | 23 | const mp = new MovePackage(wasmfs, { 24 | packagePath: "/workspace/my-counter", 25 | test: false, 26 | alias: new Map([ 27 | ["StarcoinFramework", "/workspace/starcoin-framework"] 28 | ]), 29 | initFunction: "0xABCDE::MyCounter::init" 30 | }) 31 | 32 | await mp.build() 33 | 34 | const blobBuf = wasmfs.fs.readFileSync("/workspace/my-counter/target/starcoin/release/package.blob") 35 | const base64Data = blobBuf.toString("base64") 36 | console.log("my-counter blob:", base64Data) 37 | } 38 | 39 | startWasiTask() 40 | ``` 41 | 42 | * Disassemble contract example 43 | ```ts 44 | import { WasmFs } from '@wasmer/wasmfs' 45 | import { Disassemble } from '@starcoin/move-js' 46 | 47 | const startDisassembleTask = async (app: HTMLDivElement) => { 48 | const wasmfs = new WasmFs() 49 | 50 | const dp = new Disassemble(wasmfs) 51 | 52 | // Chain code 53 | const account_scripts = "you code" 54 | 55 | dp.disassemble("account_scripts", account_scripts, (ok: boolean, data: string) => { 56 | console.log(ok) 57 | console.log(data) 58 | }) 59 | 60 | app.innerHTML = ` 61 |

view disassemble in console:

62 | ` 63 | } 64 | 65 | const app = document.querySelector('#app')! 66 | startDisassembleTask(app) 67 | ``` 68 | -------------------------------------------------------------------------------- /examples/disassemble/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /examples/disassemble/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/disassemble/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/disassemble/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "disassemble", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "tsc && vite build", 8 | "preview": "vite preview" 9 | }, 10 | "devDependencies": { 11 | "typescript": "^4.5.4", 12 | "vite": "^2.9.9" 13 | }, 14 | "dependencies": { 15 | "@wasmer/wasi": "^0.12.0", 16 | "@wasmer/wasm-transformer": "^0.10.0", 17 | "@wasmer/wasmfs": "^0.12.0", 18 | "@starcoin/move-js": "../../" 19 | } 20 | } -------------------------------------------------------------------------------- /examples/disassemble/public/data/my-counter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/examples/disassemble/public/data/my-counter.zip -------------------------------------------------------------------------------- /examples/disassemble/public/data/starcoin-framework.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/examples/disassemble/public/data/starcoin-framework.zip -------------------------------------------------------------------------------- /examples/disassemble/src/main.ts: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | 3 | import { WasmFs } from '@wasmer/wasmfs' 4 | import { Disassemble } from '@starcoin/move-js' 5 | 6 | const startDisassembleTask = async (app: HTMLDivElement) => { 7 | const wasmfs = new WasmFs() 8 | 9 | const dp = new Disassemble(wasmfs) 10 | 11 | //Chain code 12 | //0x1::Account::AccountScripts 13 | const account_scripts = "0xa11ceb0b040000000601000403040f051307071a60087a100c8a011800000001000200010000030001000104020100010c0002060c010e4163636f756e7453637269707473074163636f756e741964697361626c655f6175746f5f6163636570745f746f6b656e18656e61626c655f6175746f5f6163636570745f746f6b656e157365745f6175746f5f6163636570745f746f6b656e000000000000000000000000000000010002000001040e00091102020102000001040e000811020200" 14 | 15 | dp.disassemble("account_scripts", account_scripts, (ok: boolean, data: string) => { 16 | console.log(ok) 17 | console.log(data) 18 | }) 19 | 20 | app.innerHTML = ` 21 |

view disassemble in console:

22 | ` 23 | } 24 | 25 | const app = document.querySelector('#app')! 26 | startDisassembleTask(app) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /examples/disassemble/src/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | text-align: center; 6 | color: #2c3e50; 7 | margin-top: 60px; 8 | } 9 | -------------------------------------------------------------------------------- /examples/disassemble/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/disassemble/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ESNext", "DOM"], 7 | "moduleResolution": "Node", 8 | "strict": true, 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noEmit": true, 14 | "noUnusedLocals": true, 15 | "noUnusedParameters": true, 16 | "noImplicitReturns": true, 17 | "skipLibCheck": true 18 | }, 19 | "include": ["src"] 20 | } 21 | -------------------------------------------------------------------------------- /examples/disassemble/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@iarna/toml@^2.2.5": 6 | version "2.2.5" 7 | resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" 8 | integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== 9 | 10 | "@starcoin/move-js@../../": 11 | version "0.6.1" 12 | dependencies: 13 | "@iarna/toml" "^2.2.5" 14 | "@swc/helpers" "^0.3.13" 15 | "@wasmer/wasi" "^0.12.0" 16 | "@wasmer/wasm-transformer" "^0.10.0" 17 | "@wasmer/wasmfs" "^0.12.0" 18 | 19 | "@swc/helpers@^0.3.13": 20 | version "0.3.17" 21 | resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.3.17.tgz#7c1b91f43c77e2bba99492162a498d465ef253d5" 22 | integrity sha512-tb7Iu+oZ+zWJZ3HJqwx8oNwSDIU440hmVMDPhpACWQWnrZHK99Bxs70gT1L2dnr5Hg50ZRWEFkQCAnOVVV0z1Q== 23 | dependencies: 24 | tslib "^2.4.0" 25 | 26 | "@wasmer/wasi@^0.12.0": 27 | version "0.12.0" 28 | resolved "https://registry.yarnpkg.com/@wasmer/wasi/-/wasi-0.12.0.tgz#89c7c5e5ba58f7dfae4e323359346639c4ec382a" 29 | integrity sha512-FJhLZKAfLWm/yjQI7eCRHNbA8ezmb7LSpUYFkHruZXs2mXk2+DaQtSElEtOoNrVQ4vApTyVaAd5/b7uEu8w6wQ== 30 | dependencies: 31 | browser-process-hrtime "^1.0.0" 32 | buffer-es6 "^4.9.3" 33 | path-browserify "^1.0.0" 34 | randomfill "^1.0.4" 35 | 36 | "@wasmer/wasm-transformer@^0.10.0": 37 | version "0.10.2" 38 | resolved "https://registry.yarnpkg.com/@wasmer/wasm-transformer/-/wasm-transformer-0.10.2.tgz#1f69a4a9766974f1b170de7ad4d46e2f0d2ffec6" 39 | integrity sha512-cWctY14yLCJrNDrQfWVVlvrblYffwb8PVxsHnvdcbsaA8j8il0I7u/qzaGDA6k4jeN5Hd3QKWM4x+M1AJ6hOwg== 40 | dependencies: 41 | wasm-feature-detect "^1.2.2" 42 | 43 | "@wasmer/wasmfs@^0.12.0": 44 | version "0.12.0" 45 | resolved "https://registry.yarnpkg.com/@wasmer/wasmfs/-/wasmfs-0.12.0.tgz#7f2ad51b42b87316fac5df0b93256d1b7e567c1b" 46 | integrity sha512-m1ftchyQ1DfSenm5XbbdGIpb6KJHH5z0gODo3IZr6lATkj4WXfX/UeBTZ0aG9YVShBp+kHLdUHvOkqjy6p/GWw== 47 | dependencies: 48 | memfs "3.0.4" 49 | pako "^1.0.11" 50 | tar-stream "^2.1.0" 51 | 52 | base64-js@^1.3.1: 53 | version "1.5.1" 54 | resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" 55 | integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== 56 | 57 | bl@^4.0.3: 58 | version "4.1.0" 59 | resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" 60 | integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== 61 | dependencies: 62 | buffer "^5.5.0" 63 | inherits "^2.0.4" 64 | readable-stream "^3.4.0" 65 | 66 | browser-process-hrtime@^1.0.0: 67 | version "1.0.0" 68 | resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" 69 | integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== 70 | 71 | buffer-es6@^4.9.3: 72 | version "4.9.3" 73 | resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" 74 | integrity sha512-Ibt+oXxhmeYJSsCkODPqNpPmyegefiD8rfutH1NYGhMZQhSp95Rz7haemgnJ6dxa6LT+JLLbtgOMORRluwKktw== 75 | 76 | buffer@^5.5.0: 77 | version "5.7.1" 78 | resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" 79 | integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== 80 | dependencies: 81 | base64-js "^1.3.1" 82 | ieee754 "^1.1.13" 83 | 84 | end-of-stream@^1.4.1: 85 | version "1.4.4" 86 | resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" 87 | integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== 88 | dependencies: 89 | once "^1.4.0" 90 | 91 | esbuild-android-64@0.14.42: 92 | version "0.14.42" 93 | resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.42.tgz#d7ab3d44d3671218d22bce52f65642b12908d954" 94 | integrity sha512-P4Y36VUtRhK/zivqGVMqhptSrFILAGlYp0Z8r9UQqHJ3iWztRCNWnlBzD9HRx0DbueXikzOiwyOri+ojAFfW6A== 95 | 96 | esbuild-android-arm64@0.14.42: 97 | version "0.14.42" 98 | resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.42.tgz#45336d8bec49abddb3a022996a23373f45a57c27" 99 | integrity sha512-0cOqCubq+RWScPqvtQdjXG3Czb3AWI2CaKw3HeXry2eoA2rrPr85HF7IpdU26UWdBXgPYtlTN1LUiuXbboROhg== 100 | 101 | esbuild-darwin-64@0.14.42: 102 | version "0.14.42" 103 | resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.42.tgz#6dff5e44cd70a88c33323e2f5fb598e40c68a9e0" 104 | integrity sha512-ipiBdCA3ZjYgRfRLdQwP82rTiv/YVMtW36hTvAN5ZKAIfxBOyPXY7Cejp3bMXWgzKD8B6O+zoMzh01GZsCuEIA== 105 | 106 | esbuild-darwin-arm64@0.14.42: 107 | version "0.14.42" 108 | resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.42.tgz#2c7313e1b12d2fa5b889c03213d682fb92ca8c4f" 109 | integrity sha512-bU2tHRqTPOaoH/4m0zYHbFWpiYDmaA0gt90/3BMEFaM0PqVK/a6MA2V/ypV5PO0v8QxN6gH5hBPY4YJ2lopXgA== 110 | 111 | esbuild-freebsd-64@0.14.42: 112 | version "0.14.42" 113 | resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.42.tgz#ad1c5a564a7e473b8ce95ee7f76618d05d6daffc" 114 | integrity sha512-75h1+22Ivy07+QvxHyhVqOdekupiTZVLN1PMwCDonAqyXd8TVNJfIRFrdL8QmSJrOJJ5h8H1I9ETyl2L8LQDaw== 115 | 116 | esbuild-freebsd-arm64@0.14.42: 117 | version "0.14.42" 118 | resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.42.tgz#4bdb480234144f944f1930829bace7561135ddc7" 119 | integrity sha512-W6Jebeu5TTDQMJUJVarEzRU9LlKpNkPBbjqSu+GUPTHDCly5zZEQq9uHkmHHl7OKm+mQ2zFySN83nmfCeZCyNA== 120 | 121 | esbuild-linux-32@0.14.42: 122 | version "0.14.42" 123 | resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.42.tgz#ef18fd19f067e9d2b5f677d6b82fa81519f5a8c2" 124 | integrity sha512-Ooy/Bj+mJ1z4jlWcK5Dl6SlPlCgQB9zg1UrTCeY8XagvuWZ4qGPyYEWGkT94HUsRi2hKsXvcs6ThTOjBaJSMfg== 125 | 126 | esbuild-linux-64@0.14.42: 127 | version "0.14.42" 128 | resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.42.tgz#d84e7333b1c1b22cf8b5b9dbb5dd9b2ecb34b79f" 129 | integrity sha512-2L0HbzQfbTuemUWfVqNIjOfaTRt9zsvjnme6lnr7/MO9toz/MJ5tZhjqrG6uDWDxhsaHI2/nsDgrv8uEEN2eoA== 130 | 131 | esbuild-linux-arm64@0.14.42: 132 | version "0.14.42" 133 | resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.42.tgz#dc19e282f8c4ffbaa470c02a4d171e4ae0180cca" 134 | integrity sha512-c3Ug3e9JpVr8jAcfbhirtpBauLxzYPpycjWulD71CF6ZSY26tvzmXMJYooQ2YKqDY4e/fPu5K8bm7MiXMnyxuA== 135 | 136 | esbuild-linux-arm@0.14.42: 137 | version "0.14.42" 138 | resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.42.tgz#d49870e63e2242b8156bf473f2ee5154226be328" 139 | integrity sha512-STq69yzCMhdRaWnh29UYrLSr/qaWMm/KqwaRF1pMEK7kDiagaXhSL1zQGXbYv94GuGY/zAwzK98+6idCMUOOCg== 140 | 141 | esbuild-linux-mips64le@0.14.42: 142 | version "0.14.42" 143 | resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.42.tgz#f4e6ff9bf8a6f175470498826f48d093b054fc22" 144 | integrity sha512-QuvpHGbYlkyXWf2cGm51LBCHx6eUakjaSrRpUqhPwjh/uvNUYvLmz2LgPTTPwCqaKt0iwL+OGVL0tXA5aDbAbg== 145 | 146 | esbuild-linux-ppc64le@0.14.42: 147 | version "0.14.42" 148 | resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.42.tgz#ac9c66fc80ba9f8fda15a4cc08f4e55f6c0aed63" 149 | integrity sha512-8ohIVIWDbDT+i7lCx44YCyIRrOW1MYlks9fxTo0ME2LS/fxxdoJBwHWzaDYhjvf8kNpA+MInZvyOEAGoVDrMHg== 150 | 151 | esbuild-linux-riscv64@0.14.42: 152 | version "0.14.42" 153 | resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.42.tgz#21e0ae492a3a9bf4eecbfc916339a66e204256d0" 154 | integrity sha512-DzDqK3TuoXktPyG1Lwx7vhaF49Onv3eR61KwQyxYo4y5UKTpL3NmuarHSIaSVlTFDDpcIajCDwz5/uwKLLgKiQ== 155 | 156 | esbuild-linux-s390x@0.14.42: 157 | version "0.14.42" 158 | resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.42.tgz#06d40b957250ffd9a2183bfdfc9a03d6fd21b3e8" 159 | integrity sha512-YFRhPCxl8nb//Wn6SiS5pmtplBi4z9yC2gLrYoYI/tvwuB1jldir9r7JwAGy1Ck4D7sE7wBN9GFtUUX/DLdcEQ== 160 | 161 | esbuild-netbsd-64@0.14.42: 162 | version "0.14.42" 163 | resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.42.tgz#185664f05f10914f14ed43bd9e22b7de584267f7" 164 | integrity sha512-QYSD2k+oT9dqB/4eEM9c+7KyNYsIPgzYOSrmfNGDIyJrbT1d+CFVKvnKahDKNJLfOYj8N4MgyFaU9/Ytc6w5Vw== 165 | 166 | esbuild-openbsd-64@0.14.42: 167 | version "0.14.42" 168 | resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.42.tgz#c29006f659eb4e55283044bbbd4eb4054fae8839" 169 | integrity sha512-M2meNVIKWsm2HMY7+TU9AxM7ZVwI9havdsw6m/6EzdXysyCFFSoaTQ/Jg03izjCsK17FsVRHqRe26Llj6x0MNA== 170 | 171 | esbuild-sunos-64@0.14.42: 172 | version "0.14.42" 173 | resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.42.tgz#aa9eec112cd1e7105e7bb37000eca7d460083f8f" 174 | integrity sha512-uXV8TAZEw36DkgW8Ak3MpSJs1ofBb3Smkc/6pZ29sCAN1KzCAQzsje4sUwugf+FVicrHvlamCOlFZIXgct+iqQ== 175 | 176 | esbuild-windows-32@0.14.42: 177 | version "0.14.42" 178 | resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.42.tgz#c3fc450853c61a74dacc5679de301db23b73e61e" 179 | integrity sha512-4iw/8qWmRICWi9ZOnJJf9sYt6wmtp3hsN4TdI5NqgjfOkBVMxNdM9Vt3626G1Rda9ya2Q0hjQRD9W1o+m6Lz6g== 180 | 181 | esbuild-windows-64@0.14.42: 182 | version "0.14.42" 183 | resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.42.tgz#b877aa37ff47d9fcf0ccb1ca6a24b31475a5e555" 184 | integrity sha512-j3cdK+Y3+a5H0wHKmLGTJcq0+/2mMBHPWkItR3vytp/aUGD/ua/t2BLdfBIzbNN9nLCRL9sywCRpOpFMx3CxzA== 185 | 186 | esbuild-windows-arm64@0.14.42: 187 | version "0.14.42" 188 | resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.42.tgz#79da8744626f24bc016dc40d016950b5a4a2bac5" 189 | integrity sha512-+lRAARnF+hf8J0mN27ujO+VbhPbDqJ8rCcJKye4y7YZLV6C4n3pTRThAb388k/zqF5uM0lS5O201u0OqoWSicw== 190 | 191 | esbuild@^0.14.27: 192 | version "0.14.42" 193 | resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.42.tgz#98587df0b024d5f6341b12a1d735a2bff55e1836" 194 | integrity sha512-V0uPZotCEHokJdNqyozH6qsaQXqmZEOiZWrXnds/zaH/0SyrIayRXWRB98CENO73MIZ9T3HBIOsmds5twWtmgw== 195 | optionalDependencies: 196 | esbuild-android-64 "0.14.42" 197 | esbuild-android-arm64 "0.14.42" 198 | esbuild-darwin-64 "0.14.42" 199 | esbuild-darwin-arm64 "0.14.42" 200 | esbuild-freebsd-64 "0.14.42" 201 | esbuild-freebsd-arm64 "0.14.42" 202 | esbuild-linux-32 "0.14.42" 203 | esbuild-linux-64 "0.14.42" 204 | esbuild-linux-arm "0.14.42" 205 | esbuild-linux-arm64 "0.14.42" 206 | esbuild-linux-mips64le "0.14.42" 207 | esbuild-linux-ppc64le "0.14.42" 208 | esbuild-linux-riscv64 "0.14.42" 209 | esbuild-linux-s390x "0.14.42" 210 | esbuild-netbsd-64 "0.14.42" 211 | esbuild-openbsd-64 "0.14.42" 212 | esbuild-sunos-64 "0.14.42" 213 | esbuild-windows-32 "0.14.42" 214 | esbuild-windows-64 "0.14.42" 215 | esbuild-windows-arm64 "0.14.42" 216 | 217 | fast-extend@1.0.2: 218 | version "1.0.2" 219 | resolved "https://registry.yarnpkg.com/fast-extend/-/fast-extend-1.0.2.tgz#3b8a5b09cbc8ff3d6d47eaf397398c0a643e441b" 220 | integrity sha512-XXA9RmlPatkFKUzqVZAFth18R4Wo+Xug/S+C7YlYA3xrXwfPlW3dqNwOb4hvQo7wZJ2cNDYhrYuPzVOfHy5/uQ== 221 | 222 | fs-constants@^1.0.0: 223 | version "1.0.0" 224 | resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" 225 | integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== 226 | 227 | fs-monkey@0.3.3: 228 | version "0.3.3" 229 | resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-0.3.3.tgz#7960bb2b1fa2653731b9d0e2e84812a7e8b3664a" 230 | integrity sha512-FNUvuTAJ3CqCQb5ELn+qCbGR/Zllhf2HtwsdAtBi59s1WeCjKMT81fHcSu7dwIskqGVK+MmOrb7VOBlq3/SItw== 231 | 232 | fsevents@~2.3.2: 233 | version "2.3.2" 234 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 235 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 236 | 237 | function-bind@^1.1.1: 238 | version "1.1.1" 239 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" 240 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== 241 | 242 | has@^1.0.3: 243 | version "1.0.3" 244 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" 245 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== 246 | dependencies: 247 | function-bind "^1.1.1" 248 | 249 | ieee754@^1.1.13: 250 | version "1.2.1" 251 | resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" 252 | integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== 253 | 254 | inherits@^2.0.3, inherits@^2.0.4: 255 | version "2.0.4" 256 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 257 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 258 | 259 | is-core-module@^2.8.1: 260 | version "2.9.0" 261 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" 262 | integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== 263 | dependencies: 264 | has "^1.0.3" 265 | 266 | memfs@3.0.4: 267 | version "3.0.4" 268 | resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.0.4.tgz#17997ec34d67d0a4756f6a34f2fefd13a8dbab08" 269 | integrity sha512-OcZEzwX9E5AoY8SXjuAvw0DbIAYwUzV/I236I8Pqvrlv7sL/Y0E9aRCon05DhaV8pg1b32uxj76RgW0s5xjHBA== 270 | dependencies: 271 | fast-extend "1.0.2" 272 | fs-monkey "0.3.3" 273 | 274 | nanoid@^3.3.4: 275 | version "3.3.4" 276 | resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" 277 | integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== 278 | 279 | once@^1.4.0: 280 | version "1.4.0" 281 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 282 | integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== 283 | dependencies: 284 | wrappy "1" 285 | 286 | pako@^1.0.11: 287 | version "1.0.11" 288 | resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" 289 | integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== 290 | 291 | path-browserify@^1.0.0: 292 | version "1.0.1" 293 | resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" 294 | integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== 295 | 296 | path-parse@^1.0.7: 297 | version "1.0.7" 298 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" 299 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== 300 | 301 | picocolors@^1.0.0: 302 | version "1.0.0" 303 | resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" 304 | integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== 305 | 306 | postcss@^8.4.13: 307 | version "8.4.14" 308 | resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" 309 | integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== 310 | dependencies: 311 | nanoid "^3.3.4" 312 | picocolors "^1.0.0" 313 | source-map-js "^1.0.2" 314 | 315 | randombytes@^2.0.5: 316 | version "2.1.0" 317 | resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" 318 | integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== 319 | dependencies: 320 | safe-buffer "^5.1.0" 321 | 322 | randomfill@^1.0.4: 323 | version "1.0.4" 324 | resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" 325 | integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== 326 | dependencies: 327 | randombytes "^2.0.5" 328 | safe-buffer "^5.1.0" 329 | 330 | readable-stream@^3.1.1, readable-stream@^3.4.0: 331 | version "3.6.0" 332 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" 333 | integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== 334 | dependencies: 335 | inherits "^2.0.3" 336 | string_decoder "^1.1.1" 337 | util-deprecate "^1.0.1" 338 | 339 | resolve@^1.22.0: 340 | version "1.22.0" 341 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" 342 | integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== 343 | dependencies: 344 | is-core-module "^2.8.1" 345 | path-parse "^1.0.7" 346 | supports-preserve-symlinks-flag "^1.0.0" 347 | 348 | rollup@^2.59.0: 349 | version "2.75.5" 350 | resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.75.5.tgz#7985c1962483235dd07966f09fdad5c5f89f16d0" 351 | integrity sha512-JzNlJZDison3o2mOxVmb44Oz7t74EfSd1SQrplQk0wSaXV7uLQXtVdHbxlcT3w+8tZ1TL4r/eLfc7nAbz38BBA== 352 | optionalDependencies: 353 | fsevents "~2.3.2" 354 | 355 | safe-buffer@^5.1.0, safe-buffer@~5.2.0: 356 | version "5.2.1" 357 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 358 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 359 | 360 | source-map-js@^1.0.2: 361 | version "1.0.2" 362 | resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" 363 | integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== 364 | 365 | string_decoder@^1.1.1: 366 | version "1.3.0" 367 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" 368 | integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== 369 | dependencies: 370 | safe-buffer "~5.2.0" 371 | 372 | supports-preserve-symlinks-flag@^1.0.0: 373 | version "1.0.0" 374 | resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" 375 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== 376 | 377 | tar-stream@^2.1.0: 378 | version "2.2.0" 379 | resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" 380 | integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== 381 | dependencies: 382 | bl "^4.0.3" 383 | end-of-stream "^1.4.1" 384 | fs-constants "^1.0.0" 385 | inherits "^2.0.3" 386 | readable-stream "^3.1.1" 387 | 388 | tslib@^2.4.0: 389 | version "2.4.0" 390 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" 391 | integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== 392 | 393 | typescript@^4.5.4: 394 | version "4.7.3" 395 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" 396 | integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== 397 | 398 | util-deprecate@^1.0.1: 399 | version "1.0.2" 400 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" 401 | integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= 402 | 403 | vite@^2.9.9: 404 | version "2.9.9" 405 | resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.9.tgz#8b558987db5e60fedec2f4b003b73164cb081c5e" 406 | integrity sha512-ffaam+NgHfbEmfw/Vuh6BHKKlI/XIAhxE5QSS7gFLIngxg171mg1P3a4LSRME0z2ZU1ScxoKzphkipcYwSD5Ew== 407 | dependencies: 408 | esbuild "^0.14.27" 409 | postcss "^8.4.13" 410 | resolve "^1.22.0" 411 | rollup "^2.59.0" 412 | optionalDependencies: 413 | fsevents "~2.3.2" 414 | 415 | wasm-feature-detect@^1.2.2: 416 | version "1.2.11" 417 | resolved "https://registry.yarnpkg.com/wasm-feature-detect/-/wasm-feature-detect-1.2.11.tgz#e21992fd1f1d41a47490e392a5893cb39d81e29e" 418 | integrity sha512-HUqwaodrQGaZgz1lZaNioIkog9tkeEJjrM3eq4aUL04whXOVDRc/o2EGb/8kV0QX411iAYWEqq7fMBmJ6dKS6w== 419 | 420 | wrappy@1: 421 | version "1.0.2" 422 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 423 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 424 | -------------------------------------------------------------------------------- /examples/my-counter/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /examples/my-counter/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/my-counter/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite App 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/my-counter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-counter", 3 | "private": true, 4 | "version": "0.0.0", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "tsc && vite build", 8 | "preview": "vite preview" 9 | }, 10 | "devDependencies": { 11 | "typescript": "^4.5.4", 12 | "vite": "^2.9.9" 13 | }, 14 | "dependencies": { 15 | "@wasmer/wasi": "^0.12.0", 16 | "@wasmer/wasm-transformer": "^0.10.0", 17 | "@wasmer/wasmfs": "^0.12.0", 18 | "@starcoin/move-js": "../../" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/my-counter/public/data/my-counter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/examples/my-counter/public/data/my-counter.zip -------------------------------------------------------------------------------- /examples/my-counter/public/data/starcoin-framework.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/examples/my-counter/public/data/starcoin-framework.zip -------------------------------------------------------------------------------- /examples/my-counter/src/main.ts: -------------------------------------------------------------------------------- 1 | import './style.css' 2 | 3 | import { WasmFs } from '@wasmer/wasmfs' 4 | import { Git, MovePackage } from '@starcoin/move-js' 5 | 6 | const startWasiTask = async (app: HTMLDivElement) => { 7 | const wasmfs = new WasmFs() 8 | const git = new Git(wasmfs) 9 | 10 | await git.download("/data/starcoin-framework.zip", "/workspace/starcoin-framework") 11 | await git.download("/data/my-counter.zip", "/workspace/my-counter") 12 | 13 | const mp = new MovePackage(wasmfs, { 14 | packagePath: "/workspace/my-counter", 15 | test: false, 16 | alias: new Map([ 17 | ["StarcoinFramework", "/workspace/starcoin-framework"] 18 | ]), 19 | initFunction: "0xABCDE::MyCounter::init" 20 | }) 21 | 22 | await mp.build() 23 | 24 | const blobBuf = wasmfs.fs.readFileSync("/workspace/my-counter/target/starcoin/release/package.blob") 25 | const hash = wasmfs.fs.readFileSync("/workspace/my-counter/target/starcoin/release/hash.txt") 26 | 27 | const base64Data = blobBuf.toString("base64") 28 | console.log("my-counter blob:", base64Data) 29 | 30 | app.innerHTML = ` 31 |

my-counter blob:

32 | ${base64Data} 33 | ${hash} 34 | ` 35 | } 36 | 37 | const app = document.querySelector('#app')! 38 | startWasiTask(app) 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/my-counter/src/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | font-family: Avenir, Helvetica, Arial, sans-serif; 3 | -webkit-font-smoothing: antialiased; 4 | -moz-osx-font-smoothing: grayscale; 5 | text-align: center; 6 | color: #2c3e50; 7 | margin-top: 60px; 8 | } 9 | -------------------------------------------------------------------------------- /examples/my-counter/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/my-counter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "lib": ["ESNext", "DOM"], 7 | "moduleResolution": "Node", 8 | "strict": true, 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noEmit": true, 14 | "noUnusedLocals": true, 15 | "noUnusedParameters": true, 16 | "noImplicitReturns": true, 17 | "skipLibCheck": true 18 | }, 19 | "include": ["src"] 20 | } 21 | -------------------------------------------------------------------------------- /examples/my-counter/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@iarna/toml@^2.2.5": 6 | version "2.2.5" 7 | resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" 8 | integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== 9 | 10 | "@starcoin/move-js@../../": 11 | version "0.6.1" 12 | dependencies: 13 | "@iarna/toml" "^2.2.5" 14 | "@swc/helpers" "^0.3.13" 15 | "@wasmer/wasi" "^0.12.0" 16 | "@wasmer/wasm-transformer" "^0.10.0" 17 | "@wasmer/wasmfs" "^0.12.0" 18 | 19 | "@swc/helpers@^0.3.13": 20 | version "0.3.17" 21 | resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.3.17.tgz#7c1b91f43c77e2bba99492162a498d465ef253d5" 22 | integrity sha512-tb7Iu+oZ+zWJZ3HJqwx8oNwSDIU440hmVMDPhpACWQWnrZHK99Bxs70gT1L2dnr5Hg50ZRWEFkQCAnOVVV0z1Q== 23 | dependencies: 24 | tslib "^2.4.0" 25 | 26 | "@wasmer/wasi@^0.12.0": 27 | version "0.12.0" 28 | resolved "https://registry.yarnpkg.com/@wasmer/wasi/-/wasi-0.12.0.tgz#89c7c5e5ba58f7dfae4e323359346639c4ec382a" 29 | integrity sha512-FJhLZKAfLWm/yjQI7eCRHNbA8ezmb7LSpUYFkHruZXs2mXk2+DaQtSElEtOoNrVQ4vApTyVaAd5/b7uEu8w6wQ== 30 | dependencies: 31 | browser-process-hrtime "^1.0.0" 32 | buffer-es6 "^4.9.3" 33 | path-browserify "^1.0.0" 34 | randomfill "^1.0.4" 35 | 36 | "@wasmer/wasm-transformer@^0.10.0": 37 | version "0.10.2" 38 | resolved "https://registry.yarnpkg.com/@wasmer/wasm-transformer/-/wasm-transformer-0.10.2.tgz#1f69a4a9766974f1b170de7ad4d46e2f0d2ffec6" 39 | integrity sha512-cWctY14yLCJrNDrQfWVVlvrblYffwb8PVxsHnvdcbsaA8j8il0I7u/qzaGDA6k4jeN5Hd3QKWM4x+M1AJ6hOwg== 40 | dependencies: 41 | wasm-feature-detect "^1.2.2" 42 | 43 | "@wasmer/wasmfs@^0.12.0": 44 | version "0.12.0" 45 | resolved "https://registry.yarnpkg.com/@wasmer/wasmfs/-/wasmfs-0.12.0.tgz#7f2ad51b42b87316fac5df0b93256d1b7e567c1b" 46 | integrity sha512-m1ftchyQ1DfSenm5XbbdGIpb6KJHH5z0gODo3IZr6lATkj4WXfX/UeBTZ0aG9YVShBp+kHLdUHvOkqjy6p/GWw== 47 | dependencies: 48 | memfs "3.0.4" 49 | pako "^1.0.11" 50 | tar-stream "^2.1.0" 51 | 52 | base64-js@^1.3.1: 53 | version "1.5.1" 54 | resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" 55 | integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== 56 | 57 | bl@^4.0.3: 58 | version "4.1.0" 59 | resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" 60 | integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== 61 | dependencies: 62 | buffer "^5.5.0" 63 | inherits "^2.0.4" 64 | readable-stream "^3.4.0" 65 | 66 | browser-process-hrtime@^1.0.0: 67 | version "1.0.0" 68 | resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" 69 | integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== 70 | 71 | buffer-es6@^4.9.3: 72 | version "4.9.3" 73 | resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" 74 | integrity sha512-Ibt+oXxhmeYJSsCkODPqNpPmyegefiD8rfutH1NYGhMZQhSp95Rz7haemgnJ6dxa6LT+JLLbtgOMORRluwKktw== 75 | 76 | buffer@^5.5.0: 77 | version "5.7.1" 78 | resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" 79 | integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== 80 | dependencies: 81 | base64-js "^1.3.1" 82 | ieee754 "^1.1.13" 83 | 84 | end-of-stream@^1.4.1: 85 | version "1.4.4" 86 | resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" 87 | integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== 88 | dependencies: 89 | once "^1.4.0" 90 | 91 | esbuild-android-64@0.14.42: 92 | version "0.14.42" 93 | resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.42.tgz#d7ab3d44d3671218d22bce52f65642b12908d954" 94 | integrity sha512-P4Y36VUtRhK/zivqGVMqhptSrFILAGlYp0Z8r9UQqHJ3iWztRCNWnlBzD9HRx0DbueXikzOiwyOri+ojAFfW6A== 95 | 96 | esbuild-android-arm64@0.14.42: 97 | version "0.14.42" 98 | resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.42.tgz#45336d8bec49abddb3a022996a23373f45a57c27" 99 | integrity sha512-0cOqCubq+RWScPqvtQdjXG3Czb3AWI2CaKw3HeXry2eoA2rrPr85HF7IpdU26UWdBXgPYtlTN1LUiuXbboROhg== 100 | 101 | esbuild-darwin-64@0.14.42: 102 | version "0.14.42" 103 | resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.42.tgz#6dff5e44cd70a88c33323e2f5fb598e40c68a9e0" 104 | integrity sha512-ipiBdCA3ZjYgRfRLdQwP82rTiv/YVMtW36hTvAN5ZKAIfxBOyPXY7Cejp3bMXWgzKD8B6O+zoMzh01GZsCuEIA== 105 | 106 | esbuild-darwin-arm64@0.14.42: 107 | version "0.14.42" 108 | resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.42.tgz#2c7313e1b12d2fa5b889c03213d682fb92ca8c4f" 109 | integrity sha512-bU2tHRqTPOaoH/4m0zYHbFWpiYDmaA0gt90/3BMEFaM0PqVK/a6MA2V/ypV5PO0v8QxN6gH5hBPY4YJ2lopXgA== 110 | 111 | esbuild-freebsd-64@0.14.42: 112 | version "0.14.42" 113 | resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.42.tgz#ad1c5a564a7e473b8ce95ee7f76618d05d6daffc" 114 | integrity sha512-75h1+22Ivy07+QvxHyhVqOdekupiTZVLN1PMwCDonAqyXd8TVNJfIRFrdL8QmSJrOJJ5h8H1I9ETyl2L8LQDaw== 115 | 116 | esbuild-freebsd-arm64@0.14.42: 117 | version "0.14.42" 118 | resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.42.tgz#4bdb480234144f944f1930829bace7561135ddc7" 119 | integrity sha512-W6Jebeu5TTDQMJUJVarEzRU9LlKpNkPBbjqSu+GUPTHDCly5zZEQq9uHkmHHl7OKm+mQ2zFySN83nmfCeZCyNA== 120 | 121 | esbuild-linux-32@0.14.42: 122 | version "0.14.42" 123 | resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.42.tgz#ef18fd19f067e9d2b5f677d6b82fa81519f5a8c2" 124 | integrity sha512-Ooy/Bj+mJ1z4jlWcK5Dl6SlPlCgQB9zg1UrTCeY8XagvuWZ4qGPyYEWGkT94HUsRi2hKsXvcs6ThTOjBaJSMfg== 125 | 126 | esbuild-linux-64@0.14.42: 127 | version "0.14.42" 128 | resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.42.tgz#d84e7333b1c1b22cf8b5b9dbb5dd9b2ecb34b79f" 129 | integrity sha512-2L0HbzQfbTuemUWfVqNIjOfaTRt9zsvjnme6lnr7/MO9toz/MJ5tZhjqrG6uDWDxhsaHI2/nsDgrv8uEEN2eoA== 130 | 131 | esbuild-linux-arm64@0.14.42: 132 | version "0.14.42" 133 | resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.42.tgz#dc19e282f8c4ffbaa470c02a4d171e4ae0180cca" 134 | integrity sha512-c3Ug3e9JpVr8jAcfbhirtpBauLxzYPpycjWulD71CF6ZSY26tvzmXMJYooQ2YKqDY4e/fPu5K8bm7MiXMnyxuA== 135 | 136 | esbuild-linux-arm@0.14.42: 137 | version "0.14.42" 138 | resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.42.tgz#d49870e63e2242b8156bf473f2ee5154226be328" 139 | integrity sha512-STq69yzCMhdRaWnh29UYrLSr/qaWMm/KqwaRF1pMEK7kDiagaXhSL1zQGXbYv94GuGY/zAwzK98+6idCMUOOCg== 140 | 141 | esbuild-linux-mips64le@0.14.42: 142 | version "0.14.42" 143 | resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.42.tgz#f4e6ff9bf8a6f175470498826f48d093b054fc22" 144 | integrity sha512-QuvpHGbYlkyXWf2cGm51LBCHx6eUakjaSrRpUqhPwjh/uvNUYvLmz2LgPTTPwCqaKt0iwL+OGVL0tXA5aDbAbg== 145 | 146 | esbuild-linux-ppc64le@0.14.42: 147 | version "0.14.42" 148 | resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.42.tgz#ac9c66fc80ba9f8fda15a4cc08f4e55f6c0aed63" 149 | integrity sha512-8ohIVIWDbDT+i7lCx44YCyIRrOW1MYlks9fxTo0ME2LS/fxxdoJBwHWzaDYhjvf8kNpA+MInZvyOEAGoVDrMHg== 150 | 151 | esbuild-linux-riscv64@0.14.42: 152 | version "0.14.42" 153 | resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.42.tgz#21e0ae492a3a9bf4eecbfc916339a66e204256d0" 154 | integrity sha512-DzDqK3TuoXktPyG1Lwx7vhaF49Onv3eR61KwQyxYo4y5UKTpL3NmuarHSIaSVlTFDDpcIajCDwz5/uwKLLgKiQ== 155 | 156 | esbuild-linux-s390x@0.14.42: 157 | version "0.14.42" 158 | resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.42.tgz#06d40b957250ffd9a2183bfdfc9a03d6fd21b3e8" 159 | integrity sha512-YFRhPCxl8nb//Wn6SiS5pmtplBi4z9yC2gLrYoYI/tvwuB1jldir9r7JwAGy1Ck4D7sE7wBN9GFtUUX/DLdcEQ== 160 | 161 | esbuild-netbsd-64@0.14.42: 162 | version "0.14.42" 163 | resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.42.tgz#185664f05f10914f14ed43bd9e22b7de584267f7" 164 | integrity sha512-QYSD2k+oT9dqB/4eEM9c+7KyNYsIPgzYOSrmfNGDIyJrbT1d+CFVKvnKahDKNJLfOYj8N4MgyFaU9/Ytc6w5Vw== 165 | 166 | esbuild-openbsd-64@0.14.42: 167 | version "0.14.42" 168 | resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.42.tgz#c29006f659eb4e55283044bbbd4eb4054fae8839" 169 | integrity sha512-M2meNVIKWsm2HMY7+TU9AxM7ZVwI9havdsw6m/6EzdXysyCFFSoaTQ/Jg03izjCsK17FsVRHqRe26Llj6x0MNA== 170 | 171 | esbuild-sunos-64@0.14.42: 172 | version "0.14.42" 173 | resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.42.tgz#aa9eec112cd1e7105e7bb37000eca7d460083f8f" 174 | integrity sha512-uXV8TAZEw36DkgW8Ak3MpSJs1ofBb3Smkc/6pZ29sCAN1KzCAQzsje4sUwugf+FVicrHvlamCOlFZIXgct+iqQ== 175 | 176 | esbuild-windows-32@0.14.42: 177 | version "0.14.42" 178 | resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.42.tgz#c3fc450853c61a74dacc5679de301db23b73e61e" 179 | integrity sha512-4iw/8qWmRICWi9ZOnJJf9sYt6wmtp3hsN4TdI5NqgjfOkBVMxNdM9Vt3626G1Rda9ya2Q0hjQRD9W1o+m6Lz6g== 180 | 181 | esbuild-windows-64@0.14.42: 182 | version "0.14.42" 183 | resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.42.tgz#b877aa37ff47d9fcf0ccb1ca6a24b31475a5e555" 184 | integrity sha512-j3cdK+Y3+a5H0wHKmLGTJcq0+/2mMBHPWkItR3vytp/aUGD/ua/t2BLdfBIzbNN9nLCRL9sywCRpOpFMx3CxzA== 185 | 186 | esbuild-windows-arm64@0.14.42: 187 | version "0.14.42" 188 | resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.42.tgz#79da8744626f24bc016dc40d016950b5a4a2bac5" 189 | integrity sha512-+lRAARnF+hf8J0mN27ujO+VbhPbDqJ8rCcJKye4y7YZLV6C4n3pTRThAb388k/zqF5uM0lS5O201u0OqoWSicw== 190 | 191 | esbuild@^0.14.27: 192 | version "0.14.42" 193 | resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.42.tgz#98587df0b024d5f6341b12a1d735a2bff55e1836" 194 | integrity sha512-V0uPZotCEHokJdNqyozH6qsaQXqmZEOiZWrXnds/zaH/0SyrIayRXWRB98CENO73MIZ9T3HBIOsmds5twWtmgw== 195 | optionalDependencies: 196 | esbuild-android-64 "0.14.42" 197 | esbuild-android-arm64 "0.14.42" 198 | esbuild-darwin-64 "0.14.42" 199 | esbuild-darwin-arm64 "0.14.42" 200 | esbuild-freebsd-64 "0.14.42" 201 | esbuild-freebsd-arm64 "0.14.42" 202 | esbuild-linux-32 "0.14.42" 203 | esbuild-linux-64 "0.14.42" 204 | esbuild-linux-arm "0.14.42" 205 | esbuild-linux-arm64 "0.14.42" 206 | esbuild-linux-mips64le "0.14.42" 207 | esbuild-linux-ppc64le "0.14.42" 208 | esbuild-linux-riscv64 "0.14.42" 209 | esbuild-linux-s390x "0.14.42" 210 | esbuild-netbsd-64 "0.14.42" 211 | esbuild-openbsd-64 "0.14.42" 212 | esbuild-sunos-64 "0.14.42" 213 | esbuild-windows-32 "0.14.42" 214 | esbuild-windows-64 "0.14.42" 215 | esbuild-windows-arm64 "0.14.42" 216 | 217 | fast-extend@1.0.2: 218 | version "1.0.2" 219 | resolved "https://registry.yarnpkg.com/fast-extend/-/fast-extend-1.0.2.tgz#3b8a5b09cbc8ff3d6d47eaf397398c0a643e441b" 220 | integrity sha512-XXA9RmlPatkFKUzqVZAFth18R4Wo+Xug/S+C7YlYA3xrXwfPlW3dqNwOb4hvQo7wZJ2cNDYhrYuPzVOfHy5/uQ== 221 | 222 | fs-constants@^1.0.0: 223 | version "1.0.0" 224 | resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" 225 | integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== 226 | 227 | fs-monkey@0.3.3: 228 | version "0.3.3" 229 | resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-0.3.3.tgz#7960bb2b1fa2653731b9d0e2e84812a7e8b3664a" 230 | integrity sha512-FNUvuTAJ3CqCQb5ELn+qCbGR/Zllhf2HtwsdAtBi59s1WeCjKMT81fHcSu7dwIskqGVK+MmOrb7VOBlq3/SItw== 231 | 232 | fsevents@~2.3.2: 233 | version "2.3.2" 234 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 235 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 236 | 237 | function-bind@^1.1.1: 238 | version "1.1.1" 239 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" 240 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== 241 | 242 | has@^1.0.3: 243 | version "1.0.3" 244 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" 245 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== 246 | dependencies: 247 | function-bind "^1.1.1" 248 | 249 | ieee754@^1.1.13: 250 | version "1.2.1" 251 | resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" 252 | integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== 253 | 254 | inherits@^2.0.3, inherits@^2.0.4: 255 | version "2.0.4" 256 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 257 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 258 | 259 | is-core-module@^2.8.1: 260 | version "2.9.0" 261 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" 262 | integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== 263 | dependencies: 264 | has "^1.0.3" 265 | 266 | memfs@3.0.4: 267 | version "3.0.4" 268 | resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.0.4.tgz#17997ec34d67d0a4756f6a34f2fefd13a8dbab08" 269 | integrity sha512-OcZEzwX9E5AoY8SXjuAvw0DbIAYwUzV/I236I8Pqvrlv7sL/Y0E9aRCon05DhaV8pg1b32uxj76RgW0s5xjHBA== 270 | dependencies: 271 | fast-extend "1.0.2" 272 | fs-monkey "0.3.3" 273 | 274 | nanoid@^3.3.4: 275 | version "3.3.4" 276 | resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" 277 | integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== 278 | 279 | once@^1.4.0: 280 | version "1.4.0" 281 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 282 | integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== 283 | dependencies: 284 | wrappy "1" 285 | 286 | pako@^1.0.11: 287 | version "1.0.11" 288 | resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" 289 | integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== 290 | 291 | path-browserify@^1.0.0: 292 | version "1.0.1" 293 | resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" 294 | integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== 295 | 296 | path-parse@^1.0.7: 297 | version "1.0.7" 298 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" 299 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== 300 | 301 | picocolors@^1.0.0: 302 | version "1.0.0" 303 | resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" 304 | integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== 305 | 306 | postcss@^8.4.13: 307 | version "8.4.14" 308 | resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" 309 | integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== 310 | dependencies: 311 | nanoid "^3.3.4" 312 | picocolors "^1.0.0" 313 | source-map-js "^1.0.2" 314 | 315 | randombytes@^2.0.5: 316 | version "2.1.0" 317 | resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" 318 | integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== 319 | dependencies: 320 | safe-buffer "^5.1.0" 321 | 322 | randomfill@^1.0.4: 323 | version "1.0.4" 324 | resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" 325 | integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== 326 | dependencies: 327 | randombytes "^2.0.5" 328 | safe-buffer "^5.1.0" 329 | 330 | readable-stream@^3.1.1, readable-stream@^3.4.0: 331 | version "3.6.0" 332 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" 333 | integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== 334 | dependencies: 335 | inherits "^2.0.3" 336 | string_decoder "^1.1.1" 337 | util-deprecate "^1.0.1" 338 | 339 | resolve@^1.22.0: 340 | version "1.22.0" 341 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" 342 | integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== 343 | dependencies: 344 | is-core-module "^2.8.1" 345 | path-parse "^1.0.7" 346 | supports-preserve-symlinks-flag "^1.0.0" 347 | 348 | rollup@^2.59.0: 349 | version "2.75.5" 350 | resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.75.5.tgz#7985c1962483235dd07966f09fdad5c5f89f16d0" 351 | integrity sha512-JzNlJZDison3o2mOxVmb44Oz7t74EfSd1SQrplQk0wSaXV7uLQXtVdHbxlcT3w+8tZ1TL4r/eLfc7nAbz38BBA== 352 | optionalDependencies: 353 | fsevents "~2.3.2" 354 | 355 | safe-buffer@^5.1.0, safe-buffer@~5.2.0: 356 | version "5.2.1" 357 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 358 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 359 | 360 | source-map-js@^1.0.2: 361 | version "1.0.2" 362 | resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" 363 | integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== 364 | 365 | string_decoder@^1.1.1: 366 | version "1.3.0" 367 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" 368 | integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== 369 | dependencies: 370 | safe-buffer "~5.2.0" 371 | 372 | supports-preserve-symlinks-flag@^1.0.0: 373 | version "1.0.0" 374 | resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" 375 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== 376 | 377 | tar-stream@^2.1.0: 378 | version "2.2.0" 379 | resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" 380 | integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== 381 | dependencies: 382 | bl "^4.0.3" 383 | end-of-stream "^1.4.1" 384 | fs-constants "^1.0.0" 385 | inherits "^2.0.3" 386 | readable-stream "^3.1.1" 387 | 388 | tslib@^2.4.0: 389 | version "2.4.0" 390 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" 391 | integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== 392 | 393 | typescript@^4.5.4: 394 | version "4.7.3" 395 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" 396 | integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA== 397 | 398 | util-deprecate@^1.0.1: 399 | version "1.0.2" 400 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" 401 | integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= 402 | 403 | vite@^2.9.9: 404 | version "2.9.9" 405 | resolved "https://registry.yarnpkg.com/vite/-/vite-2.9.9.tgz#8b558987db5e60fedec2f4b003b73164cb081c5e" 406 | integrity sha512-ffaam+NgHfbEmfw/Vuh6BHKKlI/XIAhxE5QSS7gFLIngxg171mg1P3a4LSRME0z2ZU1ScxoKzphkipcYwSD5Ew== 407 | dependencies: 408 | esbuild "^0.14.27" 409 | postcss "^8.4.13" 410 | resolve "^1.22.0" 411 | rollup "^2.59.0" 412 | optionalDependencies: 413 | fsevents "~2.3.2" 414 | 415 | wasm-feature-detect@^1.2.2: 416 | version "1.2.11" 417 | resolved "https://registry.yarnpkg.com/wasm-feature-detect/-/wasm-feature-detect-1.2.11.tgz#e21992fd1f1d41a47490e392a5893cb39d81e29e" 418 | integrity sha512-HUqwaodrQGaZgz1lZaNioIkog9tkeEJjrM3eq4aUL04whXOVDRc/o2EGb/8kV0QX411iAYWEqq7fMBmJ6dKS6w== 419 | 420 | wrappy@1: 421 | version "1.0.2" 422 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 423 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 424 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Tue May 24 2022 14:32:56 GMT+0000 (Coordinated Universal Time) 3 | // process.env.CHROME_BIN = require('puppeteer').executablePath() 4 | 5 | // load rollup config 6 | import rollupConfigFunc from './rollup.config.js'; 7 | let rollupConfig = rollupConfigFunc({environment:"test"})[0] 8 | 9 | export default config => { 10 | config.set({ 11 | 12 | // base path that will be used to resolve all patterns (eg. files, exclude) 13 | basePath: '', 14 | 15 | 16 | // frameworks to use 17 | // available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter 18 | frameworks: ['jasmine'], 19 | 20 | // list of files / patterns to load in the browser 21 | files: [ 22 | // glob test files 23 | { pattern: 'test/**/*.test.ts', watched: false }, 24 | 25 | // loading assets, accessed like http://localhost:[PORT]/base/test/data/my-counter.zip 26 | { pattern: 'test/**/*.zip', watched: false, included: false, served: true, nocache: false }, 27 | ], 28 | 29 | // list of files / patterns to exclude 30 | exclude: [ 31 | ], 32 | 33 | 34 | // preprocess matching files before serving them to the browser 35 | // available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor 36 | preprocessors: { 37 | 'test/**/*.test.ts': ['rollup2'], 38 | }, 39 | 40 | rollupPreprocessor: { 41 | /** 42 | * This is just a normal Rollup config object, 43 | * except that `input` is handled for you. 44 | */ 45 | plugins: rollupConfig.plugins, 46 | output: { 47 | name: 'move', 48 | format: 'iife', 49 | sourcemap: 'inline', 50 | }, 51 | }, 52 | 53 | client: { 54 | jasmine: { 55 | random: true, 56 | seed: '4321', 57 | oneFailurePerSpec: true, 58 | failFast: true, 59 | timeoutInterval: 1000 60 | } 61 | }, 62 | 63 | // test results reporter to use 64 | // possible values: 'dots', 'progress' 65 | // available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter 66 | reporters: ['mocha'], 67 | 68 | 69 | // web server port 70 | port: 9877, 71 | 72 | 73 | // enable / disable colors in the output (reporters and logs) 74 | colors: true, 75 | 76 | 77 | // level of logging 78 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 79 | logLevel: config.LOG_INFO, 80 | 81 | 82 | // enable / disable watching file and executing tests whenever any file changes 83 | autoWatch: false, 84 | 85 | 86 | // start these browsers 87 | // available browser launchers: https://www.npmjs.com/search?q=keywords:karma-launcher 88 | browsers: ['ChromeHeadless'], 89 | 90 | 91 | // Continuous Integration mode 92 | // if true, Karma captures browsers, runs the tests and exits 93 | singleRun: true, 94 | 95 | // Concurrency level 96 | // how many browser instances should be started simultaneously 97 | concurrency: Infinity 98 | }) 99 | } 100 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@starcoin/move-js", 3 | "version": "0.7.1", 4 | "description": "Javascript version of the Move language compiler, supports compiling Move code into Move bytecode in the browser.", 5 | "keywords": [ 6 | "move", 7 | "rust", 8 | "starcoin", 9 | "smart contracts", 10 | "facebook", 11 | "diem", 12 | "blockchain" 13 | ], 14 | "files": [ 15 | "dist", 16 | "src", 17 | "pkg", 18 | "package.json", 19 | "LICENSE", 20 | "README.md" 21 | ], 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/starcoinorg/move-js" 25 | }, 26 | "main": "dist/index.cjs.js", 27 | "module": "dist/index.esm.js", 28 | "iife": "dist/index.iife.js", 29 | "types": "dist/types/index.d.ts", 30 | "browserslist": "> 0.25%, not dead", 31 | "scripts": { 32 | "build:rust": "cargo +nightly build -Zbuild-std=std,panic_abort --target=wasm32-wasi --release && cp ./target/wasm32-wasi/release/move-web.wasm ./pkg/move_bg.wasm", 33 | "build:js": "rollup -c --environment BUILD:production", 34 | "build": "run-s clean build:rust build:js", 35 | "test:integration": "babel-node --presets @babel/preset-env -- ./node_modules/karma/bin/karma start karma.conf.js", 36 | "test": "run-s build test:integration", 37 | "lint": "run-s lint:ts:tslint lint:ts:preetier", 38 | "lint:ts:tslint": "tslint --project tsconfig.json -t codeFrame 'pkg/**/*.ts'", 39 | "lint:ts:preetier": "prettier --write pkg/**/*.ts", 40 | "lint:rust": "cargo fmt", 41 | "clean": "rimraf dist && rimraf pkg/*.wasm", 42 | "release": "npm publish --access public --tag latest" 43 | }, 44 | "author": "starcoinorg", 45 | "license": "SEE LICENSE IN ./LICENSE", 46 | "peerDependencies": { 47 | "rollup": "2.x.x" 48 | }, 49 | "devDependencies": { 50 | "@allex/rollup-plugin-node-globals": "^0.0.2", 51 | "@babel/core": "~7.16.0", 52 | "@babel/node": "^7.17.10", 53 | "@babel/plugin-proposal-object-rest-spread": "~7.16.0", 54 | "@babel/preset-env": "~7.16.0", 55 | "@babel/register": "~7.16.0", 56 | "@crokita/rollup-plugin-node-builtins": "^2.1.3", 57 | "@rollup/plugin-babel": "~5.3.0", 58 | "@rollup/plugin-commonjs": "~21.0.1", 59 | "@rollup/plugin-node-resolve": "~13.0.6", 60 | "@rollup/plugin-url": "^6.1.0", 61 | "@rollup/plugin-wasm": "^5.2.0", 62 | "@types/jest": "^27.5.1", 63 | "@types/karma": "^5.0.1", 64 | "@types/mocha": "^8.2.0", 65 | "@types/node": "^14.14.19", 66 | "@wasm-tool/wasm-pack-plugin": "1.6.0", 67 | "@zip.js/zip.js": "^2.4.12", 68 | "babel-node": "^0.0.1-security", 69 | "cross-env": "~7.0.3", 70 | "eslint": "~7.18.0", 71 | "husky": "^4.3.6", 72 | "jasmine-core": "^4.1.0", 73 | "jest": "^27.3.1", 74 | "karma": "^6.3.18", 75 | "karma-chrome-launcher": "^3.1.0", 76 | "karma-jasmine": "^5.0.1", 77 | "karma-mocha-reporter": "^2.2.5", 78 | "karma-rollup2-preprocessor": "^1.0.1", 79 | "npm-run-all": "~4.1.5", 80 | "prettier": "^2.6.2", 81 | "rimraf": "~3.0.2", 82 | "rollup": "~2.60.0", 83 | "rollup-plugin-node-builtins": "^2.1.2", 84 | "rollup-plugin-node-globals": "^1.4.0", 85 | "rollup-plugin-terser": "~7.0.2", 86 | "rollup-plugin-typescript2": "^0.24.3", 87 | "tslib": "^2.3.1", 88 | "tslint": "^6.1.3", 89 | "typescript": "^4.5.2" 90 | }, 91 | "dependencies": { 92 | "@iarna/toml": "^2.2.5", 93 | "@swc/helpers": "^0.3.13", 94 | "@wasmer/wasi": "^0.12.0", 95 | "@wasmer/wasm-transformer": "^0.10.0", 96 | "@wasmer/wasmfs": "^0.12.0" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /pkg/disassemble.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | import { Move } from '../pkg/move' 3 | 4 | export interface IDisassemble { 5 | disassemble( 6 | name: string, 7 | bytecode: string, 8 | callback: (ok: boolean, data: string) => void 9 | ): Promise 10 | } 11 | 12 | export class Disassemble implements IDisassemble { 13 | private wasmfs: WasmFs 14 | 15 | constructor(wasmfs: WasmFs) { 16 | this.wasmfs = wasmfs 17 | } 18 | 19 | public async disassemble( 20 | name: string, 21 | bytecode: string, 22 | callback: (ok: boolean, data: string) => void 23 | ): Promise { 24 | const root = '/workspace/disassemble/' 25 | this.wasmfs.fs.mkdirpSync(root) 26 | 27 | const codePath = root + name 28 | this.wasmfs.fs.writeFileSync(codePath, bytecode) 29 | 30 | const cli = new Move(this.wasmfs, { 31 | pwd: '/workspace/disassemble/', 32 | preopens: ['/workspace'], 33 | }) 34 | 35 | await cli.run(['--', 'disassemble', '--file_path', codePath]) 36 | 37 | const ntfExists = this.wasmfs.fs.existsSync(codePath + '.d') 38 | 39 | if (ntfExists) { 40 | await this.wasmfs.fs.readFile(codePath + '.d', (_, v) => 41 | callback(true, v?.toString()) 42 | ) 43 | } else { 44 | await this.wasmfs.fs.readFile(codePath + '.e', (_, v) => 45 | callback(false, v?.toString()) 46 | ) 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pkg/git.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | import * as zip from '@zip.js/zip.js' 3 | import * as path from 'path' 4 | 5 | /** 6 | * Git interface 7 | */ 8 | export interface IGit { 9 | /** 10 | * Download code to dest path 11 | * 12 | * @param repoUrl 13 | * @param destPath 14 | */ 15 | download(repoUrl: string, destPath: string): Promise 16 | } 17 | 18 | /** 19 | * Git 20 | * 21 | */ 22 | export class Git implements IGit { 23 | public wasmfs?: WasmFs 24 | 25 | constructor(wasmfs: WasmFs) { 26 | this.wasmfs = wasmfs 27 | } 28 | 29 | async download(zipURL: string, destPath: string): Promise { 30 | const binary = await getBinaryFromUrl(zipURL) 31 | this.wasmfs.fs.mkdirpSync(destPath) 32 | 33 | const zipReader = new zip.ZipReader(new zip.Uint8ArrayReader(binary)) 34 | 35 | try { 36 | const entries = await zipReader.getEntries() 37 | 38 | for (const entry of entries) { 39 | if (entry.directory) { 40 | const newDest = path.join(destPath, entry.filename) 41 | this.wasmfs.fs.mkdirpSync(newDest) 42 | } else { 43 | const destEntry = path.join(destPath, entry.filename) 44 | const data = await entry.getData(new zip.Uint8ArrayWriter()) 45 | this.wasmfs.fs.writeFileSync(destEntry, data) 46 | } 47 | } 48 | } finally { 49 | await zipReader.close() 50 | } 51 | } 52 | } 53 | 54 | /** 55 | * Get binary from URL 56 | * 57 | * @param {String} url 58 | * @return {Uint8Array} 59 | */ 60 | async function getBinaryFromUrl(url: string): Promise { 61 | const fetched = await fetch(url) 62 | const buffer = await fetched.arrayBuffer() 63 | return new Uint8Array(buffer) 64 | } 65 | -------------------------------------------------------------------------------- /pkg/index.ts: -------------------------------------------------------------------------------- 1 | import { Git } from './git' 2 | import { Move } from './move' 3 | import { MovePackage } from './package' 4 | import { Disassemble } from './disassemble' 5 | 6 | export { Git, Move, MovePackage, Disassemble } 7 | -------------------------------------------------------------------------------- /pkg/move.ts: -------------------------------------------------------------------------------- 1 | import { WASI, WASIPreopenedDirs } from '@wasmer/wasi/lib' 2 | import browserBindings from '@wasmer/wasi/lib/bindings/browser' 3 | import { WasmFs } from '@wasmer/wasmfs' 4 | import loadMoveWasmModule from './move_bg' 5 | 6 | export interface IMove { 7 | run(args?: string[]): Promise 8 | } 9 | 10 | export interface IMoveOption { 11 | pwd?: string 12 | preopens?: [string] 13 | } 14 | 15 | export class Move implements IMove { 16 | private wasmFs: WasmFs 17 | private opts?: IMoveOption 18 | 19 | constructor(wasmFs: WasmFs, opts?: IMoveOption) { 20 | this.wasmFs = wasmFs 21 | this.opts = opts 22 | 23 | if (this.opts == null) { 24 | this.wasmFs.fs.mkdirpSync('/tmp') 25 | this.opts = { 26 | pwd: '/tmp', 27 | } 28 | } 29 | } 30 | 31 | async run(args?: string[]): Promise { 32 | const opts = this.opts 33 | 34 | const preopens: WASIPreopenedDirs = {} 35 | if (opts.preopens) { 36 | preopens[opts.pwd] = opts.pwd 37 | 38 | opts.preopens.forEach((value: string) => { 39 | preopens[value] = value 40 | }) 41 | } else { 42 | preopens[opts.pwd] = opts.pwd 43 | } 44 | 45 | const wasi = new WASI({ 46 | preopens, 47 | 48 | // Arguments passed to the Wasm Module 49 | // The first argument is usually the filepath to the executable WASI module 50 | // we want to run. 51 | args, 52 | 53 | // Environment variables that are accesible to the WASI module 54 | env: { 55 | PWD: opts.pwd, 56 | }, 57 | 58 | // Bindings that are used by the WASI Instance (fs, path, etc...) 59 | bindings: { 60 | ...browserBindings, 61 | fs: this.wasmFs.fs, 62 | }, 63 | }) 64 | 65 | // Instantiate the WebAssembly file 66 | const wasmModule = await loadMoveWasmModule() 67 | const instance = await WebAssembly.instantiate(wasmModule, { 68 | ...wasi.getImports(wasmModule), 69 | }) 70 | 71 | try { 72 | // @ts-ignore 73 | wasi.start(instance) // Start the WASI instance 74 | } catch (e) { 75 | console.error(e) 76 | } 77 | 78 | // Output what's inside of /dev/stdout! 79 | const stdout = await this.wasmFs.getStdOut() 80 | 81 | const stderr = await this.getStdErr() 82 | if (stderr) { 83 | console.error('Standard Error: \n' + stderr) 84 | } 85 | 86 | return stdout 87 | } 88 | 89 | async getStdErr() { 90 | const promise = new Promise((resolve) => { 91 | resolve(this.wasmFs.fs.readFileSync('/dev/stderr', 'utf8')) 92 | }) 93 | 94 | return promise 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /pkg/move_bg.js: -------------------------------------------------------------------------------- 1 | import moveWasm from './move_bg.wasm' 2 | export default moveWasm -------------------------------------------------------------------------------- /pkg/move_bg.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/pkg/move_bg.wasm -------------------------------------------------------------------------------- /pkg/package.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path' 2 | import * as TOML from '@iarna/toml' 3 | import { WasmFs } from '@wasmer/wasmfs' 4 | import { Move } from '../pkg/move' 5 | 6 | export interface IDependency { 7 | git?: string 8 | rev?: string 9 | local?: string 10 | } 11 | 12 | export interface IMovePackage { 13 | name?: string 14 | version?: string 15 | addresses?: Map 16 | dependencies?: Map 17 | devDependencies?: Map 18 | 19 | build(): void 20 | } 21 | 22 | export type MoveOptions = { 23 | packagePath: string 24 | test: boolean 25 | alias?: Map 26 | initFunction?: string 27 | } 28 | 29 | export class MovePackage implements IMovePackage { 30 | public name?: string 31 | public version?: string 32 | public addresses?: Map 33 | public devDependencies?: Map 34 | public dependencies?: Map 35 | 36 | private wasmfs: WasmFs 37 | private packagePath: string 38 | private packageAlias: Map 39 | private test: boolean 40 | private initFunction?: string 41 | 42 | constructor(wasmfs: WasmFs, opts: MoveOptions) { 43 | this.wasmfs = wasmfs 44 | this.packagePath = opts.packagePath 45 | 46 | const tomlPath = path.join(opts.packagePath, 'Move.toml') 47 | const tomlContent = wasmfs.fs.readFileSync(tomlPath, 'utf-8') 48 | this.parseToml(tomlContent.toString()) 49 | 50 | const packageAlias = new Map() 51 | if (opts.alias != null) { 52 | opts.alias.forEach((val: string, key: string) => { 53 | packageAlias.set(key, val) 54 | }) 55 | } 56 | 57 | this.packageAlias = packageAlias 58 | this.test = opts.test 59 | this.initFunction = opts.initFunction 60 | } 61 | 62 | parseToml(tomlContent: string): void { 63 | const toml = TOML.parse(tomlContent) 64 | 65 | // @ts-ignore 66 | this.name = toml['package']['name'] as string 67 | 68 | // @ts-ignore 69 | this.version = toml['package']['version'] as string 70 | 71 | this.addresses = new Map() 72 | 73 | // @ts-ignore 74 | for (const key in toml['addresses']) { 75 | if (toml['addresses'].hasOwnProperty(key)) { 76 | // @ts-ignore 77 | this.addresses.set(key, toml['addresses'][key]) 78 | } 79 | } 80 | 81 | // dev dependencies 82 | this.devDependencies = new Map() 83 | this.parseDeps(this.devDependencies, toml['dev-dependencies']) 84 | 85 | // dev dependenciesd 86 | this.dependencies = new Map() 87 | this.parseDeps(this.dependencies, toml['dependencies']) 88 | } 89 | 90 | parseDeps(thisDeps: Map, tomlDeps: any): void { 91 | // @ts-ignore 92 | for (const key in tomlDeps) { 93 | if (!tomlDeps.hasOwnProperty(key)) { 94 | continue 95 | } 96 | 97 | // @ts-ignore 98 | const dep = tomlDeps[key] 99 | 100 | if (dep != null) { 101 | const depInfo = { 102 | git: dep['git'], 103 | rev: dep['rev'], 104 | local: dep['local'], 105 | } 106 | 107 | thisDeps.set(key, depInfo) 108 | } 109 | } 110 | } 111 | 112 | public async build(): Promise { 113 | const deps = this.getAllDeps() 114 | const addresses = this.getAllAddresses() 115 | 116 | await this.buildPackage(this.wasmfs, this.packagePath, deps, addresses) 117 | } 118 | 119 | public getAllDeps(): string[] { 120 | const deps = new Array() 121 | 122 | this.collectDependencies(deps, this.dependencies) 123 | this.collectDependencies(deps, this.devDependencies) 124 | 125 | return deps 126 | } 127 | 128 | collectDependencies(allDeps: string[], modules: Map) { 129 | const packageAlias = this.packageAlias 130 | 131 | if (modules) { 132 | modules.forEach((dep: IDependency, key: string) => { 133 | const aliasPath = packageAlias.get(key) 134 | 135 | if (aliasPath != null) { 136 | allDeps.push(aliasPath) 137 | 138 | new MovePackage(this.wasmfs, { 139 | packagePath: aliasPath, 140 | test: false, 141 | }) 142 | .getAllDeps() 143 | .forEach((depName: string) => { 144 | allDeps.push(depName) 145 | }) 146 | 147 | return 148 | } 149 | 150 | if (dep.local) { 151 | const depPath = path.join(this.packagePath, dep.local) 152 | allDeps.push(depPath) 153 | 154 | new MovePackage(this.wasmfs, { 155 | packagePath: depPath, 156 | test: false, 157 | }) 158 | .getAllDeps() 159 | .forEach((depName: string) => { 160 | allDeps.push(depName) 161 | }) 162 | } 163 | }) 164 | } 165 | } 166 | 167 | public getAllAddresses(): Map { 168 | const allAddresses = new Map() 169 | 170 | this.addresses.forEach((val: string, key: string) => { 171 | allAddresses.set(key, val) 172 | }) 173 | 174 | this.collectAddresses(allAddresses, this.dependencies) 175 | this.collectAddresses(allAddresses, this.devDependencies) 176 | 177 | return allAddresses 178 | } 179 | 180 | collectAddresses( 181 | allAddresss: Map, 182 | modules: Map 183 | ) { 184 | const packageAlias = this.packageAlias 185 | 186 | if (modules) { 187 | modules.forEach((dep: IDependency, key: string) => { 188 | const aliasPath = packageAlias.get(key) 189 | 190 | if (aliasPath != null) { 191 | const mp = new MovePackage(this.wasmfs, { 192 | packagePath: aliasPath, 193 | test: false, 194 | }) 195 | const addresses = mp.getAllAddresses() 196 | if (addresses) { 197 | addresses.forEach((addr: string, name: string) => { 198 | allAddresss.set(name, addr) 199 | }) 200 | } 201 | 202 | return 203 | } 204 | 205 | if (dep.local) { 206 | const depPath = path.join(this.packagePath, dep.local) 207 | const mp = new MovePackage(this.wasmfs, { 208 | packagePath: depPath, 209 | test: false, 210 | }) 211 | 212 | const addresses = mp.getAllAddresses() 213 | if (addresses) { 214 | addresses.forEach((addr: string, name: string) => { 215 | allAddresss.set(name, addr) 216 | }) 217 | } 218 | } 219 | }) 220 | } 221 | } 222 | 223 | async buildPackage( 224 | wasmfs: WasmFs, 225 | packagePath: string, 226 | deps: string[], 227 | addresses: Map 228 | ): Promise { 229 | console.log('Building ', this.name) 230 | 231 | const cli = new Move(wasmfs, { 232 | pwd: packagePath, 233 | preopens: ['/workspace'], 234 | }) 235 | 236 | const depDirs = deps.join(',') 237 | const addressMaps = new Array() 238 | addresses.forEach((val: string, key: string) => { 239 | addressMaps.push(key + ':' + val) 240 | }) 241 | const addressArgs = addressMaps.join(',') 242 | 243 | let initFunction = '' 244 | if (this.initFunction) { 245 | initFunction = this.initFunction 246 | } 247 | 248 | console.log('build deps:', depDirs) 249 | console.log('build addresses:', addressArgs) 250 | console.log('is test:', this.test) 251 | console.log('initFunction:', initFunction) 252 | 253 | await cli.run([ 254 | '--', 255 | 'build', 256 | '--dependency_dirs', 257 | depDirs, 258 | '--address_maps', 259 | addressArgs, 260 | '--test', 261 | String(this.test), 262 | '--init_function', 263 | initFunction, 264 | ]) 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import globals from "@allex/rollup-plugin-node-globals"; 2 | import builtins from "rollup-plugin-node-builtins"; 3 | import resolve from '@rollup/plugin-node-resolve'; 4 | import commonjs from '@rollup/plugin-commonjs'; 5 | import typescript from 'rollup-plugin-typescript2'; 6 | 7 | import pkg from './package.json'; 8 | import { wasm } from '@rollup/plugin-wasm'; 9 | 10 | import { terser } from 'rollup-plugin-terser'; 11 | 12 | const LIBRARY_NAME = 'index'; // Change with your library's name 13 | const EXTERNAL = ["@wasmer/wasmfs","@wasmer/wasi"]; // Indicate which modules should be treated as external 14 | const GLOBALS = {}; // https://rollupjs.org/guide/en/#outputglobals 15 | 16 | const banner = `/*! 17 | * ${pkg.name} 18 | * ${pkg.description} 19 | * 20 | * @version v${pkg.version} 21 | * @author ${pkg.author} 22 | * @homepage ${pkg.homepage} 23 | * @repository ${pkg.repository.url} 24 | * @license ${pkg.license} 25 | */`; 26 | 27 | const extensions = [ 28 | '.js', 29 | '.ts', 30 | '.tsx' 31 | ] 32 | 33 | const makeConfig = (env = 'development') => { 34 | let bundleSuffix = ''; 35 | let sourcemapOption = 'inline' 36 | 37 | if (env === 'production') { 38 | bundleSuffix = 'min.'; 39 | sourcemapOption = undefined 40 | } 41 | 42 | const config = { 43 | input: './pkg/index.ts', 44 | external: EXTERNAL, 45 | sourceMap: true, 46 | output: [ 47 | { 48 | banner, 49 | name: LIBRARY_NAME, 50 | file: `dist/${LIBRARY_NAME}.iife.${bundleSuffix}js`, // IIFE 51 | format: 'iife', 52 | exports: 'auto', 53 | sourcemap: sourcemapOption, 54 | globals: GLOBALS 55 | }, 56 | { 57 | banner, 58 | name: LIBRARY_NAME, 59 | file: `dist/${LIBRARY_NAME}.umd.${bundleSuffix}js`, // UMD 60 | format: 'umd', 61 | exports: 'auto', 62 | sourcemap: sourcemapOption, 63 | globals: GLOBALS 64 | }, 65 | { 66 | banner, 67 | file: `dist/${LIBRARY_NAME}.cjs.${bundleSuffix}js`, // CommonJS 68 | format: 'cjs', 69 | exports: 'auto', 70 | sourcemap: sourcemapOption, 71 | globals: GLOBALS 72 | }, 73 | { 74 | banner, 75 | file: `dist/${LIBRARY_NAME}.esm.${bundleSuffix}js`, // ESM 76 | format: 'es', 77 | exports: 'named', 78 | sourcemap: sourcemapOption, 79 | globals: GLOBALS 80 | } 81 | ], 82 | plugins: [ 83 | wasm({ 84 | targetEnv: "auto-inline" 85 | }), 86 | typescript({ 87 | tsconfig: "./tsconfig.json", 88 | useTsconfigDeclarationDir: true, 89 | extensions: extensions, 90 | clean: true 91 | }), 92 | // Uncomment the following 2 lines if your library has external dependencies 93 | resolve({ 94 | preferBuiltins: false, 95 | }), // teach Rollup how to find external modules 96 | commonjs(), 97 | globals(), 98 | builtins({ 99 | extensions 100 | }) 101 | ] 102 | }; 103 | 104 | if (env === 'production') { 105 | config.plugins.push(terser({ 106 | output: { 107 | comments: /^!/ 108 | } 109 | })); 110 | } 111 | 112 | return config; 113 | }; 114 | 115 | export default commandLineArgs => { 116 | const configs = [ 117 | makeConfig() 118 | ]; 119 | 120 | // Production 121 | if (commandLineArgs.environment === 'BUILD:production') { 122 | configs.push(makeConfig('production')); 123 | } 124 | 125 | return configs; 126 | }; -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | 3 | #[derive(Parser)] 4 | #[clap(version, author, about, long_about = None)] 5 | pub struct CliOptions { 6 | #[clap(subcommand)] 7 | pub commands: Commands, 8 | } 9 | 10 | #[derive(Parser)] 11 | pub enum Commands { 12 | #[clap(name = "build")] 13 | Build { 14 | #[clap(long = "dependency_dirs")] 15 | dependency_dirs: Option, 16 | 17 | #[clap(long = "address_maps")] 18 | address_maps: Option, 19 | 20 | #[clap(long = "targets", short = 't')] 21 | targets: Option, 22 | 23 | #[clap(long = "test")] 24 | test: Option, 25 | 26 | #[clap(long = "init_function", short = 'i')] 27 | init_function: Option, 28 | }, 29 | #[clap(name = "disassemble")] 30 | Disassemble(DisassembleArgs), 31 | } 32 | 33 | #[derive(Parser)] 34 | pub struct DisassembleArgs { 35 | /// Skip printing of private functions. 36 | #[clap(long = "skip-private")] 37 | pub skip_private: bool, 38 | 39 | /// Do not print the disassembled bytecodes of each function. 40 | #[clap(long = "skip-code")] 41 | pub skip_code: bool, 42 | 43 | /// Do not print locals of each function. 44 | #[clap(long = "skip-locals")] 45 | pub skip_locals: bool, 46 | 47 | /// Do not print the basic blocks of each function. 48 | #[clap(long = "skip-basic-blocks")] 49 | pub skip_basic_blocks: bool, 50 | 51 | /// Treat input file as a script (default is to treat file as a module) 52 | #[clap(short = 's', long = "script")] 53 | pub is_script: bool, 54 | 55 | /// The path to the bytecode file to disassemble; let's call it file.mv. We assume that two 56 | /// other files reside under the same directory: a source map file.mvsm (possibly) and the Move 57 | /// source code file.move. 58 | #[clap(short = 'b', long = "file_path")] 59 | pub file_path: String, 60 | } 61 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod cli; 2 | pub mod targets; 3 | pub mod utils; 4 | 5 | use cli::DisassembleArgs; 6 | use std::fs::File; 7 | use std::io::{Read, Write}; 8 | use walkdir::WalkDir; 9 | 10 | use move_compiler::compiled_unit::CompiledUnit; 11 | use move_compiler::diagnostics::unwrap_or_report_diagnostics; 12 | use move_compiler::shared::{Flags, NumericalAddress}; 13 | use move_compiler::Compiler; 14 | use targets::target::TargetType; 15 | 16 | use move_binary_format::{ 17 | binary_views::BinaryIndexedView, 18 | file_format::{CompiledModule, CompiledScript}, 19 | }; 20 | use move_bytecode_source_map::mapping::SourceMapping; 21 | use move_disassembler::disassembler::{Disassembler, DisassemblerOptions}; 22 | use move_ir_types::location::Spanned; 23 | 24 | use anyhow::{Error, Result}; 25 | use std::collections::BTreeMap; 26 | 27 | use std::path::Path; 28 | 29 | fn convert_named_addresses(address_maps: &Vec<(&str, &str)>) -> BTreeMap { 30 | address_maps 31 | .iter() 32 | .map(|(name, addr)| (name.to_string(), NumericalAddress::parse_str(addr).unwrap())) 33 | .collect() 34 | } 35 | 36 | pub fn build_package( 37 | package_path: &str, 38 | dep_dirs: &Vec<&str>, 39 | address_maps: &Vec<(&str, &str)>, 40 | target_types: &Vec<&str>, 41 | test_mode: bool, 42 | init_function: &str, 43 | ) -> Result<(), Error> { 44 | let mut sources: Vec = vec![]; 45 | let mut deps: Vec = vec![]; 46 | let mut targets: Vec = vec![]; 47 | 48 | let path = Path::new(&package_path); 49 | let sources_dir = path.join("sources"); 50 | 51 | for entry in WalkDir::new(sources_dir) { 52 | let entry_raw = entry?; 53 | 54 | if entry_raw.path().is_file() { 55 | let move_file_path = entry_raw.path().to_str(); 56 | match move_file_path { 57 | Some(f) => { 58 | sources.push(f.to_string()); 59 | } 60 | _ => {} 61 | } 62 | } 63 | } 64 | 65 | for dep_dir in dep_dirs { 66 | let dep_path = Path::new(dep_dir); 67 | let dep_sources_dir = dep_path.join("sources"); 68 | 69 | for entry in WalkDir::new(dep_sources_dir) { 70 | let entry_raw = entry?; 71 | 72 | if entry_raw.path().is_file() { 73 | let move_file_path = entry_raw.path().to_str(); 74 | match move_file_path { 75 | Some(f) => { 76 | deps.push(f.to_string()); 77 | } 78 | _ => {} 79 | } 80 | } 81 | } 82 | } 83 | 84 | for target_type in target_types { 85 | let target = TargetType::from((*target_type).to_string()); 86 | targets.push(target); 87 | } 88 | 89 | let mut flags = Flags::empty().set_sources_shadow_deps(true); 90 | if test_mode { 91 | flags = Flags::testing().set_sources_shadow_deps(true); 92 | } 93 | 94 | let c = Compiler::new(&sources, &deps) 95 | .set_named_address_values(convert_named_addresses(address_maps)) 96 | .set_flags(flags); 97 | 98 | let (source_text, compiled_result) = c.build()?; 99 | 100 | let compiled_units = unwrap_or_report_diagnostics(&source_text, compiled_result); 101 | 102 | let units: Vec = compiled_units 103 | .0 104 | .into_iter() 105 | .map(|c| c.into_compiled_unit()) 106 | .collect(); 107 | 108 | // Output compile targets 109 | let root_path = Path::new(&package_path); 110 | targets::target::output(&units, &targets, root_path, init_function) 111 | } 112 | 113 | pub fn disassemble(args: DisassembleArgs) { 114 | let path = Path::new(&args.file_path); 115 | 116 | let mut file = match File::open(&path) { 117 | Err(e) => panic!("{}", e), 118 | Ok(f) => f, 119 | }; 120 | 121 | let mut s = String::new(); 122 | match file.read_to_string(&mut s) { 123 | Ok(_) => println!("ok"), 124 | Err(e) => println!("{}", e), 125 | } 126 | 127 | if s.find("x") != Some(0) { 128 | s.replace_range(0..2, ""); 129 | } 130 | 131 | let bytecode_bytes = hex::decode(s.as_bytes()).unwrap(); 132 | 133 | let mut disassembler_options = DisassemblerOptions::new(); 134 | disassembler_options.print_code = !args.skip_code; 135 | disassembler_options.only_externally_visible = !args.skip_private; 136 | disassembler_options.print_basic_blocks = !args.skip_basic_blocks; 137 | disassembler_options.print_locals = !args.skip_locals; 138 | 139 | let no_loc = Spanned::unsafe_no_loc(()).loc; 140 | let module: CompiledModule; 141 | let script: CompiledScript; 142 | let biv = if args.is_script { 143 | script = CompiledScript::deserialize(&bytecode_bytes) 144 | .expect("Script blob can't be deserialized"); 145 | BinaryIndexedView::Script(&script) 146 | } else { 147 | module = CompiledModule::deserialize(&bytecode_bytes) 148 | .expect("Module blob can't be deserialized"); 149 | BinaryIndexedView::Module(&module) 150 | }; 151 | 152 | let source_mapping = 153 | SourceMapping::new_from_view(biv, no_loc).expect("Unable to build dummy source mapping"); 154 | 155 | let disassembler = Disassembler::new(source_mapping, disassembler_options); 156 | 157 | let result = match disassembler.disassemble() { 158 | Ok(v) => ("d", v), 159 | Err(e) => ("e", e.to_string()), 160 | }; 161 | 162 | let mut output = path.parent().unwrap().to_path_buf(); 163 | 164 | output.push(format!( 165 | "{}.{}", 166 | path.file_name().unwrap().to_str().unwrap(), 167 | result.0 168 | )); 169 | 170 | let mut f = File::create(output.as_path()).unwrap(); 171 | 172 | println!("{}", result.1); 173 | 174 | match writeln!(f, "{}", result.1) { 175 | Err(e) => panic!("{}", e), 176 | _ => {} 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::panic; 3 | 4 | use clap::Parser; 5 | 6 | use move_web::cli::{CliOptions, Commands}; 7 | 8 | fn hook_impl(info: &panic::PanicInfo) { 9 | let _ = println!("{}", info); 10 | } 11 | 12 | fn parse_address_map(address_map: &str) -> Result<(&str, &str), String> { 13 | let mut tokens = address_map.split(":"); 14 | 15 | match tokens.next() { 16 | Some(name) => match tokens.next() { 17 | Some(address) => Ok((name, address)), 18 | None => Err(format!("Not found address name in address_map",)), 19 | }, 20 | None => Err(format!("Not found address in address_map",)), 21 | } 22 | } 23 | 24 | fn main() -> std::io::Result<()> { 25 | panic::set_hook(Box::new(hook_impl)); 26 | 27 | let pwd = env::var("PWD").expect("must has set PWD env"); 28 | println!("pwd: {:?}", pwd); 29 | 30 | let args = CliOptions::parse(); 31 | 32 | match args.commands { 33 | Commands::Build { 34 | dependency_dirs, 35 | address_maps, 36 | targets, 37 | test, 38 | init_function, 39 | } => { 40 | let dependency_dirs = match dependency_dirs { 41 | Some(ref v) => v.split(",").collect(), 42 | None => vec![], 43 | }; 44 | 45 | let address_maps = match address_maps { 46 | Some(ref v) => v 47 | .split(",") 48 | .map(|x: &str| parse_address_map(x).unwrap()) 49 | .collect(), 50 | None => vec![], // None => vec!<&str, &str>[], 51 | }; 52 | 53 | let targets = match targets { 54 | Some(ref v) => v.split(",").collect(), 55 | None => vec!["starcoin"], 56 | }; 57 | 58 | let test_mode = test.unwrap_or(false); 59 | 60 | let init_function = init_function.unwrap_or("".to_string()); 61 | 62 | let ret = move_web::build_package( 63 | &pwd, 64 | &dependency_dirs, 65 | &address_maps, 66 | &targets, 67 | test_mode, 68 | init_function.as_str(), 69 | ); 70 | match ret { 71 | Ok(()) => { 72 | println!("build package ok"); 73 | } 74 | Err(e) => { 75 | println!("build package error: {:?}", e); 76 | } 77 | } 78 | } 79 | 80 | Commands::Disassemble(args) => move_web::disassemble(args), 81 | } 82 | 83 | Ok(()) 84 | } 85 | -------------------------------------------------------------------------------- /src/targets/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod starcoin; 2 | pub mod target; 3 | -------------------------------------------------------------------------------- /src/targets/starcoin/mod.rs: -------------------------------------------------------------------------------- 1 | mod types; 2 | 3 | use move_binary_format::CompiledModule; 4 | use move_compiler::compiled_unit::{CompiledUnit, NamedCompiledModule}; 5 | 6 | use crate::targets::target::Target; 7 | use crate::utils::bcs_ext; 8 | use anyhow::{Error, Result}; 9 | use starcoin_crypto::hash::PlainCryptoHash; 10 | use std::path::Path; 11 | use types::function::FunctionId; 12 | use types::module::Module; 13 | use types::package::Package; 14 | use types::script::ScriptFunction; 15 | 16 | pub struct StarcoinTarget {} 17 | 18 | impl StarcoinTarget { 19 | pub fn new() -> Self { 20 | return Self {}; 21 | } 22 | } 23 | 24 | impl Target for StarcoinTarget { 25 | fn output( 26 | self, 27 | units: &Vec, 28 | dest_path: &Path, 29 | init_function: &str, 30 | ) -> Result<()> { 31 | let mut modules = vec![]; 32 | 33 | for mv in units { 34 | let m = module(&mv)?; 35 | let code = { 36 | let mut data = vec![]; 37 | m.serialize(&mut data)?; 38 | data 39 | }; 40 | 41 | modules.push(Module::new(code)); 42 | } 43 | 44 | let mut init_script: Option = None; 45 | if init_function != "" { 46 | let func = FunctionId::from(init_function); 47 | init_script = match &func { 48 | Ok(script) => { 49 | let script_function = script.clone(); 50 | Some(ScriptFunction::new( 51 | script_function.module, 52 | script_function.function, 53 | vec![], 54 | vec![], 55 | )) 56 | } 57 | _ => anyhow::bail!("Found script in modules -- this shouldn't happen"), 58 | }; 59 | } 60 | 61 | save_release_package(dest_path, modules, init_script)?; 62 | 63 | Ok(()) 64 | } 65 | } 66 | 67 | fn module(unit: &CompiledUnit) -> anyhow::Result<&CompiledModule> { 68 | match unit { 69 | CompiledUnit::Module(NamedCompiledModule { module, .. }) => Ok(module), 70 | _ => anyhow::bail!("Found script in modules -- this shouldn't happen"), 71 | } 72 | } 73 | 74 | fn save_release_package( 75 | root_dir: &Path, 76 | modules: Vec, 77 | init_script: Option, 78 | ) -> Result<(), Error> { 79 | let mut release_dir = root_dir.join("release"); 80 | 81 | let p = Package::new(modules, init_script)?; 82 | let blob = bcs_ext::to_bytes(&p)?; 83 | let release_path = { 84 | std::fs::create_dir_all(&release_dir)?; 85 | release_dir.push(format!("{}.blob", "package")); 86 | release_dir.to_path_buf() 87 | }; 88 | std::fs::write(&release_path, blob)?; 89 | 90 | let release_hash_path = { 91 | release_dir.pop(); 92 | release_dir.push("hash.txt"); 93 | release_dir 94 | }; 95 | 96 | let hash = p.crypto_hash().to_string(); 97 | 98 | std::fs::write(&release_hash_path, &hash)?; 99 | 100 | println!("build done, saved: {}, {}", release_path.display(), hash); 101 | 102 | Ok(()) 103 | } 104 | -------------------------------------------------------------------------------- /src/targets/starcoin/types/function.rs: -------------------------------------------------------------------------------- 1 | use move_core_types::account_address::AccountAddress; 2 | use move_core_types::identifier::Identifier; 3 | use move_core_types::language_storage::ModuleId; 4 | 5 | #[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq)] 6 | pub struct FunctionId { 7 | pub module: ModuleId, 8 | pub function: Identifier, 9 | } 10 | 11 | impl std::fmt::Display for FunctionId { 12 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 13 | write!(f, "{}::{}", &self.module, &self.function) 14 | } 15 | } 16 | 17 | impl FunctionId { 18 | pub fn from(s: &str) -> anyhow::Result { 19 | let splits: Vec<&str> = s.rsplitn(2, "::").collect(); 20 | if splits.len() != 2 { 21 | anyhow::bail!("invalid script function id"); 22 | } 23 | let module_id = parse_module_id(splits[1])?; 24 | let function = Identifier::new(splits[0])?; 25 | Ok(FunctionId { 26 | module: module_id, 27 | function, 28 | }) 29 | } 30 | } 31 | 32 | pub fn parse_module_id(s: &str) -> Result { 33 | let parts: Vec<_> = s.split("::").collect(); 34 | if parts.len() != 2 { 35 | anyhow::bail!("invalid module id"); 36 | } 37 | let module_addr = parts[0].parse::()?; 38 | let module_name = Identifier::new(parts[1])?; 39 | Ok(ModuleId::new(module_addr, module_name)) 40 | } 41 | -------------------------------------------------------------------------------- /src/targets/starcoin/types/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod function; 2 | pub mod module; 3 | pub mod package; 4 | pub mod script; 5 | -------------------------------------------------------------------------------- /src/targets/starcoin/types/module.rs: -------------------------------------------------------------------------------- 1 | use schemars::{self, JsonSchema}; 2 | use serde::{Deserialize, Serialize}; 3 | use std::fmt; 4 | 5 | #[derive(Clone, Hash, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] 6 | pub struct Module { 7 | #[serde(with = "serde_bytes")] 8 | #[schemars(with = "String")] 9 | code: Vec, 10 | } 11 | impl From for Vec { 12 | fn from(m: Module) -> Self { 13 | m.code 14 | } 15 | } 16 | impl Module { 17 | pub fn new(code: Vec) -> Module { 18 | Module { code } 19 | } 20 | 21 | pub fn code(&self) -> &[u8] { 22 | &self.code 23 | } 24 | } 25 | 26 | impl fmt::Debug for Module { 27 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 28 | f.debug_struct("Module") 29 | .field("code", &hex::encode(&self.code)) 30 | .finish() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/targets/starcoin/types/package.rs: -------------------------------------------------------------------------------- 1 | use anyhow::{ensure, Result}; 2 | 3 | use move_binary_format::access::ModuleAccess; 4 | use move_binary_format::errors::Location; 5 | use move_binary_format::CompiledModule; 6 | use move_core_types::account_address::AccountAddress; 7 | use schemars::JsonSchema; 8 | use serde::{Deserialize, Serialize}; 9 | 10 | use starcoin_crypto::hash::{CryptoHash, CryptoHasher}; 11 | 12 | use crate::targets::starcoin::types::module::Module; 13 | use crate::targets::starcoin::types::script::ScriptFunction; 14 | use crate::utils::bcs_ext; 15 | 16 | #[derive( 17 | Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize, CryptoHasher, CryptoHash, JsonSchema, 18 | )] 19 | pub struct Package { 20 | ///Package's all Module must at same address. 21 | #[schemars(with = "String")] 22 | package_address: AccountAddress, 23 | modules: Vec, 24 | init_script: Option, 25 | } 26 | 27 | impl Package { 28 | pub fn new(modules: Vec, init_script: Option) -> Result { 29 | ensure!(!modules.is_empty(), "must at latest one module"); 30 | let package_address = Self::parse_module_address(&modules[0])?; 31 | 32 | Ok(Self { 33 | package_address, 34 | modules, 35 | init_script, 36 | }) 37 | } 38 | 39 | pub fn new_with_modules(modules: Vec) -> Result { 40 | Self::new(modules, None) 41 | } 42 | 43 | pub fn new_with_module(module: Module) -> Result { 44 | Ok(Self { 45 | package_address: Self::parse_module_address(&module)?, 46 | modules: vec![module], 47 | init_script: None, 48 | }) 49 | } 50 | 51 | fn parse_module_address(module: &Module) -> Result { 52 | let compiled_module = CompiledModule::deserialize(module.code()) 53 | .map_err(|e| e.finish(Location::Undefined).into_vm_status())?; 54 | Ok(*compiled_module.address()) 55 | } 56 | 57 | pub fn set_init_script(&mut self, script: ScriptFunction) { 58 | self.init_script = Some(script); 59 | } 60 | 61 | pub fn add_module(&mut self, module: Module) -> Result<()> { 62 | self.modules.push(module); 63 | Ok(()) 64 | } 65 | 66 | pub fn package_address(&self) -> AccountAddress { 67 | self.package_address 68 | } 69 | 70 | pub fn modules(&self) -> &[Module] { 71 | &self.modules 72 | } 73 | 74 | pub fn init_script(&self) -> Option<&ScriptFunction> { 75 | self.init_script.as_ref() 76 | } 77 | 78 | pub fn into_inner(self) -> (AccountAddress, Vec, Option) { 79 | (self.package_address, self.modules, self.init_script) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/targets/starcoin/types/script.rs: -------------------------------------------------------------------------------- 1 | use crate::utils::serde_helper::vec_bytes; 2 | use move_core_types::identifier::{IdentStr, Identifier}; 3 | use move_core_types::language_storage::{ModuleId, TypeTag}; 4 | use schemars::{self, JsonSchema}; 5 | use serde::{Deserialize, Serialize}; 6 | 7 | /// Call a Move script function. 8 | #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] 9 | pub struct ScriptFunction { 10 | #[schemars(with = "String")] 11 | module: ModuleId, 12 | #[schemars(with = "String")] 13 | function: Identifier, 14 | #[schemars(with = "Vec")] 15 | ty_args: Vec, 16 | #[serde(with = "vec_bytes")] 17 | #[schemars(with = "Vec")] 18 | args: Vec>, 19 | } 20 | 21 | impl ScriptFunction { 22 | pub fn new( 23 | module: ModuleId, 24 | function: Identifier, 25 | ty_args: Vec, 26 | args: Vec>, 27 | ) -> Self { 28 | ScriptFunction { 29 | module, 30 | function, 31 | ty_args, 32 | args, 33 | } 34 | } 35 | 36 | pub fn module(&self) -> &ModuleId { 37 | &self.module 38 | } 39 | 40 | pub fn function(&self) -> &IdentStr { 41 | &self.function 42 | } 43 | 44 | pub fn ty_args(&self) -> &[TypeTag] { 45 | &self.ty_args 46 | } 47 | 48 | pub fn args(&self) -> &[Vec] { 49 | &self.args 50 | } 51 | pub fn into_inner(self) -> (ModuleId, Identifier, Vec, Vec>) { 52 | (self.module, self.function, self.ty_args, self.args) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/targets/target.rs: -------------------------------------------------------------------------------- 1 | use core::fmt::{Display, Formatter, Result}; 2 | use move_compiler::compiled_unit::CompiledUnit; 3 | use std::path::Path; 4 | 5 | pub trait Target { 6 | fn output( 7 | self, 8 | units: &Vec, 9 | dest_path: &Path, 10 | init_function: &str, 11 | ) -> anyhow::Result<()>; 12 | } 13 | 14 | pub enum TargetType { 15 | Starcoin, 16 | Unknown, 17 | } 18 | 19 | impl Display for TargetType { 20 | fn fmt(&self, f: &mut Formatter) -> Result { 21 | match self { 22 | TargetType::Starcoin => write!(f, "starcoin"), 23 | TargetType::Unknown => write!(f, "unkonw"), 24 | } 25 | } 26 | } 27 | 28 | impl From for TargetType { 29 | fn from(target_type: String) -> Self { 30 | match target_type { 31 | target_type if target_type == "starcoin" => TargetType::Starcoin, 32 | _ => TargetType::Unknown, 33 | } 34 | } 35 | } 36 | 37 | pub fn output( 38 | units: &Vec, 39 | target_types: &Vec, 40 | root_path: &Path, 41 | init_function: &str, 42 | ) -> anyhow::Result<()> { 43 | let root_dir = root_path.join("target"); 44 | 45 | for target_type in target_types { 46 | match target_type { 47 | TargetType::Starcoin => { 48 | let dest_path = root_dir.join("starcoin"); 49 | let target = crate::targets::starcoin::StarcoinTarget::new(); 50 | target.output(units, dest_path.as_path(), init_function)?; 51 | } 52 | _ => anyhow::bail!("not support target type"), 53 | } 54 | } 55 | 56 | Ok(()) 57 | } 58 | -------------------------------------------------------------------------------- /src/utils/bcs_ext/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) The Starcoin Core Contributors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // Just a wrap to BCS currently. 5 | use anyhow::Result; 6 | pub use bcs::MAX_SEQUENCE_LENGTH; 7 | use serde::{Deserialize, Serialize}; 8 | 9 | pub mod test_helpers { 10 | pub use bcs::test_helpers::*; 11 | } 12 | 13 | pub fn to_bytes(value: &T) -> Result> 14 | where 15 | T: ?Sized + Serialize, 16 | { 17 | bcs::to_bytes(value).map_err(|e| e.into()) 18 | } 19 | 20 | pub fn from_bytes<'a, T>(bytes: &'a [u8]) -> Result 21 | where 22 | T: Deserialize<'a>, 23 | { 24 | bcs::from_bytes(bytes).map_err(|e| e.into()) 25 | } 26 | 27 | #[allow(clippy::upper_case_acronyms)] 28 | pub trait BCSCodec<'a>: Sized { 29 | fn encode(&self) -> Result>; 30 | fn decode(bytes: &'a [u8]) -> Result; 31 | } 32 | 33 | impl<'a, T> BCSCodec<'a> for T 34 | where 35 | T: Serialize + Deserialize<'a>, 36 | { 37 | fn encode(&self) -> Result> { 38 | to_bytes(self) 39 | } 40 | 41 | fn decode(bytes: &'a [u8]) -> Result { 42 | from_bytes(bytes) 43 | } 44 | } 45 | 46 | pub use bcs::{is_human_readable, serialize_into, serialized_size, Error}; 47 | -------------------------------------------------------------------------------- /src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod bcs_ext; 2 | pub mod serde_helper; 3 | -------------------------------------------------------------------------------- /src/utils/serde_helper/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) The Diem Core Contributors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | pub mod vec_bytes; 5 | -------------------------------------------------------------------------------- /src/utils/serde_helper/vec_bytes.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) The Diem Core Contributors 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | use serde::{ 5 | de::Deserializer, 6 | ser::{SerializeSeq, Serializer}, 7 | Deserialize, 8 | }; 9 | 10 | pub fn serialize(data: &[Vec], serializer: S) -> Result 11 | where 12 | S: Serializer, 13 | { 14 | let mut seq = serializer.serialize_seq(Some(data.len()))?; 15 | for e in data { 16 | seq.serialize_element(serde_bytes::Bytes::new(e.as_slice()))?; 17 | } 18 | seq.end() 19 | } 20 | 21 | pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> 22 | where 23 | D: Deserializer<'de>, 24 | { 25 | Ok(>::deserialize(deserializer)? 26 | .into_iter() 27 | .map(serde_bytes::ByteBuf::into_vec) 28 | .collect()) 29 | } 30 | -------------------------------------------------------------------------------- /test/data/disassemble.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/test/data/disassemble.zip -------------------------------------------------------------------------------- /test/data/my-counter.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/test/data/my-counter.zip -------------------------------------------------------------------------------- /test/data/starcoin-framework.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/test/data/starcoin-framework.zip -------------------------------------------------------------------------------- /test/data/unit-test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/movefuns/move-js/a5de4f3a32126fd4831b92bd1e2ddc06b2e849df/test/data/unit-test.zip -------------------------------------------------------------------------------- /test/git.test.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | import { Git } from "../pkg/git"; 3 | 4 | describe("Git", () => { 5 | let git:Git; 6 | let wasmfs:WasmFs; 7 | 8 | beforeEach(async () => { 9 | wasmfs = new WasmFs(); 10 | git = new Git(wasmfs); 11 | }); 12 | 13 | it("download my-counter source zipshould be ok", async () => { 14 | await git.download("./base/test/data/my-counter.zip", "/workspace/guide-to-move-package-manager/my-counter"); 15 | const moveTomlText = wasmfs.fs.readFileSync("/workspace/guide-to-move-package-manager/my-counter/Move.toml", "utf8") 16 | expect(moveTomlText).toContain("name = \"my_counter\"") 17 | 18 | const MyCounterText = wasmfs.fs.readFileSync("/workspace/guide-to-move-package-manager/my-counter/sources/MyCounter.move", "utf8") 19 | expect(MyCounterText).toContain("struct Counter has key, store") 20 | }); 21 | 22 | it("download starcoin-framework source zip should be ok", async () => { 23 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 24 | 25 | const MyCounterText = wasmfs.fs.readFileSync("/workspace/starcoin-framework/sources/Token.move", "utf8") 26 | expect(MyCounterText).toContain("struct Token has store") 27 | }); 28 | }); -------------------------------------------------------------------------------- /test/move.test.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | import { Git } from "../pkg/git"; 3 | import { Move } from "../pkg/move"; 4 | 5 | describe("Move", () => { 6 | let wasmfs: WasmFs; 7 | let git: Git; 8 | 9 | beforeEach(async () => { 10 | wasmfs = new WasmFs(); 11 | git = new Git(wasmfs); 12 | }); 13 | 14 | it("run build unit-test should be ok", async () => { 15 | await git.download("./base/test/data/unit-test.zip", "/workspace/unit-test"); 16 | 17 | let cli = new Move(wasmfs, { 18 | pwd: "/workspace/unit-test" 19 | }) 20 | 21 | await cli.run(["--", "build", "--address_maps", "Std:0x1", "--test", "true"]) 22 | 23 | const unitTestExists = wasmfs.fs.existsSync("/workspace/unit-test/target/starcoin/release/package.blob") 24 | expect(unitTestExists).toBeTruthy() 25 | }); 26 | 27 | it("run build starcoin-framework should be ok", async () => { 28 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 29 | 30 | let cli = new Move(wasmfs, { 31 | pwd: "/workspace/starcoin-framework" 32 | }) 33 | 34 | await cli.run(["--", "build", "--dependency_dirs", "/workspace/starcoin-framework/unit-test", "--address_maps", "StarcoinFramework:0x1,StarcoinAssociation:0xA550C18,VMReserved:0x0,Std:0x1"]) 35 | 36 | const ntfExists = wasmfs.fs.existsSync("/workspace/starcoin-framework/target/starcoin/release/package.blob") 37 | expect(ntfExists).toBeTruthy() 38 | }); 39 | 40 | 41 | it("run build my-counter example should be ok", async () => { 42 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 43 | await git.download("./base/test/data/my-counter.zip", "/workspace/my-counter"); 44 | 45 | let cli = new Move(wasmfs, { 46 | pwd: "/workspace/my-counter", 47 | preopens: ["/workspace"] 48 | }) 49 | 50 | await cli.run(["--", "build", "--dependency_dirs", "/workspace/starcoin-framework,/workspace/starcoin-framework/unit-test", 51 | "--address_maps", "StarcoinFramework:0x1,MyCounter:0xABCDE,StarcoinAssociation:0xA550C18,VMReserved:0x0,Std:0x1", 52 | "--init_function", "0xABCDE::MyCounter::init"]) 53 | 54 | const ntfExists = wasmfs.fs.existsSync("/workspace/my-counter/target/starcoin/release/package.blob") 55 | expect(ntfExists).toBeTruthy() 56 | }); 57 | 58 | it("run disassemble should be ok", async () => { 59 | 60 | await git.download("./base/test/data/disassemble.zip", "/workspace/disassemble") 61 | 62 | let cli = new Move(wasmfs, { 63 | pwd: "/workspace/disassemble", 64 | preopens: ["/workspace"] 65 | }) 66 | 67 | await cli.run(["--", "disassemble", "--file_path", "/workspace/disassemble/test"]) 68 | 69 | const ntfExists = wasmfs.fs.existsSync("/workspace/disassemble/test.d") 70 | 71 | if (ntfExists) { 72 | wasmfs.fs.readFile("/workspace/disassemble/test.d", (_, v) => { 73 | console.log(v?.toString()) 74 | }) 75 | } else { 76 | wasmfs.fs.readFile("/workspace/disassemble/test.e", (_, v) => { 77 | console.log(v?.toString()) 78 | }) 79 | } 80 | 81 | expect(ntfExists).toBeTruthy() 82 | }); 83 | 84 | }); -------------------------------------------------------------------------------- /test/package.test.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | import { Git } from "../pkg/git"; 3 | import { MovePackage, } from "../pkg/package"; 4 | import { Disassemble } from "../pkg/disassemble"; 5 | 6 | describe("Package", () => { 7 | let wasmfs: WasmFs; 8 | let git: Git; 9 | 10 | beforeEach(async () => { 11 | wasmfs = new WasmFs(); 12 | git = new Git(wasmfs); 13 | }); 14 | 15 | it("create starcoin framework move package from path should be ok", async () => { 16 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 17 | 18 | let mp = new MovePackage(wasmfs, { 19 | packagePath: "/workspace/starcoin-framework", 20 | test: false 21 | }) 22 | 23 | expect(mp.name).toBe("StarcoinFramework") 24 | expect(mp.version).toBe("0.1.0") 25 | 26 | expect(mp.addresses.size).toBe(3) 27 | 28 | expect(mp.addresses.get("StarcoinFramework")).toBe("0x1") 29 | expect(mp.addresses.get("StarcoinAssociation")).toBe("0xA550C18") 30 | expect(mp.addresses.get("VMReserved")).toBe("0x0") 31 | 32 | expect(mp.devDependencies.size).toBe(1) 33 | expect(mp.devDependencies.get("UnitTest").local).toBe("./unit-test") 34 | }); 35 | 36 | 37 | it("create my-counter move package from path should be ok", async () => { 38 | await git.download("./base/test/data/my-counter.zip", "/workspace/my-counter"); 39 | 40 | let mp = new MovePackage(wasmfs, { 41 | packagePath: "/workspace/my-counter", 42 | test: false 43 | }) 44 | 45 | expect(mp.name).toBe("my_counter") 46 | expect(mp.version).toBe("0.0.1") 47 | 48 | expect(mp.addresses.size).toBe(2) 49 | expect(mp.addresses.get("StarcoinFramework")).toBe("0x1") 50 | expect(mp.addresses.get("MyCounter")).toBe("0xABCDE") 51 | 52 | expect(mp.dependencies.size).toBe(1) 53 | expect(mp.dependencies.get("StarcoinFramework").git).toBe("https://github.com/starcoinorg/starcoin-framework.git") 54 | expect(mp.dependencies.get("StarcoinFramework").rev).toBe("cf1deda180af40a8b3e26c0c7b548c4c290cd7e7") 55 | }); 56 | 57 | it("build starcoin unit-test package should be ok", async () => { 58 | await git.download("./base/test/data/unit-test.zip", "/workspace/unit-test"); 59 | 60 | let mp = new MovePackage(wasmfs, { 61 | packagePath: "/workspace/unit-test", 62 | test: true 63 | }) 64 | await mp.build() 65 | }); 66 | 67 | 68 | it("build starcoin framework should be ok", async () => { 69 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 70 | 71 | let mp = new MovePackage(wasmfs, { 72 | packagePath: "/workspace/starcoin-framework", 73 | test: false 74 | }) 75 | 76 | await mp.build() 77 | 78 | const ntfExists = wasmfs.fs.existsSync("/workspace/starcoin-framework/target/starcoin/release/package.blob") 79 | expect(ntfExists).toBeTruthy() 80 | }); 81 | 82 | 83 | it("build my-counter example package should be ok", async () => { 84 | await git.download("./base/test/data/starcoin-framework.zip", "/workspace/starcoin-framework"); 85 | await git.download("./base/test/data/my-counter.zip", "/workspace/my-counter"); 86 | 87 | let initAlias = new Map() 88 | initAlias.set("StarcoinFramework", "/workspace/starcoin-framework") 89 | 90 | let mp = new MovePackage(wasmfs, { 91 | packagePath: "/workspace/my-counter", 92 | test: true, 93 | alias: initAlias, 94 | initFunction: "0xABCDE::MyCounter::init" 95 | }) 96 | 97 | await mp.build() 98 | 99 | const ntfExists = wasmfs.fs.existsSync("/workspace/my-counter/target/starcoin/release/package.blob") 100 | 101 | const hash = wasmfs.fs.existsSync("/workspace/starcoin-framework/target/starcoin/release/hash.txt") 102 | 103 | if (hash) { 104 | wasmfs.fs.readFile("/workspace/starcoin-framework/target/starcoin/release/hash.txt", (_, v) => { 105 | console.log(v?.toString()) 106 | }) 107 | } 108 | 109 | console.log(hash) 110 | 111 | expect(ntfExists).toBeTruthy() 112 | }); 113 | }); -------------------------------------------------------------------------------- /test/wasmfs.test.ts: -------------------------------------------------------------------------------- 1 | import { WasmFs } from '@wasmer/wasmfs' 2 | 3 | describe("wasmfs", () => { 4 | let wasmfs: WasmFs; 5 | 6 | beforeEach(async () => { 7 | wasmfs = new WasmFs(); 8 | }); 9 | 10 | it("should have stdin, stdout, and stderr", async () => { 11 | expect(wasmfs.fs.existsSync("/dev/stdin")).toBe(true); 12 | expect(wasmfs.fs.existsSync("/dev/stdout")).toBe(true); 13 | expect(wasmfs.fs.existsSync("/dev/stderr")).toBe(true); 14 | }); 15 | 16 | it("should be able to retrieve stdout", async () => { 17 | let stdout = "test"; 18 | wasmfs.fs.writeFileSync("/dev/stdout", stdout); 19 | 20 | const response = await wasmfs.getStdOut(); 21 | expect(response).toBe(stdout); 22 | }); 23 | 24 | it("openSync", async () => { 25 | let fs = wasmfs.fs; 26 | try { 27 | fs.mkdirSync("/tmp"); 28 | } catch (e) {} 29 | let temp = fs.mkdirSync("/tmp/heeey"); 30 | let openSync = fs.openSync("/tmp/heeey", fs.constants.O_DIRECTORY); 31 | // console.log("openSync", openSync); 32 | }); 33 | 34 | it("serialize/deserialzie binaries", async () => { 35 | let fs = wasmfs.fs; 36 | const TINY_PNG = 37 | "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="; 38 | const deser = new Buffer(TINY_PNG, "base64"); 39 | const contents = Uint8Array.from(deser); 40 | wasmfs.volume.writeFileSync("/img.png", contents); 41 | 42 | // Serialize to JSON 43 | const jsonData = wasmfs.toJSON(); 44 | 45 | // Create a new FS from the serialized JSON 46 | const newFs = new WasmFs(); 47 | newFs.fromJSON(jsonData); 48 | 49 | // Assert both files are equal 50 | let buf = wasmfs.volume.readFileSync("/img.png"); 51 | let buf2 = newFs.volume.readFileSync("/img.png"); 52 | expect(buf).toEqual(buf2); 53 | }); 54 | 55 | it("serializes properly directories", async () => { 56 | let fs = wasmfs.fs; 57 | try { 58 | fs.mkdirSync("/tmp"); 59 | } catch (e) {} 60 | const jsonData = wasmfs.toJSON(); 61 | 62 | // Create a new FS from the serialized JSON 63 | const newFs = new WasmFs(); 64 | newFs.fromJSON(jsonData); 65 | 66 | var stat1 = wasmfs.fs.lstatSync("/tmp"); 67 | var stat2 = newFs.fs.lstatSync("/tmp"); 68 | expect(stat1.isDirectory()).toBeTruthy(); 69 | expect(stat2.isDirectory()).toBeTruthy(); 70 | }); 71 | }); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["pkg/**/*.ts"], 3 | "exclude": ["dist"], 4 | "compilerOptions": { 5 | "outDir": "./dist/", 6 | "noImplicitAny": true, 7 | "declaration": true, 8 | "declarationDir": "./dist/types", 9 | "module": "es6", 10 | "target": "es5", 11 | "jsx": "react", 12 | "allowJs": true, 13 | "allowSyntheticDefaultImports": true, 14 | "moduleResolution": "node", 15 | "types": [ 16 | "jest" 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rules": { 4 | "max-line-length": { 5 | "options": [120] 6 | }, 7 | "new-parens": true, 8 | "no-arg": true, 9 | "no-bitwise": true, 10 | "no-conditional-assignment": true, 11 | "no-consecutive-blank-lines": false, 12 | "no-console": false, 13 | "no-string-literal": false 14 | }, 15 | "jsRules": { 16 | "max-line-length": { 17 | "options": [120] 18 | } 19 | } 20 | } --------------------------------------------------------------------------------