├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md └── src ├── erc20_abi.json └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .env -------------------------------------------------------------------------------- /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 = "anyhow" 7 | version = "1.0.42" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "595d3cfa7a60d4555cb5067b99f07142a08ea778de5cf993f7b75c7d8fabc486" 10 | 11 | [[package]] 12 | name = "arrayvec" 13 | version = "0.5.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 16 | 17 | [[package]] 18 | name = "arrayvec" 19 | version = "0.7.1" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" 22 | 23 | [[package]] 24 | name = "autocfg" 25 | version = "1.0.1" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 28 | 29 | [[package]] 30 | name = "base64" 31 | version = "0.13.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 34 | 35 | [[package]] 36 | name = "bitflags" 37 | version = "1.2.1" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 40 | 41 | [[package]] 42 | name = "bitvec" 43 | version = "0.20.4" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" 46 | dependencies = [ 47 | "funty", 48 | "radium", 49 | "tap", 50 | "wyz", 51 | ] 52 | 53 | [[package]] 54 | name = "block-buffer" 55 | version = "0.9.0" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 58 | dependencies = [ 59 | "block-padding", 60 | "generic-array", 61 | ] 62 | 63 | [[package]] 64 | name = "block-padding" 65 | version = "0.2.1" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" 68 | 69 | [[package]] 70 | name = "bumpalo" 71 | version = "3.7.0" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" 74 | 75 | [[package]] 76 | name = "byte-slice-cast" 77 | version = "1.0.0" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "65c1bf4a04a88c54f589125563643d773f3254b5c38571395e2b591c693bbc81" 80 | 81 | [[package]] 82 | name = "byteorder" 83 | version = "1.4.3" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 86 | 87 | [[package]] 88 | name = "bytes" 89 | version = "1.0.1" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" 92 | 93 | [[package]] 94 | name = "cc" 95 | version = "1.0.69" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" 98 | 99 | [[package]] 100 | name = "cfg-if" 101 | version = "1.0.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 104 | 105 | [[package]] 106 | name = "convert_case" 107 | version = "0.4.0" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 110 | 111 | [[package]] 112 | name = "core-foundation" 113 | version = "0.9.1" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" 116 | dependencies = [ 117 | "core-foundation-sys", 118 | "libc", 119 | ] 120 | 121 | [[package]] 122 | name = "core-foundation-sys" 123 | version = "0.8.2" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" 126 | 127 | [[package]] 128 | name = "cpufeatures" 129 | version = "0.1.5" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" 132 | dependencies = [ 133 | "libc", 134 | ] 135 | 136 | [[package]] 137 | name = "crunchy" 138 | version = "0.2.2" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 141 | 142 | [[package]] 143 | name = "derive_more" 144 | version = "0.99.16" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" 147 | dependencies = [ 148 | "convert_case", 149 | "proc-macro2", 150 | "quote", 151 | "rustc_version", 152 | "syn", 153 | ] 154 | 155 | [[package]] 156 | name = "digest" 157 | version = "0.9.0" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 160 | dependencies = [ 161 | "generic-array", 162 | ] 163 | 164 | [[package]] 165 | name = "dotenv" 166 | version = "0.15.0" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" 169 | 170 | [[package]] 171 | name = "encoding_rs" 172 | version = "0.8.28" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" 175 | dependencies = [ 176 | "cfg-if", 177 | ] 178 | 179 | [[package]] 180 | name = "ethabi" 181 | version = "14.1.0" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "a01317735d563b3bad2d5f90d2e1799f414165408251abb762510f40e790e69a" 184 | dependencies = [ 185 | "anyhow", 186 | "ethereum-types", 187 | "hex", 188 | "serde", 189 | "serde_json", 190 | "sha3", 191 | "thiserror", 192 | "uint", 193 | ] 194 | 195 | [[package]] 196 | name = "ethbloom" 197 | version = "0.11.0" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "779864b9c7f7ead1f092972c3257496c6a84b46dba2ce131dd8a282cb2cc5972" 200 | dependencies = [ 201 | "crunchy", 202 | "fixed-hash", 203 | "impl-rlp", 204 | "impl-serde", 205 | "tiny-keccak", 206 | ] 207 | 208 | [[package]] 209 | name = "ethereum-types" 210 | version = "0.11.0" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "f64b5df66a228d85e4b17e5d6c6aa43b0310898ffe8a85988c4c032357aaabfd" 213 | dependencies = [ 214 | "ethbloom", 215 | "fixed-hash", 216 | "impl-rlp", 217 | "impl-serde", 218 | "primitive-types", 219 | "uint", 220 | ] 221 | 222 | [[package]] 223 | name = "fixed-hash" 224 | version = "0.7.0" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" 227 | dependencies = [ 228 | "byteorder", 229 | "rand", 230 | "rustc-hex", 231 | "static_assertions", 232 | ] 233 | 234 | [[package]] 235 | name = "fnv" 236 | version = "1.0.7" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 239 | 240 | [[package]] 241 | name = "foreign-types" 242 | version = "0.3.2" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 245 | dependencies = [ 246 | "foreign-types-shared", 247 | ] 248 | 249 | [[package]] 250 | name = "foreign-types-shared" 251 | version = "0.1.1" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 254 | 255 | [[package]] 256 | name = "form_urlencoded" 257 | version = "1.0.1" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 260 | dependencies = [ 261 | "matches", 262 | "percent-encoding", 263 | ] 264 | 265 | [[package]] 266 | name = "funty" 267 | version = "1.1.0" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" 270 | 271 | [[package]] 272 | name = "futures" 273 | version = "0.3.16" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b" 276 | dependencies = [ 277 | "futures-channel", 278 | "futures-core", 279 | "futures-executor", 280 | "futures-io", 281 | "futures-sink", 282 | "futures-task", 283 | "futures-util", 284 | ] 285 | 286 | [[package]] 287 | name = "futures-channel" 288 | version = "0.3.16" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" 291 | dependencies = [ 292 | "futures-core", 293 | "futures-sink", 294 | ] 295 | 296 | [[package]] 297 | name = "futures-core" 298 | version = "0.3.16" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" 301 | 302 | [[package]] 303 | name = "futures-executor" 304 | version = "0.3.16" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c" 307 | dependencies = [ 308 | "futures-core", 309 | "futures-task", 310 | "futures-util", 311 | ] 312 | 313 | [[package]] 314 | name = "futures-io" 315 | version = "0.3.16" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" 318 | 319 | [[package]] 320 | name = "futures-macro" 321 | version = "0.3.16" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" 324 | dependencies = [ 325 | "autocfg", 326 | "proc-macro-hack", 327 | "proc-macro2", 328 | "quote", 329 | "syn", 330 | ] 331 | 332 | [[package]] 333 | name = "futures-sink" 334 | version = "0.3.16" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" 337 | 338 | [[package]] 339 | name = "futures-task" 340 | version = "0.3.16" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" 343 | 344 | [[package]] 345 | name = "futures-timer" 346 | version = "3.0.2" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" 349 | 350 | [[package]] 351 | name = "futures-util" 352 | version = "0.3.16" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" 355 | dependencies = [ 356 | "autocfg", 357 | "futures-channel", 358 | "futures-core", 359 | "futures-io", 360 | "futures-macro", 361 | "futures-sink", 362 | "futures-task", 363 | "memchr", 364 | "pin-project-lite", 365 | "pin-utils", 366 | "proc-macro-hack", 367 | "proc-macro-nested", 368 | "slab", 369 | ] 370 | 371 | [[package]] 372 | name = "generic-array" 373 | version = "0.14.4" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" 376 | dependencies = [ 377 | "typenum", 378 | "version_check", 379 | ] 380 | 381 | [[package]] 382 | name = "getrandom" 383 | version = "0.2.3" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" 386 | dependencies = [ 387 | "cfg-if", 388 | "libc", 389 | "wasi", 390 | ] 391 | 392 | [[package]] 393 | name = "h2" 394 | version = "0.3.3" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" 397 | dependencies = [ 398 | "bytes", 399 | "fnv", 400 | "futures-core", 401 | "futures-sink", 402 | "futures-util", 403 | "http", 404 | "indexmap", 405 | "slab", 406 | "tokio", 407 | "tokio-util", 408 | "tracing", 409 | ] 410 | 411 | [[package]] 412 | name = "hashbrown" 413 | version = "0.11.2" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 416 | 417 | [[package]] 418 | name = "headers" 419 | version = "0.3.4" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" 422 | dependencies = [ 423 | "base64", 424 | "bitflags", 425 | "bytes", 426 | "headers-core", 427 | "http", 428 | "mime", 429 | "sha-1", 430 | "time", 431 | ] 432 | 433 | [[package]] 434 | name = "headers-core" 435 | version = "0.2.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" 438 | dependencies = [ 439 | "http", 440 | ] 441 | 442 | [[package]] 443 | name = "hermit-abi" 444 | version = "0.1.19" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 447 | dependencies = [ 448 | "libc", 449 | ] 450 | 451 | [[package]] 452 | name = "hex" 453 | version = "0.4.3" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 456 | 457 | [[package]] 458 | name = "http" 459 | version = "0.2.4" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" 462 | dependencies = [ 463 | "bytes", 464 | "fnv", 465 | "itoa", 466 | ] 467 | 468 | [[package]] 469 | name = "http-body" 470 | version = "0.4.3" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" 473 | dependencies = [ 474 | "bytes", 475 | "http", 476 | "pin-project-lite", 477 | ] 478 | 479 | [[package]] 480 | name = "httparse" 481 | version = "1.4.1" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" 484 | 485 | [[package]] 486 | name = "httpdate" 487 | version = "1.0.1" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" 490 | 491 | [[package]] 492 | name = "hyper" 493 | version = "0.14.11" 494 | source = "registry+https://github.com/rust-lang/crates.io-index" 495 | checksum = "0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11" 496 | dependencies = [ 497 | "bytes", 498 | "futures-channel", 499 | "futures-core", 500 | "futures-util", 501 | "h2", 502 | "http", 503 | "http-body", 504 | "httparse", 505 | "httpdate", 506 | "itoa", 507 | "pin-project-lite", 508 | "socket2", 509 | "tokio", 510 | "tower-service", 511 | "tracing", 512 | "want", 513 | ] 514 | 515 | [[package]] 516 | name = "hyper-tls" 517 | version = "0.5.0" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 520 | dependencies = [ 521 | "bytes", 522 | "hyper", 523 | "native-tls", 524 | "tokio", 525 | "tokio-native-tls", 526 | ] 527 | 528 | [[package]] 529 | name = "idna" 530 | version = "0.2.3" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 533 | dependencies = [ 534 | "matches", 535 | "unicode-bidi", 536 | "unicode-normalization", 537 | ] 538 | 539 | [[package]] 540 | name = "impl-codec" 541 | version = "0.5.1" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" 544 | dependencies = [ 545 | "parity-scale-codec", 546 | ] 547 | 548 | [[package]] 549 | name = "impl-rlp" 550 | version = "0.3.0" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" 553 | dependencies = [ 554 | "rlp", 555 | ] 556 | 557 | [[package]] 558 | name = "impl-serde" 559 | version = "0.3.1" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f" 562 | dependencies = [ 563 | "serde", 564 | ] 565 | 566 | [[package]] 567 | name = "impl-trait-for-tuples" 568 | version = "0.2.1" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "d5dacb10c5b3bb92d46ba347505a9041e676bb20ad220101326bffb0c93031ee" 571 | dependencies = [ 572 | "proc-macro2", 573 | "quote", 574 | "syn", 575 | ] 576 | 577 | [[package]] 578 | name = "indexmap" 579 | version = "1.7.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" 582 | dependencies = [ 583 | "autocfg", 584 | "hashbrown", 585 | ] 586 | 587 | [[package]] 588 | name = "instant" 589 | version = "0.1.10" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" 592 | dependencies = [ 593 | "cfg-if", 594 | ] 595 | 596 | [[package]] 597 | name = "ipnet" 598 | version = "2.3.1" 599 | source = "registry+https://github.com/rust-lang/crates.io-index" 600 | checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" 601 | 602 | [[package]] 603 | name = "itoa" 604 | version = "0.4.7" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" 607 | 608 | [[package]] 609 | name = "js-sys" 610 | version = "0.3.52" 611 | source = "registry+https://github.com/rust-lang/crates.io-index" 612 | checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752" 613 | dependencies = [ 614 | "wasm-bindgen", 615 | ] 616 | 617 | [[package]] 618 | name = "jsonrpc-core" 619 | version = "18.0.0" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" 622 | dependencies = [ 623 | "futures", 624 | "futures-executor", 625 | "futures-util", 626 | "log", 627 | "serde", 628 | "serde_derive", 629 | "serde_json", 630 | ] 631 | 632 | [[package]] 633 | name = "keccak" 634 | version = "0.1.0" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" 637 | 638 | [[package]] 639 | name = "lazy_static" 640 | version = "1.4.0" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 643 | 644 | [[package]] 645 | name = "libc" 646 | version = "0.2.99" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" 649 | 650 | [[package]] 651 | name = "lock_api" 652 | version = "0.4.4" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" 655 | dependencies = [ 656 | "scopeguard", 657 | ] 658 | 659 | [[package]] 660 | name = "log" 661 | version = "0.4.14" 662 | source = "registry+https://github.com/rust-lang/crates.io-index" 663 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 664 | dependencies = [ 665 | "cfg-if", 666 | ] 667 | 668 | [[package]] 669 | name = "matches" 670 | version = "0.1.8" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 673 | 674 | [[package]] 675 | name = "memchr" 676 | version = "2.4.0" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" 679 | 680 | [[package]] 681 | name = "mime" 682 | version = "0.3.16" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 685 | 686 | [[package]] 687 | name = "mio" 688 | version = "0.7.13" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" 691 | dependencies = [ 692 | "libc", 693 | "log", 694 | "miow", 695 | "ntapi", 696 | "winapi", 697 | ] 698 | 699 | [[package]] 700 | name = "miow" 701 | version = "0.3.7" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 704 | dependencies = [ 705 | "winapi", 706 | ] 707 | 708 | [[package]] 709 | name = "native-tls" 710 | version = "0.2.8" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" 713 | dependencies = [ 714 | "lazy_static", 715 | "libc", 716 | "log", 717 | "openssl", 718 | "openssl-probe", 719 | "openssl-sys", 720 | "schannel", 721 | "security-framework", 722 | "security-framework-sys", 723 | "tempfile", 724 | ] 725 | 726 | [[package]] 727 | name = "ntapi" 728 | version = "0.3.6" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 731 | dependencies = [ 732 | "winapi", 733 | ] 734 | 735 | [[package]] 736 | name = "num_cpus" 737 | version = "1.13.0" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 740 | dependencies = [ 741 | "hermit-abi", 742 | "libc", 743 | ] 744 | 745 | [[package]] 746 | name = "once_cell" 747 | version = "1.8.0" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" 750 | 751 | [[package]] 752 | name = "opaque-debug" 753 | version = "0.3.0" 754 | source = "registry+https://github.com/rust-lang/crates.io-index" 755 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 756 | 757 | [[package]] 758 | name = "openssl" 759 | version = "0.10.35" 760 | source = "registry+https://github.com/rust-lang/crates.io-index" 761 | checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" 762 | dependencies = [ 763 | "bitflags", 764 | "cfg-if", 765 | "foreign-types", 766 | "libc", 767 | "once_cell", 768 | "openssl-sys", 769 | ] 770 | 771 | [[package]] 772 | name = "openssl-probe" 773 | version = "0.1.4" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" 776 | 777 | [[package]] 778 | name = "openssl-sys" 779 | version = "0.9.65" 780 | source = "registry+https://github.com/rust-lang/crates.io-index" 781 | checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" 782 | dependencies = [ 783 | "autocfg", 784 | "cc", 785 | "libc", 786 | "pkg-config", 787 | "vcpkg", 788 | ] 789 | 790 | [[package]] 791 | name = "parity-scale-codec" 792 | version = "2.2.0" 793 | source = "registry+https://github.com/rust-lang/crates.io-index" 794 | checksum = "8975095a2a03bbbdc70a74ab11a4f76a6d0b84680d87c68d722531b0ac28e8a9" 795 | dependencies = [ 796 | "arrayvec 0.7.1", 797 | "bitvec", 798 | "byte-slice-cast", 799 | "impl-trait-for-tuples", 800 | "parity-scale-codec-derive", 801 | "serde", 802 | ] 803 | 804 | [[package]] 805 | name = "parity-scale-codec-derive" 806 | version = "2.2.0" 807 | source = "registry+https://github.com/rust-lang/crates.io-index" 808 | checksum = "40dbbfef7f0a1143c5b06e0d76a6278e25dac0bc1af4be51a0fbb73f07e7ad09" 809 | dependencies = [ 810 | "proc-macro-crate", 811 | "proc-macro2", 812 | "quote", 813 | "syn", 814 | ] 815 | 816 | [[package]] 817 | name = "parking_lot" 818 | version = "0.11.1" 819 | source = "registry+https://github.com/rust-lang/crates.io-index" 820 | checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" 821 | dependencies = [ 822 | "instant", 823 | "lock_api", 824 | "parking_lot_core", 825 | ] 826 | 827 | [[package]] 828 | name = "parking_lot_core" 829 | version = "0.8.3" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" 832 | dependencies = [ 833 | "cfg-if", 834 | "instant", 835 | "libc", 836 | "redox_syscall", 837 | "smallvec", 838 | "winapi", 839 | ] 840 | 841 | [[package]] 842 | name = "percent-encoding" 843 | version = "2.1.0" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 846 | 847 | [[package]] 848 | name = "pest" 849 | version = "2.1.3" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" 852 | dependencies = [ 853 | "ucd-trie", 854 | ] 855 | 856 | [[package]] 857 | name = "pin-project" 858 | version = "1.0.8" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" 861 | dependencies = [ 862 | "pin-project-internal", 863 | ] 864 | 865 | [[package]] 866 | name = "pin-project-internal" 867 | version = "1.0.8" 868 | source = "registry+https://github.com/rust-lang/crates.io-index" 869 | checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" 870 | dependencies = [ 871 | "proc-macro2", 872 | "quote", 873 | "syn", 874 | ] 875 | 876 | [[package]] 877 | name = "pin-project-lite" 878 | version = "0.2.7" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" 881 | 882 | [[package]] 883 | name = "pin-utils" 884 | version = "0.1.0" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 887 | 888 | [[package]] 889 | name = "pkg-config" 890 | version = "0.3.19" 891 | source = "registry+https://github.com/rust-lang/crates.io-index" 892 | checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" 893 | 894 | [[package]] 895 | name = "ppv-lite86" 896 | version = "0.2.10" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" 899 | 900 | [[package]] 901 | name = "primitive-types" 902 | version = "0.9.1" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "06345ee39fbccfb06ab45f3a1a5798d9dafa04cb8921a76d227040003a234b0e" 905 | dependencies = [ 906 | "fixed-hash", 907 | "impl-codec", 908 | "impl-rlp", 909 | "impl-serde", 910 | "uint", 911 | ] 912 | 913 | [[package]] 914 | name = "proc-macro-crate" 915 | version = "1.0.0" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92" 918 | dependencies = [ 919 | "thiserror", 920 | "toml", 921 | ] 922 | 923 | [[package]] 924 | name = "proc-macro-hack" 925 | version = "0.5.19" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" 928 | 929 | [[package]] 930 | name = "proc-macro-nested" 931 | version = "0.1.7" 932 | source = "registry+https://github.com/rust-lang/crates.io-index" 933 | checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" 934 | 935 | [[package]] 936 | name = "proc-macro2" 937 | version = "1.0.28" 938 | source = "registry+https://github.com/rust-lang/crates.io-index" 939 | checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" 940 | dependencies = [ 941 | "unicode-xid", 942 | ] 943 | 944 | [[package]] 945 | name = "quote" 946 | version = "1.0.9" 947 | source = "registry+https://github.com/rust-lang/crates.io-index" 948 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 949 | dependencies = [ 950 | "proc-macro2", 951 | ] 952 | 953 | [[package]] 954 | name = "radium" 955 | version = "0.6.2" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 958 | 959 | [[package]] 960 | name = "rand" 961 | version = "0.8.4" 962 | source = "registry+https://github.com/rust-lang/crates.io-index" 963 | checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" 964 | dependencies = [ 965 | "libc", 966 | "rand_chacha", 967 | "rand_core", 968 | "rand_hc", 969 | ] 970 | 971 | [[package]] 972 | name = "rand_chacha" 973 | version = "0.3.1" 974 | source = "registry+https://github.com/rust-lang/crates.io-index" 975 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 976 | dependencies = [ 977 | "ppv-lite86", 978 | "rand_core", 979 | ] 980 | 981 | [[package]] 982 | name = "rand_core" 983 | version = "0.6.3" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 986 | dependencies = [ 987 | "getrandom", 988 | ] 989 | 990 | [[package]] 991 | name = "rand_hc" 992 | version = "0.3.1" 993 | source = "registry+https://github.com/rust-lang/crates.io-index" 994 | checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" 995 | dependencies = [ 996 | "rand_core", 997 | ] 998 | 999 | [[package]] 1000 | name = "redox_syscall" 1001 | version = "0.2.10" 1002 | source = "registry+https://github.com/rust-lang/crates.io-index" 1003 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 1004 | dependencies = [ 1005 | "bitflags", 1006 | ] 1007 | 1008 | [[package]] 1009 | name = "remove_dir_all" 1010 | version = "0.5.3" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1013 | dependencies = [ 1014 | "winapi", 1015 | ] 1016 | 1017 | [[package]] 1018 | name = "reqwest" 1019 | version = "0.11.4" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" 1022 | dependencies = [ 1023 | "base64", 1024 | "bytes", 1025 | "encoding_rs", 1026 | "futures-core", 1027 | "futures-util", 1028 | "http", 1029 | "http-body", 1030 | "hyper", 1031 | "hyper-tls", 1032 | "ipnet", 1033 | "js-sys", 1034 | "lazy_static", 1035 | "log", 1036 | "mime", 1037 | "native-tls", 1038 | "percent-encoding", 1039 | "pin-project-lite", 1040 | "serde", 1041 | "serde_json", 1042 | "serde_urlencoded", 1043 | "tokio", 1044 | "tokio-native-tls", 1045 | "url", 1046 | "wasm-bindgen", 1047 | "wasm-bindgen-futures", 1048 | "web-sys", 1049 | "winreg", 1050 | ] 1051 | 1052 | [[package]] 1053 | name = "rlp" 1054 | version = "0.5.1" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "999508abb0ae792aabed2460c45b89106d97fe4adac593bdaef433c2605847b5" 1057 | dependencies = [ 1058 | "bytes", 1059 | "rustc-hex", 1060 | ] 1061 | 1062 | [[package]] 1063 | name = "rustc-hex" 1064 | version = "2.1.0" 1065 | source = "registry+https://github.com/rust-lang/crates.io-index" 1066 | checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" 1067 | 1068 | [[package]] 1069 | name = "rustc_version" 1070 | version = "0.3.3" 1071 | source = "registry+https://github.com/rust-lang/crates.io-index" 1072 | checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" 1073 | dependencies = [ 1074 | "semver", 1075 | ] 1076 | 1077 | [[package]] 1078 | name = "ryu" 1079 | version = "1.0.5" 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" 1081 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 1082 | 1083 | [[package]] 1084 | name = "schannel" 1085 | version = "0.1.19" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 1088 | dependencies = [ 1089 | "lazy_static", 1090 | "winapi", 1091 | ] 1092 | 1093 | [[package]] 1094 | name = "scopeguard" 1095 | version = "1.1.0" 1096 | source = "registry+https://github.com/rust-lang/crates.io-index" 1097 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1098 | 1099 | [[package]] 1100 | name = "secp256k1" 1101 | version = "0.20.3" 1102 | source = "registry+https://github.com/rust-lang/crates.io-index" 1103 | checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" 1104 | dependencies = [ 1105 | "secp256k1-sys", 1106 | ] 1107 | 1108 | [[package]] 1109 | name = "secp256k1-sys" 1110 | version = "0.4.1" 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" 1112 | checksum = "827cb7cce42533829c792fc51b82fbf18b125b45a702ef2c8be77fce65463a7b" 1113 | dependencies = [ 1114 | "cc", 1115 | ] 1116 | 1117 | [[package]] 1118 | name = "security-framework" 1119 | version = "2.3.1" 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" 1121 | checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" 1122 | dependencies = [ 1123 | "bitflags", 1124 | "core-foundation", 1125 | "core-foundation-sys", 1126 | "libc", 1127 | "security-framework-sys", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "security-framework-sys" 1132 | version = "2.3.0" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" 1135 | dependencies = [ 1136 | "core-foundation-sys", 1137 | "libc", 1138 | ] 1139 | 1140 | [[package]] 1141 | name = "semver" 1142 | version = "0.11.0" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" 1145 | dependencies = [ 1146 | "semver-parser", 1147 | ] 1148 | 1149 | [[package]] 1150 | name = "semver-parser" 1151 | version = "0.10.2" 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" 1153 | checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" 1154 | dependencies = [ 1155 | "pest", 1156 | ] 1157 | 1158 | [[package]] 1159 | name = "serde" 1160 | version = "1.0.127" 1161 | source = "registry+https://github.com/rust-lang/crates.io-index" 1162 | checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" 1163 | dependencies = [ 1164 | "serde_derive", 1165 | ] 1166 | 1167 | [[package]] 1168 | name = "serde_derive" 1169 | version = "1.0.127" 1170 | source = "registry+https://github.com/rust-lang/crates.io-index" 1171 | checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" 1172 | dependencies = [ 1173 | "proc-macro2", 1174 | "quote", 1175 | "syn", 1176 | ] 1177 | 1178 | [[package]] 1179 | name = "serde_json" 1180 | version = "1.0.66" 1181 | source = "registry+https://github.com/rust-lang/crates.io-index" 1182 | checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" 1183 | dependencies = [ 1184 | "itoa", 1185 | "ryu", 1186 | "serde", 1187 | ] 1188 | 1189 | [[package]] 1190 | name = "serde_urlencoded" 1191 | version = "0.7.0" 1192 | source = "registry+https://github.com/rust-lang/crates.io-index" 1193 | checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" 1194 | dependencies = [ 1195 | "form_urlencoded", 1196 | "itoa", 1197 | "ryu", 1198 | "serde", 1199 | ] 1200 | 1201 | [[package]] 1202 | name = "sha-1" 1203 | version = "0.9.7" 1204 | source = "registry+https://github.com/rust-lang/crates.io-index" 1205 | checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" 1206 | dependencies = [ 1207 | "block-buffer", 1208 | "cfg-if", 1209 | "cpufeatures", 1210 | "digest", 1211 | "opaque-debug", 1212 | ] 1213 | 1214 | [[package]] 1215 | name = "sha3" 1216 | version = "0.9.1" 1217 | source = "registry+https://github.com/rust-lang/crates.io-index" 1218 | checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" 1219 | dependencies = [ 1220 | "block-buffer", 1221 | "digest", 1222 | "keccak", 1223 | "opaque-debug", 1224 | ] 1225 | 1226 | [[package]] 1227 | name = "signal-hook-registry" 1228 | version = "1.4.0" 1229 | source = "registry+https://github.com/rust-lang/crates.io-index" 1230 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 1231 | dependencies = [ 1232 | "libc", 1233 | ] 1234 | 1235 | [[package]] 1236 | name = "slab" 1237 | version = "0.4.4" 1238 | source = "registry+https://github.com/rust-lang/crates.io-index" 1239 | checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" 1240 | 1241 | [[package]] 1242 | name = "smallvec" 1243 | version = "1.6.1" 1244 | source = "registry+https://github.com/rust-lang/crates.io-index" 1245 | checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" 1246 | 1247 | [[package]] 1248 | name = "socket2" 1249 | version = "0.4.1" 1250 | source = "registry+https://github.com/rust-lang/crates.io-index" 1251 | checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" 1252 | dependencies = [ 1253 | "libc", 1254 | "winapi", 1255 | ] 1256 | 1257 | [[package]] 1258 | name = "soketto" 1259 | version = "0.5.0" 1260 | source = "registry+https://github.com/rust-lang/crates.io-index" 1261 | checksum = "4919971d141dbadaa0e82b5d369e2d7666c98e4625046140615ca363e50d4daa" 1262 | dependencies = [ 1263 | "base64", 1264 | "bytes", 1265 | "futures", 1266 | "httparse", 1267 | "log", 1268 | "rand", 1269 | "sha-1", 1270 | ] 1271 | 1272 | [[package]] 1273 | name = "static_assertions" 1274 | version = "1.1.0" 1275 | source = "registry+https://github.com/rust-lang/crates.io-index" 1276 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1277 | 1278 | [[package]] 1279 | name = "syn" 1280 | version = "1.0.74" 1281 | source = "registry+https://github.com/rust-lang/crates.io-index" 1282 | checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" 1283 | dependencies = [ 1284 | "proc-macro2", 1285 | "quote", 1286 | "unicode-xid", 1287 | ] 1288 | 1289 | [[package]] 1290 | name = "tap" 1291 | version = "1.0.1" 1292 | source = "registry+https://github.com/rust-lang/crates.io-index" 1293 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 1294 | 1295 | [[package]] 1296 | name = "tempfile" 1297 | version = "3.2.0" 1298 | source = "registry+https://github.com/rust-lang/crates.io-index" 1299 | checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" 1300 | dependencies = [ 1301 | "cfg-if", 1302 | "libc", 1303 | "rand", 1304 | "redox_syscall", 1305 | "remove_dir_all", 1306 | "winapi", 1307 | ] 1308 | 1309 | [[package]] 1310 | name = "thiserror" 1311 | version = "1.0.26" 1312 | source = "registry+https://github.com/rust-lang/crates.io-index" 1313 | checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" 1314 | dependencies = [ 1315 | "thiserror-impl", 1316 | ] 1317 | 1318 | [[package]] 1319 | name = "thiserror-impl" 1320 | version = "1.0.26" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" 1323 | dependencies = [ 1324 | "proc-macro2", 1325 | "quote", 1326 | "syn", 1327 | ] 1328 | 1329 | [[package]] 1330 | name = "time" 1331 | version = "0.1.43" 1332 | source = "registry+https://github.com/rust-lang/crates.io-index" 1333 | checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" 1334 | dependencies = [ 1335 | "libc", 1336 | "winapi", 1337 | ] 1338 | 1339 | [[package]] 1340 | name = "tiny-keccak" 1341 | version = "2.0.2" 1342 | source = "registry+https://github.com/rust-lang/crates.io-index" 1343 | checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" 1344 | dependencies = [ 1345 | "crunchy", 1346 | ] 1347 | 1348 | [[package]] 1349 | name = "tinyvec" 1350 | version = "1.3.1" 1351 | source = "registry+https://github.com/rust-lang/crates.io-index" 1352 | checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" 1353 | dependencies = [ 1354 | "tinyvec_macros", 1355 | ] 1356 | 1357 | [[package]] 1358 | name = "tinyvec_macros" 1359 | version = "0.1.0" 1360 | source = "registry+https://github.com/rust-lang/crates.io-index" 1361 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1362 | 1363 | [[package]] 1364 | name = "tokio" 1365 | version = "1.9.0" 1366 | source = "registry+https://github.com/rust-lang/crates.io-index" 1367 | checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c" 1368 | dependencies = [ 1369 | "autocfg", 1370 | "bytes", 1371 | "libc", 1372 | "memchr", 1373 | "mio", 1374 | "num_cpus", 1375 | "once_cell", 1376 | "parking_lot", 1377 | "pin-project-lite", 1378 | "signal-hook-registry", 1379 | "tokio-macros", 1380 | "winapi", 1381 | ] 1382 | 1383 | [[package]] 1384 | name = "tokio-macros" 1385 | version = "1.3.0" 1386 | source = "registry+https://github.com/rust-lang/crates.io-index" 1387 | checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" 1388 | dependencies = [ 1389 | "proc-macro2", 1390 | "quote", 1391 | "syn", 1392 | ] 1393 | 1394 | [[package]] 1395 | name = "tokio-native-tls" 1396 | version = "0.3.0" 1397 | source = "registry+https://github.com/rust-lang/crates.io-index" 1398 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 1399 | dependencies = [ 1400 | "native-tls", 1401 | "tokio", 1402 | ] 1403 | 1404 | [[package]] 1405 | name = "tokio-stream" 1406 | version = "0.1.7" 1407 | source = "registry+https://github.com/rust-lang/crates.io-index" 1408 | checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" 1409 | dependencies = [ 1410 | "futures-core", 1411 | "pin-project-lite", 1412 | "tokio", 1413 | ] 1414 | 1415 | [[package]] 1416 | name = "tokio-util" 1417 | version = "0.6.7" 1418 | source = "registry+https://github.com/rust-lang/crates.io-index" 1419 | checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" 1420 | dependencies = [ 1421 | "bytes", 1422 | "futures-core", 1423 | "futures-io", 1424 | "futures-sink", 1425 | "log", 1426 | "pin-project-lite", 1427 | "tokio", 1428 | ] 1429 | 1430 | [[package]] 1431 | name = "toml" 1432 | version = "0.5.8" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" 1435 | dependencies = [ 1436 | "serde", 1437 | ] 1438 | 1439 | [[package]] 1440 | name = "tower-service" 1441 | version = "0.3.1" 1442 | source = "registry+https://github.com/rust-lang/crates.io-index" 1443 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 1444 | 1445 | [[package]] 1446 | name = "tracing" 1447 | version = "0.1.26" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" 1450 | dependencies = [ 1451 | "cfg-if", 1452 | "pin-project-lite", 1453 | "tracing-core", 1454 | ] 1455 | 1456 | [[package]] 1457 | name = "tracing-core" 1458 | version = "0.1.18" 1459 | source = "registry+https://github.com/rust-lang/crates.io-index" 1460 | checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" 1461 | dependencies = [ 1462 | "lazy_static", 1463 | ] 1464 | 1465 | [[package]] 1466 | name = "try-lock" 1467 | version = "0.2.3" 1468 | source = "registry+https://github.com/rust-lang/crates.io-index" 1469 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 1470 | 1471 | [[package]] 1472 | name = "typenum" 1473 | version = "1.13.0" 1474 | source = "registry+https://github.com/rust-lang/crates.io-index" 1475 | checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" 1476 | 1477 | [[package]] 1478 | name = "ucd-trie" 1479 | version = "0.1.3" 1480 | source = "registry+https://github.com/rust-lang/crates.io-index" 1481 | checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" 1482 | 1483 | [[package]] 1484 | name = "uint" 1485 | version = "0.9.1" 1486 | source = "registry+https://github.com/rust-lang/crates.io-index" 1487 | checksum = "6470ab50f482bde894a037a57064480a246dbfdd5960bd65a44824693f08da5f" 1488 | dependencies = [ 1489 | "byteorder", 1490 | "crunchy", 1491 | "hex", 1492 | "static_assertions", 1493 | ] 1494 | 1495 | [[package]] 1496 | name = "unicode-bidi" 1497 | version = "0.3.5" 1498 | source = "registry+https://github.com/rust-lang/crates.io-index" 1499 | checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" 1500 | dependencies = [ 1501 | "matches", 1502 | ] 1503 | 1504 | [[package]] 1505 | name = "unicode-normalization" 1506 | version = "0.1.19" 1507 | source = "registry+https://github.com/rust-lang/crates.io-index" 1508 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 1509 | dependencies = [ 1510 | "tinyvec", 1511 | ] 1512 | 1513 | [[package]] 1514 | name = "unicode-xid" 1515 | version = "0.2.2" 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" 1517 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 1518 | 1519 | [[package]] 1520 | name = "url" 1521 | version = "2.2.2" 1522 | source = "registry+https://github.com/rust-lang/crates.io-index" 1523 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1524 | dependencies = [ 1525 | "form_urlencoded", 1526 | "idna", 1527 | "matches", 1528 | "percent-encoding", 1529 | ] 1530 | 1531 | [[package]] 1532 | name = "vcpkg" 1533 | version = "0.2.15" 1534 | source = "registry+https://github.com/rust-lang/crates.io-index" 1535 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1536 | 1537 | [[package]] 1538 | name = "version_check" 1539 | version = "0.9.3" 1540 | source = "registry+https://github.com/rust-lang/crates.io-index" 1541 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" 1542 | 1543 | [[package]] 1544 | name = "want" 1545 | version = "0.3.0" 1546 | source = "registry+https://github.com/rust-lang/crates.io-index" 1547 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1548 | dependencies = [ 1549 | "log", 1550 | "try-lock", 1551 | ] 1552 | 1553 | [[package]] 1554 | name = "wasi" 1555 | version = "0.10.2+wasi-snapshot-preview1" 1556 | source = "registry+https://github.com/rust-lang/crates.io-index" 1557 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1558 | 1559 | [[package]] 1560 | name = "wasm-bindgen" 1561 | version = "0.2.75" 1562 | source = "registry+https://github.com/rust-lang/crates.io-index" 1563 | checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" 1564 | dependencies = [ 1565 | "cfg-if", 1566 | "serde", 1567 | "serde_json", 1568 | "wasm-bindgen-macro", 1569 | ] 1570 | 1571 | [[package]] 1572 | name = "wasm-bindgen-backend" 1573 | version = "0.2.75" 1574 | source = "registry+https://github.com/rust-lang/crates.io-index" 1575 | checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f" 1576 | dependencies = [ 1577 | "bumpalo", 1578 | "lazy_static", 1579 | "log", 1580 | "proc-macro2", 1581 | "quote", 1582 | "syn", 1583 | "wasm-bindgen-shared", 1584 | ] 1585 | 1586 | [[package]] 1587 | name = "wasm-bindgen-futures" 1588 | version = "0.4.25" 1589 | source = "registry+https://github.com/rust-lang/crates.io-index" 1590 | checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c" 1591 | dependencies = [ 1592 | "cfg-if", 1593 | "js-sys", 1594 | "wasm-bindgen", 1595 | "web-sys", 1596 | ] 1597 | 1598 | [[package]] 1599 | name = "wasm-bindgen-macro" 1600 | version = "0.2.75" 1601 | source = "registry+https://github.com/rust-lang/crates.io-index" 1602 | checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c" 1603 | dependencies = [ 1604 | "quote", 1605 | "wasm-bindgen-macro-support", 1606 | ] 1607 | 1608 | [[package]] 1609 | name = "wasm-bindgen-macro-support" 1610 | version = "0.2.75" 1611 | source = "registry+https://github.com/rust-lang/crates.io-index" 1612 | checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f" 1613 | dependencies = [ 1614 | "proc-macro2", 1615 | "quote", 1616 | "syn", 1617 | "wasm-bindgen-backend", 1618 | "wasm-bindgen-shared", 1619 | ] 1620 | 1621 | [[package]] 1622 | name = "wasm-bindgen-shared" 1623 | version = "0.2.75" 1624 | source = "registry+https://github.com/rust-lang/crates.io-index" 1625 | checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2" 1626 | 1627 | [[package]] 1628 | name = "web-sys" 1629 | version = "0.3.52" 1630 | source = "registry+https://github.com/rust-lang/crates.io-index" 1631 | checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696" 1632 | dependencies = [ 1633 | "js-sys", 1634 | "wasm-bindgen", 1635 | ] 1636 | 1637 | [[package]] 1638 | name = "web3" 1639 | version = "0.17.0" 1640 | source = "registry+https://github.com/rust-lang/crates.io-index" 1641 | checksum = "cd24abe6f2b68e0677f843059faea87bcbd4892e39f02886f366d8222c3c540d" 1642 | dependencies = [ 1643 | "arrayvec 0.5.2", 1644 | "base64", 1645 | "bytes", 1646 | "derive_more", 1647 | "ethabi", 1648 | "ethereum-types", 1649 | "futures", 1650 | "futures-timer", 1651 | "headers", 1652 | "hex", 1653 | "jsonrpc-core", 1654 | "log", 1655 | "parking_lot", 1656 | "pin-project", 1657 | "reqwest", 1658 | "rlp", 1659 | "secp256k1", 1660 | "serde", 1661 | "serde_json", 1662 | "soketto", 1663 | "tiny-keccak", 1664 | "tokio", 1665 | "tokio-stream", 1666 | "tokio-util", 1667 | "url", 1668 | "web3-async-native-tls", 1669 | ] 1670 | 1671 | [[package]] 1672 | name = "web3-async-native-tls" 1673 | version = "0.4.0" 1674 | source = "registry+https://github.com/rust-lang/crates.io-index" 1675 | checksum = "1f6d8d1636b2627fe63518d5a9b38a569405d9c9bc665c43c9c341de57227ebb" 1676 | dependencies = [ 1677 | "native-tls", 1678 | "thiserror", 1679 | "tokio", 1680 | "url", 1681 | ] 1682 | 1683 | [[package]] 1684 | name = "web3-rust-basics-tutorial" 1685 | version = "0.2.0" 1686 | dependencies = [ 1687 | "dotenv", 1688 | "hex", 1689 | "tokio", 1690 | "web3", 1691 | ] 1692 | 1693 | [[package]] 1694 | name = "winapi" 1695 | version = "0.3.9" 1696 | source = "registry+https://github.com/rust-lang/crates.io-index" 1697 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1698 | dependencies = [ 1699 | "winapi-i686-pc-windows-gnu", 1700 | "winapi-x86_64-pc-windows-gnu", 1701 | ] 1702 | 1703 | [[package]] 1704 | name = "winapi-i686-pc-windows-gnu" 1705 | version = "0.4.0" 1706 | source = "registry+https://github.com/rust-lang/crates.io-index" 1707 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1708 | 1709 | [[package]] 1710 | name = "winapi-x86_64-pc-windows-gnu" 1711 | version = "0.4.0" 1712 | source = "registry+https://github.com/rust-lang/crates.io-index" 1713 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1714 | 1715 | [[package]] 1716 | name = "winreg" 1717 | version = "0.7.0" 1718 | source = "registry+https://github.com/rust-lang/crates.io-index" 1719 | checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" 1720 | dependencies = [ 1721 | "winapi", 1722 | ] 1723 | 1724 | [[package]] 1725 | name = "wyz" 1726 | version = "0.2.0" 1727 | source = "registry+https://github.com/rust-lang/crates.io-index" 1728 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" 1729 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "web3-rust-basics-tutorial" 3 | version = "0.2.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | hex = "0.4" 10 | web3 = "0.17.0" 11 | tokio = { version= "1", features = ["full"] } 12 | dotenv = "0.15.0" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust Web3 basics tutorial 2 | 3 | This repository is a companion repository to my blog post about the basics of connecting to the Ethereum network using Rust and Web3. There is also an example of how to call functions on a smart contract. 4 | 5 | The blog post can be found here: [Rust Web3 connect to Ethereum blockchain: how to](https://tms-dev-blog.com/rust-web3-connect-to-ethereum/). 6 | 7 | ## Set up and run 8 | 9 | The project requires a .env file in the root directory to run properly. The .env file should contain the following: 10 | 11 | ```bash 12 | INFURA_RINKEBY=wss://rinkeby.infura.io/ws/v3/xxxxxxx 13 | ACCOUNT_ADDRESS=xxxxxxxxxx 14 | ``` 15 | 16 | The `INFURA_RINKEBY` value is an endpoint address from [infura.io](https://infura.io), however it can be any valid address to an Ethereum network WebSocket endpoint. 17 | 18 | The `ACCOUNT_ADDRESS` is the address of a Ethereum wallet, not including the "0x" prefix. 19 | 20 | If this configuration is in place the program can be run using cargo: 21 | 22 | ```bash 23 | cargo run 24 | ``` 25 | 26 | -------------------------------------------------------------------------------- /src/erc20_abi.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "inputs": [{ 3 | "internalType": "uint256", 4 | "name": "_initialAmount", 5 | "type": "uint256" 6 | }, { 7 | "internalType": "string", 8 | "name": "_tokenName", 9 | "type": "string" 10 | }, { 11 | "internalType": "uint8", 12 | "name": "_decimalUnits", 13 | "type": "uint8" 14 | }, { 15 | "internalType": "string", 16 | "name": "_tokenSymbol", 17 | "type": "string" 18 | }], 19 | "payable": false, 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, { 23 | "anonymous": false, 24 | "inputs": [{ 25 | "indexed": true, 26 | "internalType": "address", 27 | "name": "owner", 28 | "type": "address" 29 | }, { 30 | "indexed": true, 31 | "internalType": "address", 32 | "name": "spender", 33 | "type": "address" 34 | }, { 35 | "indexed": false, 36 | "internalType": "uint256", 37 | "name": "value", 38 | "type": "uint256" 39 | }], 40 | "name": "Approval", 41 | "type": "event" 42 | }, { 43 | "anonymous": false, 44 | "inputs": [{ 45 | "indexed": true, 46 | "internalType": "address", 47 | "name": "from", 48 | "type": "address" 49 | }, { 50 | "indexed": true, 51 | "internalType": "address", 52 | "name": "to", 53 | "type": "address" 54 | }, { 55 | "indexed": false, 56 | "internalType": "uint256", 57 | "name": "value", 58 | "type": "uint256" 59 | }], 60 | "name": "Transfer", 61 | "type": "event" 62 | }, { 63 | "constant": false, 64 | "inputs": [{ 65 | "internalType": "address", 66 | "name": "_owner", 67 | "type": "address" 68 | }, { 69 | "internalType": "uint256", 70 | "name": "value", 71 | "type": "uint256" 72 | }], 73 | "name": "allocateTo", 74 | "outputs": [], 75 | "payable": false, 76 | "stateMutability": "nonpayable", 77 | "type": "function" 78 | }, { 79 | "constant": true, 80 | "inputs": [{ 81 | "internalType": "address", 82 | "name": "", 83 | "type": "address" 84 | }, { 85 | "internalType": "address", 86 | "name": "", 87 | "type": "address" 88 | }], 89 | "name": "allowance", 90 | "outputs": [{ 91 | "internalType": "uint256", 92 | "name": "", 93 | "type": "uint256" 94 | }], 95 | "payable": false, 96 | "stateMutability": "view", 97 | "type": "function" 98 | }, { 99 | "constant": false, 100 | "inputs": [{ 101 | "internalType": "address", 102 | "name": "_spender", 103 | "type": "address" 104 | }, { 105 | "internalType": "uint256", 106 | "name": "amount", 107 | "type": "uint256" 108 | }], 109 | "name": "approve", 110 | "outputs": [{ 111 | "internalType": "bool", 112 | "name": "", 113 | "type": "bool" 114 | }], 115 | "payable": false, 116 | "stateMutability": "nonpayable", 117 | "type": "function" 118 | }, { 119 | "constant": true, 120 | "inputs": [{ 121 | "internalType": "address", 122 | "name": "", 123 | "type": "address" 124 | }], 125 | "name": "balanceOf", 126 | "outputs": [{ 127 | "internalType": "uint256", 128 | "name": "", 129 | "type": "uint256" 130 | }], 131 | "payable": false, 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, { 135 | "constant": true, 136 | "inputs": [], 137 | "name": "decimals", 138 | "outputs": [{ 139 | "internalType": "uint8", 140 | "name": "", 141 | "type": "uint8" 142 | }], 143 | "payable": false, 144 | "stateMutability": "view", 145 | "type": "function" 146 | }, { 147 | "constant": true, 148 | "inputs": [], 149 | "name": "name", 150 | "outputs": [{ 151 | "internalType": "string", 152 | "name": "", 153 | "type": "string" 154 | }], 155 | "payable": false, 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, { 159 | "constant": true, 160 | "inputs": [], 161 | "name": "symbol", 162 | "outputs": [{ 163 | "internalType": "string", 164 | "name": "", 165 | "type": "string" 166 | }], 167 | "payable": false, 168 | "stateMutability": "view", 169 | "type": "function" 170 | }, { 171 | "constant": true, 172 | "inputs": [], 173 | "name": "totalSupply", 174 | "outputs": [{ 175 | "internalType": "uint256", 176 | "name": "", 177 | "type": "uint256" 178 | }], 179 | "payable": false, 180 | "stateMutability": "view", 181 | "type": "function" 182 | }, { 183 | "constant": false, 184 | "inputs": [{ 185 | "internalType": "address", 186 | "name": "dst", 187 | "type": "address" 188 | }, { 189 | "internalType": "uint256", 190 | "name": "amount", 191 | "type": "uint256" 192 | }], 193 | "name": "transfer", 194 | "outputs": [{ 195 | "internalType": "bool", 196 | "name": "", 197 | "type": "bool" 198 | }], 199 | "payable": false, 200 | "stateMutability": "nonpayable", 201 | "type": "function" 202 | }, { 203 | "constant": false, 204 | "inputs": [{ 205 | "internalType": "address", 206 | "name": "src", 207 | "type": "address" 208 | }, { 209 | "internalType": "address", 210 | "name": "dst", 211 | "type": "address" 212 | }, { 213 | "internalType": "uint256", 214 | "name": "amount", 215 | "type": "uint256" 216 | }], 217 | "name": "transferFrom", 218 | "outputs": [{ 219 | "internalType": "bool", 220 | "name": "", 221 | "type": "bool" 222 | }], 223 | "payable": false, 224 | "stateMutability": "nonpayable", 225 | "type": "function" 226 | }] -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::str::FromStr; 3 | 4 | use web3::contract::{Contract, Options}; 5 | use web3::types::{Address, H160, U256}; 6 | 7 | fn wei_to_eth(wei_val: U256) -> f64 { 8 | let res = wei_val.as_u128() as f64; 9 | res / 1_000_000_000_000_000_000.0 10 | } 11 | 12 | #[tokio::main] 13 | async fn main() -> web3::Result<()> { 14 | dotenv::dotenv().ok(); 15 | 16 | let websocket = web3::transports::WebSocket::new(&env::var("INFURA_RINKEBY").unwrap()).await?; 17 | let web3s = web3::Web3::new(websocket); 18 | 19 | let mut accounts = web3s.eth().accounts().await?; 20 | accounts.push(H160::from_str(&env::var("ACCOUNT_ADDRESS").unwrap()).unwrap()); 21 | println!("Accounts: {:?}", accounts); 22 | 23 | for account in accounts { 24 | let balance = web3s.eth().balance(account, None).await?; 25 | println!("Eth balance of {:?}: {}", account, wei_to_eth(balance)); 26 | } 27 | 28 | let aave_addr = Address::from_str("0x42447d5f59d5bf78a82c34663474922bdf278162").unwrap(); 29 | let token_contract = 30 | Contract::from_json(web3s.eth(), aave_addr, include_bytes!("erc20_abi.json")).unwrap(); 31 | 32 | let token_name: String = token_contract 33 | .query("name", (), None, Options::default(), None) 34 | .await 35 | .unwrap(); 36 | 37 | let total_supply: U256 = token_contract 38 | .query("totalSupply", (), None, Options::default(), None) 39 | .await 40 | .unwrap(); 41 | 42 | println!("Token name: {}, total supply: {}", token_name, total_supply); 43 | 44 | Ok(()) 45 | } 46 | --------------------------------------------------------------------------------